bebeboutik/modules/stats_logistic/stats_logistic.php
Michael RICOIS 1ae7e28abe Async export
2018-02-01 09:34:23 +01:00

64 lines
1.5 KiB
PHP
Executable File

<?php
require_once __DIR__.'/models/StatsLogistic.php';
class stats_logistic extends Module
{
const ADMIN_STATS_LOGISTIC_CLASS = 'AdminStatsLogistic';
public function __construct()
{
$this->name = 'stats_logistic';
$this->tab = 'analytics_stats';
$this->author = 'Antadis';
$this->version = '1.0';
parent::__construct();
$this->displayName = $this->l('Stats logistic');
$this->description = $this->l('Display stats of the employee');
}
public function install()
{
return (
parent::install()
and self::createTab(6, $this->name, $this->l('Stats logistic'), self::ADMIN_STATS_LOGISTIC_CLASS)
);
}
public function uninstall()
{
return (
parent::uninstall()
and self::dropTable()
and self::deleteTab(self::ADMIN_STATS_LOGISTIC_CLASS)
);
}
public static function createTab($id_parent, $module, $name, $class_name, $status=TRUE)
{
$tab = new Tab();
$tab->module = $module;
foreach (Language::getLanguages(TRUE) as $languages) {
$tab->name[$languages['id_lang']] = $name;
}
$tab->id_parent = $id_parent;
$tab->class_name = $class_name;
$tab->active = $status;
$r = $tab->save();
if ($r === FALSE)
return FALSE;
return $tab->id;
}
public function getContent()
{
global $currentIndex;
Tools::redirectAdmin($currentIndex.'&tab='.self::ADMIN_STATS_LOGISTIC_CLASS.'&token='.Tools::getAdminTokenLite(self::ADMIN_STATS_LOGISTIC_CLASS));
Tools::redirectAdmin($this->context->link->getAdminLink(self::ADMIN_STATS_LOGISTIC_CLASS));
}
}