當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZContentClassAttribute::fetch方法代碼示例

本文整理匯總了PHP中eZContentClassAttribute::fetch方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentClassAttribute::fetch方法的具體用法?PHP eZContentClassAttribute::fetch怎麽用?PHP eZContentClassAttribute::fetch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZContentClassAttribute的用法示例。


在下文中一共展示了eZContentClassAttribute::fetch方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAttributeData

    /**
     * @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
     * @return array for further processing
     */

    public static function getAttributeData ( eZContentObjectAttribute $contentObjectAttribute )
    {
        $dataTypeIdentifier = $contentObjectAttribute->attribute( 'data_type_string' );
        $contentClassAttribute = eZContentClassAttribute::fetch( $contentObjectAttribute->attribute( 'contentclassattribute_id' ) );
        $attributeHandler =  $dataTypeIdentifier . 'SolrStorage';
        // prefill the array with generic metadata first
        $target = array (
            'data_type_identifier' => $dataTypeIdentifier,
            'version_format' => self::STORAGE_VERSION_FORMAT,
            'attribute_identifier' => $contentClassAttribute->attribute( 'identifier' ),
            'has_content' => $contentObjectAttribute->hasContent(),

            );
        if ( class_exists( $attributeHandler ) )
        {
            $attributeContent = call_user_func( array( $attributeHandler, 'getAttributeContent' ),
                     $contentObjectAttribute, $contentClassAttribute );
            return array_merge( $target, $attributeContent, array( 'content_method' => self::CONTENT_METHOD_CUSTOM_HANDLER ) );

        }
        else
        {
            $target = array_merge( $target, array(
                'content_method' => self::CONTENT_METHOD_TOSTRING,
                'content' => $contentObjectAttribute->toString(),
                'has_rendered_content' => false,
                'rendered' => null
                ));
            return $target;
        }
    }
開發者ID:sushilbshinde,項目名稱:ezpublish-study,代碼行數:36,代碼來源:ezfsolrstorage.php

示例2: buildFetch

 public function buildFetch()
 {
     $filters = array();
     foreach ($this->requestFields as $key => $value) {
         if (strpos($key, OCClassSearchFormAttributeField::NAME_PREFIX) !== false) {
             $contentClassAttributeID = str_replace(OCClassSearchFormAttributeField::NAME_PREFIX, '', $key);
             $contentClassAttribute = eZContentClassAttribute::fetch($contentClassAttributeID);
             if ($contentClassAttribute instanceof eZContentClassAttribute) {
                 $field = OCClassSearchFormAttributeField::instance($contentClassAttribute);
                 $field->buildFetch($this, $key, $value, $filters);
                 $this->isFetch = true;
             }
         } elseif (in_array($key, OCFacetNavgationHelper::$allowedUserParamters)) {
             if (!empty($value)) {
                 $this->currentParameters[$key] = $value;
                 $this->isFetch = true;
             }
         } elseif ($key == 'class_id') {
             $this->currentParameters[$key] = $value;
             $this->addFetchField(array('name' => ezpI18n::tr('extension/ezfind/facets', 'Content type'), 'value' => eZContentClass::fetch($value)->attribute('name'), 'remove_view_parameters' => $this->getViewParametersString(array($key))));
             $this->isFetch = true;
         } elseif ($key == 'publish_date') {
             $publishedField = new OCClassSearchFormPublishedField($this->requestFields['class_id']);
             $publishedField->buildFetch($this, $value, $filters);
             $this->isFetch = true;
         } elseif ($key == 'query') {
             $queryField = new OCClassSearchFormQueryField();
             $queryField->buildFetch($this, $value);
             $this->searchText = $queryField->queryText();
             $this->isFetch = true;
         }
     }
     $this->currentParameters['filter'] = $filters;
     return $this->currentParameters;
 }
開發者ID:OpencontentCoop,項目名稱:ocsearchtools,代碼行數:35,代碼來源:occlasssearchformfetcher.php

示例3: classAttributeName

 function classAttributeName()
 {
     if ($this->ClassAttributeName === null) {
         $contentClassAttribute = eZContentClassAttribute::fetch($this->attribute('contentclass_attribute_id'));
         $this->ClassAttributeName = $contentClassAttribute->attribute('name');
     }
     return $this->ClassAttributeName;
 }
開發者ID:legende91,項目名稱:ez,代碼行數:8,代碼來源:ezwaituntildatevalue.php

