Commit 0c0c7338 authored by Antoine Gallavardin's avatar Antoine Gallavardin
Browse files

Use seaprator feature

parent cb330b65
......@@ -21,6 +21,7 @@
class term extends simplePlugin
{
static function plInfo (): array
{
return [
......@@ -60,11 +61,6 @@ class term extends simplePlugin
),
new HiddenArrayAttribute('fdTaxonomyReferentiel',FALSE,[] ),
new HiddenArrayAttribute('fdTaxonomyName',FALSE,[]),
/*new StringAttribute(
_('Taxonomy Name'), _('Name of taxonomy belonging to the Referentiel'),
'fdTaxonomyName', FALSE
),*/
new TextAreaAttribute(
_('Description'), _('Short description of this terms'),
'description', FALSE
......@@ -89,21 +85,22 @@ class term extends simplePlugin
function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE)
{
global $config;
parent::__construct($dn, $object, $parent, $mainTab);
foreach ($config->get_cfg_value('TaxonomyList', []) as $taxonomy) {
list($referentiel, $taxonomy,$policy,$startDate,$endDate) = explode(';', $taxonomy);
// TODO : test the policy and the start/end Date
$ref_tax[] = $referentiel.">".$taxonomy;
$ref_tax[] = $referentiel.$config->get_cfg_value('TaxonomySeparator').$taxonomy;
}
$initval=$this->fdTaxonomyReferentiel[0].">".$this->fdTaxonomyName[0];
$this->attributesAccess['ReferentielAndTaxonomy']->setValue($this->fdTaxonomyReferentiel[0].$config->get_cfg_value('TaxonomySeparator').$this->fdTaxonomyName[0]);
$this->attributesAccess['ReferentielAndTaxonomy']->setChoices($ref_tax);
}
protected function prepare_save (): array
{
global $config;
$refAndTex = $this->attributesAccess['ReferentielAndTaxonomy']->getValue();
$hRefAndTex = explode('>', $refAndTex);
$hRefAndTex = explode($config->get_cfg_value('TaxonomySeparator'), $refAndTex);
$this->fdTaxonomyReferentiel = $hRefAndTex[0];
$this->fdTaxonomyName = $hRefAndTex[1];
$this->ReferentielAndTaxonomy='';
......
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