Exemplo n.º 1
0
<?php

/**
 * 
 * @package MVC
 */
include_once $cfg['DBAL']['dir']['root'] . '/BasicGenericObjectCollection.class.php';
include_once $cfg['DBAL']['dir']['root'] . '/Database.class.php';
include_once $cfg['MVC']['dir']['root'] . '/IController.class.php';
include_once $cfg['MVC']['dir']['root'] . '/MVCUtils.class.php';
MVCUtils::includeViewer('Viewer', 'MVC');
//include_once($cfg['MVC']['dir']['root'] . '/validators/EmailValidator.class.php');
/**
 * Processes request data and constructs an aparopiate model or viewer
 * 
 * This class is used by simply initialising. Input data is taken 
 * from superglobals.
 * 
 * 
 * @package MVC
 */
class Page implements IController
{
    /**
     * The module of this class, used in debugging
     */
    const module = 'MVC';
    /**
     * The ID of the template to use. The ID is that of the row in the database
     * @var int
     */
<?php

/**
 * @package FrontEnds
 * @subpackage CMS
 */
include_once $cfg['MVC']['dir']['root'] . '/MVCUtils.class.php';
MVCUtils::includeViewer('EditContentWindowViewer', 'CMS');
class EditContentViewer extends EditContentWindowViewer
{
    protected function setupTemplate()
    {
        global $cfg;
        parent::setupTemplate();
        $db = Database::getInstance($cfg['MVC']['dsn']);
        $sql = 'SELECT regionid FROM cmsregions ORDER BY name';
        $rIDs = $db->getColumn($sql);
        $sql = 'SELECT name FROM cmsregions ORDER BY name';
        $rNames = $db->getColumn($sql);
        $regions = array_combine($rIDs, $rNames);
        $this->assign('regions', $regions);
        if (isset($this->fieldData['regionID'])) {
            $sql = 'SELECT cmsregions.inlinetoolbar, 
			               cmsregions.windowtoolbar, 
			               cmsregions.editrealm, 
			               cmsregions.viewrealm,
			               cmsregions.name FROM cmsregions 
			       WHERE cmsregions.regionid = ?';
            $regionData = $db->getRow($sql, array($this->fieldData['regionID']));
            $this->assign('inlineToolbar', $regionData['inlinetoolbar']);
            $this->assign('windowToolbar', $regionData['windowtoolbar']);
<?php

/**
 * @package FrontEnds
 * @subpackage Auth
 */
include_once $cfg['MVC']['dir']['root'] . '/MVCUtils.class.php';
MVCUtils::includeViewer('Viewer', 'tkfecommon');
class LocationViewer extends Viewer
{
    protected function setupTemplate()
    {
        parent::setupTemplate();
        global $cfg;
        $db = Database::getInstance($cfg['DPS']['dsn']);
        $sql = "SELECT DISTINCT location as locid, location as locname \n\t\t\tFROM configuration \n\t\t\tWHERE location != -1 AND \n\t\t\t\tlocation != 0\n\t\t\tORDER BY location ASC";
        $locs = $db->getAll($sql);
        $this->assign('locs', $locs);
    }
}
<?php

/**
 * @package DPS
 */
include_once $cfg['MVC']['dir']['root'] . '/MVCUtils.class.php';
MVCUtils::includeViewer('AuthViewer', 'Auth');
class DPSLogoutViewer extends AuthViewer
{
    protected function setupTemplate()
    {
        parent::setupTemplate();
        $auth = Auth::getInstance();
        $auth->logout();
    }
}
 /**
  * Initialise a viewer object
  *
  * This method will intialise the viewer class associated with the specified  
  * model and template. The name of the class is loaded from the database,
  * the file is included, an instance is initialised, and finally assigned
  * to the $viewer class variable.
  *
  */
 public static function initializeViewer($templateIDS, $formName = null, $viewerModuleName, $fieldData = array(), $errors = array())
 {
     global $cfg;
     $db = Database::getInstance($cfg['MVC']['dsn']);
     $sql = "SELECT viewerclassname FROM templates WHERE templateid = ?";
     $classname = $db->getOne($sql, array(end($templateIDS)));
     MVCUtils::includeViewer($classname, $viewerModuleName);
     $pathParts = pathinfo($classname);
     $realClassName = $pathParts['basename'];
     eval("\$newViewer = new {$realClassName}(\$templateIDS, \$formName, \$viewerModuleName, \$fieldData, \$errors);");
     return $newViewer;
 }
Exemplo n.º 6
0
<?php

/**
 * @package FrontEnds
 * @subpackage Auth
 */
include_once 'config.php';
include_once $cfg['MVC']['dir']['root'] . '/Page.class.php';
include_once $cfg['Auth']['dir']['root'] . '/AuthUtil.class.php';
MVCUtils::includeViewer('ExceptionViewer', 'MVC');
$c = new Page();
<?php

include_once $cfg['MVC']['dir']['root'] . '/IController.class.php';
MVCUtils::includeViewer('RenderedExceptionViewer', 'MVC');
class Renderer implements IController
{
    /**
     * The module of this class, used in debugging
     */
    const module = 'MVC';
    /**
     * The ID of the template to use. The ID is that of the row in the database
     * @var int
     */
    protected $templateIDStack;
    /**
     * The name of the form (if any) which has been submitted
     * @var string
     */
    protected $formName;
    /**
     * An associative array for field/value pairs from the submitted form (if any)
     * @var array
     */
    protected $fieldData;
    protected $viewer;
    protected $viewerModuleName;
    protected $errors;
    /**
     * Initialise the Renderer object
     *