/**
  * Install Module Tabs
  */
 private function installModuleTab($title, $class_sfx = '', $parent = '')
 {
     $class = 'Admin' . Tools::ucfirst($this->name) . Tools::ucfirst($class_sfx);
     if ($parent == '') {
         $position = Tab::getCurrentTabId();
     } else {
         $position = Tab::getIdFromClassName($parent);
     }
     $tab = new Tab();
     $tab->class_name = $class;
     $tab->module = $this->name;
     $tab->id_parent = (int) $position;
     $langs = Language::getLanguages(false);
     foreach ($langs as $l) {
         $tab->name[$l['id_lang']] = $title;
     }
     return $tab->add(true, false);
 }
Exemple #2
0
 public function getContent()
 {
     /* Update the Configuration option values depending on which form has been submitted */
     if (Tools::isSubmit('SubmitBasicSettings')) {
         $this->_saveSettingsBasic();
     }
     /* VTPayment API credentials should be filled */
     if (Configuration::get('VTPAYMENT_GATEWAY_URL') == '' || Configuration::get('VTPAYMENT_MERCHANT_ID') == '' || Configuration::get('VTPAYMENT_SECRET_KEY') == '') {
         $this->_warning[] = $this->displayError($this->l('In order to use VTPayment, please provide your API credentials.'));
     }
     // add 1.4 token support
     if (method_exists('Tools', 'getAdminTokenLite')) {
         $token = Tools::getAdminTokenLite('AdminModules');
     } else {
         $tabid = (int) Tab::getCurrentTabId();
         $employee_id = (int) $this->context->cookie->id_employee;
         $token = 'AdminModules' . $tabid . $employee_id;
         $token = Tools::getAdminToken($token);
     }
     $this->context->smarty->assign(array('vtpayment_form_link' => './index.php?tab=AdminModules&configure=vtpayment&token=' . Tools::getAdminTokenLite('AdminModules') . '&tab_module=' . $this->tab . '&module_name=vtpayment', 'vtpayment_validation' => empty($this->_validation) ? false : $this->_validation, 'vtpayment_error' => empty($this->_error) ? false : $this->_error, 'vtpayment_warning' => empty($this->_warning) ? false : $this->_warning, 'vtpayment_configuration' => Configuration::getMultiple(array('VTPAYMENT_GATEWAY_URL', 'VTPAYMENT_MERCHANT_ID', 'VTPAYMENT_SECRET_KEY'))));
     return $this->display(__FILE__, 'views/templates/admin/configuration.tpl');
 }
Exemple #3
0
 /**
  * Install Module Tabs
  */
 private function installModuleTab($title, $class_sfx = '', $parent = '')
 {
     $class = 'Admin' . Tools::ucfirst($this->name) . Tools::ucfirst($class_sfx);
     @copy(_PS_MODULE_DIR_ . $this->name . '/logo.gif', _PS_IMG_DIR_ . 't/' . $class . '.gif');
     if ($parent == '') {
         # validate module
         $position = Tab::getCurrentTabId();
     } else {
         # validate module
         $position = Tab::getIdFromClassName($parent);
     }
     $tab1 = new Tab();
     $tab1->class_name = $class;
     $tab1->module = $this->name;
     $tab1->id_parent = (int) $position;
     $langs = Language::getLanguages(false);
     foreach ($langs as $l) {
         # validate module
         $tab1->name[$l['id_lang']] = $title;
     }
     //        $id_tab1 = $tab1->add(true, false);
     $tab1->add(true, false);
 }
