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(); }
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(); }
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(); }
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>'; }
public static function recurseCMSCategory($categories, $current, $id_cms_category = 1, $id_selected = 1, $is_html = 0) { $html = '<option value="' . $id_cms_category . '"' . ($id_selected == $id_cms_category ? ' selected="selected"' : '') . '>' . str_repeat(' ', $current['infos']['level_depth'] * 5) . CMSCategory::hideCMSCategoryPosition(stripslashes($current['infos']['name'])) . '</option>'; if ($is_html == 0) { echo $html; } if (isset($categories[$id_cms_category])) { foreach (array_keys($categories[$id_cms_category]) as $key) { $html .= CMSCategory::recurseCMSCategory($categories, $categories[$id_cms_category][$key], $key, $id_selected, $is_html); } } return $html; }
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>'; }
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(); }
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(); }
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>'; }
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); }