/**
  * @return array
  */
 protected function getValues()
 {
     if ($this->values === null) {
         $this->values = array();
         if ($this->contentClassAttribute->attribute('data_type_string') == 'ezobjectrelationlist') {
             //$field = ezfSolrDocumentFieldBase::generateSubattributeFieldName( $this->contentClassAttribute, 'name', 'string' );
             //@todo errore nella definzione del nome del sottoattributo? verifaicare vedi anche in self::buildFetch
             //$field = ezfSolrDocumentFieldBase::$DocumentFieldName->lookupSchemaName(
             //    ezfSolrDocumentFieldBase::SUBMETA_FIELD_PREFIX . $this->contentClassAttribute->attribute( 'identifier' ) . ezfSolrDocumentFieldBase::SUBATTR_FIELD_SEPARATOR . 'name',
             //    'string');
             $field = ezfSolrDocumentFieldBase::$DocumentFieldName->lookupSchemaName(ezfSolrDocumentFieldBase::SUBATTR_FIELD_PREFIX . $this->contentClassAttribute->attribute('identifier') . ezfSolrDocumentFieldBase::SUBATTR_FIELD_SEPARATOR . 'name' . ezfSolrDocumentFieldBase::SUBATTR_FIELD_SEPARATOR, 'string');
         } else {
             $field = ezfSolrDocumentFieldBase::generateAttributeFieldName($this->contentClassAttribute, 'string');
         }
         $facets = array('field' => $field, 'name' => $this->attributes['name'], 'limit' => 300, 'sort' => 'alpha');
         $fetchParameters = array('SearchContentClassID' => array($this->contentClassAttribute->attribute('contentclass_id')), 'Facet' => array($facets));
         $data = $this->client->fetchRemoteNavigationList($fetchParameters);
         if (isset($data[$this->attributes['name']])) {
             $this->values = $data[$this->attributes['name']];
             // setto i valori attivi e inietto il conto nel nome
             foreach ($this->values as $index => $value) {
                 $current = (array) $this->attributes['value'];
                 if (in_array($value['query'], $current)) {
                     $this->values[$index]['active'] = true;
                 }
                 $this->values[$index]['query'] = OCFacetNavgationHelper::encodeValue($this->values[$index]['query']);
                 if (isset($value['count']) && $value['count'] > 0) {
                     $this->values[$index]['name'] = $value['name'] . ' (' . $value['count'] . ')';
                 }
             }
         }
     }
     return $this->values;
 }
 /**
  * Identifies, based on the existing object relations, the type of the subattribute.
  *
  * @param eZContentClassAttribute $classAttribute
  * @param $subAttribute
  * @param $context
  *
  * @return bool|string
  */
 protected static function getTypeForSubattribute(eZContentClassAttribute $classAttribute, $subAttribute, $context)
 {
     $q = "SELECT DISTINCT( ezcoa.data_type_string )\n                FROM   ezcontentobject_link AS ezcol,\n                       ezcontentobject_attribute AS ezcoa,\n                       ezcontentclass_attribute AS ezcca,\n                       ezcontentclass_attribute AS ezcca_target\n                WHERE  ezcol.contentclassattribute_id={$classAttribute->attribute('id')}\n                  AND  ezcca_target.identifier='{$subAttribute}'\n                  AND  ezcca.data_type_string='{$classAttribute->attribute('data_type_string')}'\n                  AND  ezcca.id=ezcol.contentclassattribute_id\n                  AND  ezcol.to_contentobject_id = ezcoa.contentobject_id\n                  AND  ezcoa.contentclassattribute_id = ezcca_target.id;\n        ";
     $rows = eZDB::instance()->arrayQuery($q);
     if (count($rows) == 0) {
         return self::DEFAULT_SUBATTRIBUTE_TYPE;
     }
     if ($rows and count($rows) > 0) {
         if (count($rows) > 1) {
             $msg = "Multiple types were found for subattribute '{$subAttribute}' of class attribute #{$classAttribute->attribute('id')} [{$classAttribute->attribute('data_type_string')}]. This means that objects of different content classes were related through class attribute #{$classAttribute->attribute('id')} and had attributes named '{$subAttribute}' of different datatypes : \n" . print_r($rows, true) . " Picking the first one here : {$rows[0]['data_type_string']}";
             eZDebug::writeWarning($msg, __METHOD__);
         }
         return ezfSolrDocumentFieldBase::getClassAttributeType(new eZContentClassAttribute($rows[0]), null, $context);
     }
     return false;
 }
