public function indexAction() { $project = $this->_getProject(); $template = new Template(); $template->project = $project; $template->disableCache(); echo $template->render(Application::getTemplatesPath() . 'designer/project_debug.php'); }
/** * Validate object action */ public function validateAction() { $engineUpdate = false; $name = Request::post('name', 'string', false); if (!$name) { Response::jsonError($this->_lang->WRONG_REQUEST); } $objectConfig = Db_Object_Config::getInstance($name); // Check ACL permissions $acl = $objectConfig->getAcl(); if ($acl) { if (!$acl->can(Db_Object_Acl::ACCESS_CREATE, $name) || !$acl->can(Db_Object_Acl::ACCESS_VIEW, $name)) { Response::jsonError($this->_lang->get('ACL_ACCESS_DENIED')); } } try { $obj = new Db_Object($name); } catch (Exception $e) { Response::jsonError($this->_lang->get('CANT_GET_VALIDATE_INFO')); } $builder = new Db_Object_Builder($name); $tableExists = $builder->tableExists(); $colUpd = array(); $indUpd = array(); $keyUpd = array(); if ($tableExists) { $colUpd = $builder->prepareColumnUpdates(); $indUpd = $builder->prepareIndexUpdates(); $keyUpd = $builder->prepareKeysUpdate(); $engineUpdate = $builder->prepareEngineUpdate(); } if (empty($colUpd) && empty($indUpd) && empty($keyUpd) && $tableExists && !$engineUpdate) { Response::jsonSuccess(array(), array('nothingToDo' => true)); } $template = new Template(); $template->disableCache(); $template->engineUpdate = $engineUpdate; $template->columns = $colUpd; $template->indexes = $indUpd; $template->keys = $keyUpd; $template->tableExists = $tableExists; $template->tableName = $obj->getTable(); $template->lang = $this->_lang; $msg = $template->render(Application::getTemplatesPath() . 'orm_validate_msg.php'); Response::jsonSuccess(array(), array('text' => $msg, 'nothingToDo' => false)); }
/** * Show Page. * Running this method initiates rendering of templates and sending of HTML * data. * * @param Page $page * @param Blockmanager $blockManager */ public function showPage(Page $page, Blockmanager $blockManager) { header('Content-Type: text/html; charset=utf-8'); $template = new Template(); $template->disableCache(); $template->setProperties(array('development' => $this->_appConfig->get('development'), 'page' => $page, 'path' => $page->getThemePath(), 'templatesRoot' => Application::getTemplatesPath(), 'blockManager' => $blockManager, 'resource' => Resource::getInstance(), 'pagesTree' => Model::factory('Page')->getTree())); Response::put($template->render($page->getTemplatePath('layout.php'))); }
/** * Run backend application */ protected function _runBackend() { if ($this->_cache) { Blockmanager::setDefaultCache($this->_cache); } /* * Prepare objects */ Db_Object_Builder::useForeignKeys($this->_config->get('foreign_keys')); /* * Inject Externals exper ino Objects Manager */ if ($this->_config->get('allow_externals')) { Db_Object_Manager::setExternalsExpert($this->_getExternalsExpert()); } $cfgBackend = Config::factory(Config::File_Array, $this->_config->get('configs') . 'backend.php'); Registry::set('backend', $cfgBackend, 'config'); self::$_templates = $this->_config->get('templates') . 'system/' . $cfgBackend->get('theme') . '/'; $page = Page::getInstance(); $page->setTemplatesPath(self::$_templates); $user = User::getInstance(); /* * Update "Users Online" statistics */ if ($this->_config->get('usersOnline') && $user->isAuthorized()) { Model::factory('Online')->addOnline(session_id(), $user->id); } /* * Start routing */ $router = new Backend_Router(); $router->route(); $controller = Request::getInstance()->getPart(1); /* * Define frontent JS variables */ $res = Resource::getInstance(); $res->addInlineJs(' app.wwwRoot = "' . $this->_config->get('wwwroot') . '"; app.admin = "' . $this->_config->get('wwwroot') . $this->_config->get('adminPath') . '"; app.delimiter = "' . $this->_config->get('urlDelimiter') . '"; app.root = "' . $this->_config->get('wwwroot') . $this->_config->get('adminPath') . $this->_config->get('urlDelimiter') . $controller . $this->_config->get('urlDelimiter') . '"; '); /* * Load template */ $template = new Template(); $template->disableCache(); $template->setProperties(array('wwwRoot' => $this->_config->get('wwwroot'), 'page' => $page, 'urlPath' => $controller, 'resource' => $res, 'path' => self::$_templates, 'adminPath' => $this->_config->get('adminPath'), 'development' => $this->_config->get('development'), 'version' => Config::factory(Config::File_Array, $this->_config->get('configs') . 'versions.php')->get('core'), 'lang' => $this->_config->get('language'), 'modules' => Config::factory(Config::File_Array, $this->_config->get('backend_modules')), 'userModules' => $user->getAvailableModules(), 'useCSRFToken' => $cfgBackend->get('use_csrf_token'))); Response::put($template->render(self::$_templates . 'layout.php')); }