當前位置: 首頁>>代碼示例>>PHP>>正文


PHP modX::getCollectionGraph方法代碼示例

本文整理匯總了PHP中modX::getCollectionGraph方法的典型用法代碼示例。如果您正苦於以下問題:PHP modX::getCollectionGraph方法的具體用法?PHP modX::getCollectionGraph怎麽用?PHP modX::getCollectionGraph使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在modX的用法示例。


在下文中一共展示了modX::getCollectionGraph方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fetchPosts

 /**
  * Fetch all posts for this thread
  *
  * @param mixed $post A reference to a disPost or ID of disPost to start the posts from
  * @param array $options An array of options for sorting, limiting and display
  * @return array
  */
 public function fetchPosts($post = false, array $options = array())
 {
     $response = array();
     $c = $this->xpdo->newQuery('disPost');
     $c->innerJoin('disThread', 'Thread');
     $c->where(array('thread' => $this->get('id')));
     $response['total'] = $this->xpdo->discuss->controller->getPostCount('disThread', $this->get('id'));
     $flat = $this->xpdo->getOption('flat', $options, true);
     $limit = $this->xpdo->getOption('limit', $options, (int) $this->xpdo->getOption('discuss.post_per_page', $options, 10));
     $start = $this->xpdo->getOption('start', $options, 0);
     if ($flat) {
         $sortBy = $this->xpdo->getOption('sortBy', $options, 'createdon');
         $sortDir = $this->xpdo->getOption('sortDir', $options, 'ASC');
         $c->sortby($this->xpdo->getSelectColumns('disPost', 'disPost', '', array($sortBy)), $sortDir);
         if (empty($_REQUEST['print'])) {
             $c->limit($limit, $start);
         }
     } else {
         $c->sortby($this->xpdo->getSelectColumns('disPost', 'disPost', '', array('rank')), 'ASC');
     }
     if (!empty($post)) {
         if (!is_object($post)) {
             $post = $this->xpdo->getObject('disPost', $post);
         }
         if ($post) {
             $c->where(array('disPost.createdon:>=' => $post->get('createdon')));
         }
     }
     $c->bindGraph('{"Author":{"PrimaryDiscussGroup":{},"PrimaryGroup":{}},"EditedBy":{}}');
     //$c->prepare();
     //$cacheKey = 'discuss/thread/'.$thread->get('id').'/'.md5($c->toSql());
     $response['results'] = $this->xpdo->getCollectionGraph('disPost', '{"Author":{"PrimaryDiscussGroup":{},"PrimaryGroup":{}},"EditedBy":{}}', $c);
     return $response;
 }
開發者ID:oneismore,項目名稱:Discuss,代碼行數:41,代碼來源:disthread.class.php

示例2: getUserGroupNames

 /**
  * Gets all the User Group names of the groups this user belongs to.
  *
  * @access public
  * @return array An array of User Group names.
  */
 public function getUserGroupNames()
 {
     $groupNames = array();
     $id = $this->get('id') ? (string) $this->get('id') : '0';
     if (isset($_SESSION["modx.user.{$id}.userGroupNames"]) && $this->xpdo->user->get('id') == $this->get('id')) {
         $groupNames = $_SESSION["modx.user.{$id}.userGroupNames"];
     } else {
         $memberGroups = $this->xpdo->getCollectionGraph('modUserGroup', '{"UserGroupMembers":{}}', array('UserGroupMembers.member' => $this->get('id')));
         if ($memberGroups) {
             /** @var modUserGroup $group */
             foreach ($memberGroups as $group) {
                 $groupNames[] = $group->get('name');
             }
         }
         $_SESSION["modx.user.{$id}.userGroupNames"] = $groupNames;
     }
     return $groupNames;
 }
開發者ID:ChrstnMgcn,項目名稱:revolution,代碼行數:24,代碼來源:moduser.class.php

示例3: getResourceGroupNames

 /**
  * Gets all the Resource Group names of the resource groups this resource is assigned to.
  *
  * @access public
  * @return array An array of Resource Group names.
  */
 public function getResourceGroupNames()
 {
     $resourceGroupNames = array();
     $resourceGroups = $this->xpdo->getCollectionGraph('modResourceGroup', '{"ResourceGroupResources":{}}', array('ResourceGroupResources.document' => $this->get('id')));
     if ($resourceGroups) {
         /** @var modResourceGroup $resourceGroup */
         foreach ($resourceGroups as $resourceGroup) {
             $resourceGroupNames[] = $resourceGroup->get('name');
         }
     }
     return $resourceGroupNames;
 }
開發者ID:DeFi-ManriquezLuis,項目名稱:MTLTransfer,代碼行數:18,代碼來源:modresource.class.php


注:本文中的modX::getCollectionGraph方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。