Пример #3
0
 /**
  * Validates $data with the constraints defined on the class attribute
  *
  * @param $data
  * @param eZContentObjectAttribute $contentObjectAttribute
  * @param eZContentClassAttribute $classAttribute
  *
  * @return int
  */
 function validateIntegerHTTPInput($data, $contentObjectAttribute, $classAttribute)
 {
     $min = $classAttribute->attribute(self::MIN_VALUE_FIELD);
     $max = $classAttribute->attribute(self::MAX_VALUE_FIELD);
     $input_state = $classAttribute->attribute(self::INPUT_STATE_FIELD);
     switch ($input_state) {
         case self::NO_MIN_MAX_VALUE:
             $this->IntegerValidator->setRange(false, false);
             $state = $this->IntegerValidator->validate($data);
             if ($state === eZInputValidator::STATE_INVALID || $state === eZInputValidator::STATE_INTERMEDIATE) {
                 $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The input is not a valid integer.'));
             } else {
                 return $state;
             }
             break;
         case self::HAS_MIN_VALUE:
             $this->IntegerValidator->setRange($min, false);
             $state = $this->IntegerValidator->validate($data);
             if ($state === eZInputValidator::STATE_ACCEPTED) {
                 return eZInputValidator::STATE_ACCEPTED;
             } else {
                 $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The number must be greater than %1'), $min);
             }
             break;
         case self::HAS_MAX_VALUE:
             $this->IntegerValidator->setRange(false, $max);
             $state = $this->IntegerValidator->validate($data);
             if ($state === 1) {
                 return eZInputValidator::STATE_ACCEPTED;
             } else {
                 $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The number must be less than %1'), $max);
             }
             break;
         case self::HAS_MIN_MAX_VALUE:
             $this->IntegerValidator->setRange($min, $max);
             $state = $this->IntegerValidator->validate($data);
             if ($state === 1) {
                 return eZInputValidator::STATE_ACCEPTED;
             } else {
                 $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The number is not within the required range %1 - %2'), $min, $max);
             }
             break;
     }
     return eZInputValidator::STATE_INVALID;
 }
 /**
  * Validates $data with the constraints defined on the class attribute
  *
  * @param $data
  * @param eZContentObjectAttribute $contentObjectAttribute
  * @param eZContentClassAttribute $classAttribute
  *
  * @return int
  */
 function validateFloatHTTPInput($data, $contentObjectAttribute, $classAttribute)
 {
     $min = $classAttribute->attribute(self::MIN_FIELD);
     $max = $classAttribute->attribute(self::MAX_FIELD);
     $inputState = $classAttribute->attribute(self::INPUT_STATE_FIELD);
     switch ($inputState) {
         case self::NO_MIN_MAX_VALUE:
             $state = $this->FloatValidator->validate($data);
             if ($state === eZInputValidator::STATE_ACCEPTED) {
                 return eZInputValidator::STATE_ACCEPTED;
             } else {
                 $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The given input is not a floating point number.'));
             }
             break;
         case self::HAS_MIN_VALUE:
             $this->FloatValidator->setRange($min, false);
             $state = $this->FloatValidator->validate($data);
             if ($state === eZInputValidator::STATE_ACCEPTED) {
                 return eZInputValidator::STATE_ACCEPTED;
             } else {
                 $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The input must be greater than %1'), $min);
             }
             break;
         case self::HAS_MAX_VALUE:
             $this->FloatValidator->setRange(false, $max);
             $state = $this->FloatValidator->validate($data);
             if ($state === eZInputValidator::STATE_ACCEPTED) {
                 return eZInputValidator::STATE_ACCEPTED;
             } else {
                 $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The input must be less than %1'), $max);
             }
             break;
         case self::HAS_MIN_MAX_VALUE:
             $this->FloatValidator->setRange($min, $max);
             $state = $this->FloatValidator->validate($data);
             if ($state === eZInputValidator::STATE_ACCEPTED) {
                 return eZInputValidator::STATE_ACCEPTED;
             } else {
                 $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The input is not in defined range %1 - %2'), $min, $max);
             }
             break;
     }
     return eZInputValidator::STATE_INVALID;
 }
 public static function getFieldName(eZContentClassAttribute $classAttribute, $subAttribute = null, $context = 'search')
 {
     switch ($classAttribute->attribute('data_type_string')) {
         case 'ezinteger':
             return parent::generateAttributeFieldName($classAttribute, self::getClassAttributeType($classAttribute, null, $context));
             break;
         default:
             break;
     }
 }
