コード例 #1
0
 public function hookLeftColumn($params)
 {
     if (!$this->isCached('blockmanufacturer.tpl', $this->getCacheId())) {
         $this->smarty->assign(array('manufacturers' => Manufacturer::getManufacturers(), 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), 'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS')));
     }
     return $this->display(__FILE__, 'blockmanufacturer.tpl', $this->getCacheId());
 }
コード例 #2
0
 public function renderForm()
 {
     if (!$this->object->id) {
         $this->object->price = -1;
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Catalog price rules'), 'icon' => 'icon-dollar'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop'), 'name' => 'shop_id', 'options' => array('query' => Shop::getShops(), 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity'), 'name' => 'from_quantity', 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.)'), 'name' => 'price', 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'datetime', 'label' => $this->l('From'), 'name' => 'from'), array('type' => 'datetime', 'label' => $this->l('To'), 'name' => 'to'), array('type' => 'select', 'label' => $this->l('Reduction type'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Reduction with or without taxes'), 'name' => 'reduction_tax', 'align' => 'center', 'options' => array('query' => array(array('lab' => $this->l('Tax included'), 'val' => 1), array('lab' => $this->l('Tax excluded'), 'val' => 0)), 'id' => 'val', 'name' => 'lab')), array('type' => 'text', 'label' => $this->l('Reduction'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save')));
     if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
         $price = number_format($value, 6);
     } else {
         $price = '';
     }
     $this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 6), 'leave_bprice_on' => $price ? 0 : 1);
     $attribute_groups = array();
     $attributes = Attribute::getAttributes((int) $this->context->language->id);
     foreach ($attributes as $attribute) {
         if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
             $attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
         }
         $attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
     }
     $features = Feature::getFeatures((int) $this->context->language->id);
     foreach ($features as &$feature) {
         $feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
     }
     $this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
     return parent::renderForm();
 }
コード例 #3
0
 function hookHome($params)
 {
     global $smarty, $cookie;
     $manufacturer = Manufacturer::getManufacturers(false, $cookie->id_lang, true);
     $smarty->assign(array('manufacturer' => $manufacturer));
     return $this->display(__FILE__, 'tdmanufacturerblock.tpl');
 }
