本文整理匯總了PHP中eZContentClassAttribute::store方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentClassAttribute::store方法的具體用法?PHP eZContentClassAttribute::store怎麽用?PHP eZContentClassAttribute::store使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZContentClassAttribute
的用法示例。
在下文中一共展示了eZContentClassAttribute::store方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initializeClassAttribute
/**
* Sets the default values in class attribute
*
* @param eZContentClassAttribute $classAttribute
*/
function initializeClassAttribute( $classAttribute )
{
if ( $classAttribute->attribute( self::DEFAULT_ZONE_LAYOUT_FIELD ) === null )
$classAttribute->setAttribute( self::DEFAULT_ZONE_LAYOUT_FIELD, '' );
$classAttribute->store();
}
示例2: testGetFieldName
/**
* 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));
}
}
示例3: initializeClassAttribute
/**
* Initializes the content class attribute
*
* @param eZContentClassAttribute $classAttribute
*/
public function initializeClassAttribute($classAttribute)
{
if ($classAttribute->attribute(self::SUBTREE_LIMIT_FIELD) === null) {
$classAttribute->setAttribute(self::SUBTREE_LIMIT_FIELD, 0);
}
if ($classAttribute->attribute(self::SHOW_DROPDOWN_FIELD) === null) {
$classAttribute->setAttribute(self::SHOW_DROPDOWN_FIELD, 0);
}
if ($classAttribute->attribute(self::HIDE_ROOT_TAG_FIELD) === null) {
$classAttribute->setAttribute(self::HIDE_ROOT_TAG_FIELD, 0);
}
if ($classAttribute->attribute(self::MAX_TAGS_FIELD) === null) {
$classAttribute->setAttribute(self::MAX_TAGS_FIELD, 0);
}
$classAttribute->store();
}
示例4: customClassAttributeHTTPAction
//.........這裏部分代碼省略.........
$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);
}