public function getContent() { global $cookie; $html = ' <h2>' . $this->l('Payment logo') . '</h2> '; if (Tools::isSubmit('submitConfiguration')) { if (Validate::isUnsignedInt(Tools::getValue('id_cms'))) { Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', intval(Tools::getValue('id_cms'))); $html .= $this->displayConfirmation($this->l('Settings are updated')); } } $cmss = CMS::listCms(intval($cookie->id_lang)); if (!sizeof($cmss)) { $html .= $this->displayError($this->l('No CMS page is available')); } else { $html .= ' <form action="' . $_SERVER['REQUEST_URI'] . '" method="post"> <fieldset> <legend><img src="' . $this->_path . '/logo.gif" alt="" /> ' . $this->l('Configure') . '</legend> <label>' . $this->l('Page CMS for link') . ':</label> <div class="margin-form"> <select name="id_cms">'; foreach ($cmss as $cms) { $html .= '<option value="' . $cms['id_cms'] . '"' . (Configuration::get('PS_PAYMENT_LOGO_CMS_ID') == $cms['id_cms'] ? ' selected="selected"' : '') . '>' . $cms['meta_title'] . '</option>'; } $html .= '</select> </div> <p class="center"><input class="button" type="submit" name="submitConfiguration" value="' . $this->l('Save settings') . '" /></p> </fieldset> </form> '; } return $html; }
public function getContent() { $html = ' <h2>' . $this->l('Payment logo.') . '</h2> '; if (Tools::isSubmit('submitConfiguration')) { if (Validate::isUnsignedInt(Tools::getValue('id_cms'))) { Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', (int) Tools::getValue('id_cms')); $this->_clearCache('blockpaymentlogo.tpl'); $html .= $this->displayConfirmation($this->l('The settings have been updated.')); } } $cmss = CMS::listCms($this->context->language->id); if (!count($cmss)) { $html .= $this->displayError($this->l('No CMS page is available.')); } else { $html .= ' <form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post"> <fieldset> <legend><img src="' . $this->_path . '/logo.gif" alt="" /> ' . $this->l('Configure') . '</legend> <label>' . $this->l('Page CMS for link') . ':</label> <div class="margin-form"> <select name="id_cms"><option value="0">(' . $this->l('Select a page') . ')</option>'; foreach ($cmss as $cms) { $html .= '<option value="' . $cms['id_cms'] . '"' . (Configuration::get('PS_PAYMENT_LOGO_CMS_ID') == $cms['id_cms'] ? ' selected="selected"' : '') . '>' . $cms['meta_title'] . '</option>'; } $html .= '</select> </div> <p class="center"><input class="button" type="submit" name="submitConfiguration" value="' . $this->l('Save settings') . '" /></p> </fieldset> </form> '; } return $html; }
private function _displayForm() { global $cookie; $this->_html .= '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post"> <fieldset> <legend>' . $this->l('Selected files displayed') . '</legend> <span>' . $this->l('Please check files that will be displayed in this module') . '.</span><br /><br /> <table cellspacing="0" cellpadding="0" class="table" style="width: 29.5em;"> <thead> <tr> <th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'categoryBox[]\', this.checked)" /></th> <th>' . $this->l('ID') . '</th> <th>' . $this->l('Name') . '</th> </tr> </thead> <tbody>'; $cms = CMS::listCms(intval($cookie->id_lang)); foreach ($cms as $row) { $this->_html .= '<tr><td><input type="checkbox" class="noborder" value="' . intval($row['id_cms']) . '" name="categoryBox[]" ' . (CMS::isInBlock(intval($row['id_cms']), intval($this->id)) ? 'checked="checked"' : '') . '></td><td>' . intval($row['id_cms']) . '</td><td>' . $row['meta_title'] . '</td></tr>'; } $this->_html .= ' </tbody> </table> <br /> <input type="submit" name="btnSubmit" class="button" value="' . $this->l('Update') . '"> </fieldset> </form>'; }
public function __construct() { global $cookie; $this->className = 'Configuration'; $this->table = 'configuration'; $max_upload = (int) ini_get('upload_max_filesize'); $max_post = (int) ini_get('post_max_size'); $upload_mb = min($max_upload, $max_post); $timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT name FROM ' . _DB_PREFIX_ . 'timezone'); $taxes[] = array('id' => 0, 'name' => $this->l('None')); foreach (Tax::getTaxes((int) $cookie->id_lang) as $tax) { $taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']); } $order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout'))); $round_mode = array(array('value' => PS_ROUND_UP, 'name' => $this->l('superior')), array('value' => PS_ROUND_DOWN, 'name' => $this->l('inferior')), array('value' => PS_ROUND_HALF, 'name' => $this->l('classical'))); $cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None'))); foreach (CMS::listCms($cookie->id_lang) as $cms_file) { $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']); } $this->_fieldsGeneral = array('PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it. Please note that the webservice will not be disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP'), 'desc' => $this->l('IP addresses allowed to access the Front Office even if shop is disabled. Use a comma to separate them (e.g., 42.24.4.2,127.0.0.1,99.98.97.96)'), 'validation' => 'isGenericName', 'type' => 'maintenance_ip', 'size' => 30, 'default' => ''), 'PS_SSL_ENABLED' => array('title' => $this->l('Enable SSL'), 'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_CHECKIP' => array('title' => $this->l('Check IP on the cookie'), 'desc' => $this->l('Check the IP address of the cookie in order to avoid your cookie being stolen'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_LIFETIME_FO' => array('title' => $this->l('Lifetime of the Front Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480'), 'PS_COOKIE_LIFETIME_BO' => array('title' => $this->l('Lifetime of the Back Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480'), 'PS_TOKEN_ENABLE' => array('title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_HELPBOX' => array('title' => $this->l('Back Office help boxes'), 'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Your guest can make an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use of CMS page'), 'desc' => $this->l('Choose the Conditions of use of CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'), 'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrap pricing'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_ATTACHMENT_MAXIMUM_SIZE' => array('title' => $this->l('Maximum attachment size'), 'desc' => $this->l('Set the maximum size of attached files (in Megabytes ).') . ' ' . $this->l('Maximum:') . ' ' . ((int) str_replace('M', '', ini_get('post_max_size')) > (int) str_replace('M', '', ini_get('upload_max_filesize')) ? ini_get('upload_max_filesize') : ini_get('post_max_size')), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '2'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CART_FOLLOWING' => array('title' => $this->l('Save cart content and re-display it at login'), 'desc' => $this->l('Recall and display contents of shopping cart following customer login'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PRICE_ROUND_MODE' => array('title' => $this->l('Round mode'), 'desc' => $this->l('You can choose how to round prices: always round superior; always round inferior, or classic rounding'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $round_mode, 'identifier' => 'value'), 'PRESTASTORE_LIVE' => array('title' => $this->l('Automatically check for module updates'), 'desc' => $this->l('New modules and updates are displayed on the modules page'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_HIDE_OPTIMIZATION_TIPS' => array('title' => $this->l('Hide optimization tips'), 'desc' => $this->l('Hide optimization tips on the back office homepage'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISPLAY_SUPPLIERS' => array('title' => $this->l('Display suppliers and manufacturers'), 'desc' => $this->l('Display manufacturers and suppliers list even if corresponding blocks are disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_FORCE_SMARTY_2' => array('title' => $this->l('Use Smarty 2 instead of 3'), 'desc' => $this->l('Enable if your theme is incompatible with Smarty 3 (you should update your theme, since Smarty 2 will be unsupported from PrestaShop v1.5)'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_LIMIT_UPLOAD_FILE_VALUE' => array('title' => $this->l('Limit upload file value'), 'desc' => $this->l('Define the limit upload for a downloadable product, this value has to be inferior or equal to your server\'s maximum upload file ') . sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'limit', 'default' => '1'), 'PS_LIMIT_UPLOAD_IMAGE_VALUE' => array('title' => $this->l('Limit upload image value'), 'desc' => $this->l('Define the limit upload for an image, this value has to be inferior or equal to your server\'s maximum upload file ') . sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'limit', 'default' => '1')); if (function_exists('date_default_timezone_set')) { $this->_fieldsGeneral['PS_TIMEZONE'] = array('title' => $this->l('Time Zone:'), 'validation' => 'isAnything', 'type' => 'select', 'list' => $timezones, 'identifier' => 'name'); } // No HTTPS activation if you haven't already. if (!Tools::usingSecureMode() && !_PS_SSL_ENABLED_) { $this->_fieldsGeneral['PS_SSL_ENABLED']['type'] = 'disabled'; $this->_fieldsGeneral['PS_SSL_ENABLED']['disabled'] = '<a href="https://' . Tools::getShopDomainSsl() . Tools::safeOutput($_SERVER['REQUEST_URI']) . '">' . $this->l('Please click here to use HTTPS protocol before enabling SSL.') . '</a>'; } parent::__construct(); }
/** * @return mixed */ public function renderForm() { if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj)) { $link = $obj->getImageLink(); if (file_exists($obj->getImageLink(_PS_IMG_DIR_))) { $size = round(filesize($obj->getImageLink(_PS_IMG_DIR_)) / 1024); } } $this->fields_form = array('legend' => array('title' => $this->module->l('Block reinsurance', 'AdminBlockReinsurance'), 'icon' => 'icon-list-alt'), 'input' => array(array('type' => 'text', 'label' => $this->module->l('Name', 'AdminBlockReinsurance'), 'name' => 'name', 'required' => true, 'lang' => true), array('type' => 'text', 'label' => $this->module->l('Link', 'AdminBlockReinsurance'), 'name' => 'link', 'lang' => true), array('type' => 'textarea', 'label' => $this->module->l('Description', 'AdminBlockReinsurance'), 'name' => 'description', 'required' => true, 'lang' => true, 'autoload_rte' => true), array('type' => 'file', 'label' => $this->module->l('Image (.png)', 'AdminBlockReinsurance'), 'name' => 'image', 'display_image' => true, 'show_thumbnail' => true, 'image' => isset($link) ? '<img src="' . $link . '"/>' : null, 'size' => isset($size) ? $size : null), array('type' => 'select', 'label' => $this->module->l('CMS page linked', 'AdminBlockReinsurance'), 'name' => 'id_cms', 'required' => true, 'default_value' => 'left', 'options' => array('query' => CMS::listCms($this->context->language->id), 'id' => 'id_cms', 'name' => 'meta_title', 'default' => array('label' => $this->module->l('No cms page', 'AdminBlockReinsurance'), 'value' => 0))), array('type' => 'switch', 'label' => $this->module->l('Enable', 'AdminBlockReinsurance'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminBlockReinsurance')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminBlockReinsurance'))))), 'submit' => array('title' => $this->module->l('Save', 'AdminBlockReinsurance'))); return parent::renderForm(); }
/** * @return mixed */ public function renderForm() { if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj)) { $link = $obj->getImageLink(); if (file_exists($obj->getImageLink(_PS_IMG_DIR_))) { $size = round(filesize($obj->getImageLink(_PS_IMG_DIR_)) / 1024); } } $this->fields_form = array('legend' => array('title' => $this->module->l('Block Slideshow', 'AdminNowSlideshow'), 'icon' => 'icon-list-alt'), 'input' => array(array('type' => 'text', 'label' => $this->module->l('Name', 'AdminNowSlideshow'), 'name' => 'name', 'required' => true, 'lang' => true), array('type' => 'text', 'label' => $this->module->l('Title', 'AdminNowSlideshow'), 'name' => 'title', 'required' => true, 'lang' => true), array('type' => 'text', 'label' => $this->module->l('Button name', 'AdminNowSlideshow'), 'name' => 'button_name', 'required' => true, 'lang' => true), array('type' => 'textarea', 'label' => $this->module->l('Description', 'AdminNowSlideshow'), 'name' => 'description', 'required' => true, 'lang' => true, 'autoload_rte' => true), array('type' => 'select', 'label' => $this->module->l('Type of link', 'AdminNowSlideshow'), 'name' => 'type', 'required' => true, 'default_value' => NowSlideshow::TYPE_LINK, 'options' => array('query' => array(array('id_type' => NowSlideshow::TYPE_CATEGORY, 'type' => $this->module->l('Category', 'AdminNowSlideshow')), array('id_type' => NowSlideshow::TYPE_CMS, 'type' => $this->module->l('CMS', 'AdminNowSlideshow')), array('id_type' => NowSlideshow::TYPE_LINK, 'type' => $this->module->l('Link', 'AdminNowSlideshow')), array('id_type' => NowSlideshow::TYPE_MANUFACTURER, 'type' => $this->module->l('Manufacturer', 'AdminNowSlideshow'))), 'id' => 'id_type', 'name' => 'type')), array('type' => 'text', 'label' => $this->module->l('ID type', 'AdminNowSlideshow'), 'name' => 'id_type', 'form_group_class' => 'idTypeDiv'), array('type' => 'categories', 'label' => $this->l('Category'), 'name' => 'category', 'tree' => array('id' => 'categories-tree'), 'form_group_class' => 'categoryDiv'), array('type' => 'select', 'label' => $this->module->l('CMS', 'AdminNowSlideshow'), 'name' => 'cms', 'options' => array('query' => CMS::listCms($this->context->language->id), 'id' => 'id_cms', 'name' => 'meta_title'), 'form_group_class' => 'cmsDiv'), array('type' => 'select', 'label' => $this->module->l('Manufacturer', 'AdminNowSlideshow'), 'name' => 'manufacturer', 'options' => array('query' => Manufacturer::getManufacturers(false, $this->context->language->id), 'id' => 'id_manufacturer', 'name' => 'name'), 'form_group_class' => 'manufacturerDiv'), array('type' => 'text', 'label' => $this->module->l('Link', 'AdminNowSlideshow'), 'name' => 'link', 'form_group_class' => 'linkDiv', 'lang' => true), array('type' => 'file', 'label' => $this->module->l('Image (.png)', 'AdminNowSlideshow'), 'name' => 'image', 'display_image' => true, 'show_thumbnail' => true, 'image' => isset($link) ? '<img src="' . $link . '"/>' : null, 'size' => isset($size) ? $size : null), array('type' => 'switch', 'label' => $this->module->l('Enable', 'AdminNowSlideshow'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowSlideshow')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowSlideshow'))))), 'submit' => array('title' => $this->module->l('Save', 'AdminNowSlideshow'))); return parent::renderForm(); }
public function renderForm() { if (!($obj = $this->loadObject(true))) { return; } $products = Product::getProducts((int) $this->context->language->id, 0, 0, 'id_product', 'ASC'); foreach ($products as $product) { $productList[] = array('key' => $product['id_product'], 'name' => '(' . $product['id_product'] . ') ' . $product['name']); } $categories = Category::getSimpleCategories((int) $this->context->language->id); foreach ($categories as $category) { $categoryList[] = array('key' => $category['id_category'], 'name' => '(' . $category['id_category'] . ') ' . $category['name']); } $cmss = CMS::listCms(); foreach ($cmss as $cms) { $cmsList[] = array('key' => $cms['id_cms'], 'name' => '(' . $cms['id_cms'] . ') ' . $cms['meta_title']); } $this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('Slideshow'), 'image' => '../img/admin/cog.gif'), 'input' => array(array('type' => 'text', 'lang' => true, 'label' => $this->l('Name:'), 'name' => 'name', 'size' => 40), array('type' => 'text', 'label' => $this->l('Width:'), 'name' => 'width', 'size' => 10, 'desc' => $this->l('If you change the width of the it will be necessary to upload images again')), array('type' => 'text', 'label' => $this->l('Height:'), 'name' => 'height', 'size' => 10, 'desc' => $this->l('If you change the height of the it will be necessary to upload images again')), array('type' => 'select', 'label' => $this->l('Effect:'), 'name' => 'effect', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('random')), array('key' => 1, 'name' => $this->l('swirl')), array('key' => 2, 'name' => $this->l('rain')), array('key' => 3, 'name' => $this->l('straight'))), 'name' => 'name', 'id' => 'key')), array('type' => 'text', 'label' => $this->l('Squares per width:'), 'name' => 'spw', 'size' => 10, 'desc' => $this->l('large number can cause transitions problems, Example: 7')), array('type' => 'text', 'label' => $this->l('Squares per height:'), 'name' => 'sph', 'size' => 10, 'desc' => $this->l('large number can cause transitions problems, Example: 5')), array('type' => 'text', 'label' => $this->l('Delay:'), 'name' => 'delay', 'size' => 10, 'desc' => $this->l('delay between images in ms, Example: 3000')), array('type' => 'text', 'label' => $this->l('Square delay:'), 'name' => 'sDelay', 'size' => 10, 'desc' => $this->l('delay beetwen squares in ms. Example: 30')), array('type' => 'text', 'label' => $this->l('Opacity:'), 'name' => 'opacity', 'size' => 10, 'desc' => $this->l('opacity of title and navigation. Example: 0.7')), array('type' => 'text', 'label' => $this->l('Title speed:'), 'name' => 'titleSpeed', 'size' => 10, 'desc' => $this->l('speed of title appereance in ms. Example: 500')), array('type' => 'select', 'label' => $this->l('Navigation:'), 'name' => 'navigation', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Links:'), 'name' => 'links', 'desc' => $this->l('Enable links.'), 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Hover pause:'), 'name' => 'hoverpause', 'desc' => $this->l('pause on hover.'), 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Show on home:'), 'name' => 'home', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Show on all category:'), 'name' => 'showOnCat', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Categories:'), 'name' => 'categories[]', 'id' => 'categories', 'options' => array('query' => $categoryList, 'name' => 'name', 'id' => 'key'), 'multiple' => true, 'desc' => $this->l('Choose one or several category s page where the slideshow will be displayed.')), array('type' => 'select', 'label' => $this->l('Show on all product:'), 'name' => 'showOnProd', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Products:'), 'name' => 'products[]', 'id' => 'products', 'options' => array('query' => $productList, 'name' => 'name', 'id' => 'key'), 'multiple' => true, 'desc' => $this->l('Choose one or several product s page where the slideshow will be displayed.')), array('type' => 'select', 'label' => $this->l('Show on all cms page:'), 'name' => 'showOnCms', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Cms:'), 'name' => 'cms[]', 'id' => 'cms', 'options' => array('query' => $cmsList, 'name' => 'name', 'id' => 'key'), 'multiple' => true, 'desc' => $this->l('Choose one or several cms s page where the slideshow will be displayed.')), array('type' => 'select', 'label' => $this->l('Hook:'), 'name' => 'hook', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('name' => 'displayTop'), array('name' => 'displayHome'), array('name' => 'displayLeftColumn'), array('name' => 'displayRightColumn'), array('name' => 'displayOpartSlideshowHook')), 'name' => 'name', 'id' => 'name'), 'desc' => $this->l('You must hook the module for display your slideshow on each position. Go to modules/positions menu for setup this')), array('type' => 'select', 'label' => $this->l('Statut:'), 'name' => 'active', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('disable')), array('key' => 1, 'name' => $this->l('enable'))), 'name' => 'name', 'id' => 'key'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')); if (is_numeric($obj->id)) { //products value $sql = 'SELECT id_product FROM ' . _DB_PREFIX_ . 'opartslideshow_slideshow_product WHERE id_opartslideshow_slideshow = ' . $obj->id; $array = Db::getInstance()->executeS($sql); if (count($array)) { foreach ($array as $row) { $productValues[] = $row['id_product']; } $this->fields_value['products[]'] = $productValues; } //categories value $sql = 'SELECT id_category FROM ' . _DB_PREFIX_ . 'opartslideshow_slideshow_category WHERE id_opartslideshow_slideshow = ' . $obj->id; $array = Db::getInstance()->executeS($sql); if (count($array)) { foreach ($array as $row) { $categoriesValues[] = $row['id_category']; } $this->fields_value['categories[]'] = $categoriesValues; } //cms value $sql = 'SELECT id_cms FROM ' . _DB_PREFIX_ . 'opartslideshow_slideshow_cms WHERE id_opartslideshow_slideshow = ' . $obj->id; $array = Db::getInstance()->executeS($sql); if (count($array)) { foreach ($array as $row) { $cmsValues[] = $row['id_cms']; } $this->fields_value['cms[]'] = $cmsValues; } } $html = $header = $this->context->smarty->fetch(parent::getTemplatePath() . 'header.tpl'); $html .= parent::renderForm(); return $html; }
public function __construct() { $this->className = 'Configuration'; $this->table = 'configuration'; parent::__construct(); // List of CMS tabs $cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None'))); foreach (CMS::listCms($this->context->language->id) as $cms_file) { $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']); } // List of order process types $order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout'))); $this->fields_options = array('general' => array('title' => $this->l('General'), 'icon' => 'tab-preferences', 'fields' => array('PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Guests can place an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->l('Minimum purchase total required in order to validate order'), 'desc' => $this->l('Set to 0 to disable this feature'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->l('Allow multi-shipping'), 'desc' => $this->l('Allow the customer to ship his order to multiple addresses. This option will convert the customer\'s cart into one or more orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_SHIP_WHEN_AVAILABLE' => array('title' => $this->l('Delayed shipping'), 'desc' => $this->l('Allow the customer to split his order: one with the products currently "in stock", and another with the other products. This option will convert the customer\'s cart into two orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use CMS page'), 'desc' => $this->l('Choose the Conditions of use CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'))), 'gift' => array('title' => $this->l('Gift options'), 'icon' => 'tab-preferences', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX_RULES_GROUP' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->l('None'))), TaxRulesGroup::getTaxRulesGroups(true)), 'identifier' => 'id_tax_rules_group'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'))); }
public function __construct() { $this->bootstrap = true; $this->className = 'Configuration'; $this->table = 'configuration'; parent::__construct(); // List of CMS tabs $cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None'))); foreach (CMS::listCms($this->context->language->id) as $cms_file) { $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']); } // List of order process types $order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (Five steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One-page checkout'))); $this->fields_options = array('general' => array('title' => $this->l('General'), 'icon' => 'icon-cogs', 'fields' => array('PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'hint' => $this->l('Please choose either the five-step or one-page checkout process.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'hint' => $this->l('Allow guest visitors to place an order without registering.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISALLOW_HISTORY_REORDERING' => array('title' => $this->l('Disable Reordering Option'), 'hint' => $this->l('Disable the option to allow customers to reorder in one click from the order history page (required in some European countries).'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->l('Minimum purchase total required in order to validate the order'), 'hint' => $this->l('Set to 0 to disable this feature.'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->l('Allow multishipping'), 'hint' => $this->l('Allow the customer to ship orders to multiple addresses. This option will convert the customer\'s cart into one or more orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_SHIP_WHEN_AVAILABLE' => array('title' => $this->l('Delayed shipping'), 'hint' => $this->l('Allows you to delay shipping at your customers\' request. '), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'hint' => $this->l('Require customers to accept or decline terms of service before processing an order.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('CMS page for the Conditions of use'), 'hint' => $this->l('Choose the CMS page which contains your store\'s conditions of use.'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval')), 'submit' => array('title' => $this->l('Save'))), 'gift' => array('title' => $this->l('Gift options'), 'icon' => 'icon-gift', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift wrapping'), 'hint' => $this->l('Suggest gift-wrapping to customers.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'hint' => $this->l('Set a price for gift wrapping.'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX_RULES_GROUP' => array('title' => $this->l('Gift-wrapping tax'), 'hint' => $this->l('Set a tax for gift wrapping.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->l('None'))), TaxRulesGroup::getTaxRulesGroups(true)), 'identifier' => 'id_tax_rules_group'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'hint' => $this->l('Suggest recycled packaging to customer.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save')))); if (!Configuration::get('PS_ALLOW_MULTISHIPPING')) { unset($this->fields_options['general']['fields']['PS_ALLOW_MULTISHIPPING']); } }
public function __construct() { $this->bootstrap = true; $this->className = 'Configuration'; $this->table = 'configuration'; parent::__construct(); // List of CMS tabs $cms_tab = array(0 => array('id' => 0, 'name' => $this->trans('None', array(), 'Admin.Global'))); foreach (CMS::listCms($this->context->language->id) as $cms_file) { $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']); } $this->fields_options = array('general' => array('title' => $this->trans('General', array(), 'Admin.Global'), 'icon' => 'icon-cogs', 'fields' => array('PS_FINAL_SUMMARY_ENABLED' => array('title' => $this->trans('Enable final summary', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Display an overview of the addresses, shipping method and cart just before the order button (required in some European countries).', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->trans('Enable guest checkout', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Allow guest visitors to place an order without registering.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISALLOW_HISTORY_REORDERING' => array('title' => $this->trans('Disable Reordering Option', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Disable the option to allow customers to reorder in one click from the order history page (required in some European countries).', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->trans('Minimum purchase total required in order to validate the order', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Set to 0 to disable this feature.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ORDER_RECALCULATE_SHIPPING' => array('title' => $this->trans('Recalculate shipping cost after order edition', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Automatically updates the shipping costs when you edit an order.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->trans('Allow multishipping', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Allow the customer to ship orders to multiple addresses. This option will convert the customer\'s cart into one or more orders.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_SHIP_WHEN_AVAILABLE' => array('title' => $this->trans('Delayed shipping', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Allows you to delay shipping at your customers\' request.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->trans('Terms of service', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Require customers to accept or decline terms of service before processing an order.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->trans('Page for the Terms and conditions', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Choose the page which contains your store\'s terms and conditions of use.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval')), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions'))), 'gift' => array('title' => $this->trans('Gift options', array(), 'Admin.ShopParameters.Feature'), 'icon' => 'icon-gift', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->trans('Offer gift wrapping', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Suggest gift-wrapping to customers.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->trans('Gift-wrapping price', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Set a price for gift wrapping.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX_RULES_GROUP' => array('title' => $this->trans('Gift-wrapping tax', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Set a tax for gift wrapping.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->trans('None'))), TaxRulesGroup::getTaxRulesGroups(true)), 'identifier' => 'id_tax_rules_group'), 'PS_RECYCLABLE_PACK' => array('title' => $this->trans('Offer recycled packaging', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Suggest recycled packaging to customer.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions')))); if (!Configuration::get('PS_ALLOW_MULTISHIPPING')) { unset($this->fields_options['general']['fields']['PS_ALLOW_MULTISHIPPING']); } if (Configuration::get('PS_ATCP_SHIPWRAP')) { unset($this->fields_options['gift']['fields']['PS_GIFT_WRAPPING_TAX_RULES_GROUP']); } }
public function __construct() { global $cookie; $this->className = 'Configuration'; $this->table = 'configuration'; $timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT name FROM ' . _DB_PREFIX_ . 'timezone'); $taxes[] = array('id' => 0, 'name' => $this->l('None')); foreach (Tax::getTaxes((int) $cookie->id_lang) as $tax) { $taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']); } $order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout'))); $round_mode = array(array('value' => PS_ROUND_UP, 'name' => $this->l('superior')), array('value' => PS_ROUND_DOWN, 'name' => $this->l('inferior')), array('value' => PS_ROUND_HALF, 'name' => $this->l('classical'))); $cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None'))); foreach (CMS::listCms($cookie->id_lang) as $cms_file) { $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']); } $this->_fieldsGeneral = array('PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it. Please note that the webservice will not be disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP'), 'desc' => $this->l('IP addresses allowed to access the Front Office even if shop is disabled. Use a comma to separate them (e.g., 42.24.4.2,127.0.0.1,99.98.97.96)'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 15, 'default' => ''), 'PS_SSL_ENABLED' => array('title' => $this->l('Enable SSL'), 'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_CHECKIP' => array('title' => $this->l('Check IP on the cookie'), 'desc' => $this->l('Check the IP address of the cookie in order to avoid your cookie being stolen'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_TOKEN_ENABLE' => array('title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_HELPBOX' => array('title' => $this->l('Back Office help boxes'), 'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Your guest can make an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use CMS page'), 'desc' => $this->l('Choose the Conditions of use CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'), 'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_ATTACHMENT_MAXIMUM_SIZE' => array('title' => $this->l('Attachment maximum size'), 'desc' => $this->l('Set the maximum size of attachment files (in MegaBytes)'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CART_FOLLOWING' => array('title' => $this->l('Cart re-display at login'), 'desc' => $this->l('After customer logs in, recall and display contents of his/her last shopping cart'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PRICE_ROUND_MODE' => array('title' => $this->l('Round mode'), 'desc' => $this->l('You can choose how to round prices: always round superior; always round inferior, or classic rounding'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $round_mode, 'identifier' => 'value'), 'PRESTASTORE_LIVE' => array('title' => $this->l('Automatically check for module updates'), 'desc' => $this->l('New modules and updates are displayed on the modules page'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_HIDE_OPTIMIZATION_TIPS' => array('title' => $this->l('Hide optimization tips'), 'desc' => $this->l('Hide optimization tips on the back office homepage'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISPLAY_SUPPLIERS' => array('title' => $this->l('Display suppliers and manufacturers'), 'desc' => $this->l('Display manufacturers and suppliers list even if corresponding blocks are disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_FORCE_SMARTY_2' => array('title' => $this->l('Use Smarty 2 instead of 3'), 'desc' => $this->l('Enable if your theme is incompatible with Smarty 3 (you should update your theme, since Smarty 2 will be unsupported from PrestaShop v1.5)'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')); if (function_exists('date_default_timezone_set')) { $this->_fieldsGeneral['PS_TIMEZONE'] = array('title' => $this->l('Time Zone:'), 'validation' => 'isAnything', 'type' => 'select', 'list' => $timezones, 'identifier' => 'name'); } parent::__construct(); }
public function __construct() { $this->bootstrap = true; $this->table = 'now_block_customer_references'; $this->className = 'NowBlockCustomerReferences'; $this->module = new now_block_customer_references(); $this->lang = true; $this->_defaultOrderBy = 'position'; $this->orderBy = 'position'; $this->position_identifier = 'position'; $this->addRowAction('edit'); $this->addRowAction('delete'); $this->bulk_actions = array('delete' => array('text' => $this->module->l('Delete selected', 'AdminBlockCustomerReferences'), 'confirm' => $this->module->l('Delete selected items?', 'AdminBlockCustomerReferences'), 'icon' => 'icon-trash')); $this->context = Context::getContext(); $this->fieldImageSettings = array('name' => 'image', 'dir' => 'now_block_customer_references'); $this->imageType = 'png'; $this->fields_list = array('id_now_block_customer_references' => array('title' => $this->module->l('ID', 'AdminBlockCustomerReferences'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'image' => array('title' => $this->module->l('Image', 'AdminBlockCustomerReferences'), 'align' => 'center', 'image' => 'now_block_customer_references', 'class' => 'fixed-width-xs', 'orderby' => false, 'search' => false), 'name' => array('title' => $this->module->l('Name', 'AdminBlockCustomerReferences'), 'width' => 'auto'), 'active' => array('title' => $this->module->l('Enabled', 'AdminBlockCustomerReferences'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'class' => 'fixed-width-sm'), 'position' => array('title' => $this->module->l('Position', 'AdminBlockCustomerReferences'), 'filter_key' => 'a!position', 'position' => 'position', 'align' => 'center'), 'date_upd' => array('title' => $this->module->l('Updated Date', 'AdminBlockCustomerReferences'), 'width' => 'auto', 'type' => 'datetime')); $aCmsList = array(); foreach (CMS::listCms($this->context->language->id) as $aRow) { $aCmsList[] = array('id_cms' => $aRow['id_cms'], 'name' => $aRow['meta_title']); } parent::__construct(); }
public function __construct() { $this->bootstrap = true; $this->table = 'now_block_presentation'; $this->className = 'NowBlockPresentation'; $this->module = new now_block_presentation(); $this->lang = true; $this->_defaultOrderBy = 'position'; $this->orderBy = 'position'; $this->position_identifier = 'position'; $this->addRowAction('edit'); $this->addRowAction('delete'); $this->bulk_actions = array('delete' => array('text' => $this->module->l('Delete selected', 'AdminBlockPresentation'), 'confirm' => $this->module->l('Delete selected items?', 'AdminBlockPresentation'), 'icon' => 'icon-trash')); $this->context = Context::getContext(); $this->fieldImageSettings = array('name' => 'image', 'dir' => 'now_block_presentation'); $this->imageType = 'png'; $this->fields_list = array('id_now_block_presentation' => array('title' => $this->module->l('ID', 'AdminBlockPresentation'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'image' => array('title' => $this->module->l('Image', 'AdminBlockPresentation'), 'align' => 'center', 'image' => 'now_block_presentation', 'class' => 'fixed-width-xs', 'orderby' => false, 'search' => false), 'name' => array('title' => $this->module->l('Name', 'AdminBlockPresentation'), 'width' => 'auto'), 'active' => array('title' => $this->module->l('Enabled', 'AdminBlockPresentation'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'class' => 'fixed-width-sm'), 'position' => array('title' => $this->module->l('Position', 'AdminBlockPresentation'), 'filter_key' => 'a!position', 'position' => 'position', 'align' => 'center'), 'date_upd' => array('title' => $this->module->l('Updated Date', 'AdminBlockPresentation'), 'width' => 'auto', 'type' => 'datetime')); $aCmsList = array(); foreach (CMS::listCms($this->context->language->id) as $aRow) { $aCmsList[] = array('id_cms' => $aRow['id_cms'], 'name' => $aRow['meta_title']); } $this->fields_options = array('contact' => array('title' => $this->module->l('Presentation of the company option', 'AdminBlockPresentation'), 'fields' => array('NOW_PRESENTATION_CMS_ID' => array('title' => $this->module->l('CMS Page', 'AdminBlockPresentation'), 'desc' => $this->module->l('CMS page witch redirect when to click on the button "EN SAVOIR PLUS sur neon flexible"', 'AdminBlockPresentation'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_cms', 'list' => $aCmsList, 'visibility' => Shop::CONTEXT_ALL)), 'submit' => array('title' => $this->module->l('Save', 'AdminBlockPresentation')))); parent::__construct(); }
public function getContent() { global $cookie; if (Tools::isSubmit('submitBlocktopmenu')) { if (Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', Tools::getValue('items'))) { $this->_html .= $this->displayConfirmation($this->l('Settings Updated')); } else { $this->_html .= $this->displayError($this->l('Unable to update settings')); } Configuration::updateValue('MOD_BLOCKTOPMENU_SEARCH', (bool) Tools::getValue('search')); } if (Tools::isSubmit('submitBlocktopmenuLinks')) { if (Tools::getValue('link') == '') { $this->_html .= $this->displayError($this->l('Unable to add this link')); } else { MenuTopLinks::add(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0)); $this->_html .= $this->displayConfirmation($this->l('The link has been added')); } } if (Tools::isSubmit('submitBlocktopmenuRemove')) { $id_link = Tools::getValue('id_link', 0); MenuTopLinks::remove($id_link); Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', str_replace(array('LNK' . $id_link . ',', 'LNK' . $id_link), '', Configuration::get('MOD_BLOCKTOPMENU_ITEMS'))); $this->_html .= $this->displayConfirmation($this->l('The link has been removed')); } $this->_html .= ' <fieldset> <legend><img src="' . $this->_path . 'logo.gif" alt="" title="" />' . $this->l('Settings') . '</legend> <form action="' . $_SERVER['REQUEST_URI'] . '" method="post" id="form"> <div style="display: none"> <label>' . $this->l('Items') . '</label> <div class="margin-form"> <input type="text" name="items" id="itemsInput" value="' . Configuration::get('MOD_BLOCKTOPMENU_ITEMS') . '" size="70" /> </div> </div> <div class="clear"> </div> <table style="margin-left: 130px;"> <tbody> <tr> <td> <select multiple="multiple" id="items" style="width: 300px; height: 160px;">'; $this->makeMenuOption(); $this->_html .= '</select><br/> <br/> <a href="#" id="removeItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">' . $this->l('Remove') . ' >></a> </td> <td style="padding-left: 20px;"> <select multiple="multiple" id="availableItems" style="width: 300px; height: 160px;">'; // 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'] . '" style="margin-left:10px;">' . $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'] . '" style="margin-left:10px;">' . $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'] . '" style="margin-left:10px;">' . $manufacturer['name'] . '</option>'; } $this->_html .= '</optgroup>'; // END Manufacturer // BEGIN Categories $this->_html .= '<optgroup label="' . $this->l('Categories') . '">'; $this->getCategoryOption(1, $cookie->id_lang); $this->_html .= '</optgroup>'; // END Categories // BEGIN Products $this->_html .= '<optgroup label="' . $this->l('Products') . '">'; $this->_html .= '<option value="PRODUCT" style="margin-left:10px;font-style:italic">' . $this->l('Choose ID product') . '</option>'; $this->_html .= '</optgroup>'; // END Products // BEGIN Menu Top Links $this->_html .= '<optgroup label="' . $this->l('Menu Top Links') . '">'; $links = MenuTopLinks::gets($cookie->id_lang); foreach ($links as $link) { $this->_html .= '<option value="LNK' . $link['id_link'] . '" style="margin-left:10px;">' . $link['label'] . '</option>'; } $this->_html .= '</optgroup>'; // END Menu Top Links $this->_html .= '</select><br /> <br /> <a href="#" id="addItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);"><< ' . $this->l('Add') . '</a> </td> </tr> </tbody> </table> <div class="clear"> </div> <script type="text/javascript"> $(document).ready(function(){ $("#addItem").click(add); $("#availableItems").dblclick(add); $("#removeItem").click(remove); $("#items").dblclick(remove); function add() { $("#availableItems option:selected").each(function(i){ var val = $(this).val(); var text = $(this).text(); if(val == "PRODUCT") { val = prompt("' . $this->l('Set ID product') . '"); if(val == null || val == "" || isNaN(val)) return; text = "' . $this->l('Product ID') . ' "+val; val = "PRD"+val; } $("#items").append("<option value=\\""+val+"\\">"+text+"</option>"); }); serialize(); return false; } function remove() { $("#items option:selected").each(function(i){ $(this).remove(); }); serialize(); return false; } function serialize() { var options = ""; $("#items option").each(function(i){ options += $(this).val()+","; }); $("#itemsInput").val(options.substr(0, options.length - 1)); } }); </script> <label for="s">' . $this->l('Search Bar') . '</label> <div class="margin-form"> <input type="checkbox" name="search" id="s" value="1"' . (Configuration::get('MOD_BLOCKTOPMENU_SEARCH') ? ' checked=""' : '') . '/> </div> <p class="center"> <input type="submit" name="submitBlocktopmenu" value="' . $this->l(' Save ') . '" class="button" /> </p> </form> </fieldset><br />'; $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT')); $languages = Language::getLanguages(); $iso = Language::getIsoById($defaultLanguage); $divLangName = 'link_label'; $this->_html .= ' <fieldset> <legend><img src="../img/admin/add.gif" alt="" title="" />' . $this->l('Add Menu Top Link') . '</legend> <form action="' . $_SERVER['REQUEST_URI'] . '" method="post" id="form"> <label>' . $this->l('Label') . '</label> <div class="margin-form">'; foreach ($languages as $language) { $this->_html .= ' <div id="link_label_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . ';float: left;"> <input type="text" name="label[' . $language['id_lang'] . ']" id="label_' . $language['id_lang'] . '" size="70" value="" /> </div>'; } $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'link_label', true); $this->_html .= '</div><p class="clear"> </p> <label>' . $this->l('Link') . '</label> <div class="margin-form"> <input type="text" name="link" value="" size="70" /> </div> <label>' . $this->l('New Window') . '</label> <div class="margin-form"> <input type="checkbox" name="new_window" value="1" /> </div> <p class="center"> <input type="submit" name="submitBlocktopmenuLinks" value="' . $this->l(' Add ') . '" class="button" /> </p> </form> </fieldset><br />'; $this->_html .= ' <fieldset> <legend><img src="../img/admin/details.gif" alt="" title="" />' . $this->l('List Menu Top Link') . '</legend> <table style="width:100%;"> <thead> <tr> <th>' . $this->l('Id Link') . '</th> <th>' . $this->l('Label') . '</th> <th>' . $this->l('Link') . '</th> <th>' . $this->l('New Window') . '</th> <th>' . $this->l('Action') . '</th> </tr> </thead> <tbody>'; $links = MenuTopLinks::gets($cookie->id_lang); foreach ($links as $link) { $this->_html .= ' <tr> <td>' . $link['id_link'] . '</td> <td>' . $link['label'] . '</td> <td>' . $link['link'] . '</td> <td>' . ($link['new_window'] ? $this->l('Yes') : $this->l('No')) . '</td> <td> <form action="' . $_SERVER['REQUEST_URI'] . '" method="post"> <input type="hidden" name="id_link" value="' . $link['id_link'] . '" /> <input type="submit" name="submitBlocktopmenuRemove" value="' . $this->l('Remove') . '" class="button" /> </form> </td> </tr>'; } $this->_html .= '</tbody> </table> </fieldset>'; echo $this->_html; }
/** * Returns module content * * @param array $params Parameters * @return string Content */ function hookFooter($params) { global $smarty, $cookie; $smarty->caching = 0; $cms = CMS::listCms($cookie->id_lang, $this->id); $id_cms = array(); $rewlink = array(); foreach ($cms as $row) { $id_cms[] = intval($row['id_cms']); } $links = CMS::getLinks($cookie->id_lang, $id_cms); for ($x = 0; $x < count($links); $x++) { $l = $links[$x]["link"]; $s = strpos($l, "/prestashop/"); $links[$x]["link"] = substr($l, $s); } // echo("<pre>"); print_r($links); echo("</pre>"); $smarty->assign('cmslinks', $links); return $this->display(__FILE__, 'blockvariouslinks.tpl'); }
public function getContent() { $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT'); $languages = Language::getLanguages(true); $this->_html = ''; if (Tools::isSubmit('submitSettings')) { foreach ($_POST as $key => $value) { if (preg_match('/LAW_MESSAGE_/i', $key)) { continue; } Configuration::updateValue($key, $value); } $message_trads = array(); foreach ($_POST as $key => $value) { if (preg_match('/LAW_MESSAGE_/i', $key)) { $id_lang = preg_split('/LAW_MESSAGE_/i', $key); $message_trads[(int) $id_lang[1]] = $value; } } Configuration::updateValue('LAW_MESSAGE', $message_trads, true); $this->_html .= $this->displayConfirmation($this->l('Success')); } if (version_compare(_PS_VERSION_, '1.5', '>')) { $this->_html .= '<script type="text/javascript" src="../js/jquery/plugins/jquery.colorpicker.js"></script>'; } else { $this->_html .= '<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>'; } $this->_html .= '<h2>' . $this->displayName . '</h2>'; $this->_html .= '<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">'; $this->_html .= '<fieldset>'; $this->_html .= '<legend><img src="' . $this->_path . 'logo.gif" alt="" title="" />' . $this->l('Settings') . '</legend>'; $values = Configuration::getInt('LAW_MESSAGE'); # text $this->_html .= '<label>' . $this->l('Text') . '</label><div class="margin-form">'; foreach ($languages as $language) { $this->_html .= '<div id="lawtext_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . ';float: left;">'; $this->_html .= '<input class="translatable" size="75" type="text" id="LAW_MESSAGE_' . $language['id_lang'] . '" name="LAW_MESSAGE_' . $language['id_lang'] . '" value="' . (isset($values[$language['id_lang']]) ? $values[$language['id_lang']] : '') . '" />'; $this->_html .= '</div>'; } $this->_html .= $this->displayFlags($languages, $defaultLanguage, 'lawtext', 'lawtext', true); $this->_html .= '</div><div class="clear"></div><script>id_language = Number(' . $defaultLanguage . ');</script>'; #page $cms_pages = CMS::listCms(); $this->_html .= '<label>' . $this->l('CMS page for the "more informations" link') . '</label><div class="margin-form">'; $this->_html .= '<select name="COOKIE_LAW_CMS">'; foreach ($cms_pages as $page) { $selected = Configuration::get('COOKIE_LAW_CMS') == $page['id_cms'] ? 'selected="selected"' : ''; $this->_html .= '<option value="' . $page['id_cms'] . '" ' . $selected . '>' . $page['meta_title'] . '</option>'; } $this->_html .= '</select></div>'; # background $this->_html .= '<label>' . $this->l('Background color') . '</label><div class="margin-form">'; $this->_html .= '<input type="color" name="COOKIE_LAW_BAR_BG" data-hex="true" class="color mColorPickerInput" value="' . Configuration::get('COOKIE_LAW_BAR_BG') . '" /></div><div class="clear"></div>'; # text color $this->_html .= '<label>' . $this->l('Text color') . '</label><div class="margin-form">'; $this->_html .= '<input type="color" name="COOKIE_LAW_TEXT_COLOR" data-hex="true" class="color mColorPickerInput" value="' . Configuration::get('COOKIE_LAW_TEXT_COLOR') . '" /></div><div class="clear"></div>'; # opacity $this->_html .= '<label>' . $this->l('Bar opacity') . '</label><div class="margin-form">'; $this->_html .= '<input type="text" name="COOKIE_LAW_BAR_OPACITY" value="' . Configuration::get('COOKIE_LAW_BAR_OPACITY') . '" /> <p style="clear:both;" class="preference_description">' . $this->l('from 0.1 to 1') . '</p> </div><div class="clear"></div>'; # width $this->_html .= '<label>' . $this->l('Bar width') . '</label><div class="margin-form">'; $this->_html .= '<input type="text" name="COOKIE_LAW_BAR_WIDTH" value="' . Configuration::get('COOKIE_LAW_BAR_WIDTH') . '" /> <p style="clear:both;" class="preference_description">' . $this->l('in "%" or "px"') . '</p> </div><div class="clear"></div>'; # position $this->_html .= '<label>' . $this->l('Bar position') . '</label><div class="margin-form">'; $this->_html .= '<select name="COOKIE_LAW_BAR_POSITION""> <option value="top" ' . (Configuration::get('COOKIE_LAW_BAR_POSITION') == 'top' ? 'selected' : '') . '>' . $this->l('top of page') . '</option> <option value="bottom" ' . (Configuration::get('COOKIE_LAW_BAR_POSITION') == 'bottom' ? 'selected' : '') . '>' . $this->l('bottom of page') . '</option> </select> </div><div class="clear"></div>'; # padding $this->_html .= '<label>' . $this->l('Bar padding') . '</label><div class="margin-form">'; $this->_html .= '<input type="text" name="COOKIE_LAW_BAR_PADDING" value="' . Configuration::get('COOKIE_LAW_BAR_PADDING') . '" /> <p style="clear:both;" class="preference_description">' . $this->l('spacing within the bar, in "px"') . '</p> </div><div class="clear"></div>'; # radius $this->_html .= '<label>' . $this->l('Bar border radius') . '</label><div class="margin-form">'; $this->_html .= '<input type="text" name="COOKIE_LAW_BAR_RADIUS" value="' . Configuration::get('COOKIE_LAW_BAR_RADIUS') . '" /> <p style="clear:both;" class="preference_description">' . $this->l('bar rounding, in "px", higher value = more rounded') . '</p> </div><div class="clear"></div>'; # margins $this->_html .= '<label>' . $this->l('Bar margins') . '</label><div class="margin-form">'; $this->_html .= '<input type="text" name="COOKIE_LAW_BAR_MARGIN" value="' . Configuration::get('COOKIE_LAW_BAR_MARGIN') . '" /> <p style="clear:both;" class="preference_description">' . $this->l('margins, in "px": top right bottom left, for eg. 20px 0 20px 0') . '</p> </div><div class="clear"></div>'; # text align $this->_html .= '<label>' . $this->l('Text align') . '</label><div class="margin-form">'; $this->_html .= '<select name="COOKIE_LAW_TEXT_ALIGN""> <option value="left" ' . (Configuration::get('COOKIE_LAW_TEXT_ALIGN') == 'left' ? 'selected' : '') . '>' . $this->l('left') . '</option> <option value="center" ' . (Configuration::get('COOKIE_LAW_TEXT_ALIGN') == 'center' ? 'selected' : '') . '>' . $this->l('center') . '</option> <option value="right" ' . (Configuration::get('COOKIE_LAW_TEXT_ALIGN') == 'right' ? 'selected' : '') . '>' . $this->l('right') . '</option> </select> </div><div class="clear"></div>'; # margins $this->_html .= '<label>' . $this->l('Z-index (advanced users)') . '</label><div class="margin-form">'; $this->_html .= '<input type="text" name="COOKIE_LAW_BAR_ZINDEX" value="' . Configuration::get('COOKIE_LAW_BAR_ZINDEX') . '" /> <p style="clear:both;" class="preference_description">' . $this->l('z-index for imp_cookies layer, be carefull with modify this setting') . '</p> </div><div class="clear"></div>'; $this->_html .= '<div class="margin-form">'; $this->_html .= '<input type="submit" value="' . $this->l('Save') . '" name="submitSettings" class="button">'; $this->_html .= '</div>'; $this->_html .= '</fieldset>'; $this->_html .= '</form>'; $this->_html .= '<div style="width: 351px; margin: 20px auto">'; $this->_html .= '<a href="http://www.facebook.com/impSolutionsPL" title="" target="_blank"><img alt="" src="' . $this->_path . 'impsolutions.png" /></a>'; $this->_html .= '</div>'; return $this->_html; }
<?php } } ?> </select> </div> </div> <div class="link_type link_type_cms"> <label><?php echo $module->l('CMS:'); ?> </label> <div class="margin-form"> <select name="link_type_cms"> <?php $cmss = CMS::listCms($id_lang, false, true); if ($cates) { foreach ($cmss as $c) { ?> <option value="<?php echo $c['id_cms']; ?> "<?php echo $obj->linktype == 'cms' && $c['id_cms'] == $obj->link_content ? 'selected=selected' : ''; ?> ><?php echo $c['meta_title']; ?> </option> <?php }
$ret = '<li>' . "\n"; $ret .= '<a href="' . $node['link'] . '" title="' . strip_tags($node['desc']) . '">' . $node['name'] . '</a>' . "\n"; if (!empty($node['children'])) { $ret .= '<ul>' . "\n"; foreach ($node['children'] as $child) { $ret .= constructTreeNode($child); } $ret .= '</ul>' . "\n"; } $ret .= '</li>' . "\n"; return $ret; } $ulTree = '<div class="tree-top">' . $categTree['name'] . '</div>' . "\n"; $ulTree .= '<ul class="tree">' . "\n"; foreach ($categTree['children'] as $child) { $ulTree .= constructTreeNode($child); } $ulTree .= '</ul>' . "\n"; $smarty->assign('categoryTree', $ulTree); /* ELSE */ $smarty->assign('categoriesTree', $categTree); /* /ONLY FOR THEME OLDER THAN v1.0 */ $cms = CMS::listCms(intval($cookie->id_lang)); $id_cms = array(); foreach ($cms as $row) { $id_cms[] = intval($row['id_cms']); } $smarty->assign('cmslinks', CMS::getLinks(intval($cookie->id_lang), $id_cms)); $smarty->assign('voucherAllowed', intval(Configuration::get('PS_VOUCHERS'))); $smarty->display(_PS_THEME_DIR_ . 'sitemap.tpl'); include dirname(__FILE__) . '/footer.php';
/** * show megamenu item configuration. */ protected function showFormSetting() { $this->context->controller->addJS(__PS_BASE_URI__ . 'modules/leobootstrapmenu/assets/admin/jquery.nestable.js'); $this->context->controller->addJS(__PS_BASE_URI__ . 'modules/leobootstrapmenu/assets/admin/form.js'); $this->context->controller->addJS(__PS_BASE_URI__ . 'js/jquery/plugins/jquery.cookie-plugin.js'); $this->context->controller->addJS(__PS_BASE_URI__ . 'js/jquery/ui/jquery.ui.tabs.min.js'); $this->context->controller->addCss(__PS_BASE_URI__ . 'js/jquery/ui/themes/base/jquery.ui.tabs.css'); $this->context->controller->addCss(__PS_BASE_URI__ . 'modules/leobootstrapmenu/assets/admin/form.css'); // $action_widget = $this->base_config_url.'&widgets=1'; $this->widget->loadEngines(); // $widget = $this->widget; $id_lang = $this->context->language->id; $id_btmegamenu = (int) Tools::getValue('id_btmegamenu'); $obj = new Btmegamenu($id_btmegamenu); $tree = $obj->getTree(); $categories = LeoBtmegamenuHelper::getCategories(); $manufacturers = Manufacturer::getManufacturers(false, $id_lang, true); $suppliers = Supplier::getSuppliers(false, $id_lang, true); $cmss = CMS::listCms($this->context->language->id, false, true); $menus = $obj->getDropdown(null, $obj->id_parent); $default_lang = (int) Configuration::get('PS_LANG_DEFAULT'); $soption = array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))); $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('Create New MegaMenu Item.')), 'input' => array(array('type' => 'hidden', 'label' => $this->l('Megamenu ID'), 'name' => 'id_btmegamenu', 'default' => 0), array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'title', 'value' => true, 'lang' => true, 'default' => ''), array('type' => 'text', 'label' => $this->l('Sub Title:'), 'lang' => true, 'name' => 'text', 'cols' => 40, 'rows' => 10, 'default' => ''), array('type' => 'select', 'label' => $this->l('Parent ID'), 'name' => 'id_parent', 'options' => array('query' => $menus, 'id' => 'id', 'name' => 'title'), 'default' => 'url'), array('type' => 'switch', 'label' => $this->l('Is Active'), 'name' => 'active', 'values' => $soption, 'default' => '1'), array('type' => 'switch', 'label' => $this->l('Show Title'), 'name' => 'show_title', 'values' => $soption, 'default' => '1'), array('type' => 'select', 'label' => $this->l('Menu Type'), 'name' => 'type', 'id' => 'menu_type', 'desc' => $this->l('Select a menu link type and fill data for following input'), 'options' => array('query' => array(array('id' => 'url', 'name' => $this->l('Url')), array('id' => 'category', 'name' => $this->l('Category')), array('id' => 'product', 'name' => $this->l('Product')), array('id' => 'manufacture', 'name' => $this->l('Manufacture')), array('id' => 'supplier', 'name' => $this->l('Supplier')), array('id' => 'cms', 'name' => $this->l('Cms')), array('id' => 'html', 'name' => $this->l('Html'))), 'id' => 'id', 'name' => 'name'), 'default' => 'url'), array('type' => 'text', 'label' => $this->l('Product ID'), 'name' => 'product_type', 'id' => 'product_type', 'class' => 'menu-type-group', 'default' => ''), array('type' => 'select', 'label' => $this->l('CMS Type'), 'name' => 'cms_type', 'id' => 'cms_type', 'options' => array('query' => $cmss, 'id' => 'id_cms', 'name' => 'meta_title'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'text', 'label' => $this->l('URL'), 'name' => 'url', 'id' => 'url_type', 'required' => true, 'lang' => true, 'class' => 'url-type-group-lang', 'default' => ''), array('type' => 'select', 'label' => $this->l('Category Type'), 'name' => 'category_type', 'id' => 'category_type', 'options' => array('query' => $categories, 'id' => 'id_category', 'name' => 'name'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'select', 'label' => $this->l('Manufacture Type'), 'name' => 'manufacture_type', 'id' => 'manufacture_type', 'options' => array('query' => $manufacturers, 'id' => 'id_manufacturer', 'name' => 'name'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'select', 'label' => $this->l('Supplier Type'), 'name' => 'supplier_type', 'id' => 'supplier_type', 'options' => array('query' => $suppliers, 'id' => 'id_supplier', 'name' => 'name'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'textarea', 'label' => $this->l('HTML Type'), 'name' => 'content_text', 'desc' => $this->l('This menu is only for display content,PLease do not select it for menu level 1'), 'lang' => true, 'default' => '', 'autoload_rte' => true, 'class' => 'menu-type-group-lang'), array('type' => 'select', 'label' => $this->l('Target Open'), 'name' => 'target', 'options' => array('query' => array(array('id' => '_self', 'name' => $this->l('Self')), array('id' => '_blank', 'name' => $this->l('Blank')), array('id' => '_parent', 'name' => $this->l('Parent')), array('id' => '_top', 'name' => $this->l('Top'))), 'id' => 'id', 'name' => 'name'), 'default' => '_self'), array('type' => 'text', 'label' => $this->l('Menu Class'), 'name' => 'menu_class', 'display_image' => true, 'default' => ''), array('type' => 'text', 'label' => $this->l('Menu Icon Class'), 'name' => 'icon_class', 'display_image' => true, 'default' => '', 'desc' => $this->l('The module integrated with FontAwesome') . '. ' . $this->l('Check list of icons and class name in here') . ' <a href="http://fontawesome.io/" target="_blank">http://fontawesome.io/</a> or your icon class'), array('type' => 'file', 'label' => $this->l('Or Menu Icon Image'), 'name' => 'image', 'display_image' => true, 'default' => '', 'desc' => $this->l('Use image icon if no use con Class'), 'thumb' => '', 'title' => $this->l('Icon Preview')), array('type' => 'switch', 'label' => $this->l('Group Submenu'), 'name' => 'is_group', 'values' => $soption, 'default' => '0', 'desc' => $this->l('Group all sub menu to display in same level')), array('type' => 'text', 'label' => $this->l('Column'), 'name' => 'colums', 'values' => $soption, 'default' => '1', 'desc' => $this->l('Set each sub menu item as column'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button btn btn-danger')); $helper = new HelperForm(); $helper->module = $this; $helper->name_controller = $this->name; $helper->identifier = $this->identifier; $helper->token = Tools::getAdminTokenLite('AdminModules'); foreach (Language::getLanguages(false) as $lang) { $helper->languages[] = array('id_lang' => $lang['id_lang'], 'iso_code' => $lang['iso_code'], 'name' => $lang['name'], 'is_default' => $default_lang == $lang['id_lang'] ? 1 : 0); } $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name; $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; $helper->toolbar_scroll = true; $helper->title = $this->displayName; $helper->submit_action = 'save' . $this->name; $helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($obj), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id); $live_editor_url = AdminController::$currentIndex . '&configure=' . $this->name . '&liveeditor=1&token=' . Tools::getAdminTokenLite('AdminModules'); $action = AdminController::$currentIndex . '&configure=' . $this->name . '&save' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'); $helper->toolbar_btn = array('back' => array('href' => AdminController::$currentIndex . '&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list'))); $html = $this->_html . '<div class="col-lg-12"> <div class="alert alert-info clearfix"><div class="pull-right">Using <a href="' . $live_editor_url . '" class="btn btn-danger"> ' . $this->l('Live Edit Tools') . '</a> ' . $this->l('To Make Rich Content For Megamenu') . '</div></div></div>'; $output = $html . ' <ul class="nav nav-tabs clearfix"> <li class="active"><a href="#megamenu" data-toggle="tab">' . $this->l('Megamenu') . '</a></li> </ul> <div class="tab-content clearfix"> <div class="tab-pane active" id="megamenu"> '; $show_cavas = Configuration::get('LEO_MEGAMENU_CAVAS'); $addnew = AdminController::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminModules') . '&configure=' . $this->name . '&tab_module=front_office_features&module_name=' . $this->name; $output .= '<div class="col-md-4"><div class="panel panel-default"><h3 class="panel-title">' . $this->l('Tree Megamenu Management') . '</h3> <div class="panel-content">' . $this->l('To sort orders or update parent-child, you drap and drop expected menu, then click to Update button to Save') . '<hr><p><input type="button" value="' . $this->l('New Menu Item') . '" id="addcategory" data-loading-text="' . $this->l('Processing ...') . '" class="btn btn-danger" name="addcategory"> <a href="' . Context::getContext()->link->getAdminLink('AdminLeotempcpWidgets') . '" class="leo-modal-action btn btn-modeal btn-success btn-info">' . $this->l('List Widget') . '</a></p> <hr><p><input type="button" value="' . $this->l('Update') . '" id="show_cavas" data-loading-text="' . $this->l('Processing ...') . '" class="btn btn-info" ></p> <label>' . $this->l('Show Cavas') . '</label> <select name="show_cavas" class="show_cavas"> <option value="1" ' . (isset($show_cavas) && $show_cavas == 1 ? 'checked' : null) . '>' . $this->l('Yes') . '</option> <option value="0" ' . (isset($show_cavas) && $show_cavas == 0 ? 'checked' : null) . '>' . $this->l('No') . '</option> </select> <hr><p><input type="button" value="' . $this->l('Update Positions') . '" id="serialize" data-loading-text="' . $this->l('Processing ...') . '" class="btn btn-danger" name="serialize"></p><hr>' . $tree . '</div></div></div> <div class="col-md-8">' . $helper->generateForm($this->fields_form) . '</div> <script type="text/javascript">var addnew ="' . $addnew . '"; var action="' . $action . '";$("#content").PavMegaMenuList({action:action,addnew:addnew});</script>'; $output .= '</div>'; $output .= '</div><script>$(\'#myTab a[href="#profile"]\').tab(\'show\')</script>'; return $output; }
private function _displayForm() { $responsiveLinksConfiguration = unserialize(Configuration::get('RESPONSIVELINKS_CONFIGURATION')); $responsiveLink = null; $category = null; $cms = null; $product = null; $custom = null; if (Tools::getIsset('action') && Tools::getValue('action') == 'edit') { $responsiveLink = new ResponsiveLinksClass((int) Tools::getValue('id')); if ($responsiveLink->id_category != 0) { $category = new Category((int) $responsiveLink->id_category, $this->context->cookie->id_lang); } if ($responsiveLink->id_cms != 0) { $cms = new CMS((int) $responsiveLink->id_cms, $this->context->cookie->id_lang); } if ($responsiveLink->id_cms_category != 0) { $cmsCategory = new CMSCategory((int) $responsiveLink->id_cms_category, $this->context->cookie->id_lang); } if ($responsiveLink->id_product != 0) { $product = new Product((int) $responsiveLink->id_product, $this->context->cookie->id_lang); } if ($responsiveLink->id_category == 0 && $responsiveLink->id_cms == 0 && $responsiveLink->id_cms_category == 0 && $responsiveLink->id_product == 0) { $custom = true; } } /* Languages preliminaries */ $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT'); $languages = Language::getLanguages(false); $divLangName = 'title¤url'; $this->_html .= ' <script type="text/javascript"> var urlAjaxModule = "' . _PS_BASE_URL_ . $this->_path . 'ajax.php"; </script> <link type="text/css" rel="stylesheet" href="' . $this->_path . '../responsiveextension/stylesheets/admin-common.css" /> <link type="text/css" rel="stylesheet" href="' . $this->_path . 'stylesheets/jquery.treeTable.css" /> <link type="text/css" rel="stylesheet" href="' . $this->_path . 'stylesheets/responsivelinks.css" /> <script type="text/javascript" src="' . $this->_path . '../responsiveextension/javascripts/admin-common.js"></script> <script type="text/javascript" src="' . _PS_JS_DIR_ . 'jquery/plugins/jquery.tablednd.js"></script> <script type="text/javascript" src="' . $this->_path . 'javascripts/jquery.treeTable.js"></script> <script type="text/javascript" src="' . $this->_path . 'javascripts/responsivelinks.js"></script> <script type="text/javascript">id_language = Number(' . $defaultLanguage . ');</script>'; if (isset($responsiveLink)) { $this->_html .= ' <a href="' . $this->getPageUrl(array('action=newlink')) . '" class="button"><span>' . $this->l('New link') . '</span></a> <form id="link-form" style="display:block;"'; } else { $this->_html .= ' <button class="button dropdown" section="link-form"><span>' . $this->l('Add a link') . '</span></button> <form id="link-form" ' . (Tools::getIsset('action') && Tools::getValue('action') == 'newlink' ? 'style="display:block;"' : '') . ''; } $this->_html .= ' class="dropdown-content" action="' . $this->getPageUrl() . '" method="post" enctype="multipart/form-data"> <fieldset> <legend><img src="../img/admin/information.png" class="middle"> ' . $this->l('Link configuration') . '</legend> '; // Where the link will be displayed $this->_html .= ' <div class="page_category step-1' . (isset($responsiveLink) ? ' hidden' : '') . '"> <h3>' . $this->l('Step 1 : Choose where you want to display the link') . '.</h3> <div> <label for="page_category">' . $this->l('Choose link location') . ' : </label> <div class="margin-form"> <select name="page_category" id="page_category"> <option value="header" ' . (isset($responsiveLink) && $responsiveLink->page_category == 'header' ? 'selected="selected"' : '') . '>' . $this->l('Header') . '</option> <option value="footer" ' . (isset($responsiveLink) && $responsiveLink->page_category == 'footer' ? 'selected="selected"' : '') . '>' . $this->l('Footer') . '</option> </select> </div> </div>'; // If footer is the choice, select the column $this->_html .= ' <div class="hide page_category_column_choice"> <label for="page_category_column">' . $this->l('Choose your column') . ' : </label> <div class="margin-form"> <select name="page_category_column" id="page_category_column"> <option value="1" ' . (isset($responsiveLink) && $responsiveLink->page_category_column == '1' ? 'selected="selected"' : '') . '>' . $this->l('Browse') . '</option> <option value="2" ' . (isset($responsiveLink) && $responsiveLink->page_category_column == '2' ? 'selected="selected"' : '') . '>' . $this->l('Site info') . '</option> </select> </div> </div> </div>'; // parent ou non $this->_html .= ' <div class="link-type' . (isset($responsiveLink) ? ' link-type-edition' : '') . '"> <div class="option-parent step-2' . (isset($responsiveLink) ? ' hidden' : '') . '"> <h3>' . $this->l('Step 2 : Choose is the link has a parent or not') . '.</h3> <div class="option"> <label for="isparent">' . $this->l('Has a parent link?') . '</label> <div class="margin-form"> <input type="radio" name="isparent" class="link-option" value="1"> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="isparent" class="link-option" value="0" checked="checked"> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div> <div class="option-block"> <label for="parent">' . $this->l('Choose your Parent link :') . '</label> <div class="margin-form"> <select name="parent" id="parent" size="5">'; /** @var $parentTemp ResponsiveLinksClass */ foreach (ResponsiveLinksClass::findAll($this->context->cookie->id_lang, false) as $parentTemp) { $parentCategory = null; $parentCms = null; $parentProduct = null; if ($parentTemp->id_category != 0) { $parentCategory = new Category((int) $parentTemp->id_category, $this->context->cookie->id_lang); $this->_html .= '<option value="' . $parentTemp->id . '">' . $parentTemp->id . ' - ' . $parentCategory->name . '</option>'; } elseif ($parentTemp->id_cms != 0) { $parentCms = new CMS((int) $parentTemp->id_cms, $this->context->cookie->id_lang); $this->_html .= '<option value="' . $parentTemp->id . '">' . $parentTemp->id . ' - ' . $parentCms->meta_title . '</option>'; } elseif ($parentTemp->id_cms_category != 0) { $parentCmsCategory = new CMSCategory((int) $parentTemp->id_cms_category, $this->context->cookie->id_lang); $this->_html .= '<option value="' . $parentTemp->id . '">' . $parentTemp->id . ' - ' . $parentCmsCategory->name . '</option>'; } elseif ($parentTemp->id_product != 0) { $parentProduct = new Product((int) $parentTemp->id_product, false, $this->context->cookie->id_lang); $this->_html .= '<option value="' . $parentTemp->id . '">' . $parentTemp->id . ' - ' . $parentProduct->name . '</option>'; } else { $this->_html .= '<option value="' . $parentTemp->id . '">' . $parentTemp->id . ' - ' . $parentTemp->title . '</option>'; } } $this->_html .= ' </select> <p class="clear">' . $this->l('Choose a parent link for your link and a dropdown will appear in the nav bar for the parent') . '.</p> </div> </div> </div>'; // category ou non $this->_html .= ' <div class="step-3"> <h3 class="' . (isset($responsiveLink) ? 'hidden' : '') . '">' . $this->l('Step 3 : Choose your link type') . '.</h3> <div class="option ' . (isset($responsiveLink) ? 'hidden' : '') . '"> <label for="iscategory">' . $this->l('Is a category link?') . '</label> <div class="margin-form"> <input type="radio" name="iscategory" class="link-choice" value="1" ' . (isset($category) ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="iscategory" class="link-choice" value="0" ' . (isset($category) ? '' : 'checked="checked"') . '> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div> <div class="option-block ' . (isset($category) ? 'active' : '') . '"> <label for="category">' . $this->l('Choose your category page :') . '</label> <div class="margin-form"> <select name="category" id="category" size="5">'; foreach (Category::getSimpleCategories($this->context->cookie->id_lang) as $categoryTemp) { $this->_html .= ' <option value="' . $categoryTemp['id_category'] . '" ' . (isset($category) && $category->id == $categoryTemp['id_category'] ? 'selected="selected"' : '') . '>' . $categoryTemp['name'] . '</option>'; } $this->_html .= ' </select> </div> </div>'; // cms ou non $this->_html .= ' <div class="option ' . (isset($responsiveLink) ? 'hidden' : '') . '"> <label for="iscms">' . $this->l('Is a CMS link?') . '</label> <div class="margin-form"> <input type="radio" name="iscms" class="link-choice" value="1" ' . (isset($cms) ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="iscms" class="link-choice" value="0" ' . (isset($cms) ? '' : 'checked="checked"') . '> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div> <div class="option-block ' . (isset($cms) ? 'active' : '') . '"> <label for="cms">' . $this->l('Choose your CMS page :') . '</label> <div class="margin-form"> <select name="cms" id="cms" size="5">'; foreach (CMS::listCms($this->context->cookie->id_lang) as $cmsTemp) { $this->_html .= ' <option value="' . $cmsTemp['id_cms'] . '" ' . (isset($cms) && $cms->id == $cmsTemp['id_cms'] ? 'selected="selected"' : '') . '>' . $cmsTemp['meta_title'] . '</option>'; } $this->_html .= ' </select> </div> </div>'; // cms category or not $this->_html .= ' <div class="option ' . (isset($responsiveLink) ? 'hidden' : '') . '"> <label for="iscmscategory">' . $this->l('Is a CMS category link?') . '</label> <div class="margin-form"> <input type="radio" name="iscmscategory" class="link-choice" value="1" ' . (isset($cmsCategory) ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="iscmscategory" class="link-choice" value="0" ' . (isset($cmsCategory) ? '' : 'checked="checked"') . '> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div> <div class="option-block ' . (isset($cmsCategory) ? 'active' : '') . '"> <label for="cms">' . $this->l('Choose your CMS Category page :') . '</label> <div class="margin-form"> <select name="cmscategory" id="cmscategory" size="5">'; foreach (CMSCategory::getSimpleCategories($this->context->cookie->id_lang) as $cmsCategoryTemp) { $this->_html .= ' <option value="' . $cmsCategoryTemp['id_cms_category'] . '" ' . (isset($cmsCategory) && $cmsCategory->id == $cmsCategoryTemp['id_cms_category'] ? 'selected="selected"' : '') . '>' . $cmsCategoryTemp['name'] . '</option>'; } $this->_html .= ' </select> </div> </div>'; // product ou non $this->_html .= ' <div class="option ' . (isset($responsiveLink) ? 'hidden' : '') . '"> <label for="isproduct">' . $this->l('Is a product link?') . '</label> <div class="margin-form"> <input type="radio" name="isproduct" class="link-choice" value="1" ' . (isset($product) ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="isproduct" class="link-choice" value="0" ' . (isset($product) ? '' : 'checked="checked"') . '> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div> <div class="option-block ' . (isset($product) ? 'active' : '') . '"> <label for="product">' . $this->l('Choose your product page :') . '</label> <div class="margin-form"> <input type="text" id="product_auto" name="product_auto" size="50"/> <input type="hidden" id="product" name="product" /> <p class="clear">' . $this->l('Type a word to search products') . '.</p> </div> </div>'; // custom ou non $this->_html .= ' <div class="option ' . (isset($responsiveLink) ? 'hidden' : '') . '"> <label for="iscustom">' . $this->l('Is a custom link?') . '</label> <div class="margin-form"> <input type="radio" name="iscustom" class="link-choice" value="1" ' . (isset($custom) ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="iscustom" class="link-choice" value="0" ' . (isset($custom) ? '' : 'checked="checked"') . '> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div>'; //title field $this->_html .= ' <div class="option-block ' . (isset($custom) ? 'active' : '') . '"> <label>' . $this->l('Title :') . '</label> <div class="margin-form">'; foreach ($languages as $language) { $this->_html .= ' <div id="title_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . ';float: left;"> <input class="required" type="text" name="title_' . $language['id_lang'] . '" id="title_' . $language['id_lang'] . '" size="35" value="' . (isset($responsiveLink->title[$language['id_lang']]) ? $responsiveLink->title[$language['id_lang']] : '') . '" /> </div>'; } $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'title', true); $this->_html .= ' <p class="clear">' . $this->l('Link title') . '.</p> </div>'; //champ url $this->_html .= ' <label>' . $this->l('Url :') . '</label> <div class="margin-form">'; foreach ($languages as $language) { $this->_html .= ' <div id="url_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . ';float: left;"> <input class="required" type="text" name="url_' . $language['id_lang'] . '" id="url_' . $language['id_lang'] . '" size="70" value="' . (isset($responsiveLink->url[$language['id_lang']]) ? $responsiveLink->url[$language['id_lang']] : '') . '" /> </div>'; } $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'url', true); $this->_html .= ' <p class="clear">' . $this->l('Url of the link (leave blank is no url)') . '.</p> </div> </div>'; $this->_html .= ' <div class="margin-form">'; if (Tools::getIsset('action') && Tools::getIsset('action') == 'edit') { $this->_html .= '<input type="submit" value="' . $this->l('Save') . '" name="editLink" class="button"> <input type="hidden" value="' . $responsiveLink->id . '" name="id" class="button">'; } else { $this->_html .= '<input type="submit" value="' . $this->l('Save') . '" name="addLink" class="button">'; } $this->_html .= ' </div> </div> </div> </fieldset> </form>'; $this->_html .= ' <fieldset> <legend><img src="../img/admin/tab-preferences.gif" class="middle"> ' . $this->l('Nav bar links') . '</legend> <p>' . $this->l('Edit your main nav links with the edit button and save it.') . '</p> <hr> <table id="links" class="table tableDnD updatePosition" cellpadding="0" cellspacing="0" style="width: 100%;"> <thead> <tr> <th class="center">' . $this->l('Expand') . '</th> <th class="center">' . $this->l('Id') . '</th> <th class="center">' . $this->l('Position') . '</th> <th>' . $this->l('Title') . '</th> <th class="center">' . $this->l('Actions') . '</th> </tr> </thead> <tbody>'; /** @var $responsiveLink ResponsiveLinksClass */ foreach (ResponsiveLinksClass::findAll($this->context->cookie->id_lang, true) as $responsiveLink) { $category = null; $cms = null; $product = null; if ($responsiveLink->id_category != 0) { $category = new Category((int) $responsiveLink->id_category, $this->context->cookie->id_lang); } elseif ($responsiveLink->id_cms != 0) { $cms = new CMS((int) $responsiveLink->id_cms, $this->context->cookie->id_lang); } elseif ($responsiveLink->id_cms_category != 0) { $cmsCategory = new CMSCategory((int) $responsiveLink->id_cms_category, $this->context->cookie->id_lang); } elseif ($responsiveLink->id_product != 0) { $product = new Product((int) $responsiveLink->id_product, false, $this->context->cookie->id_lang); } $this->_html .= ' <tr id="node-' . $responsiveLink->id . '"> <td class="center"><img src="' . $this->_path . 'img/folder.png" alt="" /></td> <td class="center">' . $responsiveLink->id . '</td> <td class="center position"></td> <td>'; if (isset($category)) { $this->_html .= $category->name; } elseif (isset($cms)) { $this->_html .= $cms->meta_title; } elseif (isset($cmsCategory)) { $this->_html .= $cmsCategory->name; } elseif (isset($product)) { $this->_html .= $product->name; } else { $this->_html .= $responsiveLink->title; } $this->_html .= ' </td> <td class="center"> <a href="' . $this->getPageUrl(array('id=' . $responsiveLink->id, 'action=edit')) . '" title="' . $this->l('Edit') . '"> <img src="../img/admin/edit.gif" alt="' . $this->l('Edit') . '" alt="' . $this->l('Edit') . '"> </a> <a class="delete" href="' . $this->getPageUrl(array('id=' . $responsiveLink->id, 'action=delete')) . '" id="' . $responsiveLink->id . '" title="' . $this->l('Delete the link ?') . '"> <img src="../img/admin/delete.gif" alt="' . $this->l('Delete') . '" alt="' . $this->l('Delete') . '"> </a> </td> </tr>'; $this->getSubLinks($responsiveLink->id, $this->context->cookie->id_lang); } $this->_html .= ' </tbody> </table> </fieldset> <fieldset> <legend><img src="../img/admin/tab-preferences.gif" class="middle"> ' . $this->l('Footer links') . '</legend> <p>' . $this->l('Edit your footer links and save it') . '.</p> <hr> <h3>' . $this->l('Browse column') . '</h3> <table id="footer-browse-links" class="table tableDnD" cellpadding="0" cellspacing="0" style="width: 100%;"> <thead> <tr> <th class="center">' . $this->l('Id') . '</th> <th class="center">' . $this->l('Position') . '</th> <th>' . $this->l('Title') . '</th> <th class="center">' . $this->l('Actions') . '</th> </tr> </thead> <tbody>'; /** @var $responsiveLink ResponsiveLinksClass */ foreach (ResponsiveLinksClass::findAll($this->context->cookie->id_lang, true, 'footer', 1) as $responsiveLink) { $category = null; $cms = null; $product = null; if ($responsiveLink->id_category != 0) { $category = new Category((int) $responsiveLink->id_category, $this->context->cookie->id_lang); } elseif ($responsiveLink->id_cms != 0) { $cms = new CMS((int) $responsiveLink->id_cms, $this->context->cookie->id_lang); } elseif ($responsiveLink->id_cms_category != 0) { $cmsCategory = new CMSCategory((int) $responsiveLink->id_cms_category, $this->context->cookie->id_lang); } elseif ($responsiveLink->id_product != 0) { $product = new Product((int) $responsiveLink->id_product, false, $this->context->cookie->id_lang); } $this->_html .= ' <tr id="node-' . $responsiveLink->id . '"> <td class="center">' . $responsiveLink->id . '</td> <td class="center position"></td> <td>'; if (isset($category)) { $this->_html .= $category->name; } elseif (isset($cms)) { $this->_html .= $cms->meta_title; } elseif (isset($cmsCategory)) { $this->_html .= $cmsCategory->name; } elseif (isset($product)) { $this->_html .= $product->name; } else { $this->_html .= $responsiveLink->title; } $this->_html .= ' </td> <td class="center"> <a href="' . $this->getPageUrl(array('id=' . $responsiveLink->id, 'action=edit')) . '" title="' . $this->l('Edit') . '"> <img src="../img/admin/edit.gif" alt="' . $this->l('Edit') . '" alt="' . $this->l('Edit') . '"> </a> <a class="delete" href="' . $this->getPageUrl(array('id=' . $responsiveLink->id, 'action=delete')) . '" id="' . $responsiveLink->id . '" title="' . $this->l('Delete the link ?') . '"> <img src="../img/admin/delete.gif" alt="' . $this->l('Delete') . '" alt="' . $this->l('Delete') . '"> </a> </td> </tr>'; } $this->_html .= ' </tbody> </table> <h3 style="margin-top: 10px;">' . $this->l('Site info column') . '</h3> <table id="footer-siteinfo-links" class="table tableDnD" cellpadding="0" cellspacing="0" style="width: 100%;"> <thead> <tr> <th class="center">' . $this->l('Id') . '</th> <th class="center">' . $this->l('Position') . '</th> <th>' . $this->l('Title') . '</th> <th class="center">' . $this->l('Actions') . '</th> </tr> </thead> <tbody>'; /** @var $responsiveLink ResponsiveLinksClass */ foreach (ResponsiveLinksClass::findAll($this->context->cookie->id_lang, true, 'footer', 2) as $responsiveLink) { $category = null; $cms = null; $product = null; if ($responsiveLink->id_category != 0) { $category = new Category((int) $responsiveLink->id_category, $this->context->cookie->id_lang); } elseif ($responsiveLink->id_cms != 0) { $cms = new CMS((int) $responsiveLink->id_cms, $this->context->cookie->id_lang); } elseif ($responsiveLink->id_cms_category != 0) { $cmsCategory = new CMSCategory((int) $responsiveLink->id_cms_category, $this->context->cookie->id_lang); } elseif ($responsiveLink->id_product != 0) { $product = new Product((int) $responsiveLink->id_product, false, $this->context->cookie->id_lang); } $this->_html .= ' <tr id="node-' . $responsiveLink->id . '"> <td class="center">' . $responsiveLink->id . '</td> <td class="center position"></td> <td>'; if (isset($category)) { $this->_html .= $category->name; } elseif (isset($cms)) { $this->_html .= $cms->meta_title; } elseif (isset($cmsCategory)) { $this->_html .= $cmsCategory->name; } elseif (isset($product)) { $this->_html .= $product->name; } else { $this->_html .= $responsiveLink->title; } $this->_html .= ' </td> <td class="center"> <a href="' . $this->getPageUrl(array('id=' . $responsiveLink->id, 'action=edit')) . '" title="' . $this->l('Edit') . '"> <img src="../img/admin/edit.gif" alt="' . $this->l('Edit') . '" alt="' . $this->l('Edit') . '"> </a> <a class="delete" href="' . $this->getPageUrl(array('id=' . $responsiveLink->id, 'action=delete')) . '" id="' . $responsiveLink->id . '" title="' . $this->l('Delete the link ?') . '"> <img src="../img/admin/delete.gif" alt="' . $this->l('Delete') . '" alt="' . $this->l('Delete') . '"> </a> </td> </tr>'; } $this->_html .= ' </tbody> </table> </fieldset> <form action="' . $this->getPageUrl() . '" method="post" enctype="multipart/form-data"> <fieldset class="follow-type"> <legend><img src="../img/admin/tab-preferences.gif" class="middle"> ' . $this->l('Follow us links') . '</legend> <p>' . $this->l('Edit your social links and save it') . '.</p> <hr>'; // cms ou non $this->_html .= ' <div class="option"> <label for="isfacebook">' . $this->l('Facebook') . '</label> <div class="margin-form"> <input type="radio" name="isfacebook" class="link-option" value="1" ' . (isset($responsiveLinksConfiguration['FOLLOWFACEBOOK']) && $responsiveLinksConfiguration['FOLLOWFACEBOOK']['option'] == 1 ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="isfacebook" class="link-option" value="0" ' . (!isset($responsiveLinksConfiguration['FOLLOWFACEBOOK']) || $responsiveLinksConfiguration['FOLLOWFACEBOOK']['option'] == 0 ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div> <div class="option-block ' . (isset($responsiveLinksConfiguration['FOLLOWFACEBOOK']) && $responsiveLinksConfiguration['FOLLOWFACEBOOK']['option'] == 1 ? 'active' : '') . '"> <label for="facebookcontent">' . $this->l('Facebook page') . ' : </label> <div class="margin-form"> <input type="text" name="facebookcontent" size="150" value="' . $responsiveLinksConfiguration['FOLLOWFACEBOOK']['value'] . '"/> <p class="clear">' . $this->l('Enter your Facebook page') . '</p> </div> </div> <div class="option"> <label for="isyoutube">' . $this->l('Youtube') . ' : </label> <div class="margin-form"> <input type="radio" name="isyoutube" class="link-option" value="1" ' . (isset($responsiveLinksConfiguration['FOLLOWYOUTUBE']) && $responsiveLinksConfiguration['FOLLOWYOUTUBE']['option'] == 1 ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="isyoutube" class="link-option" value="0" ' . (!isset($responsiveLinksConfiguration['FOLLOWYOUTUBE']) || $responsiveLinksConfiguration['FOLLOWYOUTUBE']['option'] == 0 ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div> <div class="option-block ' . (isset($responsiveLinksConfiguration['FOLLOWYOUTUBE']) && $responsiveLinksConfiguration['FOLLOWYOUTUBE']['option'] == 1 ? 'active' : '') . '"> <label for="youtubecontent">' . $this->l('Youtube page ') . ' : </label> <div class="margin-form"> <input type="text" name="youtubecontent" size="150" value="' . $responsiveLinksConfiguration['FOLLOWYOUTUBE']['value'] . '"/> <p class="clear">' . $this->l('Enter your Youtube page') . '</p> </div> </div> <div class="option"> <label for="istwitter">' . $this->l('Twitter') . ' : </label> <div class="margin-form"> <input type="radio" name="istwitter" class="link-option" value="1" ' . (isset($responsiveLinksConfiguration['FOLLOWTWITTER']) && $responsiveLinksConfiguration['FOLLOWTWITTER']['option'] == 1 ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="istwitter" class="link-option" value="0" ' . (!isset($responsiveLinksConfiguration['FOLLOWTWITTER']) || $responsiveLinksConfiguration['FOLLOWTWITTER']['option'] == 0 ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div> <div class="option-block ' . (isset($responsiveLinksConfiguration['FOLLOWTWITTER']) && $responsiveLinksConfiguration['FOLLOWTWITTER']['option'] == 1 ? 'active' : '') . '"> <label for="twittercontent">' . $this->l('Twitter page') . ' : </label> <div class="margin-form"> <input type="text" name="twittercontent" size="150" value="' . $responsiveLinksConfiguration['FOLLOWTWITTER']['value'] . '"/> <p class="clear">' . $this->l('Enter your Twitter page') . '</p> </div> </div> <div class="option"> <label for="islinkedin">' . $this->l('LinkedIn') . ' : </label> <div class="margin-form"> <input type="radio" name="islinkedin" class="link-option" value="1" ' . (isset($responsiveLinksConfiguration['FOLLOWLINKEDIN']) && $responsiveLinksConfiguration['FOLLOWLINKEDIN']['option'] == 1 ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '"></label> <input type="radio" name="islinkedin" class="link-option" value="0" ' . (!isset($responsiveLinksConfiguration['FOLLOWLINKEDIN']) || $responsiveLinksConfiguration['FOLLOWLINKEDIN']['option'] == 0 ? 'checked="checked"' : '') . '> <label class="t"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '"></label> </div> </div> <div class="option-block ' . (isset($responsiveLinksConfiguration['FOLLOWLINKEDIN']) && $responsiveLinksConfiguration['FOLLOWLINKEDIN']['option'] == 1 ? 'active' : '') . '"> <label for="linkedincontent">' . $this->l('LinkedIn page') . ' : </label> <div class="margin-form"> <input type="text" name="linkedincontent" size="150" value="' . $responsiveLinksConfiguration['FOLLOWLINKEDIN']['value'] . '"/> <p class="clear">' . $this->l('Enter your LinkedIn page') . '</p> </div> </div> <div class="margin-form"> <input type="submit" value="' . $this->l('Save') . '" name="editFollow" class="button"> </div> </fieldset> </form>'; }
/** * @return mixed */ public function renderFormLink() { $this->context->smarty->assign(array('back_url_override' => self::$currentIndex . '&id_now_block_cms_footer_column=' . Tools::getValue('id_now_block_cms_footer_column', $this->object->id_now_block_cms_footer_column) . '&detailsnow_block_cms_footer_column&token=' . $this->token)); $obj = $this->loadObject(true); $this->fields_form = array('legend' => array('title' => $this->module->l('Link', 'AdminNowBlockFooterCms'), 'icon' => 'icon-list-alt'), 'input' => array(array('type' => 'select', 'label' => $this->module->l('Column', 'AdminNowBlockFooterCms'), 'name' => 'id_now_block_cms_footer_column', 'options' => array('query' => NowBlockFooterCmsColumn::getColumns($this->context->language->id, true, true), 'id' => 'id_now_block_cms_footer_column', 'name' => 'name')), array('type' => 'select', 'label' => $this->module->l('Type of link', 'AdminNowBlockFooterCms'), 'name' => 'type', 'required' => true, 'default_value' => NowBlockFooterCms::TYPE_LINK, 'options' => array('query' => array(array('id_type' => NowBlockFooterCms::TYPE_CATEGORY, 'type' => $this->module->l('Category', 'AdminNowBlockFooterCms')), array('id_type' => NowBlockFooterCms::TYPE_CMS, 'type' => $this->module->l('CMS', 'AdminNowBlockFooterCms')), array('id_type' => NowBlockFooterCms::TYPE_LINK, 'type' => $this->module->l('Link', 'AdminNowBlockFooterCms')), array('id_type' => NowBlockFooterCms::TYPE_MANUFACTURER, 'type' => $this->module->l('Manufacturer', 'AdminNowBlockFooterCms'))), 'id' => 'id_type', 'name' => 'type')), array('type' => 'text', 'label' => $this->module->l('ID type', 'AdminNowBlockFooterCms'), 'name' => 'id_type', 'form_group_class' => 'idTypeDiv'), array('type' => 'categories', 'label' => $this->l('Category', 'AdminNowBlockFooterCms'), 'name' => 'category', 'tree' => array('id' => 'categories-tree', 'selected_categories' => array($obj->type == 'category' ? $obj->id_type : '')), 'form_group_class' => 'categoryDiv'), array('type' => 'select', 'label' => $this->module->l('CMS', 'AdminNowBlockFooterCms'), 'name' => 'cms', 'options' => array('query' => CMS::listCms($this->context->language->id), 'id' => 'id_cms', 'name' => 'meta_title'), 'form_group_class' => 'cmsDiv'), array('type' => 'select', 'label' => $this->module->l('Manufacturer', 'AdminNowBlockFooterCms'), 'name' => 'manufacturer', 'options' => array('query' => Manufacturer::getManufacturers(false, $this->context->language->id), 'id' => 'id_manufacturer', 'name' => 'name'), 'form_group_class' => 'manufacturerDiv'), array('type' => 'text', 'label' => $this->module->l('Link', 'AdminNowBlockFooterCms'), 'name' => 'link', 'form_group_class' => 'linkDiv', 'lang' => true), array('type' => 'text', 'label' => $this->module->l('Name', 'AdminNowBlockFooterCms'), 'name' => 'name', 'lang' => true, 'desc' => $this->module->l('Complete this field only if you want to change the name that will appear in the footer.', 'AdminNowBlockFooterCms')), array('type' => 'switch', 'label' => $this->module->l('Enable', 'AdminNowBlockFooterCms'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowBlockFooterCms')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowBlockFooterCms'))))), 'submit' => array('title' => $this->module->l('Save', 'AdminNowBlockFooterCms'))); return parent::renderForm(); }
/** * show megamenu item configuration. */ protected function showFormSetting() { $this->context->controller->addJS(__PS_BASE_URI__ . 'modules/psmegamenu/views/js/admin/jquery.nestable.js'); $this->context->controller->addJS(__PS_BASE_URI__ . 'modules/psmegamenu/views/js/admin/form.js'); $this->context->controller->addJS(__PS_BASE_URI__ . 'js/jquery/plugins/jquery.cookie-plugin.js'); $this->context->controller->addJS(__PS_BASE_URI__ . 'js/jquery/ui/jquery.ui.tabs.min.js'); $this->context->controller->addCss(__PS_BASE_URI__ . 'js/jquery/ui/themes/base/jquery.ui.tabs.css'); $this->context->controller->addCss(__PS_BASE_URI__ . 'modules/psmegamenu/views/css/admin/form.css'); $this->widget->loadEngines(); $id_lang = $this->context->language->id; $id_psmegamenu = (int) Tools::getValue('id_psmegamenu'); $obj = new Psbtmegamenu($id_psmegamenu); $tree = $obj->getTree(); $categories = PsMegamenuHelper::getCategories(); $manufacturers = Manufacturer::getManufacturers(false, $id_lang, true); $suppliers = Supplier::getSuppliers(false, $id_lang, true); $cmss = CMS::listCms($this->context->language->id, false, true); $menus = $obj->getDropdown(null, $obj->id_parent); $default_lang = (int) Configuration::get('PS_LANG_DEFAULT'); $soption = array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))); $image_url = ''; if ($obj->image && is_file(_PSMEGAMENU_IMAGE_DIR_ . $obj->image)) { $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://'; $image_url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST']) . _PSMEGAMENU_IMAGE_URL_ . $obj->image; } $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('Create New MegaMenu Item.')), 'input' => array(array('type' => 'hidden', 'label' => $this->l('Megamenu ID'), 'name' => 'id_psmegamenu', 'default' => 0), array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'title', 'value' => true, 'lang' => true, 'default' => ''), array('type' => 'text', 'label' => $this->l('Sub Title:'), 'lang' => true, 'name' => 'text', 'cols' => 40, 'rows' => 10, 'default' => ''), array('type' => 'select', 'label' => $this->l('Parent ID'), 'name' => 'id_parent', 'options' => array('query' => $menus, 'id' => 'id', 'name' => 'title'), 'default' => 'url'), array('type' => 'switch', 'label' => $this->l('Is Active'), 'name' => 'active', 'values' => $soption, 'default' => '1'), array('type' => 'switch', 'label' => $this->l('Show Title'), 'name' => 'show_title', 'values' => $soption, 'default' => '1'), array('type' => 'select', 'label' => $this->l('Menu Type'), 'name' => 'type', 'id' => 'menu_type', 'desc' => $this->l('Select a menu link type and fill data for following input'), 'options' => array('query' => array(array('id' => 'url', 'name' => $this->l('Url')), array('id' => 'category', 'name' => $this->l('Category')), array('id' => 'product', 'name' => $this->l('Product')), array('id' => 'manufacture', 'name' => $this->l('Manufacture')), array('id' => 'supplier', 'name' => $this->l('Supplier')), array('id' => 'cms', 'name' => $this->l('Cms')), array('id' => 'html', 'name' => $this->l('Html'))), 'id' => 'id', 'name' => 'name'), 'default' => 'url'), array('type' => 'text', 'label' => $this->l('Product ID'), 'name' => 'product_type', 'id' => 'product_type', 'class' => 'menu-type-group', 'default' => ''), array('type' => 'select', 'label' => $this->l('CMS Type'), 'name' => 'cms_type', 'id' => 'cms_type', 'options' => array('query' => $cmss, 'id' => 'id_cms', 'name' => 'meta_title'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'text', 'label' => $this->l('URL'), 'name' => 'url', 'id' => 'url_type', 'class' => 'menu-type-group', 'default' => ''), array('type' => 'select', 'label' => $this->l('Category Type'), 'name' => 'category_type', 'id' => 'category_type', 'options' => array('query' => $categories, 'id' => 'id_category', 'name' => 'name'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'select', 'label' => $this->l('Manufacture Type'), 'name' => 'manufacture_type', 'id' => 'manufacture_type', 'options' => array('query' => $manufacturers, 'id' => 'id_manufacturer', 'name' => 'name'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'select', 'label' => $this->l('Supplier Type'), 'name' => 'supplier_type', 'id' => 'supplier_type', 'options' => array('query' => $suppliers, 'id' => 'id_supplier', 'name' => 'name'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'textarea', 'label' => $this->l('HTML Type'), 'name' => 'content_text', 'lang' => true, 'default' => '', 'autoload_rte' => true, 'class' => 'menu-type-group-lang'), array('type' => 'select', 'label' => $this->l('Target Open'), 'name' => 'target', 'options' => array('query' => array(array('id' => '_self', 'name' => $this->l('Self')), array('id' => '_blank', 'name' => $this->l('Blank')), array('id' => '_parent', 'name' => $this->l('Parent')), array('id' => '_top', 'name' => $this->l('Top'))), 'id' => 'id', 'name' => 'name'), 'default' => '_self'), array('type' => 'text', 'label' => $this->l('Menu Class'), 'name' => 'menu_class', 'display_image' => true, 'default' => ''), array('type' => 'text', 'label' => $this->l('Menu Icon Class'), 'name' => 'icon_class', 'display_image' => true, 'default' => '', 'desc' => $this->l('The module integrated with FontAwesome') . '.' . $this->l('Check list of icons and class name in here') . ' <a href="http://fontawesome.io/" target="_blank">http://fontawesome.io/</a> or your icon class'), array('type' => 'file_pts', 'label' => $this->l('Or Menu Icon Image'), 'name' => 'image', 'display_image' => true, 'default' => '', 'image' => $image_url, 'delete_url' => $this->base_config_url . '&delete_icon=1', 'title' => $this->l('Icon Preview')), array('type' => 'select', 'label' => $this->l('Sub Menu Type'), 'name' => 'type_submenu', 'options' => array('query' => array(array('id' => 'menu', 'name' => $this->l('Menu')), array('id' => 'html', 'name' => $this->l('HTML'))), 'id' => 'id', 'name' => 'name'), 'default' => 'menu', 'desc' => $this->l('Submenu will be showed if select option Menu')), array('type' => 'textarea', 'label' => $this->l('Sub Menu Content:'), 'name' => 'submenu_content_text', 'value' => true, 'lang' => true, 'default' => '', 'autoload_rte' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button btn btn-danger')); $helper = new HelperForm(); $helper->module = $this; $helper->name_controller = $this->name; $helper->identifier = $this->identifier; $helper->token = Tools::getAdminTokenLite('AdminModules'); foreach (Language::getLanguages(false) as $lang) { $helper->languages[] = array('id_lang' => $lang['id_lang'], 'iso_code' => $lang['iso_code'], 'name' => $lang['name'], 'is_default' => $default_lang == $lang['id_lang'] ? 1 : 0); } $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name; $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; $helper->toolbar_scroll = true; $helper->title = $this->displayName; $helper->submit_action = 'save' . $this->name; $helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($obj), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id); $liveeditor_url = AdminController::$currentIndex . '&configure=' . $this->name . '&liveeditor=1&token=' . Tools::getAdminTokenLite('AdminModules'); $action = AdminController::$currentIndex . '&configure=' . $this->name . '&save' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'); $helper->toolbar_btn = array('back' => array('href' => AdminController::$currentIndex . '&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list'))); $html = $this->_html . '<div class="col-lg-12"> <div class="alert alert-info clearfix"> <div class="pull-right">Using <a href="' . $liveeditor_url . '" class="btn btn-danger"> ' . $this->l('Live Megamenu Editor') . '</a> ' . $this->l('To Make Rich Content For Megamenu') . '</div></div></div>'; $output = $html . ' <ul class="nav nav-tabs clearfix" id="myTab"> <li class="active"><a href="#megamenu" data-toggle="tab">' . $this->l('Megamenu') . '</a></li> <li><a href="#widgets" data-toggle="tab">' . $this->l('Widgets') . '</a></li> </ul> <div class="tab-content clearfix"> <div class="tab-pane active" id="megamenu"> '; $addnew = AdminController::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminModules') . '&configure=' . $this->name . '&tab_module=front_office_features&module_name=' . $this->name; $output .= '<div class="col-md-4"><div class="panel panel-default"><h3 class="panel-title">' . $this->l('Tree Megamenu Management') . '</h3> <div class="panel-content"><div class="alert alert-warning">' . $this->l('To sort orders or update parent-child, you drap and drop expected menu, then click to Update button to Save') . '</div> <hr> <p> <div class="pull-right"> <input type="button" value="' . $this->l('New Category') . '" id="addcategory" data-loading-text="' . $this->l('Processing ...') . '" class="btn btn-default " name="addcategory"> <a href="' . $liveeditor_url . '" class="btn btn-danger"> ' . $this->l('Editor') . '</a> </div> <input type="button" value="' . $this->l('Update Positions') . '" id="serialize" data-loading-text="' . $this->l('Processing ...') . '" class="btn btn-primary" name="serialize"></p><hr>' . $tree . '<p><input type="button" value="' . $this->l('Update Positions') . '" id="serialize-tree" data-loading-text="' . $this->l('Processing ...') . '" class="btn btn-primary" name="serialize"></p></div></div></div> <div class="col-md-8">' . $helper->generateForm($this->fields_form) . '</div> <script type="text/javascript">var addnew ="' . $addnew . '"; var action="' . $action . '"; $("#content").PavMegaMenuList({action:action,addnew:addnew});</script>'; $output .= '</div>'; $output .= '<div class="tab-pane" id="widgets"> <div> <p><a href="' . AdminController::$currentIndex . '& configure=' . $this->name . '&widgets=1&token=' . Tools::getAdminTokenLite('AdminModules') . '" class="btn btn-info pts-modal-action btn btn-modeal btn-success btn-action">' . $this->l('Create Widget') . '</a></p> </div>' . $this->widgetsList() . '</div>'; $output .= '</div><script>$(\'#myTab a[href="#profile"]\').tab(\'show\')</script>'; return $output; }
public function displayAddCmsForm() { $output = null; $cmslinks = CMS::listCms(Context::getContext()->cookie->id_lang); $output = ' <div id="copycms" title="' . $this->l('Copy from cms form.') . '"> <form id="copycms_form" method="post" > <input id="parentid" name="parentid" type="hidden" /> <input id="copyinput_custom" name="custom" value="0" type="hidden" /> <input id="copy_position" name="position" value="" type="hidden" /> <fieldset style="background:none;"> <label>' . $this->l('Cms title :') . '</label> <div class="margin-form"> <select name="id_cms" style="float:left;">'; $output .= '<option value="0" >' . $this->l('---Select---') . '</option>'; if (is_array($cmslinks) == true) { foreach ($cmslinks as $cmslink) { $output .= '<option value="' . $cmslink['id_cms'] . '" >' . $cmslink['meta_title'] . '</option>'; } } $output .= ' </select> </div> <p style="clear: both;font-size:0.8em;text-align:left;margin-left:40px;">' . $this->l('This is cms page title you want to copy.') . '</p> </fieldset> </form> </div> <style> .margin-form { padding: 0 0 1em 80px; } </style>'; return $output; }
public function getContent() { global $cookie; if (Tools::isSubmit('submitwpblocktopmenu')) { $data = Tools::getValue('items'); if ($data != '') { $data_array = $this->_unserializeJQuery($data); $q = array(); $order = 1; foreach ($data_array as $key => $value) { $values = explode("|", $value); $q[] = "(" . $key . "," . ($values[2] == 'root' ? "NULL" : $values[2]) . ",'" . $values[0] . "'," . $values[1] . "," . $order++ . "," . $values[3] . ")"; } Db::getInstance()->Execute('TRUNCATE TABLE `' . _DB_PREFIX_ . 'wpblocktopmenu`'); $result = Db::getInstance()->Execute('INSERT INTO ' . _DB_PREFIX_ . 'wpblocktopmenu(`id`,`parent_id`,`type`,`id_ref`,`order`,`depth`) VALUES ' . implode(",", $q) . ' ON DUPLICATE KEY UPDATE `type`=VALUES(`type`),`parent_id`=VALUES(`parent_id`),`order`=VALUES(`order`),`depth`=VALUES(`depth`)'); } } if (Tools::isSubmit('submitwpblocktopmenuLinks')) { if (Tools::getValue('link') == '') { $this->_html .= $this->displayError($this->l('Unable to add this link')); } else { WPMenuTopLinks::add(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0)); $this->_html .= $this->displayConfirmation($this->l('The link has been added')); } } $this->_html .= ' <script type="text/javascript" src="' . $this->_path . 'js/jquery-ui-1.8.11.custom.min.js"></script> <script type="text/javascript" src="' . $this->_path . 'js/jquery.ui.nestedSortable.js"></script> <script type="text/javascript" src="' . $this->_path . 'js/backend.js"></script> <script> function add() { $("#availableItems option:selected").each(function(i){ var val = $(this).val(); var text = $(this).text(); if(val == "PRODUCT") { val = prompt("' . $this->l('Set ID product') . '"); if(val == null || val == "" || isNaN(val)) return; text = "' . $this->l('Product ID') . ' "+val; val = "PRD"+val; } var id=val.substring(3); $("#wp_menu").append("<li id=\\"list_"+(no_menu_items++)+"\\"><div>"+text+"<input type=\\"hidden\\" class=\\"type\\" value=\\""+val.substring(0,3)+"\\" /><input type=\\"hidden\\" class=\\"parent_id\\" value=\\"0\\" /><input type=\\"hidden\\" class=\\"id_ref\\" value=\\""+id+"\\" /></div>"); }); return false; } </script> <style type="text/css"> optgroup { } .remove { cursor:pointer; } #availableItems { width:300px; padding:10px; } option { } .option { } #menu_items { } #menu_items h1 { padding:5px 40px; background:transparent url("' . $this->_path . 'img/menu.png") 0 0 no-repeat; border-bottom:solid 1px #cccccc; } .box { border:solid 1px #cccccc; padding:10px; float:left; margin-right:2em; border-radius: 10px; -ms-border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -khtml-border-radius: 10px; background: #fafad2; /* for non-css3 browsers */ } .box_submit { width:150px; float:right; } #wp_menu { margin:0px; } ol { margin: 0; padding: 0; padding-left: 30px; } ol.sortable, ol.sortable ol { margin: 0 0 0 25px; padding: 0; list-style-type: none; } ol.sortable { margin: 4em 0; width:300px; } .sortable li span.remove { font-size:10px; color:#ffcc00; display:block; text-align:right; padding:0px; margin:0px; } .sortable li { margin: 7px 0 7px 0; padding: 0; } .sortable li div { border-radius: 10px; -ms-border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -khtml-border-radius: 10px; background-color:#ffffff; padding: 7px; margin: 0; cursor: move; } #availableItems { overflow:visible; } #addItem { border:solid 1px #666666; background:#ffffff url("' . $this->_path . 'img/popup_footer.gif") 0 0 repeat; padding:10px; 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 // BEGIN Products $this->_html .= '<optgroup label="' . $this->l('Products') . '">'; $this->_html .= '<option value="PRODUCT" font-style:italic">' . $this->l('Choose ID product') . '</option>'; $this->_html .= '</optgroup>'; // END Products // BEGIN Menu Top Links $this->_html .= '<optgroup label="' . $this->l('Menu Top Links') . '">'; $links = WPMenuTopLinks::gets($cookie->id_lang); foreach ($links as $link) { $this->_html .= '<option value="LNK' . $link['id_link'] . '" ">' . $link['label'] . '</option>'; } $this->_html .= '</optgroup>'; // END Menu Top Links $this->_html .= '</select><br /> <br /> <a href="#" id="addItem" >' . $this->l('Add') . '</a> </div> <div class="wp_menu box">'; $this->makeMenuOption(); $this->_html .= '</ol><br/> <br/> </div> </div> </form> <div class="clear"> </div> </fieldset><br />'; $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT')); $languages = Language::getLanguages(); $iso = Language::getIsoById($defaultLanguage); $divLangName = 'link_label'; $this->_html .= ' <fieldset> <legend><img src="../img/admin/add.gif" alt="" title="" />' . $this->l('Add Menu Top Link') . '</legend> <form action="' . $_SERVER['REQUEST_URI'] . '" method="post" id="form"> <label>' . $this->l('Label') . '</label> <div class="margin-form">'; foreach ($languages as $language) { $this->_html .= ' <div id="link_label_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . ';float: left;"> <input type="text" name="label[' . $language['id_lang'] . ']" id="label_' . $language['id_lang'] . '" size="70" value="" /> </div>'; } $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'link_label', true); $this->_html .= '</div><p class="clear"> </p> <label>' . $this->l('Link') . '</label> <div class="margin-form"> <input type="text" name="link" value="" size="70" /> </div> <label>' . $this->l('New Window') . '</label> <div class="margin-form"> <input type="checkbox" name="new_window" value="1" /> </div> <p class="center"> <input type="submit" name="submitwpblocktopmenuLinks" value="' . $this->l(' Add ') . '" class="button" /> </p> </form> </fieldset><br />'; $this->_html .= ' <fieldset> <legend><img src="../img/admin/details.gif" alt="" title="" />' . $this->l('List Menu Top Link') . '</legend> <table style="width:100%;"> <thead> <tr> <th>' . $this->l('Id Link') . '</th> <th>' . $this->l('Label') . '</th> <th>' . $this->l('Link') . '</th> <th>' . $this->l('New Window') . '</th> <th>' . $this->l('Action') . '</th> </tr> </thead> <tbody>'; $links = WPMenuTopLinks::gets($cookie->id_lang); foreach ($links as $link) { $this->_html .= ' <tr> <td>' . $link['id_link'] . '</td> <td>' . $link['label'] . '</td> <td>' . $link['link'] . '</td> <td>' . ($link['new_window'] ? $this->l('Yes') : $this->l('No')) . '</td> <td> <form action="' . $_SERVER['REQUEST_URI'] . '" method="post"> <input type="hidden" name="id_link" value="' . $link['id_link'] . '" /> <input type="submit" name="submitwpblocktopmenuRemove" value="' . $this->l('Remove') . '" class="button" /> </form> </td> </tr>'; } $this->_html .= '</tbody> </table> </fieldset>'; echo $this->_html; }
/** * Returns module content * * @param array $params Parameters * @return string Content */ function hookFooter($params) { global $smarty, $cookie; $cms = CMS::listCms($cookie->id_lang, $this->id); $id_cms = array(); foreach ($cms as $row) { $id_cms[] = intval($row['id_cms']); } $smarty->assign('cmslinks', CMS::getLinks($cookie->id_lang, $id_cms)); return $this->display(__FILE__, 'blockvariouslinks.tpl'); }
public function renderForm() { $fields_form = array('form' => array('legend' => array('title' => $this->l('Settings'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => 'select', 'label' => $this->l('Destination page for the block\'s link'), 'name' => 'PS_PAYMENT_LOGO_CMS_ID', 'required' => false, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => CMS::listCms($this->context->language->id), 'id' => 'id_cms', 'name' => 'meta_title'))), 'submit' => array('title' => $this->l('Save')))); $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $lang = new Language((int) Configuration::get('PS_LANG_DEFAULT')); $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->identifier = $this->identifier; $helper->submit_action = 'submitConfiguration'; $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->tpl_vars = array('fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id); return $helper->generateForm(array($fields_form)); }
private function _displayForm() { $params = $this->params; $id_lang = $this->context->language->id; $id_btmegamenu = (int) Tools::getValue('id_btmegamenu'); $obj = new Btmegamenu($id_btmegamenu); $tree = $obj->getTree(); $categories = LeoBtmegamenuHelper::getCategories(); $manufacturers = Manufacturer::getManufacturers(false, $id_lang, true); $suppliers = Supplier::getSuppliers(false, $id_lang, true); $cmss = CMS::listCms($this->context->language->id, false, true); $menus = $obj->getDropdown(null, $obj->id_parent); require_once dirname(__FILE__) . '/form.php'; }
private function _displayItemAdd() { global $cookie, $currentIndex; $id_menu = Tools::isSubmit('edit') ? intVal(Tools::getValue('id_menu')) : 0; $menu = new Menu($id_menu); $id_lang = $cookie->id_lang; $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT')); $iso = Language::getIsoById(intval($cookie->id_lang)); $languages = Language::getLanguages(); $divLangName = 'title¤link'; $this->_html .= ' <script type="text/javascript">id_language = Number(' . $defaultLanguage . ');</script> <form action="" method="post" enctype="multipart/form-data"> <fieldset> <legend> <img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/add.gif" alt="" title="" /> ' . $this->l('Add item') . ' </legend> <label for="type">' . $this->l('Type:') . '</label> <div class="margin-form"> <select name="type" onchange="$(\'.case\').addClass(\'hide\');$(\'.case_\'+$(this).val()).removeClass(\'hide\');"> <option value="">-- ' . $this->l('Select an item type') . ' --</option> <option value="category" ' . ($menu->type == 'category' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Categories') . '</option> <option value="product"' . ($menu->type == 'product' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Products') . '</option> <option value="cms"' . ($menu->type == 'cms' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('CMS') . '</option> <option value="manufacturers"' . ($menu->type == 'manufacturers' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Manufacturers List') . '</option> <option value="manufacturer"' . ($menu->type == 'manufacturer' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Manufacturer') . '</option> <option value="suppliers"' . ($menu->type == 'suppliers' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Suppliers List') . '</option> <option value="supplier"' . ($menu->type == 'supplier' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Supplier') . '</option> <option value="link"' . ($menu->type == 'link' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Links') . '</option> </select><sup> *</sup> <!-- <p class="clear">...</p> --> </div> <label for="type">' . $this->l('Parent Item:') . '</label> <div class="margin-form"> <select name="id_parent"> <option value="0">-- ' . $this->l('Choose a parent item') . ' --</option>'; $items = Menu::getItems($id_lang); $this->_html .= $this->_showOption($items, $id_lang, 0, $menu->id_parent, array($menu->id)); $this->_html .= ' </select> </div> <!-- 2010-02-22 12:40:43 --> <label for="css">' . $this->l('CSS ID:') . '</label> <div class="margin-form"> <input type="text" name="css" id="css" value="' . (!is_null($menu->id) ? $menu->css : '') . '" /> <p class="clear">' . $this->l('Use this option to set a CSS ID to this item.') . '</p> </div> <!-- /2010-02-22 12:40:43 --> <!-- INT --> <label for="title">' . $this->l('Title:') . '</label> <div class="margin-form">'; foreach ($languages as $language) { $this->_html .= ' <div id="title_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;"> <input type="text" name="title[' . $language['id_lang'] . ']" value="' . (!is_null($menu->id) ? $menu->title[$language['id_lang']] : '') . '" class="' . ($language['id_lang'] != $defaultLanguage ? 'clone' : 'cloneParent') . '" /><sup class="case case_link hide"> *</sup> </div>'; } ob_start(); $this->displayFlags($languages, $defaultLanguage, $divLangName, 'title'); $this->_html .= ob_get_contents(); ob_end_clean(); $this->_html .= ' <p class="clear">' . $this->l('If you leave the field blank, the default title will be used.') . '</p> </div> <!-- INT --> <!-- 2009-12-14 09:56:32 --> <label for="logged">' . $this->l('Must be logged:') . '</label> <div class="margin-form"> <input type="checkbox" id="logged" name="logged" value="1"' . (!is_null($menu->id) && $menu->logged ? ' checked=""' : '') . '/> <p class="clear">' . $this->l('User must be logged.') . '</p> </div> <!-- /2009-12-14 09:56:32 --> <div class="case_category case ' . ($menu->type == 'category' && Tools::isSubmit('edit') ? '' : 'hide') . '"> <label for="category_level">' . $this->l('Level:') . '</label> <div class="margin-form"> <input type="text" name="category_level" id="category_level" value="' . (!is_null($menu->id) ? $menu->level : '0') . '" size="5" /> <p class="clear">' . $this->l('Maximum level of unfolding, leave 0 for all.') . '</p> </div> <label for="id_category">' . $this->l('Category:') . '</label> <div class="margin-form"> <select name="id_category" id="id_category" size="10">'; $this->_getCategoryOption(1, $cookie->id_lang, true, !is_null($menu->id) ? $menu->id_item : null); $this->_html .= ' </select><sup> *</sup> <p class="clear">' . $this->l('Start category') . '</p> </div> <label for="category_ignore">' . $this->l('Categories to ignore:') . '</label> <div class="margin-form"> <input type="text" name="category_ignore" id="category_ignore" value="' . (!is_null($menu->id) ? $menu->ignore : '') . '" /> <p class="clear">' . $this->l('Separate with comma. (id1,id2,...)') . '</p> </div> </div> <div class="case_product case ' . ($menu->type == 'product' && Tools::isSubmit('edit') ? '' : 'hide') . '"> <label for="id_product">' . $this->l('Product ID:') . '</label> <div class="margin-form"> <input type="text" name="id_product" id="id_product" size="6" /> <!-- <select name="id_product" id="id_product">'; $this->_html .= ' </select><sup> *</sup> --> </div> </div> <div class="case_cms case ' . ($menu->type == 'cms' && Tools::isSubmit('edit') ? '' : 'hide') . '"> <label for="id_cms">' . $this->l('CMS Page:') . '</label> <div class="margin-form"> <select name="id_cms" id="id_cms">'; $_cms = CMS::listCms($cookie->id_lang); foreach ($_cms as $cms) { $this->_html .= '<option value="' . $cms['id_cms'] . '" ' . (!is_null($menu->id) && $menu->id_item == $cms['id_cms'] ? 'selected=""' : '') . ' >' . $cms['meta_title'] . '</option>'; } $this->_html .= ' </select><sup> *</sup> </div> </div> <div class="case_manufacturer case ' . ($menu->type == 'manufacturer' && Tools::isSubmit('edit') ? '' : 'hide') . '"> <label for="manufacturer_id">' . $this->l('Manufacturer:') . '</label> <div class="margin-form"> <select name="id_manufacturer" id="id_manufacturer">'; $manufacturers = Manufacturer::getManufacturers(false, $cookie->id_lang); foreach ($manufacturers as $manufacturer) { $this->_html .= '<option value="' . $manufacturer['id_manufacturer'] . '" ' . (!is_null($menu->id) && $menu->id_item == $manufacturer['id_manufacturer'] ? 'selected=""' : '') . ' >' . $manufacturer['name'] . '</option>'; } $this->_html .= ' </select> </div> </div> <div class="case_supplier case ' . ($menu->type == 'supplier' && Tools::isSubmit('edit') ? '' : 'hide') . '"> <label for="id_supplier">' . $this->l('Supplier:') . '</label> <div class="margin-form"> <select name="id_supplier" id="id_supplier">'; $suppliers = Supplier::getSuppliers(false, $cookie->id_lang); foreach ($suppliers as $supplier) { $this->_html .= '<option value="' . $supplier['id_supplier'] . '" ' . (!is_null($menu->id) && $menu->id_item == $supplier['id_supplier'] ? 'selected=""' : '') . ' >' . $supplier['name'] . '</option>'; } $this->_html .= ' </select><sup> *</sup> </div> </div> <div class="case_link case ' . ($menu->type == 'link' && Tools::isSubmit('edit') ? '' : 'hide') . '"> <label for="link">' . $this->l('URL:') . '</label> <div class="margin-form">'; foreach ($languages as $language) { $this->_html .= ' <div id="link_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;"> <input type="text" name="link[' . $language['id_lang'] . ']" value="' . (!is_null($menu->id) ? $menu->link[$language['id_lang']] : '') . '" class="' . ($language['id_lang'] != $defaultLanguage ? 'clone' : 'cloneParent') . '" /><sup> *</sup> </div>'; } ob_start(); $this->displayFlags($languages, $defaultLanguage, $divLangName, 'link'); $this->_html .= ob_get_contents(); ob_end_clean(); $this->_html .= ' <p class="clear"> </p> </div> </div> <!-- v5.6.5 --> <label for="new_window">' . $this->l('New window:') . '</label> <div class="margin-form"> <input type="checkbox" id="new_window" name="new_window" value="1"' . (!is_null($menu->id) && $menu->new_window ? ' checked=""' : '') . '/> <p class="clear">' . $this->l('On click, open link in new window.') . '</p> </div> <label for="icon">' . $this->l('Icon:') . '</label> <div class="margin-form"> <input type="file" name="icon" id="icon" /><br />'; $filename = $this->_getFilename($menu->id); if ($filename) { $this->_html .= ' <div id="image" style="float: none; width: 100px;"> <img src="' . $filename . '?refresh=' . rand(1, 10) . '" /> <a href="' . $_SERVER['REQUEST_URI'] . '&deleteIcon"><img src="' . _PS_ADMIN_IMG_ . '/delete.gif" alt="" /></a> </div>'; } $this->_html .= ' </div> <div class="clear center"> <input type="submit" name="submitItem" value="' . $this->l(' Save item ') . '" class="button" /> </div> </fieldset> </form>'; }
private function _postProcess() { // Dismiss Addons rating if (isset($_GET['dismissRating'])) { $this->_html = ''; self::_cleanBuffer(); if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) { Configuration::updateGlobalValue('PM_' . self::$_module_prefix . '_DISMISS_RATING', 1); } else { Configuration::updateValue('PM_' . self::$_module_prefix . '_DISMISS_RATING', 1); } die; } $this->saveConfig(); $this->saveAdvancedConfig(); if (isset($_GET['displayPreview'])) { $this->_html = ''; $this->displayPreview(); self::_cleanBuffer(); echo $this->_html; die; } elseif (Tools::getValue('activeMaintenance')) { echo $this->_postProcessMaintenance(self::$_module_prefix); die; } elseif (Tools::getValue('actionColumn') == 'get_select_columns') { $id_menu = Tools::getValue('id_menu', false); if (!$id_menu) { die; } $columns = AdvancedTopMenuColumnClass::getMenuColumsByIdMenu((int) $id_menu, $this->_cookie->id_lang, false); $column_selected = Tools::getValue('column_selected', false); $this->_smarty->assign(array('columns' => $columns, 'column_selected' => $column_selected, 'objADTM' => new PM_AdvancedTopMenu())); self::_cleanBuffer(); $this->_smarty->display(dirname(__FILE__) . '/column_select.tpl'); die; } elseif (Tools::getValue('actionColumn') == 'get_select_columnsWrap') { $id_menu = Tools::getValue('id_menu', false); if (!$id_menu) { die; } $columnsWrap = AdvancedTopMenuColumnWrapClass::getMenuColumnsWrap((int) $id_menu, $this->_cookie->id_lang, false); $columnWrap_selected = Tools::getValue('columnWrap_selected', false); $this->_smarty->assign(array('columnsWrap' => $columnsWrap, 'columnWrap_selected' => $columnWrap_selected)); self::_cleanBuffer(); $this->_smarty->display(dirname(__FILE__) . '/columnwrap_select.tpl'); die; } elseif (isset($_GET['columnElementsPosition'])) { $order = $_GET['columnElementsPosition'] ? explode(',', $_GET['columnElementsPosition']) : array(); foreach ($order as $position => $id_element) { $row = array('position' => intval($position)); Db::getInstance()->AutoExecute(_DB_PREFIX_ . 'pm_advancedtopmenu_elements', $row, 'UPDATE', 'id_element =' . intval($id_element)); } $this->clearCache(); self::_cleanBuffer(); echo $this->l('Save'); die; } elseif (isset($_GET['menuPosition'])) { $order = $_GET['menuPosition'] ? explode(',', $_GET['menuPosition']) : array(); foreach ($order as $position => $id_menu) { if (!trim($id_menu)) { continue; } $row = array('position' => intval($position)); Db::getInstance()->AutoExecute(_DB_PREFIX_ . 'pm_advancedtopmenu', $row, 'UPDATE', 'id_menu =' . intval($id_menu)); } $this->clearCache(); self::_cleanBuffer(); echo $this->l('Save'); die; } elseif (isset($_GET['columnPosition'])) { $order = $_GET['columnPosition'] ? explode(',', $_GET['columnPosition']) : array(); foreach ($order as $position => $id_column) { if (!trim($id_column)) { continue; } $row = array('position' => intval($position)); Db::getInstance()->AutoExecute(_DB_PREFIX_ . 'pm_advancedtopmenu_columns', $row, 'UPDATE', 'id_column =' . intval($id_column)); } $this->clearCache(); self::_cleanBuffer(); echo $this->l('Save'); die; } elseif (isset($_GET['columnWrapPosition'])) { $order = $_GET['columnWrapPosition'] ? explode(',', $_GET['columnWrapPosition']) : array(); foreach ($order as $position => $id_wrap) { if (!trim($id_wrap)) { continue; } $row = array('position' => intval($position)); Db::getInstance()->AutoExecute(_DB_PREFIX_ . 'pm_advancedtopmenu_columns_wrap', $row, 'UPDATE', 'id_wrap =' . intval($id_wrap)); } $this->clearCache(); self::_cleanBuffer(); echo $this->l('Save'); die; } elseif (Tools::getValue('activeMenu') && Tools::getValue('id_menu')) { $return = ''; $ObjAdvancedTopMenuClass = new AdvancedTopMenuClass(Tools::getValue('id_menu')); $ObjAdvancedTopMenuClass->active = $ObjAdvancedTopMenuClass->active ? 0 : 1; if ($ObjAdvancedTopMenuClass->save()) { $return .= '$("#imgActiveMenu' . $ObjAdvancedTopMenuClass->id . '").attr("src","../img/admin/' . ($ObjAdvancedTopMenuClass->active ? 'enabled' : 'disabled') . '.gif");'; $return .= 'show_info("activemenu","' . $this->l('Save') . '");'; } else { $return .= 'show_info("activemenu","' . $this->l('Error during update menu') . '");'; } $this->clearCache(); self::_cleanBuffer(); echo $return; die; } elseif (Tools::getValue('activeColumnWrap') && Tools::getValue('id_wrap')) { $return = ''; $ObjAdvancedTopMenuColumnWrapClass = new AdvancedTopMenuColumnWrapClass(Tools::getValue('id_wrap')); $ObjAdvancedTopMenuColumnWrapClass->active = $ObjAdvancedTopMenuColumnWrapClass->active ? 0 : 1; if ($ObjAdvancedTopMenuColumnWrapClass->save()) { $return .= '$("#imgActiveColumnWrap' . $ObjAdvancedTopMenuColumnWrapClass->id . '").attr("src","../img/admin/' . ($ObjAdvancedTopMenuColumnWrapClass->active ? 'enabled' : 'disabled') . '.gif");'; $return .= 'show_info("activecolumnwrap","' . $this->l('Save') . '");'; } else { $return .= 'show_info("activecolumnwrap","' . $this->l('Error during update column') . '");'; } $this->clearCache(); self::_cleanBuffer(); echo $return; die; } elseif (Tools::getValue('activeColumn') && Tools::getValue('id_column')) { $return = ''; $ObjAdvancedTopMenuColumnClass = new AdvancedTopMenuColumnClass(Tools::getValue('id_column')); $ObjAdvancedTopMenuColumnClass->active = $ObjAdvancedTopMenuColumnClass->active ? 0 : 1; if ($ObjAdvancedTopMenuColumnClass->save()) { $return .= '$("#imgActiveColumn' . $ObjAdvancedTopMenuColumnClass->id . '").attr("src","../img/admin/' . ($ObjAdvancedTopMenuColumnClass->active ? 'enabled' : 'disabled') . '.gif");'; $return .= 'show_info("activegroup","' . $this->l('Save') . '");'; } else { $return .= 'show_info("activegroup","' . $this->l('Error during update group') . '");'; } $this->clearCache(); self::_cleanBuffer(); echo $return; die; } elseif (Tools::getValue('activeElement') && Tools::getValue('id_element')) { $return = ''; $AdvancedTopMenuElementsClass = new AdvancedTopMenuElementsClass(Tools::getValue('id_element')); $AdvancedTopMenuElementsClass->active = $AdvancedTopMenuElementsClass->active ? 0 : 1; if ($AdvancedTopMenuElementsClass->save()) { $return .= '$("#imgActiveElement' . $AdvancedTopMenuElementsClass->id . '").attr("src","../img/admin/' . ($AdvancedTopMenuElementsClass->active ? 'enabled' : 'disabled') . '.gif");'; $return .= 'show_info("activeelement","' . $this->l('Save') . '");'; } else { $return .= 'show_info("activeelement","' . $this->l('Error during update element') . '");'; } $this->clearCache(); self::_cleanBuffer(); echo $return; die; } elseif (Tools::getValue('deleteMenu') && Tools::getValue('id_menu')) { $ObjAdvancedTopMenuClass = new AdvancedTopMenuClass(Tools::getValue('id_menu')); if ($ObjAdvancedTopMenuClass->delete()) { $this->_html .= $this->displayConfirmation($this->l('Menu has been deleted')); } else { $this->errors[] = $this->l('Error during delete column'); } $this->clearCache(); } elseif (Tools::getValue('deleteColumnWrap') && Tools::getValue('id_wrap')) { $ObjAdvancedTopMenuColumnWrapClass = new AdvancedTopMenuColumnWrapClass(Tools::getValue('id_wrap')); if ($ObjAdvancedTopMenuColumnWrapClass->delete()) { $this->_html .= $this->displayConfirmation($this->l('Column has been deleted')); } else { $this->errors[] = $this->l('Error during delete column'); } $this->clearCache(); } elseif (Tools::getValue('deleteColumn') && Tools::getValue('id_column')) { $ObjAdvancedTopMenuColumnClass = new AdvancedTopMenuColumnClass(Tools::getValue('id_column')); if ($ObjAdvancedTopMenuColumnClass->delete()) { $this->_html .= $this->displayConfirmation($this->l('Group has been deleted')); } else { $this->errors[] = $this->l('Error during delete Group'); } $this->clearCache(); } elseif (Tools::getValue('deleteElement') && Tools::getValue('id_element')) { $AdvancedTopMenuElementsClass = new AdvancedTopMenuElementsClass(Tools::getValue('id_element')); if ($AdvancedTopMenuElementsClass->delete()) { $this->_html .= $this->displayConfirmation($this->l('Item has been deleted')); } else { $this->errors[] = $this->l('Error during delete item'); } $this->clearCache(); } elseif (Tools::getValue('getMenuForm')) { $ObjAdvancedTopMenuClass = false; if (Tools::getValue('editMenu') && Tools::getValue('id_menu')) { $ObjAdvancedTopMenuClass = new AdvancedTopMenuClass(Tools::getValue('id_menu')); } $cms = CMS::listCms(intval($this->_cookie->id_lang)); $categories = Category::getCategories(intval($this->_cookie->id_lang), false); $manufacturer = Manufacturer::getManufacturers(false, $this->_cookie->id_lang, true); $supplier = Supplier::getSuppliers(false, $this->_cookie->id_lang, true); self::_cleanBuffer(); if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) { $this->_html = ''; } $this->displayMenuForm($cms, $categories, $manufacturer, $supplier, $ObjAdvancedTopMenuClass); $this->initColorPicker(); $this->initTinyMce(); echo $this->_html; die; } elseif (Tools::getValue('getColumnWrapForm')) { $ObjAdvancedTopMenuColumnWrapClass = false; if (Tools::getValue('editColumnWrap') && Tools::getValue('id_wrap')) { $ObjAdvancedTopMenuColumnWrapClass = new AdvancedTopMenuColumnWrapClass(Tools::getValue('id_wrap')); } $menus = AdvancedTopMenuClass::getMenus($this->_cookie->id_lang, false); self::_cleanBuffer(); if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) { $this->_html = ''; } $this->displayColumnWrapForm($menus, $ObjAdvancedTopMenuColumnWrapClass); $this->initColorPicker(); $this->initTinyMce(); echo $this->_html; die; } elseif (Tools::getValue('getColumnForm')) { $ObjAdvancedTopMenuColumnClass = false; if (Tools::getValue('editColumn') && Tools::getValue('id_column')) { $ObjAdvancedTopMenuColumnClass = new AdvancedTopMenuColumnClass(Tools::getValue('id_column')); } $cms = CMS::listCms(intval($this->_cookie->id_lang)); $categories = Category::getCategories(intval($this->_cookie->id_lang), false); $manufacturer = Manufacturer::getManufacturers(false, $this->_cookie->id_lang, true); $supplier = Supplier::getSuppliers(false, $this->_cookie->id_lang, true); $menus = AdvancedTopMenuClass::getMenus($this->_cookie->id_lang, false); self::_cleanBuffer(); if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) { $this->_html = ''; } $this->displayColumnForm($menus, $cms, $categories, $manufacturer, $supplier, $ObjAdvancedTopMenuColumnClass); $this->initColorPicker(); $this->initTinyMce(); echo $this->_html; die; } elseif (Tools::getValue('getElementForm')) { $ObjAdvancedTopMenuElementsClass = false; if (Tools::getValue('editElement') && Tools::getValue('id_element')) { $ObjAdvancedTopMenuElementsClass = new AdvancedTopMenuElementsClass(Tools::getValue('id_element')); } $cms = CMS::listCms(intval($this->_cookie->id_lang)); $categories = Category::getCategories(intval($this->_cookie->id_lang), false); $manufacturer = Manufacturer::getManufacturers(false, $this->_cookie->id_lang, true); $supplier = Supplier::getSuppliers(false, $this->_cookie->id_lang, true); $menus = AdvancedTopMenuClass::getMenus($this->_cookie->id_lang, false); self::_cleanBuffer(); if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) { $this->_html = ''; } $this->displayElementForm($menus, array(), $cms, $categories, $manufacturer, $supplier, $ObjAdvancedTopMenuElementsClass); $this->initColorPicker(); echo $this->_html; die; } elseif (isset($_POST['submitMenu'])) { $this->_postProcessMenu(); $this->clearCache(); } elseif (isset($_POST['submitColumnWrap'])) { $this->_postProcessColumnWrap(); $this->clearCache(); } elseif (isset($_POST['submitColumn'])) { $this->_postProcessColumn(); $this->clearCache(); } elseif (isset($_POST['submitElement'])) { $this->_postProcessColumnElement(); $this->clearCache(); } elseif (isset($_POST['submitFastChangeColumn'])) { $id_column = Tools::getValue('id_column'); $id_wrap = Tools::getValue('id_wrap'); if ($id_wrap && $id_column) { $row = array('id_wrap' => intval($id_wrap)); Db::getInstance()->AutoExecute(_DB_PREFIX_ . 'pm_advancedtopmenu_columns', $row, 'UPDATE', 'id_column =' . intval($id_column)); } $this->clearCache(); } }
} public static function getCMSPages() { $pages = CMS::listCms($id_lang = null, $id_block = false, $active = true); $npages = array(); if (!empty($pages)) { foreach ($pages as $page) { $npages['CMS_' . $page['id_cms']] = $page['meta_title']; } } return $npages;