本文整理汇总了PHP中eZContentClassAttribute类的典型用法代码示例。如果您正苦于以下问题:PHP eZContentClassAttribute类的具体用法?PHP eZContentClassAttribute怎么用?PHP eZContentClassAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZContentClassAttribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getFieldName
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;
}
}
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:10,代码来源:ocsolrdocumentfieldinteger.php
示例2: validateStringHTTPInput
/**
* 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;
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:19,代码来源:ezstringtype.php
示例3: getFieldName
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 ) );
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:10,代码来源:ezfsolrdocumentfieldsolrmetadata.php
示例4: 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));
}
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:54,代码来源:ezfsolrdocumentfieldbase_test.php
示例5: getFieldName
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;
}
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:15,代码来源:ocsolrdocumentfieldmatrix.php
示例6: 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
示例7: 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
示例8: testAttributeIsTranslatable
/**
* #15898: Cannot translate a user content object
* Make sure datatype translation flag is honored.
*
* @link http://issues.ez.no/15898
*/
public function testAttributeIsTranslatable()
{
$stringAttribute = eZContentClassAttribute::create(0, 'ezstring');
$this->assertEquals(1, $stringAttribute->attribute('can_translate'), 'ezstring class attribute should have been translatable by default');
$stringAttribute = eZContentClassAttribute::create(0, 'ezuser');
$this->assertEquals(0, $stringAttribute->attribute('can_translate'), 'ezuser class attribute should NOT have been translatable by default');
}
开发者ID:nfrp,项目名称:ezpublish,代码行数:13,代码来源:ezcontentclassattribute_test.php
示例9: validateClassAttributeHTTPInput
function validateClassAttributeHTTPInput($http, $base, $classAttribute)
{
//checking if the recaptcha key is set up if recaptcha is enabled
$ini = eZINI::instance('ezcomments.ini');
$fields = $ini->variable('FormSettings', 'AvailableFields');
if (in_array('recaptcha', $fields)) {
$publicKey = $ini->variable('RecaptchaSetting', 'PublicKey');
$privateKey = $ini->variable('RecaptchaSetting', 'PrivateKey');
if ($publicKey === '' || $privateKey === '') {
eZDebug::writeNotice('reCAPTCHA key is not set up. For help please visit http://projects.ez.no/ezcomments', __METHOD__);
}
}
if ($http->hasPostVariable('StoreButton') || $http->hasPostVariable('ApplyButton')) {
// find the class and count how many Comments dattype
$cond = array('contentclass_id' => $classAttribute->attribute('contentclass_id'), 'version' => eZContentClass::VERSION_STATUS_TEMPORARY, 'data_type_string' => $classAttribute->attribute('data_type_string'));
$classAttributeList = eZContentClassAttribute::fetchFilteredList($cond);
// if there is more than 1 comment attribute, return it as INVALID
if (!is_null($classAttributeList) && count($classAttributeList) > 1) {
if ($classAttributeList[0]->attribute('id') == $classAttribute->attribute('id')) {
eZDebug::writeNotice('There are more than 1 comment attribute in the class.', __METHOD__);
return eZInputValidator::STATE_INVALID;
}
}
}
return eZInputValidator::STATE_ACCEPTED;
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:26,代码来源:ezcomcommentstype.php
示例10: 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
示例11: validateIntegerHTTPInput
/**
* 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;
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:54,代码来源:ezintegertype.php
示例12: validateFloatHTTPInput
/**
* 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;
}
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:53,代码来源:ezfloattype.php
示例13: add
/**
* Adds new content class attribute to initialized class.
*
* @param string $name
* @param string $identifier
* @param string $type
* @return eZContentClassAttribute
*/
public function add($name = 'Test attribute', $identifer = 'test_attribute', $type = 'ezstring')
{
$classAttribute = eZContentClassAttribute::create($this->id, $type, array(), $this->language);
$classAttribute->setName($name, $this->language);
$dataType = $classAttribute->dataType();
$dataType->initializeClassAttribute($classAttribute);
$classAttribute->setAttribute('identifier', $identifer);
$classAttribute->store();
return $classAttribute;
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:18,代码来源:class.php
示例14: testMultipleCallsToCalculatedPrice
/**
* Test scenario for issue #13712: Multiprice datatype shows wrong price after multiple calls in template
*
* Test Outline
* ------------
* 1. Create a euro currency
* 2. Create a VAT type of 10 %
* 3. Create a content class with an attribute of the datatype ezmultiprice
* 4. Create a content object of this content class and set a custom price ex. VAT with the VAT type of 10% that we created
* 5. Subsequently retrieve the attribute 'inc_vat_price_list'
*
* @result: the returned eZMultiPriceData instances differ on each call, their values are increased each time with VAT
* @expected: the returned eZMultiPriceData instances are equal
* @link http://issues.ez.no/13712
* @group issue_13712
*/
public function testMultipleCallsToCalculatedPrice()
{
$currencyCode = 'EUR';
// create currency
$currencyParams = array('code' => $currencyCode, 'symbol' => false, 'locale' => 'eng-GB', 'custom_rate_value' => 0, 'rate_factor' => 1);
$currency = eZCurrencyData::create($currencyCode, '€', 'eng-GB', 0, 0, 1);
$currency->store();
$currencyID = $currency->attribute('id');
$this->assertInternalType('integer', $currencyID);
// create VAT type
$row = array('name' => 'Test', 'percentage' => 10.0);
$vatType = new eZVatType($row);
$vatType->store();
$vatTypeID = $vatType->attribute('id');
$this->assertInternalType('integer', $vatTypeID);
$class = eZContentClass::create(false, array('name' => 'eZMultiPrice::testMultipleCallsToCalculatedPrice', 'identifier' => 'ezmultiprice_test'));
$class->store();
$classID = $class->attribute('id');
$this->assertInternalType('integer', $classID);
$attributes = $class->fetchAttributes();
// add class attributes
$newAttribute = eZContentClassAttribute::create($classID, 'ezmultiprice', array('name' => 'Test', 'identifier' => 'test'));
$dataType = $newAttribute->dataType();
$dataType->initializeClassAttribute($newAttribute);
$newAttribute->setAttribute(eZMultiPriceType::DEFAULT_CURRENCY_CODE_FIELD, $currencyCode);
$newAttribute->setAttribute(eZMultiPriceType::VAT_ID_FIELD, $vatTypeID);
$newAttribute->store();
$attributes[] = $newAttribute;
$class->storeDefined($attributes);
$contentObject = $class->instantiate();
$version = $contentObject->currentVersion();
$dataMap = $version->dataMap();
$multiPrice = $dataMap['test']->content();
$multiPrice->setAttribute('selected_vat_type', $vatTypeID);
$multiPrice->setAttribute('is_vat_included', eZMultiPriceType::EXCLUDED_VAT);
$multiPrice->setCustomPrice($currencyCode, 100);
$multiPrice->updateAutoPriceList();
$dataMap['test']->setContent($multiPrice);
$dataMap['test']->setAttribute('data_text', $vatTypeID . ',' . eZMultiPriceType::EXCLUDED_VAT);
$dataMap['test']->store();
// test values
$firstIncVatPriceList = $multiPrice->attribute('inc_vat_price_list');
$this->assertArrayHasKey('EUR', $firstIncVatPriceList);
$firstCallValue = $firstIncVatPriceList['EUR']->attribute('value');
$secondIncVatPriceList = $multiPrice->attribute('inc_vat_price_list');
$this->assertArrayHasKey('EUR', $secondIncVatPriceList);
$secondCallValue = $secondIncVatPriceList['EUR']->attribute('value');
$this->assertEquals($firstCallValue, $secondCallValue);
$thirdIncVatPriceList = $multiPrice->attribute('inc_vat_price_list');
$this->assertArrayHasKey('EUR', $thirdIncVatPriceList);
$thirdCallValue = $thirdIncVatPriceList['EUR']->attribute('value');
$this->assertEquals($firstCallValue, $thirdCallValue);
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:69,代码来源:ezmultipricetype_regression.php
示例15: fetchContentClassImageAttributes
/**
* Fetch content class attributes by dataTypestring
*
* @param array $imageDataTypeStrings array of image datatype strings. ie: array( 'ezimage' )
* @return array Array of content class attributes, empty array if not
* @static
*/
static function fetchContentClassImageAttributes($imageDataTypeStrings = false)
{
$contentClassImageAttributes = array();
if (!is_array($imageDataTypeStrings)) {
// Default datatypes to create image alias variations
$imageDataTypeStrings = eZINI::instance('bcimagealias.ini')->variable('BCImageAliasSettings', 'ImageDataTypeStringList');
}
foreach ($imageDataTypeStrings as $dataTypeString) {
$contentClassImageAttributes = array_merge($contentClassImageAttributes, eZContentClassAttribute::fetchList(true, array('data_type' => $dataTypeString)));
}
return $contentClassImageAttributes;
}
开发者ID:philandteds,项目名称:bcimagealias,代码行数:19,代码来源:bcimagealias.php
示例16: fetchMapMarkers
public static function fetchMapMarkers($parentNodeId, $childrenClassIdentifiers)
{
foreach ($childrenClassIdentifiers as $key => $value) {
if (empty($value)) {
unset($childrenClassIdentifiers[$key]);
}
}
$sortBy = array('name' => 'asc');
$result = array();
if ($parentNode = self::getNode($parentNodeId)) {
if (!empty($childrenClassIdentifiers)) {
$childrenClassTypes = (array) eZContentClass::fetchList(0, true, false, null, null, $childrenClassIdentifiers);
} else {
$childrenClassTypes = self::getChildrenClasses($parentNodeId);
}
// ricavo gli attributi delle classi
$geoAttributes = array();
foreach ($childrenClassTypes as $classType) {
if ($classType instanceof eZContentClass) {
$geoAttributes = array_merge($geoAttributes, eZContentClassAttribute::fetchFilteredList(array('contentclass_id' => $classType->attribute('id'), 'version' => $classType->attribute('version'), 'data_type_string' => 'ezgmaplocation')));
}
}
if (count($geoAttributes)) {
// imposto i filtri di ricerca
$geoFields = $geoFieldsNames = array();
foreach ($geoAttributes as $geoAttribute) {
if ($geoAttribute instanceof eZContentClassAttribute) {
$geoFields[$geoAttribute->attribute('identifier')] = $geoAttribute->attribute('name');
$geoFieldsNames[] = "subattr_{$geoAttribute->attribute('identifier')}___coordinates____gpt";
}
}
$childrenParameters = array('SearchSubTreeArray' => array($parentNode->attribute('node_id')), 'Filter' => array('-meta_id_si:' . $parentNode->attribute('contentobject_id')), 'SearchLimit' => 1000, 'AsObjects' => false, 'SortBy' => $sortBy, 'FieldsToReturn' => $geoFieldsNames);
// cerco i figli
$solr = new OCSolr();
$children = $solr->search('', $childrenParameters);
if ($children['SearchCount'] > 0) {
foreach ($children['SearchResult'] as $item) {
foreach ($geoFieldsNames as $geoFieldsName) {
@(list($longitude, $latitude) = explode(',', $item['fields'][$geoFieldsName][0]));
if (intval($latitude) > 0 && intval($longitude) > 0) {
$href = isset($item['main_url_alias']) ? $item['main_url_alias'] : $item['main_url_alias_ms'];
eZURI::transformURI($href, false, 'full');
$popup = isset($item['name']) ? $item['name'] : $item['name_t'];
$id = isset($item['id_si']) ? $item['id_si'] : $item['id'];
$result[] = array('id' => $id, 'type' => null, 'lat' => floatval($latitude), 'lon' => floatval($longitude), 'lng' => floatval($longitude), 'popupMsg' => $popup, 'title' => $popup, 'description' => "<h3><a href='{$href}'>{$popup}</a></h3>", 'urlAlias' => $href, 'objectID' => $id);
}
}
}
}
}
}
return array('result' => $result);
}
开发者ID:OpencontentCoop,项目名称:ocbootstrap,代码行数:53,代码来源:ocbtoolsfunctioncollection.php
示例17: 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
示例18: getClassList
/**
* Returns the ids of content classes that have an xmltext attribute
* @return array(contentclass_id=>array(contentclassattribute_id))
*/
function getClassList()
{
$affectedClasses = array();
$classAttributes = eZContentClassAttribute::fetchFilteredList(array('data_type_string' => 'ezxmltext', 'version' => eZContentClass::VERSION_STATUS_DEFINED), false);
foreach ($classAttributes as $classAttribute) {
$contentClassId = $classAttribute['contentclass_id'];
if (!isset($affectedClasses[$contentClassId])) {
$affectedClasses[$contentClassId] = array();
}
$affectedClasses[$contentClassId][] = $classAttribute['identifier'];
}
return $affectedClasses;
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:17,代码来源:restorexmlrelations.php
示例19: testIssue15263
/**
* Regression test for issue #15263
* Content object name/url of imported content classes aren't generated correctly
*
* @url http://issues.ez.no/15263
*
* @outline
* 1) Expire and force generation of class attribute cache
* 2) Load a test package
* 3) Install the package
* 4) Publish an object of the imported class
* 5) The object name / url alias shouldn't be the expected one
**/
public function testIssue15263()
{
$adminUser = eZUser::fetchByName('admin');
$previousUser = eZUser::currentUser();
eZUser::setCurrentlyLoggedInUser($adminUser, $adminUser->attribute('contentobject_id'));
// 1) Expire and force generation of class attribute cache
$handler = eZExpiryHandler::instance();
$handler->setTimestamp('class-identifier-cache', time() - 1);
$handler->store();
eZContentClassAttribute::classAttributeIdentifierByID(1);
// 1) Load a test package
$packageName = 'ezpackage_regression_testIssue15223.ezpkg';
$packageFilename = dirname(__FILE__) . DIRECTORY_SEPARATOR . $packageName;
$packageImportTried = false;
while (!$packageImportTried) {
$package = eZPackage::import($packageFilename, $packageName);
if (!$package instanceof eZPackage) {
if ($package === eZPackage::STATUS_ALREADY_EXISTS) {
$packageToRemove = eZPackage::fetch($packageName);
$packageToRemove->remove();
} else {
self::fail("An error occured loading the package '{$packageFilename}'");
}
}
$packageImportTried = true;
}
// 2) Install the package
$installParameters = array('site_access_map' => array('*' => false), 'top_nodes_map' => array('*' => 2), 'design_map' => array('*' => false), 'restore_dates' => true, 'user_id' => $adminUser->attribute('contentobject_id'), 'non-interactive' => true, 'language_map' => $package->defaultLanguageMap());
$result = $package->install($installParameters);
// 3) Publish an object of the imported class
$object = new ezpObject('test_issue_15523', 2, $adminUser->attribute('contentobject_id'), 1);
$object->myname = __METHOD__;
$object->myothername = __METHOD__;
$publishedObjectID = $object->publish();
unset($object);
// 4) Test data from the publish object
$publishedNodeArray = eZContentObjectTreeNode::fetchByContentObjectID($publishedObjectID);
if (count($publishedNodeArray) != 1) {
$this->fail("An error occured fetching node for object #{$publishedObjectID}");
}
$publishedNode = $publishedNodeArray[0];
if (!$publishedNode instanceof eZContentObjectTreeNode) {
$this->fail("An error occured fetching node for object #{$publishedObjectID}");
} else {
$this->assertEquals("eZPackageRegression::testIssue15263", $publishedNode->attribute('name'));
$this->assertEquals("eZPackageRegression-testIssue15263", $publishedNode->attribute('url_alias'));
}
// Remove the installed package & restore the logged in user
$package->remove();
eZUser::setCurrentlyLoggedInUser($previousUser, $previousUser->attribute('contentobject_id'));
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:64,代码来源:ezpackage_regression.php
示例20: getClassConstraintListAsArray
function getClassConstraintListAsArray($class_identifier = false, $contentclass_id = false, $debug = false)
{
//todo debug
if (!$contentclass_id && !$class_identifier) {
return;
}
if ($contentclass_id && $class_identifier) {
return;
}
$ezobjectrelationlist = eZContentClassAttribute::fetchFilteredList(array('data_type_string' => 'ezobjectrelationlist'));
$return = array();
if ($contentclass_id) {
foreach ($ezobjectrelationlist as $attribute) {
if ($attribute->attribute('contentclass_id') == $contentclass_id) {
$attributeContent = $attribute->content();
if (!empty($attributeContent['class_constraint_list'])) {
$return = array_merge($return, $attributeContent['class_constraint_list']);
}
}
}
if (!empty($return)) {
return $return;
} else {
return false;
}
}
if ($class_identifier) {
foreach ($ezobjectrelationlist as $attribute) {
$attributeContent = $attribute->content();
if (!empty($attributeContent['class_constraint_list'])) {
if (in_array($class_identifier, $attributeContent['class_constraint_list'])) {
$class = eZContentClass::fetch($attribute->attribute('contentclass_id'));
$classIdentifier = eZContentClass::classIdentifierByID($attribute->attribute('contentclass_id'));
$return[$classIdentifier][] = array('class_id' => $attribute->attribute('contentclass_id'), 'class_name' => $class->attribute('name'), 'attribute_identifier' => $attribute->attribute('identifier'), 'attribute_name' => $attribute->attribute('name'), 'class_constraint_list' => $attributeContent['class_constraint_list'], 'search_filter' => $classIdentifier . '/' . $attribute->attribute('identifier') . '/main_node_id');
}
}
}
//eZDebug::writeNotice( $return, __METHOD__ );
if (!empty($return)) {
return $return;
} else {
return false;
}
}
return false;
}
开发者ID:Opencontent,项目名称:wrapoperator,代码行数:46,代码来源:getClassConstraintListAsArray.php
注:本文中的eZContentClassAttribute类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论