Smarty(); /* define some directories */ $workflowHomeDirectory = isset($_SESSION['phpgw_info']['workflow']['vfs_basedir']) ? $_SESSION['phpgw_info']['workflow']['vfs_basedir'] . '/workflow': $GLOBALS['phpgw_info']['server']['files_dir'] . '/workflow'; $smartyDirectory = $workflowHomeDirectory . '/smarty'; $templateSet = isset($_SESSION['phpgw_info']['workflow']['server']['template_set']) ? $_SESSION['phpgw_info']['workflow']['server']['template_set'] : $GLOBALS['phpgw_info']['server']['template_set']; $documentRoot = isset($_SESSION['phpgw_info']['workflow']['server_root']) ? $_SESSION['phpgw_info']['workflow']['server_root'] : $_SERVER['DOCUMENT_ROOT'] . $GLOBALS['phpgw_info']['server']['webserver_url']; /* list of directories used by the Smarty Template Engine */ $directories = array( 'home' => $workflowHomeDirectory, 'main' => $smartyDirectory, 'template' => array( "{$documentRoot}/workflow/templates/{$templateSet}", "{$documentRoot}/workflow/templates/default" ), 'compile' => $smartyDirectory . '/compile', 'config' => $smartyDirectory . '/config', 'cache' => $smartyDirectory . '/cache' ); /* if necessary, create the directories */ if (!is_dir($directories['main'])) foreach ($directories as $key => $dir) if ($key != 'template') if (!is_dir($dir)) @mkdir($dir,0770); /* setup the Smarty configuration */ $this->template_dir = $directories['template']; $this->compile_dir = $directories['compile']; $this->config_dir = $directories['config']; $this->cache_dir = $directories['cache']; $this->plugins_dir[] = $documentRoot . '/workflow/inc/smarty/module_plugins'; if ($createHeader) $this->setHeader(workflow_smarty::SHOW_HEADER | workflow_smarty::SHOW_NAVIGATION_BAR | workflow_smarty::SHOW_FOOTER); } /** * Define os elementos do template padrão, do ExpressoLivre, que serão exibidos * @param int $config Um inteiro que representa quais os elementos que serão exibidos * @param string $applicationTitle O título da aplicação, opcional (valor padrão: Workflow) * @return void * @access public */ public function setHeader($config, $applicationTitle = 'Workflow') { $this->showHeader = (bool) ($config & workflow_smarty::SHOW_HEADER); $this->showNavigationBar = (bool) ($config & workflow_smarty::SHOW_NAVIGATION_BAR); $this->showFooter = (bool) ($config & workflow_smarty::SHOW_FOOTER); $this->showHeader = $this->showHeader || $this->showNavigationBar; $GLOBALS['phpgw_info']['flags']['app_header'] = $applicationTitle; $GLOBALS['phpgw_info']['flags'] = array( 'noheader' => true, 'nonavbar' => true, 'currentapp' => 'workflow' ); $this->createHeader(); } /** * Cria o cabeçalho de acordo com os elementos selecionados * @return void * @access private */ private function createHeader() { /* get the header code */ if ($this->showHeader) { ob_start(); $GLOBALS['phpgw']->common->phpgw_header(); if ($this->showNavigationBar) parse_navbar(); $this->expressoHeader = ob_get_contents(); ob_end_clean(); } /* get the footer code */ if ($this->showFooter) { ob_start(); $GLOBALS['phpgw']->common->phpgw_footer(); $this->expressoFooter = ob_get_contents(); ob_end_clean(); } } } ?>