本文整理汇总了PHP中ContentHelperQuery::orderbySecondary方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentHelperQuery::orderbySecondary方法的具体用法?PHP ContentHelperQuery::orderbySecondary怎么用?PHP ContentHelperQuery::orderbySecondary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentHelperQuery
的用法示例。
在下文中一共展示了ContentHelperQuery::orderbySecondary方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering The field to order on.
* @param string $direction The direction to order on.
*
* @return void.
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
parent::populateState();
$app = JFactory::getApplication();
// Add archive properties
$params = $this->state->params;
// Filter on archived articles
$this->setState('filter.published', 2);
// Filter on month, year
$this->setState('filter.month', $app->input->getInt('month'));
$this->setState('filter.year', $app->input->getInt('year'));
// Optional filter text
$this->setState('list.filter', $app->input->getString('filter-search'));
// Get list limit
$itemid = $app->input->get('Itemid', 0, 'int');
$limit = $app->getUserStateFromRequest('com_content.archive.list' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint');
$this->setState('list.limit', $limit);
// Set the archive ordering
$articleOrderby = $params->get('orderby_sec', 'rdate');
$articleOrderDate = $params->get('order_date');
// No category ordering
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate);
$this->setState('list.ordering', $secondary . ', a.created DESC');
$this->setState('list.direction', '');
}
示例2: 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;
}
示例3: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering The field to order on.
* @param string $direction The direction to order on.
*
* @return void.
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
parent::populateState($ordering, $direction);
$input = JFactory::getApplication()->input;
$user = JFactory::getUser();
// List state information
$limitstart = $input->getUInt('limitstart', 0);
$this->setState('list.start', $limitstart);
$params = $this->state->params;
$limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links');
$this->setState('list.limit', $limit);
$this->setState('list.links', $params->get('num_links'));
$this->setState('filter.frontpage', true);
if (!$user->authorise('core.edit.state', 'com_content') && !$user->authorise('core.edit', 'com_content')) {
// Filter on published for those who do not have edit or edit.state rights.
$this->setState('filter.published', 1);
} else {
$this->setState('filter.published', array(0, 1, 2));
}
// Check for category selection
if ($params->get('featured_categories') && implode(',', $params->get('featured_categories')) == true) {
$featuredCategories = $params->get('featured_categories');
$this->setState('filter.frontpage.categories', $featuredCategories);
}
$articleOrderby = $params->get('orderby_sec', 'rdate');
$articleOrderDate = $params->get('order_date');
$categoryOrderby = $params->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate);
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
$this->setState('list.ordering', $primary . $secondary . ', a.created DESC');
$this->setState('list.direction', '');
}
示例4: getListQuery
/**
* @return JDatabaseQuery
*/
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('MONTH(' . $queryDate . ') = ' . $month);
}
if ($year = $this->getState('filter.year')) {
$query->where('YEAR(' . $queryDate . ') = ' . $year);
}
//echo nl2br(str_replace('#__','jos_',$query));
return $query;
}
示例5: _buildContentOrderBy
function _buildContentOrderBy()
{
$filter_order = JRequest::getCmd('filter_order');
$filter_order_Dir = JRequest::getWord('filter_order_Dir');
$orderby = ' ORDER BY ';
if ($filter_order && $filter_order_Dir) {
$orderby .= $filter_order . ' ' . $filter_order_Dir . ', ';
}
// Get the page/component configuration
$params = $this->getState('parameters.menu');
if (!is_object($params)) {
$params =& JComponentHelper::getParams('com_content');
}
// Special ordering for archive articles
$orderby_sec = $params->def('orderby', 'rdate');
$primary = ContentHelperQuery::orderbySecondary($orderby_sec);
$orderby .= $primary;
return $orderby;
}
示例6: buildContentOrderBy
/**
* Generates the order by part of the query according to the
* menu/component/user settings. It checks if the current user
* has already changed the article's ordering column in the frontend
*
* @param JRegistry $params
* @param int $parentId
* @param int $itemid
* @return string
*/
static function buildContentOrderBy(&$params, $parentId, $itemid)
{
$app = JFactory::getApplication('site');
// Case when the child gets a different menu itemid than it's parent
if ($parentId != $itemid) {
$menu = $app->getMenu();
$item = $menu->getItem($itemid);
$menuParams = clone $params;
$itemParams = new JRegistry($item->params);
$menuParams->merge($itemParams);
} else {
$menuParams =& $params;
}
$filter_order = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
$filter_order_Dir = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
$orderby = ' ';
if ($filter_order && $filter_order_Dir) {
$orderby .= $filter_order . ' ' . $filter_order_Dir . ', ';
}
$articleOrderby = $menuParams->get('orderby_sec', 'rdate');
$articleOrderDate = $menuParams->get('order_date');
//$categoryOrderby = $menuParams->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
//$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
//$orderby .= $primary . ' ' . $secondary . ' a.created ';
$orderby .= $secondary . ' a.created ';
return $orderby;
}
示例7: getListQuery
/**
* Get the list of items.
*
* @return JDatabaseQuery
*/
protected function getListQuery()
{
// Set the blog ordering
$params = $this->state->params;
$articleOrderby = $params->get('orderby_sec', 'rdate');
$articleOrderDate = $params->get('order_date');
$categoryOrderby = $params->def('orderby_pri', '');
$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();
// Filter by frontpage.
if ($this->getState('filter.frontpage')) {
$query->join('INNER', '#__content_frontpage AS fp ON fp.content_id = a.id');
}
// Filter by categories
$featuredCategories = $this->getState('filter.frontpage.categories');
if (is_array($featuredCategories) && !in_array('', $featuredCategories)) {
$query->where('a.catid IN (' . implode(',', $featuredCategories) . ')');
}
return $query;
}
示例8: _buildContentOrderBy
function _buildContentOrderBy($state = 1)
{
$filter_order = JRequest::getCmd('filter_order');
$filter_order_Dir = JRequest::getWord('filter_order_Dir');
$orderby = ' ORDER BY ';
if ($filter_order && $filter_order_Dir) {
$orderby .= $filter_order . ' ' . $filter_order_Dir . ', ';
}
// Get the page/component configuration
$app =& JFactory::getApplication();
$params =& $app->getParams();
switch ($state) {
case -1:
// Special ordering for archive articles
$orderby_sec = $params->def('orderby', 'rdate');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec);
$primary = '';
break;
case 1:
default:
$orderby_sec = $params->def('orderby_sec', 'rdate');
$orderby_sec = $orderby_sec == 'front' ? '' : $orderby_sec;
$orderby_pri = $params->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec);
$primary = ContentHelperQuery::orderbyPrimary($orderby_pri);
break;
}
$orderby .= "{$primary} {$secondary}";
return $orderby;
}
示例9: _buildContentOrderBy
/**
* Build the orderby for the query
*
* @return string $orderby portion of query
*/
protected function _buildContentOrderBy()
{
$app =& JFactory::getApplication('site');
$params = $this->_state->params;
$itemid = JRequest::getInt('id', 0) . ':' . JRequest::getInt('Itemid', 0);
$filter_order = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
$filter_order_Dir = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
$orderby = ' ';
if ($filter_order && $filter_order_Dir) {
$orderby .= $filter_order . ' ' . $filter_order_Dir . ', ';
}
$articleOrderby = $params->get('article_orderby', 'rdate');
$articleOrderDate = $params->get('order_date');
$categoryOrderby = $params->def('category_orderby', '');
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
$orderby .= $primary . ' ' . $secondary . ' a.created DESC ';
return $orderby;
}
示例10: _buildContentOrderBy
/**
* Build the orderby for the query
*
* @return string $orderby portion of query
* @since 1.5
*/
protected function _buildContentOrderBy()
{
$app = JFactory::getApplication('site');
$db = $this->getDbo();
$params = $this->state->params;
$itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int');
$orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
$orderDirn = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
$orderby = ' ';
if (!in_array($orderCol, $this->filter_fields)) {
$orderCol = null;
}
if (!in_array(strtoupper($orderDirn), array('ASC', 'DESC', ''))) {
$orderDirn = 'ASC';
}
if ($orderCol && $orderDirn) {
$orderby .= $db->escape($orderCol) . ' ' . $db->escape($orderDirn) . ', ';
}
$articleOrderby = $params->get('orderby_sec', 'rdate');
$articleOrderDate = $params->get('order_date');
$categoryOrderby = $params->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
$orderby .= $primary . ' ' . $secondary . ' a.created ';
return $orderby;
}
示例11: _buildContentOrderBy
function _buildContentOrderBy($state = 1)
{
global $mainframe;
// Get the page/component configuration
$params =& $mainframe->getParams();
$filter_order = JRequest::getCmd('filter_order');
$filter_order_Dir = JRequest::getWord('filter_order_Dir');
$orderby = ' ORDER BY ';
if ($filter_order && $filter_order_Dir) {
$orderby .= $filter_order . ' ' . $filter_order_Dir . ', ';
}
if ($filter_order == 'author') {
$orderby .= 'created_by_alias ' . $filter_order_Dir . ', ';
}
switch ($state) {
case -1:
// Special ordering for archive articles
$orderby_sec = $params->def('orderby', 'rdate');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec) . ', ';
$primary = '';
break;
case 1:
default:
$orderby_sec = $params->def('orderby_sec', 'rdate');
$orderby_sec = $orderby_sec == 'front' ? '' : $orderby_sec;
$orderby_pri = $params->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec) . ', ';
$primary = ContentHelperQuery::orderbyPrimary($orderby_pri);
break;
}
$orderby .= $primary . ' ' . $secondary . ' a.created DESC';
return $orderby;
}
示例12: _buildContentOrderBy
function _buildContentOrderBy()
{
$filter_order = JRequest::getCmd('filter_order');
$filter_order_Dir = JRequest::getWord('filter_order_Dir');
if (!in_array($filter_order, array('a.id', 'a.title', 'a.alias', 'a.title_alias', 'a.introtext', 'a.sectionid', 'a.state', 'a.catid', 'a.created', 'a.created_by', 'a.created_by_alias', 'a.modified', 'a.modified_by', 'a.hits', 'a.ordering', 'cc.title', 's.title'))) {
$filter_order = '';
}
if (!in_array(strtoupper($filter_order_Dir), array('ASC', 'DESC'))) {
$filter_order_Dir = '';
}
$orderby = ' ORDER BY ';
if ($filter_order) {
$orderby .= $filter_order . ' ' . $filter_order_Dir . ', ';
}
// Get the page/component configuration
$params = $this->getState('parameters.menu');
if (!is_object($params)) {
$params =& JComponentHelper::getParams('com_content');
}
// Special ordering for archive articles
$orderby_sec = $params->def('orderby', 'rdate');
$primary = ContentHelperQuery::orderbySecondary($orderby_sec);
$orderby .= $primary;
return $orderby;
}
示例13: _buildContentOrderBy
function _buildContentOrderBy($state = 1)
{
$filter_order = JRequest::getCmd('filter_order');
$filter_order_Dir = JRequest::getWord('filter_order_Dir');
$orderby = ' ORDER BY ';
if ($filter_order && $filter_order_Dir) {
$orderby .= $filter_order . ' ' . $filter_order_Dir . ', ';
}
// Get the parameters of the active menu item
$menu =& JSite::getMenu();
$item = $menu->getActive();
$params =& $menu->getParams($item->id);
switch ($state) {
case -1:
// Special ordering for archive articles
$orderby_sec = $params->def('orderby', 'rdate');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec);
$primary = '';
break;
case 1:
default:
$orderby_sec = $params->def('orderby_sec', 'rdate');
$orderby_sec = $orderby_sec == 'front' ? '' : $orderby_sec;
$orderby_pri = $params->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec);
$primary = ContentHelperQuery::orderbyPrimary($orderby_pri);
break;
}
$orderby .= "{$primary} {$secondary}";
return $orderby;
}
示例14: _buildContentOrderBy
public static function _buildContentOrderBy($atribmenu)
{
$app = JFactory::getApplication('site');
$db = JFactory::getDbo();
$params = $atribmenu;
$itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int');
$orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
$orderDirn = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
$orderby = ' ';
/*if (!in_array($orderCol, $this->filter_fields))
{
$orderCol = null;
}*/
if (!in_array(strtoupper($orderDirn), array('ASC', 'DESC', ''))) {
$orderDirn = 'ASC';
}
if ($orderCol && $orderDirn) {
$orderby .= $db->escape($orderCol) . ' ' . $db->escape($orderDirn) . ', ';
}
$articleOrderby = $atribmenu['orderby_sec'] ? $atribmenu['orderby_sec'] : 'rdate';
$articleOrderDate = $atribmenu['order_date'];
$categoryOrderby = $atribmenu['orderby_pri'];
require_once JPATH_SITE . '/components/com_content/helpers/query.php';
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
$orderby .= $primary . ' ' . $secondary . ' a.created ';
return $orderby;
}
示例15: _buildContentOrderBy
function _buildContentOrderBy($state = 1)
{
global $mainframe;
// Get the page/component configuration
$params =& $mainframe->getParams();
$itemid = JRequest::getInt('id', 0) . ':' . JRequest::getInt('Itemid', 0);
$filter_order = $mainframe->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
if (!in_array($filter_order, array('a.title', 'author', 'a.hits', 'a.created', 'a.publish_up', 'a.publish_down', 'a.modified'))) {
$filter_order = '';
}
if (!in_array(strtoupper($filter_order_Dir), array('ASC', 'DESC'))) {
$filter_order_Dir = 'ASC';
}
$orderby = ' ORDER BY ';
if ($filter_order && $filter_order_Dir) {
$orderby .= $filter_order . ' ' . $filter_order_Dir . ', ';
}
if ($filter_order == 'author') {
$orderby .= 'created_by_alias ' . $filter_order_Dir . ', ';
}
switch ($state) {
case -1:
// Special ordering for archive articles
$orderby_sec = $params->def('orderby', 'rdate');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec) . ', ';
$primary = '';
break;
case 1:
default:
$orderby_sec = $params->def('orderby_sec', 'rdate');
$orderby_sec = $orderby_sec == 'front' ? '' : $orderby_sec;
$orderby_pri = $params->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec) . ', ';
$primary = ContentHelperQuery::orderbyPrimary($orderby_pri);
break;
}
$orderby .= $primary . ' ' . $secondary . ' a.created DESC';
return $orderby;
}