当前位置: 首页>>代码示例>>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;未经允许,请勿转载。