当前位置: 首页>>代码示例>>PHP>>正文


PHP eZPersistentObject::count方法代码示例

本文整理汇总了PHP中eZPersistentObject::count方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPersistentObject::count方法的具体用法?PHP eZPersistentObject::count怎么用?PHP eZPersistentObject::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZPersistentObject的用法示例。


在下文中一共展示了eZPersistentObject::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bookmarks

 /**
  * Gets current users bookmarks by offset and limit
  *
  * @param array $args  0 => offset:0, 1 => limit:10
  * @return hash
  */
 public static function bookmarks($args)
 {
     $offset = isset($args[0]) ? (int) $args[0] : 0;
     $limit = isset($args[1]) ? (int) $args[1] : 10;
     $http = eZHTTPTool::instance();
     $user = eZUser::currentUser();
     $sort = 'desc';
     if (!$user instanceof eZUser) {
         throw new ezcBaseFunctionalityNotSupportedException('Bookmarks retrival', 'current user object is not of type eZUser');
     }
     $userID = $user->attribute('contentobject_id');
     if ($http->hasPostVariable('SortBy') && $http->postVariable('SortBy') !== 'asc') {
         $sort = 'asc';
     }
     // fetch bookmarks
     $count = eZPersistentObject::count(eZContentBrowseBookmark::definition(), array('user_id' => $userID));
     if ($count) {
         $objectList = eZPersistentObject::fetchObjectList(eZContentBrowseBookmark::definition(), null, array('user_id' => $userID), array('id' => $sort), array('offset' => $offset, 'length' => $limit), true);
     } else {
         $objectList = false;
     }
     // Simplify node list so it can be encoded
     if ($objectList) {
         $list = ezjscAjaxContent::nodeEncode($objectList, array('loadImages' => true, 'fetchNodeFunction' => 'fetchNode', 'fetchChildrenCount' => true), 'raw');
     } else {
         $list = array();
     }
     return array('list' => $list, 'count' => $count ? count($objectList) : 0, 'total_count' => (int) $count, 'offset' => $offset, 'limit' => $limit);
 }
开发者ID:legende91,项目名称:ez,代码行数:35,代码来源:ezoeserverfunctions.php

