Beispiel #1
1
 public function renderList()
 {
     $fields = array('city' => array('title' => $this->l('Город'), 'orderby' => false), 'mobile' => array('title' => $this->l('Мобильный'), 'orderby' => false, 'search' => false), 'phone' => array('title' => $this->l('Стационарный'), 'orderby' => false, 'search' => false));
     if (Tools::isSubmit('submitFilter')) {
         $filterCity = Tools::getValue('Filter_city');
         $list = DB::getInstance()->executeS("\n                select `c`.`id_city`, `cl`.`name` as `city`, `pc`.`mobile`, `pc`.`phone`\n                from `" . _DB_PREFIX_ . "city` as `c`\n                left join `" . _DB_PREFIX_ . "city_lang` as `cl` ON `cl`.`id_city` = `c`.`id_city`\n                left join `" . _DB_PREFIX_ . "phone_city` as `pc` ON `pc`.`id_city` = `c`.`id_city`\n                where `c`.`is_root` = 1 and `cl`.`id_lang` = {$this->context->language->id} AND `cl`.`name` LIKE '%{$filterCity}%'\n            ");
     } else {
         $list = DB::getInstance()->executeS("\n                select `c`.`id_city`, `cl`.`name` as `city`, `pc`.`mobile`, `pc`.`phone`\n                from `" . _DB_PREFIX_ . "city` as `c`\n                left join `" . _DB_PREFIX_ . "city_lang` as `cl` ON `cl`.`id_city` = `c`.`id_city`\n                left join `" . _DB_PREFIX_ . "phone_city` as `pc` ON `pc`.`id_city` = `c`.`id_city`\n                where `c`.`is_root` = 1 and `cl`.`id_lang` = {$this->context->language->id}\n            ");
     }
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = false;
     $helper->actions = array('edit');
     $helper->identifier = 'id_city';
     $helper->show_toolbar = false;
     $helper->title = $this->l('Телефоны по городам');
     $helper->table = '';
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     return $helper->generateList($list, $fields);
 }
 public function getContent()
 {
     if (Tools::isSubmit('updatePositions')) {
         $this->updatePositionsDnd();
     }
     $helper = new HelperList();
     // Obligatoire
     $helper->shopLinkType = '';
     // Obligatoire. Correspondant souvent à id_*
     $helper->identifier = 'id_example_data';
     // Permet de ne pas afficher le header complet.
     $helper->simple_header = true;
     //
     $helper->module = $this;
     // Important.
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     // Permet de définir le champ sur lequel est associé les positions.
     $helper->position_identifier = 'position';
     // Si utilisation des positions, obligatoire.
     $helper->orderBy = 'position';
     $helper->orderWay = 'ASC';
     // Permet de définir l'ID de la table. Le terme "module-" en préfixe est TRES important.
     $helper->table_id = 'module-helperlist_positions';
     // Ou encore
     $helper->table_id = 'module-' . $this->name;
     // Permet de récupérer les champs/headers de la liste. On passe par une méthode, par lisitibilité du code.
     $fields_list = $this->getListHeader();
     // Permet de récupérer les enregistrements/lignes de la liste. On passe par une méthode, par lisibilité du code.
     $values = $this->getListValues();
     return $helper->generateList($values, $fields_list);
 }
 public function displayEditLink($token = null, $id, $name = null)
 {
     $this->_helper_list->currentIndex = $this->_list_index;
     $this->_helper_list->identifier = $this->identifier;
     $this->_helper_list->table = $this->table;
     return $this->_helper_list->displayEditLink($this->_list_token, $id, $name);
 }
 /**
  * Listing ajax des produits
  */
 public function displayAjaxProductsList()
 {
     $filterCond = $this->_getProductFilterConditions();
     //Récupération des produits
     $products = Db::getInstance()->ExecuteS("SELECT p.id_product,p.reference, pl.name \n\t\t\t\t\t\t\tFROM ps_product p\n\t\t\t\t\t\t\tLEFT JOIN ps_product_lang pl ON ( p.id_product = pl.id_product AND pl.id_lang = " . $this->context->language->id . ")\n\t\t\t\t\t\t\t" . $filterCond);
     $fields_list = array('id_product' => array('title' => $this->l('id'), 'type' => 'text', 'width' => 50, 'class' => 'product_id product-link'), 'reference' => array('title' => $this->l('ref'), 'type' => 'text', 'width' => 100, 'class' => 'product-link'), 'name' => array('title' => $this->l('name'), 'type' => 'text', 'width' => 150, 'class' => 'product_name product-link'), 'add_link' => array('title' => $this->l('Add to cart link'), 'type' => 'text', 'width' => 150, 'class' => 'product-add-cart-link', 'search' => false));
     $productList = new HelperList();
     $productList->simple_header = false;
     $productList->identifier = 'id_product';
     $productList->title = 'Product List';
     $productList->table = $this->helper_list_name;
     $productList->shopLinkType = '';
     $productList->currentIndex = str_replace('index.php', '', $_SERVER['PHP_SELF']) . $this->context->link->getAdminLink('Wysiwyg&module=eicmslinks&action=ProductsList&ajax=1');
     $productList->token = $this->token;
     $productList->no_link = true;
     echo $productList->generateList($products, $fields_list);
 }
    public function renderList()
    {
        // Total recipients will be stored in $this->list_total
        // ----------------------------------------------------
        $recipients = $this->getRecipientsDB();
        // Count the duplicates
        // --------------------
        $request = 'SELECT SUM(duplic - 1)
					FROM
					(
						SELECT COUNT(target) as duplic
						FROM ' . _DB_PREFIX_ . 'expressmailing_fax_recipients
						WHERE campaign_id= ' . $this->campaign_id . '
						GROUP BY target
						HAVING COUNT(target) > 1
					) as dd';
        $this->duplicate_count = Db::getInstance()->getValue($request, false);
        // Panel 1 : CSV import
        // --------------------
        $this->fields_form = array('legend' => array('title' => $this->module->l('Contacts importation (step 3)', 'adminmarketingfstep3'), 'icon' => 'icon-beaker'), 'input' => array(array('type' => _PS_MODE_DEV_ ? 'text' : 'hidden', 'lang' => false, 'label' => 'Ref :', 'name' => 'campaign_id', 'col' => 1, 'readonly' => 'readonly'), array('type' => 'file', 'label' => $this->module->l('Import a csv file :', 'adminmarketingfstep3'), 'name' => 'csv_file', 'required' => true)), 'submit' => array('title' => $this->module->l('Start analysis ...', 'adminmarketingfstep3'), 'name' => 'importCsvStep3', 'icon' => 'process-icon-cogs'), 'buttons' => array(array('type' => 'submit', 'title' => $this->module->l('Clear selection', 'adminmarketingfstep3'), 'icon' => 'process-icon-delete', 'name' => 'clearRecipients', 'class' => 'pull-left'), array('type' => 'submit', 'title' => sprintf($this->module->l('Clear duplicates (%d)', 'adminmarketingfstep3'), $this->duplicate_count), 'icon' => 'process-icon-eraser', 'name' => 'clearDuplicate', 'class' => 'pull-left button-clear-duplicate')));
        $output = parent::renderForm();
        // Panel 2 : Recipients preview
        // ----------------------------
        $helper_list = new HelperList();
        $helper_list->no_link = true;
        $helper_list->shopLinkType = '';
        $helper_list->simple_header = true;
        $helper_list->identifier = 'ID';
        $helper_list->show_toolbar = false;
        $helper_list->table = 'expressmailing_fax_recipients';
        $helper_list->imageType = 'jpg';
        $fields_list = array('target' => array('title' => $this->module->l('Phone', 'adminmarketingfstep3'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_1' => array('title' => $this->module->l('Col_1', 'adminmarketingfstep3'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_2' => array('title' => $this->module->l('Col_2', 'adminmarketingfstep3'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_3' => array('title' => $this->module->l('Col_3', 'adminmarketingfstep3'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_4' => array('title' => $this->module->l('Col_4', 'adminmarketingfstep3'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_5' => array('title' => $this->module->l('Col_5', 'adminmarketingfstep3'), 'width' => 140, 'search' => false, 'type' => 'text'));
        $html_list = $helper_list->generateList($recipients, $fields_list);
        if (!preg_match('/<table.*<\\/table>/iUs', $html_list, $array_table)) {
            $output .= $html_list;
        }
        $this->fields_form = array('legend' => array('title' => $this->module->l('Recipients preview', 'adminmarketingfstep3') . '<span class="badge">' . $this->list_total . '</span>', 'icon' => 'icon-phone'), 'input' => array(array('type' => 'hidden', 'lang' => false, 'label' => 'Ref :', 'name' => 'campaign_id', 'col' => 1, 'readonly' => 'readonly'), array('type' => 'free', 'name' => 'html_list')), 'submit' => array('title' => $this->module->l('Validate this selection', 'adminmarketingfstep3'), 'name' => 'submitFaxStep3', 'icon' => 'process-icon-next'), 'buttons' => array(array('href' => 'index.php?controller=AdminMarketingFStep2&campaign_id=' . $this->campaign_id . '&token=' . Tools::getAdminTokenLite('AdminMarketingFStep2'), 'title' => $this->module->l('Back', 'adminmarketingfstep3'), 'icon' => 'process-icon-back')));
        $this->getFieldsValues();
        // Concatenate list and buttons
        // ----------------------------
        $html_boutons = parent::renderForm();
        $output .= preg_replace('/<div class="form-group">/', $array_table[0] . '<div class="form-group">', $html_boutons, 1);
        $footer = $this->getTemplatePath() . 'footer.tpl';
        $output .= $this->context->smarty->fetch($footer);
        return $output;
    }
Beispiel #6
0
 public function renderList()
 {
     $fields_list = array('id' => array('title' => $this->l('Link ID'), 'type' => 'text'), 'shop_name' => array('title' => $this->l('Shop'), 'type' => 'text'), 'city_name' => array('title' => $this->l('City'), 'type' => 'text'), 'domain' => array('title' => $this->l('URL'), 'type' => 'text'), 'yandex' => array('title' => $this->l('Yandex'), 'type' => 'bool'), 'google' => array('title' => $this->l('Google'), 'type' => 'bool'));
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = false;
     $helper->identifier = 'id';
     $helper->actions = array('edit', 'delete');
     $helper->show_toolbar = false;
     $helper->title = $this->l('Link list');
     $helper->table = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $links = $this->getLinks();
     if (is_array($links) && count($links)) {
         return $helper->generateList($links, $fields_list);
     } else {
         return false;
     }
 }
 public function renderList()
 {
     $this->fields_list = array();
     $this->fields_list['nama_bank'] = array('title' => $this->l('Nama Bank'), 'type' => 'text', 'search' => true, 'orderby' => true);
     $this->fields_list['no_rek'] = array('title' => $this->l('No Rekening'), 'type' => 'text', 'search' => true, 'orderby' => true);
     $this->fields_list['reg_account_name'] = array('title' => $this->l('Account Name'), 'type' => 'text', 'search' => true, 'orderby' => true);
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = false;
     $helper->identifier = 'id_accountbank';
     $helper->actions = array('edit', 'delete');
     $helper->show_toolbar = true;
     $helper->imageType = 'jpg';
     $helper->toolbar_btn['new'] = array('href' => AdminController::$currentIndex . '&configure=' . $this->name . '&add' . $this->name . '&token=' . $this->token, 'desc' => $this->l('Add new'));
     $helper->title = 'DATA ACCOUNT BANK';
     $helper->table = $this->name;
     $helper->token = $this->token;
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $content = $this->getListContent();
     return $helper->generateList($content, $this->fields_list);
 }
 /**
  * method call when ajax request is made with the details row action
  * @see AdminController::postProcess()
  */
 public function ajaxProcessDetails()
 {
     if ($id = Tools::getValue('id')) {
         $this->table = 'attribute';
         $this->className = 'Attribute';
         $this->identifier = 'id_attribute';
         $this->lang = true;
         if (!Validate::isLoadedObject($obj = new AttributeGroup((int) $id))) {
             $this->errors[] = Tools::displayError('An error occurred while updating the status for an object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
         }
         $this->fields_list = array('id_attribute' => array('title' => $this->l('ID'), 'width' => 40, 'align' => 'center'), 'name' => array('title' => $this->l('Value'), 'width' => 'auto', 'filter_key' => 'b!name'));
         if ($obj->group_type == 'color') {
             $this->fields_list['color'] = array('title' => $this->l('Color'), 'width' => 40, 'filter_key' => 'b!color');
         }
         $this->fields_list['position'] = array('title' => $this->l('Position'), 'width' => 40, 'filter_key' => 'a!position', 'position' => 'position');
         $this->addRowAction('edit');
         $this->addRowAction('delete');
         // override attributes
         $this->display = 'list';
         $this->tpl_folder = 'attributes/';
         $this->_where = 'AND a.`id_attribute_group` = ' . (int) $id;
         $this->_orderBy = 'position';
         // get list and force no limit clause in the request
         $this->getList($this->context->language->id, null, null, 0, false);
         // Render list
         $helper = new HelperList();
         $helper->actions = $this->actions;
         $helper->override_folder = $this->tpl_folder;
         $helper->no_link = true;
         $helper->shopLinkType = '';
         $helper->identifier = $this->identifier;
         $helper->toolbar_scroll = false;
         $helper->orderBy = 'position';
         $helper->orderWay = 'ASC';
         $helper->currentIndex = self::$currentIndex;
         $helper->token = $this->token;
         $helper->table = $this->table;
         $helper->simple_header = true;
         $helper->show_toolbar = false;
         $helper->bulk_actions = $this->bulk_actions;
         $helper->position_identifier = 'id_attribute';
         $content = $helper->generateList($this->_list, $this->fields_list);
         die(Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content)));
     }
 }
 public function renderListModel()
 {
     $content = array();
     $fields_list = array();
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->actions = null;
     $helper->show_toolbar = false;
     $helper->module = $this;
     $helper->listTotal = count($content);
     $helper->identifier = 'id_product_comment';
     $helper->title = 'Moderate Comments';
     $helper->table = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     return $helper->generateList($content, $fields_list);
 }
Beispiel #10
0
 public function renderRestricList()
 {
     $default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
     $this->bulk_actions = array('add' => array('text' => $this->l('Add Selected Countries'), 'icon' => 'icon-plus'), 'remove' => array('text' => $this->l('Remove Selected Countries'), 'icon' => 'icon-minus'));
     if (Module::isInstalled("eko_ctt")) {
         $this->bulk_actions['divid1'] = array('text' => 'divider');
         $this->bulk_actions['addo'] = array('text' => $this->l('Add Selected Countries to Order Status'), 'icon' => 'icon-plus');
         $this->bulk_actions['removeo'] = array('text' => $this->l('Remove Selected Countries from Order Status'), 'icon' => 'icon-minus');
         $this->bulk_actions['divid2'] = array('text' => 'divider');
         $this->bulk_actions['addc'] = array('text' => $this->l('Add Selected Countries to CTT Status'), 'icon' => 'icon-plus');
         $this->bulk_actions['removec'] = array('text' => $this->l('Remove Selected Countries from CTT Status'), 'icon' => 'icon-minus');
     }
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = false;
     $helper->identifier = 'id_country';
     $helper->show_toolbar = false;
     $helper->no_link = true;
     $helper->bulk_actions = $this->bulk_actions;
     $helper->title = '<i class="icon icon-globe"></i>&nbsp;' . $this->l('Country Restrict');
     $helper->table = '_' . $this->name . "restrict";
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     return $helper->generateList($this->getRestricFieldsData(), $this->getRestricFields());
 }
Beispiel #11
0
 public function renderList($id_wishlist)
 {
     $wishlist = new WishList($id_wishlist);
     $products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $this->context->language->id);
     foreach ($products as $key => $val) {
         $image = Image::getCover($val['id_product']);
         $products[$key]['image'] = $this->context->link->getImageLink($val['link_rewrite'], $image['id_image'], ImageType::getFormatedName('small'));
     }
     $fields_list = array('image' => array('title' => $this->l('Image'), 'type' => 'image'), 'name' => array('title' => $this->l('Product'), 'type' => 'text'), 'attributes_small' => array('title' => $this->l('Combination'), 'type' => 'text'), 'quantity' => array('title' => $this->l('Quantity'), 'type' => 'text'), 'priority' => array('title' => $this->l('Priority'), 'type' => 'priority', 'values' => array($this->l('High'), $this->l('Medium'), $this->l('Low'))));
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->no_link = true;
     $helper->actions = array('view');
     $helper->show_toolbar = false;
     $helper->module = $this;
     $helper->identifier = 'id_product';
     $helper->title = $this->l('Product list');
     $helper->table = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $helper->tpl_vars = array('priority' => array($this->l('High'), $this->l('Medium'), $this->l('Low')));
     return $helper->generateList($products, $fields_list);
 }
Beispiel #12
0
 public function renderListAttributes($product, $currency)
 {
     $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
     $this->addRowAction('edit');
     $this->addRowAction('default');
     $this->addRowAction('delete');
     $default_class = 'highlighted';
     $this->fields_list = array('attributes' => array('title' => $this->l('Attribute - value pair'), 'align' => 'left'), 'price' => array('title' => $this->l('Impact on price'), 'type' => 'price', 'align' => 'left'), 'weight' => array('title' => $this->l('Impact on weight'), 'align' => 'left'), 'reference' => array('title' => $this->l('Reference'), 'align' => 'left'), 'ean13' => array('title' => $this->l('EAN-13'), 'align' => 'left'), 'upc' => array('title' => $this->l('UPC'), 'align' => 'left'));
     if ($product->id) {
         /* Build attributes combinations */
         $combinations = $product->getAttributeCombinations($this->context->language->id);
         $groups = array();
         $comb_array = array();
         if (is_array($combinations)) {
             $combination_images = $product->getCombinationImages($this->context->language->id);
             foreach ($combinations as $k => $combination) {
                 $price_to_convert = Tools::convertPrice($combination['price'], $currency);
                 $price = Tools::displayPrice($price_to_convert, $currency);
                 $comb_array[$combination['id_product_attribute']]['id_product_attribute'] = $combination['id_product_attribute'];
                 $comb_array[$combination['id_product_attribute']]['attributes'][] = array($combination['group_name'], $combination['attribute_name'], $combination['id_attribute']);
                 $comb_array[$combination['id_product_attribute']]['wholesale_price'] = $combination['wholesale_price'];
                 $comb_array[$combination['id_product_attribute']]['price'] = $price;
                 $comb_array[$combination['id_product_attribute']]['weight'] = $combination['weight'] . Configuration::get('PS_WEIGHT_UNIT');
                 $comb_array[$combination['id_product_attribute']]['unit_impact'] = $combination['unit_price_impact'];
                 $comb_array[$combination['id_product_attribute']]['reference'] = $combination['reference'];
                 $comb_array[$combination['id_product_attribute']]['ean13'] = $combination['ean13'];
                 $comb_array[$combination['id_product_attribute']]['upc'] = $combination['upc'];
                 $comb_array[$combination['id_product_attribute']]['id_image'] = isset($combination_images[$combination['id_product_attribute']][0]['id_image']) ? $combination_images[$combination['id_product_attribute']][0]['id_image'] : 0;
                 $comb_array[$combination['id_product_attribute']]['available_date'] = strftime($combination['available_date']);
                 $comb_array[$combination['id_product_attribute']]['default_on'] = $combination['default_on'];
                 if ($combination['is_color_group']) {
                     $groups[$combination['id_attribute_group']] = $combination['group_name'];
                 }
             }
         }
         $irow = 0;
         if (isset($comb_array)) {
             foreach ($comb_array as $id_product_attribute => $product_attribute) {
                 $list = '';
                 /* In order to keep the same attributes order */
                 asort($product_attribute['attributes']);
                 foreach ($product_attribute['attributes'] as $attribute) {
                     $list .= $attribute[0] . ' - ' . $attribute[1] . ', ';
                 }
                 $list = rtrim($list, ', ');
                 $comb_array[$id_product_attribute]['image'] = $product_attribute['id_image'] ? new Image($product_attribute['id_image']) : false;
                 $comb_array[$id_product_attribute]['available_date'] = $product_attribute['available_date'] != 0 ? date('Y-m-d', strtotime($product_attribute['available_date'])) : '0000-00-00';
                 $comb_array[$id_product_attribute]['attributes'] = $list;
                 $comb_array[$id_product_attribute]['name'] = $list;
                 if ($product_attribute['default_on']) {
                     $comb_array[$id_product_attribute]['class'] = $default_class;
                 }
             }
         }
     }
     foreach ($this->actions_available as $action) {
         if (!in_array($action, $this->actions) && isset($this->{$action}) && $this->{$action}) {
             $this->actions[] = $action;
         }
     }
     $helper = new HelperList();
     $helper->identifier = 'id_product_attribute';
     $helper->table_id = 'combinations-list';
     $helper->token = $this->token;
     $helper->currentIndex = self::$currentIndex;
     $helper->no_link = true;
     $helper->simple_header = true;
     $helper->show_toolbar = false;
     $helper->shopLinkType = $this->shopLinkType;
     $helper->actions = $this->actions;
     $helper->list_skip_actions = $this->list_skip_actions;
     $helper->colorOnBackground = true;
     $helper->override_folder = $this->tpl_folder . 'combination/';
     return $helper->generateList($comb_array, $this->fields_list);
 }
 public function renderCommentsList()
 {
     require_once dirname(__FILE__) . '/ProductComment.php';
     $comments = ProductComment::getByValidate(1, false);
     $fields_list = $this->getStandardFieldList();
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->actions = array('delete');
     $helper->show_toolbar = false;
     $helper->module = $this;
     $helper->listTotal = count($comments);
     $helper->identifier = 'id_product_comment';
     $helper->title = $this->l('Approved Reviews');
     $helper->table = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     //$helper->tpl_vars = array('priority' => array($this->l('High'), $this->l('Medium'), $this->l('Low')));
     return $helper->generateList($comments, $fields_list);
 }
 public function renderList()
 {
     // Campagne en cours de création (off-line)
     // ----------------------------------------
     if (!count($this->getLocalCampaigns())) {
         $this->_list = array();
     } else {
         $this->_list = $this->getLocalCampaigns(self::NEW_CMP);
     }
     $helper = new HelperList();
     $helper->no_link = true;
     $helper->shopLinkType = '';
     $helper->simple_header = false;
     $helper->table = $this->table;
     $helper->identifier = 'campaign_id';
     $helper->show_toolbar = true;
     $helper->toolbar_scroll = false;
     $helper->token = $this->token;
     $helper->currentIndex = AdminController::$currentIndex;
     $helper->allow_export = false;
     $helper->title = '<i class="icon-edit"></i> ' . $this->module->l('Drafted messages (off-line)', 'adminmarketingslist');
     $helper->actions = array('edit', 'delete');
     $helper->listTotal = count($this->_list);
     $helper->toolbar_btn['new'] = array('href' => 'index.php?controller=AdminMarketingS&token=' . Tools::getAdminTokenLite('AdminMarketingS'), 'desc' => $this->module->l('New sms campaign', 'adminmarketingslist'));
     $this->fields_list = array('campaign_id' => array('title' => $this->module->l('ID', 'adminmarketingslist'), 'width' => 140, 'type' => 'text', 'search' => false, 'ajax' => true), 'campaign_date_update' => array('title' => $this->module->l('Last Update', 'adminmarketingslist'), 'width' => 'auto', 'type' => 'text', 'search' => false, 'ajax' => true), 'campaign_name' => array('title' => $this->module->l('Campaign name', 'adminmarketingslist'), 'width' => 'auto', 'type' => 'text', 'search' => false, 'callback' => 'callbackTitle', 'ajax' => true));
     $output = $helper->generateList($this->_list, $this->fields_list);
     // Campagnes on-line
     // -----------------
     if ($this->session_api->connectFromCredentials('sms')) {
         $response_array = array();
         $parameters = array('account_ids' => array($this->session_api->account_id), 'campaign_states' => array(self::SCHEDULED, self::WAITING_NEXT_SLOT, self::SLEEPING, self::SENDING, self::RETRYING, self::FINISHED, self::UNAVAILABLE_CREDIT, self::FINISHING));
         if ($this->session_api->call('sms', 'campaign', 'enum_by_states', $parameters, $response_array)) {
             // Campagnes en cours d'envoi, programmées ou en pause
             // ---------------------------------------------------
             $data = array_filter($response_array, function ($k) {
                 $states = array('scheduled', 'waiting_next_slot', 'sleeping', 'sending', 'retrying', 'unavailable_credit');
                 return in_array($k['state'], $states);
             });
             if (count($data) > 0) {
                 $helper = new HelperList();
                 $helper->no_link = true;
                 $helper->shopLinkType = '';
                 $helper->simple_header = false;
                 $helper->table = $this->table;
                 $helper->identifier = 'campaign_id';
                 $helper->show_toolbar = true;
                 $helper->toolbar_scroll = false;
                 $helper->token = Tools::getAdminTokenLite('AdminMarketingSStats');
                 $helper->currentIndex = $this->context->link->getAdminLink('AdminMarketingSStats', false);
                 $helper->allow_export = false;
                 $helper->title = '<i class="icon-share"></i> ' . $this->module->l('Messages in the outbox (on-line)', 'adminmarketingslist') . ' <span class="badge">' . count($data) . '</span>';
                 $helper->actions = array('details');
                 $helper->listTotal = count($data);
                 $this->fields_list = array('campaign_id' => array('title' => $this->module->l('ID', 'adminmarketingslist'), 'width' => 140, 'type' => 'text', 'search' => false), 'start_date' => array('title' => $this->module->l('Date send', 'adminmarketingslist'), 'width' => 'auto', 'type' => 'text', 'callback' => 'callbackTime', 'search' => false), 'name' => array('title' => $this->module->l('Campaign name', 'adminmarketingslist'), 'width' => 'auto', 'type' => 'text', 'callback' => 'callbackTitle', 'search' => false));
                 $output .= $helper->generateList($data, $this->fields_list);
             }
             $data = array_filter($response_array, function ($k) {
                 return $k['state'] == 'finished';
             });
             if (count($data) > 0) {
                 // Campagne archivées
                 // ------------------
                 $helper = new HelperList();
                 $helper->no_link = true;
                 $helper->shopLinkType = '';
                 $helper->simple_header = false;
                 $helper->table = $this->table;
                 $helper->identifier = 'campaign_id';
                 $helper->show_toolbar = false;
                 $helper->toolbar_scroll = false;
                 $helper->token = Tools::getAdminTokenLite('AdminMarketingSStats');
                 $helper->currentIndex = $this->context->link->getAdminLink('AdminMarketingSStats', false);
                 $helper->allow_export = false;
                 $helper->title = '<i class="icon-folder-open"></i> ' . $this->module->l('Sent & archived messages (on-line)', 'adminmarketingslist') . ' <span class="badge">' . count($data) . '</span>';
                 $helper->actions = array('details');
                 $helper->listTotal = count($response_array);
                 $this->fields_list = array('campaign_id' => array('title' => $this->module->l('ID', 'adminmarketingslist'), 'width' => 140, 'type' => 'text', 'search' => false), 'start_date' => array('title' => $this->module->l('Sent date', 'adminmarketingslist'), 'width' => 'auto', 'type' => 'text', 'callback' => 'callbackDate', 'search' => false), 'name' => array('title' => $this->module->l('Campaign name', 'adminmarketingslist'), 'width' => 'auto', 'type' => 'text', 'callback' => 'callbackTitle', 'search' => false));
                 $output .= $helper->generateList($data, $this->fields_list);
             }
         }
     }
     $footer = $this->getTemplatePath() . 'footer.tpl';
     $output .= $this->context->smarty->fetch($footer);
     return $output;
 }
 public function renderList()
 {
     $fields_list = array('id' => array('title' => $this->l('Id'), 'type' => 'text'), 'text_' . $this->context->language->id => array('title' => $this->l('Text'), 'type' => 'text'), 'url' => array('title' => $this->l('Url'), 'type' => 'text'));
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->identifier = 'id';
     $helper->actions = array('edit', 'delete');
     $helper->show_toolbar = false;
     $helper->title = $this->l('Link list');
     $helper->table = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $links = $this->getLinks();
     if (is_array($links) && count($links)) {
         return $helper->generateList($this->getLinks(), $fields_list);
     } else {
         return false;
     }
 }
 public function renderList()
 {
     $fields_list = array('id' => array('title' => $this->l('ID'), 'search' => false), 'shop_name' => array('title' => $this->l('Shop'), 'search' => false), 'gender' => array('title' => $this->l('Gender'), 'search' => false), 'lastname' => array('title' => $this->l('Lastname'), 'search' => false), 'firstname' => array('title' => $this->l('Firstname'), 'search' => false), 'email' => array('title' => $this->l('Email'), 'search' => false), 'subscribed' => array('title' => $this->l('Subscribed'), 'type' => 'bool', 'active' => 'subscribed', 'search' => false), 'newsletter_date_add' => array('title' => $this->l('Subscribed on'), 'type' => 'date', 'search' => false));
     if (!Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE')) {
         unset($fields_list['shop_name']);
     }
     $helper_list = new HelperList();
     $helper_list->module = $this;
     $helper_list->title = $this->l('Newsletter registrations');
     $helper_list->shopLinkType = '';
     $helper_list->no_link = true;
     $helper_list->show_toolbar = true;
     $helper_list->simple_header = false;
     $helper_list->identifier = 'id';
     $helper_list->table = 'merged';
     $helper_list->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name;
     $helper_list->token = Tools::getAdminTokenLite('AdminModules');
     $helper_list->actions = array('viewCustomer');
     $helper_list->toolbar_btn['export'] = array('href' => $helper_list->currentIndex . '&amp;exportSubscribers&amp;token=' . $helper_list->token, 'desc' => $this->l('Export'));
     /* Before 1.6.0.7 displayEnableLink() could not be overridden in Module class
        we declare another row action instead 			*/
     if (version_compare(_PS_VERSION_, '1.6.0.7', '<')) {
         unset($fields_list['subscribed']);
         $helper_list->actions = array_merge($helper_list->actions, array('unsubscribe'));
     }
     // This is needed for displayEnableLink to avoid code duplication
     $this->_helperlist = $helper_list;
     /* Retrieve list data */
     $subscribers = $this->getSubscribers();
     $helper_list->listTotal = count($subscribers);
     /* Paginate the result */
     $page = ($page = Tools::getValue('submitFilter' . $helper_list->table)) ? $page : 1;
     $pagination = ($pagination = Tools::getValue($helper_list->table . '_pagination')) ? $pagination : 50;
     $subscribers = $this->paginateSubscribers($subscribers, $page, $pagination);
     return $helper_list->generateList($subscribers, $fields_list);
 }
 public function renderView()
 {
     $this->tpl_view_vars['query'] = Tools::safeOutput($this->query);
     $this->tpl_view_vars['show_toolbar'] = true;
     if (count($this->errors)) {
         return parent::renderView();
     } else {
         $nb_results = 0;
         foreach ($this->_list as $list) {
             if ($list != false) {
                 $nb_results += count($list);
             }
         }
         $this->tpl_view_vars['nb_results'] = $nb_results;
         if (isset($this->_list['features']) && count($this->_list['features'])) {
             $this->tpl_view_vars['features'] = $this->_list['features'];
         }
         if (isset($this->_list['categories']) && count($this->_list['categories'])) {
             $categories = array();
             foreach ($this->_list['categories'] as $category) {
                 $categories[] = getPath($this->context->link->getAdminLink('AdminCategories', false), $category['id_category']);
             }
             $this->tpl_view_vars['categories'] = $categories;
         }
         if (isset($this->_list['products']) && count($this->_list['products'])) {
             $view = '';
             $this->initProductList();
             $helper = new HelperList();
             $helper->shopLinkType = '';
             $helper->simple_header = true;
             $helper->identifier = 'id_product';
             $helper->actions = array('edit');
             $helper->show_toolbar = false;
             $helper->table = 'product';
             $helper->currentIndex = $this->context->link->getAdminLink('AdminProducts', false);
             $helper->token = Tools::getAdminTokenLite('AdminProducts');
             if ($this->_list['products']) {
                 $view = $helper->generateList($this->_list['products'], $this->fields_list['products']);
             }
             $this->tpl_view_vars['products'] = $view;
         }
         if (isset($this->_list['customers']) && count($this->_list['customers'])) {
             $view = '';
             $this->initCustomerList();
             $helper = new HelperList();
             $helper->shopLinkType = '';
             $helper->simple_header = true;
             $helper->identifier = 'id_customer';
             $helper->actions = array('edit', 'view');
             $helper->show_toolbar = false;
             $helper->table = 'customer';
             $helper->currentIndex = $this->context->link->getAdminLink('AdminCustomers', false);
             $helper->token = Tools::getAdminTokenLite('AdminCustomers');
             if ($this->_list['customers']) {
                 foreach ($this->_list['customers'] as $key => $val) {
                     $this->_list['customers'][$key]['orders'] = Order::getCustomerNbOrders((int) $val['id_customer']);
                 }
                 $view = $helper->generateList($this->_list['customers'], $this->fields_list['customers']);
             }
             $this->tpl_view_vars['customers'] = $view;
         }
         if (isset($this->_list['orders']) && count($this->_list['orders'])) {
             $view = '';
             $this->initOrderList();
             $helper = new HelperList();
             $helper->shopLinkType = '';
             $helper->simple_header = true;
             $helper->identifier = 'id_order';
             $helper->actions = array('view');
             $helper->show_toolbar = false;
             $helper->table = 'order';
             $helper->currentIndex = $this->context->link->getAdminLink('AdminOrders', false);
             $helper->token = Tools::getAdminTokenLite('AdminOrders');
             if ($this->_list['orders']) {
                 $view = $helper->generateList($this->_list['orders'], $this->fields_list['orders']);
             }
             $this->tpl_view_vars['orders'] = $view;
         }
         if (isset($this->_list['modules']) && count($this->_list['modules'])) {
             $this->tpl_view_vars['modules'] = $this->_list['modules'];
         }
         if (isset($this->_list['addons']) && count($this->_list['addons'])) {
             $this->tpl_view_vars['addons'] = $this->_list['addons'];
         }
         return parent::renderView();
     }
 }
 public function renderForm()
 {
     $get_available_themes = Theme::getAvailable(false);
     $available_theme_dir = array();
     $selected_theme_dir = null;
     $metas = Meta::getMetas();
     $formated_metas = array();
     foreach ($metas as $meta) {
         $meta_object = new Meta($meta['id_meta']);
         $title = $meta['page'];
         if (isset($meta_object->title[(int) $this->context->language->id]) && $meta_object->title[(int) $this->context->language->id] != '') {
             $title = $meta_object->title[(int) $this->context->language->id];
         }
         $formated_metas[$meta['id_meta']] = array('title' => $title, 'left' => 0, 'right' => 0);
     }
     $image_url = false;
     if ($this->object) {
         if ((int) $this->object->id > 0) {
             $theme = new Theme((int) $this->object->id);
             $theme_metas = $theme->getMetas();
             // if no theme_meta are found, we must create them
             if (empty($theme_metas)) {
                 $metas = Db::getInstance()->executeS('SELECT id_meta FROM ' . _DB_PREFIX_ . 'meta');
                 $metas_default = array();
                 foreach ($metas as $meta) {
                     $tmp_meta['id_meta'] = (int) $meta['id_meta'];
                     $tmp_meta['left'] = 1;
                     $tmp_meta['right'] = 1;
                     $metas_default[] = $tmp_meta;
                 }
                 $theme->updateMetas($metas_default);
                 $theme_metas = $theme->getMetas();
             }
             $image_url = '<img alt="preview" src="' . __PS_BASE_URI__ . 'themes/' . $theme->directory . '/preview.jpg">';
             foreach ($theme_metas as $theme_meta) {
                 $formated_metas[$theme_meta['id_meta']]['id_theme_meta'] = (int) $theme_meta['id_theme_meta'];
                 $formated_metas[$theme_meta['id_meta']]['id_meta'] = (int) $theme_meta['id_meta'];
                 $formated_metas[$theme_meta['id_meta']]['left'] = (int) $theme_meta['left_column'];
                 $formated_metas[$theme_meta['id_meta']]['right'] = (int) $theme_meta['right_column'];
             }
         }
         $selected_theme_dir = $this->object->directory;
     }
     foreach ($get_available_themes as $k => $dirname) {
         $available_theme_dir[$k]['value'] = $dirname;
         $available_theme_dir[$k]['label'] = $dirname;
         $available_theme_dir[$k]['id'] = $dirname;
     }
     $this->fields_form = array('tinymce' => false, 'legend' => array('title' => $this->l('Theme'), 'icon' => 'icon-picture'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name of the theme'), 'name' => 'name', 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'file', 'label' => $this->l('Preview image for the theme'), 'name' => 'image_preview', 'display_image' => true, 'hint' => sprintf($this->l('Max image size: %1s'), Tools::formatBytes(Tools::getMaxUploadSize())), 'image' => $image_url), array('type' => 'switch', 'label' => $this->l('Default left column'), 'name' => 'default_left_column', 'hint' => $this->l('Choose a default behavior when displaying the column in a new page added by you or by a module.'), 'values' => array(array('id' => 'default_left_column_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'default_left_column_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'switch', 'label' => $this->l('Default right column'), 'name' => 'default_right_column', 'hint' => $this->l('Choose a default behavior when displaying the column in a new page added by you or by a module.'), 'values' => array(array('id' => 'default_right_column_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'default_right_column_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'text', 'label' => $this->l('Number of products per page'), 'name' => 'product_per_page', 'hint' => $this->l('This value will be used when activating the theme.'))), 'submit' => array('title' => $this->l('Save')));
     // adding a new theme, you can create a directory, and copy from an existing theme
     if ($this->display == 'add' || !$this->object->id) {
         $this->fields_form['input'][] = array('type' => 'text', 'label' => $this->l('Name of the theme\'s directory'), 'name' => 'directory', 'required' => true, 'hint' => $this->l('If the directory does not exists, it will be created.'));
         $theme_query = Theme::getThemes();
         $this->fields_form['input'][] = array('type' => 'select', 'name' => 'based_on', 'label' => $this->l('Copy missing files from existing theme'), 'hint' => $this->l('If you create a new theme, it\'s recommended that you use the default theme files.'), 'options' => array('id' => 'id', 'name' => 'name', 'default' => array('value' => 0, 'label' => '-'), 'query' => $theme_query));
         $this->fields_form['input'][] = array('type' => 'switch', 'label' => $this->l('Responsive'), 'name' => 'responsive', 'hint' => $this->l('Please indicate if the theme is adapted to all screen sizes (mobile, tablet, desktop).'), 'values' => array(array('id' => 'responsive_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'responsive_off', 'value' => 0, 'label' => $this->l('No'))));
     } else {
         $this->fields_form['input'][] = array('type' => 'radio', 'label' => $this->l('Directory'), 'name' => 'directory', 'required' => true, 'br' => true, 'values' => $available_theme_dir, 'selected' => $selected_theme_dir, 'hint' => $this->l('Please select a valid theme directory.'));
     }
     $list = '';
     if (Tools::getIsset('update' . $this->table)) {
         $fields_list = array('title' => array('title' => $this->l('Meta'), 'align' => 'center', 'width' => 'auto'), 'left' => array('title' => $this->l('Left column'), 'active' => 'left', 'type' => 'bool', 'ajax' => true), 'right' => array('title' => $this->l('Right column'), 'active' => 'right', 'type' => 'bool', 'ajax' => true));
         $helper_list = new HelperList();
         $helper_list->tpl_vars = array('icon' => 'icon-columns');
         $helper_list->title = $this->l('Appearance of columns');
         $helper_list->no_link = true;
         $helper_list->shopLinkType = '';
         $helper_list->identifier = 'id_theme_meta';
         $helper_list->table = 'meta';
         $helper_list->currentIndex = $this->context->link->getAdminLink('AdminThemes', false);
         $helper_list->token = Tools::getAdminTokenLite('AdminThemes');
         $list = $helper_list->generateList($formated_metas, $fields_list);
     }
     return parent::renderForm() . $list;
 }
 public function renderList()
 {
     $output = '';
     if ($this->session_api->connectFromCredentials('email')) {
         Tools::clearCache($this->context->smarty);
         $response_array = array();
         $parameters = array('account_id' => $this->session_api->account_id, 'max_lines' => 20, 'campaign_id' => (int) Tools::getValue('campaign_id'));
         if ($this->session_api->call('email', 'campaign', 'enum_last_sent', $parameters, $response_array)) {
             if (is_array($response_array) && count($response_array)) {
                 // On retrouve tous les jours d'envoi (envois fractionnés sur plusieurs jours)
                 // ---------------------------------------------------------------------------
                 $tools = new EMTools();
                 $days = array();
                 foreach ($response_array as $day) {
                     $days[] = array('day_api' => $day['stat_date'], 'day_lang' => $tools->getLocalizableDate($day['stat_date']));
                 }
                 $this->context->smarty->assign(array('days' => $days, 'current_index' => AdminController::$currentIndex . '&campaign_id=' . $response_array[0]['campaign_id'], 'campaign_id' => $response_array[0]['campaign_id'], 'campaign_name' => Tools::htmlentitiesDecodeUTF8($response_array[0]['name'])));
                 // S'il y a un stat_date, il faut ré-intéroger l'API pour obtenir les stats du jour sélectionné
                 // --------------------------------------------------------------------------------------------
                 if (Tools::getValue('stat_date')) {
                     $stat_array = array();
                     $parameters = array('account_id' => $this->session_api->account_id, 'campaign_id' => (int) Tools::getValue('campaign_id'), 'stat_date' => (int) Tools::getValue('stat_date'));
                     if ($this->session_api->call('email', 'campaign', 'get_statistics', $parameters, $stat_array)) {
                         $response_array = array($stat_array);
                     }
                     // Pour rester compatible avec le code ci-dessous
                 }
                 // S'il n'y a pas de stat_date, l'API nous retourne directement les stats du dernier envoi
                 // ---------------------------------------------------------------------------------------
                 $this->context->smarty->assign(array('select_day' => $response_array[0]['stat_date'], 'sent' => $response_array[0]['sent'], 'not_sent' => $response_array[0]['not_sent'], 'delivered' => $response_array[0]['delivered'], 'not_delivered' => $response_array[0]['not_delivered'], 'opened' => $response_array[0]['opened'], 'not_opened' => $response_array[0]['not_opened'], 'unique_clickers' => $response_array[0]['unique_clickers'], 'all_clicks' => $response_array[0]['all_clicks'], 'unsubscribes' => $response_array[0]['unsubscribes'], 'abuses' => $response_array[0]['abuses'], 'ratio_sent' => $response_array[0]['ratio_sent'], 'ratio_not_sent' => $response_array[0]['ratio_not_sent'], 'ratio_delivered' => $response_array[0]['ratio_delivered'], 'ratio_not_delivered' => $response_array[0]['ratio_not_delivered'], 'ratio_opened' => $response_array[0]['ratio_opened'], 'ratio_not_opened' => $response_array[0]['ratio_not_opened'], 'ratio_unique_clickers' => $response_array[0]['ratio_unique_clickers'], 'ratio_unsubscribes' => $response_array[0]['ratio_unsubscribes'], 'ratio_abuses' => $response_array[0]['ratio_abuses']));
                 // On affiche le tableau des stats
                 // -------------------------------
                 $diplay = $this->getTemplatePath() . 'marketinge_stats/marketinge_stats.tpl';
                 $output = $this->context->smarty->fetch($diplay);
                 // On charge les données du graphique des "opened"
                 // -----------------------------------------------
                 $delivered = array();
                 /* ne pas utiliser le nom response_array SVP */
                 $parameters = array('account_id' => $this->session_api->account_id, 'campaign_id' => $response_array[0]['campaign_id'], 'stat_date' => $response_array[0]['stat_date']);
                 $this->session_api->call('email', 'campaign', 'get_graph_delivered_per_hour', $parameters, $delivered);
                 $this->context->smarty->assign('delivered', $delivered);
                 $graph = $this->getTemplatePath() . 'marketinge_stats/marketinge_graph.tpl';
                 $output .= $this->context->smarty->fetch($graph);
             } else {
                 // On affiche une liste vide
                 // -------------------------
                 $helper = new HelperList();
                 $helper->no_link = true;
                 $helper->shopLinkType = '';
                 $helper->simple_header = false;
                 // Mettre 'search' => false dans chaque fields_list
                 $helper->table = $this->table;
                 $helper->identifier = 'campaign_id';
                 $helper->show_toolbar = true;
                 $helper->toolbar_scroll = false;
                 $helper->token = Tools::getAdminTokenLite('AdminMarketingEStats');
                 $helper->currentIndex = $this->context->link->getAdminLink('AdminMarketingEStats', false);
                 $helper->allow_export = false;
                 $helper->title = '<i class="icon-bar-chart"></i> ' . $this->module->l('Broadcast evolution during last 24/48 hours', 'adminmarketingestats');
                 $helper->toolbar_btn = array('back' => array('href' => 'index.php?controller=AdminMarketingEList&token=' . Tools::getAdminTokenLite('AdminMarketingEList'), 'desc' => $this->module->l('Back to list', 'adminmarketingestats')));
                 $helper->actions = array('details');
                 $this->fields_list = array();
                 $output .= $helper->generateList($this->fields_list, $this->fields_list);
             }
         }
     }
     $footer = $this->getTemplatePath() . 'footer.tpl';
     $output .= $this->context->smarty->fetch($footer);
     return $output;
 }
 /**
  * method call when ajax request is made with the details row action
  * @see AdminController::postProcess()
  */
 public function ajaxProcess()
 {
     // test if an id is submit
     if (Tools::isSubmit('id')) {
         // override attributes
         $this->identifier = 'id_product_attribute';
         $this->display = 'list';
         $this->lang = false;
         $this->addRowAction('addstock');
         $this->addRowAction('removestock');
         $this->addRowAction('transferstock');
         // get current lang id
         $lang_id = (int) $this->context->language->id;
         // Get product id
         $product_id = (int) Tools::getValue('id');
         // Load product attributes with sql override
         $this->table = 'product_attribute';
         $this->_select = 'a.id_product_attribute as id, a.id_product, a.reference, a.ean13, a.upc';
         $this->_where = 'AND a.id_product = ' . $product_id;
         $this->_group = 'GROUP BY a.id_product_attribute';
         // get list and force no limit clause in the request
         $this->getList($this->context->language->id, null, null, 0, false);
         // Render list
         $helper = new HelperList();
         $helper->bulk_actions = array();
         $helper->toolbar_scroll = $this->toolbar_scroll;
         $helper->show_toolbar = false;
         $helper->actions = $this->actions;
         $helper->list_skip_actions = $this->list_skip_actions;
         $helper->no_link = true;
         $helper->shopLinkType = '';
         $helper->identifier = $this->identifier;
         // Force render - no filter, form, js, sorting ...
         $helper->simple_header = true;
         $content = $helper->generateList($this->_list, $this->fields_list);
         echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
     }
     die;
 }
    public function renderList()
    {
        // Count the duplicates
        // --------------------
        $request = 'SELECT SUM(duplic - 1)
					FROM
					(
						SELECT COUNT(target) as duplic
						FROM ' . _DB_PREFIX_ . 'expressmailing_sms_recipients
						WHERE campaign_id= ' . $this->campaign_id . '
						GROUP BY target
						HAVING COUNT(target) > 1
					) as dd';
        $this->duplicate_count = (int) Db::getInstance()->getValue($request, false);
        // Total recipients will be stored in $this->list_total
        // ----------------------------------------------------
        $this->initCustomerFilters();
        $recipients = $this->getRecipientsDB();
        // Panel 1 : contacts import
        // -------------------------
        $display = $this->getTemplatePath() . 'marketings_step2/tabcontacts_importation_sms.tpl';
        $this->context->smarty->assign(array('customers_filters' => $this->generateCustomersFilters(), 'duplicate_count' => $this->duplicate_count));
        $output = $this->context->smarty->fetch($display);
        // Panel 2 : Recipients preview
        // ----------------------------
        $helper_list = new HelperList();
        $helper_list->no_link = true;
        $helper_list->shopLinkType = '';
        $helper_list->simple_header = true;
        $helper_list->identifier = 'ID';
        $helper_list->show_toolbar = false;
        $helper_list->table = 'expressmailing_sms_recipients';
        $fields_list = array('target' => array('title' => $this->module->l('Phone', 'adminmarketingsstep2'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_1' => array('title' => $this->module->l('Col_1', 'adminmarketingsstep2'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_2' => array('title' => $this->module->l('Col_2', 'adminmarketingsstep2'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_3' => array('title' => $this->module->l('Col_3', 'adminmarketingsstep2'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_4' => array('title' => $this->module->l('Col_4', 'adminmarketingsstep2'), 'width' => 140, 'search' => false, 'type' => 'text'), 'col_5' => array('title' => $this->module->l('Col_5', 'adminmarketingsstep2'), 'width' => 140, 'search' => false, 'type' => 'text'));
        $html_list = $helper_list->generateList($recipients, $fields_list);
        if (!preg_match('/<table.*<\\/table>/iUs', $html_list, $array_table)) {
            $output .= $html_list;
        }
        $this->fields_form = array('legend' => array('title' => $this->module->l('Recipients preview', 'adminmarketingsstep2') . '<span class="badge">' . $this->list_total . '</span>', 'icon' => 'icon-phone'), 'input' => array(array('type' => 'hidden', 'lang' => false, 'label' => 'Ref :', 'name' => 'campaign_id', 'col' => 1, 'readonly' => 'readonly'), array('type' => 'free', 'name' => 'html_list')), 'submit' => array('title' => $this->module->l('Validate this selection', 'adminmarketingsstep2'), 'name' => 'submitSmsStep2', 'icon' => 'process-icon-next'), 'buttons' => array(array('href' => 'index.php?controller=AdminMarketingSStep1&campaign_id=' . $this->campaign_id . '&token=' . Tools::getAdminTokenLite('AdminMarketingSStep1'), 'title' => $this->module->l('Back', 'adminmarketingsstep2'), 'icon' => 'process-icon-back')));
        $this->getFieldsValues();
        $html_boutons = parent::renderForm();
        // Concatenate list and buttons
        // ----------------------------
        if (count($array_table) > 0) {
            $output .= str_replace('<div class="form-group">', $array_table[0] . '<div class="form-group">', $html_boutons);
        } else {
            $output .= $html_boutons;
        }
        $footer = $this->getTemplatePath() . 'footer.tpl';
        $output .= $this->context->smarty->fetch($footer);
        $open_tree = $this->getTemplatePath() . 'marketinge_step4/filters_tree.tpl';
        $output .= $this->context->smarty->fetch($open_tree);
        return $output;
    }
Beispiel #22
0
 public function renderList()
 {
     $current_index = AdminController::$currentIndex;
     $token = Tools::getAdminTokenLite('AdminModules');
     $list = DB::getInstance()->executeS("\n            SELECT * FROM `" . _DB_PREFIX_ . "mycarrier_rule`\n        ");
     $fields_list = array('id_rule' => array('title' => $this->l('Id'), 'width' => 20, 'type' => 'text'), 'name' => array('title' => $this->l('Name'), 'width' => 'auto', 'type' => 'text'), 'is_msk' => array('title' => $this->l('Moskow region'), 'width' => 80, 'type' => 'bool', 'active' => 'status'), 'price' => array('title' => $this->l('Price'), 'width' => 80, 'type' => 'price'));
     $helper = new HelperList();
     $helper->module = $this;
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->actions = array('edit', 'delete');
     $helper->identifier = 'id_rule';
     $helper->show_toolbar = true;
     $helper->title = 'helper list';
     $helper->table = '_rule';
     $helper->token = $token;
     $helper->currentIndex = $current_index . '&configure=' . $this->name;
     $helper->toolbar_btn = array('new' => array('href' => $current_index . '&amp;configure=' . $this->name . '&amp;token=' . $token . '&amp;addBlockCMS', 'desc' => $this->l('Add new')));
     $this->_html .= $helper->generateList($list, $fields_list);
 }
Beispiel #23
0
 private function rendertList()
 {
     $this->fields_list = array('id' => array('title' => $this->l('ID'), 'width' => 60), 'path' => array('title' => $this->l('Path'), 'width' => 'auto', 'type' => 'text'), 'desc' => array('title' => $this->l('Description'), 'width' => 'auto', 'type' => 'text'), 'recursive' => array('title' => $this->l('Recursive'), 'active' => 'recursive', 'type' => 'bool', 'align' => 'center'), 'enabled' => array('title' => $this->l('Enabled'), 'active' => 'enabled', 'type' => 'bool', 'align' => 'center'));
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = false;
     // Actions to be displayed in the "Actions" column
     $helper->actions = array('edit', 'delete');
     $helper->identifier = 'id';
     $helper->title = $this->l('Directories list');
     $helper->table = $this->name;
     $helper->show_toolbar = true;
     $helper->toolbar_btn['new'] = array('href' => AdminController::$currentIndex . '&configure=' . $this->name . '&add' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Add new'));
     $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $listContent = DirList::getContent();
     $helper->listTotal = count($listContent);
     return $helper->generateList($listContent, $this->fields_list);
 }
 public function renderList()
 {
     $add_url = $this->context->link->getAdminLink('AdminModules') . '&configure=' . $this->name . '&addCarrierRule=1';
     $fields_list = array('name' => array('title' => $this->l('Name of carrier'), 'type' => 'text'), 'delivery_between' => array('title' => $this->l('Delivery between'), 'type' => 'text'), 'delivery_saturday' => array('title' => $this->l('Saturday delivery'), 'type' => 'bool', 'align' => 'center', 'active' => 'saturdaystatus'), 'delivery_sunday' => array('title' => $this->l('Sunday delivery'), 'type' => 'bool', 'align' => 'center', 'active' => 'sundaystatus'));
     $list = $this->_getCarrierRulesWithCarrierName();
     foreach ($list as $key => $val) {
         if (!$val['name']) {
             $list[$key]['name'] = Configuration::get('PS_SHOP_NAME');
         }
         $list[$key]['delivery_between'] = sprintf($this->l('%1$d day(s) and %2$d day(s)'), $val['minimal_time'], $val['maximal_time']);
     }
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->identifier = 'id_carrier_rule';
     $helper->actions = array('edit', 'delete');
     $helper->show_toolbar = false;
     $helper->title = $this->l('Link list');
     $helper->table = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $this->context->smarty->assign(array('add_url' => $add_url));
     return $this->display(__FILE__, 'button.tpl') . $helper->generateList($list, $fields_list) . $this->display(__FILE__, 'button.tpl');
 }
Beispiel #25
0
 protected function renderList()
 {
     $this->fields_list = array();
     $this->fields_list['id_info'] = array('title' => $this->l('Block ID'), 'type' => 'text', 'search' => false, 'orderby' => false);
     if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) {
         $this->fields_list['shop_name'] = array('title' => $this->l('Shop'), 'type' => 'text', 'search' => false, 'orderby' => false);
     }
     $this->fields_list['text'] = array('title' => $this->l('Block text'), 'type' => 'text', 'search' => false, 'orderby' => false);
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = false;
     $helper->identifier = 'id_info';
     $helper->actions = array('edit', 'delete');
     $helper->show_toolbar = true;
     $helper->imageType = 'jpg';
     $helper->toolbar_btn['new'] = array('href' => AdminController::$currentIndex . '&configure=' . $this->name . '&add' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Add new'));
     $helper->title = $this->displayName;
     $helper->table = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $content = $this->getListContent($this->context->language->id);
     return $helper->generateList($content, $this->fields_list);
 }
 /**
  * method call when ajax request is made with the details row action
  * @see AdminController::postProcess()
  */
 public function ajaxProcessDetails()
 {
     if ($id = Tools::getValue('id')) {
         // override attributes
         $this->display = 'list';
         $this->lang = false;
         $this->addRowAction('edit');
         $this->addRowAction('delete');
         $this->_select = 'b.*';
         $this->_join = 'LEFT JOIN `' . _DB_PREFIX_ . 'tab_lang` b ON (b.`id_tab` = a.`id_tab` AND b.`id_lang` = ' . $this->context->language->id . ')';
         $this->_where = 'AND a.`id_parent` = ' . (int) $id;
         $this->_orderBy = 'position';
         // get list and force no limit clause in the request
         $this->getList($this->context->language->id);
         // Render list
         $helper = new HelperList();
         $helper->actions = $this->actions;
         $helper->list_skip_actions = $this->list_skip_actions;
         $helper->no_link = true;
         $helper->shopLinkType = '';
         $helper->identifier = $this->identifier;
         $helper->imageType = $this->imageType;
         $helper->toolbar_scroll = false;
         $helper->show_toolbar = false;
         $helper->orderBy = 'position';
         $helper->orderWay = 'ASC';
         $helper->currentIndex = self::$currentIndex;
         $helper->token = $this->token;
         $helper->table = $this->table;
         $helper->position_identifier = $this->position_identifier;
         // Force render - no filter, form, js, sorting ...
         $helper->simple_header = true;
         $content = $helper->generateList($this->_list, $this->fields_list);
         echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
     }
     die;
 }
Beispiel #27
0
 protected function renderTasksList()
 {
     $helper = new HelperList();
     $helper->title = $this->l('Cron tasks');
     $helper->table = $this->name;
     $helper->no_link = true;
     $helper->shopLinkType = '';
     $helper->identifier = 'id_cronjob';
     $helper->actions = array('edit', 'delete');
     $values = CronJobsForms::getTasksListValues();
     $helper->listTotal = count($values);
     $helper->tpl_vars = array('show_filters' => false);
     $helper->toolbar_btn['new'] = array('href' => $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name . '&newcronjobs=1&token=' . Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Add new task'));
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
     return $helper->generateList($values, CronJobsForms::getTasksList());
 }
 protected function renderCustomersList($group)
 {
     $genders = array(0 => '?');
     $genders_icon = array('default' => 'unknown.gif');
     foreach (Gender::getGenders() as $gender) {
         $genders_icon[$gender->id] = '../genders/' . (int) $gender->id . '.jpg';
         $genders[$gender->id] = $gender->name;
     }
     $customer_fields_display = array('id_customer' => array('title' => $this->l('ID'), 'width' => 15, 'align' => 'center'), 'id_gender' => array('title' => $this->l('Titles'), 'align' => 'center', 'width' => 50, 'icon' => $genders_icon, 'list' => $genders), 'firstname' => array('title' => $this->l('Name'), 'align' => 'center'), 'lastname' => array('title' => $this->l('Name'), 'align' => 'center'), 'email' => array('title' => $this->l('E-mail address'), 'width' => 150, 'align' => 'center'), 'birthday' => array('title' => $this->l('Birth date'), 'width' => 150, 'align' => 'right', 'type' => 'date'), 'date_add' => array('title' => $this->l('Register date'), 'width' => 150, 'align' => 'right', 'type' => 'date'), 'orders' => array('title' => $this->l('Orders'), 'align' => 'center'), 'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'width' => 20, 'active' => 'status', 'type' => 'bool'));
     $customer_list = $group->getCustomers(false);
     $helper = new HelperList();
     $helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false);
     $helper->token = Tools::getAdminTokenLite('AdminCustomers');
     $helper->shopLinkType = '';
     $helper->table = 'customer';
     $helper->identifier = 'id_customer';
     $helper->actions = array('edit', 'view');
     $helper->show_toolbar = false;
     return $helper->generateList($customer_list, $customer_fields_display);
 }
 public function renderList()
 {
     $shops = Shop::getContextListShopID();
     $links = array();
     foreach ($shops as $shop_id) {
         $links = array_merge($links, MenuTopLinks::gets((int) $this->context->language->id, null, (int) $shop_id));
     }
     $fields_list = array('id_linksmenutop' => array('title' => $this->l('Link ID'), 'type' => 'text'), 'name' => array('title' => $this->l('Shop name'), 'type' => 'text'), 'label' => array('title' => $this->l('Label'), 'type' => 'text'), 'link' => array('title' => $this->l('Link'), 'type' => 'link'), 'new_window' => array('title' => $this->l('New window'), 'type' => 'bool', 'align' => 'center', 'active' => 'status'));
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->identifier = 'id_linksmenutop';
     $helper->table = 'linksmenutop';
     $helper->actions = array('edit', 'delete');
     $helper->show_toolbar = false;
     $helper->module = $this;
     $helper->title = $this->l('Link list');
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     return $helper->generateList($links, $fields_list);
 }
 public function ajaxProcess()
 {
     // get product list of order
     if (Tools::isSubmit('action') && Tools::isSubmit('id') && (Tools::getValue('action') == 'detailsAjax' || Tools::getValue('action') == 'details')) {
         // override attributes
         $this->identifier = 'id_order_detail';
         $this->display = 'list';
         $this->lang = false;
         $this->explicitSelect = false;
         $this->actions = array();
         // get current lang id
         $lang_id = (int) $this->context->language->id;
         // Get order id
         $order_id = (int) Tools::getValue('id');
         $this->fields_list = array('product_name' => array('title' => $this->l('Product name'), 'callback' => 'getProductLinkTag'), 'product_quantity' => array('title' => $this->l('Quantity'), 'align' => 'center'), 'product_reference' => array('title' => $this->l('Product Reference')), 'unit_price_tax_incl' => array('title' => $this->l('Unit price ti'), 'type' => 'price'), 'total_price_tax_incl' => array('title' => $this->l('Total price ti'), 'type' => 'price'), 'stock_level_color' => array('title' => $this->l('Stock level'), 'align' => 'center', 'callback' => 'gestockLevelColor'));
         // Load product attributes with sql override
         $this->table = 'order_detail';
         unset($this->_join);
         $this->_select = null;
         $this->_select = 'i.id_image, a.product_name, a.product_quantity, a.product_reference,a.unit_price_tax_incl, a.total_price_tax_incl';
         $this->_join = ' LEFT JOIN ' . _DB_PREFIX_ . 'image i ON a.product_id = i.id_product
                         INNER JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (a.product_id = pl.id_product AND pl.id_lang = ' . (int) $this->context->language->id . ') ';
         $this->_where = ' AND a.id_order = ' . $order_id;
         $this->_group = ' GROUP BY a.id_order_detail ';
         // get list and force no limit clause in the request
         $this->getList($lang_id, 'a.product_name', 'ASC', 0, false);
         // Render list
         $helper = new HelperList();
         $helper->bulk_actions = array();
         $helper->toolbar_scroll = $this->toolbar_scroll;
         $helper->show_toolbar = false;
         $helper->actions = $this->actions;
         $helper->list_skip_actions = $this->list_skip_actions;
         $helper->no_link = true;
         $helper->shopLinkType = '';
         $helper->identifier = $this->identifier;
         // Force render - no filter, form, js, sorting ...
         $helper->simple_header = true;
         $helper->override_folder = 'advanced_order_ajax/';
         $content = $helper->generateList($this->_list, $this->fields_list);
         echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
     } elseif (Tools::isSubmit('task') && Tools::getValue('task') == 'getOrdersWithSameProduct') {
         $this->ajaxGetOrdersWithSameProduct();
     } elseif (Tools::isSubmit('task') && Tools::getValue('task') == 'getProducts') {
         $this->ajaxGetProducts();
     } elseif (Tools::isSubmit('task') && Tools::getValue('task') == 'updateOrderStatus') {
         include_once _PS_MODULE_DIR_ . 'erpillicopresta/ajax/ajax.php';
     } else {
         echo 'error';
     }
     die;
 }