Beispiel #1
0
 public function getRoleType()
 {
     if ($this->roleType == '') {
         return Gpf_Session::getModule()->getRoleType();
     }
     return $this->roleType;
 }
 /**
  *
  * @param string $templateSource if $fetchType is FETCH_FILE,
  *                                  then $templateSource is template file name
  *                               if $fetchType is FETCH_TEXT,
  *                                  then $templateSource is template source as a string
  * @param string $panelName optional
  * @param string $fetchType FETCH_FILE (default) or FETCH_TEXT
  */
 public function __construct($templateSource, $panelName = '', $fetchType = self::FETCH_FILE, $theme = '')
 {
     if ($theme == '') {
         $this->theme = Gpf_Session::getAuthUser()->getTheme();
         $this->paths = Gpf_Paths::getInstance();
     } else {
         $this->theme = $theme;
         $this->paths = Gpf_Paths::getInstance()->clonePaths($theme);
     }
     if ($panelName == '') {
         $this->panel = Gpf_Session::getModule()->getPanelName();
     } else {
         $this->panel = $panelName;
     }
     $this->basePath = $this->paths->getTopPath();
     if ($fetchType == self::FETCH_FILE) {
         $this->initFetchFromFile($templateSource);
     } else {
         $this->initFetchFromText($templateSource);
     }
     $this->addPluginsDirectories();
     $this->setAndCheckCompileDir();
     $this->smarty->register_prefilter(array(&$this, 'preProcess'));
     $this->assign('basePath', $this->paths->getBaseServerUrl());
     $this->assign('imgPath', $this->getImgUrl());
     $this->assign('logoutUrl', $this->getLogoutUrl());
     Gpf_Session::getModule()->assignModuleAttributes($this);
 }
 /**
  * @service theme read
  *
  * @return Gpf_Data_RecordSet
  */
 public function getThemes(Gpf_Rpc_Params $params)
 {
     if ($params->exists('panelName')) {
         return $this->getThemesNoRpc($params->get('panelName'));
     } else {
         return $this->getThemesNoRpc(Gpf_Session::getModule()->getPanelName(), $params->get('filterDisabled'));
     }
 }
Beispiel #4
0
 public function __construct($themeId = '', $panelName = '')
 {
     $this->themeId = $themeId;
     $this->panelName = $panelName;
     if ($this->themeId == '') {
         $this->themeId = Gpf_Session::getAuthUser()->getTheme();
     }
     if ($this->panelName == '') {
         $this->panelName = Gpf_Session::getModule()->getPanelName();
     }
     $this->initThemeConfig();
 }
Beispiel #5
0
 public function init()
 {
     $this->initLanguage();
     try {
         $this->setLanguage(Gpf_Lang_Dictionary::getInstance()->load($this->getLanguage()));
     } catch (Exception $e) {
     }
     $this->loadTheme();
     if (!Gpf_Session::getModule()->isThemeValid($this->theme)) {
         $this->setTheme(Gpf_Session::getModule()->getDefaultTheme());
     }
 }
 /**
  *
  * @service authentication logout
  * @return Gpf_Rpc_Action
  */
 public function logoutByURL(Gpf_Rpc_Params $params)
 {
     try {
         $panelName = Gpf_Session::getModule()->getPanelName();
         Gpf_Session::getAuthUser()->logout();
         Gpf_Http::setHeader('Location', Gpf_Paths::getInstance()->getTopPath() . $panelName . '/login.php');
     } catch (Exception $e) {
         echo $this->_('Logout was not successful');
     }
 }
Beispiel #7
0
 public function getTemplateSearchPaths($panelName = '', $postDirectory = '', $onlyDefault = false)
 {
     $key = $panelName . '|' . $postDirectory . '|' . $onlyDefault;
     if (isset($this->cachedSearchPaths[$key])) {
         return $this->cachedSearchPaths[$key];
     }
     $paths = array();
     if ($panelName == '') {
         $panelName = $this->addTrailingSlash(Gpf_Session::getModule()->getPanelName());
     } else {
         $panelName = $this->addTrailingSlash($panelName);
     }
     foreach ($this->serverPaths as $path) {
         if ($path == $this->frameworkPath && $this->isDevelopementVersion()) {
             $panel = '';
         } else {
             $panel = $panelName;
         }
         if (!$onlyDefault && $panel != '') {
             $paths[] = $this->buildTemplatePath($path, $panel, $this->getTheme(), $postDirectory);
         }
         $paths[] = $this->buildTemplatePath($path, $panel, self::DEFAULT_THEME, $postDirectory);
     }
     $this->cachedSearchPaths[$key] = $paths;
     return $paths;
 }