示例2: run

 /**
  * Will check if UserID provided in credentials is valid
  * @see ezcAuthenticationFilter::run()
  */
 public function run($credentials)
 {
     $status = self::STATUS_INVALID_USER;
     $count = eZPersistentObject::count(eZUser::definition(), array('contentobject_id' => (int) $credentials->id));
     if ($count > 0) {
         $status = self::STATUS_OK;
     }
     return $status;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:13,代码来源:native_user_authfilter.php

示例3: userHasConnection

 /**
  * Returns if eZ Publish user has connection to specified social network
  *
  * @param int $userID
  * @param string $loginMethod
  *
  * @return bool
  */
 static function userHasConnection($userID, $loginMethod)
 {
     $count = eZPersistentObject::count(self::definition(), array('user_id' => $userID, 'login_method' => $loginMethod));
     if ($count > 0) {
         return true;
     }
     $user = eZUser::fetch($userID);
     if (substr($user->Login, 0, 10 + strlen($loginMethod)) === 'ngconnect_' . $loginMethod) {
         return true;
     }
     return false;
 }
开发者ID:netgen,项目名称:ngconnect,代码行数:20,代码来源:ngconnect.php

示例4: fetchDeliveriesByContentobjectIdCount

 static function fetchDeliveriesByContentobjectIdCount($object_id, $status = array())
 {
     $conds = array('contentobject_id' => $object_id);
     if (is_string($status)) {
         $status = array($status);
     }
     if (is_array($status)) {
         $status = array_intersect(jajNewsletterDelivery::states(), $status);
     }
     if (count($status)) {
         $conds['state'] = array($status);
     }
     $rows = eZPersistentObject::count(jajNewsletterDelivery::definition(), $conds);
     return $rows;
 }
开发者ID:jjohnsen,项目名称:jaj_newsletter,代码行数:15,代码来源:jajnewsletterdelivery.php

示例5: countByRecipientsLists

 static function countByRecipientsLists($lists, $status = array())
 {
     $list_ids = array();
     foreach ($lists as $list) {
         if (is_a($list, 'jajNewsletterRecipientsList')) {
             array_push($list_ids, $list->SubscriptionListID);
         }
     }
     if (count($list_ids)) {
         $conditions = array('subscription_list_id' => array($list_ids));
         if (is_string($status)) {
             $status = array($status);
         }
         if (is_array($status)) {
             $status = array_intersect(jajNewsletterSubscription::states(), $status);
         }
         if (count($status)) {
             $conditions['jaj_newsletter_subscription.state'] = array($status);
         }
         return eZPersistentObject::count(jajNewsletterSubscription::definition(), $conditions, "email");
     }
     return 0;
 }
开发者ID:jjohnsen,项目名称:jaj_newsletter,代码行数:23,代码来源:jajnewslettersubscription.php

示例6: importIsPending

 /**
  * Checks if an import is pending (waiting to start)
  * @return bool
  */
 public static function importIsPending()
 {
     $conds = array('name' => self::STATUS_FIELD_NAME, 'value' => self::IMPORT_STATUS_PENDING);
     $statusCount = parent::count(self::definition(), $conds);
     return $statusCount > 0;
 }
开发者ID:nicolasaguenot,项目名称:sqliimport,代码行数:10,代码来源:sqliimporttoken.php

示例7: userHasRated

 /**
  * Figgure out if current user has rated, since eZ Publish changes session id as of 4.1
  * on login / logout, a couple of things needs to be checked.
  * 1. Session variable 'ezsrRatedAttributeIdList' for list of attribute_id's
  * 2a. (annonymus user) check against session key
  * 2b. (logged in user) check against user id
  *
  * @param bool $returnRatedObject Return object if user has rated and [eZStarRating]AllowChangeRating=enabled
  * @return bool|ezsrRatingDataObject
  */
 function userHasRated($returnRatedObject = false)
 {
     if ($this->currentUserHasRated === null) {
         $http = eZHTTPTool::instance();
         if ($http->hasSessionVariable('ezsrRatedAttributeIdList')) {
             $attributeIdList = explode(',', $http->sessionVariable('ezsrRatedAttributeIdList'));
         } else {
             $attributeIdList = array();
         }
         $ini = eZINI::instance();
         $contentobjectAttributeId = $this->attribute('contentobject_attribute_id');
         if (in_array($contentobjectAttributeId, $attributeIdList) && $ini->variable('eZStarRating', 'UseUserSession') === 'enabled') {
             $this->currentUserHasRated = true;
         }
         $returnRatedObject = $returnRatedObject && $ini->variable('eZStarRating', 'AllowChangeRating') === 'enabled';
         if ($this->currentUserHasRated === null || $returnRatedObject) {
             $sessionKey = $this->attribute('session_key');
             $userId = $this->attribute('user_id');
             if ($userId == eZUser::anonymousId()) {
                 $cond = array('user_id' => $userId, 'session_key' => $sessionKey, 'contentobject_id' => $this->attribute('contentobject_id'), 'contentobject_attribute_id' => $contentobjectAttributeId);
             } else {
                 $cond = array('user_id' => $userId, 'contentobject_id' => $this->attribute('contentobject_id'), 'contentobject_attribute_id' => $contentobjectAttributeId);
             }
             if ($returnRatedObject) {
                 $this->currentUserHasRated = eZPersistentObject::fetchObject(self::definition(), null, $cond);
                 if ($this->currentUserHasRated === null) {
                     $this->currentUserHasRated = false;
                 }
             } else {
                 $this->currentUserHasRated = eZPersistentObject::count(self::definition(), $cond, 'id') != 0;
             }
         }
     }
     return $this->currentUserHasRated;
 }
开发者ID:heliopsis,项目名称:ezstarrating,代码行数:45,代码来源:ezsrratingdataobject.php

示例8: getPaEx

 /**
  * Get actual values for PaEx data for the given contentobject id.
  * If not defined for the given coID, use defaults.
  *
  * @param int $ezcoid Contentobject id (user id) to get PaEx for
  * @param bool $checkIfUserHasDatatype See if user has paex datatype, default false
  * @return eZPaEx|null Actual PaEx applicable data, null if $checkIfUserHasDatatype = true
  *                     and object does not have ezpaex datatype
  */
 static function getPaEx($ezcoid, $checkIfUserHasDatatype = false)
 {
     $currentPaex = eZPaEx::fetch($ezcoid);
     // If we don't have paex object for the current object id, create a default one
     if (!$currentPaex instanceof eZPaEx) {
         // unless user does not have paex datatype
         if ($checkIfUserHasDatatype) {
             //eZContentObject::fetch( $ezcoid );
             $paexDataTypeCount = eZPersistentObject::count(eZContentObjectAttribute::definition(), array('contentobject_id' => $ezcoid, 'data_type_string' => ezpaextype::DATA_TYPE_STRING), 'id');
             if (!$paexDataTypeCount) {
                 eZDebug::writeDebug("User id {$ezcoid} does not have paex datatype", __METHOD__);
                 return null;
             }
         }
         return eZPaEx::create($ezcoid);
     }
     // Get default paex values from ini to use in case there is anyone missing in the object
     $ini = eZINI::instance('mbpaex.ini');
     $iniPasswordValidationRegexp = $ini->variable('mbpaexSettings', 'PasswordValidationRegexp');
     $iniDefaultPasswordLifeTime = $ini->variable('mbpaexSettings', 'DefaultPasswordLifeTime');
     $iniExpirationNotification = $ini->variable('mbpaexSettings', 'ExpirationNotification');
     // If still any empty values in the paex object, set defaults from ini
     if (!$currentPaex->hasRegexp()) {
         $currentPaex->setAttribute('passwordvalidationregexp', $iniPasswordValidationRegexp);
         eZDebug::writeDebug('Regexp empty, used default: "' . $iniPasswordValidationRegexp . '"', 'eZPaEx::getPaEx');
     }
     if (!$currentPaex->hasLifeTime()) {
         $currentPaex->setAttribute('passwordlifetime', $iniDefaultPasswordLifeTime);
         eZDebug::writeDebug('PasswordLifeTime empty, used default: "' . $iniDefaultPasswordLifeTime . '"', 'eZPaEx::getPaEx');
     }
     if (!$currentPaex->hasNotification()) {
         $currentPaex->setAttribute('expirationnotification', $iniExpirationNotification);
         eZDebug::writeDebug('ExpirationNotification empty, used default: "' . $iniPasswordValidationRegexp . '"', 'eZPaEx::getPaEx');
     }
     eZDebug::writeDebug('PasswordLastUpdated value: "' . $currentPaex->attribute('password_last_updated') . '"', 'eZPaEx::getPaEx');
     return $currentPaex;
 }
开发者ID:netbliss,项目名称:ezmbpaex,代码行数:46,代码来源:ezpaex.php

示例9: array

    eZDB::setInstance($db);
}
$db->setIsSQLOutputEnabled($showSQL);
$searchEngine = eZSearch::getEngine();
if (!$searchEngine instanceof ezpSearchEngine) {
    $cli->error("The configured search engine does not implement the ezpSearchEngine interface or can't be found.");
    $script->shutdown(1);
}
if ($cleanupSearch) {
    $cli->output("{eZSearchEngine: Cleaning up search data", false);
    $searchEngine->cleanup();
    $cli->output("}");
}
$def = eZContentObject::definition();
$conds = array('status' => eZContentObject::STATUS_PUBLISHED);
$count = eZPersistentObject::count($def, $conds, 'id');
$cli->output("Number of objects to index: {$count}");
$length = 50;
$limit = array('offset' => 0, 'length' => $length);
$script->resetIteration($count);
$needRemoveWithUpdate = $searchEngine->needRemoveWithUpdate();
do {
    // clear in-memory object cache
    eZContentObject::clearCache();
    $objects = eZPersistentObject::fetchObjectList($def, null, $conds, null, $limit);
    foreach ($objects as $object) {
        if ($needRemoveWithUpdate || !$cleanupSearch) {
            $searchEngine->removeObjectById($object->attribute("id"), false);
        }
        if (!$searchEngine->addObject($object, false)) {
            $cli->warning("\tFailed indexing object ID #" . $object->attribute("id") . ".");
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:31,代码来源:updatesearchindex.php

示例10: fetchObjectsForQueryString

 /**
  * Retrieves the content objects elevated by a given query string, possibly per language.
  *
  * @param mixed $searchQuery Can be a string containing the search_query to filter on.
  *                           Can also be an array looking like the following, supporting fuzzy search optionnally.
  * <code>
  *    array( 'searchQuery' => ( string )  'foo bar',
  *           'fuzzy'       => ( boolean ) true      )
  * </code>
  *
  * @param string $languageCode if filtering on language-code is required
  * @param array $limit Associative array containing the 'offset' and 'limit' keys, with integers as values, framing the result set. Example :
  * <code>
  *     array( 'offset' => 0,
  *            'limit'  => 10 )
  * </code>
  *
  * @param boolean $countOnly If only the count of matching results is needed
  * @return mixed An array containing the content objects elevated by the query string, optionnally sorted by language code, null if error. If $countOnly is true,
  *               only the result count is returned.
  */
 public static function fetchObjectsForQueryString($queryString, $groupByLanguage = true, $languageCode = null, $limit = null, $countOnly = false)
 {
     if (is_string($queryString) and $queryString === '' or is_array($queryString) and array_key_exists('searchQuery', $queryString) and $queryString['searchQuery'] == '') {
         return null;
     }
     $fieldFilters = $custom = null;
     $objects = array();
     $conds = array();
     $sortClause = $groupByLanguage ? array('language_code' => 'asc') : null;
     if (!is_array($queryString)) {
         $conds['search_query'] = $queryString;
     } else {
         $conds['search_query'] = @$queryString['fuzzy'] === true ? array('like', "%{$queryString['searchQuery']}%") : $queryString['searchQuery'];
     }
     if ($languageCode and $languageCode !== '') {
         $conds['language_code'] = array(array($languageCode, self::WILDCARD));
     }
     if ($countOnly) {
         return parent::count(self::definition(), $conds);
     } else {
         $rows = parent::fetchObjectList(self::definition(), $fieldFilters, $conds, $sortClause, $limit, false, false, $custom);
         foreach ($rows as $row) {
             if (($obj = eZContentObject::fetch($row['contentobject_id'])) !== null) {
                 if ($groupByLanguage) {
                     $objects[$row['language_code']][] = $obj;
                 } else {
                     $objects[] = $obj;
                 }
             }
         }
         return $objects;
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:54,代码来源:ezfindelevateconfiguration.php

示例11: viewCacheClear

 /**
  * Clears view cache for imported content objects.
  * ObjectIDs are stored in 'ezpending_actions' table, with {@link SQLIContent::ACTION_CLEAR_CACHE} action
  */
 public static function viewCacheClear()
 {
     $db = eZDB::instance();
     $isCli = isset($_SERVER['argv']);
     $output = null;
     $progressBar = null;
     $i = 0;
     $conds = array('action' => SQLIContent::ACTION_CLEAR_CACHE);
     $limit = array('offset' => 0, 'length' => 50);
     $count = (int) eZPersistentObject::count(eZPendingActions::definition(), $conds);
     if ($isCli && $count > 0) {
         // Progress bar implementation
         $output = new ezcConsoleOutput();
         $output->outputLine('Starting to clear view cache for imported objects...');
         $progressBarOptions = array('emptyChar' => ' ', 'barChar' => '=');
         $progressBar = new ezcConsoleProgressbar($output, $count, $progressBarOptions);
         $progressBar->start();
     }
     /*
      * To avoid fatal errors due to memory exhaustion, pending actions are fetched by packets
      */
     do {
         $aObjectsToClear = eZPendingActions::fetchObjectList(eZPendingActions::definition(), null, $conds, null, $limit);
         $jMax = count($aObjectsToClear);
         if ($jMax > 0) {
             for ($j = 0; $j < $jMax; ++$j) {
                 if ($isCli) {
                     $progressBar->advance();
                 }
                 $db->begin();
                 eZContentCacheManager::clearContentCacheIfNeeded((int) $aObjectsToClear[$j]->attribute('param'));
                 $aObjectsToClear[$j]->remove();
                 $db->commit();
                 $i++;
             }
         }
         unset($aObjectsToClear);
         eZContentObject::clearCache();
         if (eZINI::instance('site.ini')->variable('ContentSettings', 'StaticCache') == 'enabled') {
             $optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
             $options = new ezpExtensionOptions($optionArray);
             $staticCacheHandler = eZExtension::getHandlerClass($options);
             $staticCacheHandler::executeActions();
         }
     } while ($i < $count);
     if ($isCli && $count > 0) {
         $progressBar->finish();
         $output->outputLine();
     }
 }
开发者ID:lolautruche,项目名称:sqliimport,代码行数:54,代码来源:sqliimportutils.php

示例12: fetchSubscriptionListByImportIdAndStatusCount

 /**
  * Count all user who subscripe to list
  *
  * @param integer $importId
  * @param integer Subscirpiton STATUS
  * @return integer
  */
 static function fetchSubscriptionListByImportIdAndStatusCount($importId, $status)
 {
     $count = eZPersistentObject::count(self::definition(), array('import_id' => (int) $importId, 'status' => (int) $status), 'id');
     return $count;
 }
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:12,代码来源:cjwnewslettersubscription.php

示例13: fetchBounceCountByEditionSendId

 /**
  * count all bounces for a edition send id
  *
  * @param integer $editionSendId
  * @return integer
  */
 public static function fetchBounceCountByEditionSendId($editionSendId)
 {
     $count = eZPersistentObject::count(self::definition(), array('edition_send_id' => (int) $editionSendId, 'bounced' => array('>', 0)), 'id');
     return $count;
 }
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:11,代码来源:cjwnewslettereditionsenditem.php

示例14: fetchSubscribersCount

 public function fetchSubscribersCount($state = null)
 {
     $conditions = array('subscription_list_id' => $this->ID);
     if ($state) {
         $conditions['state'] = $state;
     }
     return eZPersistentObject::count(jajNewsletterSubscription::definition(), $conditions);
 }
开发者ID:jjohnsen,项目名称:jaj_newsletter,代码行数:8,代码来源:jajnewslettersubscriptionlist.php

示例15: removeRelationObject

 static function removeRelationObject($contentObjectAttribute, $deletionItem)
 {
     if (self::isItemPublished($deletionItem)) {
         return;
     }
     $hostObject = $contentObjectAttribute->attribute('object');
     $hostObjectID = $hostObject->attribute('id');
     // Do not try removing the object if present in trash
     // Only objects being really orphaned (not even being in trash) should be removed by this method.
     // See issue #019457
     if ((int) eZPersistentObject::count(eZContentObjectTrashNode::definition(), array("contentobject_id" => $hostObjectID)) > 0) {
         return;
     }
     $hostObjectVersions = $hostObject->versions();
     $isDeletionAllowed = true;
     // check if the relation item to be deleted is unique in the domain of all host-object versions
     foreach ($hostObjectVersions as $version) {
         if ($isDeletionAllowed and $version->attribute('version') != $contentObjectAttribute->attribute('version')) {
             $relationAttribute = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, array('version' => $version->attribute('version'), 'contentobject_id' => $hostObjectID, 'contentclassattribute_id' => $contentObjectAttribute->attribute('contentclassattribute_id')));
             if (count($relationAttribute) > 0) {
                 $relationContent = $relationAttribute[0]->content();
                 if (is_array($relationContent) and is_array($relationContent['relation_list'])) {
                     foreach ($relationContent['relation_list'] as $relationItem) {
                         if ($deletionItem['contentobject_id'] == $relationItem['contentobject_id'] && $deletionItem['contentobject_version'] == $relationItem['contentobject_version']) {
                             $isDeletionAllowed = false;
                             break 2;
                         }
                     }
                 }
             }
         }
     }
     if ($isDeletionAllowed) {
         $subObjectVersion = eZContentObjectVersion::fetchVersion($deletionItem['contentobject_version'], $deletionItem['contentobject_id']);
         if ($subObjectVersion instanceof eZContentObjectVersion) {
             $subObjectVersion->removeThis();
         } else {
             eZDebug::writeError('Cleanup of subobject-version failed. Could not fetch object from relation list.\\n' . 'Requested subobject id: ' . $deletionItem['contentobject_id'] . '\\n' . 'Requested Subobject version: ' . $deletionItem['contentobject_version'], __METHOD__);
         }
     }
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:41,代码来源:ezobjectrelationlisttype.php


注:本文中的eZPersistentObject::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。