本文整理汇总了PHP中eZContentObject::fetchList方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::fetchList方法的具体用法?PHP eZContentObject::fetchList怎么用?PHP eZContentObject::fetchList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::fetchList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearContentCacheIfNeededBySectionID
static function clearContentCacheIfNeededBySectionID($sectionID)
{
// fetch all objects of this section
$objectList = eZContentObject::fetchList(false, array('section_id' => "{$sectionID}"));
// Clear cache
$objectIDList = array();
foreach ($objectList as $object) {
$objectIDList[] = $object['id'];
}
self::clearContentCacheIfNeeded($objectIDList);
return true;
}
示例2: orderStatistics
static function orderStatistics($year = false, $month = false)
{
if ($year == false) {
$startDate = 0;
$stopDate = mktime(0, 0, 0, 12, 31, 2037);
} else {
if ($year != false and $month == false) {
$startDate = mktime(0, 0, 0, 1, 1, $year);
$stopDate = mktime(0, 0, 0, 1, 1, $year + 1);
} else {
if ($year != false and $month != false) {
$startDate = mktime(0, 0, 0, $month, 1, $year);
$stopDate = mktime(23, 59, 59, $month + 1, 0, $year);
}
}
}
$db = eZDB::instance();
$productArray = $db->arrayQuery("SELECT ezproductcollection_item.*, ignore_vat, ezorder.created, currency_code FROM ezorder, ezproductcollection_item, ezproductcollection\n WHERE ezproductcollection.id=ezproductcollection_item.productcollection_id\n AND ezproductcollection_item.productcollection_id=ezorder.productcollection_id\n AND is_temporary='0'\n AND ezorder.created >= '{$startDate}' AND ezorder.created < '{$stopDate}'\n ORDER BY contentobject_id, currency_code");
$currentContentObjectID = 0;
$productItemArray = array();
$itemCount = 0;
$name = false;
$productInfo = array();
$totalSumInfo = array();
$firstPass = true;
// Hash of ContentObject ID, the value will be replaced by the correct object once all IDs are known.
$contentObjectIDHash = array();
foreach ($productArray as $productItem) {
$itemCount++;
$contentObjectID = $productItem['contentobject_id'];
if ($firstPass) {
$contentObjectIDHash[$currentContentObjectID] = true;
$currentContentObjectID = $contentObjectID;
$firstPass = false;
}
if ($currentContentObjectID != $contentObjectID && $itemCount != 1) {
$productItemArray[] = array('name' => $name, 'product' => &$contentObjectIDHash[$currentContentObjectID], 'product_info' => $productInfo);
$productInfo = array();
$name = $productItem['name'];
$currentContentObjectID = $contentObjectID;
$contentObjectIDHash[$currentContentObjectID] = true;
}
$currencyCode = $productItem['currency_code'];
if ($currencyCode == '') {
$currencyCode = eZOrder::fetchLocaleCurrencyCode();
}
if (!isset($productInfo[$currencyCode])) {
$productInfo[$currencyCode] = array('sum_count' => 0, 'sum_ex_vat' => 0, 'sum_inc_vat' => 0);
}
if (!isset($totalSumInfo[$currencyCode])) {
$totalSumInfo[$currencyCode] = array('sum_ex_vat' => 0, 'sum_inc_vat' => 0);
}
if ($productItem['ignore_vat'] == true) {
$vatValue = 0;
} else {
$vatValue = $productItem['vat_value'];
}
$price = $productItem['price'];
if ($productItem['is_vat_inc']) {
$priceExVAT = $price / (100 + $vatValue) * 100;
$priceIncVAT = $price;
} else {
$priceExVAT = $price;
$priceIncVAT = $price * (100 + $vatValue) / 100;
}
$count = $productItem['item_count'];
$realPricePercent = (100 - $productItem['discount']) / 100;
$totalPriceExVAT = round($count * $priceExVAT * $realPricePercent, 2);
$totalPriceIncVAT = round($count * $priceIncVAT * $realPricePercent, 2);
$totalSumInfo[$currencyCode]['sum_ex_vat'] += $totalPriceExVAT;
$totalSumInfo[$currencyCode]['sum_inc_vat'] += $totalPriceIncVAT;
$productInfo[$currencyCode]['sum_count'] += $count;
$productInfo[$currencyCode]['sum_ex_vat'] += $totalPriceExVAT;
$productInfo[$currencyCode]['sum_inc_vat'] += $totalPriceIncVAT;
}
// add last product info
if (!empty($productArray)) {
$productItemArray[] = array('name' => $name, 'product' => &$contentObjectIDHash[$currentContentObjectID], 'product_info' => $productInfo);
// Fetching all ContentObject ids in one query, filling the hash with the corresponding ContentObject
foreach (eZContentObject::fetchList(true, array("id" => array(array_keys($contentObjectIDHash)))) as $contentObject) {
$contentObjectIDHash[$contentObject->ID] = $contentObject;
}
}
return array(array('product_list' => $productItemArray, 'total_sum_info' => $totalSumInfo));
}
示例3: contentObjectByName
function contentObjectByName( $params )
{
$objectName = $params['name'];
$classID = isset( $params['class_id'] ) ? $params['class_id'] : false;
//build up the conditions
$conditions = array( 'name' => $objectName );
if( $classID )
array_merge( $conditions, array( 'contentclass_id' => $classID ) );
$objectList = eZContentObject::fetchList( true, $conditions, 0, 1 );
$object = false;
if( count( $objectList ) > 0 )
$object = $objectList[0];
return $object;
}
示例4: testFetchListWithArchivedStatus
/**
* Test for eZContentObject::fetchList(), returning objects with archived status
*/
public function testFetchListWithArchivedStatus()
{
$this->article->setAttribute('status', eZContentObject::STATUS_ARCHIVED);
$this->article->store();
$eZContentObjectDefinition = eZContentObject::definition();
$objects = eZContentObject::fetchList(true, array($eZContentObjectDefinition['name'] . ".id" => $this->article->id, 'status' => eZContentObject::STATUS_ARCHIVED));
$this->assertSame(1, count($objects));
}
示例5: clearContentCacheIfNeededBySectionID
static function clearContentCacheIfNeededBySectionID($sectionID)
{
// fetch all objects of this section
$objectList = eZContentObject::fetchList(false, array('section_id' => "{$sectionID}"));
// Clear cache
foreach ($objectList as $object) {
eZContentCacheManager::clearContentCacheIfNeeded($object['id']);
}
return true;
}
示例6: getClassList
$script->startup();
$options = $script->getOptions();
$script->initialize();
$cli = eZCLI::instance();
$affectedClasses = getClassList();
$languages = eZContentLanguage::fetchList();
if (count($languages) < 2) {
$script->shutdown(0, "This upgrade script is only required for installations that have more than one language");
}
$totalUpdatedRelations = 0;
foreach ($affectedClasses as $affectedClassId => $classAttributeIdentifiers) {
$count = eZContentObject::fetchListCount(array('contentclass_id' => $affectedClassId));
if ($count > 0) {
$done = 0;
do {
$objects = eZContentObject::fetchList(true, array('contentclass_id' => $affectedClassId), $done, 100);
foreach ($objects as $object) {
$updatedRelations = restoreXmlRelations($object, $classAttributeIdentifiers);
if ($updatedRelations) {
$cli->output(str_repeat('.', $updatedRelations), false);
}
$totalUpdatedRelations += $updatedRelations;
}
$done += count($objects);
} while ($done < $count);
}
}
if ($totalUpdatedRelations) {
$cli->output();
$cli->output();
$cli->output("Restored {$totalUpdatedRelations} relations");
示例7: 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)) {
//.........这里部分代码省略.........