• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ContentHelperQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了ContentHelperQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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', '');
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:44,代码来源:featured.php


示例3: _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;
 }
开发者ID:Isabella570,项目名称:Hotel-Management-Selena-,代码行数:30,代码来源:section.php


示例4: _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;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:24,代码来源:category.php


示例5: display

 /**
  * Display the view
  *
  * @return	mixed	False on error, null otherwise.
  */
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $state = $this->get('State');
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $params =& $state->params;
     // PREPARE THE DATA
     // Get the metrics for the structural page layout.
     $numLeading = $params->def('num_leading_articles', 1);
     $numIntro = $params->def('num_intro_articles', 4);
     $numLinks = $params->def('num_links', 4);
     // Compute the article slugs and prepare introtext (runs content plugins).
     foreach ($items as $i => &$item) {
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         $item->event = new stdClass();
         $dispatcher = JEventDispatcher::getInstance();
         $item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'com_content.featured');
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$item->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
     }
     // Preprocess the breakdown of leading, intro and linked articles.
     // This makes it much easier for the designer to just interogate the arrays.
     $max = count($items);
     // The first group is the leading articles.
     $limit = $numLeading;
     for ($i = 0; $i < $limit && $i < $max; $i++) {
         $this->lead_items[$i] =& $items[$i];
     }
     // The second group is the intro articles.
     $limit = $numLeading + $numIntro;
     // Order articles across, then down (or single column mode)
     for ($i = $numLeading; $i < $limit && $i < $max; $i++) {
         $this->intro_items[$i] =& $items[$i];
     }
     $this->columns = max(1, $params->def('num_columns', 1));
     $order = $params->def('multi_column_order', 1);
     if ($order == 0 && $this->columns > 1) {
         // call order down helper
         $this->intro_items = ContentHelperQuery::orderDownColumns($this->intro_items, $this->columns);
     }
     // The remainder are the links.
     for ($i = $numLeading + $numIntro; $i < $max; $i++) {
         $this->link_items[$i] =& $items[$i];
     }
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->params =& $params;
     $this->items =& $items;
     $this->pagination =& $pagination;
     $this->user =& $user;
     $this->_prepareDocument();
     parent::display($tpl);
 }
开发者ID:RuDers,项目名称:JoomlaSQL,代码行数:75,代码来源:view.html.php


示例6: 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


示例7: display

 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     // Get some data from the models
     $state = $this->get('State');
     $params = $state->params;
     $items = $this->get('Items');
     $category = $this->get('Category');
     $children = $this->get('Children');
     $parent = $this->get('Parent');
     $pagination = $this->get('Pagination');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     if ($category == false) {
         return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
     }
     if ($parent == false) {
         return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
     }
     // Setup the category parameters.
     $cparams = $category->getParams();
     $category->params = clone $params;
     $category->params->merge($cparams);
     // Check whether category access level allows access.
     $user = JFactory::getUser();
     $groups = $user->getAuthorisedViewLevels();
     if (!in_array($category->access, $groups)) {
         return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     // PREPARE THE DATA
     // Get the metrics for the structural page layout.
     $numLeading = $params->def('num_leading_articles', 1);
     $numIntro = $params->def('num_intro_articles', 4);
     $numLinks = $params->def('num_links', 4);
     // Compute the article slugs and prepare introtext (runs content plugins).
     for ($i = 0, $n = count($items); $i < $n; $i++) {
         $item =& $items[$i];
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
         $item->event = new stdClass();
         $dispatcher = JEventDispatcher::getInstance();
         $item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'com_content.category');
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$item->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
     }
     // Check for layout override only if this is not the active menu item
     // If it is the active menu item, then the view and category id will match
     $active = $app->getMenu()->getActive();
     if (!$active || (strpos($active->link, 'view=category') === false || strpos($active->link, '&id=' . (string) $category->id) === false)) {
         // Get the layout from the merged category params
         if ($layout = $category->params->get('category_layout')) {
             $this->setLayout($layout);
         }
     } elseif (isset($active->query['layout'])) {
         // We need to set the layout from the query in case this is an alternative menu item (with an alternative layout)
         $this->setLayout($active->query['layout']);
     }
     // For blog layouts, preprocess the breakdown of leading, intro and linked articles.
     // This makes it much easier for the designer to just interrogate the arrays.
     if ($params->get('layout_type') == 'blog' || $this->getLayout() == 'blog') {
         $max = count($items);
         // The first group is the leading articles.
         $limit = $numLeading;
         for ($i = 0; $i < $limit && $i < $max; $i++) {
             $this->lead_items[$i] =& $items[$i];
         }
         // The second group is the intro articles.
         $limit = $numLeading + $numIntro;
         // Order articles across, then down (or single column mode)
         for ($i = $numLeading; $i < $limit && $i < $max; $i++) {
             $this->intro_items[$i] =& $items[$i];
         }
         $this->columns = max(1, $params->def('num_columns', 1));
         $order = $params->def('multi_column_order', 1);
         if ($order == 0 && $this->columns > 1) {
             // call order down helper
             $this->intro_items = ContentHelperQuery::orderDownColumns($this->intro_items, $this->columns);
         }
         $limit = $numLeading + $numIntro + $numLinks;
         // The remainder are the links.
         for ($i = $numLeading + $numIntro; $i < $limit && $i < $max; $i++) {
             $this->link_items[$i] =& $items[$i];
         }
     }
     $children = array($category->id => $children);
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
//.........这里部分代码省略.........
开发者ID:rasiodesign,项目名称:joomla-cms,代码行数:101,代码来源:view.html.php


示例8: _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;
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:19,代码来源:archive.php


示例9: _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;
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:31,代码来源:section.php


示例10: getData

 /**
  *
  * Get data
  *
  * @param Array $pk
  */
 public function getData($pk)
 {
     $this->_data = new stdClass();
     $this->_data->items = array();
     $this->_data->children = null;
     $this->_data->category = null;
     jimport('joomla.application.categories');
     $this->setState('category.id', $pk['id']);
     $this->_data->items = $this->getItems();
     // Get some data from the models
     if (isset($this->state->params)) {
         $this->_data->params = $this->state->params;
         $options = array();
         $options['countItems'] = $this->_data->params->get('show_cat_num_articles', 1) || !$this->_data->params->get('show_empty_categories_cat', 0);
     } else {
         $options['countItems'] = 0;
     }
     $categories = JCategories::getInstance('Content', $options);
     $this->_data->category = $categories->get($this->getState('category.id', 'root'));
     // Compute selected asset permissions.
     if (is_object($this->_data->category)) {
         // TODO: Why aren't we lazy loading the children and siblings?
         $this->_data->children = $this->_data->category->getChildren();
         $this->_data->parent = false;
         if ($this->_data->category->getParent()) {
             $this->_data->parent = $this->_data->category->getParent();
         }
         // Setup the category parameters.
         $cparams = $this->_data->category->getParams();
         $this->_data->category->params = clone $this->_data->params;
         $this->_data->category->params->merge($cparams);
     } else {
         $this->_data->children = false;
         $this->_data->parent = false;
     }
     // PREPARE THE DATA
     // Get the metrics for the structural page layout.
     $numLeading = $this->_data->params->def('num_leading_articles', 1);
     $numIntro = $this->_data->params->def('num_intro_articles', 4);
     $numLinks = $this->_data->params->def('num_links', 4);
     // Compute the article slugs and prepare introtext (runs content plugins).
     for ($i = 0, $n = count($this->_data->items); $i < $n; $i++) {
         $item =& $this->_data->items[$i];
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         // Ignore content plugins on links.
         if ($i < $numLeading + $numIntro) {
             $item->introtext = JHtml::_('content.prepare', $item->introtext);
         }
     }
     // For blog layouts, preprocess the breakdown of leading, intro and linked articles.
     // This makes it much easier for the designer to just interrogate the arrays.
     if ($this->_data->params->get('layout_type') == 'blog' || @$pk['layout'] == 'blog') {
         $max = count($this->_data->items);
         // The first group is the leading articles.
         $limit = $numLeading;
         for ($i = 0; $i < $limit && $i < $max; $i++) {
             $this->_data->lead_items[$i] =& $this->_data->items[$i];
             // Add router helpers.
             $item =& $this->_data->lead_items[$i];
             $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
             $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
             $item->parent_slug = $item->category_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         }
         // The second group is the intro articles.
         $limit = $numLeading + $numIntro;
         // Order articles across, then down (or single column mode)
         for ($i = $numLeading; $i < $limit && $i < $max; $i++) {
             $this->_data->intro_items[$i] =& $this->_data->items[$i];
             // Add router helpers.
             $item =& $this->_data->intro_items[$i];
             $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
             $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
             $item->parent_slug = $item->category_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         }
         $this->_data->columns = max(1, $this->_data->params->def('num_columns', 1));
         $order = $this->_data->params->def('multi_column_order', 1);
         if ($order == 0 && $this->_data->columns > 1) {
             // call order down helper
             $this->_data->intro_items = ContentHelperQuery::orderDownColumns($this->_data->intro_items, $this->_data->columns);
         }
         $limit = $numLeading + $numIntro + $numLinks;
         // The remainder are the links.
         for ($i = $numLeading + $numIntro; $i < $limit && $i < $max; $i++) {
             $this->_data->link_items[$i] =& $this->_data->items[$i];
         }
     }
     // Order subcategories
     if (sizeof($this->_data->children)) {
         if ($this->_data->params->get('orderby_pri') == 'alpha' || $this->_data->params->get('orderby_pri') == 'ralpha') {
             jimport('joomla.utilities.arrayhelper');
//.........这里部分代码省略.........
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:101,代码来源:category.php


示例11: display


//.........这里部分代码省略.........
     }
     JRequest::setVar('limit', (int) $limit);
     $contentConfig = JComponentHelper::getParams('com_content');
     $params->def('show_page_title', $contentConfig->get('show_title'));
     $menu_params = new JParameter($menu->params);
     if (!$menu_params->get('page_title')) {
         $params->set('page_title', $article->title ? $article->title : $menu->title);
     }
     $document->setTitle($params->get('page_title'));
     if ($article->metadesc) {
         $document->setDescription($article->metadesc);
     }
     if ($article->metakey) {
         $document->setMetadata('keywords', $article->metakey);
     }
     // Get some data from the model
     $items = $this->get('Data');
     if ($items) {
         $total = $this->get('Total');
         // only do count if there are items to count
     } else {
         $total = 0;
     }
     //add alternate feed link
     if ($params->get('show_feed_link', 1) == 1) {
         $link = '&format=feed&limitstart=';
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
         $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
         $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     }
     // Create a user access object for the user
     $access = new stdClass();
     $access->canEdit = $user->authorize('core.edit', 'com_content');
     $access->canEditOwn = $user->authorize('core.edit.own', 'com_content');
     $access->canPublish = $user->authorize('core.edit.state', 'com_content');
     jimport('joomla.html.pagination');
     //In case we are in a blog view set the limit
     if ($layout == 'blog') {
         $pagination = new JPagination($total, $limitstart, $limit - $numLinks);
     } else {
         $pagination = new JPagination($total, $limitstart, $limit);
     }
     // Compute the article slugs and prepare introtext (runs content plugins).
     foreach ($items as $i => &$item) {
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         $item->event = new stdClass();
         $dispatcher = JDispatcher::getInstance();
         // Ignore content plugins on links.
         if ($i < $numLeading + $numIntro) {
             $item->introtext = JHtml::_('content.prepare', $item->introtext);
             $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$item->params, 0));
             $item->event->afterDisplayTitle = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$item->params, 0));
             $item->event->beforeDisplayContent = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$item->params, 0));
             $item->event->afterDisplayContent = trim(implode("\n", $results));
         }
     }
     // Preprocess the breakdown of leading, intro and linked articles.
     // This makes it much easier for the designer to just interogate the arrays.
     $max = count($items);
     // The first group is the leading articles.
     $limit = $numLeading;
     for ($i = 0; $i < $limit && $i < $max; $i++) {
         $this->lead_items[$i] =& $items[$i];
     }
     // The second group is the intro articles.
     $limit = $numLeading + $numIntro;
     // Order articles across, then down (or single column mode)
     for ($i = $numLeading; $i < $limit && $i < $max; $i++) {
         $this->intro_items[$i] =& $items[$i];
     }
     $this->columns = max(1, $params->def('num_columns', 1));
     $order = $params->def('multi_column_order', 1);
     if ($order == 0 && $this->columns > 1) {
         // call order down helper
         $this->intro_items = ContentHelperQuery::orderDownColumns($this->intro_items, $this->columns);
     }
     // The remainder are the links.
     for ($i = $numLeading + $numIntro; $i < $max; $i++) {
         $this->link_items[$i] =& $items[$i];
     }
     $this->assignRef('article', $article);
     $this->assignRef('params', $params);
     $this->assignRef('user', $user);
     $this->assignRef('access', $access);
     $this->assignRef('items', $items);
     $this->assign('total', $total);
     $this->assign('action', $uri->toString());
     $this->assignRef('pagination', $pagination);
     $this->assignRef('state', $state);
     parent::display($tpl);
 }
