Пример #1
0
 private function getFirstAvailableTheme()
 {
     $themeManager = new Gpf_Desktop_ThemeManager();
     return $themeManager->getFirstTheme($this->panelName);
 }
Пример #2
0
 /**
  * @service template read
  * @param $fields
  * @return Gpf_Data_RecordSet
  */
 public function getThemesForFile(Gpf_Rpc_Params $params)
 {
     $templateName = $this->fixTemplateName($params->get("templatename"));
     $panelName = '';
     if ($params->exists("panelname")) {
         $panelName = $params->get("panelname");
     }
     $themeManager = new Gpf_Desktop_ThemeManager();
     $themes = $themeManager->getThemesNoRpc($panelName);
     $themes->addColumn("filename");
     foreach ($themes as $theme) {
         $paths = Gpf_Paths::getInstance()->clonePaths($theme->get(Gpf_Desktop_Theme::ID));
         $templatePath = $paths->getTemplatePath($templateName, $panelName);
         if (strpos($templatePath, Gpf_Paths::DEFAULT_THEME) === false) {
             $theme->set("filename", $templatePath);
         }
     }
     $commonTemplates = $themes->createRecord();
     $commonTemplates->set(Gpf_Desktop_Theme::ID, trim(Gpf_Paths::DEFAULT_THEME, '/'));
     $commonTemplates->set(Gpf_Desktop_Theme::NAME, $this->_("Common templates"));
     $paths = Gpf_Paths::getInstance()->clonePaths(trim(Gpf_Paths::DEFAULT_THEME, '/'));
     $commonTemplates->set("filename", $paths->getTemplatePath($templateName, $panelName));
     $themes->addRecord($commonTemplates);
     return $themes;
 }