bebeboutik/modules/stats_logistic/stats_logistic.php
Srv Bebeboutik 6c0978166c add modules
2016-01-04 12:49:26 +01:00

57 lines
1.4 KiB
PHP
Executable File

<?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));
}
}