/** * assign all public members of the storage-object either to a (*default*) placeholder * or to a new member of the view * @param string $toPlaceholder * @return View */ public function assignViewVars($toPlaceholder = 'content') { $placeholder = $this->_view->getPlaceholder(); if ($placeholder !== $toPlaceholder) { $this->_view->setDefaultPlaceholder($toPlaceholder); } $this->_view->{$toPlaceholder} = $this->getData(); return $this->_view; }
/** * ctor-function to initialize basic controller behaviour */ public function __construct() { $server = php_sapi_name(); if ('cli' !== $server) { $this->_request = new Request\Http(); $this->_response = new Response\Http($this->_request); } $className = get_class($this); $classArray = explode('\\', $className); $module = array_shift($classArray); $this->view = Mvc\ModuleSetup::getInstance($module)->get(['View' => 'config']); $this->view->setRequest($this->getRequest()); $this->_model = new Mvc\Model\ViewContainer($this->view); $this->init(); }