questlab/app/views/StationtypeView.inc

80 lines
2.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Questlab
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
* @copyright 2014 2016 Heinrich-Heine-Universität Düsseldorf
* @license http://www.gnu.org/licenses/gpl.html
* @link https://github.com/coderkun/questlab
*/
namespace hhu\z\views;
/**
* Abstract class for implementing a StationtypeView.
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
*/
class StationtypeView extends \nre\core\View
{
/**
* Load and instantiate the StationtypeView of a StationtypeAgent.
*
* @throws \nre\exceptions\ViewNotFoundException
* @param string $layoutName Name of Layout in use
* @param string $agentName Name of the Agent
* @param string $action Current Action
* @param bool $isToplevel Agent is a ToplevelAgent
*/
public static function loadAndFactory($layoutName, $agentName=null, $action=null, $isToplevel=false)
{
return new StationtypeView($layoutName, $agentName, $action, $isToplevel);
}
/**
* Construct a new StationtypeView.
*
* @throws \nre\exceptions\ViewNotFoundException
* @param string $layoutName Name of Layout in use
* @param string $agentName Name of the Agent
* @param string $action Current Action
* @param bool $isToplevel Agent is a ToplevelAgent
*/
protected function __construct($layoutName, $agentName=null, $action=null, $isToplevel=false)
{
// Create template filename
// LayoutName
$fileName = ROOT.DS.
\nre\configs\AppConfig::$dirs['stationtypes'].DS.
strtolower($agentName).DS.
strtolower($layoutName).DS;
// Action
$fileName .= strtolower($action);
// File extension
$fileName .= \nre\configs\CoreConfig::getFileExt('views');
// Check template file
if(!file_exists($fileName)) {
throw new \nre\exceptions\ViewNotFoundException($fileName);
}
// Save filename
$this->templateFilename = $fileName;
}
}
?>