Example #1
0
 /**
  * List template from all themes, show theme name
  *
  * @param string $strPrefix
  *
  * @return array
  */
 public static function getTemplates($strPrefix)
 {
     $arrTemplates = \Controller::getTemplateGroup($strPrefix);
     // Try to select the shop configs
     try {
         $objConfig = Config::findAll(array('order' => 'name'));
     } catch (\Exception $e) {
         $objConfig = null;
     }
     // Add the shop config templates
     if (null !== $objConfig) {
         while ($objConfig->next()) {
             if ($objConfig->templateGroup != '') {
                 $arrConfigTemplates = glob(TL_ROOT . '/' . $objConfig->templateGroup . '/' . $strPrefix . '*');
                 if (is_array($arrConfigTemplates)) {
                     foreach ($arrConfigTemplates as $strFile) {
                         $strTemplate = basename($strFile, strrchr($strFile, '.'));
                         if (!isset($arrTemplates[$strTemplate])) {
                             $arrTemplates[$strTemplate] = $strTemplate;
                         } else {
                             $arrTemplates[$strTemplate] = substr($arrTemplates[$strTemplate], 0, -1) . ', ' . sprintf($GLOBALS['TL_LANG']['MSC']['templatesConfig'], $objConfig->name) . ')';
                         }
                     }
                 }
             }
         }
     }
     return $arrTemplates;
 }
Example #2
0
 protected function getFilterByConfigPanel()
 {
     $arrConfigs = array('' => &$GLOBALS['TL_LANG']['ISO_REPORT']['all']);
     $objConfigs = Config::findAll(array('order' => 'name'));
     if (null !== $objConfigs) {
         while ($objConfigs->next()) {
             $arrConfigs[$objConfigs->id] = $objConfigs->name;
         }
     }
     $arrSession = \Session::getInstance()->get('iso_reports');
     $varValue = (string) $arrSession[$this->name]['iso_config'];
     return array('name' => 'iso_config', 'label' => &$GLOBALS['TL_LANG']['ISO_REPORT']['shop_config'], 'type' => 'filter', 'value' => $varValue, 'active' => $varValue != '', 'class' => 'iso_config', 'options' => $arrConfigs);
 }
Example #3
0
 /**
  * List template from all themes, show theme name
  * @param string
  * @param int
  * @return array
  */
 public static function getTemplates($strPrefix)
 {
     $arrTemplates = array();
     // Get the default templates
     foreach (\TemplateLoader::getPrefixedFiles($strPrefix) as $strTemplate) {
         $arrTemplates[$strTemplate] = $strTemplate;
     }
     $arrCustomized = glob(TL_ROOT . '/templates/' . $strPrefix . '*');
     // Add the customized templates
     if (is_array($arrCustomized)) {
         foreach ($arrCustomized as $strFile) {
             $strTemplate = basename($strFile, strrchr($strFile, '.'));
             if (!isset($arrTemplates[$strTemplate])) {
                 $arrTemplates[''][$strTemplate] = $strTemplate;
             }
         }
     }
     // Do not look for back end templates in theme folders (see #5379)
     if ($strPrefix == 'be_') {
         return $arrTemplates;
     }
     // Try to select the shop configs
     try {
         $objConfig = Config::findAll(array('order' => 'name'));
     } catch (\Exception $e) {
         $objConfig = null;
     }
     // Add the shop config templates
     if (null !== $objConfig) {
         while ($objConfig->next()) {
             if ($objConfig->templateGroup != '') {
                 $strFolder = sprintf($GLOBALS['TL_LANG']['MSC']['templatesConfig'], $objConfig->name);
                 $arrConfigTemplates = glob(TL_ROOT . '/' . $objConfig->templateGroup . '/' . $strPrefix . '*');
                 if (is_array($arrConfigTemplates)) {
                     foreach ($arrConfigTemplates as $strFile) {
                         $strTemplate = basename($strFile, strrchr($strFile, '.'));
                         if (!isset($arrTemplates[''][$strTemplate])) {
                             $arrTemplates[$strFolder][$strTemplate] = $strTemplate;
                         }
                     }
                 }
             }
         }
     }
     // Try to select the themes (see #5210)
     try {
         $objTheme = \ThemeModel::findAll(array('order' => 'name'));
     } catch (\Exception $e) {
         $objTheme = null;
     }
     // Add the theme templates
     if (null !== $objTheme) {
         while ($objTheme->next()) {
             if ($objTheme->templates != '') {
                 $strFolder = sprintf($GLOBALS['TL_LANG']['MSC']['templatesTheme'], $objTheme->name);
                 $arrThemeTemplates = glob(TL_ROOT . '/' . $objTheme->templates . '/' . $strPrefix . '*');
                 if (is_array($arrThemeTemplates)) {
                     foreach ($arrThemeTemplates as $strFile) {
                         $strTemplate = basename($strFile, strrchr($strFile, '.'));
                         if (!isset($arrTemplates[''][$strTemplate])) {
                             $arrTemplates[$strFolder][$strTemplate] = $strTemplate;
                         }
                     }
                 }
             }
         }
     }
     return $arrTemplates;
 }