/**
  * Build List linked Icons Toolbar
  */
 public function initPageHeaderToolbar()
 {
     if (empty($this->display)) {
         $this->page_header_toolbar_btn['save'] = array('href' => 'index.php?tab=AdminLeotempcpPanel&token=' . Tools::getAdminTokenLite('AdminLeotempcpPanel') . '&action=savepos', 'id' => 'savepos', 'desc' => $this->l('Save Positions'));
     }
     parent::initPageHeaderToolbar();
 }
Example #2
0
 public function __construct()
 {
     $url = 'index.php?controller=adminmodules&configure=leotempcp&tab_module=Home&module_name=leotempcp&token=' . Tools::getAdminTokenLite('AdminModules');
     Tools::redirectAdmin($url);
     $this->bootstrap = true;
     $this->className = 'Configuration';
     $this->table = 'configuration';
     $this->themeName = Context::getContext()->shop->getTheme();
     parent::__construct();
 }
 public function initToolbarTitle()
 {
     parent::initToolbarTitle();
     $this->toolbar_title = $this->l("LeoTheme Positions Control: " . $this->theme_name);
     $this->toolbar_btn['save'] = array('href' => 'index.php?tab=AdminLeotempcpPanel&token=' . Tools::getAdminTokenLite('AdminLeotempcpPanel') . '&action=savepos', 'id' => 'savepos', 'desc' => $this->l('Save Positions'));
     $this->toolbar_btn['controlpanel'] = array('href' => 'index.php?controller=adminmodules&configure=leotempcp&token=' . Tools::getAdminTokenLite('AdminModules') . '&tab_module=Home&module_name=leotempcp', 'id' => 'controlpanel', 'desc' => $this->l('Theme Control Panel'));
     $admin_dir = basename(_PS_ADMIN_DIR_);
     $live_edit_params = array('live_edit' => true, 'ad' => $admin_dir, 'liveToken' => Tools::getAdminTokenLite('AdminModulesPositions'), 'id_employee' => (int) $this->context->employee->id);
     $this->toolbar_btn['liveedit'] = array('href' => $this->getLiveEditUrl($live_edit_params), 'id' => 'liveedit', 'desc' => $this->l('Live Edit'));
     $helpURL = __PS_BASE_URI__ . str_replace("//", "/", 'modules/leotempcp') . "/help/help.pdf";
     $this->toolbar_btn['help'] = array('href' => $helpURL, 'id' => 'help', 'jsddd' => 'showHelp(\'' . $helpURL . '\')', 'desc' => $this->l('Help'));
 }
