diff --git a/include/class_template.inc b/include/class_template.inc index 12e49848aa25b3d049eb6df64490c589f9814f2b..0aaa6b6d3e06afdfe0e4a68b3404ca9287b1bfb9 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -83,13 +83,13 @@ class template } $tempTabObject = objects::open($this->dn, $this->type); /* Used to know which tab is activated */ $this->attributes = array(); - foreach ($tempTabObject->by_object as $class => $plugin) { - if ($plugin->is_account || $plugin->ignore_account) { - $this->tabObject->by_object[$class]->is_account = $plugin->is_account; + $tempTabObject->setActiveTabs($this->tabObject); + foreach ($this->tabObject->by_object as $class => $tab) { + if ($tab->is_account || $tab->ignore_account) { $this->attributes[$class] = array(); - $attrs = array_unique(array_merge($this->tabObject->by_object[$class]->getRequiredAttributes(), $this->needed)); - foreach (array_keys($this->tabObject->by_object[$class]->attributesAccess) as $attr) { - if (!$plugin->showInTemplate($attr, $this->attrs)) { + $attrs = array_unique(array_merge($tab->getRequiredAttributes(), $this->needed)); + foreach (array_keys($tab->attributesAccess) as $attr) { + if (!$tab->showInTemplate($attr, $this->attrs)) { continue; } if (in_array($attr, $attrs)) { diff --git a/include/simpleplugin/class_simpleTabs.inc b/include/simpleplugin/class_simpleTabs.inc index 22adc9f82400e3cac77ac6e5ef0fcaccdc5330c1..5f828a39621ca814d36f054a115f82a9dea81cea 100644 --- a/include/simpleplugin/class_simpleTabs.inc +++ b/include/simpleplugin/class_simpleTabs.inc @@ -114,7 +114,6 @@ class simpleTabs } } - /*! * \brief Reinitializes the tab classes with fresh ldap values. * @@ -138,6 +137,18 @@ class simpleTabs } } + /*! + * \brief Sets the active tabs from this instance to an other one. Used by templates + */ + function setActiveTabs(&$tabObject) + { + foreach ($this->by_object as $class => $plugin) { + if ($plugin->is_account || $plugin->ignore_account) { + $tabObject->by_object[$class]->is_account = $plugin->is_account; + } + } + } + function resetCopyInfos() { $this->dn = 'new'; diff --git a/plugins/admin/groups/tabs_ogroups.inc b/plugins/admin/groups/tabs_ogroups.inc index b41aa85ceaff524b325383872f7bc4e65efef281..64e63ce1270056e0fc36f9ef57cb30ba2cd98f8a 100644 --- a/plugins/admin/groups/tabs_ogroups.inc +++ b/plugins/admin/groups/tabs_ogroups.inc @@ -136,6 +136,19 @@ class ogrouptabs extends simpleTabs_noSpecial return parent::gen_tabs($disabled); } + /*! + * \brief Sets the active tabs from this instance to an other one. Used by templates + */ + function setActiveTabs(&$tabObject) + { + $tabObject->loadtabs($this->groupObjects); + foreach ($this->by_object as $class => $plugin) { + if ($plugin->is_account || $plugin->ignore_account) { + $tabObject->by_object[$class]->is_account = $plugin->is_account; + } + } + } + function check($ignore_account = FALSE) { return parent::check(FALSE);