Beispiel #1
0
 /**
  * module configuration page
  * @return page HTML code
  */
 public function getContent()
 {
     $this->displayFlashMessagesIfIsset();
     if (!$this->ps_14) {
         $this->context->controller->addJS(_DPDGROUP_JS_URI_ . 'backoffice.js');
         if (!$this->bootstrap || Tools::getValue('menu') && Tools::getValue('menu') != 'shipment_list') {
             $this->context->controller->addCSS(_DPDGROUP_CSS_URI_ . 'backoffice.css');
         }
     }
     $this->setGlobalVariablesForAjax();
     $this->context->smarty->assign('dpd_geopost_other_country', DpdGroupConfiguration::OTHER_COUNTRY);
     $this->html .= $this->context->smarty->fetch(_DPDGROUP_TPL_DIR_ . 'admin/global_variables.tpl');
     if ($this->bootstrap) {
         $this->html .= $this->getBootstrapMenu();
     }
     $this->displayModuleWarnings();
     switch (Tools::getValue('menu')) {
         case 'configuration':
             require_once _DPDGROUP_CONTROLLERS_DIR_ . 'Configuration.controller.php';
             DpdGroupConfigurationController::init();
             if (!$this->bootstrap) {
                 $this->context->smarty->assign('path', array($this->displayName, $this->l('Settings')));
                 $this->displayNavigation();
             }
             if (!$this->ps_14) {
                 $this->displayShopRestrictionWarning();
             }
             $configuration_controller = new DpdGroupConfigurationController();
             $this->html .= $configuration_controller->getSettingsPage();
             break;
         case 'csv':
             require_once _DPDGROUP_CONTROLLERS_DIR_ . 'Csv.controller.php';
             DpdGroupCSVController::init();
             if (!$this->bootstrap) {
                 $this->context->smarty->assign('path', array($this->displayName, $this->l('Price rules')));
                 $this->displayNavigation();
             }
             if (!$this->ps_14) {
                 if (Shop::getContext() != Shop::CONTEXT_SHOP) {
                     $this->displayAdminWarning($this->l('CSV management is disabled when all shops or group of shops are selected'));
                     break;
                 }
             }
             $csv_controller = new DpdGroupCSVController();
             $this->html .= $csv_controller->getCSVPage();
             break;
         case 'postcode':
             require_once _DPDGROUP_CONTROLLERS_DIR_ . 'Postcode.controller.php';
             DpdGroupPostcodeController::init();
             if (!$this->bootstrap) {
                 $this->context->smarty->assign('path', array($this->displayName, $this->l('Postcodes update')));
                 $this->displayNavigation();
             }
             if (!$this->ps_14) {
                 if (Shop::getContext() != Shop::CONTEXT_SHOP) {
                     $this->displayAdminWarning($this->l('Postcodes management is disabled when all shops or group of shops are selected'));
                     break;
                 }
             }
             $psotcode_controller = new DpdGroupPostcodeController();
             $this->html .= $psotcode_controller->getPostcodePage();
             break;
         case 'help':
             if (!$this->bootstrap) {
                 $this->context->smarty->assign('path', array($this->displayName, $this->l('Help')));
                 $this->displayNavigation();
             }
             if (Tools::isSubmit('print_pdf')) {
                 $filename = 'dpdgroup_eng.pdf';
                 ob_end_clean();
                 header('Content-type: application/pdf');
                 header('Content-Disposition: attachment; filename="' . $this->l('manual') . '.pdf"');
                 readfile(_PS_MODULE_DIR_ . $this->name . '/manual/' . $filename);
                 exit;
             }
             $this->context->smarty->assign('module_link', $this->module_url);
             $this->html .= $this->context->smarty->fetch(_DPDGROUP_TPL_DIR_ . 'admin/help.tpl');
             break;
         case 'shipment_list':
         default:
             if ($this->ps_14) {
                 includeDatepicker(null);
             } else {
                 $this->context->controller->addJqueryUI(array('ui.slider', 'ui.datepicker'));
                 $this->context->controller->addJS(array(_DPDGROUP_JS_URI_ . 'jquery.bpopup.min.js', _PS_JS_DIR_ . 'jquery/plugins/timepicker/jquery-ui-timepicker-addon.js'));
                 $this->context->controller->addCSS(_PS_JS_DIR_ . 'jquery/plugins/timepicker/jquery-ui-timepicker-addon.css');
                 // for datetimepicker
             }
             if (!$this->bootstrap) {
                 $this->context->smarty->assign('path', array($this->displayName, $this->l('Shipments')));
                 $this->displayNavigation();
             } else {
                 $this->context->controller->addCSS(_DPDGROUP_CSS_URI_ . 'backoffice_16.css');
             }
             require_once _DPDGROUP_CONTROLLERS_DIR_ . 'ShipmentsList.controller.php';
             if (!$this->ps_14 && Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(0)) > 1 && Shop::getContext() != Shop::CONTEXT_SHOP) {
                 $this->displayAdminWarning($this->l('Shipments functionality is disabled when all shops or group of shops are chosen'));
                 break;
             }
             $shipment_controller = new DpdGroupShipmentController();
             $this->html .= $shipment_controller->getShipmentList();
             break;
     }
     return $this->html;
 }