Commit ee951741 authored by Antoine Gallavardin's avatar Antoine Gallavardin
Browse files

Acc class for theme management

parent 3c33bb16
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2012-2020 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class term extends simplePlugin
{
static function plInfo (): array
{
return [
'plShortName' => _('Term'),
'plDescription' => _('Terms Settings'),
'plObjectClass' => ['fdTaxonomyTerms'],
'plObjectType' => ['term' => [
'name' => _('Terms Lists'),
'icon' => 'geticon.php?context=applications&icon=term&size=16',
'ou' => get_ou('fdTaxonomyTermsRDN'),
]],
//'plSearchAttrs' => ['description'],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo(), TRUE)
];
}
// The main function : information about attributes
static function getAttributesInfo (): array
{
return [
'main' => [
'name' => _('Term'),
'attrs' => [
new StringAttribute(
_('Code'), _('Code name of Term'),
'fdTaxonomyTermCode', TRUE
),
new StringAttribute(
_('Description'), _('Short description of this terms'),
'description', FALSE
),
new StringAttribute(
_('Referentiel'), _('Referentiel used'),
'fdTaxonomyReferentiel', FALSE
),
new StringAttribute(
_('Taxonomy Name'), _('Name of taxonomy belonging to the Referentiel'),
'fdTaxonomyName', FALSE
),
new TextAreaAttribute(
_('Term Long Label'), _('Long Label of Term code'),
'fdTaxonomyTermLongLabel', FALSE
),
new DateAttribute(
_('StartDate'), _('Start Date of validity '),
'fdTaxonomyTermStartDate', FALSE,
'Ymd', '',
'today', NULL
),
new DateAttribute(
_('EndDate'), _('End Date of validity'),
'fdTaxonomyTermEndDate', FALSE,
'Ymd', '',
'today', NULL
)
]
]
];
}
function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE)
{
global $config;
parent::__construct($dn, $object, $parent, $mainTab);
//list($code_entites, $label_entites) = static::listPossibleParentEntities();
//$this->attributesAccess['supannCodeEntiteParent']->attribute->setChoices($code_entites, $label_entites);
//$this->attributesAccess['ou']->setUnique('one');
//$this->attributesAccess['supannCodeEntite']->setUnique('whole', '(objectClass=supannEntite)');
//$this->attributesAccess['supannRefId']->setUnique('whole', '(objectClass=supannEntite)');
}
//static public function listPossibleParentEntities (): array
//{
//global $config;
//$ldap = $config->get_ldap_link();
//$ldap->cd($config->current['BASE']);
//$ldap->search('(objectClass=supannEntite)', ['supannCodeEntite','ou','o','description']);
//$code_entites = [''];
//$label_entites = [''];
//while ($attrs = $ldap->fetch()) {
//if (isset($attrs['supannCodeEntite'][0])) {
//$code_entites[] = $attrs['supannCodeEntite'][0];
//if (isset($attrs['description'][0])) {
//$description = $attrs['description'][0];
//if (mb_strlen($description, 'UTF-8') > 30) {
//$description = mb_substr($description, 0, 27, 'UTF-8').'...';
//}
//$description = ' ('.$description.')';
//} else {
//$description = '';
//}
//if (isset($attrs['ou'][0])) {
//$label_entites[] = $attrs['ou'][0].$description;
//} else {
//$label_entites[] = $attrs['o'][0].$description;
//}
//}
//}
//return [$code_entites, $label_entites];
//}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment