当前位置: 首页>>代码示例>>PHP>>正文


PHP ContentHelperQuery::orderDownColumns方法代码示例

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


在下文中一共展示了ContentHelperQuery::orderDownColumns方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

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

示例2: display

 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     parent::commonCategoryDisplay();
     // Prepare the data
     // Get the metrics for the structural page layout.
     $params = $this->params;
     $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 ($this->items as $item) {
         $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();
         // Old plugins: Ensure that text property is available
         if (!isset($item->text)) {
             $item->text = $item->introtext;
         }
         JPluginHelper::importPlugin('content');
         $dispatcher->trigger('onContentPrepare', array('com_content.category', &$item, &$item->params, 0));
         // Old plugins: Use processed text as introtext
         $item->introtext = $item->text;
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.category', &$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
     $app = JFactory::getApplication();
     $active = $app->getMenu()->getActive();
     $menus = $app->getMenu();
     $pathway = $app->getPathway();
     $title = null;
     if (!$active || (strpos($active->link, 'view=category') === false || strpos($active->link, '&id=' . (string) $this->category->id) === false)) {
         // Get the layout from the merged category params
         if ($layout = $this->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') {
         foreach ($this->items as $i => $item) {
             if ($i < $numLeading) {
                 $this->lead_items[] = $item;
             } elseif ($i >= $numLeading && $i < $numLeading + $numIntro) {
                 $this->intro_items[] = $item;
             } elseif ($i < $numLeading + $numIntro + $numLinks) {
                 $this->link_items[] = $item;
             } else {
                 continue;
             }
         }
         $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);
         }
     }
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     }
     $title = $this->params->get('page_title', '');
     $id = (int) @$menu->query['id'];
     // Check for empty title and add site name if param is set
     if (empty($title)) {
         $title = $app->get('sitename');
     } elseif ($app->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
     } elseif ($app->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
     }
     if (empty($title)) {
         $title = $this->category->title;
     }
     $this->document->setTitle($title);
     if ($this->category->metadesc) {
//.........这里部分代码省略.........
开发者ID:educakanchay,项目名称:kanchay,代码行数:101,代码来源:view.html.php

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

示例4: display

 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     parent::commonCategoryDisplay();
     // Prepare the data
     // Get the metrics for the structural page layout.
     $params = $this->params;
     $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 ($this->items as $item) {
         $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();
         // Old plugins: Ensure that text property is available
         if (!isset($item->text)) {
             $item->text = $item->introtext;
         }
         JPluginHelper::importPlugin('content');
         $dispatcher->trigger('onContentPrepare', array('com_content.category', &$item, &$item->params, 0));
         // Old plugins: Use processed text as introtext
         $item->introtext = $item->text;
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.category', &$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
     $app = JFactory::getApplication();
     $active = $app->getMenu()->getActive();
     if (!$active || (strpos($active->link, 'view=category') === false || strpos($active->link, '&id=' . (string) $this->category->id) === false)) {
         // Get the layout from the merged category params
         if ($layout = $this->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($this->items);
         foreach ($this->items as $i => $item) {
             if ($i < $numLeading) {
                 $this->lead_items[] = $item;
             } elseif ($i >= $numLeading && $i < $numLeading + $numIntro) {
                 $this->intro_items[] = $item;
             } elseif ($i < $numLeading + $numIntro + $numLinks) {
                 $this->link_items[] = $item;
             } else {
                 continue;
             }
         }
         $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);
         }
     }
     return parent::display($tpl);
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:79,代码来源:view.html.php

示例5: 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++) {
         $data->link_items[$i] =& $items[$i];
     }
     $data->pagination = $this->getPagination();
     //Escape strings for HTML output
     $data->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     return $data;
 }
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:85,代码来源:featured.php

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

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

示例8: onAfterDispatch


