Example #1
0
 /**
  * module configuration page
  * @return page HTML code
  */
 public function getContent()
 {
     $this->checkConfigurationActions();
     $this->checkConfigurationCategoryActions();
     $this->displayFlashMessagesIfIsset();
     $menu = Tools::getValue('menu');
     if (!$this->testConnection()) {
         $menu = 'technical_settings';
         $this->context->smarty->assign('base_dir', _PS_BASE_URL_ . __PS_BASE_URI__);
         $this->context->smarty->assign('shop_name', Configuration::get('PS_SHOP_NAME'));
         $this->context->smarty->assign('first_name', Context::getContext()->employee->firstname);
         $this->context->smarty->assign('last_name', Context::getContext()->employee->lastname);
         $this->context->smarty->assign('email', Context::getContext()->employee->email);
         $this->context->smarty->assign('shop_id', Context::getContext()->shop->id);
         $default_currency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT'));
         $this->context->smarty->assign('iso_code', $default_currency->iso_code);
     }
     $this->context->smarty->assign('menu', $menu);
     if (!version_compare(_PS_VERSION_, '1.5', '<')) {
         if (Shop::getContext() != Shop::CONTEXT_SHOP) {
             $this->addFlashWarning($this->l('It is not possible to manage module configuration when you are managing ALL SHOPS or a GROUP of shops. Please select a shop to configure the module.'));
             $this->displayFlashMessagesIfIsset();
             return $this->html;
         }
     }
     switch ($menu) {
         case 'configuration':
         default:
             $this->context->smarty->assign('current_page_name', $this->l('Main settings'));
             $this->displayNavigation();
             $give_it_configuration_view_obj = new GiveItConfigurationView();
             $this->html .= $give_it_configuration_view_obj->getConfigurationForm();
             break;
         case 'configuration_category':
             $this->context->smarty->assign('current_page_name', $this->l('Category settings'));
             $this->displayNavigation();
             $give_it_configuration_view_obj = new GiveItConfigurationView();
             $this->html .= $give_it_configuration_view_obj->getConfigurationCategoryForm();
             break;
         case 'configuration_product':
             $this->context->smarty->assign('current_page_name', $this->l('Product settings'));
             $this->displayNavigation();
             if (!version_compare(_PS_VERSION_, '1.5', '<')) {
                 if (Shop::getContext() != Shop::CONTEXT_SHOP) {
                     $this->addFlashWarning($this->l('It is not possible to manage product settings when You are currently managing all of your shops or group of shops.'));
                     $this->displayFlashMessagesIfIsset();
                     break;
                 }
             }
             $give_it_configuration_view_obj = new GiveItConfigurationView();
             $this->html .= $give_it_configuration_view_obj->getConfigurationProductForm();
             break;
         case 'shipping_prices':
             $this->context->smarty->assign('current_page_name', $this->l('Shipping prices'));
             $this->displayNavigation();
             $this->displayShippingPricesPage();
             break;
         case 'help':
             $this->context->smarty->assign('current_page_name', $this->l('Help'));
             $this->displayNavigation();
             $this->html .= $this->display(__FILE__, 'views/templates/admin/help.tpl');
             break;
     }
     return $this->html;
 }