diff --git a/include/class_config.inc b/include/class_config.inc index f543343462249120ade8b4e83b52a730a933e4aa..5abea57a113a2a41f21e0967a6bb9f7b44018554 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -980,6 +980,7 @@ class config $this->data['OBJECTS'][$obj]['management'] = $class; if (isset($class::$skipTemplates) && ($class::$skipTemplates == FALSE)) { $this->data['OBJECTS'][$obj]['templateActive'] = TRUE; + $this->data['CATEGORIES'][$cat]['classes'][] = 'template'; } } } diff --git a/include/class_template.inc b/include/class_template.inc index c6ba99e999aa64fa38e7a39de60ca0b43eaa07aa..20170011ec5d900e3e8bf29f624dff2e04f80681 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -40,7 +40,8 @@ class template return array( 'plShortName' => _('Template'), 'plDescription' => _('Object template, used to create several objects with similar values'), - 'plCategory' => array('user'), + /* Categories for templates are computed in config class */ + 'plCategory' => array(), 'plProvidedAcls' => array( 'template_cn' => _('Template name') @@ -48,6 +49,23 @@ class template ); } + static function getTemplatedTypes() + { + $result = array(); + $types = objects::types(); + foreach ($types as $type) { + if (in_array($type, departmentManagement::getDepartmentTypes())) { + continue; + } + $infos = objects::infos($type); + if ($infos['templateActive']) { + $result[$type] = $infos['name']; + } + } + asort($result); + return $result; + } + function __construct($type, $dn, $targetdn = NULL) { $this->type = $type;