...
 
Commits (4)
<?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];
//}
}
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2012-2019 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 taxonomyTermsManagement extends management
{
public static $skipTemplates = FALSE;
public static $columns = [
['ObjectTypeColumn', []],
['LinkColumn', ['attributes' => 'nameAttr', 'label' => 'Name']],
['LinkColumn', ['attributes' => 'fdTaxonomyTerm', 'label' => 'Term']],
['LinkColumn', ['attributes' => 'fdTaxonomyReferentiel', 'label' => 'Referentiel']],
['LinkColumn', ['attributes' => 'description', 'label' => 'Description']],
['ActionsColumn', ['label' => 'Actions']],
];
static function plInfo (): array
{
return [
'plShortName' => _('Taxonomy terms'),
'plDescription' => _('Taxonomy terms management'),
'plIcon' => 'geticon.php?context=applications&icon=supann&size=48',
'plSection' => 'accounts',
'plPriority' => 40,
'plManages' => ['terms'],
'plProvidedAcls' => []
];
}
protected function setUpListing ()
{
/* Set baseMode to FALSE */
$this->listing = new managementListing($this, FALSE);
}
}
##
## supann-fd.schema - Needed by Fusion Directory for managing Taxonomy
##
# Attributes
attributetype ( 1.3.6.1.4.1.38414.81.10.1 NAME 'fdTaxonomyTermCode'
DESC 'FusionDirectory - Code of Term belong to a taxonomy'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.38414.81.10.2 NAME 'fdTaxonomyTermLongLabel'
DESC 'FusionDirectory - Long Label of a term belong to a taxonomy'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
attributetype ( 1.3.6.1.4.1.38414.81.10.3 NAME 'fdTaxonomyReferentiel'
DESC 'FusionDirectory - Referentiel which contain the term'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
attributetype ( 1.3.6.1.4.1.38414.81.10.4 NAME 'fdTaxonomyName'
DESC 'FusionDirectory - Taxonomy which contain the term'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
attributetype ( 1.3.6.1.4.1.38414.81.10.5 NAME 'fdTaxonomyTermStartDate'
DESC 'FusionDirectory - Term Validation start date'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
attributetype ( 1.3.6.1.4.1.38414.81.10.6 NAME 'fdTaxonomyTermEndDate'
DESC 'FusionDirectory - Term Validation End date'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
# Object Class
objectclass ( 1.3.6.1.4.1.38414.81.20.1 NAME 'fdTaxonomyTerms'
DESC 'FusionDirectory Taxonomy plugin configuration'
SUP top AUXILIARY
MUST ( fdTaxonomyTermCode )
MAY (
fdTaxonomyTermLongLabel $ fdTaxonomyReferentiel $ fdTaxonomyName $ fdTaxonomyTermStartDate $ fdTaxonomyTermEndDate $ description
) )