Example #4
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->table = 'leohook';
     $this->className = 'LeotempcpPanel';
     $this->bootstrap = true;
     $this->lang = true;
     $this->context = Context::getContext();
     parent::__construct();
     $this->display_key = (int) Tools::getValue('show_modules');
     $this->ownPositions = array('displayHeaderRight', 'displaySlideshow', 'topNavigation', 'displayBottom');
     $this->hookspos = array('displayTop', 'displayHeaderRight', 'displaySlideshow', 'topNavigation', 'displayTopColumn', 'displayRightColumn', 'displayLeftColumn', 'displayHome', 'displayFooter', 'displayBottom', 'displayContentBottom', 'displayFootNav');
     $this->themeName = Context::getContext()->shop->getTheme();
     $this->themeCustomizePath = _PS_ALL_THEMES_DIR_ . $this->themeName . '/css/customize/';
     $this->themeCustomizeURL = $this->context->shop->getBaseURL() . '/themes/' . $this->themeName . '/css/customize/';
 }
 public function renderForm()
 {
     if (!$this->loadObject(true)) {
         if (Validate::isLoadedObject($this->object)) {
             $this->display = 'edit';
         } else {
             $this->display = 'add';
         }
     }
     $this->initToolbar();
     $this->initPageHeaderToolbar();
     $this->multiple_fieldsets = true;
     $this->fields_form[0]['form'] = array('tinymce' => true, 'legend' => array('title' => $this->l('Citys'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'hidden', 'label' => $this->l('id'), 'name' => 'id_egms_city'), array('type' => 'text', 'label' => $this->l('cityname1'), 'name' => 'cityname1', 'required' => true, 'hint' => $this->l('cityname1')), array('type' => 'text', 'label' => $this->l('cityname2'), 'name' => 'cityname2', 'required' => true, 'hint' => $this->l('cityname2')), array('type' => 'text', 'label' => $this->l('cityname3'), 'name' => 'cityname3', 'required' => true, 'hint' => $this->l('cityname3')), array('type' => 'text', 'label' => $this->l('psyname'), 'name' => 'psyname', 'hint' => $this->l('psyname')), array('type' => 'text', 'label' => $this->l('alias'), 'name' => 'alias', 'hint' => $this->l('alias'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-default pull-right'));
     $this->tpl_form_vars = array('fields_value' => $this->getFieldsValues());
     return parent::renderForm();
 }
 public function setMedia()
 {
     parent::setMedia();
     $this->addJqueryUi('ui.widget');
     $this->addJqueryPlugin('tagify');
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->module->l('Product type', 'AdminNowProductType'), 'icon' => 'icon-money'), 'input' => array(array('type' => 'text', 'label' => $this->module->l('Name', 'AdminNowProductType'), 'name' => 'name', 'required' => true, 'lang' => true), array('type' => 'text', 'label' => $this->module->l('Button name', 'AdminNowProductType'), 'name' => 'button_name', 'required' => true, 'lang' => true), array('type' => 'select', 'label' => $this->module->l('Type de page', 'AdminNowProductType'), 'name' => 'type', 'required' => true, 'default_value' => 'CONTENT', 'options' => array('query' => array(array('id' => 'CONTENT', 'name' => $this->module->l('Contenu', 'AdminNowProductType')), array('id' => 'BUTTON', 'name' => $this->module->l('Bouton', 'AdminNowProductType'))), 'id' => 'id', 'name' => 'name')), array('type' => 'switch', 'label' => $this->module->l('Enable', 'AdminNowProductType'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowProductType')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowProductType'))))), 'submit' => array('title' => $this->module->l('Save', 'AdminNowProductType')));
     return parent::renderForm();
 }
 public function postProcess()
 {
     if ((Tools::isSubmit('saveleotempcp') || Tools::isSubmit('saveandstayleotempcp')) && Tools::isSubmit('widgets')) {
         if (!Tools::getValue('widget_name')) {
             $this->errors[] = Tools::displayError('Widget Name Empty !');
         }
         if (!count($this->errors)) {
             if (Tools::getValue('id_leowidgets')) {
                 $model = new LeoTempcpWidget((int) Tools::getValue('id_leowidgets'));
             } else {
                 $model = $this->widget;
             }
             $model->loadEngines();
             $model->id_shop = Context::getContext()->shop->id;
             //				$id_lang_default = (int)Configuration::get('PS_LANG_DEFAULT');
             $languages = Language::getLanguages(false);
             $tmp = array();
             $post = LeomanagewidgetsHelper::getPost();
             $widget_type = Tools::getValue('widget_type');
             # GET POST - BEGIN
             $widget_type = Tools::getValue('widget_type');
             $file_name = _PS_MODULE_DIR_ . 'leomanagewidgets/classes/widget/' . $widget_type . '.php';
             require_once $file_name;
             $class_name = 'LeoWidget' . Tools::ucfirst($widget_type);
             $widget = new $class_name();
             $keys = array('addleowidgets', 'id_leowidgets', 'widget_name', 'widget_type', 'saveandstayleotempcp');
             $post = LeomanagewidgetsHelper::getPost($keys, 0);
             $keys = array('widget_title');
             $post += LeomanagewidgetsHelper::getPost($keys, 1);
             $keys = $widget->getConfigKey(0);
             $post += LeomanagewidgetsHelper::getPost($keys, 0);
             $keys = $widget->getConfigKey(1);
             $post += LeomanagewidgetsHelper::getPost($keys, 1);
             $keys = $widget->getConfigKey(2);
             $post += LeomanagewidgetsHelper::getPost($keys, 2);
             # GET POST - END
             foreach ($post as $key => $value) {
                 $tmp[$key] = str_replace(array('\'', '\\"'), array("'", '"'), $value);
                 foreach ($this->_langField as $fVal) {
                     if (strpos($key, $fVal) !== false) {
                         foreach ($languages as $language) {
                             if (Tools::getIsset($fVal . '_' . $language['id_lang'])) {
                                 $valueLang = Tools::getValue($fVal . '_' . $language['id_lang']);
                                 if (empty($valueLang)) {
                                     $tmp[$fVal . '_' . $language['id_lang']] = $value;
                                 }
                             }
                         }
                     }
                 }
             }
             $data = array('id' => Tools::getValue('id_leowidgets'), 'params' => call_user_func('base64' . '_encode', Tools::jsonEncode($tmp)), 'type' => Tools::getValue('widget_type'), 'name' => Tools::getValue('widget_name'));
             foreach ($data as $k => $v) {
                 $model->{$k} = $v;
             }
             if ($model->id) {
                 if (!$model->update()) {
                     $this->errors[] = Tools::displayError('Can not update new widget');
                 } else {
                     if (Tools::isSubmit('saveandstayleotempcp')) {
                         $this->confirmations[] = $this->l('Update successful');
                         $model->clearCaches();
                         Tools::redirectAdmin(self::$currentIndex . '&id_leowidgets=' . $model->id . '&updateleowidgets&token=' . $this->token . '&conf=4');
                     } else {
                         Tools::redirectAdmin(self::$currentIndex . '&token=' . $this->token . '&conf=4');
                     }
                 }
             } else {
                 $model->key_widget = time();
                 if (!$model->add()) {
                     $this->errors[] = Tools::displayError('Can not add new widget');
                 } else {
                     if (Tools::isSubmit('saveandstayleotempcp')) {
                         $this->confirmations[] = $this->l('Update successful');
                         $model->clearCaches();
                         Tools::redirectAdmin(self::$currentIndex . '&id_leowidgets=' . $model->id . '&updateleowidgets&token=' . $this->token . '&conf=4');
                     } else {
                         Tools::redirectAdmin(self::$currentIndex . '&token=' . $this->token . '&conf=4');
                     }
                 }
             }
         }
     }
     if (Tools::isSubmit('submitBulkcorrectlinkleowidgets')) {
         $leowidgetsBox = Tools::getValue('leowidgetsBox');
         if ($leowidgetsBox) {
             foreach ($leowidgetsBox as $widgetID) {
                 $model = new LeoTempcpWidget($widgetID);
                 $params = Tools::jsonDecode(call_user_func('base64' . '_decode', $model->params), true);
                 $tmp = array();
                 foreach ($params as $widKey => $widValue) {
                     foreach ($this->_imageField as $fVal) {
                         if (strpos($widKey, $fVal) !== false && strpos($widValue, 'img') !== false) {
                             //                            $widValue = str_replace('src="' . __PS_BASE_URI__ . 'modules/', 'src="' . __PS_BASE_URI__ . 'themes/'.$this->_theme_dir.'/img/modules/', $widValue);
                             //                            $patterns = array('/\/leomanagewidgets\/data\//','/\/leobootstrapmenu\/img\//','/\/leobootstrapmenu\/images\//'
                             //                                ,'/\/leomanagewidgets\/images\//','/\/leomenusidebar\/images\//');
                             //                            $replacements = array('/leomanagewidgets/','/leobootstrapmenu/','/leobootstrapmenu/','/leomanagewidgets/','/leomenusidebar/');
                             //                            $widValue = preg_replace($patterns, $replacements, $widValue);
                             $widValue = preg_replace('/\\/themes\\/(\\w+)\\/img/', '/themes/' . $this->_theme_dir . '/img', $widValue);
                             break;
                         }
                     }
                     $tmp[$widKey] = $widValue;
                 }
                 $model->params = call_user_func('base64' . '_encode', Tools::jsonEncode($tmp));
                 $model->save();
             }
         }
     }
     if (Tools::isSubmit('submitBulkinsertLangleowidgets')) {
         $leowidgetsBox = Tools::getValue('leowidgetsBox');
         $id_currentLang = $this->context->language->id;
         $languages = Language::getLanguages(false);
         if ($leowidgetsBox) {
             foreach ($leowidgetsBox as $widgetID) {
                 $model = new LeoTempcpWidget($widgetID);
                 $tmp = Tools::jsonDecode(call_user_func('base64' . '_decode', $model->params), true);
                 $defauleVal = array();
                 if ($tmp) {
                     foreach ($tmp as $widKey => $widValue) {
                         $defaulArray = explode('_', $widKey);
                         if (strpos($widKey, '_' . $id_currentLang) !== false && $defaulArray[count($defaulArray) - 1] == $id_currentLang) {
                             $defauleVal[$widKey] = $widValue;
                         }
                     }
                 }
                 if ($defauleVal) {
                     foreach ($languages as $lang) {
                         if ($lang['id_lang'] == $id_currentLang) {
                             continue;
                         }
                         foreach ($defauleVal as $widKey => $widValue) {
                             $keyRemove = Tools::substr($widKey, 0, -Tools::strlen('_' . $id_currentLang));
                             $keyReal = $keyRemove . '_' . $lang['id_lang'];
                             if (!isset($tmp[$keyReal]) || trim($tmp[$keyReal]) == '') {
                                 $tmp[$keyReal] = $widValue;
                             }
                         }
                     }
                 }
                 if ($defauleVal) {
                     $model->params = call_user_func('base64' . '_encode', Tools::jsonEncode($tmp));
                     $model->save();
                 }
             }
         }
     }
     if (Tools::isSubmit('submitBulkcorrectContentleowidgets')) {
         $leowidgetsBox = Tools::getValue('leowidgetsBox');
         $id_currentLang = $this->context->language->id;
         $languages = Language::getLanguages(false);
         if ($leowidgetsBox) {
             foreach ($leowidgetsBox as $widgetID) {
                 $model = new LeoTempcpWidget($widgetID);
                 $tmp = @unserialize($model->params);
                 if (!$tmp) {
                     $tmp = Tools::json_decode($model->params, true);
                 }
                 if ($tmp) {
                     $model->params = call_user_func('base64' . '_encode', Tools::jsonEncode($tmp));
                     $model->save();
                 }
             }
         }
     }
     parent::postProcess();
 }
 public function setMedia()
 {
     $this->addCSS(array($this->module->module_uri . 'css/bootstrap.min.css' => 'all', $this->module->module_uri . 'css/DT_bootstrap.css' => 'all', $this->module->module_uri . 'css/' . $this->module->name . '.css' => 'all'));
     parent::setMedia();
     $this->addJS(array($this->module->module_uri . 'js/jquery.dataTables.js', $this->module->module_uri . 'js/' . $this->module->name . '.js'));
     $this->addjqueryPlugin('fancybox');
 }
 public function renderList()
 {
     $this->toolbar_title = $this->l('Comments Management');
     $this->toolbar_btn['new'] = null;
     return parent::renderList();
 }
 /**
  * @return mixed
  */
 public function renderform()
 {
     $this->fields_form = array('legend' => array('title' => $this->module->l('Add or Update a delivery time rule', 'AdminNowDeliveryTime'), 'icon' => 'icon-settings'), 'input' => array(array('type' => 'select', 'label' => $this->module->l('Carrier', 'AdminNowDeliveryTime'), 'name' => 'id_carrier', 'required' => true, 'options' => array('query' => Carrier::getCarriers(Context::getContext()->language->id, true), 'id' => 'id_carrier', 'name' => 'name')), array('type' => 'switch', 'label' => $this->module->l('Saturday shipping', 'AdminNowDeliveryTime'), 'name' => 'saturday_shipping', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowDeliveryTime')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowDeliveryTime')))), array('type' => 'switch', 'label' => $this->module->l('Sunday shipping', 'AdminNowDeliveryTime'), 'name' => 'sunday_shipping', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowDeliveryTime')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowDeliveryTime')))), array('type' => 'switch', 'label' => $this->module->l('Shipping holidays', 'AdminNowDeliveryTime'), 'name' => 'shipping_holidays', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowDeliveryTime')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowDeliveryTime')))), array('type' => 'switch', 'label' => $this->module->l('Saturday delivery', 'AdminNowDeliveryTime'), 'name' => 'saturday_delivery', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowDeliveryTime')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowDeliveryTime')))), array('type' => 'switch', 'label' => $this->module->l('Sunday delivery', 'AdminNowDeliveryTime'), 'name' => 'sunday_delivery', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowDeliveryTime')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowDeliveryTime')))), array('type' => 'switch', 'label' => $this->module->l('Delivery holidays', 'AdminNowDeliveryTime'), 'name' => 'delivery_holidays', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowDeliveryTime')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowDeliveryTime')))), array('type' => 'text', 'label' => $this->module->l('Minimum day', 'AdminNowDeliveryTime'), 'name' => 'day_min', 'required' => true, 'suffix' => $this->module->l('days', 'AdminNowDeliveryTime')), array('type' => 'text', 'label' => $this->module->l('Maximum day', 'AdminNowDeliveryTime'), 'name' => 'day_max', 'required' => true, 'suffix' => $this->module->l('days', 'AdminNowDeliveryTime')), array('type' => 'textarea', 'label' => $this->module->l('Description', 'AdminNowDeliveryTime'), 'name' => 'description', 'lang' => true), array('type' => 'textarea', 'label' => $this->module->l('Timeslot', 'AdminNowDeliveryTime'), 'name' => 'timeslot', 'lang' => true)), 'submit' => array('title' => $this->module->l('Save', 'AdminNowDeliveryTime')));
     return parent::renderForm();
 }
 public function renderForm()
 {
     if (!$this->loadObject(true)) {
         if (Validate::isLoadedObject($this->object)) {
             $this->display = 'edit';
         } else {
             $this->display = 'add';
         }
     }
     $this->initToolbar();
     $this->initPageHeaderToolbar();
     $this->multiple_fieldsets = true;
     $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('tinymce' => true, 'legend' => array('title' => $this->l('Shops by Citys'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'hidden', 'label' => $this->l('id'), 'name' => 'id_egms_cu'), array('type' => 'select', 'label' => $this->l('Citys'), 'name' => 'id_city', 'required' => true, 'options' => array('query' => $this->citys, 'id' => 'id', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Shop URL'), 'name' => 'id_shop_url', 'required' => true, 'options' => array('query' => $this->urls, 'id' => 'id', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('veryf_yandex'), 'name' => 'veryf_yandex', 'hint' => $this->l('veryf_yandex')), array('type' => 'text', 'label' => $this->l('veryf_google'), 'name' => 'veryf_google', 'hint' => $this->l('veryf_google')), array('type' => 'text', 'label' => $this->l('veryf_mail'), 'name' => 'veryf_mail', 'hint' => $this->l('veryf_mail')), array('type' => 'text', 'label' => $this->l('phone'), 'name' => 'phone', 'hint' => $this->l('phone')), array('type' => 'switch', 'label' => $this->l('Is Active'), 'name' => 'active', 'values' => $soption, 'default' => '1'), array('type' => 'checkbox', 'label' => $this->l('Manufacturers'), 'multiple' => true, 'name' => 'manufacturer', 'hint' => $this->l('Manufacturers hint'), 'desc' => $this->l('Manufacturers'), 'values' => array('query' => $this->manufacturers, 'id' => 'id', 'name' => 'name'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-default pull-right'));
     $this->tpl_form_vars = array('fields_value' => $this->getFieldsValues());
     return parent::renderForm();
 }
 /**
  * @return mixed
  */
 public function renderform()
 {
     $this->fields_form = array('legend' => array('title' => $this->module->l('Add or Update holidays date or public holidays date', 'AdminNowHolidays'), 'icon' => 'icon-settings'), 'input' => array(array('type' => 'text', 'label' => $this->module->l('Evenment name', 'AdminNowHolidays'), 'required' => true, 'name' => 'evenment_name'), array('type' => 'select', 'label' => $this->module->l('Type', 'AdminNowHolidays'), 'name' => 'type', 'required' => true, 'options' => array('query' => array(array('id' => NowHolidays::PUBLIC_HOLIDAYS, 'name' => $this->module->l('Public holidays', 'AdminNowHolidays')), array('id' => NowHolidays::HOLIDAYS, 'name' => $this->module->l('Holidays', 'AdminNowHolidays'))), 'id' => 'id', 'name' => 'name')), array('type' => 'date', 'label' => $this->module->l('Start date', 'AdminNowHolidays'), 'required' => true, 'name' => 'date_start'), array('type' => 'date', 'label' => $this->module->l('End date', 'AdminNowHolidays'), 'required' => true, 'name' => 'date_end'), array('type' => 'switch', 'label' => $this->module->l('Preparation', 'AdminNowHolidays'), 'hint' => $this->module->l('Indicate whether the preparation of orders not will be carried out over this period', 'AdminNowHolidays'), 'name' => 'preparation', 'required' => true, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowHolidays')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowHolidays')))), array('type' => 'switch', 'label' => $this->module->l('Shipping', 'AdminNowHolidays'), 'hint' => $this->module->l('Indicate whether the shipment of orders not will be carried out over this period', 'AdminNowHolidays'), 'name' => 'shipping', 'required' => true, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowHolidays')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowHolidays')))), array('type' => 'switch', 'label' => $this->module->l('Delivery', 'AdminNowHolidays'), 'hint' => $this->module->l('Indicate whether the delivery of orders not will be carried out over this period', 'AdminNowHolidays'), 'name' => 'delivery', 'required' => true, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowHolidays')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowHolidays'))))), 'submit' => array('title' => $this->module->l('Save', 'AdminNowHolidays')));
     return parent::renderForm();
 }