public static function display($model) { if (null === $model || false === $model) { return $model; } if (is_array($model) && !empty($model['_view_mode'])) { $viewMode = $model['_view_mode']; unset($model['_view_mode']); } else { $viewMode = Request::getViewMode(); if (empty($viewMode)) { if (Request::isAjax()) { $viewMode = 'Json'; } else { $viewMode = 'Php'; } } } $view = ZView::getInstance($viewMode); if ('Php' === $viewMode) { $_tpl_file = Request::getTplFile(); if (is_array($model) && !empty($model['_tpl_file'])) { $_tpl_file = $model['_tpl_file']; unset($model['_tpl_file']); } if (empty($_tpl_file)) { throw new \Exception("tpl file empty"); } $view->setTpl($_tpl_file); } $view->setModel($model); return $view->display(); }
public function display($model) { if (empty($this->_view_mode)) { $viewMode = Config::getField('project', 'view_mode', 'String'); } else { $viewMode = $this->_view_mode; } $this->_view_mode = ''; $view = View\Factory::getInstance($viewMode); $view->setModel($model); $view->display(); }
public function display($model) { // ($viewMode = $this->_view_mode) || ($viewMode = Config::getField('project', 'view_mode', '')); if ($this->_view_mode) { $viewMode = $this->_view_mode; } else { $viewMode = Config::getField('project', 'view_mode'); } if (is_array($model) && !empty($model['_view_mode'])) { $viewMode = $model['_view_mode']; unset($model['_view_mode']); } $this->_view_mode = null; if (empty($viewMode)) { if (ZUtils::isAjax()) { $viewMode = 'Json'; } else { $viewMode = 'Php'; } } $view = View\Factory::getInstance($viewMode); if ('Php' === $viewMode) { if (is_array($model) && !empty($model['_tpl_file'])) { $view->setTpl($model['_tpl_file']); unset($model['_tpl_file']); } else { if (!empty($this->_tpl_file)) { $view->setTpl($this->_tpl_file); $this->_tpl_file = null; } else { throw new \Exception("tpl file empty"); } } } $view->setModel($model); return $view->display(); }
public static final function fatalHandler() { $error = \error_get_last(); if (empty($error)) { return; } if (!in_array($error['type'], array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR))) { return; } Utils::status('200'); $exceptionView = View\Factory::getInstance(); $exceptionView->setModel(Formater::fatal($error)); $exceptionView->display(); }
public static final function exceptionHandler($exception) { $exceptionView = View\Factory::getInstance(); $exceptionView->setModel(Formater::exception($exception)); $exceptionView->display(); }
public function display($model) { $data = array(); if (is_array($model)) { $data = $model; } else { $data['data'] = $model; } $data['fd'] = $this->fd; $data['cmd'] = $this->_cmd; $data['rid'] = $this->_rid; if (empty($data['_view_mode'])) { $viewMode = 'ZRpack'; } else { $viewMode = $data['_view_mode']; } $view = View\Factory::getInstance($viewMode); $view->setModel($data); return $view->display(); //$this->_data = $data; //return array($data, $this->getData()); }