Skip to content

Commit

Permalink
1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
timoj committed Jul 25, 2017
1 parent 812ab40 commit 55927e5
Showing 1 changed file with 16 additions and 30 deletions.
46 changes: 16 additions & 30 deletions wuunderconnector/wuunderconnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,46 +52,32 @@ private function uninstallDB()

private function installModuleTab($tab_class, $tab_name, $id_tab_parent)
{
// if (!copy(_PS_MODULE_DIR_ . $this->name . '/logo.png', _PS_IMG_DIR_ . 't/' . $tab_class . '.png')) {
// return false;
// }
// $tab = new Tab();
//
// $languages = Language::getLanguages(false);
// foreach ($languages as $language) {
// $tab->name[$language['id_lang']] = $tab_name;
// }
// $tab->class_name = $tab_class;
// $tab->module = $this->name;
// $tab->id_parent = $id_tab_parent;
//
// if (!$tab->save()) {
// return false;
// }
// return true;
if (!copy(_PS_MODULE_DIR_ . $this->name . '/logo.png', _PS_IMG_DIR_ . 't/' . $tab_class . '.png')) {
return false;
}
$tab = new Tab();
$tab->active = 1;
$tab->class_name = $tab_class;
$tab->name = array();

foreach (Language::getLanguages(true) as $lang) {
$tab->name[$lang['id_lang']] = $tab_name;
}
if ($id_tab_parent) {
$tab->id_parent = (int) Tab::getIdFromClassName($id_tab_parent);
} else {
$tab->id_parent = 0;
$languages = Language::getLanguages(false);
foreach ($languages as $language) {
$tab->name[$language['id_lang']] = $tab_name;
}
$tab->class_name = $tab_class;
$tab->module = $this->name;
return $tab->add();
$tab->id_parent = $id_tab_parent;

if (!$tab->save()) {
return false;
}
return true;
}

private function uninstallModuleTab($tab_class)
{
$id_tab = Tab::getIdFromClassName($tab_class);
if ($id_tab != 0) {
$tab = new Tab($id_tab);
return $tab->delete();
$tab->delete();
return true;
}
return false;
}
Expand All @@ -104,7 +90,7 @@ public function install()
$this->installDB();

if (!parent::install() ||
!$this->installModuleTab('AdminWuunderConnector', 'Wuunder', 'AdminParentShipping')
!$this->installModuleTab('AdminWuunderConnector', 'Wuunder', Tab::getIdFromClassName('AdminShipping'))
)
return false;

Expand Down

0 comments on commit 55927e5

Please sign in to comment.