当前位置: 首页>>代码示例>>PHP>>正文


PHP Theme::getAvailable方法代码示例

本文整理汇总了PHP中Theme::getAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::getAvailable方法的具体用法?PHP Theme::getAvailable怎么用?PHP Theme::getAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Theme的用法示例。


在下文中一共展示了Theme::getAvailable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: print_available_themes

 public static function print_available_themes()
 {
     $installedThemesDirs = array();
     $themes = Theme::getAvailable(false);
     $installedThemes = Theme::getThemes();
     foreach ($installedThemes as $installedTheme) {
         $installedThemesDirs[] = $installedTheme->directory;
     }
     $table = new Cli\Table();
     $table->setHeaders(array('Directory', 'Installed'));
     foreach ($themes as $theme) {
         //check if theme is installed
         if (array_search($theme, $installedThemesDirs) === false) {
             $isInstalled = 'No';
         } else {
             $isInstalled = 'Yes';
         }
         $table->addRow(array($theme, $isInstalled));
     }
     $table->display();
 }
开发者ID:rodrisan,项目名称:ps-cli,代码行数:21,代码来源:themes.php

示例2: renderForm

 public function renderForm()
 {
     $getAvailableThemes = Theme::getAvailable(false);
     $available_theme_dir = array();
     $selected_theme_dir = null;
     if ($this->object) {
         $selected_theme_dir = $this->object->directory;
     }
     foreach ($getAvailableThemes as $k => $dirname) {
         $available_theme_dir[$k]['value'] = $dirname;
         $available_theme_dir[$k]['label'] = $dirname;
         $available_theme_dir[$k]['id'] = $dirname;
     }
     $this->fields_form = array('tinymce' => false, 'legend' => array('title' => $this->l('Theme'), 'image' => '../img/admin/themes.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name of the theme:'), 'name' => 'name', 'size' => 48, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}')), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     // adding a new theme, you can create a directory, and copy from an existing theme
     if ($this->display == 'add' || !$this->object->id) {
         $this->fields_form['input'][] = array('type' => 'text', 'label' => $this->l('Name of the theme\'s directory:'), 'name' => 'directory', 'required' => true, 'desc' => $this->l('If the directory does not exists, it will be created.'));
         $theme_query = Theme::getThemes();
         $this->fields_form['input'][] = array('type' => 'select', 'name' => 'based_on', 'label' => $this->l('Copy missing files from existing theme:'), 'desc' => $this->l('If you create a new theme, it\'s recommended to use default theme files.'), 'options' => array('id' => 'id', 'name' => 'name', 'default' => array('value' => 0, 'label' => '&nbsp;-&nbsp;'), 'query' => $theme_query));
     } else {
         $this->fields_form['input'][] = array('type' => 'radio', 'label' => $this->l('Directory:'), 'name' => 'directory', 'required' => true, 'br' => true, 'class' => 't', 'values' => $available_theme_dir, 'selected' => $selected_theme_dir, 'desc' => $this->l('Please select a valid theme directory.'));
     }
     return parent::renderForm();
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:24,代码来源:AdminThemesController.php

示例3: renderForm

 public function renderForm()
 {
     $get_available_themes = Theme::getAvailable(false);
     $available_theme_dir = array();
     $selected_theme_dir = null;
     $metas = Meta::getMetas();
     $formated_metas = array();
     foreach ($metas as $meta) {
         $meta_object = new Meta($meta['id_meta']);
         $title = $meta['page'];
         if (isset($meta_object->title[(int) $this->context->language->id]) && $meta_object->title[(int) $this->context->language->id] != '') {
             $title = $meta_object->title[(int) $this->context->language->id];
         }
         $formated_metas[$meta['id_meta']] = array('title' => $title, 'left' => 0, 'right' => 0);
     }
     $image_url = false;
     if ($this->object) {
         if ((int) $this->object->id > 0) {
             $theme = new Theme((int) $this->object->id);
             $theme_metas = $theme->getMetas();
             // if no theme_meta are found, we must create them
             if (empty($theme_metas)) {
                 $metas = Db::getInstance()->executeS('SELECT id_meta FROM ' . _DB_PREFIX_ . 'meta');
                 $metas_default = array();
                 foreach ($metas as $meta) {
                     $tmp_meta['id_meta'] = (int) $meta['id_meta'];
                     $tmp_meta['left'] = 1;
                     $tmp_meta['right'] = 1;
                     $metas_default[] = $tmp_meta;
                 }
                 $theme->updateMetas($metas_default);
                 $theme_metas = $theme->getMetas();
             }
             $image_url = '<img alt="preview" src="' . __PS_BASE_URI__ . 'themes/' . $theme->directory . '/preview.jpg">';
             foreach ($theme_metas as $theme_meta) {
                 $formated_metas[$theme_meta['id_meta']]['id_theme_meta'] = (int) $theme_meta['id_theme_meta'];
                 $formated_metas[$theme_meta['id_meta']]['id_meta'] = (int) $theme_meta['id_meta'];
                 $formated_metas[$theme_meta['id_meta']]['left'] = (int) $theme_meta['left_column'];
                 $formated_metas[$theme_meta['id_meta']]['right'] = (int) $theme_meta['right_column'];
             }
         }
         $selected_theme_dir = $this->object->directory;
     }
     foreach ($get_available_themes as $k => $dirname) {
         $available_theme_dir[$k]['value'] = $dirname;
         $available_theme_dir[$k]['label'] = $dirname;
         $available_theme_dir[$k]['id'] = $dirname;
     }
     $this->fields_form = array('tinymce' => false, 'legend' => array('title' => $this->l('Theme'), 'icon' => 'icon-picture'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name of the theme'), 'name' => 'name', 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'file', 'label' => $this->l('Preview image for the theme'), 'name' => 'image_preview', 'display_image' => true, 'hint' => sprintf($this->l('Max image size: %1s'), Tools::formatBytes(Tools::getMaxUploadSize())), 'image' => $image_url), array('type' => 'switch', 'label' => $this->l('Default left column'), 'name' => 'default_left_column', 'hint' => $this->l('Choose a default behavior when displaying the column in a new page added by you or by a module.'), 'values' => array(array('id' => 'default_left_column_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'default_left_column_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'switch', 'label' => $this->l('Default right column'), 'name' => 'default_right_column', 'hint' => $this->l('Choose a default behavior when displaying the column in a new page added by you or by a module.'), 'values' => array(array('id' => 'default_right_column_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'default_right_column_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'text', 'label' => $this->l('Number of products per page'), 'name' => 'product_per_page', 'hint' => $this->l('This value will be used when activating the theme.'))), 'submit' => array('title' => $this->l('Save')));
     // adding a new theme, you can create a directory, and copy from an existing theme
     if ($this->display == 'add' || !$this->object->id) {
         $this->fields_form['input'][] = array('type' => 'text', 'label' => $this->l('Name of the theme\'s directory'), 'name' => 'directory', 'required' => true, 'hint' => $this->l('If the directory does not exists, it will be created.'));
         $theme_query = Theme::getThemes();
         $this->fields_form['input'][] = array('type' => 'select', 'name' => 'based_on', 'label' => $this->l('Copy missing files from existing theme'), 'hint' => $this->l('If you create a new theme, it\'s recommended that you use the default theme files.'), 'options' => array('id' => 'id', 'name' => 'name', 'default' => array('value' => 0, 'label' => '-'), 'query' => $theme_query));
         $this->fields_form['input'][] = array('type' => 'switch', 'label' => $this->l('Responsive'), 'name' => 'responsive', 'hint' => $this->l('Please indicate if the theme is adapted to all screen sizes (mobile, tablet, desktop).'), 'values' => array(array('id' => 'responsive_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'responsive_off', 'value' => 0, 'label' => $this->l('No'))));
     } else {
         $this->fields_form['input'][] = array('type' => 'radio', 'label' => $this->l('Directory'), 'name' => 'directory', 'required' => true, 'br' => true, 'values' => $available_theme_dir, 'selected' => $selected_theme_dir, 'hint' => $this->l('Please select a valid theme directory.'));
     }
     $list = '';
     if (Tools::getIsset('update' . $this->table)) {
         $fields_list = array('title' => array('title' => $this->l('Meta'), 'align' => 'center', 'width' => 'auto'), 'left' => array('title' => $this->l('Left column'), 'active' => 'left', 'type' => 'bool', 'ajax' => true), 'right' => array('title' => $this->l('Right column'), 'active' => 'right', 'type' => 'bool', 'ajax' => true));
         $helper_list = new HelperList();
         $helper_list->tpl_vars = array('icon' => 'icon-columns');
         $helper_list->title = $this->l('Appearance of columns');
         $helper_list->no_link = true;
         $helper_list->shopLinkType = '';
         $helper_list->identifier = 'id_theme_meta';
         $helper_list->table = 'meta';
         $helper_list->currentIndex = $this->context->link->getAdminLink('AdminThemes', false);
         $helper_list->token = Tools::getAdminTokenLite('AdminThemes');
         $list = $helper_list->generateList($formated_metas, $fields_list);
     }
     return parent::renderForm() . $list;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:74,代码来源:AdminThemesController.php

示例4: getContentExport

 public function getContentExport()
 {
     if (_PS_VERSION_ < '1.5') {
         $this->theme_list = $this->getThemes14();
     } else {
         $this->theme_list = Theme::getAvailable();
     }
     $this->error = false;
     self::getModuleState();
     self::displayInformations();
     if (Tools::isSubmit('submitExport') && $this->error === false && $this->checkPostedDatas() == true) {
         self::getThemeVariations();
         self::getDocumentation();
         self::getHookState();
         self::getImageState();
         self::generateXML();
         self::generateArchive();
     }
     self::authorInformationForm();
     self::modulesInformationForm();
     self::themeInformationForm();
     self::docInformationForm();
     self::variationInformationForm();
     return $this->_html;
 }
开发者ID:jep004,项目名称:prestashop,代码行数:25,代码来源:themeinstallator.php

示例5: getContentExport

 public function getContentExport()
 {
     $this->theme_list = Theme::getAvailable();
     $this->error = false;
     self::getModuleState();
     self::displayInformations();
     if (Tools::isSubmit('submitExport') && $this->error === false && $this->checkPostedDatas() == true) {
         self::getThemeVariations();
         // Check variations exists
         if (empty($this->variations)) {
             $this->_html .= parent::displayError($this->l('You must select at least one theme'));
         } else {
             self::getDocumentation();
             self::getHookState();
             self::getImageState();
             self::generateXML();
             self::generateArchive();
         }
     }
     self::authorInformationForm();
     self::modulesInformationForm();
     self::themeInformationForm();
     self::docInformationForm();
     self::variationInformationForm();
     return $this->_html;
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:26,代码来源:themeinstallator.php

示例6: getTemplateVars

function getTemplateVars()
{
    $vars = array();
    $controllers = getTemplateControllers();
    foreach (Theme::getAvailable(false) as $themeName) {
        $themeDir = getThemeDir($themeName);
        $path = $themeDir . '/templates/templates.php';
        if (file_exists($path)) {
            require_once $path;
        }
        foreach ($controllers as $type => $controller) {
            $name = getTemplateName($themeName, $type);
            $value = Configuration::get($name, false);
            if (!$value && isset($templates)) {
                // template settings has not been saved to database yet or it's preview theme
                foreach ($templates[$type] as $t) {
                    if (isset($t['name']) && $t['name'] == $type) {
                        $value = $type . '_' . $t['id'];
                    }
                }
            }
            if ($value) {
                $c = strtolower($controller);
                $vars[$themeName][$c] = $value;
            }
        }
    }
    return $vars;
}
开发者ID:tmdhosting,项目名称:TMDHosting-PrestaShop-Technology-Theme,代码行数:29,代码来源:defines.inc.php

示例7: buildThemesData

 public static function buildThemesData($currentIndex = '', $adminDir = '')
 {
     $token = Designer::getToken();
     $baseUrl = Designer::getBaseUrlWithLastSlash();
     $themesUrl = $baseUrl . 'themes';
     $adminUrl = $baseUrl . $adminDir . '/' . ($currentIndex ? $currentIndex : 'index.php?controller=AdminAjax') . '&token=' . $token;
     $shop = Designer::getShop();
     $themes = array();
     foreach (Theme::getAvailable(false) as $themeName) {
         if (strpos($themeName, _PREVIEW_SUFFIX_) !== FALSE || !file_exists(getProjectPath($themeName))) {
             continue;
         }
         $id = Designer::getThemeId($themeName);
         $themeUrl = $themesUrl . '/' . $themeName;
         $url = $adminUrl . '&theme_name=' . $themeName;
         $themes['themes'][$themeName] = array('themeName' => $themeName, 'thumbnailUrl' => $themeUrl . '/preview.jpg', 'openUrl' => $url . '&ajax=1&ver=' . theme_get_manifest_version($themeName) . getDesktopParams(), 'settingsUrl' => $url . '&edit=1', 'isActive' => $id && $shop->id_theme == $id);
     }
     return $themes;
 }
开发者ID:tmdhosting,项目名称:TMDHosting-PrestaShop-Technology-Theme,代码行数:19,代码来源:designer.php

示例8: getTemplateVars

function getTemplateVars()
{
    $vars = array();
    $templates = getTemplateControllers();
    foreach (Theme::getAvailable(false) as $themeName) {
        foreach ($templates as $type => $controller) {
            $name = getTemplateName($themeName, $type);
            $value = Configuration::get($name);
            if ($value) {
                $c = strtolower($controller);
                $vars[$themeName][$c] = $value;
            }
        }
    }
    return $vars;
}
开发者ID:tmdhosting,项目名称:TMDHosting-PrestaShop-Pets-Theme,代码行数:16,代码来源:defines.inc.php


注:本文中的Theme::getAvailable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。