示例#1
0
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $pk = $app->input->getInt('id', 0);
     $this->setState('tag.id', $pk);
     $params = JUDirectoryHelper::getParams();
     $this->setState('params', $params);
     if ($this->context) {
         $listingPagination = $params->get('listing_pagination', 10);
         $limitArray = JUDirectoryFrontHelper::customLimitBox();
         if (is_array($limitArray) && count($limitArray)) {
             $limit = $app->input->getUint('limit', null);
             if (is_null($limit) || in_array($limit, $limitArray)) {
                 $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $listingPagination, 'uint');
             } else {
                 $limit = $listingPagination;
             }
         } else {
             $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $listingPagination, 'uint');
         }
         $this->setState('list.limit', $limit);
         $this->setState('list.start', $app->input->getUint('limitstart', 0));
         $orderCol = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', '');
         $this->setState('list.ordering', $orderCol);
         $listOrder = $app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', 'ASC');
         $this->setState('list.direction', $listOrder);
     } else {
         $this->setState('list.start', 0);
         $this->state->set('list.limit', 0);
     }
 }
示例#2
0
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $params = JUDirectoryHelper::getParams();
     if ($layout = $app->input->get('layout')) {
         $this->context .= '.' . $layout;
     }
     if ($this->context) {
         $listingPagination = $params->get('listing_pagination', 10);
         $limitArray = JUDirectoryFrontHelper::customLimitBox();
         if (is_array($limitArray) && count($limitArray)) {
             $limit = $app->input->getInt('limit', 0);
             if (in_array($limit, $limitArray)) {
                 $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $listingPagination, 'uint');
             } else {
                 $limit = $listingPagination;
             }
         } else {
             $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $listingPagination, 'uint');
         }
         $this->setState('list.limit', $limit);
         $this->setState('list.start', $app->input->getUint('limitstart', 0));
         $orderCol = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', '');
         $this->setState('list.ordering', $orderCol);
         $listOrder = $app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', 'ASC');
         $this->setState('list.direction', $listOrder);
         $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
         $this->setState('filter.search', $search);
         $category = $this->getUserStateFromRequest($this->context . '.filter.category', 'filter_catid');
         $this->setState('filter.catid', $category);
         $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access');
         $this->setState('filter.access', $access);
         $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published');
         $this->setState('filter.published', $published);
         $featured = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured');
         $this->setState('filter.featured', $featured);
     } else {
         $this->setState('list.start', 0);
         $this->state->set('list.limit', 0);
     }
 }
 public function getLimitBox()
 {
     $app = JFactory::getApplication();
     $limits = array();
     $limitArray = JUDirectoryFrontHelper::customLimitBox();
     $keyAllLimit = array_search(0, $limitArray);
     if ($keyAllLimit) {
         $limitAll = true;
         unset($limitArray[$keyAllLimit]);
     } else {
         $limitAll = false;
     }
     $limitArray = array_values($limitArray);
     sort($limitArray);
     if (empty($limitArray)) {
         return parent::getLimitBox();
     }
     foreach ($limitArray as $limitValue) {
         $limits[] = JHtml::_('select.option', "{$limitValue}");
     }
     if ($limitAll) {
         $limits[] = JHtml::_('select.option', '0', JText::_('JALL'));
     }
     $jversion_arr = explode(".", JVERSION);
     $priVersion = $jversion_arr[0];
     if ($priVersion == 2) {
         $selected = $this->_viewall ? 0 : $this->limit;
     } elseif ($priVersion == 3) {
         $selected = $this->viewall ? 0 : $this->limit;
     }
     if ($app->isAdmin()) {
         $html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="Joomla.submitform();"', 'value', 'text', $selected);
     } else {
         $html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected);
     }
     return $html;
 }
示例#4
0
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $listingId = $app->input->getInt('id', 0);
     $this->setState('listing.id', $listingId);
     if ($this->context) {
         $app = JFactory::getApplication();
         $params = JUDirectoryHelper::getParams(null, $listingId);
         $this->setState('params', $params);
         $this->setState('list.start', $app->input->getUInt('limitstart', 0));
         $commentPagination = $params->get('comment_pagination', 10);
         if ($params->get('show_comment_pagination', 0)) {
             $limitArray = JUDirectoryFrontHelper::customLimitBox();
             if (is_array($limitArray) && count($limitArray)) {
                 $limit = $app->input->getUint('limit', null);
                 if (is_null($limit) || in_array($limit, $limitArray)) {
                     $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $commentPagination, 'uint');
                 } else {
                     $limit = $commentPagination;
                 }
             } else {
                 $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $commentPagination, 'uint');
             }
             $this->setState('list.limit', $limit);
         } else {
             $limit = $commentPagination;
             $this->setState('list.limit', $limit);
         }
         if ($params->get('show_comment_direction', 1)) {
             $defaultOrdering = $params->get('comment_ordering', 'cm.created');
             $orderCol = $app->getUserStateFromRequest($this->context . '.list.filter_order', 'filter_order', $defaultOrdering, 'string');
             $commentOrdering = $this->getCommentOrderingOptions();
             $commentOrdering = array_keys($commentOrdering);
             if (!in_array($orderCol, $commentOrdering)) {
                 $orderCol = 'cm.created';
             }
             $this->setState('list.ordering', $orderCol);
             $defaultDirection = $params->get('comment_direction', 'DESC');
             $orderDirection = $app->getUserStateFromRequest($this->context . '.list.filter_order_Dir', 'filter_order_Dir', $defaultDirection, 'cmd');
             if (!in_array(strtoupper($orderDirection), array('ASC', 'DESC', ''))) {
                 $orderDirection = 'DESC';
             }
             $this->setState('list.direction', $orderDirection);
         }
         if ($params->get('filter_comment_language', 0)) {
             $filterLang = $app->getUserStateFromRequest($this->context . '.list.filter_lang', 'filter_lang', '*', 'string');
             $this->setState('list.lang', $filterLang);
         }
         if ($params->get('filter_comment_rating', 1)) {
             $starFilter = $app->getUserStateFromRequest($this->context . '.list.star_filter', 'star_filter', '');
             $resetFilter = $app->input->getInt('resetfilter', 0);
             if ($resetFilter == 1) {
                 $this->setState('list.star_filter', '');
             } else {
                 $this->setState('list.star_filter', $starFilter);
             }
         }
     } else {
         $this->setState('list.start', 0);
         $this->state->set('list.limit', 0);
     }
 }