當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。