Exemple #4
0
 public function __construct()
 {
     global $cookie;
     $this->id = Tab::getCurrentTabId();
     $this->_conf = array(1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'), 3 => $this->l('Creation successful'), 4 => $this->l('Update successful'), 5 => $this->l('Status update successful'), 6 => $this->l('Settings update successful'), 7 => $this->l('Image successfully deleted'), 8 => $this->l('Module downloaded successfully'), 9 => $this->l('Thumbnails successfully regenerated'), 10 => $this->l('Message sent to the customer'), 11 => $this->l('Comment added'), 12 => $this->l('Module installed successfully'), 13 => $this->l('Module uninstalled successfully'), 14 => $this->l('Language successfully copied'), 15 => $this->l('Translations successfully added'), 16 => $this->l('Module transplanted successfully to hook'), 17 => $this->l('Module removed successfully from hook'), 18 => $this->l('Upload successful'), 19 => $this->l('Duplication completed successfully'), 20 => $this->l('Translation added successfully but the language has not been created'), 21 => $this->l('Module reset successfully'), 22 => $this->l('Module deleted successfully'), 23 => $this->l('Localization pack imported successfully'), 24 => $this->l('Refund Successful'), 25 => $this->l('Images successfully moved'));
     if (!$this->identifier) {
         $this->identifier = 'id_' . $this->table;
     }
     if (!$this->_defaultOrderBy) {
         $this->_defaultOrderBy = $this->identifier;
     }
     $className = get_class($this);
     if ($className == 'AdminCategories' or $className == 'AdminProducts') {
         $className = 'AdminCatalog';
     }
     $this->token = Tools::getAdminToken($className . (int) $this->id . (int) $cookie->id_employee);
 }
Exemple #5
0
 public function __construct()
 {
     global $cookie;
     $this->id = Tab::getCurrentTabId();
     $this->_conf = array(1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'), 3 => $this->l('Creation successful'), 4 => $this->l('Update successful'), 5 => $this->l('Status update successful'), 6 => $this->l('Settings update successful'), 7 => $this->l('Image successfully deleted'), 8 => $this->l('Module downloaded successfully'), 9 => $this->l('Thumbnails successfully regenerated'), 10 => $this->l('Message sent to the customer'), 11 => $this->l('Comment added'), 12 => $this->l('Module installed successfully'), 13 => $this->l('Module uninstalled successfully'), 14 => $this->l('Language successfully copied'), 15 => $this->l('Translations successfully added'), 16 => $this->l('Module transplanted successfully to hook'), 17 => $this->l('Module removed successfully from hook'), 18 => $this->l('Upload successful'), 19 => $this->l('Duplication successfully done'), 20 => $this->l('Translation added successfully but the language has been not created'));
     if (!$this->identifier) {
         $this->identifier = 'id_' . $this->table;
     }
     if (!$this->_defaultOrderBy) {
         $this->_defaultOrderBy = $this->identifier;
     }
     $this->token = Tools::getAdminToken(get_class($this) . intval($this->id) . intval($cookie->id_employee));
 }
Exemple #6
0
 protected function displayFormSettings()
 {
     $helper = new HelperOptions();
     // Helper Options
     $helper->required = false;
     $helper->id = Tab::getCurrentTabId();
     //always Tab::getCurrentTabId() at helper option
     // Helper
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $helper->table = '';
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->module = $this;
     $helper->identifier = null;
     //alway null at helper option
     $helper->toolbar_btn = null;
     //alway null at helper option
     $helper->ps_help_context = null;
     //alway null at helper option
     $helper->title = null;
     //alway null at helper option
     $helper->show_toolbar = true;
     //alway true at helper option
     $helper->toolbar_scroll = false;
     //alway false at helper option
     $helper->bootstrap = false;
     //alway false at helper option
     $this->getOptionFieldsSettings();
     return $helper->generateOptions($this->option_fields_settings);
 }
 public function getContent()
 {
     /* Loading CSS and JS files */
     // 2013-11-8 add 1.4 support
     if (isset($this->context->controller)) {
         $this->context->controller->addCSS(array($this->_path . 'css/paypal-usa.css', $this->_path . 'css/colorpicker.css'));
         $this->context->controller->addJS(array(_PS_JS_DIR_ . 'jquery/jquery-ui-1.8.10.custom.min.js', $this->_path . 'js/colorpicker.js', $this->_path . 'js/jquery.lightbox_me.js', $this->_path . 'js/paypalusa.js'));
     }
     /* Update the Configuration option values depending on which form has been submitted */
     if (Validate::isLoadedObject($this->_shop_country) && $this->_shop_country->iso_code == 'MX' && Tools::isSubmit('SubmitBasicSettings')) {
         $this->_saveSettingsProducts();
         $this->_saveSettingsBasic();
         unset($this->_validation[count($this->_validation) - 1]);
     } elseif (Tools::isSubmit('SubmitPayPalProducts')) {
         $this->_saveSettingsProducts();
     } elseif (Tools::isSubmit('SubmitBasicSettings')) {
         $this->_saveSettingsBasic();
     } elseif (Tools::isSubmit('SubmitAdvancedSettings')) {
         $this->_saveSettingsAdvanced();
     }
     /* If PayPal Payments Advanced has been enabled, the Shop country has to be USA */
     if (Configuration::get('PAYPAL_USA_PAYMENT_ADVANCED') && Validate::isLoadedObject($this->_shop_country) && $this->_shop_country->iso_code != 'US') {
         $this->context->smarty->assign('paypal_usa_advanced_only_us', true);
     }
     /* If PayPal Payments Advanced has been enabled, PayPal's Manager credentials must be filled */
     if ((Configuration::get('PAYPAL_USA_PAYMENT_ADVANCED') || Configuration::get('PAYPAL_USA_PAYFLOW_LINK')) && (Configuration::get('PAYPAL_USA_MANAGER_USER') == '' || Configuration::get('PAYPAL_USA_MANAGER_PASSWORD') == '' || Configuration::get('PAYPAL_USA_MANAGER_PARTNER') == '')) {
         $this->_error[] = $this->l('In order to use PayPal Payments Advanced, please provide your PayPal Manager credentials.');
     }
     /* If PayPal Express Checkout has been enabled, PayPal's API credentials must be filled */
     if (Configuration::get('PAYPAL_USA_EXPRESS_CHECKOUT') && (Configuration::get('PAYPAL_USA_API_USERNAME') == '' || Configuration::get('PAYPAL_USA_API_PASSWORD') == '' || Configuration::get('PAYPAL_USA_API_SIGNATURE') == '')) {
         $this->_error[] = $this->l('In order to use PayPal ExpessCheckOut, please provide your PayPal API credentials.');
     }
     /* If PayPal Standard has been enabled, PayPal's API credentials should be filled to use the refund feature */
     if (Configuration::get('PAYPAL_USA_PAYMENT_STANDARD') && (Configuration::get('PAYPAL_USA_API_USERNAME') == '' || Configuration::get('PAYPAL_USA_API_PASSWORD') == '' || Configuration::get('PAYPAL_USA_API_SIGNATURE') == '')) {
         $this->_warning[] = $this->l('In order to use PayPal refund feature with PayPal Standard, please provide your PayPal API credentials.');
     }
     // 2013-11-8 add 1.4 token support
     if (method_exists('Tools', 'getAdminTokenLite')) {
         $token = Tools::getAdminTokenLite('AdminModules');
     } else {
         $tabid = (int) Tab::getCurrentTabId();
         $employee_id = (int) $this->context->cookie->id_employee;
         $token = 'AdminModules' . $tabid . $employee_id;
         $token = Tools::getAdminToken($token);
     }
     $this->context->smarty->assign(array('paypal_usa_tracking' => 'http://www.prestashop.com/modules/paypalusa.png?url_site=' . Tools::safeOutput($_SERVER['SERVER_NAME']) . '&id_lang=' . (int) $this->context->cookie->id_lang, 'paypal_usa_form_link' => './index.php?tab=AdminModules&configure=paypalusa&token=' . Tools::getAdminTokenLite('AdminModules') . '&tab_module=' . $this->tab . '&module_name=paypalusa', 'paypal_usa_ssl' => Configuration::get('PS_SSL_ENABLED'), 'paypal_usa_validation' => empty($this->_validation) ? false : $this->_validation, 'paypal_usa_error' => empty($this->_error) ? false : $this->_error, 'paypal_usa_warning' => empty($this->_warning) ? false : $this->_warning, 'paypal_usa_configuration' => Configuration::getMultiple(array('PAYPAL_USA_SANDBOX', 'PAYPAL_USA_PAYMENT_STANDARD', 'PAYPAL_USA_PAYMENT_ADVANCED', 'PAYPAL_USA_EXPRESS_CHECKOUT', 'PAYPAL_USA_PAYFLOW_LINK', 'PAYPAL_USA_ACCOUNT', 'PAYPAL_USA_API_USERNAME', 'PAYPAL_USA_API_PASSWORD', 'PAYPAL_USA_API_SIGNATURE', 'PAYPAL_USA_EXP_CHK_PRODUCT', 'PAYPAL_USA_EXP_CHK_SHOPPING_CART', 'PAYPAL_USA_EXP_CHK_BORDER_COLOR', 'PAYPAL_USA_MANAGER_USER', 'PAYPAL_USA_MANAGER_LOGIN', 'PAYPAL_USA_MANAGER_PASSWORD', 'PAYPAL_USA_MANAGER_PARTNER', 'PAYPAL_USA_SANDBOX_ADVANCED')), 'paypal_usa_merchant_country_is_usa' => Validate::isLoadedObject($this->_shop_country) && $this->_shop_country->iso_code == 'US', 'paypal_usa_merchant_country_is_mx' => Validate::isLoadedObject($this->_shop_country) && $this->_shop_country->iso_code == 'MX', 'paypal_usa_ps_14' => version_compare(_PS_VERSION_, '1.5', '<') ? 1 : 0, 'paypal_usa_b1width' => version_compare(_PS_VERSION_, '1.5', '>') ? '350' : '300', 'paypal_usa_js_files' => stripcslashes('"' . _PS_JS_DIR_ . 'jquery/jquery-ui-1.8.10.custom.min.js","' . $this->_path . 'js/colorpicker.js","' . $this->_path . 'js/jquery.lightbox_me.js","' . $this->_path . 'js/paypalusa.js' . '"')));
     return $this->display(__FILE__, 'views/templates/admin/configuration' . (Validate::isLoadedObject($this->_shop_country) && $this->_shop_country->iso_code == 'MX' ? '-mx' : '') . '.tpl');
 }
Exemple #8
0
 protected function displayFormSettings()
 {
     $helper = new HelperForm();
     // Helper Options
     $helper->required = false;
     $helper->id = Tab::getCurrentTabId();
     // Helper
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $helper->table = '';
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->module = $this;
     $helper->identifier = null;
     $helper->toolbar_btn = null;
     $helper->ps_help_context = null;
     $helper->title = null;
     $helper->show_toolbar = true;
     $helper->toolbar_scroll = false;
     $helper->bootstrap = true;
     $helper->default_form_language = (int) Configuration::get('PS_LANG_DEFAULT');
     if (_PS_VERSION_ < '1.6.0.0') {
         $helper->show_toolbar = false;
         $helper->title = $this->displayName;
     }
     $helper->fields_value['MEDIAFINANZ_CLIENT_ID'] = Tools::getValue('MEDIAFINANZ_CLIENT_ID', Configuration::get('MEDIAFINANZ_CLIENT_ID'));
     $helper->fields_value['MEDIAFINANZ_CLIENT_KEY'] = Tools::getValue('MEDIAFINANZ_CLIENT_KEY', Configuration::get('MEDIAFINANZ_CLIENT_KEY'));
     $helper->fields_value['MEDIAFINANZ_LOG_ENABLED'] = Tools::getValue('MEDIAFINANZ_LOG_ENABLED', Configuration::get('MEDIAFINANZ_LOG_ENABLED'));
     $helper->fields_value['MEDIAFINANZ_SANDBOX'] = Tools::getValue('MEDIAFINANZ_SANDBOX', Configuration::get('MEDIAFINANZ_SANDBOX'));
     $init_os = $this->getInitOSSettings();
     foreach ($init_os as $os_id) {
         $helper->fields_value['MEDIAFINANZ_REMINDER_INIT_OS_' . $os_id] = Tools::getValue('MEDIAFINANZ_REMINDER_INIT_OS_' . $os_id, $os_id);
     }
     $helper->fields_value['MEDIAFINANZ_REMINDER_DAYS'] = $this->displayReminderDays();
     $helper->fields_value['MEDIAFINANZ_LAST_REMINDER_DAYS'] = $this->displayLastReminderDays();
     $helper->fields_value['MEDIAFINANZ_REMINDER_INFO'] = Tools::getValue('MEDIAFINANZ_REMINDER_INFO', Configuration::get('MEDIAFINANZ_REMINDER_INFO'));
     $helper->fields_value['cron_information'] = $this->displayCronInformation();
     $helper->fields_value['MEDIAFINANZ_CLAIM_TYPE'] = Tools::getValue('MEDIAFINANZ_CLAIM_TYPE', Configuration::get('MEDIAFINANZ_CLAIM_TYPE'));
     $helper->fields_value['MEDIAFINANZ_OVERDUEFEES'] = Tools::getValue('MEDIAFINANZ_OVERDUEFEES', Configuration::get('MEDIAFINANZ_OVERDUEFEES'));
     $helper->fields_value['MEDIAFINANZ_NOTE'] = Tools::getValue('MEDIAFINANZ_NOTE', Configuration::get('MEDIAFINANZ_NOTE'));
     return $helper->generateForm($this->getFormFieldsSettings());
 }
 public static function installModuleTab($module_name, $title, $class_sfx = '', $parent = '')
 {
     $class = 'Admin' . Tools::ucfirst($module_name) . Tools::ucfirst($class_sfx);
     @Tools::copy(_PS_MODULE_DIR_ . $module_name . '/logo.gif', _PS_IMG_DIR_ . 't/' . $class . '.gif');
     if ($parent == '') {
         $position = Tab::getCurrentTabId();
     } else {
         $position = Tab::getIdFromClassName($parent);
     }
     $tab1 = new Tab();
     $tab1->class_name = $class;
     $tab1->module = $module_name;
     $tab1->id_parent = call_user_func('int' . 'val', $position);
     $langs = Language::getLanguages(false);
     foreach ($langs as $l) {
         $tab1->name[$l['id_lang']] = $title;
     }
     if ($parent == -1) {
         $tab1->id_parent = -1;
         $id_tab1 = $tab1->add();
     } else {
         $id_tab1 = $tab1->add(true, false);
     }
     unset($id_tab1);
 }