コード例 #1
0
 /**
  * Aggiorna la selezione delle tematiche da sincronizzare
  * @param eZHTTPTool $http
  */
 public function modifySelection($http)
 {
     if ($http->hasPostVariable('BrowseActionName') && $http->postVariable('BrowseActionName') == 'SelectDestinationNodeID') {
         // Scelta del nodo di destinazione
         $nodeIDArray = $http->postVariable('SelectedNodeIDArray');
         $this->object->setAttribute('destination_node_id', $nodeIDArray[0]);
         $this->object->store();
     } else {
         // Abilitazione e disabilitazione delle tematiche
         $tematicheChanged = false;
         foreach ($http->attribute('post') as $key => $value) {
             $action = explode('_', $key);
             if ($action[0] == 'DisableTag') {
                 if (($_key = array_search($value, $this->getTematiche())) !== false) {
                     $_tematiche = $this->getTematiche();
                     unset($_tematiche[$_key]);
                     $this->object->setAttribute('tags', implode(';', $_tematiche));
                 }
                 $tematicheChanged = true;
             } else {
                 if ($action[0] == 'EnableTag') {
                     $_tematiche = $this->getTematiche();
                     $_tematiche[] = $value;
                     $this->object->setAttribute('tags', implode(';', $_tematiche));
                     $tematicheChanged = true;
                 }
             }
         }
         if ($tematicheChanged) {
             $this->object->store();
         }
     }
 }