private function existTemplate($templateName)
 {
     foreach (Gpf_Paths::getInstance()->getTemplateSearchPaths() as $templateDir) {
         if (Gpf_Io_File::isFileExists($templateDir . $templateName . ".tpl")) {
             return true;
         }
     }
     return false;
 }
 /**
  * Import selected language into database and
  * create language cache file in account directory
  */
 protected function importLanguage($code)
 {
     $fileName = Gpf_Paths::getInstance()->getLanguageInstallDirectory() . Gpf_Application::getInstance()->getCode() . '_' . $code . '.csv';
     if (!Gpf_Io_File::isFileExists($fileName)) {
         return;
     }
     $importer = new Gpf_Lang_ImportLanguageTask($fileName, $code, false);
     $importer->run();
 }
 protected function loadItems($itemId)
 {
     $result = new Gpf_Data_RecordSet();
     $result->setHeader(array('itemId', 'subItemsCount', 'name', 'info', 'type'));
     if (Gpf_Io_File::isFileExists($itemId)) {
         $file = new Gpf_Io_File($itemId);
         if ($file->isDirectory()) {
             $this->loadSubfilesFiles($itemId, $result, true);
             $this->loadSubfilesFiles($itemId, $result);
             return $result;
         }
         $result->add(array($itemId, 0, $file->getName(), $file->getSize(), self::TYPE_FILE));
     }
     return $result;
 }
Example #4
0
 public function isThemeValid($theme)
 {
     if (strpos($theme, '_') === 0) {
         return false;
     }
     $themePath = Gpf_Paths::getInstance()->getTopTemplatePath() . $this->getPanelName() . '/' . $theme . '/';
     if (!Gpf_Io_File::isFileExists($themePath) || !Gpf_Io_File::isFileExists($themePath . Gpf_Desktop_Theme::CONFIG_FILE_NAME)) {
         return false;
     }
     $themeObj = new Gpf_Desktop_Theme($theme, $this->getPanelName());
     return $themeObj->isEnabled();
 }
Example #5
0
 public function getResourcePath($resouceName, $postDirectory = '', $panelName = '', $onlyDefault = false)
 {
     if ($postDirectory != '') {
         $postDirectory = $this->addTrailingSlash($postDirectory);
     }
     $paths = $this->getTemplateSearchPaths($panelName, $postDirectory, $onlyDefault);
     foreach ($paths as $path) {
         $fileName = $path . $resouceName;
         if (Gpf_Io_File::isFileExists($fileName)) {
             return $fileName;
         }
     }
     throw new Gpf_ResourceNotFoundException($resouceName, $panelName);
 }