Exemple #1
0
 public function set($var, $val, $isSave = false)
 {
     $this->isModif = true;
     foreach (formxTools::domSearch(formxTools::domGetRoot($this->dom), 'ITEM') as $item) {
         if ($item->getAttribute('id') == $var) {
             try {
                 formxTools::domSetTagValue($item, 'Val', $val);
                 if ($isSave) {
                     $this->save();
                 }
                 return true;
             } catch (Exception $e) {
                 eko("attention");
             }
         }
     }
     //eko('pas trouve');
     //si on est encore là c'est qu'on a pas trouvé la balise.on va la créer
     //TODO découpler ci dessous
     $bal = $this->dom->createElement('ITEM');
     $this->dom->getElementsByTagName('GLOBVARS')->item(0)->appendChild($bal);
     $bal->setAttribute('id', $var);
     formxTools::createTagValue($bal, 'Val', $val, $this->dom);
     if ($isSave) {
         $this->save();
     }
     return true;
 }