public function indexAction()
 {
     //action body
     $dba = Zend_Registry::get('dba');
     $emissions = new Application_Model_Emission($dba);
     $this->view->emissions = $emissions->fetchAll();
     $auth = Zend_Auth::getInstance();
     $log = $auth->getIdentity()->NOM_M . " " . $auth->getIdentity()->PRENOM;
     $this->view->log = $log;
 }
 public function indexAction()
 {
     $auth = Zend_Auth::getInstance();
     $log = $auth->getIdentity()->NOM_M . " " . $auth->getIdentity()->PRENOM;
     $this->view->log = $log;
     $dba = Zend_Registry::get('dba');
     $evenements = new Application_Model_Evenement($dba);
     $evenements_results = $evenements->fetchAll();
     $genre_table = new Application_Model_Genre($dba);
     $genres = $genre_table->fetchAll()->toArray();
     $genre_playlist = array();
     foreach ($genres as $genre) {
         $playlist_table = new Application_Model_Playlist($dba);
         $where = $dba->quoteInto("ID_GENRE = ?", $genre["ID_GENRE"]);
         $playlists_results = $playlist_table->fetchAll($where)->toArray();
         $playlists = array();
         foreach ($playlists_results as $playlist) {
             $playlists[] = array("PLAY_ID" => $playlist["PLAY_ID"], "NOM_PLAY" => $playlist["NOM_PLAY"]);
         }
         if (count($playlists) > 0) {
             $genre_playlist[] = array("ID_GENRE" => $genre["ID_GENRE"], "GENRE" => $genre["NOM_G"], "PLAYLISTS" => $playlists);
         }
     }
     $result = array();
     foreach ($evenements_results as $evenement) {
         $joue_table = new Application_Model_Joue($dba);
         $select = $joue_table->select()->where("EVENEMENT_ID = ?", $evenement->EVENEMENT_ID);
         $joue_results = $joue_table->fetchAll($select)->toArray();
         $color = "blue";
         if ($evenement->ID_EMISSION != NULL) {
             $color = "red";
         }
         if (count($joue_results) > 0) {
             $color = "orange";
         }
         $item = array("EVENEMENT_ID" => $evenement->EVENEMENT_ID, "D_H_DEBUT" => $evenement->D_H_DEBUT, "D_H_FIN" => $evenement->D_H_FIN, "NOM_EV" => $evenement->NOM_EV, "COLOR" => $color);
         $result[] = $item;
     }
     $emission_table = new Application_Model_Emission($dba);
     $select = $emission_table->select()->where("PATH_E IS NOT NULL");
     $this->view->podcast = $emission_table->fetchAll($select)->toArray();
     $this->view->genre_playlist = $genre_playlist;
     $this->view->evenements = $result;
 }