示例#1
0
	protected function populateState($ordering = null, $direction = null)
	{
		
		$app = JFactory::getApplication();

		$rootCategory = JUDownloadFrontHelperCategory::getRootCategory();
		$categoryId   = $app->input->getInt('id', $rootCategory->id);

		$this->setState('category.id', $categoryId);

		$params = JUDownloadHelper::getParams($categoryId);
		$this->setState('params', $params);

		
		if ($this->context)
		{
			$documentPagination = $params->get('document_pagination', 10);

			$limitArray = JUDownloadFrontHelper::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', $documentPagination, 'uint');
				}
				else
				{
					$limit = $documentPagination;
				}
			}
			else
			{
				$limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $documentPagination, '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
	public function populateState($ordering = null, $direction = null)
	{
		
		$app = JFactory::getApplication();

		$params = JUDownloadHelper::getParams();
		$this->setState('params', $params);

		
		if ($this->context)
		{
			$commentPagination = $params->get('comment_pagination', 10);

			$limitArray = JUDownloadFrontHelper::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);

			$this->setState('list.start', $app->input->get('limitstart', 0, 'uint'));

			$commentOrdering = $params->get('comment_ordering', 'cm.created');
			$orderCol        = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', $commentOrdering);
			$this->setState('list.ordering', $orderCol);

			$commentDirection = $params->get('comment_direction', 'DESC');
			$listOrder        = $app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', $commentDirection);
			$this->setState('list.direction', $listOrder);
		}
		else
		{
			$this->setState('list.start', 0);
			$this->state->set('list.limit', 0);
		}
	}
示例#3
0
	protected function populateState($ordering = null, $direction = null)
	{
		
		$app = JFactory::getApplication();

		$params = JUDownloadHelper::getParams();
		$this->setState('params', $params);

		
		if ($this->context)
		{
			$limitArray = JUDownloadFrontHelper::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', $app->getCfg('list_limit'), 'uint');
				}
				else
				{
					$limit = $app->getCfg('list_limit');
				}
			}
			else
			{
				$limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $app->getCfg('list_limit'), 'uint');
			}

			$this->setState('list.limit', $limit);

			$this->setState('list.start', $app->input->get('limitstart', 0, 'uint'));

			$orderCol = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', 'tag.title');
			$this->setState('list.ordering', $orderCol);

			$listOrder = $app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', 'ASC');
			$this->setState('list.direction', $listOrder);
		}
	}
示例#4
0
	protected function populateState($ordering = null, $direction = null)
	{
		$app = JFactory::getApplication();
		
		$documentId = $app->input->getInt('id', 0);
		$this->setState('document.id', $documentId);
		
		if ($this->context)
		{
			
			$app = JFactory::getApplication();

			
			$params = JUDownloadHelper::getParams(null, $documentId);
			$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 = JUDownloadFrontHelper::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);
		}
	}
示例#5
0
	public function getLimitBox()
	{
		$app = JFactory::getApplication();

		
		$limits = array();

		$limitArray = JUDownloadFrontHelper::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;
	}
示例#6
0
	protected function populateState($ordering = null, $direction = null)
	{
		$app    = JFactory::getApplication();
		$params = JUDownloadHelper::getParams();

		
		if ($layout = $app->input->get('layout'))
		{
			$this->context .= '.' . $layout;
		}

		
		if ($this->context)
		{
			$documentPagination = $params->get('document_pagination', 10);

			$limitArray = JUDownloadFrontHelper::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', $documentPagination, 'uint');
				}
				else
				{
					$limit = $documentPagination;
				}
			}
			else
			{
				$limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $documentPagination, '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);

			$license = $this->getUserStateFromRequest($this->context . '.filter.license', 'filter_licenseid');
			$this->setState('filter.licenseid', $license);

			$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);
		}
	}