<?php
namespace com\whitemagicsoftware;
require "constants.php";
require "class.BaseController.php";
class Instructions extends BaseController {
function __construct() {
parent::__construct();
}
protected function getAuthorizationFunctionName() {
return "is_authorized_account";
}
protected function getLastResortId() {
return $this->getAccountId();
}
protected function getStylesheetName() {
return "xsl/instructions.xsl";
}
private function getXml() {
$result = $this->call( "generate_instruction_group_xml", "x",
$this->getId() );
return isset( $result ) ?
$result[0]["x"] : $this->getErrorXml( "directions" );
}
protected function isEditable() {
return true;
}
protected function getParameterIdName() {
return "id";
}
protected function exists( $id ) {
return $this->isTrue(
$this->call( "is_existing_instruction_group", "exists", $id ) );
}
protected function getXhtml() {
$xslt = $this->getXsltEngine();
$xslt->setXml( $this->getXml() );
$xslt->setStylesheet( $this->getStylesheetName() );
$xslt->setParameter( $this->getParameterIdName(), $this->getId() );
$xslt->setParameter( "editable", $this->isEditable() );
return $xslt->transform();
}
protected function handleRequest() {
$command = $this->getCommand();
$subcommand = $this->getSubCommand();
if( $command === "view" and $subcommand === "xml" ) {
$this->sendHttpHeaders( "application/xml" );
echo getXml();
}
else {
$this->render();
}
}
}