本文整理汇总了PHP中eZPersistentObject类的典型用法代码示例。如果您正苦于以下问题:PHP eZPersistentObject类的具体用法?PHP eZPersistentObject怎么用?PHP eZPersistentObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZPersistentObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchForUser
static function fetchForUser( $address, $asObject = true )
{
return eZPersistentObject::fetchObject( eZGeneralDigestUserSettings::definition(),
null,
array( 'address' => $address ),
$asObject );
}
示例2: 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);
}
示例3: fetchList
function fetchList($collaborationID, $userID = false, $asObject = true)
{
if ($userID == false) {
$userID == eZUser::currentUserID();
}
return eZPersistentObject::fetchObjectList(eZCollaborationItemGroupLink::definition(), null, array('collaboration_id' => $collaborationID, 'user_id' => $userID), null, null, $asObject);
}
示例4: removeDrafts
function removeDrafts($user)
{
$list = eZPersistentObject::fetchObjectList(eZContentObjectVersion::definition(), null, array('creator_id' => $user->id(), 'status' => array(EZ_VERSION_STATUS_DRAFT, EZ_VERSION_STATUS_INTERNAL_DRAFT)), null, null, true);
foreach ($list as $item) {
$item->remove();
}
}
示例5: fetchClassListByGroups
function fetchClassListByGroups( $groupFilter, $groupFilterType = 'include' )
{
$notIn = ( $groupFilterType == 'exclude' );
if ( is_array( $groupFilter ) && count( $groupFilter ) > 0 )
{
$db = eZDB::instance();
$groupFilter = $db->generateSQLINStatement( $groupFilter, 'ccg.group_id', $notIn );
$classNameFilter = eZContentClassName::sqlFilter( 'cc' );
$version = eZContentClass::VERSION_STATUS_DEFINED;
$sql = "SELECT DISTINCT cc.*, $classNameFilter[nameField] " .
"FROM ezcontentclass cc, ezcontentclass_classgroup ccg, $classNameFilter[from] " .
"WHERE cc.version = $version" .
" AND cc.id = ccg.contentclass_id" .
" AND $groupFilter" .
" AND $classNameFilter[where] " .
"ORDER BY $classNameFilter[nameField] ASC";
$rows = $db->arrayQuery( $sql );
$classes = eZPersistentObject::handleRows( $rows, 'eZContentClass', true );
}
else
{
$classes = eZContentClass::fetchList( eZContentClass::VERSION_STATUS_DEFINED, true, false, array( 'name' => 'asc' ) );
}
return array( 'result' => $classes );
}
示例6: fetchList
static function fetchList($mementoKey, $asObject = true)
{
if (is_array($mementoKey)) {
$mementoKey = eZOperationMemento::createKey($mementoKey);
}
return eZPersistentObject::fetchObjectList(eZOperationMemento::definition(), null, array('memento_key' => $mementoKey, 'main' => 0), null, null, $asObject);
}
示例7: fetchParticipantList
static function fetchParticipantList($parameters = array())
{
$parameters = array_merge(array('as_object' => true, 'item_id' => false, 'offset' => false, 'limit' => false, 'sort_by' => false), $parameters);
$cacheHashKey = md5(serialize($parameters));
if (isset($GLOBALS['eZCollaborationItemParticipantLinkListCache'][$cacheHashKey])) {
return $GLOBALS['eZCollaborationItemParticipantLinkListCache'][$cacheHashKey];
}
$itemID = $parameters['item_id'];
$asObject = $parameters['as_object'];
$offset = $parameters['offset'];
$limit = $parameters['limit'];
$linkList = null;
$limitArray = null;
if ($offset and $limit) {
$limitArray = array('offset' => $offset, 'length' => $limit);
}
$linkList = eZPersistentObject::fetchObjectList(eZCollaborationItemParticipantLink::definition(), null, array("collaboration_id" => $itemID), null, $limitArray, $asObject);
foreach ($linkList as $linkItem) {
if ($asObject) {
$participantID = $linkItem->attribute('participant_id');
} else {
$participantID = $linkItem['participant_id'];
}
if (!isset($GLOBALS["eZCollaborationItemParticipantLinkCache"][$itemID][$participantID])) {
$GLOBALS["eZCollaborationItemParticipantLinkCache"][$itemID][$participantID] = $linkItem;
}
}
return $GLOBALS['eZCollaborationItemParticipantLinkListCache'][$cacheHashKey] = $linkList;
}
示例8: fetch
/**
* Used in datatype cjwnewsletter_list
*
* @param unknown_type $attributeId
* @param unknown_type $version
* @return CjwNewsletterEdition
*/
static function fetch($attributeId, $version)
{
$objectList = eZPersistentObject::fetchObjectList(CjwNewsletterEdition::definition(), null, array('contentobject_attribute_id' => $attributeId, 'contentobject_attribute_version' => $version), null, null, true);
if (count($objectList) > 0) {
return $objectList[0];
}
}
示例9: groupedUserDrafts
/**
* @return array
*/
static function groupedUserDrafts()
{
$return = array();
$user = eZUser::currentUser();
$fetchParameters = array('status' => array(array(eZContentObjectVersion::STATUS_DRAFT, eZContentObjectVersion::STATUS_INTERNAL_DRAFT)), 'creator_id' => $user->attribute('contentobject_id'));
$versions = eZPersistentObject::fetchObjectList(eZContentObjectVersion::definition(), null, $fetchParameters);
$return = array();
foreach ($versions as $version) {
$return[$version->attribute('contentobject_id')] = array('version' => $version, 'related' => array());
}
foreach ($return as $id => $entry) {
$eZObj = $entry['version']->attribute('contentobject');
switch ($eZObj->attribute('class_identifier')) {
case 'image':
$revese_related_objects = $eZObj->reverseRelatedObjectList(false, 0, false, array('AllRelations' => true));
foreach ($revese_related_objects as $rr_eZObj) {
if (isset($return[$rr_eZObj->attribute('id')])) {
$return[$rr_eZObj->attribute('id')]['related'][] = $entry['version'];
unset($return[$eZObj->attribute('id')]);
}
}
}
}
return array('result' => $return);
}
示例10: fetchAllElements
static function fetchAllElements($classAttributeID, $version, $asObject = true)
{
if ($classAttributeID === null) {
return array();
}
return eZPersistentObject::fetchObjectList(eZEnumValue::definition(), null, array("contentclass_attribute_id" => $classAttributeID, "contentclass_attribute_version" => $version), null, null, $asObject);
}
示例11: removeByID
static function removeByID($id, $version)
{
if ($version == null) {
eZPersistentObject::removeObject(eZBinaryFile::definition(), array('contentobject_attribute_id' => $id));
} else {
eZPersistentObject::removeObject(eZBinaryFile::definition(), array('contentobject_attribute_id' => $id, 'version' => $version));
}
}
示例12: unLock
function unLock(eZContentObject $object)
{
$filterConds = array('action' => 'creating_translation', 'param' => $object->attribute('id'));
$rows = eZPersistentObject::fetchObjectList(eZPendingActions::definition(), null, $filterConds);
foreach ($rows as $row) {
$row->remove();
}
}
示例13: connections
/**
* Returns all of eZ Publish users connections to social networks
*
* @param int $userID
*
* @return bool
*/
static function connections($userID)
{
$result = eZPersistentObject::fetchObjectList(self::definition(), null, array('user_id' => $userID));
if (is_array($result) && !empty($result)) {
return $result;
}
return array();
}
示例14: removeByAttribute
/**
* Removes the data from the table by attribute
*
* @param int $contentObjectAttributeId
* @param int $contentObjectAttributeVersion
*/
static function removeByAttribute($contentObjectAttributeId, $contentObjectAttributeVersion = null)
{
$conditions = array('contentobject_attribute_id' => $contentObjectAttributeId);
if ($contentObjectAttributeVersion !== null) {
$conditions['contentobject_attribute_version'] = $contentObjectAttributeVersion;
}
eZPersistentObject::removeObject(self::definition(), $conditions);
}
示例15: fetchList
public static function fetchList($classAttributeID, $typeID = null)
{
$filters = array('class_attribute_id' => $classAttributeID);
if ($typeID !== null) {
$filters['type'] = $typeID;
}
return eZPersistentObject::fetchObjectList(self::definition(), null, $filters, true);
}