本文整理汇总了PHP中eZContentClass类的典型用法代码示例。如果您正苦于以下问题:PHP eZContentClass类的具体用法?PHP eZContentClass怎么用?PHP eZContentClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZContentClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Create a scheduled script that will store the modification made to an eZContentClass.
*
* @param eZContentClass Content class to be stored.
* @param array[eZContentClassAttribute] Attributes of the new content class.
* @param array Unordered view parameters
*/
public function store(eZContentClass $class, array $attributes, array &$unorderedParameters)
{
$script = eZScheduledScript::create('syncobjectattributes.php', eZINI::instance('ezscriptmonitor.ini')->variable('GeneralSettings', 'PhpCliCommand') . ' extension/ezscriptmonitor/bin/' . eZScheduledScript::SCRIPT_NAME_STRING . ' -s ' . eZScheduledScript::SITE_ACCESS_STRING . ' --classid=' . $class->attribute('id'));
$script->store();
$unorderedParameters['ScheduledScriptID'] = $script->attribute('id');
$class->storeVersioned($attributes, eZContentClass::VERSION_STATUS_MODIFIED);
}
开发者ID:netbliss,项目名称:ezscriptmonitor,代码行数:14,代码来源:ezcontentclasseditdeferredhandler.php
示例2: store
/**
* Store the modification made to an eZContentClass.
*
* @param eZContentClass Content class to be stored.
* @param array[eZContentClassAttribute] Attributes of the new content class.
* @param array Unordered view parameters
*/
public function store(eZContentClass $class, array $attributes, array &$unorderedParameters)
{
$oldClassAttributes = $class->fetchAttributes($class->attribute('id'), true, eZContentClass::VERSION_STATUS_DEFINED);
// Delete object attributes which have been removed.
foreach ($oldClassAttributes as $oldClassAttribute) {
$attributeExists = false;
$oldClassAttributeID = $oldClassAttribute->attribute('id');
foreach ($class->fetchAttributes() as $newClassAttribute) {
if ($oldClassAttributeID == $newClassAttribute->attribute('id')) {
$attributeExists = true;
break;
}
}
if (!$attributeExists) {
foreach (eZContentObjectAttribute::fetchSameClassAttributeIDList($oldClassAttributeID) as $objectAttribute) {
$objectAttribute->removeThis($objectAttribute->attribute('id'));
}
}
}
$class->storeDefined($attributes);
// Add object attributes which have been added.
foreach ($attributes as $newClassAttribute) {
$attributeExists = false;
$newClassAttributeID = $newClassAttribute->attribute('id');
foreach ($oldClassAttributes as $oldClassAttribute) {
if ($newClassAttributeID == $oldClassAttribute->attribute('id')) {
$attributeExists = true;
break;
}
}
if (!$attributeExists) {
$newClassAttribute->initializeObjectAttributes($objects);
}
}
}
开发者ID:legende91,项目名称:ez,代码行数:42,代码来源:ezcontentclassedithandler.php
示例3: instance
public static function instance(eZContentClass $class)
{
if (!$class instanceof eZContentClass) {
throw new Exception("Class not found (" . __METHOD__ . ")");
}
if (!isset(self::$instances[$class->attribute('identifier')])) {
self::$instances[$class->attribute('identifier')] = new OCClassExtraParametersManager($class);
}
return self::$instances[$class->attribute('identifier')];
}
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:10,代码来源:occlassextraparametersmanager.php
示例4: syncGroups
protected function syncGroups()
{
$remote = $this->getRemote();
if ($remote === null) {
throw new Exception("Classe remota non trovata");
}
$this->syncAllGroups($remote);
$locale = $this->currentClass;
/** @var eZContentClassClassGroup[] $localGroups */
$localGroups = $locale->fetchGroupList();
//$localGroupsNames = array();
//$remoteGroupsNames = array();
foreach ($localGroups as $group) {
/** @var eZContentClassGroup $classGroup */
$classGroup = eZContentClassGroup::fetchByName($group->attribute('group_name'));
if ($classGroup) {
eZContentClassClassGroup::removeGroup($this->currentClass->attribute('id'), $this->currentClass->attribute('version'), $classGroup->attribute('id'));
}
}
foreach ($remote->InGroups as $group) {
/** @var eZContentClassGroup $classGroup */
$classGroup = eZContentClassGroup::fetchByName($group->GroupName);
if ($classGroup) {
$ingroup = eZContentClassClassGroup::create($this->currentClass->attribute('id'), $this->currentClass->attribute('version'), $classGroup->attribute('id'), $classGroup->attribute('name'));
$ingroup->store();
}
}
//$groups = $this->currentClass->attribute( 'ingroup_list' );
//if ( count( $groups ) == 0 )
//{
// //@todo
//}
}
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:33,代码来源:occlasstools.php
示例5: testContentClassStillInGroupAfterEdition
/**
* Test that saving a content class in DEFINED version status
* correctly manipulate associated class groups
*
* @link http://issues.ez.no/16197
*/
public function testContentClassStillInGroupAfterEdition()
{
$class = eZContentClass::fetch( $this->class->id );
// This is logic contained in kernel/class/edit.php
foreach ( eZContentClassClassGroup::fetchGroupList( $class->attribute( 'id' ),
eZContentClass::VERSION_STATUS_DEFINED ) as $classGroup )
{
eZContentClassClassGroup::create( $class->attribute( 'id' ),
eZContentClass::VERSION_STATUS_TEMPORARY,
$classGroup->attribute( 'group_id' ),
$classGroup->attribute( 'group_name' ) )
->store();
}
$attributes = $class->fetchAttributes();
$class->setAttribute( 'version', eZContentClass::VERSION_STATUS_TEMPORARY );
$class->NameList->setHasDirtyData();
foreach ( $attributes as $attribute )
{
$attribute->setAttribute( 'version', eZContentClass::VERSION_STATUS_TEMPORARY );
if ( $dataType = $attribute->dataType() )
$dataType->initializeClassAttribute( $attribute );
}
$class->store( $attributes );
$db = eZDB::instance();
$db->begin();
$class->storeVersioned( $attributes, eZContentClass::VERSION_STATUS_DEFINED );
$db->commit();
$this->assertTrue( eZContentClassClassGroup::classInGroup( $class->attribute( 'id' ),
eZContentClass::VERSION_STATUS_DEFINED,
1 ) );
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:41,代码来源:ezcontentclass_regression.php
示例6: remove
static function remove($classID)
{
$contentClass = eZContentClass::fetch($classID);
if ($contentClass == null or !$contentClass->isRemovable()) {
return false;
}
// Remove all objects
$contentObjects = eZContentObject::fetchSameClassList($classID);
foreach ($contentObjects as $contentObject) {
eZContentObjectOperations::remove($contentObject->attribute('id'));
}
if (count($contentObjects) == 0) {
eZContentObject::expireAllViewCache();
}
eZContentClassClassGroup::removeClassMembers($classID, 0);
eZContentClassClassGroup::removeClassMembers($classID, 1);
// Fetch real version and remove it
$contentClass->remove(true);
// Fetch temp version and remove it
$tempDeleteClass = eZContentClass::fetch($classID, true, 1);
if ($tempDeleteClass != null) {
$tempDeleteClass->remove(true, 1);
}
return true;
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:25,代码来源:ezcontentclassoperations.php
示例7: removeGroup
static function removeGroup( $classID, $classVersion, $selectedGroup )
{
$class = eZContentClass::fetch( $classID, true, eZContentClass::VERSION_STATUS_DEFINED );
if ( !$class )
return false;
$groups = $class->attribute( 'ingroup_list' );
foreach ( array_keys( $groups ) as $key )
{
if ( in_array( $groups[$key]->attribute( 'group_id' ), $selectedGroup ) )
{
unset( $groups[$key] );
}
}
if ( count( $groups ) == 0 )
{
return false;
}
else
{
foreach( $selectedGroup as $group_id )
{
eZContentClassClassGroup::removeGroup( $classID, $classVersion, $group_id );
}
}
return true;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:27,代码来源:ezclassfunctions.php
示例8: modify
function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$canCreateClassList = $namedParameters['can_create_class_list'];
switch ($operatorName) {
case 'ezcreateclasslistgroups':
$groupArray = array();
$ini = eZINI::instance('websitetoolbar.ini');
foreach ($canCreateClassList as $class) {
$contentClass = eZContentClass::fetch($class['id']);
if (!$contentClass) {
return false;
}
foreach ($contentClass->fetchGroupList() as $group) {
$isHidden = false;
if (in_array($contentClass->attribute('identifier'), $ini->variable('WebsiteToolbarSettings', 'HiddenContentClasses'))) {
$isHidden = true;
}
if (array_key_exists($group->attribute('group_id'), $groupArray)) {
if (!$isHidden) {
$groupArray[$group->attribute('group_id')]['items'][] = $contentClass;
}
} else {
if (!$isHidden) {
$groupArray[$group->attribute('group_id')]['items'] = array($contentClass);
$groupArray[$group->attribute('group_id')]['group_name'] = $group->attribute('group_name');
}
}
}
}
$operatorValue = $groupArray;
break;
}
}
开发者ID:heliopsis,项目名称:ezwt,代码行数:33,代码来源:ezcreateclasslistgroups.php
示例9: attribute
function attribute($attr)
{
switch ($attr) {
case 'contentclass_list':
return eZContentClass::fetchList(eZContentClass::VERSION_STATUS_DEFINED, true);
break;
case 'contentclassattribute_list':
// $postvarname = 'WorkflowEvent' . '_event_ezwaituntildate_' .'class_' . $workflowEvent->attribute( 'id' ); and $http->hasPostVariable( $postvarname )
if (isset($GLOBALS['eZWaitUntilDateSelectedClass'])) {
$classID = $GLOBALS['eZWaitUntilDateSelectedClass'];
} else {
// if nothing was preselected, we will use the first one:
// POSSIBLE ENHANCEMENT: in the common case, the contentclass_list fetch will be called twice
$classList = eZWaitUntilDateType::attribute('contentclass_list');
if (isset($classList[0])) {
$classID = $classList[0]->attribute('id');
} else {
$classID = false;
}
}
if ($classID) {
return eZContentClassAttribute::fetchListByClassID($classID);
}
return array();
break;
case 'has_class_attributes':
// for the backward compatibility:
return 1;
break;
default:
return eZWorkflowEventType::attribute($attr);
}
}
开发者ID:nfrp,项目名称:ezpublish,代码行数:33,代码来源:ezwaituntildatetype.php
示例10: createUser
/**
* Creates a user with provided auth data
*
* @param array $authResult
*
* @return bool|eZUser
*/
public static function createUser($authResult)
{
$ngConnectINI = eZINI::instance('ngconnect.ini');
$siteINI = eZINI::instance('site.ini');
$defaultUserPlacement = $ngConnectINI->variable('LoginMethod_' . $authResult['login_method'], 'DefaultUserPlacement');
$placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
if (!$placementNode instanceof eZContentObjectTreeNode) {
$defaultUserPlacement = $siteINI->variable('UserSettings', 'DefaultUserPlacement');
$placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
if (!$placementNode instanceof eZContentObjectTreeNode) {
return false;
}
}
$contentClass = eZContentClass::fetch($siteINI->variable('UserSettings', 'UserClassID'));
$userCreatorID = $siteINI->variable('UserSettings', 'UserCreatorID');
$defaultSectionID = $siteINI->variable('UserSettings', 'DefaultSectionID');
$db = eZDB::instance();
$db->begin();
$contentObject = $contentClass->instantiate($userCreatorID, $defaultSectionID);
$contentObject->store();
$nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => 1, 'parent_node' => $placementNode->attribute('node_id'), 'is_main' => 1));
$nodeAssignment->store();
$currentTimeStamp = eZDateTime::currentTimeStamp();
/** @var eZContentObjectVersion $version */
$version = $contentObject->currentVersion();
$version->setAttribute('modified', $currentTimeStamp);
$version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$version->store();
$dataMap = $version->dataMap();
self::fillUserObject($version->dataMap(), $authResult);
if (!isset($dataMap['user_account'])) {
$db->rollback();
return false;
}
$userLogin = 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'];
$userPassword = (string) rand() . 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'] . (string) rand();
$userExists = false;
if (eZUser::requireUniqueEmail()) {
$userExists = eZUser::fetchByEmail($authResult['email']) instanceof eZUser;
}
if (empty($authResult['email']) || $userExists) {
$email = md5('ngconnect_' . $authResult['login_method'] . '_' . $authResult['id']) . '@localhost.local';
} else {
$email = $authResult['email'];
}
$user = new eZUser(array('contentobject_id' => $contentObject->attribute('id'), 'email' => $email, 'login' => $userLogin, 'password_hash' => md5("{$userLogin}\n{$userPassword}"), 'password_hash_type' => 1));
$user->store();
$userSetting = new eZUserSetting(array('is_enabled' => true, 'max_login' => 0, 'user_id' => $contentObject->attribute('id')));
$userSetting->store();
$dataMap['user_account']->setContent($user);
$dataMap['user_account']->store();
$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObject->attribute('id'), 'version' => $version->attribute('version')));
if (array_key_exists('status', $operationResult) && $operationResult['status'] == eZModuleOperationInfo::STATUS_CONTINUE) {
$db->commit();
return $user;
}
$db->rollback();
return false;
}
开发者ID:netgen,项目名称:ngconnect,代码行数:66,代码来源:ngconnectfunctions.php
示例11: className
function className()
{
if ($this->ClassName === null) {
$contentClass = eZContentClass::fetch($this->attribute('contentclass_id'));
$this->ClassName = $contentClass->attribute('name');
}
return $this->ClassName;
}
开发者ID:legende91,项目名称:ez,代码行数:8,代码来源:ezwaituntildatevalue.php
示例12: execute
public function execute($process, $event)
{
$processParameters = $process->attribute('parameter_list');
$object = eZContentObject::fetch($processParameters['object_id']);
$targetClassIdentifier = $object->contentClass()->attribute('identifier');
$iniGroups = eZINI::instance('ngindexer.ini')->groups();
$targets = array();
foreach ($iniGroups as $iniGroupName => $iniGroup) {
$iniGroupNameArray = explode('/', $iniGroupName);
if (is_array($iniGroupNameArray) && count($iniGroupNameArray) == 3) {
$class = eZContentClass::fetchByIdentifier($iniGroupNameArray[0]);
if ($class instanceof eZContentClass) {
$classAttribute = $class->fetchAttributeByIdentifier($iniGroupNameArray[1]);
if ($classAttribute instanceof eZContentClassAttribute) {
$indexTarget = isset($iniGroup['IndexTarget']) ? trim($iniGroup['IndexTarget']) : '';
$referencedClassIdentifiers = isset($iniGroup['ClassIdentifiers']) && is_array($iniGroup['ClassIdentifiers']) ? $iniGroup['ClassIdentifiers'] : null;
if ($referencedClassIdentifiers != null && (empty($referencedClassIdentifiers) || in_array($targetClassIdentifier, $referencedClassIdentifiers))) {
switch ($indexTarget) {
case 'parent':
case 'parent_line':
$children = eZContentObjectTreeNode::subTreeByNodeID(array('ClassFilterType' => 'include', 'ClassFilterArray' => array($iniGroupNameArray[0]), 'Depth' => $indexTarget == 'parent' ? 1 : false), $object->mainNode()->attribute('node_id'));
if (is_array($children)) {
$targets = array_merge($targets, $children);
}
break;
case 'children':
$parentNode = $object->mainNode()->fetchParent();
if ($parentNode->classIdentifier() == $iniGroupNameArray[0]) {
$targets[] = $parentNode;
}
break;
case 'subtree':
$path = $object->mainNode()->fetchPath();
foreach ($path as $pathNode) {
if ($pathNode->classIdentifier() == $iniGroupNameArray[0]) {
$targets[] = $parentNode;
}
}
break;
default:
continue;
}
}
}
}
}
}
$filteredTargets = array();
foreach ($targets as $target) {
$objectID = $target->attribute('contentobject_id');
$version = $target->object()->attribute('current_version');
if (!isset($filteredTargets[$objectID])) {
$filteredTargets[$objectID] = $version;
eZContentOperationCollection::registerSearchObject($objectID, $version);
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
开发者ID:netgen,项目名称:ngindexer,代码行数:58,代码来源:ngindexertype.php
示例13: attribute_migrate
private function attribute_migrate($classIdentifier, $srcAttribute, $conversion, $destAttribute)
{
$contentClass = eZContentClass::fetchByIdentifier($classIdentifier);
if (!$contentClass) {
throw new Exception("Failed to instantiate content class [" . $classIdentifier . "]");
}
$classDataMap = $contentClass->attribute("data_map");
if (!isset($classDataMap[$srcAttribute])) {
throw new Exception("Content class '" . $classIdentifier . "' does not contain this attribute: [" . $srcAttribute . "]");
}
if (!isset($classDataMap[$destAttribute])) {
throw new Exception("Content class '" . $classIdentifier . "' does not contain this attribute: [" . $destAttribute . "]");
}
$classId = $contentClass->attribute("id");
$objects = eZContentObject::fetchSameClassList($classId, false);
$numObjects = count($objects);
$conversionFunc = null;
switch ($conversion) {
default:
echo "This mapping is not supported: [" . $conversion . "]\n";
return;
break;
case "rot13":
$conversionFunc = "convertStringToRot13";
break;
case "time2integer":
$conversionFunc = "convertTimeToInteger";
break;
case "trim":
$conversionFunc = "convertTrim";
break;
case "date2ts":
$conversionFunc = "dateToTS";
break;
}
foreach ($objects as $n => $object) {
$object = eZContentObject::fetch($object["id"]);
if ($object) {
// copy data with conversion
$dataMap = $object->DataMap();
$src = $dataMap[$srcAttribute];
$dest = $dataMap[$destAttribute];
$dest->fromString(eep::$conversionFunc($src->toString()));
$dest->store();
// publish to get changes recognized, eg object title updated
eep::republishObject($object->attribute("id"));
}
echo "Percent complete: " . sprintf("% 3.3f", ($n + 1.0) / $numObjects * 100.0) . "%\r";
// clear caches
unset($GLOBALS["eZContentObjectContentObjectCache"]);
unset($GLOBALS["eZContentObjectDataMapCache"]);
unset($GLOBALS["eZContentObjectVersionCache"]);
unset($object);
}
echo "\n";
}
开发者ID:truffo,项目名称:eep,代码行数:56,代码来源:index.php
示例14: updateClass
function updateClass($classId, $scheduledScript)
{
$cli = eZCLI::instance();
/*
// If the class is not stored yet, store it now
$class = eZContentClass::fetch( $classId, true, eZContentClass::VERSION_STATUS_TEMPORARY );
if ( $class )
{
$cli->output( "Storing class" );
$class->storeDefined( $class->fetchAttributes() );
}
*/
// Fetch the stored class
$class = eZContentClass::fetch($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
if (!$class) {
$cli->error('No class in a modified version status with ID: ' . $classId);
return;
}
// Fetch attributes and definitions
$attributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
$oldClassAttributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_DEFINED);
// Delete object attributes which have been removed.
foreach ($oldClassAttributes as $oldClassAttribute) {
$attributeExist = false;
$oldClassAttributeID = $oldClassAttribute->attribute('id');
foreach ($attributes as $newClassAttribute) {
if ($oldClassAttributeID == $newClassAttribute->attribute('id')) {
$attributeExist = true;
}
}
if (!$attributeExist) {
foreach (eZContentObjectAttribute::fetchSameClassAttributeIDList($oldClassAttributeID) as $objectAttribute) {
$objectAttribute->removeThis($objectAttribute->attribute('id'));
}
}
}
$class->storeVersioned($attributes, eZContentClass::VERSION_STATUS_DEFINED);
// Add object attributes which have been added.
foreach ($attributes as $newClassAttribute) {
$attributeExist = false;
foreach ($oldClassAttributes as $oldClassAttribute) {
if ($oldClassAttribute->attribute('id') == $newClassAttribute->attribute('id')) {
$attributeExist = true;
break;
}
}
if (!$attributeExist) {
$objects = null;
$newClassAttribute->initializeObjectAttributes($objects);
}
}
if ($scheduledScript !== false) {
$scheduledScript->updateProgress(100);
}
}
开发者ID:legende91,项目名称:ez,代码行数:55,代码来源:syncobjectattributes.php
示例15: contentClassList
private function contentClassList()
{
$db = eZDB::instance();
$query = "SELECT ezcontentclass.id\n FROM ezcontentclass,\n ezcontentclass_attribute ezcontentclass_attribute1,\n ezcontentclass_attribute ezcontentclass_attribute2\n WHERE ezcontentclass.version='0' AND\n ezcontentclass.id=ezcontentclass_attribute1.contentclass_id AND\n ezcontentclass_attribute1.is_information_collector='0' AND\n ezcontentclass.id=ezcontentclass_attribute2.contentclass_id AND\n ezcontentclass_attribute2.is_information_collector='0' AND\n ezcontentclass_attribute1.contentclass_id=ezcontentclass_attribute2.contentclass_id AND\n ezcontentclass_attribute1.data_type_string='ezxmltext' AND\n ezcontentclass_attribute2.data_type_string='eztext'";
$contentClassArray = $db->arrayQuery($query);
$retArray = array();
foreach ($contentClassArray as $contentClass) {
$retArray[] = eZContentClass::fetch($contentClass['id']);
}
return $retArray;
}
开发者ID:heliopsis,项目名称:ezsurvey,代码行数:11,代码来源:ezsurveywizard.php
示例16: getForm
/**
* @return string
*/
protected function getForm()
{
$classKeyArray = array(array('class_identifier', $this->contentClass->attribute('identifier')));
$tpl = eZTemplate::factory();
$tpl->setVariable('class', $this->contentClass);
$tpl->setVariable('remote_class_id', $this->remoteContentClassDefinition->ID);
$tpl->setVariable('client', $this);
$attributeFields = array();
$dataMap = $this->contentClass->attribute('data_map');
$disabled = array();
if (eZINI::instance('ocsearchtools.ini')->hasVariable('RemoteClassSearchFormSettings', 'DisabledAttributes')) {
$disabled = eZINI::instance('ocsearchtools.ini')->variable('RemoteClassSearchFormSettings', 'DisabledAttributes');
}
/** @var $dataMap eZContentClassAttribute[] */
foreach ($dataMap as $attribute) {
if (!in_array($this->contentClass->attribute('identifier') . '/' . $attribute->attribute('identifier'), $disabled) && $attribute->attribute('is_searchable')) {
if (isset($this->remoteContentClassDefinition->DataMap[0]->{$attribute->attribute('identifier')})) {
$attribute->setAttribute('data_type_string', $this->remoteContentClassDefinition->DataMap[0]->{$attribute->attribute('identifier')}->DataTypeString);
$inputField = OCRemoteClassSearchFormAttributeField::instance($attribute, $this->remoteContentClassDefinition->DataMap[0]->{$attribute->attribute('identifier')}, $this);
$keyArray = array(array('class_identifier', $this->contentClass->attribute('identifier')), array('attribute_identifier', $inputField->contentClassAttribute->attribute('identifier')));
$tpl = eZTemplate::factory();
$tpl->setVariable('class', $this->contentClass);
$tpl->setVariable('attribute', $inputField->contentClassAttribute);
$tpl->setVariable('input', $inputField);
$res = eZTemplateDesignResource::instance();
$res->setKeys($keyArray);
$templateName = $inputField->contentClassAttribute->attribute('data_type_string');
$attributeFields[$inputField->attribute('id')] = $tpl->fetch('design:class_search_form/datatypes/' . $templateName . '.tpl');
}
}
}
$tpl->setVariable('attribute_fields', $attributeFields);
$parameters = array('action' => 'search');
$tpl->setVariable('parameters', $parameters);
$formAction = $this->attributes['definition']['ClientBasePath'];
eZURI::transformURI($formAction);
$tpl->setVariable('form_action', $formAction);
$res = eZTemplateDesignResource::instance();
$res->setKeys($classKeyArray);
return $tpl->fetch('design:repository/contentclass_client/remote_class_search_form.tpl');
}
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:44,代码来源:ocrepositorymappedcontentclassclient.php
示例17: 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
示例18: className
function className()
{
if ($this->ClassName === null) {
$contentClass = eZContentClass::fetch($this->attribute('contentclass_id'));
if (!$contentClass instanceof eZContentClass) {
eZDebug::writeError('Unable to find eZContentClass #' . $this->attribute('contentclass_id'), __METHOD__);
return null;
}
$this->ClassName = $contentClass->attribute('name');
}
return $this->ClassName;
}
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:12,代码来源:ezwaituntildatevalue.php
示例19: notificationAvailableTags
/**
* Ritorna l'elengo dei tag disponibili
*
* @return eZTagsObject[]
*/
public static function notificationAvailableTags()
{
$class = eZContentClass::fetchByIdentifier(self::CLASS_IDENTIFIER);
if ($class instanceof eZContentClass) {
$classAttribute = $class->fetchAttributeByIdentifier(self::TAG_ATTRIBUTE_IDENTIFIER);
if ($classAttribute instanceof eZContentClassAttribute) {
$tagRoot = eZTagsObject::fetch(intval($classAttribute->attribute(eZTagsType::SUBTREE_LIMIT_FIELD)));
return $tagRoot->getChildren();
}
}
return array();
}
开发者ID:informaticatrentina,项目名称:pat_base,代码行数:17,代码来源:itnewsletterpost.php
示例20: 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
|
请发表评论