<?php

/**
 * IndexController - The default controller class
 * 
 * @author
 * @version 
 */

require_once 'Zend/Controller/Action.php';

class IndexController extends Zend_Controller_Action 
{
	
	public function init()
	{
		$this->view->topmenu = 1;
	}
	/**
	 * The default action - show the home page
	 */
    public function indexAction() 
    {
    	$ID = Zend_Registry::get('user')->id_user;
    	
    	$users = new Users();
    	$user = $users->getUser($ID);
    	
    	$weekStart = 1;
    	if ($user) $weekStart = $user->week_start;
    	
    	$calendar = new Calendar();
    	$this->view->calendar = $calendar->getCalendar(null, null, $weekStart);
    	
        $messages = new Messages();
        $this->view->messages = $messages->getMessages($ID, true, 10);
        
        /* confirm versions */
        $confVer = new VersionConfirm();
        $this->view->verconf = $confVer->fetchAll($confVer->getConfirmations($ID, false, 10));
        
        /* confirm revisions */
        $confRev = new RevisionConfirm();
        $this->view->revconf = $confRev->fetchAll($confRev->getConfirmations($ID, false, 10));
    }
}