english/libraries/joomla/application/component/modellist.php
/**
	 * Method to auto-populate the model state.
	 *
	 * This method should only be called once per instantiation and is designed
	 * to be called on the first call to the getState() method unless the model
	 * configuration flag to ignore the request is set.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @param   string  $ordering   An optional ordering field.
	 * @param   string  $direction  An optional direction (asc|desc).
	 *
	 * @return  void
	 *
	 * @since   11.1
	 */
Method to auto-populate the model state.
This method should only be called once per instantiation and is designed
to be called on the first call to the getState() method unless the model
configuration flag to ignore the request is set.

Note. Calling getState in this method will result in recursion.

@param   string  $ordering   An optional ordering field.
@param   string  $direction  An optional direction (asc|desc).

@return  void


Method to auto - populate the model state . This method should only be called once per instantiation and is designed to be called on the first call to the getState () method unless the model configuration flag to ignore the request is set . Note . Calling getState in this method will result in recursion . @param string $ordering An optional ordering field . @param string $direction An optional direction ( asc|desc ) . @return void
protected function populateState($ordering = null, $direction = null)
	{
		if ($this->context) {
			$app = JFactory::getApplication();
			$value = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'));
			$limit = $value;
			$this->setState('list.limit', $limit);
			$value = $app->getUserStateFromRequest($this->context.'.limitstart', 'limitstart', 0);
			$limitstart = ($limit != 0 ? (floor($value / $limit) * $limit) : 0);
			$this->setState('list.start', $limitstart);
			$value = $app->getUserStateFromRequest($this->context.'.ordercol', 'filter_order', $ordering);
			if (!in_array($value, $this->filter_fields)) {
				$value = $ordering;
				$app->setUserState($this->context.'.ordercol', $value);
			}
			$this->setState('list.ordering', $value);
			$value = $app->getUserStateFromRequest($this->context.'.orderdirn', 'filter_order_Dir', $direction);
			if (!in_array(strtoupper($value), array('ASC', 'DESC', ''))) {
				$value = $direction;
				$app->setUserState($this->context.'.orderdirn', $value);
			}
			$this->setState('list.direction', $value);
		}
		else {
			$this->setState('list.start', 0);
			$this->state->set('list.limit', 0);
		}
	}
protected function populateState ( $ ordering = null , $ direction = null ) { if ( $ this -> context ) { $ app = JFactory :: getApplication ( ) ; $ value = $ app -> getUserStateFromRequest ( 'global.list.limit' , 'limit' , $ app -> getCfg ( 'list_limit' ) ) ; $ limit = $ value ; $ this -> setState ( 'list.limit' , $ limit ) ; $ value = $ app -> getUserStateFromRequest ( $ this -> context . '.limitstart' , 'limitstart' , 0 ) ; $ limitstart = ( $ limit != 0 ? ( floor ( $ value / $ limit ) * $ limit ) : 0 ) ; $ this -> setState ( 'list.start' , $ limitstart ) ; $ value = $ app -> getUserStateFromRequest ( $ this -> context . '.ordercol' , 'filter_order' , $ ordering ) ; if ( ! in_array ( $ value , $ this -> filter_fields ) ) { $ value = $ ordering ; $ app -> setUserState ( $ this -> context . '.ordercol' , $ value ) ; } $ this -> setState ( 'list.ordering' , $ value ) ; $ value = $ app -> getUserStateFromRequest ( $ this -> context . '.orderdirn' , 'filter_order_Dir' , $ direction ) ; if ( ! in_array ( strtoupper ( $ value ) , array ( 'ASC' , 'DESC' , '' ) ) ) { $ value = $ direction ; $ app -> setUserState ( $ this -> context . '.orderdirn' , $ value ) ; } $ this -> setState ( 'list.direction' , $ value ) ; } else { $ this -> setState ( 'list.start' , 0 ) ; $ this -> state -> set ( 'list.limit' , 0 ) ; } }
Method to auto-populate the model state.
Method to auto - populate the model state .
// If the context is set, assume that stateful lists are used. // Check if the ordering field is in the white list, otherwise use the incoming value. // Check if the ordering direction is valid, otherwise use the incoming value.