示例4: classAttributeName

 function classAttributeName()
 {
     if ($this->ClassAttributeName === null) {
         $contentClassAttribute = eZContentClassAttribute::fetch($this->attribute('contentclass_attribute_id'));
         if (!$contentClassAttribute instanceof eZContentClassAttribute) {
             eZDebug::writeError('Unable to find eZContentClassAttribute #' . $this->attribute('contentclass_attribute_id'), __METHOD__);
             return null;
         }
         $this->ClassAttributeName = $contentClassAttribute->attribute('name');
     }
     return $this->ClassAttributeName;
 }
開發者ID:patrickallaert,項目名稱:ezpublish-legacy-php7,代碼行數:12,代碼來源:ezwaituntildatevalue.php

示例5: addEntry

 function addEntry($contentClassAttributeID, $contentClassID = false)
 {
     if (!isset($contentClassAttributeID)) {
         return;
     }
     if (!$contentClassID) {
         $contentClassAttribute = eZContentClassAttribute::fetch($contentClassAttributeID);
         $contentClassID = $contentClassAttribute->attribute('contentclass_id');
     }
     // Checking if $contentClassAttributeID and $contentClassID already exist (in Entries)
     foreach ($this->Entries as $entrie) {
         if ($entrie->attribute('contentclass_attribute_id') == $contentClassAttributeID and $entrie->attribute('contentclass_id') == $contentClassID) {
             return;
         }
     }
     $waitUntilDateValue = eZWaitUntilDateValue::create($this->WorkflowEventID, $this->WorkflowEventVersion, $contentClassAttributeID, $contentClassID);
     $waitUntilDateValue->store();
     $this->Entries = eZWaitUntilDateValue::fetchAllElements($this->WorkflowEventID, $this->WorkflowEventVersion);
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:19,代碼來源:ezwaituntildate.php

示例6: validateClassAttributeHTTPInput

 function validateClassAttributeHTTPInput($http, $base, $classAttribute)
 {
     $typeParam = $base . self::CLASS_TYPE . $classAttribute->attribute('id');
     $fileParam = $base . self::CLASS_FILE . $classAttribute->attribute('id');
     $sectionParam = $base . self::CLASS_SECTION . $classAttribute->attribute('id');
     $parameterParam = $base . self::CLASS_PARAMETER . $classAttribute->attribute('id');
     if ($http->hasPostVariable($fileParam) and $http->hasPostVariable($sectionParam) and $http->hasPostVariable($parameterParam) and $http->hasPostVariable($typeParam) and (int) $http->postVariable($typeParam) > 0 and (int) $http->postVariable($typeParam) <= 6) {
         $liveClassAttribute = eZContentClassAttribute::fetch($classAttribute->attribute('id'));
         if (is_object($liveClassAttribute)) {
             $new_type = (int) $http->postVariable($typeParam);
             $old_type = (int) $liveClassAttribute->attribute(self::CLASS_TYPE_FIELD);
             if ($new_type !== $old_type and ($new_type === ymcDynamicIniSetting::TYPE_ARRAY or $old_type === ymcDynamicIniSetting::TYPE_ARRAY)) {
                 eZDebug::writeNotice('It is not possible to change an existing type from/to the array-type', 'ymcDynamicIniSettingType::validateClassAttributeHTTPInput');
                 return eZInputValidator::STATE_INVALID;
             }
         }
         return eZInputValidator::STATE_ACCEPTED;
     }
     eZDebug::writeNotice('Could not validate parameters: ' . "\n" . $fileParam . ':' . $http->postVariable($fileParam) . "\n" . $sectionParam . ':' . $http->postVariable($sectionParam) . "\n" . $parameterParam . ':' . $http->postVariable($parameterParam) . "\n" . $typeParam . ':' . $http->postVariable($typeParam), 'ymcDynamicIniSettingType::validateClassAttributeHTTPInput');
     return eZInputValidator::STATE_INVALID;
 }
開發者ID:pascalvb,項目名稱:eZ-ExtensionLoader,代碼行數:21,代碼來源:ymcdynamicinisettingtype.php

示例7: search

 /**
  * Searches $searchText in the search database.
  *
  * @param string $searchText Search term
  * @param array $params Search parameters
  * @param array $searchTypes Search types
  *
  * @return array
  */
 public function search($searchText, $params = array(), $searchTypes = array())
 {
     $searchText = trim($searchText);
     if (empty($searchText)) {
         return array('SearchResult' => array(), 'SearchCount' => 0, 'StopWordArray' => array());
     }
     $doFullText = true;
     $query = new LocationQuery();
     $criteria = array();
     if (isset($params['SearchDate']) && (int) $params['SearchDate'] > 0) {
         $currentTimestamp = time();
         $dateSearchType = (int) $params['SearchDate'];
         $fromTimestamp = 0;
         if ($dateSearchType === 1) {
             // Last day
             $fromTimestamp = $currentTimestamp - 86400;
         } else {
             if ($dateSearchType === 2) {
                 // Last week
                 $fromTimestamp = $currentTimestamp - 7 * 86400;
             } else {
                 if ($dateSearchType === 3) {
                     // Last month
                     $fromTimestamp = $currentTimestamp - 30 * 86400;
                 } else {
                     if ($dateSearchType === 4) {
                         // Last three months
                         $fromTimestamp = $currentTimestamp - 3 * 30 * 86400;
                     } else {
                         if ($dateSearchType === 5) {
                             // Last year
                             $fromTimestamp = $currentTimestamp - 365 * 86400;
                         }
                     }
                 }
             }
         }
         $criteria[] = new Criterion\DateMetadata(Criterion\DateMetadata::CREATED, Criterion\Operator::GTE, $fromTimestamp);
     }
     if (isset($params['SearchSectionID']) && (int) $params['SearchSectionID'] > 0) {
         $criteria[] = new Criterion\SectionId((int) $params['SearchSectionID']);
     }
     if (isset($params['SearchContentClassID']) && (int) $params['SearchContentClassID'] > 0) {
         $criteria[] = new Criterion\ContentTypeId((int) $params['SearchContentClassID']);
         if (isset($params['SearchContentClassAttributeID']) && (int) $params['SearchContentClassAttributeID'] > 0) {
             $classAttribute = eZContentClassAttribute::fetch($params['SearchContentClassAttributeID']);
             if ($classAttribute instanceof eZContentClassAttribute) {
                 $criteria[] = new Criterion\Field($classAttribute->attribute('identifier'), Criterion\Operator::LIKE, $searchText);
                 $doFullText = false;
             }
         }
     }
     if (isset($params['SearchSubTreeArray']) && !empty($params['SearchSubTreeArray'])) {
         $subTreeArrayCriteria = array();
         foreach ($params['SearchSubTreeArray'] as $nodeId) {
             $node = eZContentObjectTreeNode::fetch($nodeId);
             $subTreeArrayCriteria[] = $node->attribute('path_string');
         }
         $criteria[] = new Criterion\Subtree($subTreeArrayCriteria);
     }
     if ($doFullText) {
         $criteria[] = new Criterion\FullText($searchText);
     }
     $query->query = new Criterion\LogicalAnd($criteria);
     $query->limit = isset($params['SearchLimit']) ? (int) $params['SearchLimit'] : 10;
     $query->offset = isset($params['SearchOffset']) ? (int) $params['SearchOffset'] : 0;
     $useLocationSearch = eZINI::instance('ezplatformsearch.ini')->variable('SearchSettings', 'UseLocationSearch') === 'true';
     if ($useLocationSearch) {
         $searchResult = $this->repository->getSearchService()->findLocations($query);
     } else {
         $searchResult = $this->repository->getSearchService()->findContentInfo($query);
     }
     $nodeIds = array();
     foreach ($searchResult->searchHits as $searchHit) {
         $nodeIds[] = $useLocationSearch ? $searchHit->valueObject->id : $searchHit->valueObject->mainLocationId;
     }
     $nodes = eZContentObjectTreeNode::fetch($nodeIds);
     if ($nodes instanceof eZContentObjectTreeNode) {
         $nodes = array($nodes);
     } else {
         if (!is_array($nodes)) {
             $nodes = array();
         }
     }
     return array('SearchResult' => $nodes, 'SearchCount' => $searchResult->totalCount, 'StopWordArray' => array());
 }
開發者ID:harmstyler,項目名稱:ezplatformsearch,代碼行數:95,代碼來源:ezplatformsearch.php

示例8: count

    $attrcnt = count($attributes) + 1;
    $newAttribute->setName(ezpI18n::tr('kernel/class/edit', 'new attribute') . $attrcnt, $EditLanguage);
    $dataType = $newAttribute->dataType();
    $dataType->initializeClassAttribute($newAttribute);
    $newAttribute->store();
    $attributes[] = $newAttribute;
    $lastChangedID = $newAttribute->attribute('id');
} else {
    if ($http->hasPostVariable('MoveUp')) {
        $attribute = eZContentClassAttribute::fetch($http->postVariable('MoveUp'), true, eZContentClass::VERSION_STATUS_TEMPORARY, array('contentclass_id', 'version', 'placement'));
        $attribute->move(false);
        $Module->redirectTo($Module->functionURI('edit') . '/' . $ClassID . '/(language)/' . $EditLanguage);
        return;
    } else {
        if ($http->hasPostVariable('MoveDown')) {
            $attribute = eZContentClassAttribute::fetch($http->postVariable('MoveDown'), true, eZContentClass::VERSION_STATUS_TEMPORARY, array('contentclass_id', 'version', 'placement'));
            $attribute->move(true);
            $Module->redirectTo($Module->functionURI('edit') . '/' . $ClassID . '/(language)/' . $EditLanguage);
            return;
        }
    }
}
$Module->setTitle('Edit class ' . $class->attribute('name'));
// set session to allow current user to store class (to avoid direct post edit actions to this view)
if (!$http->hasSessionVariable('ClassCanStoreTicket')) {
    $http->setSessionVariable('ClassCanStoreTicket', 1);
}
// Fetch updated attributes
$attributes = $class->fetchAttributes();
$validation = array_merge($validation, $datatypeValidation);
// Template handling
開發者ID:brookinsconsulting,項目名稱:ezecosystem,代碼行數:31,代碼來源:edit.php