コード例 #4
0
 /**
  * @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();
 }
コード例 #5
0
ファイル: brandsslider.php プロジェクト: abdoumej/libsamy
 public function hookdisplayGroupSports($params)
 {
     if (!$this->isCached('brandsslider.tpl', $this->getCacheId())) {
         $manufacturers = Manufacturer::getManufacturers();
         foreach ($manufacturers as $key => $item) {
             foreach ($manufacturers as &$item) {
                 $item['image'] = $item['id_manufacturer'] . '-brand-136x69.jpg';
             }
         }
         $this->smarty->assign('manufacturers', $manufacturers);
     }
     return $this->display(__FILE__, 'brandsslider.tpl', $this->getCacheId());
 }
コード例 #6
0
ファイル: blockmanufacturer.php プロジェクト: zangles/lennyba
 public function hookLeftColumn($params)
 {
     if (!$this->isCached('blockmanufacturer.tpl', $this->getCacheId())) {
         $manufacturers = Manufacturer::getManufacturers();
         foreach ($manufacturers as &$manufacturer) {
             $manufacturer['image'] = $this->context->language->iso_code . '-default';
             if (file_exists(_PS_MANU_IMG_DIR_ . $manufacturer['id_manufacturer'] . '-' . ImageType::getFormatedName('medium') . '.jpg')) {
                 $manufacturer['image'] = $manufacturer['id_manufacturer'];
             }
         }
         $this->smarty->assign(array('manufacturers' => $manufacturers, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), 'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS')));
     }
     return $this->display(__FILE__, 'blockmanufacturer.tpl', $this->getCacheId());
 }
コード例 #7
0
 public function hookDisplayHome($params)
 {
     if (!$this->isCached('tmbrandlogo.tpl', $this->getCacheId())) {
         $manufacturers = Manufacturer::getManufacturers();
         foreach ($manufacturers as &$manufacturer) {
             $manufacturer['image'] = $this->context->language->iso_code . '-default';
             if (file_exists(_PS_MANU_IMG_DIR_ . $manufacturer['id_manufacturer'] . '-' . ImageType::getFormatedName('medium') . '.jpg')) {
                 $manufacturer['image'] = $manufacturer['id_manufacturer'];
             }
         }
         $this->smarty->assign(array('manufacturers' => $manufacturers, 'tm_slider' => Configuration::get('TM_BRAND_SLIDER'), 'tm_logoname' => Configuration::get('TM_BRAND_NAME'), 'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS')));
     }
     return $this->display(__FILE__, 'tmbrandlogo.tpl', $this->getCacheId());
 }
コード例 #8
0
 public function renderContent($setting)
 {
     $t = array('name' => '', 'html' => '');
     $setting = array_merge($t, $setting);
     $data = Manufacturer::getManufacturers(false, 0, true, 1, $setting['limit']);
     foreach ($data as $key => $item) {
         $item['image'] = !file_exists(_PS_MANU_IMG_DIR_ . $item['id_manufacturer'] . '-' . ImageType::getFormatedName('medium') . '.jpg') ? Context::getContext()->language->iso_code . '-default' : $item['id_manufacturer'];
         $data[$key] = $item;
     }
     $setting['manufacturers'] = $data;
     $setting['link'] = Context::getContext()->link;
     $output = array('type' => 'manufacture', 'data' => $setting);
     return $output;
 }
コード例 #9
0
ファイル: manufacture.php プロジェクト: evgrishin/mh16014
 public function renderContent($args, $setting)
 {
     $t = array('name' => '', 'html' => '');
     $setting = array_merge($t, $setting);
     $plimit = $setting['limit'] ? (int) $setting['limit'] : 10;
     $image_type = $setting['image'] ? $setting['image'] : 'small' . '_default';
     $data = Manufacturer::getManufacturers(true, Context::getContext()->language->id, true, 1, $plimit, false);
     foreach ($data as &$item) {
         $id_images = !file_exists(_PS_MANU_IMG_DIR_ . '/' . $item['id_manufacturer'] . '-' . $image_type . '.jpg') ? Language::getIsoById(Context::getContext()->language->id) . '-default' : $item['id_manufacturer'];
         $item['image'] = _THEME_MANU_DIR_ . $id_images . '-' . $image_type . '.jpg';
     }
     $setting['manufacturers'] = $data;
     $output = array('type' => 'manufacture', 'data' => $setting);
     return $output;
 }
コード例 #10
0
 /**
  * Assign template vars if displaying the manufacturer list
  */
 protected function assignAll()
 {
     if (Configuration::get('PS_DISPLAY_SUPPLIERS')) {
         $data = Manufacturer::getManufacturers(false, $this->context->language->id, true, false, false, false);
         $nbProducts = count($data);
         $this->n = abs((int) Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE')));
         $this->p = abs((int) Tools::getValue('p', 1));
         $data = Manufacturer::getManufacturers(true, $this->context->language->id, true, $this->p, $this->n, false);
         $this->pagination($nbProducts);
         foreach ($data as &$item) {
             $item['image'] = !file_exists(_PS_MANU_IMG_DIR_ . $item['id_manufacturer'] . '-' . ImageType::getFormatedName('medium') . '.jpg') ? $this->context->language->iso_code . '-default' : $item['id_manufacturer'];
         }
         $this->context->smarty->assign(array('pages_nb' => ceil($nbProducts / (int) $this->n), 'nbManufacturers' => $nbProducts, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'manufacturers' => $data, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY')));
     } else {
         $this->context->smarty->assign('nbManufacturers', 0);
     }
 }
コード例 #11
0
 public function process()
 {
     if (Validate::isLoadedObject($this->manufacturer) and $this->manufacturer->active) {
         $nbProducts = $this->manufacturer->getProducts($this->manufacturer->id, NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
         $this->pagination($nbProducts);
         self::$smarty->assign(array('nb_products' => $nbProducts, 'products' => $this->manufacturer->getProducts($this->manufacturer->id, (int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay), 'path' => $this->manufacturer->active ? Tools::safeOutput($this->manufacturer->name) : '', 'manufacturer' => $this->manufacturer));
     } elseif (!Tools::getValue('id_manufacturer')) {
         if (Configuration::get('PS_DISPLAY_SUPPLIERS')) {
             $result = Manufacturer::getManufacturers(true, (int) self::$cookie->id_lang, true);
             $nbProducts = count($result);
             $this->pagination($nbProducts);
             $manufacturers = Manufacturer::getManufacturers(true, (int) self::$cookie->id_lang, true, $this->p, $this->n);
             foreach ($manufacturers as &$row) {
                 $row['image'] = !file_exists(_PS_MANU_IMG_DIR_ . '/' . $row['id_manufacturer'] . '-medium.jpg') ? Language::getIsoById((int) self::$cookie->id_lang) . '-default' : $row['id_manufacturer'];
             }
             self::$smarty->assign(array('pages_nb' => ceil($nbProducts / (int) $this->n), 'nbManufacturers' => $nbProducts, 'mediumSize' => Image::getSize('medium'), 'manufacturers' => $manufacturers, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY')));
         } else {
             self::$smarty->assign('nbManufacturers', 0);
         }
     }
 }
コード例 #12
0
 public function renderContent($setting)
 {
     $t = array('name' => '', 'html' => '', 'columns' => 4, 'list_mode' => 'grid', 'display_mode' => 'carousel', 'nbr_desktops' => 4, 'nbr_tablets' => 2, 'nbr_mobile' => 1, 'widgetid' => 'manu-' . time());
     $setting = array_merge($t, $setting);
     $manufacturers = Manufacturer::getManufacturers();
     foreach ($manufacturers as &$manufacturer) {
         $manufacturer['image'] = Context::getContext()->language->iso_code . '-default';
         if (file_exists(_PS_MANU_IMG_DIR_ . $manufacturer['id_manufacturer'] . '-' . ImageType::getFormatedName('medium') . '.jpg')) {
             $manufacturer['image'] = $manufacturer['id_manufacturer'];
         }
     }
     $setting['manufacturers'] = $manufacturers;
     $list_mode_tpl = _PS_MODULE_DIR_ . '/pspagebuilder/views/templates/front/widgets/sub/item_manufacturer_' . $setting['list_mode'] . '.tpl';
     $tlist_mode_tpl = _PS_ALL_THEMES_DIR_ . _THEME_NAME_ . '/modules/pspagebuilder/views/templates/front/widgets/sub/item_manufacturer_' . $setting['list_mode'] . '.tpl';
     if (file_exists($tlist_mode_tpl)) {
         $list_mode_tpl = $tlist_mode_tpl;
     }
     $setting['list_mode_tpl'] = $list_mode_tpl;
     $output = array('type' => 'manufacturer', 'data' => $setting);
     return $output;
 }
コード例 #13
0
 public function renderContent($args, $setting)
 {
     $t = array('name' => '', 'html' => '');
     $setting = array_merge($t, $setting);
     $items_page = $setting['itemspage'] ? (int) $setting['itemspage'] : 3;
     $columns_page = $setting['columns'] ? (int) $setting['columns'] : 3;
     $items_tab = $setting['itemstab'] ? (int) $setting['itemstab'] : 6;
     $interval = isset($setting['interval']) ? (int) $setting['interval'] : 8000;
     $image_type = $setting['image'] ? $setting['image'] : 'small_' . 'default';
     $data = Manufacturer::getManufacturers(true, Context::getContext()->language->id, true, false, $items_tab, false);
     foreach ($data as &$item) {
         $id_images = !file_exists(_PS_MANU_IMG_DIR_ . '/' . $item['id_manufacturer'] . '-' . $image_type . '.jpg') ? Language::getIsoById(Context::getContext()->language->id) . '-default' : $item['id_manufacturer'];
         $item['image'] = _THEME_MANU_DIR_ . $id_images . '-' . $image_type . '.jpg';
     }
     $setting['manufacturers'] = $data;
     $setting['itemsperpage'] = $items_page;
     $setting['columnspage'] = $columns_page;
     $setting['scolumn'] = 12 / $columns_page;
     $setting['interval'] = $interval;
     $setting['tab'] = 'leomanulogocarousel' . rand(20, rand());
     $output = array('type' => 'manucarousel', 'data' => $setting);
     return $output;
 }
    public function getContent()
    {
        $id_lang = (int) Context::getContext()->language->id;
        $languages = $this->context->controller->getLanguages();
        $default_language = (int) Configuration::get('PS_LANG_DEFAULT');
        $labels = Tools::getValue('label') ? array_filter(Tools::getValue('label'), 'strlen') : array();
        $links_label = Tools::getValue('link') ? array_filter(Tools::getValue('link'), 'strlen') : array();
        $spacer = str_repeat('&nbsp;', $this->spacer_size);
        $divLangName = 'link_label';
        $update_cache = false;
        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_HOME', (bool) Tools::getValue('home'));
            $update_cache = true;
        } else {
            if (Tools::isSubmit('submitBlocktopmenuLinks')) {
                if (!count($links_label) && !count($labels)) {
                } else {
                    if (!count($links_label)) {
                        $this->_html .= $this->displayError($this->l('Please, fill the "Link" field'));
                    } else {
                        if (!count($labels)) {
                            $this->_html .= $this->displayError($this->l('Please add a label'));
                        } else {
                            if (!isset($labels[$default_language])) {
                                $this->_html .= $this->displayError($this->l('Please add a label for your default language'));
                            } else {
                                MenuTopLinks_mod::add(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0), (int) Shop::getContextShopID());
                                $this->_html .= $this->displayConfirmation($this->l('The link has been added'));
                            }
                        }
                    }
                }
                $update_cache = true;
            } else {
                if (Tools::isSubmit('submitBlocktopmenuRemove')) {
                    $id_linksmenutop = Tools::getValue('id_linksmenutop', 0);
                    MenuTopLinks_mod::remove($id_linksmenutop, (int) Shop::getContextShopID());
                    Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', str_replace(array('LNK' . $id_linksmenutop . ',', 'LNK' . $id_linksmenutop), '', Configuration::get('MOD_BLOCKTOPMENU_ITEMS')));
                    $this->_html .= $this->displayConfirmation($this->l('The link has been removed'));
                    $update_cache = true;
                } else {
                    if (Tools::isSubmit('submitBlocktopmenuEdit')) {
                        $id_linksmenutop = (int) Tools::getValue('id_linksmenutop', 0);
                        $id_shop = (int) Shop::getContextShopID();
                        if (!Tools::isSubmit('link')) {
                            $tmp = MenuTopLinks_mod::getLinkLang($id_linksmenutop, $id_shop);
                            $links_label_edit = $tmp['link'];
                            $labels_edit = $tmp['label'];
                            $new_window_edit = $tmp['new_window'];
                        } else {
                            MenuTopLinks_mod::update(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0), (int) $id_shop, (int) $id_linksmenutop, (int) $id_linksmenutop);
                            $this->_html .= $this->displayConfirmation($this->l('The link has been edited'));
                        }
                        $update_cache = true;
                    }
                }
            }
        }
        if ($update_cache) {
            $this->clearMenuCache();
        }
        $this->_html .= '
        <fieldset>
            <div class="multishop_info">
            ' . $this->l('The modifications will be applied to') . ' ' . (Shop::getContext() == Shop::CONTEXT_SHOP ? $this->l('shop:') . ' ' . $this->context->shop->name : $this->l('all shops')) . '.
            </div>
            <legend><img src="' . $this->_path . 'logo.gif" alt="" title="" />' . $this->l('Settings') . '</legend>
            <form action="' . Tools::safeOutput($_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="' . Tools::safeOutput(Configuration::get('MOD_BLOCKTOPMENU_ITEMS')) . '" size="70" />
                </div>
                </div>

                <div class="clear">&nbsp;</div>
                <table style="margin-left: 130px;">
                    <tbody>
                        <tr>
                            <td style="padding-left: 20px;">
                                <select multiple="multiple" id="availableItems" style="width: 300px; height: 160px;">';
        // BEGIN CMS
        $this->_html .= '<optgroup label="' . $this->l('CMS') . '">';
        $this->getCMSOptions(0, 1, $id_lang);
        $this->_html .= '</optgroup>';
        // BEGIN SUPPLIER
        $this->_html .= '<optgroup label="' . $this->l('Supplier') . '">';
        $suppliers = Supplier::getSuppliers(false, $id_lang);
        foreach ($suppliers as $supplier) {
            $this->_html .= '<option value="SUP' . $supplier['id_supplier'] . '">' . $spacer . $supplier['name'] . '</option>';
        }
        $this->_html .= '</optgroup>';
        // BEGIN Manufacturer
        $this->_html .= '<optgroup label="' . $this->l('Manufacturer') . '">';
        $manufacturers = Manufacturer::getManufacturers(false, $id_lang);
        foreach ($manufacturers as $manufacturer) {
            $this->_html .= '<option value="MAN' . $manufacturer['id_manufacturer'] . '">' . $spacer . $manufacturer['name'] . '</option>';
        }
        $this->_html .= '</optgroup>';
        // BEGIN Categories
        $this->_html .= '<optgroup label="' . $this->l('Categories') . '">';
        $this->getCategoryOption(1, (int) $id_lang, (int) Shop::getContextShopID());
        $this->_html .= '</optgroup>';
        // BEGIN Shops
        if (Shop::isFeatureActive()) {
            $this->_html .= '<optgroup label="' . $this->l('Shops') . '">';
            $shops = Shop::getShopsCollection();
            foreach ($shops as $shop) {
                if (!$shop->setUrl() && !$shop->getBaseURL()) {
                    continue;
                }
                $this->_html .= '<option value="SHOP' . (int) $shop->id . '">' . $spacer . $shop->name . '</option>';
            }
            $this->_html .= '</optgroup>';
        }
        // BEGIN Products
        $this->_html .= '<optgroup label="' . $this->l('Products') . '">';
        $this->_html .= '<option value="PRODUCT" style="font-style:italic">' . $spacer . $this->l('Choose ID product') . '</option>';
        $this->_html .= '</optgroup>';
        // BEGIN Menu Top Links
        $this->_html .= '<optgroup label="' . $this->l('Menu Top Links') . '">';
        $links = MenuTopLinks_mod::gets($id_lang, null, (int) Shop::getContextShopID());
        foreach ($links as $link) {
            if ($link['label'] == '') {
                $link = MenuTopLinks_mod::get($link['id_linksmenutop'], $default_language, (int) Shop::getContextShopID());
                $this->_html .= '<option value="LNK' . (int) $link[0]['id_linksmenutop'] . '">' . $spacer . $link[0]['label'] . '</option>';
            } else {
                $this->_html .= '<option value="LNK' . (int) $link['id_linksmenutop'] . '">' . $spacer . $link['label'] . '</option>';
            }
        }
        $this->_html .= '</optgroup>';
        $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') . ' &gt;&gt;</a>
                            </td>
                            <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);">&lt;&lt; ' . $this->l('Remove') . '</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <div class="clear">&nbsp;</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();
                            text = text.replace(/(^\\s*)|(\\s*$)/gi,"");
                            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('Home Item') . '</label>
                <div class="margin-form">
                    <input type="checkbox" name="home" id="s" value="1"' . (Configuration::get('MOD_BLOCKTOPMENU_HOME') ? ' checked=""' : '') . '/>
                </div>
                <p class="center">
                    <input type="submit" name="submitBlocktopmenu" value="' . $this->l('	Save	') . '" class="button" />
                </p>
            </form>
        </fieldset><br />';
        $this->_html .= '
        <fieldset>
            <legend><img src="../img/admin/add.gif" alt="" title="" />' . $this->l('Add Menu Top Link') . '</legend>
            <form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" id="form">

                ';
        foreach ($languages as $language) {
            $this->_html .= '
                    <div id="link_label_' . (int) $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $id_lang ? 'block' : 'none') . ';">
                <label>' . $this->l('Label') . '</label>
                <div class="margin-form">
                        <input type="text" name="label[' . (int) $language['id_lang'] . ']" id="label_' . (int) $language['id_lang'] . '" size="70" value="' . (isset($labels_edit[$language['id_lang']]) ? Tools::safeOutput($labels_edit[$language['id_lang']]) : '') . '" />
              </div>
                    ';
            $this->_html .= '
                  <label>' . $this->l('Link') . '</label>
                <div class="margin-form">
                    <input type="text" name="link[' . (int) $language['id_lang'] . ']" id="link_' . (int) $language['id_lang'] . '" value="' . (isset($links_label_edit[$language['id_lang']]) ? Tools::safeOutput($links_label_edit[$language['id_lang']]) : '') . '" size="70" />
                </div>
                </div>';
        }
        $this->_html .= '<label>' . $this->l('Language') . '</label>
                <div class="margin-form">' . $this->displayFlags($languages, (int) $id_lang, $divLangName, 'link_label', true) . '</div><p style="clear: both;"> </p>';
        $this->_html .= '<label style="clear: both;">' . $this->l('New Window') . '</label>
                <div class="margin-form">
                    <input style="clear: both;" type="checkbox" name="new_window" value="1" ' . (isset($new_window_edit) && $new_window_edit ? 'checked' : '') . '/>
                </div>
<div class="margin-form">';
        if (Tools::isSubmit('id_linksmenutop')) {
            $this->_html .= '<input type="hidden" name="id_linksmenutop" value="' . (int) Tools::getValue('id_linksmenutop') . '" />';
        }
        if (Tools::isSubmit('submitBlocktopmenuEdit')) {
            $this->_html .= '<input type="submit" name="submitBlocktopmenuEdit" value="' . $this->l('Edit') . '" class="button" />';
        }
        $this->_html .= '
                    <input type="submit" name="submitBlocktopmenuLinks" value="' . $this->l('	Add	') . '" class="button" />
</div>

            </form>
        </fieldset><br />';
        $links = MenuTopLinks_mod::gets((int) $id_lang, null, (int) Shop::getContextShopID());
        if (!count($links)) {
            return $this->_html;
        }
        $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 style="text-align: left;">
                        <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>';
        foreach ($links as $link) {
            $this->_html .= '
                    <tr>
                        <td>' . (int) $link['id_linksmenutop'] . '</td>
                        <td>' . Tools::safeOutput($link['label']) . '</td>
                        <td><a href="' . Tools::safeOutput($link['link']) . '"' . ($link['new_window'] ? ' target="_blank"' : '') . '>' . Tools::safeOutput($link['link']) . '</a></td>
                        <td>' . ($link['new_window'] ? $this->l('Yes') : $this->l('No')) . '</td>
                        <td>
                            <form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">
                                <input type="hidden" name="id_linksmenutop" value="' . (int) $link['id_linksmenutop'] . '" />
                                <input type="submit" name="submitBlocktopmenuEdit" value="' . $this->l('Edit') . '" class="button" />
                                <input type="submit" name="submitBlocktopmenuRemove" value="' . $this->l('Remove') . '" class="button" />
                            </form>
                        </td>
                    </tr>';
        }
        $this->_html .= '</tbody>
            </table>
        </fieldset>';
        return $this->_html;
    }
コード例 #15
0
 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';
 }
コード例 #16
0
 function hookLeftColumn($params)
 {
     global $smarty, $link;
     $smarty->assign(array('manufacturers' => Manufacturer::getManufacturers(), 'link' => $link, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), 'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS')));
     return $this->display(__FILE__, 'blockmanufacturer.tpl');
 }