Пример #6
0
 /**
  * Validates $data with the constraints defined on the class attribute
  *
  * @param $data
  * @param eZContentObjectAttribute $contentObjectAttribute
  * @param eZContentClassAttribute $classAttribute
  *
  * @return int
  */
 function validateStringHTTPInput($data, $contentObjectAttribute, $classAttribute)
 {
     $maxLen = $classAttribute->attribute(self::MAX_LEN_FIELD);
     $textCodec = eZTextCodec::instance(false);
     if ($textCodec->strlen($data) > $maxLen and $maxLen > 0) {
         $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The input text is too long. The maximum number of characters allowed is %1.'), $maxLen);
         return eZInputValidator::STATE_INVALID;
     }
     return eZInputValidator::STATE_ACCEPTED;
 }
	public static function getFieldName( eZContentClassAttribute $classAttribute, $subAttribute = null )
    {
        $contentClassAttributeIdentifier = $classAttribute->attribute( 'identifier' );
        if ( $subAttribute != null )
        {
            $suffix = self::getPostFix( $contentClassAttributeIdentifier );
            return 'attr_'.$contentClassAttributeIdentifier.'_'.$subAttribute.$suffix;
        }
        return self::generateAttributeFieldName( $classAttribute, self::getClassAttributeType( $classAttribute ) );
    }
 /**
  * test for getFieldName()
  */
 public function testGetFieldName()
 {
     $providerArray = array();
     $ezcca1 = new eZContentClassAttribute(array('identifier' => 'title', 'data_type_string' => 'ezstring'));
     $expected1 = ezfSolrDocumentFieldBase::ATTR_FIELD_PREFIX . 'title_t';
     $providerArray[] = array($expected1, $ezcca1, null);
     // Testing the default subattribute
     $ezcca2 = new eZContentClassAttribute(array('identifier' => 'dummy', 'data_type_string' => 'dummy_example'));
     $expected2 = ezfSolrDocumentFieldBase::ATTR_FIELD_PREFIX . 'dummy_t';
     $providerArray[] = array($expected2, $ezcca2, null);
     //Testing the class/attribute/subattribute syntax, with the secondary subattribute of
     //  the 'dummy' datatype
     $ezcca3 = $ezcca2;
     $expected3 = ezfSolrDocumentFieldBase::SUBATTR_FIELD_PREFIX . 'dummy-subattribute1_i';
     $options3 = 'subattribute1';
     $providerArray[] = array($expected3, $ezcca3, $options3);
     //Testing the class/attribute/subattribute syntax, with the default subattribute of
     //  the 'dummy' datatype
     $ezcca5 = $ezcca2;
     $expected5 = ezfSolrDocumentFieldBase::ATTR_FIELD_PREFIX . 'dummy_t';
     $options5 = 'subattribute2';
     $providerArray[] = array($expected5, $ezcca5, $options5);
     //Testing the class/attribute/subattribute syntax for ezobjectrelation attributes
     $time4 = time();
     $image4 = new ezpObject("image", 2);
     $image4->name = __METHOD__ . $time4;
     $image4->caption = __METHOD__ . $time4;
     $imageId4 = $image4->publish();
     $srcObjId4 = 123456;
     $ezcca4 = new eZContentClassAttribute(array('id' => $time4, 'identifier' => 'image', 'data_type_string' => 'ezobjectrelation', 'data_int' => $imageId4));
     $ezcca4->store();
     //Create entry in ezcontentobject_link
     $q4 = "INSERT INTO ezcontentobject_link VALUES( {$ezcca4->attribute('id')}, {$srcObjId4}, 1, 123456, 0, 8, {$imageId4} );";
     eZDB::instance()->query($q4);
     $expected4 = ezfSolrDocumentFieldBase::SUBATTR_FIELD_PREFIX . 'image-name_t';
     $options4 = 'name';
     $providerArray[] = array($expected4, $ezcca4, $options4);
     // Testing the class/attribute/subattribute syntax for ezobjectrelation attributes, with a subattribute of
     // a different type than the default Solr type :
     $ezcca5 = $ezcca4;
     $expected5 = ezfSolrDocumentFieldBase::SUBATTR_FIELD_PREFIX . 'image-caption_t';
     $options5 = 'caption';
     $providerArray[] = array($expected5, $ezcca5, $options5);
     // perform actual testing
     foreach ($providerArray as $input) {
         $expected = $input[0];
         $contentClassAttribute = $input[1];
         $options = $input[2];
         self::assertEquals($expected, ezfSolrDocumentFieldBase::getFieldName($contentClassAttribute, $options));
     }
 }
 public static function getFieldName(eZContentClassAttribute $classAttribute, $subAttribute = null, $context = 'search')
 {
     switch ($classAttribute->attribute('data_type_string')) {
         case 'ezmatrix':
             if ($subAttribute and $subAttribute !== '') {
                 // A subattribute was passed
                 return parent::generateSubattributeFieldName($classAttribute, $subAttribute, self::DEFAULT_SUBATTRIBUTE_TYPE);
             } else {
                 // return the default field name here.
                 return parent::generateAttributeFieldName($classAttribute, self::getClassAttributeType($classAttribute, null, $context));
             }
             break;
     }
     return null;
 }
 /**
  * @param eZContentClassAttribute $attribute
  *
  * @return OCClassSearchFormAttributeField
  */
 public static function instance(eZContentClassAttribute $attribute)
 {
     if (self::$fieldHandlers === null) {
         self::$fieldHandlers = array();
         if (eZINI::instance('ocsearchtools.ini')->hasVariable('ClassSearchFormHandlers', 'AttributeHandlers')) {
             self::$fieldHandlers = eZINI::instance('ocsearchtools.ini')->variable('ClassSearchFormHandlers', 'AttributeHandlers');
         }
     }
     if (!isset(self::$_instances[$attribute->attribute('id')])) {
         if (isset(self::$fieldHandlers[$attribute->attribute('data_type_string')]) && class_exists(self::$fieldHandlers[$attribute->attribute('data_type_string')])) {
             $className = self::$fieldHandlers[$attribute->attribute('data_type_string')];
         } else {
             $className = 'OCClassSearchFormAttributeField';
         }
         self::$_instances[$attribute->attribute('id')] = new $className($attribute);
     }
     return self::$_instances[$attribute->attribute('id')];
 }