示例9: array

$arguments = false;
$useStandardOptions = true;
$options = $script->getOptions($config, $argumentConfig, $optionHelp, $arguments, $useStandardOptions);
$script->initialize();
if (count($options['arguments']) != 1) {
    $script->shutdown(1, 'wrong argument count');
}
$preview = $options['preview'] !== null;
$attributeID = $options['arguments'][0];
if (!is_numeric($attributeID)) {
    $attributeID = eZContentObjectTreeNode::classAttributeIDByIdentifier($attributeID);
    if ($attributeID === false) {
        $script->shutdown(2, 'unknown attribute identifier');
    }
}
$classAttribute = eZContentClassAttribute::fetch($attributeID);
if (!is_object($classAttribute)) {
    $script->shutdown(3, 'could not find a class attribute with the specified ID');
}
$enum = $classAttribute->attribute('content');
// both datatypes use data_int1 for the multiple flag, so the following code is not necessary
/*
$isMultiple = $enum->attribute( 'enum_ismultiple' );
$classAttribute->setAttribute( 'data_int1', $isMultiple );
*/
//var_dump( $enum );
$enumValues = $enum->attribute('enum_list');
$oldOptions = array();
$oldToNewIDMap = array();
foreach ($enumValues as $enumValue) {
    $element = $enumValue->attribute('enumelement');
開發者ID:CG77,項目名稱:ezpublish-legacy,代碼行數:31,代碼來源:convertezenumtoezselection.php

示例10: modify

 /**
  * @param $tpl eZTemplate
  * @param $operatorName array
  * @param $operatorParameters array
  * @param $rootNamespace string
  * @param $currentNamespace string
  * @param $operatorValue mixed
  * @param $namedParameters array
  *
  * @return mixed
  */
 function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     $ini = eZINI::instance('ocoperatorscollection.ini');
     $appini = eZINI::instance('app.ini');
     switch ($operatorName) {
         case 'related_attribute_objects':
             $object = $operatorValue;
             $identifier = $namedParameters['identifier'];
             $dataMap = $object instanceof eZContentObject || $object instanceof eZContentObjectTreeNode ? $object->attribute('data_map') : array();
             $data = array();
             if (isset($dataMap[$identifier])) {
                 $ids = $dataMap[$identifier] instanceof eZContentObjectAttribute ? explode('-', $dataMap[$identifier]->toString()) : array();
                 if (!empty($ids)) {
                     $data = eZContentObject::fetchList(true, array("id" => array($ids)));
                 }
             }
             $operatorValue = $data;
             break;
         case 'smart_override':
             $identifier = $namedParameters['identifier'];
             $view = $namedParameters['view'];
             $node = $operatorValue;
             $operatorValue = $this->findSmartTemplate($identifier, $view, $node);
             break;
         case 'parse_link_href':
             $href = $operatorValue;
             $hrefParts = explode(':', $href);
             $hrefFirst = array_shift($hrefParts);
             if (!in_array($hrefFirst, array('http', 'https', 'file', 'mailto', 'ftp'))) {
                 if (!empty($hrefFirst)) {
                     $nodeID = eZURLAliasML::fetchNodeIDByPath('/' . $hrefFirst);
                     if ($nodeID) {
                         $contentNode = eZContentObjectTreeNode::fetch($nodeID);
                         if ($contentNode instanceof eZContentObjectTreeNode) {
                             $keyArray = array(array('node', $contentNode->attribute('node_id')), array('object', $contentNode->attribute('contentobject_id')), array('class_identifier', $contentNode->attribute('class_identifier')), array('class_group', $contentNode->attribute('object')->attribute('content_class')->attribute('match_ingroup_id_list')));
                             $tpl = new eZTemplate();
                             $ini = eZINI::instance();
                             $autoLoadPathList = $ini->variable('TemplateSettings', 'AutoloadPathList');
                             $extensionAutoloadPath = $ini->variable('TemplateSettings', 'ExtensionAutoloadPath');
                             $extensionPathList = eZExtension::expandedPathList($extensionAutoloadPath, 'autoloads/');
                             $autoLoadPathList = array_unique(array_merge($autoLoadPathList, $extensionPathList));
                             $tpl->setAutoloadPathList($autoLoadPathList);
                             $tpl->autoload();
                             $tpl->setVariable('node', $contentNode);
                             $tpl->setVariable('object', $contentNode->attribute('object'));
                             $tpl->setVariable('original_href', $href);
                             $res = new eZTemplateDesignResource();
                             $res->setKeys($keyArray);
                             $tpl->registerResource($res);
                             $result = trim($tpl->fetch('design:link/href.tpl'));
                             if (!empty($result)) {
                                 $href = $result;
                             }
                         }
                     }
                 }
             }
             return $operatorValue = $href;
             break;
         case 'gmap_static_image':
             try {
                 $cacheFileNames = array();
                 //@todo
                 $operatorValue = OCOperatorsCollectionsTools::gmapStaticImage($namedParameters['parameters'], $namedParameters['attribute'], $cacheFileNames);
             } catch (Exception $e) {
                 eZDebug::writeError($e->getMessage(), 'gmap_static_image');
             }
             break;
         case 'fa_class_icon':
             $faIconIni = eZINI::instance('fa_icons.ini');
             $node = $operatorValue;
             $data = $namedParameters['fallback'] != '' ? $namedParameters['fallback'] : $faIconIni->variable('ClassIcons', '_fallback');
             if ($node instanceof eZContentObjectTreeNode) {
                 if ($faIconIni->hasVariable('ClassIcons', $node->attribute('class_identifier'))) {
                     $data = $faIconIni->variable('ClassIcons', $node->attribute('class_identifier'));
                 }
             }
             $operatorValue = $data;
             break;
         case 'fa_object_icon':
             $faIconIni = eZINI::instance('fa_icons.ini');
             $object = $operatorValue;
             $data = $namedParameters['fallback'] != '' ? $namedParameters['fallback'] : '';
             if ($object instanceof eZContentObject) {
                 if ($faIconIni->hasVariable('ObjectIcons', $object->attribute('id'))) {
                     $data = $faIconIni->variable('ObjectIcons', $object->attribute('id'));
                 }
             } else {
                 if ($faIconIni->hasVariable('ObjectIcons', $node)) {
//.........這裏部分代碼省略.........
開發者ID:OpencontentCoop,項目名稱:ocoperatorscollection,代碼行數:101,代碼來源:ocoperatorscollection.php

示例11: exportCollectionObjectHeader

 function exportCollectionObjectHeader(&$attributes_to_export)
 {
     $resultstring = array();
     foreach ($attributes_to_export as $attributeid) {
         if ($attributeid == "contentobjectid") {
             array_push($resultstring, "ID");
         } else {
             if ($attributeid == -1) {
                 array_push($resultstring, "");
             } else {
                 if ($attributeid != -2) {
                     $attribute =& eZContentClassAttribute::fetch($attributeid);
                     $attribute_name = $attribute->name();
                     $attribute_name_escaped = preg_replace("(\r\n|\n|\r)", " ", $attribute_name);
                     $attribute_name_escaped = utf8_decode($attribute_name_escaped);
                     array_push($resultstring, $attribute_name_escaped);
                     // works for 3.8 only
                     // array_push( $resultstring, $attribute->Name );
                 }
             }
         }
     }
     return $resultstring;
 }
開發者ID:obenyoussef,項目名稱:bccie,代碼行數:24,代碼來源:parser.php

示例12: foreach

<?php 
require "autoload.php";
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => 'Update the datatype ezenhancedselection to the new version', 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$script->initialize();
$cli->output('Updating ezenhancedselection to sckenhancedselection...');
$cli->output();
// Find all class attributes based on ezenhancedselection
$db = eZDB::instance();
$IDs = $db->arrayQuery("SELECT id\n    FROM ezcontentclass_attribute\n    WHERE version = 0 AND data_type_string = 'ezenhancedselection'");
$cli->output($cli->stylize('bold', 'Updating class attributes'));
if (is_array($IDs) and count($IDs) > 0) {
    foreach ($IDs as $id) {
        $cli->output('Updating class attribute: ID - ' . $id['id']);
        $classAttribute = eZContentClassAttribute::fetch($id['id']);
        $content = $classAttribute->content();
        $classAttribute->setAttribute('data_type_string', 'sckenhancedselection');
        $classAttribute->DataTypeString = 'sckenhancedselection';
        $classAttribute->setContent($content);
        $classAttribute->store();
        $classAttribute->setAttribute('data_int1', 0);
        $classAttribute->setAttribute('data_text1', '');
        $classAttribute->store();
        unset($classAttribute);
    }
} else {
    $cli->output('No class attributes to update!');
}
$IDs = $db->arrayQuery("SELECT id, version\n    FROM ezcontentobject_attribute\n    WHERE data_type_string = 'ezenhancedselection'");
$cli->output();
開發者ID:netgen,項目名稱:enhancedselection2,代碼行數:31,代碼來源:updateenhancedselection.php

示例13: fetchClassAttributeHTTPInput

 function fetchClassAttributeHTTPInput($http, $base, $classAttribute)
 {
     $startValueName = $base . self::START_VALUE_VARIABLE . $classAttribute->attribute("id");
     $digitsName = $base . self::DIGITS_VARIABLE . $classAttribute->attribute("id");
     $preTextName = $base . self::PRETEXT_VARIABLE . $classAttribute->attribute("id");
     $postTextName = $base . self::POSTTEXT_VARIABLE . $classAttribute->attribute("id");
     if ($http->hasPostVariable($startValueName) and $http->hasPostVariable($digitsName) and $http->hasPostVariable($preTextName) and $http->hasPostVariable($postTextName)) {
         $startValueValue = str_replace(" ", "", $http->postVariable($startValueName));
         $startValueValue = (int) $startValueValue;
         if ($startValueValue < 1) {
             $startValueValue = 1;
         }
         $digitsValue = str_replace(" ", "", $http->postVariable($digitsName));
         $digitsValue = (int) $digitsValue;
         if ($digitsValue < 1) {
             $digitsValue = 1;
         }
         $preTextValue = $http->postVariable($preTextName);
         $postTextValue = $http->postVariable($postTextName);
         $classAttribute->setAttribute(self::DIGITS_FIELD, $digitsValue);
         $classAttribute->setAttribute(self::PRETEXT_FIELD, $preTextValue);
         $classAttribute->setAttribute(self::POSTTEXT_FIELD, $postTextValue);
         $classAttribute->setAttribute(self::START_VALUE_FIELD, $startValueValue);
         $classAttribute->setAttribute(self::IDENTIFIER_FIELD, $classAttribute->attribute(self::START_VALUE_FIELD));
         $originalClassAttribute = eZContentClassAttribute::fetch($classAttribute->attribute('id'), true, 0);
         if ($originalClassAttribute) {
             if ($originalClassAttribute->attribute(self::DIGITS_FIELD) == $digitsValue && $originalClassAttribute->attribute(self::PRETEXT_FIELD) == $preTextValue && $originalClassAttribute->attribute(self::POSTTEXT_FIELD) == $postTextValue && $originalClassAttribute->attribute(self::IDENTIFIER_FIELD) >= $startValueValue) {
                 $classAttribute->setAttribute(self::START_VALUE_FIELD, $originalClassAttribute->attribute(self::START_VALUE_FIELD));
                 $classAttribute->setAttribute(self::IDENTIFIER_FIELD, $originalClassAttribute->attribute(self::IDENTIFIER_FIELD));
             }
         }
     }
     return true;
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:34,代碼來源:ezidentifiertype.php

示例14: array

<?php 
require 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "Converts ezkeyword datatype content to eztags datatype content.\n" . "Since the script would require as many publish operations as there are translations\n" . "per each object, the script will not republish the objects, but rather update\n" . "the current version of currently published objects. Because of that, you will\n" . "need to take care of clearing relevant caches, reindexing and so on.\n" . "php extension/eztags/bin/php/convertezkeyword.php --from-attr-id=123 --to-attr-id=456 --parent-tag-id=42", 'use-session' => true, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[from-attr-id:][to-attr-id:][parent-tag-id:]", "", array('from-attr-id' => "Specifies source class attribute ID.\n" . "Must be of ezkeyword type", 'to-attr-id' => "Specifies destination class attribute ID.\n" . "Must be of eztags type and located in the same class as from-attr-id", 'parent-tag-id' => "Specifies where in tags tree will new tags be located.\n" . "Cannot be a synonym."));
$script->initialize();
if (!isset($options['from-attr-id']) || !isset($options['to-attr-id']) || !isset($options['parent-tag-id'])) {
    $cli->output("Some of the required parameters are missing.\n" . "Please run the script with --help option to see how to run the script properly.");
    $script->shutdown(1);
}
$sourceClassAttributeID = (int) $options['from-attr-id'];
$destClassAttributeID = (int) $options['to-attr-id'];
$parentTagID = (int) $options['parent-tag-id'];
$sourceClassAttribute = eZContentClassAttribute::fetch($sourceClassAttributeID);
$destClassAttribute = eZContentClassAttribute::fetch($destClassAttributeID);
$parentTag = eZTagsObject::fetch($parentTagID);
if (!$sourceClassAttribute instanceof eZContentClassAttribute || $sourceClassAttribute->attribute('data_type_string') != 'ezkeyword') {
    $cli->output("Invalid source class attribute.");
    $script->shutdown(1);
}
if (!$destClassAttribute instanceof eZContentClassAttribute || $destClassAttribute->attribute('data_type_string') != 'eztags' || $sourceClassAttribute->attribute('contentclass_id') != $destClassAttribute->attribute('contentclass_id')) {
    $cli->output("Invalid destination class attribute.");
    $script->shutdown(1);
}
if (!$parentTag instanceof eZTagsObject || (int) $parentTag->attribute('main_tag_id') != 0) {
    $cli->output("Invalid parent tag.");
    $script->shutdown(1);
}
$cli->warning("This script will NOT republish objects, but rather update the CURRENT");
$cli->warning("version of published objects. If you do not wish to do that, you have");
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:31,代碼來源:convertezkeyword.php

示例15: addAttribute

 function addAttribute($attributeID)
 {
     $status = false;
     if (is_numeric($attributeID)) {
         $classAttribute = eZContentClassAttribute::fetch($attributeID);
         if ($classAttribute instanceof eZContentClassAttribute) {
             if ($classAttribute->attribute('data_type_string') == 'ezisbn') {
                 if ($classAttribute->attribute('data_int1') == 1 or $this->Force === true) {
                     $this->AttributeArray[$classAttribute->attribute('id')] = $classAttribute;
                 } else {
                     $this->Cli->output($this->Cli->stylize('warning', 'Warning:') . ' The attribute id ' . $this->Cli->stylize('strong', $attributeID) . ' is not set to ISBN-13. Use --force to set the ISBN-13 flag');
                 }
             } else {
                 $this->Cli->output($this->Cli->stylize('warning', 'Warning:') . ' The attribute id ' . $this->Cli->stylize('strong', $attributeID) . ' is not an ISBN datatype but of type ' . $this->Cli->stylize('strong', $classAttribute->attribute('data_type_string')) . '.');
             }
         } else {
             $this->Cli->output($this->Cli->stylize('warning', 'Warning:') . ' The attribute id ' . $this->Cli->stylize('strong', $attributeID) . ' does not exist.');
         }
     } else {
         if ($attributeID !== null) {
             $this->Cli->output($this->Cli->stylize('error', 'Error:') . ' the attribute id need to be numeric.');
             $status = true;
         }
     }
     return $status;
 }
開發者ID:patrickallaert,項目名稱:ezpublish-legacy-php7,代碼行數:26,代碼來源:ezisbn10to13converter.php


注:本文中的eZContentClassAttribute::fetch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。