示例#1
0
 /**
  * Fetches the HTTP POST input and stores it in the data instance
  *
  * @param eZInformationCollection $collection
  * @param eZInformationCollectionAttribute $collectionAttribute
  * @param eZHTTPTool $http
  * @param string $base
  * @param eZContentObjectAttribute $contentObjectAttribute
  *
  * @return bool
  */
 function fetchCollectionAttributeHTTPInput($collection, $collectionAttribute, $http, $base, $contentObjectAttribute)
 {
     if ($http->hasPostVariable($base . self::OIB_VARIABLE . $contentObjectAttribute->attribute("id"))) {
         $data = trim($http->postVariable($base . self::OIB_VARIABLE . $contentObjectAttribute->attribute("id")));
         $collectionAttribute->setAttribute(self::OIB_FIELD, $data);
         return true;
     }
     return false;
 }
 /**
  * Fetches the HTTP collected information for the content object attribute.
  *
  * @param eZInformationCollection $collection
  * @param eZInformationCollectionAttribute $collectionAttribute
  * @param eZHTTPTool $http
  * @param string $base
  * @param eZContentObjectAttribute $objectAttribute
  *
  * @return bool
  */
 public function fetchCollectionAttributeHTTPInput($collection, $collectionAttribute, $http, $base, $objectAttribute)
 {
     $id = $objectAttribute->attribute('id');
     $classContent = $objectAttribute->classContent();
     $nameArray = array();
     $selectionName = join('_', array($base, 'sckenhancedselection_selection', $id));
     if ($http->hasPostVariable($selectionName)) {
         $selection = $http->postVariable($selectionName);
         if (count($selection) > 0) {
             $options = $classContent['options'];
             if (isset($classContent['db_options']) && count($classContent['db_options']) > 0) {
                 $options = $classContent['db_options'];
             }
             foreach ($options as $option) {
                 if (in_array($option['identifier'], $selection)) {
                     $nameArray[] = $option['name'];
                 }
             }
             unset($options);
         }
     }
     $delimiter = $classContent['delimiter'];
     if (empty($delimiter)) {
         $delimiter = ', ';
     }
     $dataText = join($delimiter, $nameArray);
     $collectionAttribute->setAttribute('data_text', $dataText);
     return true;
 }