Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/uikit/controller/state.php
<?php

class AnUikitControllerState extends KMixinAbstract
{
	/**
	 * 
	 * @return 
	 * @param $options Object
	 */
	public function __construct($options)
	{
		parent::__construct($options);
		
		$this->_mixer->registerFunctionBefore(array('browse','read') , 'loadState');
		
		$this->_mixer->registerFunctionAfter(array('browse','read') ,  'saveState');
	}
	
	/**
	 * 
	 * @return 
	 */
	public function loadState()
	{
		$identifier  = $this->_mixer->getIdentifier();
		
		$identifier .= '.'.$this->_mixer->getAction();
		
		$state   = KRequest::get('session.'.$identifier, 'raw', array());
		
		$request = KRequest::get('request', 'string');
					
		$request = KHelperArray::merge($state, $request);
		
		KRequest::set('request',  $request);
		
		$state   = KFactory::tmp('lib.koowa.model.state');

		foreach($request as $key => $value) {
			$state->insert($key, null, $value);
		}

		$this->view()->assign('state', $state);
		

	}
	
	/**
	 * 
	 * @return 
	 */
	public function saveState()
	{
		$identifier  = $this->_mixer->getIdentifier();
		
		$identifier .= '.'.$this->_mixer->getAction();
				
		$request = KRequest::get('request', 'string');

		KRequest::set('session.'.$identifier, $request);
	}	
}
Return current item: Anahita Social Engine