Exemplo n.º 1
0
 protected function displayForm()
 {
     $this->context->controller->addJqueryPlugin('tablednd');
     $this->context->controller->addJS(_PS_JS_DIR_ . 'admin-dnd.js');
     $current_index = AdminController::$currentIndex;
     $token = Tools::getAdminTokenLite('AdminModules');
     $this->_display = 'index';
     $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('CMS block configuration'), 'icon' => 'icon-list-alt'), 'input' => array(array('type' => 'cms_blocks', 'label' => $this->l('CMS Blocks'), 'name' => 'cms_blocks', 'values' => array(0 => OvicBlockCMSModel::getCMSBlocksByLocation(OvicBlockCMSModel::LEFT_COLUMN, Shop::getContextShopID()), 1 => OvicBlockCMSModel::getCMSBlocksByLocation(OvicBlockCMSModel::RIGHT_COLUMN, Shop::getContextShopID()), 3 => OvicBlockCMSModel::getCMSBlocksByLocation(OvicBlockCMSModel::CMS_POS, Shop::getContextShopID())))), 'buttons' => array('newBlock' => array('title' => $this->l('New block'), 'href' => $current_index . '&configure=' . $this->name . '&token=' . $token . '&addBlockCMS', 'class' => 'pull-right', 'icon' => 'process-icon-new')));
     $this->fields_form[1]['form'] = array('tinymce' => true, 'legend' => array('title' => $this->l('Configuration of the various links in the footer'), 'icon' => 'icon-link'), 'input' => array(array('type' => 'checkbox', 'name' => 'cms_footer', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Display various links and information in the footer'), 'val' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'cms_pages', 'label' => $this->l('Footer links'), 'name' => 'footerBox[]', 'values' => OvicBlockCMSModel::getAllCMSStructure(), 'desc' => $this->l('Please mark every page that you want to display in the footer CMS block.')), array('type' => 'textarea', 'label' => $this->l('Footer information'), 'name' => 'footer_text', 'rows' => 5, 'cols' => 60, 'lang' => true), array('type' => 'checkbox', 'name' => 'PS_STORES_DISPLAY_FOOTER', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Display "Our stores" link in the footer'), 'val' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'checkbox', 'name' => 'cms_footer_display_price-drop', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Display "Price drop" link in the footer'), 'val' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'checkbox', 'name' => 'cms_footer_display_new-products', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Display "New products" link in the footer'), 'val' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'checkbox', 'name' => 'cms_footer_display_best-sales', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Display "Best sales" link in the footer'), 'val' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'checkbox', 'name' => 'cms_footer_display_contact', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Display "Contact us" link in the footer'), 'val' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'checkbox', 'name' => 'cms_footer_display_sitemap', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Display sitemap link in the footer'), 'val' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'checkbox', 'name' => 'cms_footer_powered_by', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Display "Powered by PrestaShop" in the footer'), 'val' => '1')), 'id' => 'id', 'name' => 'name'))), 'submit' => array('name' => 'submitFooterCMS', 'title' => $this->l('Save')));
     $this->context->controller->getLanguages();
     $tmp = Configuration::get('FOOTER_CMS');
     $footer_boxes = explode('|', $tmp);
     if ($footer_boxes && is_array($footer_boxes)) {
         foreach ($footer_boxes as $key => $value) {
             $this->fields_value[$value] = true;
         }
     }
     $this->fields_value['cms_footer_on'] = Configuration::get('FOOTER_BLOCK_ACTIVATION');
     $this->fields_value['cms_footer_powered_by_on'] = Configuration::get('FOOTER_POWEREDBY');
     $this->fields_value['PS_STORES_DISPLAY_FOOTER_on'] = Configuration::get('PS_STORES_DISPLAY_FOOTER');
     $this->fields_value['cms_footer_display_price-drop_on'] = Configuration::get('FOOTER_PRICE-DROP');
     $this->fields_value['cms_footer_display_new-products_on'] = Configuration::get('FOOTER_NEW-PRODUCTS');
     $this->fields_value['cms_footer_display_best-sales_on'] = Configuration::get('FOOTER_BEST-SALES');
     $this->fields_value['cms_footer_display_contact_on'] = Configuration::get('FOOTER_CONTACT');
     $this->fields_value['cms_footer_display_sitemap_on'] = Configuration::get('FOOTER_SITEMAP');
     foreach ($this->context->controller->_languages as $language) {
         $footer_text = Configuration::get('FOOTER_CMS_TEXT_' . $language['id_lang']);
         $this->fields_value['footer_text'][$language['id_lang']] = $footer_text;
     }
     $helper = $this->initForm();
     $helper->submit_action = '';
     $helper->title = $this->l('CMS Block configuration');
     $helper->fields_value = $this->fields_value;
     $this->_html .= $helper->generateForm($this->fields_form);
     return;
 }