本文整理汇总了PHP中CMSCategory类的典型用法代码示例。如果您正苦于以下问题:PHP CMSCategory类的具体用法?PHP CMSCategory怎么用?PHP CMSCategory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMSCategory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _prepareHook
protected function _prepareHook($params)
{
$languages = Language::getLanguages(true, $this->context->shop->id);
if (!count($languages)) {
return false;
}
$link = new Link();
if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
$default_rewrite = array();
if (Dispatcher::getInstance()->getController() == 'product' && ($id_product = (int) Tools::getValue('id_product'))) {
$rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
foreach ($rewrite_infos as $infos) {
$default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
}
}
if (Dispatcher::getInstance()->getController() == 'category' && ($id_category = (int) Tools::getValue('id_category'))) {
$rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
foreach ($rewrite_infos as $infos) {
$default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
}
}
if (Dispatcher::getInstance()->getController() == 'cms' && (($id_cms = (int) Tools::getValue('id_cms')) || ($id_cms_category = (int) Tools::getValue('id_cms_category')))) {
$rewrite_infos = isset($id_cms) && !isset($id_cms_category) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
foreach ($rewrite_infos as $infos) {
$arr_link = isset($id_cms) && !isset($id_cms_category) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], null, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
$default_rewrite[$infos['id_lang']] = $arr_link;
}
}
$this->smarty->assign('lang_rewrite_urls', $default_rewrite);
}
return true;
}
开发者ID:jpodracky,项目名称:dogs,代码行数:32,代码来源:blocklanguages.php
示例2: getTemplateVarSitemap
public function getTemplateVarSitemap()
{
$pages = [];
$catalog_mode = Configuration::isCatalogMode();
$cms = CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1);
foreach ($cms['cms'] as $p) {
$pages[] = ['id' => 'cms-page-' . $p['id_cms'], 'label' => $p['meta_title'], 'url' => $this->context->link->getCMSLink(new CMS($p['id_cms']))];
}
$pages[] = ['id' => 'stores-page', 'label' => $this->trans('Our stores', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('stores')];
$pages[] = ['id' => 'contact-page', 'label' => $this->trans('Contact us', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('contact')];
$pages[] = ['id' => 'sitemap-page', 'label' => $this->trans('Sitemap', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('sitemap')];
$pages[] = ['id' => 'login-page', 'label' => $this->trans('Log in', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('authentication')];
$pages[] = ['id' => 'register-page', 'label' => $this->trans('Create new account', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('authentication')];
$catalog = ['new-product' => ['id' => 'new-product-page', 'label' => $this->trans('New products', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('new-products')]];
if ($catalog_mode && Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
$catalog['best-sales'] = ['id' => 'best-sales-page', 'label' => $this->trans('Best sellers', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('best-sales')];
$catalog['prices-drop'] = ['id' => 'prices-drop-page', 'label' => $this->trans('Price drop', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('prices-drop')];
}
if (Configuration::get('PS_DISPLAY_SUPPLIERS')) {
$manufacturers = Manufacturer::getLiteManufacturersList($this->context->language->id, 'sitemap');
$catalog['manufacturer'] = ['id' => 'manufacturer-page', 'label' => $this->trans('Manufacturers', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('manufacturer'), 'children' => $manufacturers];
$suppliers = Supplier::getLiteSuppliersList($this->context->language->id, 'sitemap');
$catalog['supplier'] = ['id' => 'supplier-page', 'label' => $this->trans('Suppliers', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('supplier'), 'children' => $suppliers];
}
$categories = Category::getRootCategory()->recurseLiteCategTree(0, 0, null, null, 'sitemap');
$catalog['category'] = ['id' => 'category-page', 'label' => $this->trans('Categories', array(), 'Shop.Theme.Catalog'), 'url' => '#', 'children' => $categories['children']];
$sitemap = [['id' => 'page-page', 'label' => $this->trans('Pages', array(), 'Shop.Theme'), 'url' => '#', 'children' => $pages], ['id' => 'catalog-page', 'label' => $this->trans('Catalog', array(), 'Shop.Theme'), 'url' => '#', 'children' => $catalog]];
return $sitemap;
}
开发者ID:M03G,项目名称:PrestaShop,代码行数:29,代码来源:SitemapController.php
示例3: renderForm
public function renderForm()
{
$fields_form = array('form' => array('legend' => array('title' => $this->l('Homepage categories'), 'icon' => ''), 'input' => array(array('type' => 'cms_choice', 'label' => '', 'name' => 'cats')), 'submit' => array('name' => 'submitBlockshortcms', 'title' => $this->l('Save'))));
$lang = $this->context->language;
if ($selectedItems = Configuration::get('MOD_BLOCKHOMECMS_ITEMS')) {
$selectedItems = explode(',', $selectedItems);
foreach ($selectedItems as $index => $id_cms) {
$selectedItems[$index] = new CMS($id_cms, $this->context->language->id);
}
} else {
$selectedItems = null;
}
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->default_form_language = $lang->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$helper->module = $this;
$helper->identifier = 'id_blocklink';
$helper->submit_action = 'submit';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->fields_value = array('text' => 'text');
$categories = current(CMSCategory::getCategories($this->context->language->id));
$allCms = CMS::getCMSPages($this->context->language->id);
$helper->tpl_vars = array('categories' => current(CMSCategory::getCategories($this->context->language->id)), 'allCms' => CMS::getCMSPages($this->context->language->id), 'selectedCms' => $selectedItems);
return $helper->generateForm(array($fields_form));
}
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:27,代码来源:blockshortcms.php
示例4: process
public function process()
{
parent::process();
self::$smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0));
self::$smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory(_USER_ID_LANG_, 1, 1, 1));
self::$smarty->assign('voucherAllowed', (int) Configuration::get('PS_VOUCHERS'));
$blockmanufacturer = Module::getInstanceByName('blockmanufacturer');
$blocksupplier = Module::getInstanceByName('blocksupplier');
self::$smarty->assign('display_manufacturer_link', (int) $blockmanufacturer->id ? true : false);
self::$smarty->assign('display_supplier_link', (int) $blocksupplier->id ? true : false);
self::$smarty->assign('PS_DISPLAY_SUPPLIERS', Configuration::get('PS_DISPLAY_SUPPLIERS'));
self::$smarty->assign('display_store', Configuration::get('PS_STORES_DISPLAY_SITEMAP'));
}
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:13,代码来源:SitemapController.php
示例5: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0));
$this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1));
$this->context->smarty->assign('voucherAllowed', (int) Configuration::get('PS_VOUCHERS'));
$blockmanufacturer = Module::getInstanceByName('blockmanufacturer');
$blocksupplier = Module::getInstanceByName('blocksupplier');
$this->context->smarty->assign('display_manufacturer_link', (bool) $blockmanufacturer->active);
$this->context->smarty->assign('display_supplier_link', (bool) $blocksupplier->active);
$this->context->smarty->assign('PS_DISPLAY_SUPPLIERS', Configuration::get('PS_DISPLAY_SUPPLIERS'));
$this->context->smarty->assign('display_store', Configuration::get('PS_STORES_DISPLAY_SITEMAP'));
$this->setTemplate(_PS_THEME_DIR_ . 'sitemap.tpl');
}
开发者ID:jicheng17,项目名称:vipinsg,代码行数:18,代码来源:SitemapController.php
示例6: getTemplateVarCategoryCms
public function getTemplateVarCategoryCms()
{
$categoryCms = array();
$categoryCms['cms_category'] = $this->objectPresenter->present($this->cms_category);
$categoryCms['sub_categories'] = array();
$categoryCms['cms_pages'] = array();
foreach ($this->cms_category->getSubCategories($this->context->language->id) as $subCategory) {
$categoryCms['sub_categories'][$subCategory['id_cms_category']] = $subCategory;
$categoryCms['sub_categories'][$subCategory['id_cms_category']]['link'] = $this->context->link->getCMSCategoryLink($subCategory['id_cms_category'], $subCategory['link_rewrite']);
}
foreach (CMS::getCMSPages($this->context->language->id, (int) $this->cms_category->id, true, (int) $this->context->shop->id) as $cmsPages) {
$categoryCms['cms_pages'][$cmsPages['id_cms']] = $cmsPages;
$categoryCms['cms_pages'][$cmsPages['id_cms']]['link'] = $this->context->link->getCMSLink($cmsPages['id_cms'], $cmsPages['link_rewrite']);
}
return $categoryCms;
}
开发者ID:M03G,项目名称:PrestaShop,代码行数:16,代码来源:CmsController.php
示例7: reorderpositions
function reorderpositions()
{
/* Clean products positions */
if ($cat = Category::getCategories(1, false, false)) {
foreach ($cat as $i => $categ) {
Product::cleanPositions((int) $categ['id_category']);
}
}
//clean Category position and delete old position system
Language::loadLanguages();
$language = Language::getLanguages();
$cat_parent = Db::getInstance()->ExecuteS('SELECT DISTINCT c.id_parent FROM `' . _DB_PREFIX_ . 'category` c WHERE id_category != 1');
foreach ($cat_parent as $parent) {
$result = Db::getInstance()->ExecuteS('
SELECT DISTINCT c.*, cl.*
FROM `' . _DB_PREFIX_ . 'category` c
LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = ' . (int) Configuration::get('PS_LANG_DEFAULT') . ')
WHERE c.id_parent = ' . (int) $parent['id_parent'] . '
ORDER BY name ASC');
foreach ($result as $i => $categ) {
Db::getInstance()->Execute('
UPDATE `' . _DB_PREFIX_ . 'category`
SET `position` = ' . (int) $i . '
WHERE `id_parent` = ' . (int) $categ['id_parent'] . '
AND `id_category` = ' . (int) $categ['id_category']);
}
$result = Db::getInstance()->ExecuteS('
SELECT DISTINCT c.*, cl.*
FROM `' . _DB_PREFIX_ . 'category` c
LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category`)
WHERE c.id_parent = ' . (int) $parent['id_parent'] . '
ORDER BY name ASC');
// Remove number from category name
foreach ($result as $i => $categ) {
Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'category` c
LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category`)
SET `name` = \'' . preg_replace('/^[0-9]+\\./', '', $categ['name']) . '\'
WHERE c.id_category = ' . (int) $categ['id_category'] . ' AND id_lang = \'' . (int) $categ['id_lang'] . '\'');
}
}
/* Clean CMS positions */
if ($cms_cat = CMSCategory::getCategories(1, false, false)) {
foreach ($cms_cat as $i => $categ) {
CMS::cleanPositions((int) $categ['id_cms_category']);
}
}
}
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:47,代码来源:reorderpositions.php
示例8: preProcess
public function preProcess()
{
if ($id_cms = (int) Tools::getValue('id_cms')) {
$this->cms = new CMS($id_cms, self::$cookie->id_lang);
} elseif ($id_cms_category = (int) Tools::getValue('id_cms_category')) {
$this->cms_category = new CMSCategory($id_cms_category, self::$cookie->id_lang);
}
// Automatically redirect to the canonical URL if the current in is the right one
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
if ($this->cms and $canonicalURL = self::$link->getCMSLink($this->cms)) {
if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
header('HTTP/1.0 301 Moved');
if (defined(_PS_MODE_DEV_) and _PS_MODE_DEV_) {
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
}
Tools::redirectLink($canonicalURL);
}
}
if ($this->cms_category and $canonicalURL = self::$link->getCMSCategoryLink($this->cms_category)) {
if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
header('HTTP/1.0 301 Moved');
if (_PS_MODE_DEV_) {
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
}
Tools::redirectLink($canonicalURL);
}
}
parent::preProcess();
/* assignCase (1 = CMS page, 2 = CMS category) */
if (Validate::isLoadedObject($this->cms) and ($this->cms->active or Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS' . $this->cms->id) and file_exists(dirname(__FILE__) . '/../' . Tools::getValue('ad') . '/ajax.php'))) {
$this->assignCase = 1;
} elseif (Validate::isLoadedObject($this->cms_category)) {
$this->assignCase = 2;
} else {
Tools::redirect('404.php');
}
if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
$rewrite_infos = (isset($id_cms) and !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
$default_rewrite = array();
foreach ($rewrite_infos as $infos) {
$arr_link = (isset($id_cms) and !isset($id_cms_category)) ? self::$link->getCMSLink($id_cms, $infos['link_rewrite'], $this->ssl, $infos['id_lang']) : self::$link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
$default_rewrite[$infos['id_lang']] = $arr_link;
}
self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
}
}
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:46,代码来源:CMSController.php
示例9: renderForm
public function renderForm()
{
$this->display = 'edit';
$this->toolbar_btn['save-and-preview'] = array('href' => '#', 'desc' => $this->l('Save and preview'));
$this->initToolbar();
if (!$this->loadObject(true)) {
return;
}
$categories = CMSCategory::getCategories($this->context->language->id, false);
$html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1);
$this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('CMS Page'), 'image' => '../img/admin/tab-categories.gif'), 'input' => array(array('type' => 'select_category', 'label' => $this->l('CMS Category'), 'name' => 'id_cms_category', 'options' => array('html' => $html_categories)), array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'id' => 'name', 'lang' => true, 'required' => true, 'class' => 'copy2friendlyUrl', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'size' => 50), array('type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'size' => 70), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'size' => 70, 'desc' => $this->l('To add "tags" click in the field, write something, then press "Enter"')), array('type' => 'text', 'label' => $this->l('Friendly URL'), 'name' => 'link_rewrite', 'required' => true, 'lang' => true, 'hint' => $this->l('Only letters and the minus (-) character are allowed')), array('type' => 'textarea', 'label' => $this->l('Page content'), 'name' => 'content', 'autoload_rte' => true, 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'radio', 'label' => $this->l('Displayed:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button'));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
}
$this->tpl_form_vars = array('active' => $this->object->active);
return parent::renderForm();
}
开发者ID:jicheng17,项目名称:vipinsg,代码行数:17,代码来源:AdminCmsController.php
示例10: processSave
/**
* Method processSave() : add or update cms category object
*
* @module now_seo_links
* @return object CMS Category
*
* @see AdminCmsCategoriesControllerCore::processSave()
*/
public function processSave()
{
$iIdCmsCategory = Tools::getValue('id_cms_category', false);
$aLinkRewrite = array();
foreach (Language::getLanguages(true) as $aLang) {
if (array_key_exists('link_rewrite_' . (int) $aLang['id_lang'], $_POST)) {
$aLinkRewrite[(int) $aLang['id_lang']] = Tools::getValue('link_rewrite_' . (int) $aLang['id_lang']);
}
}
// Check if name already exist
foreach ($aLinkRewrite as $iIdLang => $sLinkRewrite) {
if (CMSCategory::linkRewriteIsAlreadyUsed($iIdCmsCategory, $sLinkRewrite, $iIdLang)) {
$this->errors[] = sprintf(Tools::displayError('Ce link_rewrite "%s" (%s) existe déjà pour une autre catégorie de CMS et ne peut être utilisé une nouvelle fois.'), $sLinkRewrite, Language::getIsoById($iIdLang));
}
}
return parent::processSave();
}
开发者ID:TheTypoMaster,项目名称:neonflexible,代码行数:25,代码来源:AdminCmsCategoriesController.php
示例11: renderForm
public function renderForm()
{
if (!$this->loadObject(true)) {
return;
}
$checkVersion = version_compare(_PS_VERSION_, '1.6');
$this->isPS6 = false;
if ($checkVersion >= 0) {
$this->isPS6 = true;
}
if (Validate::isLoadedObject($this->object)) {
$this->display = 'edit';
} else {
$this->display = 'add';
}
if (!$this->isPS6) {
//ps5
$this->toolbar_btn['save-and-preview'] = array('href' => '#', 'desc' => $this->l('Save and preview'));
$this->toolbar_btn['save-and-stay'] = array('short' => 'SaveAndStay', 'href' => '#', 'desc' => $this->l('Save and stay'));
}
$this->initToolbar();
if ($this->isPS6) {
//ps6
$this->initPageHeaderToolbar();
}
$categories = CMSCategory::getCategories($this->context->language->id, false);
$html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1);
$galleries = $this->getSliders();
$this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('CMS Page'), 'image' => '../img/admin/tab-categories.gif', 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'select_category', 'label' => $this->l('CMS Category'), 'name' => 'id_cms_category', 'options' => array('html' => $html_categories)), array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'id' => 'name', 'lang' => true, 'required' => true, 'class' => 'copy2friendlyUrl copyMeta2friendlyURL', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'select_category', 'label' => $this->l('Slider'), 'name' => 'proslider', 'empty_message' => $this->l('None'), 'options' => array('html' => $galleries)), array('type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('To add "tags" click in the field, write something, and then press "Enter."')), array('type' => 'text', 'label' => $this->l('Friendly URL'), 'name' => 'link_rewrite', 'required' => true, 'lang' => true, 'hint' => $this->l('Only letters and the minus (-) character are allowed')), array('type' => 'textarea', 'label' => $this->l('Page content'), 'name' => 'content', 'autoload_rte' => true, 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => $this->isPS6 ? 'switch' : 'hidden', 'label' => $this->l('Indexation by search engines'), 'name' => 'indexation', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'indexation_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'indexation_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => $this->isPS6 ? 'switch' : 'radio', 'label' => $this->l('Displayed:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button btn btn-default'));
if ($this->isPS6) {
$this->fields_form['buttons'] = array('save_and_preview' => array('name' => 'viewcms', 'type' => 'submit', 'title' => $this->l('Save and preview'), 'class' => 'btn btn-default pull-right', 'icon' => 'process-icon-preview'));
}
$this->fields_form['submit'] = array('title' => $this->l('Save'), 'class' => 'button btn btn-default pull-right');
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
}
if ($this->isPS6) {
if (Validate::isLoadedObject($this->object)) {
$this->context->smarty->assign('url_prev', $this->getPreviewUrl($this->object));
}
}
$this->tpl_form_vars = array('active' => $this->object->active, 'PS_ALLOW_ACCENTED_CHARS_URL', (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'));
return adminController::renderForm();
}
开发者ID:ac3gam3r,项目名称:Maxokraft,代码行数:44,代码来源:AdminCmsContent.php
示例12: renderForm
public function renderForm()
{
if (!$this->loadObject(true)) {
return;
}
if (Validate::isLoadedObject($this->object)) {
$this->display = 'edit';
} else {
$this->display = 'add';
}
$this->initToolbar();
$this->initPageHeaderToolbar();
$categories = CMSCategory::getCategories($this->context->language->id, false);
$html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1);
$this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('CMS Page'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'select_category', 'label' => $this->l('CMS Category'), 'name' => 'id_cms_category', 'options' => array('html' => $html_categories)), array('type' => 'text', 'label' => $this->l('Meta title'), 'name' => 'meta_title', 'id' => 'name', 'lang' => true, 'required' => true, 'class' => 'copyMeta2friendlyURL', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => array($this->l('To add "tags" click in the field, write something, and then press "Enter."'), $this->l('Invalid characters:') . ' <>;=#{}')), array('type' => 'text', 'label' => $this->l('Friendly URL'), 'name' => 'link_rewrite', 'required' => true, 'lang' => true, 'hint' => $this->l('Only letters and the hyphen (-) character are allowed.')), array('type' => 'textarea', 'label' => $this->l('Page content'), 'name' => 'content', 'autoload_rte' => true, 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'switch', 'label' => $this->l('Indexation by search engines'), 'name' => 'indexation', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'indexation_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'indexation_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'switch', 'label' => $this->l('Displayed'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save')), 'buttons' => array('save_and_preview' => array('name' => 'viewcms', 'type' => 'submit', 'title' => $this->l('Save and preview'), 'class' => 'btn btn-default pull-right', 'icon' => 'process-icon-preview')));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
}
$this->tpl_form_vars = array('active' => $this->object->active, 'PS_ALLOW_ACCENTED_CHARS_URL', (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'));
return parent::renderForm();
}
开发者ID:carloslastresDev,项目名称:HealthyTaiwan_UsingPrestaShop,代码行数:21,代码来源:AdminCmsController.php
示例13: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$parent_cat = new CMSCategory(1, $this->context->language->id);
$this->context->smarty->assign('id_current_lang', $this->context->language->id);
$this->context->smarty->assign('home_title', $parent_cat->name);
$this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID'));
if ($this->assignCase == 1) {
if (isset($this->cms->id_cms_category) && $this->cms->id_cms_category) {
$path = Tools::getFullPath($this->cms->id_cms_category, $this->cms->meta_title, 'CMS');
} elseif (isset($this->cms_category->meta_title)) {
$path = Tools::getFullPath(1, $this->cms_category->meta_title, 'CMS');
}
$this->context->smarty->assign(array('cms' => $this->cms, 'content_only' => (int) Tools::getValue('content_only'), 'path' => $path, 'body_classes' => array($this->php_self . '-' . $this->cms->id, $this->php_self . '-' . $this->cms->link_rewrite)));
if ($this->cms->indexation == 0) {
$this->context->smarty->assign('nobots', true);
}
} elseif ($this->assignCase == 2) {
$this->context->smarty->assign(array('category' => $this->cms_category, 'cms_category' => $this->cms_category, 'sub_category' => $this->cms_category->getSubCategories($this->context->language->id), 'cms_pages' => CMS::getCMSPages($this->context->language->id, (int) $this->cms_category->id, true, (int) $this->context->shop->id), 'path' => $this->cms_category->id !== 1 ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '', 'body_classes' => array($this->php_self . '-' . $this->cms_category->id, $this->php_self . '-' . $this->cms_category->link_rewrite)));
}
$this->setTemplate(_PS_THEME_DIR_ . 'cms.tpl');
}
开发者ID:jpodracky,项目名称:dogs,代码行数:26,代码来源:CmsController.php
示例14: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0));
$this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1));
$this->context->smarty->assign('voucherAllowed', (int) CartRule::isFeatureActive());
if (Module::isInstalled('blockmanufacturer') && Module::isEnabled('blockmanufacturer')) {
$blockmanufacturer = Module::getInstanceByName('blockmanufacturer');
$this->context->smarty->assign('display_manufacturer_link', isset($blockmanufacturer->active) ? (bool) $blockmanufacturer->active : false);
} else {
$this->context->smarty->assign('display_manufacturer_link', 0);
}
if (Module::isInstalled('blocksupplier') && Module::isEnabled('blocksupplier')) {
$blocksupplier = Module::getInstanceByName('blocksupplier');
$this->context->smarty->assign('display_supplier_link', isset($blocksupplier->active) ? (bool) $blocksupplier->active : false);
} else {
$this->context->smarty->assign('display_supplier_link', 0);
}
$this->context->smarty->assign('PS_DISPLAY_SUPPLIERS', Configuration::get('PS_DISPLAY_SUPPLIERS'));
$this->context->smarty->assign('PS_DISPLAY_BEST_SELLERS', Configuration::get('PS_DISPLAY_BEST_SELLERS'));
$this->context->smarty->assign('display_store', Configuration::get('PS_STORES_DISPLAY_SITEMAP'));
$this->setTemplate(_PS_THEME_DIR_ . 'sitemap.tpl');
}
开发者ID:jpodracky,项目名称:dogs,代码行数:27,代码来源:SitemapController.php
示例15: hookTop
/**
* Returns module content for header
*
* @param array $params Parameters
* @return string Content
*/
public function hookTop($params)
{
global $smarty;
$languages = Language::getLanguages();
if (!count($languages)) {
return;
}
$link = new Link();
if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
$default_rewrite = array();
$phpSelf = isset($_SERVER['PHP_SELF']) ? substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)) : '';
if ($phpSelf == 'product.php' and $id_product = (int) Tools::getValue('id_product')) {
$rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
foreach ($rewrite_infos as $infos) {
$default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
}
}
if ($phpSelf == 'category.php' and $id_category = (int) Tools::getValue('id_category')) {
$rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
foreach ($rewrite_infos as $infos) {
$default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
}
}
if ($phpSelf == 'cms.php' and ($id_cms = (int) Tools::getValue('id_cms') or $id_cms_category = (int) Tools::getValue('id_cms_category'))) {
$rewrite_infos = (isset($id_cms) and !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
foreach ($rewrite_infos as $infos) {
$arr_link = (isset($id_cms) and !isset($id_cms_category)) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], NULL, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
$default_rewrite[$infos['id_lang']] = $arr_link;
}
}
if (count($default_rewrite)) {
$smarty->assign('lang_rewrite_urls', $default_rewrite);
}
}
$smarty->assign('languages', $languages);
return $this->display(__FILE__, 'blocklanguages.tpl');
}
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:43,代码来源:blocklanguages.php
示例16: getCMSMenuItems
protected function getCMSMenuItems($parent, $depth = 1, $id_lang = false)
{
$id_lang = $id_lang ? (int) $id_lang : (int) Context::getContext()->language->id;
if ($depth > 3) {
return;
}
$categories = $this->getCMSCategories(false, (int) $parent, (int) $id_lang);
$pages = $this->getCMSPages((int) $parent);
if (count($categories) || count($pages)) {
$this->_menu .= '<ul>';
foreach ($categories as $category) {
$cat = new CMSCategory((int) $category['id_cms_category'], (int) $id_lang);
$this->_menu .= '<li>';
$this->_menu .= '<a href="' . Tools::HtmlEntitiesUTF8($cat->getLink()) . '">' . $category['name'] . '</a>';
$this->getCMSMenuItems($category['id_cms_category'], (int) $depth + 1);
$this->_menu .= '</li>';
}
foreach ($pages as $page) {
$cms = new CMS($page['id_cms'], (int) $id_lang);
$links = $cms->getLinks((int) $id_lang, array((int) $cms->id));
$selected = $this->page_name == 'cms' && (int) Tools::getValue('id_cms') == $page['id_cms'] ? ' class="sfHoverForce"' : '';
$this->_menu .= '<li ' . $selected . '>';
$this->_menu .= '<a href="' . $links[0]['link'] . '">' . $cms->meta_title . '</a>';
$this->_menu .= '</li>';
}
$this->_menu .= '</ul>';
}
}
开发者ID:prestashop,项目名称:blocktopmenu,代码行数:28,代码来源:blocktopmenu.php
示例17: _displayAddForm
private function _displayAddForm()
{
global $currentIndex, $cookie;
$defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
$languages = Language::getLanguages(false);
$divLangName = 'name';
$cmsBlock = NULL;
if (Tools::isSubmit('editBlockCMS') and Tools::getValue('id_cms_block')) {
$cmsBlock = $this->getBlockCMS((int) Tools::getValue('id_cms_block'));
}
$this->_html .= '
<script type="text/javascript" src="' . _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/' . $this->name . '/' . $this->name . '.js"></script>
<script type="text/javascript">id_language = Number(' . $defaultLanguage . ');</script>
<form method="POST" action="' . Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']) . '">
';
if (Tools::getValue('id_cms_block')) {
$this->_html .= '<input type="hidden" name="id_cms_block" value="' . (int) Tools::getValue('id_cms_block') . '" id="id_cms_block" />';
}
$this->_html .= '
<fieldset>';
if (Tools::isSubmit('addBlockCMS')) {
$this->_html .= '<legend><img src="' . _PS_ADMIN_IMG_ . 'add.gif" alt="" /> ' . $this->l('New CMS block') . '</legend>';
} elseif (Tools::isSubmit('editBlockCMS')) {
$this->_html .= '<legend><img src="' . _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/' . $this->name . '/logo.gif" alt="" /> ' . $this->l('Edit CMS block') . '</legend>';
}
$this->_html .= '
<label>' . $this->l('Name of block:') . '</label>
<div class="margin-form">';
foreach ($languages as $language) {
$this->_html .= '
<div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . ';float: left;">
<input type="text" name="block_name_' . $language['id_lang'] . '" id="block_name_' . $language['id_lang'] . '" size="30" value="' . (Tools::getValue('block_name_' . $language['id_lang']) ? Tools::getValue('block_name_' . $language['id_lang']) : (isset($cmsBlock['name'][$language['id_lang']]) ? $cmsBlock['name'][$language['id_lang']] : '')) . '" />
</div>';
}
$this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'name', true);
$this->_html .= '<p class="clear">' . $this->l('If you leave this field empty, the block name will use the category name') . '</p>
</div><br />
<label for="id_category">' . $this->l('Choose a CMS category:') . '</label>
<div class="margin-form">
<select name="id_category" id="id_category" onchange="CMSCategory_js($(this).val(), \'' . $this->secure_key . '\')">';
$categories = CMSCategory::getCategories((int) $cookie->id_lang, false);
$this->_html .= CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $cmsBlock != NULL ? $cmsBlock[0]['id_cms_category'] : 1, 1);
$this->_html .= '
</select>
</div><br />
<label>' . $this->l('Location:') . '</label>
<div class="margin-form">
<select name="block_location" id="block_location">
<option value="' . self::LEFT_COLUMN . '" ' . (($cmsBlock and $cmsBlock[0]['location'] == self::LEFT_COLUMN) ? 'selected="selected"' : '') . '>' . $this->l('Left') . '</option>
<option value="' . self::RIGHT_COLUMN . '" ' . (($cmsBlock and $cmsBlock[0]['location'] == self::RIGHT_COLUMN) ? 'selected="selected"' : '') . '>' . $this->l('Right') . '</option>
</select>
</div>';
$this->_html .= '
<label for="PS_STORES_DISPLAY_CMS_on">' . $this->l('Display Stores:') . '</label>
<div class="margin-form">
<img src=&
|
请发表评论