136 lines
3.4 KiB
PHP
136 lines
3.4 KiB
PHP
<?php
|
|
/**
|
|
* AdminOrderTaxProfitReport.php file defines admin tab class of module
|
|
*/
|
|
|
|
if (!defined('_PS_VERSION_')) {
|
|
exit(1);
|
|
}
|
|
|
|
class AdminOrderTaxProfitReport extends AdminTab
|
|
{
|
|
/**
|
|
* @var int $iCurrentLang : store id of default lang
|
|
*/
|
|
public static $iCurrentLang = null;
|
|
|
|
/**
|
|
* @var string $sBASE_URI : base of URI in prestashop
|
|
*/
|
|
public static $sBASE_URI = null;
|
|
|
|
/**
|
|
* @var string $multishop_context_group : store context group
|
|
*/
|
|
public $multishop_context_group = null;
|
|
|
|
/**
|
|
* @var string $multishop_context : store context
|
|
*/
|
|
public $multishop_context = null;
|
|
|
|
/**
|
|
* Magic Method __construct assigns few information about module and instantiate parent class
|
|
*/
|
|
public function __construct()
|
|
{
|
|
// hack for older version than 1 4 5 1
|
|
if (version_compare(_PS_VERSION_, '1.4.5.1') == -1) {
|
|
require_once(_PS_MODULE_DIR_ . 'ordertaxprofitreport/conf/common.conf.php');
|
|
}
|
|
else {
|
|
require_once(dirname(__FILE__) . '/conf/common.conf.php');
|
|
}
|
|
|
|
// use case - get link context
|
|
if (version_compare(_PS_VERSION_, '1.5', '>')) {
|
|
$cookie = Context::getContext()->cookie;
|
|
}
|
|
else {
|
|
global $cookie;
|
|
}
|
|
|
|
global $currentIndex;
|
|
|
|
// get default lang
|
|
self::$iCurrentLang = $cookie->id_lang;
|
|
|
|
// set module name
|
|
$this->module = _OTPR_MODULE_SET_NAME;
|
|
|
|
// Fix for translations before v1.4
|
|
if (version_compare(_PS_VERSION_, '1.4.0.1') == -1) {
|
|
global $_LANGADM, $_MODULE;
|
|
|
|
// set lang filename
|
|
$sLangFile = _PS_MODULE_DIR_ . $this->module . '/' . Language::getIsoById(self::$iCurrentLang) . '.php';
|
|
|
|
// check lang file exists
|
|
if (file_exists($sLangFile)) {
|
|
// include php lang file
|
|
require_once $sLangFile;
|
|
|
|
foreach ($_MODULE as $nKey => $sValue) {
|
|
if (Tools::substr(strip_tags($nKey), 0, 5) == 'Admin') {
|
|
$_LANGADM[str_replace('_', '', strip_tags($nKey))] = $sValue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// construct
|
|
parent::__construct();
|
|
|
|
self::$sBASE_URI = $currentIndex;
|
|
}
|
|
|
|
|
|
/**
|
|
* display() method manages all data in Back Office of admin tab
|
|
*
|
|
* @return string
|
|
*/
|
|
public function display()
|
|
{
|
|
// include main class
|
|
require_once(_OTPR_PATH_ROOT . 'ordertaxprofitreport.php');
|
|
|
|
// instantiate
|
|
$oMainClass = new OrderTaxProfitReport();
|
|
|
|
// use case - display => search form / export => return HTML report or a downloadable CVS report
|
|
$_REQUEST['sAction'] = (!Tools::getIsset('sAction') || (Tools::getIsset('sAction') && 'display' == Tools::getValue('sAction')))? 'display' : Tools::getValue('sAction');
|
|
|
|
$_REQUEST['sType'] = !Tools::getIsset('sType')? 'searchForm' : $_REQUEST['sType'];
|
|
|
|
// set URI of admin tab
|
|
$_REQUEST['sAdminTabURI'] = self::$sBASE_URI;
|
|
|
|
echo (
|
|
$oMainClass->getContent()
|
|
);
|
|
}
|
|
|
|
/**
|
|
* addCSS() method return always true because some other modules are hooked on adminBackofficeHeader and call addCSS() method. This method doesn't exist in the Admin context tab.
|
|
* This prevent those modules do not execute functions which do not exists
|
|
*
|
|
* @return bool true
|
|
*/
|
|
public function addCSS()
|
|
{
|
|
// return true
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* addJS() method return always true because some other modules are hooked on adminBackofficeHeader and call addJS() method. This method doesn't exist in the Admin context tab.
|
|
* This prevents those modules do not execute functions which doesn't exists
|
|
*
|
|
* @return bool true
|
|
*/
|
|
public function addJS()
|
|
{
|
|
// return true
|
|
return true;
|
|
}
|
|
} |