Example #1
0
 /**
  * Controller constructor.  Grabs certain properties from the boot object, establishes the view
  * from the plugin manager and assigns certain information to view making it available to templates.
  *
  * @param Bootstrap $boot the current bootstrap object
  */
 public function __construct($boot)
 {
     $this->boot = $boot;
     $this->cli_mode = $boot->getURICliMode();
     $this->initError = $boot->getURIError();
     $this->uri_data = $boot->getURIData();
     $this->plugin_manager = $boot->getPluginManager();
     $this->plugin_manager->setController($this);
     $this->environment = $boot->getEnvironment();
     $this->stash = new Stash();
     $this->connected = false;
     $this->module = $_GET['module'];
     $this->class = $_GET['class'];
     $this->event = $_GET['event'];
     if (defined('TITLE')) {
         $this->title = TITLE;
     }
     if (!defined('TPL_BY_CLASS') || TPL_BY_CLASS) {
         $this->templateFile = $this->class . '.tpl';
     } else {
         $this->templateFile = $this->module . '.tpl';
     }
     Session::up();
     // get presenter
     $this->presenter = $this->plugin_manager->getView();
     if ($this->presenter !== null) {
         $this->assignControllerInfo();
         $this->assignConstants();
         $this->assignEnvironment();
     }
     // if within CMS assign the current section name to the template
     if (isset($_GET['section_uri'])) {
         $this->assign('section', $_GET['section_uri']);
     }
 }