<?php


include APPLICATION_PATH . '/DAO/UtilisateurDAO.php';
include APPLICATION_PATH . '/DAO/RoleDAO.php';
include APPLICATION_PATH . '/DAO/LogDAO.php';
include APPLICATION_PATH . '/DAO/RoleAuthorisationDAO.php';
include APPLICATION_PATH . '/DAO/AuthorisationDAO.php';
include PUBLIC_PATH . '/Fonctions/Fonction.php';
//include PUBLIC_PATH . '/files_to_include/Constantes.php';

class AccueilController extends Zend_Controller_Action
{

    public function init()
    {
        session_start();
        if ( isset($_SESSION["codeUser"])){
            $_SESSION["derniereAction"] = new \DateTime();
        }else{
            $this->_helper->redirector('index' , 'Index');
        }
        
    }
   


    public function indexAction()
    {
//        $userDao = new UtilisateurDAO();
//        $connexion = $userDao->_em->getConnection();
//        $sql = "drop table if exists stocks; CREATE  TABLE IF NOT EXISTS stocks(PRIMARY KEY (id)) select st.id as id,st.consommable,et.entree-st.sortie as quantite
//
//from (SELECT c.id as id,c.libelle as consommable, sum(IFNULL(s.quantite,0)) as sortie  FROM consommable c 
//left join sortieconsommable s on c.id=s.consommable WHERE c.state= 1 group by c.id, c.libelle) st join (SELECT c.id as id,c.libelle as consommable, sum(IFNULL(e.quantite,0)) as entree  FROM consommable c 
//left join entreeconsommable e on c.id=e.consommable WHERE c.state= 1 group by c.id, c.libelle) et on st.id = et.id ";
//        $requete = $connexion->prepare($sql);
//        $requete->execute();
        
    }

  

}



