本文整理汇总了PHP中CMSCategory::getCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP CMSCategory::getCategories方法的具体用法?PHP CMSCategory::getCategories怎么用?PHP CMSCategory::getCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMSCategory
的用法示例。
在下文中一共展示了CMSCategory::getCategories方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: 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']);
}
}
}
示例3: 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();
}
示例4: 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();
}
示例5: 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();
}
示例6: get_categories_array
public static function get_categories_array()
{
$array = array();
$context = Context::getContext();
$categories = CMSCategory::getCategories($context->language->id, false);
self::_array_recurse_categories($categories, $categories[0][1], 1, $array);
return $array;
}
示例7: displayForm
public function displayForm($token = NULL)
{
global $currentIndex, $cookie;
parent::displayForm();
if (!($obj = $this->loadObject(true))) {
return;
}
$active = $this->getFieldValue($obj, 'active');
echo '
<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . ($token != NULL ? $token : $this->token) . '" method="post" enctype="multipart/form-data">
' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
<fieldset style="width:520px"><legend><img src="../img/admin/tab-categories.gif" />' . $this->l('CMS Category') . '</legend>
<label>' . $this->l('Name:') . ' </label>
<div class="margin-form translatable">';
foreach ($this->_languages as $language) {
echo '
<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input type="text" style="width: 260px" name="name_' . $language['id_lang'] . '" id="name_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'name', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" ' . (!$obj->id ? ' onkeyup="copy2friendlyURL();"' : '') . ' /><sup> *</sup>
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
</div>';
}
echo ' <p class="clear"></p>
</div>
<label>' . $this->l('Displayed:') . ' </label>
<div class="margin-form">
<input type="radio" name="active" id="active_on" value="1" ' . ($active ? 'checked="checked" ' : '') . '/>
<label class="t" for="active_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
<input type="radio" name="active" id="active_off" value="0" ' . (!$active ? 'checked="checked" ' : '') . '/>
<label class="t" for="active_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
</div>
<label>' . $this->l('Parent CMS Category:') . ' </label>
<div class="margin-form">
<select name="id_parent">';
$categories = CMSCategory::getCategories((int) $cookie->id_lang, false);
CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_parent'));
echo '
</select>
</div>
<label>' . $this->l('Description:') . ' </label>
<div class="margin-form translatable">';
foreach ($this->_languages as $language) {
echo '
<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<textarea name="description_' . $language['id_lang'] . '" rows="5" cols="40">' . htmlentities($this->getFieldValue($obj, 'description', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '</textarea>
</div>';
}
echo ' <p class="clear"></p>
</div>
<div class="clear"><br /></div>
<label>' . $this->l('Meta title:') . ' </label>
<div class="margin-form translatable">';
foreach ($this->_languages as $language) {
echo '
<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input type="text" name="meta_title_' . $language['id_lang'] . '" id="meta_title_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_title', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
</div>';
}
echo ' <p class="clear"></p>
</div>
<label>' . $this->l('Meta description:') . ' </label>
<div class="margin-form translatable">';
foreach ($this->_languages as $language) {
echo '<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input type="text" name="meta_description_' . $language['id_lang'] . '" id="meta_description_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_description', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
</div>';
}
echo ' <p class="clear"></p>
</div>
<label>' . $this->l('Meta keywords:') . ' </label>
<div class="margin-form translatable">';
foreach ($this->_languages as $language) {
echo '
<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input type="text" name="meta_keywords_' . $language['id_lang'] . '" id="meta_keywords_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_keywords', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
</div>';
}
echo ' <p class="clear"></p>
</div>
<label>' . $this->l('Friendly URL:') . ' </label>
<div class="margin-form translatable">';
foreach ($this->_languages as $language) {
echo '<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input type="text" name="link_rewrite_' . $language['id_lang'] . '" id="link_rewrite_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'link_rewrite', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" onkeyup="this.value = str2url(this.value);" /><sup> *</sup>
<span class="hint" name="help_box">' . $this->l('Only letters and the minus (-) character are allowed') . '<span class="hint-pointer"> </span></span>
</div>';
}
echo ' <p class="clear"></p>
</div>
<div class="margin-form">
<input type="submit" value="' . $this->l('Save and back to parent CMS Category') . '" name="submitAdd' . $this->table . 'AndBackToParent" class="button" />
<input type="submit" class="button" name="submitAdd' . $this->table . '" value="' . $this->l('Save') . '"/>
</div>
<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
</fieldset>
</form>
<p class="clear"></p>';
//.........这里部分代码省略.........
示例8: displayForm
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
parent::displayForm();
$obj = $this->loadObject(true);
$iso = Language::getIsoById((int) $cookie->id_lang);
$divLangName = 'meta_title¤meta_description¤meta_keywords¤ccontent¤link_rewrite';
echo '
<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . Tools::getAdminTokenLite('AdminCMSContent') . '" method="post" name="cms" id="cms">
' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
' . $this->_displayDraftWarning($obj->active) . '
<fieldset><legend><img src="../img/admin/cms.gif" />' . $this->l('CMS page') . '</legend>';
// META TITLE
echo '<label>' . $this->l('CMS Category:') . ' </label>
<div class="margin-form">
<select name="id_cms_category">';
$categories = CMSCategory::getCategories((int) $cookie->id_lang, false);
CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_cms_category'));
echo '
</select>
</div>
<label>' . $this->l('Meta title') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo ' <div id="meta_title_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input size="40" type="text" onkeyup="copyMeta2friendlyURL();" id="name_' . $language['id_lang'] . '" name="meta_title_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_title', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_title');
echo ' </div><div class="clear space"> </div>';
// META DESCRIPTION
echo ' <label>' . $this->l('Meta description') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo ' <div id="meta_description_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input size="50" type="text" name="meta_description_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_description', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_description');
echo ' </div><div class="clear space"> </div>';
// META KEYWORDS
echo ' <label>' . $this->l('Meta keywords') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo ' <div id="meta_keywords_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input size="50" type="text" name="meta_keywords_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_keywords', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_keywords');
echo ' </div><div class="clear space"> </div>';
// LINK REWRITE
echo ' <label>' . $this->l('Friendly URL') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo ' <div id="link_rewrite_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input size="30" type="text" id="input_link_rewrite_' . $language['id_lang'] . '" name="link_rewrite_' . $language['id_lang'] . '" onkeyup="this.value = str2url(this.value); updateFriendlyURL();" value="' . htmlentities($this->getFieldValue($obj, 'link_rewrite', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'link_rewrite');
echo ' </div><div class="clear space"> </div>';
// CONTENT
echo ' <label>' . $this->l('Page content') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo ' <div id="ccontent_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . ';float: left;">
<textarea class="rte" cols="80" rows="30" id="content_' . $language['id_lang'] . '" name="content_' . $language['id_lang'] . '">' . htmlentities(stripslashes($this->getFieldValue($obj, 'content', $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'ccontent');
echo ' </div><div class="clear space"> </div>
<label>' . $this->l('Enable:') . ' </label>
<div class="margin-form">
<input type="radio" name="active" id="active_on" onclick="toggleDraftWarning(false);" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
<input type="radio" name="active" id="active_off" onclick="toggleDraftWarning(true);" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
</div>';
// SUBMIT
echo ' <div class="margin-form space">
<input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" />
</div>
<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
</fieldset><br />
' . $this->_displayDraftWarning($obj->active) . '
</form>';
// TinyMCE
global $cookie;
$iso = Language::getIsoById((int) $cookie->id_lang);
$isoTinyMCE = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
$ad = dirname($_SERVER["PHP_SELF"]);
echo '
<script type="text/javascript">
var iso = \'' . $isoTinyMCE . '\' ;
var pathCSS = \'' . _THEME_CSS_DIR_ . '\' ;
var ad = \'' . $ad . '\' ;
</script>
<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tinymce.inc.js"></script>';
}
示例9: renderForm
public function renderForm()
{
$this->display = 'edit';
$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_parent'), 1);
$this->fields_form = array('legend' => array('title' => $this->l('CMS Category'), 'image' => '../img/admin/tab-categories.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'required' => true, 'lang' => true, 'class' => 'copy2friendlyUrl', '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')))), array('type' => 'select_category', 'label' => $this->l('Parent CMS Category:'), 'name' => 'id_parent', 'options' => array('html' => $html_categories)), array('type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'description', 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'lang' => true, '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' => 'text', 'label' => $this->l('Meta keywords:'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => $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 minus (-) character are allowed'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
$this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
return parent::renderForm();
}
示例10: generateCMSCategoryData
protected function generateCMSCategoryData()
{
$delimiter = ';';
$line = array();
$titles = array();
$new_path = new Sampledatainstall();
$id_lang = $this->use_lang;
$f = fopen($new_path->sendPath() . 'output/cms_categories.vsc', 'w');
foreach ($this->cms_category_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$cms_categories = CMSCategory::getCategories($id_lang);
if ($cms_categories) {
foreach ($cms_categories as $cms_category) {
foreach ($cms_category as $cc) {
$cms_cat = new Category($cc['infos']['id_cms_category'], $id_lang);
foreach ($this->cms_category_fields as $field => $array) {
$line[$field] = property_exists('Category', $field) && !is_array($cms_cat->{$field}) && !Tools::isEmpty($cms_cat->{$field}) ? $cms_cat->{$field} : '';
}
if (!$line[$field]) {
$line[$field] = '';
}
fputcsv($f, $line, $delimiter, '"');
}
}
}
fclose($f);
}
示例11: renderForm
public function renderForm()
{
$this->display = 'edit';
$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_parent'), 1);
$this->fields_form = array('legend' => array('title' => $this->l('CMS Category'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'required' => true, 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), 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')))), array('type' => 'select_category', 'label' => $this->l('Parent CMS Category'), 'name' => 'id_parent', 'options' => array('html' => $html_categories)), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta title'), 'name' => 'meta_title', 'lang' => true, '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' => 'text', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => $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 minus (-) character are allowed.'))), 'submit' => array('title' => $this->l('Save')));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
}
$this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
return parent::renderForm();
}
示例12: _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="../img/admin/enabled.gif" alt="Yes" title="Yes" />
<input type="radio" name="PS_STORES_DISPLAY_CMS" id="PS_STORES_DISPLAY_CMS_on" ' . (($cmsBlock and isset($cmsBlock[0]['display_store']) && $cmsBlock[0]['display_store'] == 0) ? '' : 'checked="checked" ') . 'value="1" />
<label class="t" for="PS_STORES_DISPLAY_CMS_on">' . $this->l('Yes') . '</label>
<img src="../img/admin/disabled.gif" alt="No" title="No" style="margin-left: 10px;" />
<input type="radio" name="PS_STORES_DISPLAY_CMS" id="PS_STORES_DISPLAY_CMS_off" ' . (($cmsBlock and isset($cmsBlock[0]['display_store']) && $cmsBlock[0]['display_store'] == 0) ? 'checked="checked" ' : '') . 'value="0" />
<label class="t" for="PS_STORES_DISPLAY_CMS_off">' . $this->l('No') . '</label><br />' . $this->l('Display "our stores" at the end of the block') . '</div>';
$this->_html .= '<div id="cms_subcategories"></div>
<p class="center">
<input type="submit" class="button" name="submitBlockCMS" value="' . $this->l('Save') . '" />
<a class="button" style="position:relative; padding:3px 3px 4px 3px; top:1px" href="' . $currentIndex . '&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules') . '">' . $this->l('Cancel') . '</a>
</p>';
$this->_html .= '
</fieldset>
</form>
<script type="text/javascript">CMSCategory_js($(\'#id_category\').val(), \'' . $this->secure_key . '\')</script>';
}
示例13: getContent
//.........这里部分代码省略.........
display:block;
margin:10px 0px;
text-align:center;
font-weight:bold;
border-radius: 10px;
-ms-border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
}
</style>
<fieldset>
<legend>' . $this->l('Settings') . '</legend>
<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" id="form">
<input type="hidden" name="items" id="itemsInput" value="" size="200" />
<div class="clear"> </div>
<div id="menu_items">
<div class=" box_submit">
<p class="center">
<input type="submit" id="submitwpblocktopmenu" name="submitwpblocktopmenu" value="' . $this->l(' Save ') . '" class="button" />
</p>
</div><h1>' . $this->l('Menu') . '</h1>
<div class="wp_items box">
<select multiple="multiple" id="availableItems" style="">';
//BEGIN CMS Categories
$this->_html .= '<optgroup label="' . $this->l('CMS Categories') . '">';
$_cms_cat = CMSCategory::getCategories($cookie->id_lang);
$this->_html .= $this->menuCMSCategory($_cms_cat, $_cms_cat[0][1], 1, 1, 1, 'CCS');
$this->_html .= '</optgroup>';
//END CMS Categories
// BEGIN CMS
$this->_html .= '<optgroup label="' . $this->l('CMS') . '">';
$_cms = CMS::listCms($cookie->id_lang);
foreach ($_cms as $cms) {
$this->_html .= '<option value="CMS' . $cms['id_cms'] . '" ">' . $cms['meta_title'] . '</option>';
}
$this->_html .= '</optgroup>';
// END CMS
// BEGIN SUPPLIER
$this->_html .= '<optgroup label="' . $this->l('Supplier') . '">';
$suppliers = Supplier::getSuppliers(false, $cookie->id_lang);
foreach ($suppliers as $supplier) {
$this->_html .= '<option value="SUP' . $supplier['id_supplier'] . '" ">' . $supplier['name'] . '</option>';
}
$this->_html .= '</optgroup>';
// END SUPPLIER
// BEGIN Manufacturer
$this->_html .= '<optgroup label="' . $this->l('Manufacturer') . '">';
$manufacturers = Manufacturer::getManufacturers(false, $cookie->id_lang);
foreach ($manufacturers as $manufacturer) {
$this->_html .= '<option value="MAN' . $manufacturer['id_manufacturer'] . '" ">' . $manufacturer['name'] . '</option>';
}
$this->_html .= '</optgroup>';
// END Manufacturer
// BEGIN Categories
$this->_html .= '<optgroup label="' . $this->l('Categories') . '">';
$this->getCategoryOption1(1, $cookie->id_lang);
$this->_html .= '</optgroup>';
// END Categories
示例14: fieldsetCmsCategory
public function fieldsetCmsCategory($children = true)
{
$categories = CMSCategory::getCategories($this->context->language->id, false);
$id_cms_category = 1;
if (isset($this->object->id_cms_category)) {
$id_cms_category = $this->object->id_cms_category;
}
$html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $id_cms_category, 1, false);
$fields = array('legend' => array('title' => $this->l('Cms Category'), 'class' => 'fieldset-cms-category', 'image' => $this->getPstPictureUrl('cms_category.png', 'type')), 'input' => array(array('type' => 'select_html', 'label' => $this->l('CMS Category'), 'name' => 'id_cms_category', 'options' => array('html' => $html_categories))));
if ($children) {
$fields['input'][] = array('type' => 'radio', 'class' => 't', 'label' => $this->l('Display childs ? :'), 'container_class' => 'display_cms_cat_childs', 'required' => false, 'name' => 'display_cms_cat_childs', 'desc' => $this->l('Display all sub categories'), 'is_bool' => true, 'values' => array(array('id' => 'display_cms_cat_childs_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'display_cms_cat_childs_off', 'value' => 0, 'label' => $this->l('Disabled'))));
}
$this->fields_form[] = array('class' => 'cms_category box-hide', 'form' => $fields);
}