开发者ID:xenten,项目名称:swift-kanban,代码行数:101,代码来源:view.html.php


示例12: _buildQuery

 function _buildQuery($state = 1)
 {
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $user = JFactory::getUser();
     $userGroups = implode(',', $user->getAuthorisedViewLevels());
     // If voting is turned on, get voting data as well for the content items
     $voting = ContentHelperQuery::buildVotingQuery($params);
     $metakey = trim($this->_article->metakey);
     $thisAlias = trim($this->_article->created_by_alias);
     $thisAuthor = $this->_article->created_by;
     $matchAuthor = trim($params->get('matchAuthor', 0));
     $matchAuthorAlias = trim($params->get('matchAuthorAlias', 0));
     $noauth = !$params->get('show_noauth');
     $anyOrAll = $params->get('anyOrAll', 'any');
     $publishedState = $params->get('fjArticleState', 1);
     if ($metakey || $matchAuthor || $matchAuthorAlias && $thisAlias) {
         $db = $this->getDBO();
         $user = JFactory::getUser();
         $date = JFactory::getDate();
         $now = $date->toMySQL();
         $nullDate = $db->getNullDate();
         // explode the meta keys on a comma
         $keys = explode(',', $metakey);
         $likes = array();
         // assemble any non-blank word(s)
         foreach ($keys as $key) {
             $key = trim($key);
             if ($key) {
                 // surround with commas so first and last items have surrounding commas
                 $likes[] = ',' . $this->_db->getEscaped($key) . ',';
             }
         }
         $ordering = $params->get('ordering', 'alpha');
         $sqlSort = $this->_buildContentOrderBy($ordering);
         // set connector to OR or AND based on parameter
         $sqlConnector = $anyOrAll == 'any' ? ' OR ' : ' AND ';
         if ($likes && $anyOrAll != 'exact') {
             $keywordSelection = ' CONCAT(",", REPLACE(a.metakey,", ",","),",") LIKE "%' . implode('%"' . $sqlConnector . 'CONCAT(",", REPLACE(a.metakey,", ",","),",") LIKE "%', $likes) . '%"';
         } else {
             if ($likes && $anyOrAll == 'exact') {
                 $keywordSelection = ' UPPER(a.metakey) = "' . strtoupper($metakey) . '" ';
             } else {
                 // in this case we are only going to match on author or alias, so we put a harmless false selection here
                 $keywordSelection = ' 1 = 2 ';
                 // just as a placeholder (so our AND's and OR's still work)
             }
         }
         // get published state select
         if (is_array($publishedState)) {
             $publishedStateCondition = implode(',', $publishedState);
         } else {
             $publishedStateCondition = $publishedState;
         }
         // get category selections
         // process either as comma-delimited list or as array (for backward compatibility)
         $catid = is_array($params->get('catid')) ? implode(',', $params->get('catid')) : trim($params->get('catid'));
         $catCondition = '';
         if ($catid || $catid == '0') {
             $ids = str_replace('C', $this->_article->catid, strtoupper($catid));
             $ids = explode(',', $ids);
             JArrayHelper::toInteger($ids);
             $catCondition = ' AND a.catid IN (' . implode(',', $ids) . ')';
         }
         if ($matchAuthor) {
             $matchAuthorCondition = $sqlConnector . 'a.created_by = ' . $db->Quote($thisAuthor) . ' ';
         }
         if ($matchAuthorAlias && $thisAlias) {
             $matchAuthorAliasCondition = $sqlConnector . 'UPPER(a.created_by_alias) = ' . $db->Quote(strtoupper($thisAlias)) . ' ';
         } else {
             $matchAuthorAliasCondition = ' ';
         }
         if ($noauth) {
             $noauthCondition = ' AND a.access IN (' . $userGroups . ')' . ' AND cc.access IN (' . $userGroups . ')' . ' AND cc.published = 1 ';
         }
         if ($params->get('filter_type') != 'none') {
             $filterWhere = $this->_getFilterWhere($params->get('filter_type'));
         } else {
             $filterWhere = '';
         }
         // select other items based on the metakey field 'like' the keys found
         $query = 'SELECT a.id, a.title, a.alias, a.introtext, a.fulltext, DATE_FORMAT(a.created, "%Y-%m-%d") AS created, a.state, a.catid, a.hits,' . ' a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' . ' a.checked_out, a.checked_out_time, a.publish_up, a.publish_down, a.attribs, a.hits, a.images, a.urls, a.ordering, a.metakey, a.metadesc, a.access,' . ' cc.access AS cat_access, cc.published AS cat_state, ' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,' . ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug,' . ' CHAR_LENGTH( a.`fulltext` ) AS readmore, u.name AS author ' . $voting['select'] . ', ' . ' a.metakey, "0" as match_count, "" as match_list, "" as main_article_keywords, ' . ' cc.title as category, "article" as link_type, cc.alias as category_alias, parent.id as parent_id, parent.alias as parent_alias' . ' FROM #__content AS a' . ' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' . ' LEFT JOIN #__categories AS cc ON cc.id = a.catid' . ' LEFT JOIN #__users AS u ON u.id = a.created_by' . ' LEFT JOIN #__categories AS parent on parent.id = cc.parent_id' . $voting['join'] . ' WHERE a.id != ' . (int) $this->_id . ' AND a.state IN (' . $publishedStateCondition . ') ' . ($noauth ? $noauthCondition : '') . ' AND ( ' . $keywordSelection . ($matchAuthor ? $matchAuthorCondition : '') . ($matchAuthorAlias ? $matchAuthorAliasCondition : '') . ' )' . ' AND ( a.publish_up = ' . $db->Quote($nullDate) . ' OR a.publish_up <= ' . $db->Quote($now) . ' )' . ' AND ( a.publish_down = ' . $db->Quote($nullDate) . ' OR a.publish_down >= ' . $db->Quote($now) . ' ) ' . ($catCondition ? $catCondition : '') . $filterWhere . $sqlSort;
         // sort the query
     } else {
         $query = '';
     }
     return $query;
 }