コード例 #17
0
    /**
     * 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;
    }
コード例 #18
0
 public function ajaxProcessProductManufacturers()
 {
     $manufacturers = Manufacturer::getManufacturers(false, 0, true, false, false, false, true);
     $jsonArray = array();
     if ($manufacturers) {
         foreach ($manufacturers as $manufacturer) {
             $jsonArray[] = '{"optionValue": "' . (int) $manufacturer['id_manufacturer'] . '", "optionDisplay": "' . htmlspecialchars(trim($manufacturer['name'])) . '"}';
         }
     }
     die('[' . implode(',', $jsonArray) . ']');
 }
 public function renderFormAddress()
 {
     // Change table and className for addresses
     $this->table = 'address';
     $this->className = 'Address';
     $id_address = Tools::getValue('id_address');
     // Create Object Address
     $address = new Address($id_address);
     $res = $address->getFieldsRequiredDatabase();
     $required_fields = array();
     foreach ($res as $row) {
         $required_fields[(int) $row['id_required_field']] = $row['field_name'];
     }
     $form = array('legend' => array('title' => $this->l('Addresses'), 'icon' => 'icon-building'));
     if (!$address->id_manufacturer || !Manufacturer::manufacturerExists($address->id_manufacturer)) {
         $form['input'][] = array('type' => 'select', 'label' => $this->l('Choose the manufacturer'), 'name' => 'id_manufacturer', 'options' => array('query' => Manufacturer::getManufacturers(), 'id' => 'id_manufacturer', 'name' => 'name'));
     } else {
         $form['input'][] = array('type' => 'text', 'label' => $this->l('Manufacturer'), 'name' => 'name', 'col' => 4, 'disabled' => true);
         $form['input'][] = array('type' => 'hidden', 'name' => 'id_manufacturer');
     }
     $form['input'][] = array('type' => 'hidden', 'name' => 'alias');
     $form['input'][] = array('type' => 'hidden', 'name' => 'id_address');
     if (in_array('company', $required_fields)) {
         $form['input'][] = array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'company', 'display' => in_array('company', $required_fields), 'required' => in_array('company', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Company name for this supplier'));
     }
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Last name'), 'name' => 'lastname', 'required' => true, 'col' => 4, 'hint' => $this->l('Invalid characters:') . ' 0-9!&lt;&gt;,;?=+()@#"�{}_$%:');
     $form['input'][] = array('type' => 'text', 'label' => $this->l('First name'), 'name' => 'firstname', 'required' => true, 'col' => 4, 'hint' => $this->l('Invalid characters:') . ' 0-9!&lt;&gt;,;?=+()@#"�{}_$%:');
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address1', 'col' => 6, 'required' => true);
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Address (2)'), 'name' => 'address2', 'col' => 6, 'required' => in_array('address2', $required_fields));
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Zip/postal code'), 'name' => 'postcode', 'col' => 2, 'required' => in_array('postcode', $required_fields));
     $form['input'][] = array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'col' => 4, 'required' => true);
     $form['input'][] = array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => false, 'default_value' => (int) $this->context->country->id, 'col' => 4, 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name'));
     $form['input'][] = array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'required' => false, 'col' => 4, 'options' => array('query' => array(), 'id' => 'id_state', 'name' => 'name'));
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Home phone'), 'name' => 'phone', 'col' => 4, 'required' => in_array('phone', $required_fields));
     $form['input'][] = array('type' => 'text', 'label' => $this->l('Mobile phone'), 'name' => 'phone_mobile', 'col' => 4, 'required' => in_array('phone_mobile', $required_fields));
     $form['input'][] = array('type' => 'textarea', 'label' => $this->l('Other'), 'name' => 'other', 'required' => false, 'hint' => $this->l('Forbidden characters:') . ' &lt;&gt;;=#{}', 'rows' => 2, 'cols' => 10, 'col' => 6);
     $form['submit'] = array('title' => $this->l('Save'));
     $this->fields_value = array('name' => Manufacturer::getNameById($address->id_manufacturer), 'alias' => 'manufacturer', 'id_country' => $address->id_country);
     $this->initToolbar();
     $this->fields_form[0]['form'] = $form;
     $this->getlanguages();
     $helper = new HelperForm();
     $helper->show_cancel_button = true;
     $back = Tools::safeOutput(Tools::getValue('back', ''));
     if (empty($back)) {
         $back = self::$currentIndex . '&token=' . $this->token;
     }
     if (!Validate::isCleanHtml($back)) {
         die(Tools::displayError());
     }
     $helper->back_url = $back;
     $helper->currentIndex = self::$currentIndex;
     $helper->token = $this->token;
     $helper->table = $this->table;
     $helper->identifier = $this->identifier;
     $helper->title = $this->l('Edit Addresses');
     $helper->id = $address->id;
     $helper->toolbar_scroll = true;
     $helper->languages = $this->_languages;
     $helper->default_form_language = $this->default_form_language;
     $helper->allow_employee_form_lang = $this->allow_employee_form_lang;
     $helper->fields_value = $this->getFieldsValue($address);
     $helper->toolbar_btn = $this->toolbar_btn;
     $this->content .= $helper->generateForm($this->fields_form);
 }
コード例 #20
0
 public function ajaxProcessProductManufacturers()
 {
     $manufacturers = Manufacturer::getManufacturers(false, 0, true, false, false, false, true);
     $jsonArray = array();
     if ($manufacturers) {
         foreach ($manufacturers as $manufacturer) {
             $tmp = array("optionValue" => $manufacturer['id_manufacturer'], "optionDisplay" => htmlspecialchars(trim($manufacturer['name'])));
             $jsonArray[] = Tools::jsonEncode($tmp);
         }
     }
     die('[' . implode(',', $jsonArray) . ']');
 }
コード例 #21
0
 protected function generateManufacturerData()
 {
     $delimiter = ';';
     $line = array();
     $titles = array();
     $id_lang = $this->use_lang;
     $new_path = new Sampledatainstall();
     $f = fopen($new_path->sendPath() . 'output/manufacturers.vsc', 'w');
     foreach ($this->manufacturers_fields as $field => $array) {
         $titles[] = $array['label'];
     }
     fputcsv($f, $titles, $delimiter, '"');
     $manufacturers = Manufacturer::getManufacturers(false, $id_lang, true);
     foreach ($manufacturers as $manufacturer) {
         $m = new Manufacturer($manufacturer['id_manufacturer'], $id_lang);
         foreach ($this->manufacturers_fields as $field => $array) {
             $line[$field] = property_exists('Manufacturer', $field) && !is_array($m->{$field}) && !Tools::isEmpty($m->{$field}) ? $m->{$field} : '';
             if (file_exists(_PS_MANU_IMG_DIR_ . $m->id . '.jpg')) {
                 $this->copyConverFileName(_PS_MANU_IMG_DIR_ . $m->id . '.jpg');
             }
         }
         if (!$line[$field]) {
             $line[$field] = '';
         }
         fputcsv($f, $line, $delimiter, '"');
     }
     fclose($f);
 }
コード例 #22
0
ファイル: popup.php プロジェクト: WhisperingTree/etagerca
							<?php 
        }
    }
    ?>
						</select>
					</div>
				</div>
				<div class="link_type link_type_manufacturer">
					<label><?php 
    echo $module->l('Manufacturer:');
    ?>
</label>
					<div class="margin-form">
						<select name="link_type_manufacturer">
						<?php 
    $manufacturers = Manufacturer::getManufacturers(false, $id_lang, true);
    if ($cates) {
        foreach ($manufacturers as $c) {
            ?>
								<option value="<?php 
            echo $c['id_manufacturer'];
            ?>
"<?php 
            echo $obj->linktype == 'manufacturer' && $c['id_manufacturer'] == $obj->link_content ? 'selected=selected' : '';
            ?>
><?php 
            echo $c['name'];
            ?>
</option>
							<?php 
        }
コード例 #23
0
ファイル: blocktopmenu.php プロジェクト: greench/prestashop
    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">&nbsp;</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') . ' &gt;&gt;</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);">&lt;&lt; ' . $this->l('Add') . '</a>			
              </td>
            </tr>
          </tbody>
        </table>
        <div class="clear">&nbsp;</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;
    }
コード例 #24
0
ファイル: ajax.php プロジェクト: priyankajsr19/indusdiva2
    }
    fclose($fd);
    if (!Tools::ZipExtract($file, _PS_MODULE_DIR_)) {
        unlink($file);
        die(displayJavascriptAlert('Cannot unzip file'));
    }
    unlink($file);
    die(displayJavascriptAlert('Module copied to disk'));
}
function displayJavascriptAlert($s)
{
    echo '<script type="text/javascript">alert(\'' . addslashes($s) . '\');</script>';
}
if (isset($_GET['ajaxProductManufacturers'])) {
    $currentIndex = 'index.php?tab=AdminCatalog';
    $manufacturers = Manufacturer::getManufacturers();
    if ($manufacturers) {
        $jsonArray = array();
        foreach ($manufacturers as $manufacturer) {
            $jsonArray[] = '{"optionValue": "' . $manufacturer['id_manufacturer'] . '", "optionDisplay": "' . htmlspecialchars($manufacturer['name']) . '"}';
        }
        die('[' . implode(',', $jsonArray) . ']');
    }
}
if (isset($_GET['ajaxReferrers'])) {
    require 'tabs/AdminReferrers.php';
}
if (isset($_GET['ajaxProductSuppliers'])) {
    $currentIndex = 'index.php?tab=AdminCatalog';
    $suppliers = Supplier::getSuppliers();
    if ($suppliers) {
コード例 #25
0
ファイル: advancefooter.php プロジェクト: abdoumej/libsamy
 private function getManufacturerOption($selected_id = null)
 {
     $html = '';
     $manufacturers = Manufacturer::getManufacturers(false, $this->context->language->id);
     foreach ($manufacturers as $manufacturer) {
         $html .= '<option value="' . $manufacturer['id_manufacturer'] . '"' . (!is_null($selected_id) && $selected_id == $manufacturer['id_manufacturer'] ? 'selected = "selected"' : '') . '>' . $manufacturer['name'] . '</option>';
     }
     return $html;
 }
コード例 #26
0
ファイル: tdmegamenu.php プロジェクト: reshman/swkart-presta
    private function _tdAdminOptionDesign()
    {
        global $cookie;
        $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
        $languages = Language::getLanguages(false);
        $iso = Language::getIsoById((int) $cookie->id_lang);
        $id_lang = Context::getContext()->language->id;
        $divLangName = 'title¤description¤link';
        $this->_html .= '<fieldset>
      		<legend><img src="../img/admin/add.gif" alt="" title="" />' . $this->l('Add Menu Links') . '</legend>
      			<form action="index.php?tab=AdminModules&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules') . '&tab_module=front_office_features&module_name=' . $this->name . '" method="post" id="form">
                        <label>' . $this->l('Links type') . '</label>
                        <div class="from-block">
                        <select id="selected_menu_type" name="menu_type">
                            <option value="selmenutype">' . $this->l('Select Menu type') . ' </option>
                            <option value="cat">' . $this->l('Categories') . '</option>
                            <option value="cms">' . $this->l('CMS') . '</option>
                            <option value="manu">' . $this->l('Manufacturer') . '</option>
                            <option value="sup">' . $this->l('Supplier') . '</option>
                            <option value="custom">' . $this->l('Custom Options') . '</option>';
        $this->_html .= '</select>
             
                        </div>
                        <div id="category_block">
                        <label>' . $this->l('Categories') . '</label>
                        <div class="from-block">
                        <select id="cat_id" name="cat_id">
                            <option value="sel_cat">' . $this->l('Select Category Links') . '</option>';
        $this->_html .= $this->getCategoryOption();
        $this->_html .= '</select>
                        </div>
                        </div>
                         <div id="cms-block">
                        <label>' . $this->l('CMS') . '</label>
                        <div class="from-block">
                        <select id="cms_id" name="cms_id">
                        <option value="selcms"> ' . $this->l('Select CMS Links') . '</option>';
        $this->_html .= $this->getCMSOptions();
        $this->_html .= '</select>
                        </div>
                        </div>
                       <div id="menuf-block">
                        <label>' . $this->l('Manufacturer') . '</label>
                        <div class="from-block">
                        <select id="manufac_id" name="manufac_id">
                            <option value="selmanuf">' . $this->l('Select Manufacturer Links') . '</option>';
        $manufacturers = Manufacturer::getManufacturers(false, $id_lang);
        foreach ($manufacturers as $manufacturer) {
            $this->_html .= '<option value="MAN' . $manufacturer['id_manufacturer'] . '">' . ' ' . $manufacturer['name'] . '</option>';
        }
        $this->_html .= '</select>
                        </div>
                        </div>
                        <div id="supplier-block">
                        <label>' . $this->l('Supplier') . '</label>
                        <div class="from-block">
                        <select id="sup_id" name="sup_id">
                            <option value="selsup">' . $this->l('Select Supplier Links') . '</option>';
        $suppliers = Supplier::getSuppliers(false, $id_lang);
        foreach ($suppliers as $supplier) {
            $this->_html .= '<option value="SUP' . $supplier['id_supplier'] . '">' . ' ' . $supplier['name'] . '</option>';
        }
        $this->_html .= '</select>
                        </div>
                        </div>
                        <div id="custom-box">
                        <label>' . $this->l('Custom Links') . '</label>
                        <div class="from-block">
                        <select id="custom-block-section" name="custom-block-section">
                            <option value="customtype">' . $this->l('Select Custom type') . '</option>
                            <option value="cus_links">' . $this->l('Custom Link') . '</option>
                            <option value="cus_html">' . $this->l('Custom HTML Block') . '</option>';
        $this->_html .= '</select>
                        </div>
                        </div>
                    <div id="menu_links_block">
            
  			<label>' . $this->l('Title') . '</label>
        			<div class="from-block">';
        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'] . '" id="title_' . $language['id_lang'] . '" size="66" /></div>';
        }
        $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'title', true);
        $this->_html .= '</div></div><p class="clear"> </p>
             <div id="custom_links_block">
  			<label>' . $this->l('Link') . '</label>
  			<div class="from-block">';
        foreach ($languages as $language) {
            $this->_html .= '<div id="link_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . ';float: left;">' . '<input id="link_' . $language['id_lang'] . '"  type="text" name="link_' . $language['id_lang'] . '" size="66" /></div>';
        }
        $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'link', true);
        $this->_html .= '</div>
             </div>

<div id="description">
            <label>' . $this->l('Custom HTML Block') . '</label>
        			<div class="from-block">';
        foreach ($languages as $language) {
            $this->_html .= '
		<div id="description_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . ';float: left;">
                <textarea  name="description_' . $language['id_lang'] . '" id="description_' . $language['id_lang'] . '" rows="5" cols="63" >';
            $this->_html .= '</textarea>
        </div>
       ';
        }
        $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'description', true);
        $this->_html .= '</div> </div>';
        $this->_html .= '<p class="clear"> </p>
			<label>' . $this->l('Parent') . '</label>
  			<div class="from-block">
				<select name="parent">
					<option value="0">' . $this->l('Root') . '</option>';
        $this->_html .= $this->displayParentMenu();
        $this->_html .= '</select>
  			</div>';
        $this->_html .= '<label>' . $this->l('Menu Order') . '</label>
  			<div class="from-block">
                            <input type="text" name="order" />
  			</div>';
        $this->_html .= '<input type="submit" name="submitMenuLinks"  class="button"  value="' . $this->l('  Add Links  ') . '" />';
        $this->_html .= '</form>
    </fieldset><br />';
        return $this->_html;
    }
コード例 #27
0
 public function renderChoicesSelect()
 {
     $spacer = str_repeat('&nbsp;', $this->spacer_size);
     $items = $this->getMenuItems();
     $html = '<select multiple="multiple" id="availableItems" style="width: 300px; height: 160px;">';
     $html .= '<optgroup label="' . $this->l('CMS') . '">';
     $html .= $this->getCMSOptions(0, 1, $this->context->language->id, $items);
     $html .= '</optgroup>';
     // BEGIN SUPPLIER
     $html .= '<optgroup label="' . $this->l('Supplier') . '">';
     // Option to show all Suppliers
     $html .= '<option value="ALLSUP0">' . $this->l('All suppliers') . '</option>';
     $suppliers = Supplier::getSuppliers(false, $this->context->language->id);
     foreach ($suppliers as $supplier) {
         if (!in_array('SUP' . $supplier['id_supplier'], $items)) {
             $html .= '<option value="SUP' . $supplier['id_supplier'] . '">' . $spacer . $supplier['name'] . '</option>';
         }
     }
     $html .= '</optgroup>';
     // BEGIN Manufacturer
     $html .= '<optgroup label="' . $this->l('Manufacturer') . '">';
     // Option to show all Manufacturers
     $html .= '<option value="ALLMAN0">' . $this->l('All manufacturers') . '</option>';
     $manufacturers = Manufacturer::getManufacturers(false, $this->context->language->id);
     foreach ($manufacturers as $manufacturer) {
         if (!in_array('MAN' . $manufacturer['id_manufacturer'], $items)) {
             $html .= '<option value="MAN' . $manufacturer['id_manufacturer'] . '">' . $spacer . $manufacturer['name'] . '</option>';
         }
     }
     $html .= '</optgroup>';
     // BEGIN Categories
     $shop = new Shop((int) Shop::getContextShopID());
     $html .= '<optgroup label="' . $this->l('Categories') . '">';
     $shops_to_get = Shop::getContextListShopID();
     foreach ($shops_to_get as $shop_id) {
         $html .= $this->generateCategoriesOption($this->customGetNestedCategories($shop_id, null, (int) $this->context->language->id, false), $items);
     }
     $html .= '</optgroup>';
     // BEGIN Shops
     if (Shop::isFeatureActive()) {
         $html .= '<optgroup label="' . $this->l('Shops') . '">';
         $shops = Shop::getShopsCollection();
         foreach ($shops as $shop) {
             if (!$shop->setUrl() && !$shop->getBaseURL()) {
                 continue;
             }
             if (!in_array('SHOP' . (int) $shop->id, $items)) {
                 $html .= '<option value="SHOP' . (int) $shop->id . '">' . $spacer . $shop->name . '</option>';
             }
         }
         $html .= '</optgroup>';
     }
     // BEGIN Products
     $html .= '<optgroup label="' . $this->l('Products') . '">';
     $html .= '<option value="PRODUCT" style="font-style:italic">' . $spacer . $this->l('Choose product ID') . '</option>';
     $html .= '</optgroup>';
     // BEGIN Menu Top Links
     $html .= '<optgroup label="' . $this->l('Menu Top Links') . '">';
     $links = MenuTopLinks::gets($this->context->language->id, null, (int) Shop::getContextShopID());
     foreach ($links as $link) {
         if ($link['label'] == '') {
             $default_language = Configuration::get('PS_LANG_DEFAULT');
             $link = MenuTopLinks::get($link['id_linksmenutop'], $default_language, (int) Shop::getContextShopID());
             if (!in_array('LNK' . (int) $link[0]['id_linksmenutop'], $items)) {
                 $html .= '<option value="LNK' . (int) $link[0]['id_linksmenutop'] . '">' . $spacer . Tools::safeOutput($link[0]['label']) . '</option>';
             }
         } elseif (!in_array('LNK' . (int) $link['id_linksmenutop'], $items)) {
             $html .= '<option value="LNK' . (int) $link['id_linksmenutop'] . '">' . $spacer . Tools::safeOutput($link['label']) . '</option>';
         }
     }
     $html .= '</optgroup>';
     $html .= '</select>';
     return $html;
 }
コード例 #28
0
ファイル: advancetopmenu.php プロジェクト: abdoumej/libsamy
 private function getAllDefaultLink($id_lang = null, $link = false)
 {
     if (is_null($id_lang)) {
         $id_lang = (int) $this->context->language->id;
     }
     $html = '<optgroup label="' . $this->l('Category') . '">';
     $html .= $this->getCategoryOption(1, $id_lang, false, true, $link);
     $html .= '</optgroup>';
     //CMS option
     $html .= '<optgroup label="' . $this->l('Cms') . '">';
     $html .= $this->getCMSOptions(0, 0, $id_lang, $link);
     $html .= '</optgroup>';
     //Manufacturer option
     $html .= '<optgroup label="' . $this->l('Manufacturer') . '">';
     $manufacturers = Manufacturer::getManufacturers(false, $id_lang);
     foreach ($manufacturers as $manufacturer) {
         if ($link) {
             $html .= '<option value="' . $this->context->link->getManufacturerLink($manufacturer['id_manufacturer']) . '">' . $manufacturer['name'] . '</option>';
         } else {
             $html .= '<option value="MAN' . (int) $manufacturer['id_manufacturer'] . '">' . $manufacturer['name'] . '</option>';
         }
     }
     $html .= '</optgroup>';
     //Supplier option
     $html .= '<optgroup label="' . $this->l('Supplier') . '">';
     $suppliers = Supplier::getSuppliers(false, $id_lang);
     foreach ($suppliers as $supplier) {
         if ($link) {
             $html .= '<option value="' . $this->context->link->getSupplierLink($supplier['id_supplier']) . '">' . $supplier['name'] . '</option>';
         } else {
             $html .= '<option value="SUP' . (int) $supplier['id_supplier'] . '">' . $supplier['name'] . '</option>';
         }
     }
     $html .= '</optgroup>';
     //Page option
     $html .= '<optgroup label="' . $this->l('Page') . '">';
     $html .= $this->getPagesOption($id_lang, $link);
     $shoplink = Shop::getShops();
     if (count($shoplink) > 1) {
         $html .= '<optgroup label="' . $this->l('Shops') . '">';
         foreach ($shoplink as $sh) {
             $html .= '<option value="SHO' . (int) $sh['id_shop'] . '">' . $sh['name'] . '</option>';
         }
     }
     $html .= '</optgroup>';
     return $html;
 }
コード例 #29
0
 public function processHook()
 {
     if (!$this->isCached('ecomblockmanufacturer.tpl', $this->getCacheId())) {
         $this->site_url = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
         $manuf_page = $this->getConfigValue('page', 6);
         $manuf_cols = $this->getConfigValue('col', 3);
         $show_title = $this->getConfigValue('active_title', 1);
         $auto_play = $this->getConfigValue('active_play', 0);
         $image_types = $this->getConfigValue('type_img', 'pf_manufacturer');
         $interval = $this->getConfigValue('intv', 8000);
         if (!$auto_play) {
             $interval = 'false';
         }
         $manufacturers = Manufacturer::getManufacturers(false, $this->context->language->id, true);
         //echo '<pre>'.print_r($manufacturers,1);die;
         $id_manufacturers = array();
         foreach ($manufacturers as $m) {
             $id_manufacturers[] = $m['id_manufacturer'];
         }
         $manufs = array();
         foreach ($id_manufacturers as $id_manufacturer) {
             $manufacturer = new Manufacturer($id_manufacturer, $this->context->language->id);
             if (Validate::isLoadedObject($manufacturer)) {
                 $manufs[$id_manufacturer]['link'] = $this->context->link->getManufacturerLink($id_manufacturer, $manufacturer->link_rewrite, $this->context->language->id);
                 $manufs[$id_manufacturer]['id_manufacturer'] = $id_manufacturer;
                 $manufs[$id_manufacturer]['name'] = $manufacturer->name;
                 $manufs[$id_manufacturer]['linkIMG'] = $id_manufacturer . '-' . $image_types . '.jpg';
             }
         }
         $this->smarty->assign(array('manuf_page' => $manuf_page, 'manuf_cols' => $manuf_cols, 'scolumn' => 12 / $manuf_cols, 'show_title' => $show_title, 'auto_play' => $auto_play, 'ecommanufacturers' => $manufs, 'interval' => $interval));
     }
     return $this->display(__FILE__, 'ecomblockmanufacturer.tpl', $this->getCacheId());
 }
コード例 #30
0
ファイル: megaboxs.php プロジェクト: zangles/lennyba
 protected function generateAllLinkOptions($selected = '')
 {
     $suppliers = Supplier::getSuppliers(false, false);
     $manufacturers = Manufacturer::getManufacturers(false, false);
     $allLink = '';
     if ($selected == 'CUSTOMLINK|0') {
         $allLink .= '<option selected="selected" value="CUSTOMLINK|0">' . $this->l('-- Custom Link --') . '</option>';
     } else {
         $allLink .= '<option value="CUSTOMLINK|0">' . $this->l('-- Custom Link --') . '</option>';
     }
     $allLink .= '<optgroup label="' . $this->l('Category Link') . '">' . $this->generateCategoryLinkOption(0, $selected) . '</optgroup>';
     $allLink .= '<optgroup label="' . $this->l('CMS Link') . '">' . $this->generateCMSLinkOption(0, 1, false, $selected) . '</optgroup>';
     $allLink .= '<optgroup label="' . $this->l('Supplier Link') . '">';
     if ($selected == 'ALLSUP|0') {
         $allLink .= '<option selected="selected" value="ALLSUP|0">' . $this->l('All suppliers') . '</option>';
     } else {
         $allLink .= '<option value="ALLSUP|0">' . $this->l('All suppliers') . '</option>';
     }
     foreach ($suppliers as $supplier) {
         $key = 'SUP|' . $supplier['id_supplier'];
         if ($key == $selected) {
             $allLink .= '<option selected="selected" value="' . $key . '">|- ' . $supplier['name'] . '</option>';
         } else {
             $allLink .= '<option value="' . $key . '">|- ' . $supplier['name'] . '</option>';
         }
     }
     $allLink .= '</optgroup>';
     $allLink .= '<optgroup label="' . $this->l('Manufacturer Link') . '">';
     if ($selected == 'ALLMAN|0') {
         $allLink .= '<option selected="selected" value="ALLMAN|0">' . $this->l('All manufacturers') . '</option>';
     } else {
         $allLink .= '<option value="ALLMAN|0">' . $this->l('All manufacturers') . '</option>';
     }
     foreach ($manufacturers as $manufacturer) {
         $key = 'MAN|' . $manufacturer['id_manufacturer'];
         if ($key == $selected) {
             $allLink .= '<option selected="selected" value="' . $key . '">|- ' . $manufacturer['name'] . '</option>';
         } else {
             $allLink .= '<option value="' . $key . '">|- ' . $manufacturer['name'] . '</option>';
         }
     }
     $allLink .= '</optgroup>';
     $allLink .= '<optgroup label="' . $this->l('Page Link') . '">' . $this->generatePageLinkOption(0, $selected) . '</optgroup>';
     if (Shop::isFeatureActive()) {
         $allLink .= '<optgroup label="' . $this->l('Shops Link') . '">';
         $shops = Shop::getShopsCollection();
         foreach ($shops as $shop) {
             if (!$shop->setUrl() && !$shop->getBaseURL()) {
                 continue;
             }
             $key = 'SHO|' . $shop->id;
             if ($key == $selected) {
                 $allLink .= '<option selected="selected" value="' . $key . '">' . $shop->name . '</option>';
             } else {
                 $allLink .= '<option value="' . $key . '">' . $shop->name . '</option>';
             }
         }
         $allLink .= '</optgroup>';
     }
     $allLink .= '<optgroup label="' . $this->l('Product Link') . '">';
     if ($selected == 'PRODUCT|0') {
         $allLink .= '<option selected value="PRODUCT|0" style="font-style:italic">' . $this->l('Choose product ID') . '</option>';
     } else {
         $allLink .= '<option value="PRODUCT|0" style="font-style:italic">' . $this->l('Choose product ID') . '</option>';
     }
     $allLink .= '</optgroup>';
     return $allLink;
 }