Пример #11
0
 /**
  * Return content action(s) which can be performed on object containing
  * the current datatype. Return format is array of arrays with key 'name'
  * and 'action'. 'action' can be mapped to url in datatype.ini
  *
  * @param eZContentClassAttribute $classAttribute
  * @return array
  */
 function contentActionList($classAttribute)
 {
     $actionList = array();
     if ($classAttribute instanceof eZContentClassAttribute) {
         if ($classAttribute->attribute('is_information_collector') == true) {
             $actionList[] = array('name' => ezpI18n::tr('kernel/classes/datatypes', 'Send', 'Datatype information collector action'), 'action' => 'ActionCollectInformation');
         }
     } else {
         eZDebug::writeError('$classAttribute isn\'t an object.', __METHOD__);
     }
     return $actionList;
 }
Пример #12
0
 /**
  * Adds the necessary DOM structure to the attribute parameters
  *
  * @param eZContentClassAttribute $classAttribute
  * @param DOMNode $attributeNode
  * @param DOMNode $attributeParametersNode
  */
 public function serializeContentClassAttribute($classAttribute, $attributeNode, $attributeParametersNode)
 {
     $dom = $attributeParametersNode->ownerDocument;
     $subTreeLimit = (string) $classAttribute->attribute(self::SUBTREE_LIMIT_FIELD);
     $domNode = $dom->createElement('subtree-limit');
     $domNode->appendChild($dom->createTextNode($subTreeLimit));
     $attributeParametersNode->appendChild($domNode);
     $maxTags = (string) $classAttribute->attribute(self::MAX_TAGS_FIELD);
     $domNode = $dom->createElement('max-tags');
     $domNode->appendChild($dom->createTextNode($maxTags));
     $attributeParametersNode->appendChild($domNode);
     $showDropDown = (int) $classAttribute->attribute(self::SHOW_DROPDOWN_FIELD) > 0 ? 'true' : 'false';
     $domNode = $dom->createElement('dropdown');
     $domNode->appendChild($dom->createTextNode($showDropDown));
     $attributeParametersNode->appendChild($domNode);
     $hideRootTag = (int) $classAttribute->attribute(self::HIDE_ROOT_TAG_FIELD) > 0 ? 'true' : 'false';
     $domNode = $dom->createElement('hide-root-tag');
     $domNode->appendChild($dom->createTextNode($hideRootTag));
     $attributeParametersNode->appendChild($domNode);
 }