开发者ID:xenten,项目名称:swift-kanban,代码行数:88,代码来源:fjrelated.php


示例13: _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;
 }
开发者ID:androidealp,项目名称:droide-ajaxscroll,代码行数:28,代码来源:helper.php


示例14: 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;
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:30,代码来源:featured.php


示例15: getData

 /**
  * Get featured items
  * 
  */
 public function getData($pk)
 {
     JSNFactory::localimport('libraries.joomlashine.config');
     $params = JSNConfig::getMenuParams($pk['Itemid']);
     JSNConfig::megreGlobalParams('com_content', $params);
     $this->setState('params', $params);
     $data = new stdClass();
     $data->params = $params;
     $activeAllParams = new JRegistry();
     if ($params instanceof JRegistry) {
         foreach ($params->toArray() as $key => $val) {
             if (strpos($key, 'show_') !== false && (int) $params->get($key) == 0) {
                 $activeAllParams->set($key, 1);
             } else {
                 $activeAllParams->set($key, $val);
             }
         }
     }
     $limit = (int) $params->def('num_leading_articles', 1) + (int) $params->get('num_intro_articles', 4) + (int) $params->def('num_links', 4);
     $this->setState('params', $activeAllParams);
     $this->setState('filter.published', 1);
     $this->setState('filter.access', '');
     $this->setState('list.start', 0);
     $this->setState('list.limit', $limit);
     $this->setState('list.direction', '');
     $this->setState('list.filter', '');
     // filter.subcategories indicates whether to include articles from subcategories in the list or blog
     $this->setState('list.links', $activeAllParams->get('num_links'));
     if ($activeAllParams->get('featured_categories') && implode(',', $activeAllParams->get('featured_categories')) == true) {
         $this->setState('filter.frontpage.categories', $activeAllParams->get('featured_categories'));
     }
     $this->setState('filter.frontpage', 1);
     $items = parent::getItems();
     // PREPARE THE DATA
     // Get the metrics for the structural page layout.
     $numLeading = $params->def('num_leading_articles', 1);
     $numIntro = $params->def('num_intro_articles', 4);
     $numLinks = $params->def('num_links', 4);
     // Compute the article slugs and prepare introtext (runs content plugins).
     foreach ($items as $i => &$item) {
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         // Ignore content plugins on links.
         if ($i < $numLeading + $numIntro) {
             $item->introtext = JHtml::_('content.prepare', $item->introtext);
         }
     }
     // Preprocess the breakdown of leading, intro and linked articles.
     // This makes it much easier for the designer to just interogate the arrays.
     $max = count($items);
     // The first group is the leading articles.
     $limit = $numLeading;
     for ($i = 0; $i < $limit && $i < $max; $i++) {
         $data->lead_items[$i] =& $items[$i];
     }
     // The second group is the intro articles.
     $limit = $numLeading + $numIntro;
     // Order articles across, then down (or single column mode)
     for ($i = $numLeading; $i < $limit && $i < $max; $i++) {
         $data->intro_items[$i] =& $items[$i];
     }
     $data->columns = max(1, $params->def('num_columns', 1));
     $order = $params->def('multi_column_order', 1);
     if ($order == 0 && $data->columns > 1) {
         // call order down helper
         $data->intro_items = ContentHelperQuery::orderDownColumns($data->intro_items, $data->columns);
     }
     // The remainder are the links.
     for ($i = $numLeading + $numIntro; $i < $max; $i++)  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ContentHelperRoute类代码示例发布时间:2022-05-23
下一篇:
PHP ContentHelper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap