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


PHP Am_Query::crossJoin方法代码示例

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


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

示例1: getResourcesForMembers

 /**
  * select resource accessible for customers using
  * records (user_id, resource_id, resource_type, login, email)
  * @return Am_Query
  */
 function getResourcesForMembers($types = null)
 {
     if ($types && !is_array($types)) {
         $types = (array) $types;
     }
     $qfree = new Am_Query($this, 'rfree');
     $qfree->crossJoin('?_user', 'u')->clearFields()->addField('u.user_id')->addField('rfree.resource_id')->addField('rfree.resource_type')->addField('u.login')->addField('u.email')->addWhere("rfree.fn = 'free'");
     $q = $this->_getBaseQuery();
     $q->clearFields();
     $q->addField('DISTINCT c.user_id')->addField('r.resource_id')->addField('r.resource_type')->addField('u.login')->addField('u.email')->leftJoin('?_user', 'u', 'u.user_id=c.user_id')->addOrder('user_id')->addWhere("r.fn <> 'free'")->addUnion($qfree);
     if ($types) {
         $q->addWhere('r.resource_type IN (?a)', $types);
     }
     return $q;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:20,代码来源:ResourceAccess.php

示例2: getResourcesForMembers

 /**
  * select resource accessible for customers using
  * records (user_id, resource_id, resource_type, login, email)
  * @return Am_Query
  */
 function getResourcesForMembers($types = null, $condition = "1=1")
 {
     if ($types && !is_array($types)) {
         $types = (array) $types;
     }
     $qfree = new Am_Query($this, 'rfree');
     $qfree->crossJoin('?_user', 'u')->clearFields()->addField('u.user_id')->addField('rfree.resource_id')->addField('rfree.resource_type')->addField('u.login')->addField('u.email')->addField("rfree.fn", 'fn')->addField("rfree.id", 'fn_id')->groupBy('user_id, resource_id, resource_type', 'u')->addWhere("rfree.fn IN ('free', 'free_without_login')")->addWhere("(\n                            (rfree.start_days IS NULL AND rfree.stop_days IS NULL) \n                            OR\n                            (CEIL((UNIX_TIMESTAMP() - UNIX_TIMESTAMP(u.added))/86400) BETWEEN IFNULL(rfree.start_days,0) AND IFNULL(rfree.stop_days, 90000)) \n                            OR\n                            (CEIL((UNIX_TIMESTAMP() - UNIX_TIMESTAMP(u.added))/86400) >= IFNULL(rfree.start_days,0) AND rfree.stop_days = -1) \n                       )");
     if ($types) {
         $qfree->addWhere('rfree.resource_type IN (?a) AND ' . $condition, $types);
     }
     $q = $this->_getBaseQuery();
     $q->clearFields();
     $q->clearOrder();
     $q->addField('DISTINCT c.user_id')->addField('r.resource_id')->addField('r.resource_type')->addField('u.login')->addField('u.email')->addField("r.fn", 'fn')->addField("r.id", 'fn_id')->leftJoin('?_user', 'u', 'u.user_id=c.user_id')->addOrder('user_id')->addOrderRaw("(SELECT _sort_order\n                 FROM ( SELECT sort_order as _sort_order, \n                        resource_type as _resource_type, \n                        resource_id as _resource_id\n                      FROM ?_resource_access_sort ras) AS _ras\n                 WHERE _resource_id=resource_id AND _resource_type=resource_type LIMIT 1),\n                 resource_id, resource_type")->groupBy('user_id, resource_id, resource_type', 'c')->addWhere("r.fn NOT IN ('free', 'free_without_login')")->addUnion($qfree);
     if ($types) {
         $q->addWhere('r.resource_type IN (?a) AND ' . $condition, $types);
     }
     return $q;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:24,代码来源:ResourceAccess.php


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