/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * @since 1.6 */ protected function populateState($ordering = 'ordering', $direction = 'ASC') { $app = JFactory::getApplication(); // List state information $value = Request::getUInt('limit', Config::get('list_limit', 0)); $this->setState('list.limit', $value); $value = Request::getUInt('limitstart', 0); $this->setState('list.start', $value); $orderCol = Request::getCmd('filter_order', 'a.ordering'); if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'a.ordering'; } $this->setState('list.ordering', $orderCol); $listOrder = Request::getCmd('filter_order_Dir', 'ASC'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $params = $app->getParams(); $this->setState('params', $params); 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); } $this->setState('filter.language', App::get('language.filter')); // process show_noauth parameter if (!$params->get('show_noauth')) { $this->setState('filter.access', true); } else { $this->setState('filter.access', false); } $this->setState('layout', Request::getCmd('layout')); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * @since 1.6 */ protected function populateState() { $app = JFactory::getApplication('site'); // Load state from the request. $pk = Request::getInt('id'); $this->setState('newsfeed.id', $pk); $offset = Request::getUInt('limitstart', 0); $this->setState('list.offset', $offset); // Load the parameters. $params = $app->getParams(); $this->setState('params', $params); if (!User::authorise('core.edit.state', 'com_newsfeeds') && !User::authorise('core.edit', 'com_newsfeeds')) { $this->setState('filter.published', 1); $this->setState('filter.archived', 2); } }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState() { $app = JFactory::getApplication('site'); // Load state from the request. $pk = Request::getInt('id'); $this->setState('article.id', $pk); $offset = Request::getUInt('limitstart'); $this->setState('list.offset', $offset); // Load the parameters. $params = $app->getParams(); $this->setState('params', $params); // TODO: Tune these values based on other permissions. if (!User::authorise('core.edit.state', 'com_content') && !User::authorise('core.edit', 'com_content')) { $this->setState('filter.published', 1); $this->setState('filter.archived', 2); } $this->setState('filter.language', JLanguageMultilang::isEnabled()); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { parent::populateState($ordering, $direction); // List state information $limitstart = Request::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); } }
/** * @return void * @return 1.6 */ protected function _createTOC(&$row, &$matches, &$page) { $heading = isset($row->title) ? $row->title : Lang::txt('PLG_CONTENT_PAGEBREAK_NO_TITLE'); $limitstart = Request::getUInt('limitstart', 0); $showall = Request::getInt('showall', 0); // TOC header. $row->toc = '<div id="article-index">'; if ($this->params->get('article_index') == 1) { $headingtext = Lang::txt('PLG_CONTENT_PAGEBREAK_ARTICLE_INDEX'); if ($this->params->get('article_index_text')) { htmlspecialchars($headingtext = $this->params->get('article_index_text')); } $row->toc .= '<h3>' . $headingtext . '</h3>'; } // TOC first Page link. $class = $limitstart === 0 && $showall === 0 ? 'toclink active' : 'toclink'; $row->toc .= '<ul> <li> <a href="' . Route::url(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=&limitstart=') . '" class="' . $class . '">' . $heading . '</a> </li> '; $i = 2; foreach ($matches as $bot) { $link = Route::url(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=&limitstart=' . ($i - 1)); if (@$bot[0]) { $attrs2 = JUtility::parseAttributes($bot[0]); if (@$attrs2['alt']) { $title = stripslashes($attrs2['alt']); } elseif (@$attrs2['title']) { $title = stripslashes($attrs2['title']); } else { $title = Lang::txt('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i); } } else { $title = Lang::txt('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i); } $class = $limitstart == $i - 1 ? 'toclink active' : 'toclink'; $row->toc .= ' <li> <a href="' . $link . '" class="' . $class . '">' . $title . '</a> </li> '; $i++; } if ($this->params->get('showall')) { $link = Route::url(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=1&limitstart='); $class = $showall == 1 ? 'toclink active' : 'toclink'; $row->toc .= ' <li> <a href="' . $link . '" class="' . $class . '">' . Lang::txt('PLG_CONTENT_PAGEBREAK_ALL_PAGES') . '</a> </li> '; } $row->toc .= '</ul></div>'; }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * return void * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Initiliase variables. $app = JFactory::getApplication('site'); $pk = Request::getInt('id'); $this->setState('category.id', $pk); // Load the parameters. Merge Global and Menu Item params into new object $params = $app->getParams(); $menuParams = new \Hubzero\Config\Registry(); if ($menu = \App::get('menu')->getActive()) { $menuParams->parse($menu->params); } $mergedParams = clone $menuParams; $mergedParams->merge($params); $this->setState('params', $mergedParams); $user = User::getInstance(); // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); $groups = implode(',', $user->getAuthorisedViewLevels()); if (!$user->authorise('core.edit.state', 'com_content') && !$user->authorise('core.edit', 'com_content')) { // limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. $nullDate = $db->Quote($db->getNullDate()); $nowDate = $db->Quote(Date::toSQL()); $query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')'); $query->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } else { $this->setState('filter.published', array(0, 1, 2)); } // process show_noauth parameter if (!$params->get('show_noauth')) { $this->setState('filter.access', true); } else { $this->setState('filter.access', false); } // Optional filter text $this->setState('list.filter', Request::getString('filter-search')); // filter.order $itemid = Request::getInt('id', 0) . ':' . Request::getInt('Itemid', 0); $orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string'); if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'a.ordering'; } $this->setState('list.ordering', $orderCol); $listOrder = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $this->setState('list.start', Request::getUInt('limitstart', 0)); // set limit for query. If list, use parameter. If blog, add blog parameters for limit. if (Request::getCmd('layout') == 'blog' || $params->get('layout_type') == 'blog') { $limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links'); $this->setState('list.links', $params->get('num_links')); } else { $limit = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint'); } $this->setState('list.limit', $limit); // set the depth of the category query based on parameter $showSubcategories = $params->get('show_subcategory_content', '0'); if ($showSubcategories) { $this->setState('filter.max_category_levels', $params->get('show_subcategory_content', '1')); $this->setState('filter.subcategories', true); } $this->setState('filter.language', App::get('language.filter')); $this->setState('layout', Request::getCmd('layout')); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $params = Component::params('com_newsfeeds'); // List state information $limit = Request::getState('global.list.limit', 'limit', Config::get('list_limit'), 'uint'); $this->setState('list.limit', $limit); $limitstart = Request::getUInt('limitstart', 0); $this->setState('list.start', $limitstart); $orderCol = Request::getCmd('filter_order', 'ordering'); if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'ordering'; } $this->setState('list.ordering', $orderCol); $listOrder = Request::getCmd('filter_order_Dir', 'ASC'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $id = Request::getVar('id', 0, '', 'int'); $this->setState('category.id', $id); if (!User::authorise('core.edit.state', 'com_newsfeeds') && !User::authorise('core.edit', 'com_newsfeeds')) { // limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. $this->setState('filter.publish_date', true); } $this->setState('filter.language', \App::get('language.filter')); // Load the parameters. $this->setState('params', $params); }
/** * Method to get the archived article list * * @access public * @return array */ public function getData() { $app = JFactory::getApplication(); // Lets load the content if it doesn't already exist if (empty($this->_data)) { // Get the page/component configuration $params = $app->getParams(); // Get the pagination request variables $limit = Request::getUInt('limit', $params->get('display_num', 20)); $limitstart = Request::getUInt('limitstart', 0); $query = $this->_buildQuery(); $this->_data = $this->_getList($query, $limitstart, $limit); } return $this->_data; }