private function __construct() { $this->sessionScope = SessionScope::instance(); $this->pageScope = PageScope::instance(); $this->requestScope = RequestScope::instance(); $this->eventScope = EventScope::instance(); }
public function __construct($config = array()) { // module name parent::__construct('zool', $config); $this->config = new Configuration($config); // set_error_handler(array($this, 'errorHandler')); //set_exception_handler(array($this, 'exceptionHandler')); $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $reRender = isset($_REQUEST['reRender']) ? $_REQUEST['reRender'] : null; $zoolForm = isset($_REQUEST['zoolForm']) ? $_REQUEST['zoolForm'] : null; $viewAlias = Request::instance()->getViewId(); $viewAlias = ($viewAlias == null ? 'app.view/index' : $viewAlias) . '.zool'; $this->viewProvider = new HtmlViewProvider($viewAlias); /** * Input value binding */ if ($zoolForm !== null && is_array($zoolForm)) { foreach ($zoolForm as $key => $value) { list($var, $scope) = explode(':', $key, 2); try { if ($scope == UNSPECIFIED_SCOPE) { $scope = EVENT_SCOPE; } Scopes::instance()->setToScope($scope, $var, $value); } catch (ZException $e) { throw new ZException($e->getMessage()); } } } if ($action !== null) { $methodExpression = PageScope::instance()->get($action); if ($methodExpression instanceof ZMethodExpression) { $methodExpression->run(); } // there is no outputing } EventScope::instance()->reset(); if ($reRender !== null) { $this->viewProvider->handleReRender(); } if ($action !== null || $reRender !== null) { die; } }