Esempio n. 1
0
    public function getContent()
    {
        $post_action = NULL;
        if (!empty($_POST)) {
            $this->_postValidation();
            if (!sizeof($this->_postErrors)) {
                $post_action = $this->_postProcess();
            }
        }
        $carriers_list = Db::getInstance()->executeS('
			SELECT m.*
			FROM `' . _DB_PREFIX_ . 'mr_method` m
			LEFT JOIN `' . _DB_PREFIX_ . 'carrier` c
			ON (c.`id_carrier` = m.`id_carrier`)
			LEFT JOIN `' . _DB_PREFIX_ . 'mr_method_shop` ms
			ON ms.`id_mr_method` = m.`id_mr_method`
			WHERE c.`deleted` = 0 AND ms.`id_shop` = ' . (int) $this->account_shop['id_shop']);
        $controller = _PS_VERSION_ < '1.5' ? 'AdminContact' : 'AdminStores';
        // TODO : Fill an array with admi controller name
        $this->context->smarty->assign(array('MR_token_admin_performance' => Tools::getAdminToken('AdminPerformance' . (int) Tab::getIdFromClassName('AdminPerformance') . (int) $this->context->cookie->id_employee), 'MR_token_admin_carriers' => Tools::getAdminToken('AdminCarriers' . (int) Tab::getIdFromClassName('AdminCarriers') . (int) $this->context->employee->id), 'MR_token_admin_contact' => array('controller_name' => $controller, 'token' => Tools::getAdminToken($controller . (int) Tab::getIdFromClassName($controller) . (int) $this->context->employee->id)), 'MR_token_admin_mondialrelay' => Tools::getAdminToken('AdminMondialRelay' . (int) Tab::getIdFromClassName('AdminMondialRelay') . (int) $this->context->employee->id), 'MR_token_admin_module' => Tools::getAdminToken('AdminModules' . (int) Tab::getIdFromClassName('AdminModules') . (int) $this->context->employee->id), 'MR_enseigne_webservice' => Tools::getValue('MR_enseigne_webservice') ? Tools::getValue('MR_enseigne_webservice') : $this->account_shop['MR_ENSEIGNE_WEBSERVICE'], 'MR_code_marque' => Tools::getValue('MR_code_marque') ? Tools::getValue('MR_code_marque') : $this->account_shop['MR_CODE_MARQUE'], 'MR_webservice_key' => Tools::getValue('MR_webservice_key') ? Tools::getValue('MR_webservice_key') : $this->account_shop['MR_KEY_WEBSERVICE'], 'MR_available_languages' => Language::getLanguages(), 'MR_selected_language' => $this->account_shop['MR_LANGUAGE'], 'MR_weight_coefficient' => Tools::getValue('MR_weight_coefficient') ? Tools::getValue('MR_weight_coefficient') : $this->account_shop['MR_WEIGHT_COEFFICIENT'], 'MR_PS_WEIGHT_UNIT' => Configuration::get('PS_WEIGHT_UNIT'), 'MR_order_states_list' => OrderState::getOrderStates($this->context->language->id), 'MR_MONDIAL_RELAY_ORDER_STATE' => Configuration::get('MONDIAL_RELAY_ORDER_STATE'), 'MR_CRON_URL' => Tools::getHttpHost(true, true) . _MODULE_DIR_ . $this->name . '/cron.php?secure_key=' . Configuration::get('MONDIAL_RELAY_SECURE_KEY'), 'MR_name' => Tools::getValue('MR_name') ? Tools::getValue('MR_name') : '', 'MR_carriers_list' => $carriers_list, 'MR_error_list' => $this->_postErrors, 'MR_form_action' => $post_action, 'MR_PS_ADMIN_IMG_' => _PS_ADMIN_IMG_, 'MR_tab_selected' => Tools::getValue('MR_tab_name') ? Tools::getValue('MR_tab_name') : (MondialRelay::isAccountSet() ? 'account_form' : 'info_form'), 'MR_delay' => Tools::getValue('MR_delay') ? Tools::getValue('MR_delay') : '', 'MR_local_path' => MondialRelay::$modulePath, 'MR_upgrade_detail' => $this->upgrade_detail, 'MR_unit_weight_used' => Configuration::get('PS_WEIGHT_UNIT'), 'MR_account_set' => MondialRelay::isAccountSet(), 'MR_base_dir' => MondialRelay::$moduleURL));
        return $this->fetchTemplate('/tpl/', 'configuration');
    }
 public function display()
 {
     $post_action = count($_POST) ? $this->postProcess() : NULL;
     $this->displaySettings($post_action);
     if (MondialRelay::isAccountSet() && (int) $this->mondialrelay->account_shop['MR_ORDER_STATE']) {
         $this->displayOrdersTable();
         $this->displayhistoriqueForm();
     }
 }