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


PHP ContentHelperQuery::getQueryDate方法代碼示例

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


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

示例1: getListQuery

 /**
  * @return	JDatabaseQuery
  */
 function getListQuery()
 {
     // Set the archive ordering
     $params = $this->state->params;
     $articleOrderby = $params->get('orderby_sec', 'rdate');
     $articleOrderDate = $params->get('order_date');
     // No category ordering
     $categoryOrderby = '';
     $secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
     $primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
     $orderby = $primary . ' ' . $secondary . ' a.created DESC ';
     $this->setState('list.ordering', $orderby);
     $this->setState('list.direction', '');
     // Create a new query object.
     $query = parent::getListQuery();
     // Add routing for archive
     $query->select(' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug');
     $query->select(' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as catslug');
     // Filter on month, year
     // First, get the date field
     $queryDate = ContentHelperQuery::getQueryDate($articleOrderDate);
     if ($month = $this->getState('filter.month')) {
         $query->where('MONTH(' . $queryDate . ') = ' . $month);
     }
     if ($year = $this->getState('filter.year')) {
         $query->where('YEAR(' . $queryDate . ') = ' . $year);
     }
     //echo nl2br(str_replace('#__','jos_',$query));
     return $query;
 }
開發者ID:carmerin,項目名稱:cesae-web,代碼行數:33,代碼來源:archive.php

示例2: getListQuery

 /**
  * Get the master query for retrieving a list of articles subject to the model state.
  *
  * @return  JDatabaseQuery
  *
  * @since   1.6
  */
 protected function getListQuery()
 {
     // Set the archive ordering
     $params = $this->state->params;
     $articleOrderby = $params->get('orderby_sec', 'rdate');
     $articleOrderDate = $params->get('order_date');
     // No category ordering
     $categoryOrderby = '';
     $secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
     $primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
     $orderby = $primary . ' ' . $secondary . ' a.created DESC ';
     $this->setState('list.ordering', $orderby);
     $this->setState('list.direction', '');
     // Create a new query object.
     $query = parent::getListQuery();
     // Add routing for archive
     // Sqlsrv changes
     $case_when = ' CASE WHEN ';
     $case_when .= $query->charLength('a.alias', '!=', '0');
     $case_when .= ' THEN ';
     $a_id = $query->castAsChar('a.id');
     $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
     $case_when .= ' ELSE ';
     $case_when .= $a_id . ' END as slug';
     $query->select($case_when);
     $case_when = ' CASE WHEN ';
     $case_when .= $query->charLength('c.alias', '!=', '0');
     $case_when .= ' THEN ';
     $c_id = $query->castAsChar('c.id');
     $case_when .= $query->concatenate(array($c_id, 'c.alias'), ':');
     $case_when .= ' ELSE ';
     $case_when .= $c_id . ' END as catslug';
     $query->select($case_when);
     // Filter on month, year
     // First, get the date field
     $queryDate = ContentHelperQuery::getQueryDate($articleOrderDate);
     if ($month = $this->getState('filter.month')) {
         $query->where($query->month($queryDate) . ' = ' . $month);
     }
     if ($year = $this->getState('filter.year')) {
         $query->where($query->year($queryDate) . ' = ' . $year);
     }
     return $query;
 }
開發者ID:educakanchay,項目名稱:kanchay,代碼行數:51,代碼來源:archive.php


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