lang = TRUE; parent::__construct(); $this->imagelist = array( 'thumb' => array($this->l('Thumbnail'), '260x108'), 'liston' => array($this->l('Listing image (on)'), '380x178'), 'listoff' => array($this->l('Listing image (off)'), '380x178'), 'fb' => array($this->l('Facebook image'), '100x100'), 'trailerbg' => array($this->l('Trailer background'), '*x*'), 'trailercenter' => array($this->l('Trailer center background'), '560x*'), ); } public function displayForm($isMainTab=TRUE) { global $currentIndex, $cookie; parent::displayForm(); $iso = Language::getIsoById((int)($cookie->id_lang)); $images = array(); foreach(array_keys($this->imagelist) as $img) { $images[] = 'img_'.$img; } $divLangName = 'description¤video¤'.implode('¤', $images); echo '
'; } public function display() { global $cookie, $currentIndex; $this->cursale = NULL; if($id = Tools::getValue('id')) { $this->cursale = new Sale($id); if($this->cursale->id === NULL) { Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales')); } } // // ANTADIS INSERT TYPE // $ventes = Sale::getSales(NULL, NULL, NULL, NULL , FALSE, FALSE, 'position ASC'); // foreach ($ventes as $key => $vente) { // global $cookie; // if($cookie->id_employee == 1){ // Db::getInstance()->autoExecute('ps_privatesale_type', array( // 'id_sale' => $vente->id, // 'id_sale_type' => $vente->sale_type, // ), 'INSERT'); // } // } $this->displayForm(); $export = Module::isInstalled('exports'); $employees = array(); foreach(Db::getInstance()->ExecuteS(' SELECT `id_employee`, `firstname`, `lastname` FROM `'._DB_PREFIX_.'employee` ') as $row) { $employees[(int) $row['id_employee']] = $row['firstname'].' '.$row['lastname']; } //ANTADIS echo ''; ?> '; echo ''; } public static function getSaleType($sale_type){ $type = ""; if(in_array(1, $sale_type)){ $type.= "Bébé "; } if(in_array(2, $sale_type)){ $type.= "Enfant "; } if(in_array(3, $sale_type)){ $type.= "Maman "; } if(empty($type)){ return "undefined"; } return $type; } public function postProcess() { global $cookie, $currentIndex; if(Tools::isSubmit('submitSaleAdd')) { if (Sale::getSaleFromCategory(Tools::getValue('id_category'))) { return false; } $sql_position = 'SELECT MAX(position) FROM '. _DB_PREFIX_.'privatesale'; $position = Db::getInstance()->getValue($sql_position); $sale = new Sale(); $sale->date_start = Tools::getValue('date_start', '0000-00-00 00:00:00'); $sale->date_end = Tools::getValue('date_end', '0000-00-00 00:00:00'); $sale->id_country = (int) Tools::getValue('id_country'); $sale->enabled = Tools::getValue('enabled', 0); $sale->featured = Tools::getValue('featured', 0); $sale->logout = Tools::getValue('logout', 0); $sale->new = Tools::getValue('new', 0); $sale->braderie = Tools::getValue('braderie', 0); $sale->forward_news = Tools::getValue('forward_news', 0); $sale->pub = Tools::getValue('pub', 0); $sale->id_category = Tools::getValue('id_category', Configuration::get('PRIVATESALES_ROOT')); $sale->id_employee = (int) Tools::getValue('id_employee'); $sale->delivery_delay = (int) Tools::getValue('delivery_delay'); $sale->sale_type = array(); $sale->versions = array(); foreach(Tools::getValue('sale_type', array()) as $sale_type) { $sale->sale_type[] = (int) $sale_type; } foreach(Language::getLanguages(FALSE) as $language) { if($description = Tools::getValue('description_'.$language['id_lang'])) { $sale->description[$language['id_lang']] = $description; } else { $sale->description[$language['id_lang']] = ''; } if($video = Tools::getValue('video_'.$language['id_lang'])) { $sale->video[$language['id_lang']] = $video; } else { $sale->video[$language['id_lang']] = ''; } } foreach(Tools::getValue('m_groups', array()) as $group) { $sale->groups[] = (int) $group; } foreach(Tools::getValue('m_versions', array()) as $version) { $sale->versions[] = pSql($version); } foreach(Tools::getValue('m_carriers', array()) as $carrier) { $sale->carriers[] = (int) $carrier; } if( empty($sale->carriers)) { echo '