<?php

/**
 * DocumentsController - app core
 * 
 * @author Lukáš Havlíček
 * @version 1.0
 */

class HistoryController extends Zend_Controller_Action 
{ 	
	public function init()
	{
		$this->view->topmenu = 4;
	}
	/**
	 * The default action - show the home page
	 */
    public function indexAction() 
    {
    	$user = Zend_Registry::get('user');

    	
		$table = new History();
		$select = $table->getHistory($user->id_user, $user->super_admin);
		
		$page = (int) $this->_getParam('page');
    	if ($page < 1  || !$page) $page = 1;
    	
    	if (!$select)
    	{
    		$this->view->data = null;
    		return;
    	}
    	
    	$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($select));
    	$paginator->setCurrentPageNumber($page);
    	$paginator->setItemCountPerPage(15);
    	$paginator->setPageRange(10);
    	
    	$this->view->data = $paginator;
    	$this->view->page = $page;
    }
    
   
}
