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