Example #1
0
 /**
  * Create URI object which determines dispatch method and
  * perform dispatch
  *
  * @param bool $fake
  *
  * @return void
  */
 public function dispatch($fake = false)
 {
     $this->uri = new URI($this->defaultModule, $this->dynamicModule);
     $error = $this->uri->getError();
     if ($error == URI::MISSING_CLASS && isset($this->dynamicModule) && $this->dynamicModule != '') {
         $error = $this->uri->dynamicSection();
     }
     if ($error > 0) {
         if ($this->environment == 'prod' || $this->debug_mode == false) {
             if ($error == URI::MISSING_CLASS || $error == URI::MISSING_EVENT_DEF || $error == URI::ERROR_404) {
                 throw new RequestException('Not found', RequestException::NOT_FOUND);
             }
         } else {
             throw new Exception('Dispatch error ' . $error . ' : ' . $this->uri->getErrorMessage());
         }
     }
     $controller_name = $this->uri->getControllerName();
     $this->controller = new $controller_name($this);
     $this->plugin_manager->preEvent();
     if ($fake == false) {
         $event_val = $this->controller->{$_GET}['event']();
         if ($this->mvc->hasErrors()) {
             throw new ErrorException($this->mvc->errorsToString());
         } elseif ($event_val !== false) {
             if ($this->uri->getInternal()) {
                 $this->controller->setTemplate('empathy.tpl');
                 $this->display(true);
             } else {
                 $this->display(false);
             }
         }
     }
 }
 /**
  * This is overrided to manage is behaviour
  * if a customer access to the site with mobile device.
  */
 public function setTemplate($default_template)
 {
     if ($this->useMobileTheme()) {
         $this->setMobileTemplate($default_template);
     } else {
         $template = $this->getOverrideTemplate();
         if ($template) {
             parent::setTemplate($template);
         } else {
             parent::setTemplate($default_template);
         }
     }
 }
 /**
  * This is overrided to manage is behaviour
  * if a customer access to the site with mobile device.
  */
 public function setTemplate($default_template)
 {
     if ($this->context->getMobileDevice() != false) {
         $this->setMobileTemplate($default_template);
     } else {
         $template = $this->getOverrideTemplate();
         if ($template) {
             parent::setTemplate($template);
         } else {
             parent::setTemplate($default_template);
         }
     }
 }
Example #4
0
 /**
  * Sets template file for page content output.
  *
  * @param string $default_template
  */
 public function setTemplate($template, $params = array(), $locale = null)
 {
     parent::setTemplate($this->getTemplateFile($template, $params, $locale = null));
 }
Example #5
0
/**
 * translationmanager.php
 * Copyright Rysty 2004:
 *   Teemu Lahtela
 *   Jukka Kaartinen
 *   Teemu Siitarinen
 *
 * author: tepe
 * created: 11.01.2005
 *
*/
// for testing
error_reporting(E_ALL);
ini_set('include_path', '.:./inc:./view:./toiminnot:./directorylisting:./templates:./components');
// do buffering
ob_start();
// initialize sessions
ini_set("session.use_only_cookies", "1");
session_start();
require_once "config.php";
require_once "controller.php";
// tätä ei pakosta tarvittais
header("Content-Type: text/html; charset=ISO-8859-1");
$controller = new Controller();
// template on asetettava ennen toiminnon suorittamista
$controller->setTemplate($TEMPLATE);
$controller->processToiminto();
$controller->drawTemplate();
// end buffering
ob_end_flush();