Exemplo n.º 1
0
 /**
  * Grabs the THEME template directory unless layout is not
  * operational
  */
 public static function getTplDir($module)
 {
     if ($module == 'core') {
         return PHPWS_SOURCE_DIR . 'core/templates/';
     }
     if (!class_exists('Layout')) {
         return PHPWS_SOURCE_DIR . "mod/{$module}/templates/";
     }
     $theme = Layout::getThemeDirRoot() . Layout::getTheme();
     return sprintf('%s/templates/%s/', $theme, $module);
 }
Exemplo n.º 2
0
 /**
  * Inserts the content data into the current theme
  */
 public static function loadTheme($theme, $template)
 {
     $tpl = new PHPWS_Template();
     $tpl->setRoot(PHPWS_SOURCE_DIR);
     $themeDir = Layout::getThemeDir();
     if (PHPWS_Error::isError($themeDir)) {
         PHPWS_Error::log($themeDir);
         PHPWS_Core::errorPage();
     }
     $result = $tpl->setFile($themeDir . 'theme.tpl', TRUE);
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     if (!empty($GLOBALS['Layout_Collapse'])) {
         $template['COLLAPSE'] = 'id="layout-collapse"';
     }
     $template['THEME_DIRECTORY'] = Layout::getThemeDirRoot() . $theme . '/';
     $template['THEME_HTTP'] = Layout::getThemeHttpRoot() . $theme . '/';
     $template['SOURCE_THEME_HTTP'] = PHPWS_SOURCE_HTTP . 'themes/';
     $template['SOURCE_THEME_DIR'] = PHPWS_SOURCE_DIR . 'themes/';
     $tpl->setData($template);
     return $tpl;
 }
Exemplo n.º 3
0
 public static function getThemeList()
 {
     PHPWS_Core::initCoreClass('File.php');
     return PHPWS_File::readDirectory(Layout::getThemeDirRoot(), 1);
 }
 public function loadSettings($theme = null)
 {
     $db = new PHPWS_DB('layout_config');
     $result = $db->loadObject($this, false);
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         PHPWS_Core::errorPage();
     }
     if ($theme && is_dir(Layout::getThemeDirRoot() . $theme)) {
         $this->default_theme = $theme;
     }
     if (empty($this->current_theme)) {
         $this->current_theme = $this->default_theme;
     }
     $themeInit = Layout::getThemeDirRoot() . $this->current_theme . '/theme.ini';
     if (is_file($themeInit)) {
         $themeVars = parse_ini_file($themeInit, true);
         $this->loadBoxSettings($themeVars);
         $this->loadStyleSheets($themeVars);
     } else {
         PHPWS_Error::log(LAYOUT_INI_FILE, 'layout', 'Layout_Settings::loadSettings', $themeInit);
         //PHPWS_Core::errorPage();
     }
     if (Current_User::isDeity()) {
         $this->deity_reload = true;
     }
 }