81 lines
2.0 KiB
PHP
81 lines
2.0 KiB
PHP
<?php
|
|
|
|
if (!defined('_PS_VERSION_')) {
|
|
exit;
|
|
}
|
|
|
|
class EksportHistorii extends Module
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->name = 'eksporthistorii';
|
|
$this->tab = 'administration';
|
|
$this->version = '1.0.0';
|
|
$this->author = 'Custom';
|
|
$this->need_instance = 0;
|
|
$this->bootstrap = true;
|
|
|
|
parent::__construct();
|
|
|
|
$this->displayName = $this->l('Eksport historii zamówień');
|
|
$this->description = $this->l('Eksport historii zamówień do pliku Excel (CSV).');
|
|
}
|
|
|
|
public function install()
|
|
{
|
|
return parent::install()
|
|
&& $this->installTab();
|
|
}
|
|
|
|
public function uninstall()
|
|
{
|
|
return $this->uninstallTab()
|
|
&& parent::uninstall();
|
|
}
|
|
|
|
/**
|
|
* Dodanie zakładki jako podmenu w "Zamówienia"
|
|
*/
|
|
protected function installTab()
|
|
{
|
|
// rodzic: Orders / Zamówienia
|
|
$id_parent = (int) Tab::getIdFromClassName('AdminParentOrders');
|
|
|
|
$tab = new Tab();
|
|
$tab->active = 1;
|
|
$tab->class_name = 'AdminEksportHistorii';
|
|
$tab->name = [];
|
|
|
|
foreach (Language::getLanguages(false) as $lang) {
|
|
$tab->name[$lang['id_lang']] = 'Eksport historii';
|
|
}
|
|
|
|
$tab->id_parent = $id_parent;
|
|
$tab->module = $this->name;
|
|
|
|
return (bool) $tab->add();
|
|
}
|
|
|
|
/**
|
|
* Usunięcie zakładki przy deinstalacji
|
|
*/
|
|
protected function uninstallTab()
|
|
{
|
|
// Usuwamy naszą aktualną zakładkę
|
|
$id_tab = (int) Tab::getIdFromClassName('AdminEksportHistorii');
|
|
if ($id_tab) {
|
|
$tab = new Tab($id_tab);
|
|
$tab->delete();
|
|
}
|
|
|
|
// Sprzątamy ewentualną starą zakładkę (ze starego modułu)
|
|
$old_id_tab = (int) Tab::getIdFromClassName('AdminEksportowanieIstorii');
|
|
if ($old_id_tab) {
|
|
$old_tab = new Tab($old_id_tab);
|
|
$old_tab->delete();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|