//.........这里部分代码省略.........
         $model->setState('filter.category_id', JRequest::getVar('id', $cont_params->get('featured_categories')));
     }
     $model->setState('list.start', 0);
     $model->setState('list.limit', 0);
     $model->setState('filter.published', 1);
     $access = !$cont_params->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.access', $access);
     $model->setState('filter.language', $app->getLanguageFilter());
     if ($this->_view == 'view_featured') {
         $articleOrderby = $cont_params->get('orderby_sec', 'rdate');
         $articleOrderDate = $cont_params->get('order_date');
         $categoryOrderby = $cont_params->def('orderby_pri', '');
         $secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
         $primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
         $orderby = $primary . ' ' . $secondary . ' a.created DESC ';
         $model->setState('filter.frontpage', true);
         $model->setState('list.ordering', $orderby);
         $model->setState('list.direction', '');
         $model->setState('filter.featured', 'only');
     } elseif ($this->_view == 'view_category') {
         $model->setState('list.ordering', $this->_buildContentOrderBy());
     }
     $numberitems = $model->getItems();
     $this->_total = count($numberitems);
     $this->_start = $limit;
     $this->_limit = $this->_limit > 0 ? $this->_limit : $limit;
     $this->tag_id = $view == 'category' ? '.blog' : '.blog-featured';
     if ($this->isAjax()) {
         $com_content_ajax = (int) JRequest::getVar('com_content_ajax', 0);
         $content_listing_ajax_com = JRequest::getVar('content_listing_ajax_com');
         $content_listing_ajax_view = JRequest::getVar('content_listing_ajax_view');
         $content_listing_ajax_layout = JRequest::getVar('content_listing_ajax_layout');
         if ($com_content_ajax == 1 && $content_listing_ajax_com == 'com_content' && ($content_listing_ajax_view == 'category' && $content_listing_ajax_layout == 'blog' || $content_listing_ajax_view == 'featured' && $content_listing_ajax_layout == 'featured')) {
             $task = JRequest::getCmd('task');
             $view = JRequest::getCmd('view');
             $result = new stdClass();
             $model->setState('filter.category_id', JRequest::getVar('id'));
             $model->setState('list.start', $app->input->getInt('limitstart', 0));
             $model->setState('list.limit', $this->_limit);
             $lead_items = array();
             $intro_items = array();
             $link_items = array();
             $items = $model->getItems();
             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 = JDispatcher::getInstance();
                 // Old plugins: Ensure that text property is available
                 if (!isset($item->text)) {
                     $item->text = $item->introtext;
                 }
                 JPluginHelper::importPlugin('content');
                 $results = $dispatcher->trigger('onContentPrepare', array('com_content.category', &$item, &$this->params, 0));
                 // Old plugins: Use processed text as introtext
                 $item->introtext = $item->text;
                 $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.category', &$item, &$item->params, 0));
                 $item->event->afterDisplayTitle = trim(implode("\n", $results));
                 $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.category', &$item, &$item->params, 0));
                 $item->event->beforeDisplayContent = trim(implode("\n", $results));
                 $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.category', &$item, &$item->params, 0));
                 $item->event->afterDisplayContent = trim(implode("\n", $results));
             }
             if ($cont_params->get('layout_type') == 'blog' || $app->input->get('layout') == 'blog' || $content_listing_ajax_view == 'featured' && $content_listing_ajax_layout == 'featured') {
                 $max = count($items);
                 //$numLeading = ($numIntro + $numLinks <= 0 || $numLeading <= 0  )?$this->_limit:$numLeading;
                 $limit = $numLeading;
                 for ($i = 0; $i < $limit && $i < $max; $i++) {
                     $lead_items[$i] =& $items[$i];
                 }
                 $limit = $numLeading + $numIntro;
                 for ($i = $numLeading; $i < $limit && $i < $max; $i++) {
                     $intro_items[$i] =& $items[$i];
                 }
                 $this->columns = max(1, $cont_params->get('num_columns', 1));
                 $order = $cont_params->get('multi_column_order', 1);
                 if ($order == 0 && $this->columns > 1) {
                     $intro_items = ContentHelperQuery::orderDownColumns($intro_items, $this->columns);
                 }
                 for ($i = $numLeading + $numIntro; $i < $max; $i++) {
                     $link_items[$i] =& $items[$i];
                 }
             }
             ob_start();
             if (!empty($lead_items) || !empty($intro_items) || !empty($link_items)) {
                 $buffer0 = $this->getViewHtml($lead_items, $intro_items, $link_items, $cont_params);
                 $result->items_markup = preg_replace(array('/ {2,}/', '/<!--.*?-->|\\t|(?:\\r?\\n[ \\t]*)+/s'), array(' ', ''), $buffer0);
             }
             ob_end_clean();
             die(json_encode($result));
         }
     }
 }
开发者ID:educacionbe,项目名称:stabwall,代码行数:101,代码来源:plg_sj_content_listing_ajax.php


注:本文中的ContentHelperQuery::orderDownColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。