Пример #13
0
 /**
  * Returns the content for the class attribute
  * Result is an associative array :
  * 		- default_activated (bool)
  * 		- comments_by_location (bool)
  *
  * @param eZContentClassAttribute $classAttribute
  * @return array
  * @see eZDataType::classAttributeContent()
  */
 public function classAttributeContent($classAttribute)
 {
     return array('default_activated' => (bool) $classAttribute->attribute(self::CLASSATTRIBUTE_COMMENTS_ACTIVATED_DEFAULT_FIELD));
 }
Пример #14
0
 /**
  * @param eZContentClassAttribute $localeAttribute
  * @param string $newDataTypeString
  */
 protected function changeContentObjectAttributeDataTypeString($localeAttribute, $newDataTypeString)
 {
     /** @var eZContentObjectAttribute[] $contentAttributes */
     $contentAttributes = eZContentObjectAttribute::fetchSameClassAttributeIDList($localeAttribute->attribute('id'), true);
     foreach ($contentAttributes as $attribute) {
         $attribute->setAttribute('data_type_string', $newDataTypeString);
         $attribute->store();
     }
 }
 /**
  * Fetches all variables inputed on content class level
  * return true if fetching of class attributes are successfull, false if not
  *
  * @param eZHTTPTool $http
  * @param string $base
  * @param eZContentClassAttribute $classAttribute
  * @return bool
  */
 function fetchClassAttributeHTTPInput($http, $base, $classAttribute)
 {
     if ($http->hasPostVariable($base . '_ezpage_default_layout_' . $classAttribute->attribute('id'))) {
         $defaultLayout = $http->postVariable($base . '_ezpage_default_layout_' . $classAttribute->attribute('id'));
         $classAttribute->setAttribute('data_text1', $defaultLayout);
     }
     return true;
 }
Пример #16
0
 /**
  * Fetches all variables inputed on content class level
  * return true if fetching of class attributes are successfull, false if not
  *
  * @param eZHTTPTool $http
  * @param string $base
  * @param eZContentClassAttribute $classAttribute
  * @return bool
  */
 function fetchClassAttributeHTTPInput( $http, $base, $classAttribute )
 {
     if ( $http->hasPostVariable( $base . '_ezpage_default_layout_' . $classAttribute->attribute( 'id' ) ) )
     {
         $defaultLayout = $http->postVariable( $base . '_ezpage_default_layout_' . $classAttribute->attribute( 'id' ) );
         $classAttribute->setAttribute( self::DEFAULT_ZONE_LAYOUT_FIELD, $defaultLayout );
     }
     return true;
 }
 function deleteNotVersionedStoredClassAttribute(eZContentClassAttribute $classAttribute)
 {
     eZContentObjectAttribute::removeRelationsByContentClassAttributeId($classAttribute->attribute('id'));
 }
 /**
  * Generates the full Solr field name for a metadata subattribute.
  * Helper method to be used, if needed, by datatype-specific handlers.
  * Used particularly when indexing metadata of a related object.
  *
  * @param string $baseName
  * @param eZContentClassAttribute $classAttribute
  * @return string
  *
  * @example
  *      If $baseName equals 'main_url_alias', and $classAttribute
  *      has as identifier 'dummy', the return value will be :
  *      'submeta_dummy-main_url_alias_s'
  *
  * @see ezfSolrDocumentFieldObjectRelation
  */
 public static function generateSubmetaFieldName($baseName, eZContentClassAttribute $classAttribute)
 {
     return self::$DocumentFieldName->lookupSchemaName(self::SUBMETA_FIELD_PREFIX . $classAttribute->attribute('identifier') . self::SUBATTR_FIELD_SEPARATOR . $baseName, eZSolr::getMetaAttributeType($baseName));
 }
Пример #19
0
 /**
  * Get the content
  *
  * @param eZContentClassAttribute $contentClassAttribute
  *
  * @return array
  */
 function classAttributeContent($contentClassAttribute)
 {
     return json_decode($contentClassAttribute->attribute('data_text5'), true);
 }
 /**
  * Executes a custom action for a class attribute which was defined on the web page.
  *
  * @param eZHTTPTool $http
  * @param string $action
  * @param eZContentClassAttribute $classAttribute
  */
 public function customClassAttributeHTTPAction($http, $action, $classAttribute)
 {
     $id = $classAttribute->attribute('id');
     $base = "ContentClass";
     $content = $classAttribute->content();
     $customActionVarName = "CustomActionButton";
     $customActionKeyName = "{$id}_{$action}";
     $idArrayName = join('_', array($base, 'sckenhancedselection_id', $id));
     $idArray = array();
     if ($http->hasPostVariable($idArrayName)) {
         $idArray = $http->postVariable($idArrayName);
     }
     switch ($action) {
         case 'new_option':
             $maxID = 0;
             foreach ($content['options'] as $option) {
                 if (intval($option['id']) > $maxID) {
                     $maxID = intval($option['id']);
                 }
             }
             $maxID++;
             $content['options'][] = array('id' => $maxID, 'name' => '', 'identifier' => '', 'priority' => 1);
             break;
         case 'remove_optionlist':
             $removeArrayName = join('_', array($base, "sckenhancedselection_remove", $id));
             if ($http->hasPostVariable($removeArrayName)) {
                 $removeArray = $http->postVariable($removeArrayName);
                 foreach ($removeArray as $removeID) {
                     unset($idArray[$removeID]);
                     unset($content['options'][$removeID]);
                 }
             }
             break;
         case 'move_up':
             $customActionVar = $http->postVariable($customActionVarName);
             // This is where the user clicked
             $customActionValue = $customActionVar[$customActionKeyName];
             // Up == swap selected row with the one above
             // Or: Move the row above below the selected one
             $this->swapRows($customActionValue - 1, $customActionValue, $content, $idArray);
             break;
         case 'move_down':
             $customActionVar = $http->postVariable($customActionVarName);
             // This is where the user clicked
             $customActionValue = $customActionVar[$customActionKeyName];
             // Down == swap selected row with the one below
             // Or: Move the selected row below the one below
             $this->swapRows($customActionValue, $customActionValue + 1, $content, $idArray);
             break;
         case 'sort_optionlist':
             $sortName = join('_', array($base, 'sckenhancedselection_sort_order', $id));
             if ($http->hasPostVariable($sortName)) {
                 $sort = $http->postVariable($sortName);
                 $sortArray = array();
                 $sortOrder = SORT_ASC;
                 $sortType = SORT_STRING;
                 $numericSorts = array('prior');
                 if (strpos($sort, '_') !== false) {
                     list($type, $ranking) = explode('_', $sort);
                     $currentOptions = $content['options'];
                     if ($ranking === 'desc') {
                         $sortOrder = SORT_DESC;
                     }
                     if (in_array($type, $numericSorts)) {
                         $sortType = SORT_NUMERIC;
                     }
                     // Use POST priorities instead of the stored ones
                     // Otherwise you have to store new priorities before you can sort
                     $priorityArray = array();
                     if ($type == 'prior') {
                         $priorityArray = $http->postVariable(join('_', array($base, 'sckenhancedselection_priority', $id)));
                     }
                     foreach (array_keys($currentOptions) as $key) {
                         $option = $currentOptions[$key];
                         switch ($type) {
                             case 'prior':
                                 if (isset($priorityArray[$option['id']])) {
                                     $option['priority'] = $priorityArray[$option['id']];
                                 }
                                 $sortArray[] = $option['priority'];
                                 break;
                             case 'alpha':
                             default:
                                 $sortArray[] = $option['name'];
                                 break;
                         }
                         unset($option);
                     }
                     array_multisort($sortArray, $sortOrder, $sortType, $currentOptions);
                     $idArray = array();
                     foreach ($currentOptions as $option) {
                         $idArray[] = $option['id'];
                     }
                     $content['options'] = $currentOptions;
                 } else {
                     eZDebug::writeError("Unknown sort value. Please use the form type_order (ex. alpha_asc)", "SckEnhancedSelectionType");
                 }
             }
             break;
         default:
             eZDebug::writeError("Unknown class HTTP action: {$action}", "SckEnhancedSelectionType");
     }
     $classAttribute->setContent($content);
     $classAttribute->store();
     $http->setPostVariable($idArrayName, $idArray);
 }