コード例 #1
0
 /**
  * Fonction appelée lorsque l'on clique sur le lien export du menu
  * Récupère en session les agendas visualisables de l'utilisateur
  * récupère l'objet exportParams en session s'il existe, le créer sinon, puis stock en session
  * @since 2006/08/17
  * @author Audrey Vassal <*****@*****.**>
  * appelle les zones agendamenu et agendaexport
  */
 public function processGetPrepareExport()
 {
     CopixHTMLHeader::addCSSLink(_resource("styles/module_agenda.css"));
     CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.ui.datepicker-fr.js"));
     $serviceAuth = new AgendaAuth();
     $serviceAgenda = new AgendaService();
     //on vérifie les droits des utilisateurs sur la liste des agendas affichés
     $listAgendasAffiches = $serviceAgenda->getAgendaAffiches();
     foreach ((array) $listAgendasAffiches as $id_agenda) {
         //on vérifie si l'utilisateur a les droits d'écriture sur un des agendas affiché
         if ($serviceAuth->getCapability($id_agenda) >= $serviceAuth->getRead()) {
             $ableToRead = true;
         }
     }
     if (!$ableToRead) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.error.enableToWrite'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine')));
     }
     //on récupère en session la liste des agendas en cours de visualisation
     $arAgendasAffiches = $serviceAgenda->getAgendaAffiches();
     $arTitleAgendasAffiches = $serviceAgenda->getArTitleAgendaByArIdAgenda($arAgendasAffiches);
     if (!($exportParams = $this->_getSessionExport())) {
         //initialisation de l'objet exportParams avec le premier agenda affiché de la liste
         $exportParams->id_agenda = current($arAgendasAffiches);
         $this->_setSessionExport($exportParams);
     }
     //récupération de la liste des agendas en bdd (pour l'affichage du menu)
     $listAgendas = $serviceAgenda->getAvailableAgenda();
     //récupération de la liste des agendas affichés
     $listAgendasAffiches = $serviceAgenda->getAgendaAffiches();
     //template pour agenda
     $tplAgenda = new CopixTpl();
     $tplAgenda->assign('MAIN_AGENDA', CopixZone::process('agenda|agendaexport', array('arTitleAgendasAffiches' => $arTitleAgendasAffiches, 'e' => $this->getRequest('e'), 'errors' => $this->getRequest('errors'), 'exportParams' => $exportParams)));
     //template principal
     $tpl = new CopixTpl();
     $tpl->assign('BODY_ON_LOAD', "setDatePicker('#datedeb_export,#datefin_export')");
     $tpl->assign('TITLE_PAGE', CopixI18N::get('agenda|agenda.message.export'));
     $menu = $serviceAgenda->getAgendaMenu('export');
     $tpl->assign('MENU', $menu);
     $tpl->assign('MAIN', $tplAgenda->fetch('agenda|main.agenda.tpl'));
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
コード例 #2
0
 /**
  * Fonction qui prépare l'affichage de la vue semaine
  */
 public function getVueSemaine()
 {
     CopixHTMLHeader::addCSSLink(_resource("styles/module_agenda.css"));
     CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_agenda.js');
     $obj = new AgendaService();
     $listAgendas = $obj->getAvailableAgenda();
     $agendaService = new AgendaService();
     $dateService = new DateService();
     if (($params = $this->_getSessionSemaineParams()) == null) {
         $params = new SemaineParams();
         $params->numSemaine = $this->getRequest('numSemaine', $dateService->dateToWeeknum(mktime()), true);
         $params->annee = $this->getRequest('annee', date('Y'), true);
     } else {
         $params->numSemaine = $this->getRequest('numSemaine', $params->numSemaine, true);
         $params->annee = $this->getRequest('annee', $params->annee, true);
     }
     //pour savoir si on a cliqué sur un agenda à afficher
     if (_request('updateAgendaAffiches')) {
         $arIdAgendas = array();
         foreach ($listAgendas as $agenda) {
             if (_request('agendas_' . $agenda->id_agenda)) {
                 $arIdAgendas[$agenda->id_agenda] = $agenda->id_agenda;
             }
         }
         $agendaService->setAgendaAffiches($arIdAgendas);
     }
     //on récupère en session les agendas à afficher
     $params->agendas = $agendaService->getAgendaAffiches();
     //on met à jour la session
     $this->_setSessionSemaineParams($params);
     //on determine la date de début et de fin de la semaine en cours d'affichage
     $dateDebutSemaine = date('Ymd', $dateService->numweekToDate($params->numSemaine, $params->annee, 1));
     //date au format bdd
     $dateFinSemaine = date('Ymd', $dateService->numweekToDate($params->numSemaine, $params->annee, 0));
     //date au format bdd
     $arEventsSemaine = array();
     //on récupère tous les évènements de la semaine en cours de vue
     foreach ((array) $params->agendas as $idAgenda) {
         $arEventsSemaine[$idAgenda] = $agendaService->checkEventOfAgendaInBdd($idAgenda, $dateDebutSemaine, $dateFinSemaine);
     }
     //on classe ces évènements par jour
     $arEventByDay = $agendaService->getEventsByDay($arEventsSemaine, $dateDebutSemaine, $dateFinSemaine);
     //on ordonne les évènements par ordre croissant d'heure de début d'évènement dans la journée
     $arEventByDay = $agendaService->getEventsInOrderByDay($arEventByDay);
     //on détermine l'heure de début et l'heure de fin pour l'affichage du calendrier
     //on travail sur des heures sans séparateur pour pouvoir les comparer
     $heureDeb = CopixConfig::get('agenda|heuredebcal');
     $heureFin = CopixConfig::get('agenda|heurefincal');
     foreach ((array) $arEventByDay as $jours) {
         if (!isset($jours->events)) {
             continue;
         }
         //print_r($jours);
         foreach ((array) $jours->events as $event) {
             if ($event->alldaylong_event == 0) {
                 if ($dateService->heureWithSeparateurToheureWithoutSeparateur($event->heuredeb_event) < $dateService->heureWithSeparateurToheureWithoutSeparateur($heureDeb)) {
                     $heureDeb = $dateService->heureWithSeparateurToheureWithoutSeparateur($event->heuredeb_event);
                 }
                 if ($dateService->heureWithSeparateurToheureWithoutSeparateur($heureFin) < $dateService->heureWithSeparateurToheureWithoutSeparateur($event->heurefin_event)) {
                     $heureFin = $dateService->heureWithSeparateurToheureWithoutSeparateur($event->heurefin_event);
                 }
             }
         }
     }
     //on arrondit à l'heure inférieure pour l'heure de début et à l'heure supérieure pour l'heure de fin
     $heureDeb = substr($heureDeb, 0, 2);
     if (substr($heureFin, 2, 2) == 0) {
         //si les minutes sont à 0, on arrondit à l'heure
         $heureFin = substr($heureFin, 0, 2);
     } else {
         //si les minutes ne sont pas à 0, on arrondit à l'heure supérieure
         $heureFin = substr($heureFin, 0, 2) + 1;
     }
     //on récupère les leçons de la semaine à afficher
     $arLecons = $agendaService->getLeconsByDay((array) $params->agendas, $dateDebutSemaine, $dateFinSemaine);
     // On récupère les travaux de la semaine par agenda
     $travailDAO = _ioDAO('cahierdetextes|cahierdetextestravail');
     $agenda2cahier = array();
     $arTravauxEnClasse = array();
     $arTravauxAFaire = array();
     foreach ($params->agendas as $agendaId) {
         $agendaInfos = Kernel::getModParentInfo('MOD_AGENDA', $agendaId);
         $agendaType = AgendaType::getAgendaTypeForNode($agendaInfos['type'], $agendaInfos['id']);
         $mods = Kernel::getModEnabled($agendaInfos['type'], $agendaInfos['id']);
         $cahierDeTextes = Kernel::filterModuleList($mods, 'MOD_CAHIERDETEXTES');
         $agendaLevel = Kernel::getLevel($agendaInfos['type'], $agendaInfos['id']);
         if (isset($cahierDeTextes[0])) {
             $agenda2cahier[$agendaId] = $cahierDeTextes[0]->module_id;
             $travauxEnClasse = $travailDAO->findTravauxEnClasseByAgendaParJour($agendaId, $dateDebutSemaine, $dateFinSemaine, $agendaInfos['type'], $agendaInfos['id'], $agendaLevel);
             if (!is_null($travauxEnClasse)) {
                 foreach ($travauxEnClasse as $date => $travail) {
                     $arTravauxEnClasse[$date][$agendaId] = $travail;
                 }
             }
             $travauxAFaire = $travailDAO->findTravauxAFaireByAgendaParJour($agendaId, $dateDebutSemaine, $dateFinSemaine, $agendaInfos['type'], $agendaInfos['id'], $agendaLevel);
             if (!is_null($travauxAFaire)) {
                 foreach ($travauxAFaire as $date => $travail) {
                     $arTravauxAFaire[$date][$agendaId] = $travail;
                 }
             }
         }
     }
     //récupération de la liste des agendas affichés
     $listAgendasAffiches = $obj->getAgendaAffiches();
     //template pour agenda
     $tplAgenda = new CopixTpl();
     $tplAgenda->assign('MAIN_AGENDA', CopixZone::process('agenda|agendavuesemaine', array('elementsSemaineAffichee' => $params, 'arEventByDay' => $arEventByDay, 'heureDeb' => $heureDeb, 'heureFin' => $heureFin, 'arLecons' => $arLecons, 'arTravauxEnClasse' => $arTravauxEnClasse, 'arTravauxAFaire' => $arTravauxAFaire, 'agenda2cahier' => $agenda2cahier)));
     $title = $obj->getCurrentTitle();
     //template principal
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', $title['title']);
     $menu = $agendaService->getAgendaMenu('week');
     $tpl->assign('MENU', $menu);
     $tpl->assign('MAIN', $tplAgenda->fetch('agenda|main.agenda.tpl'));
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
コード例 #3
0
 /**
  * Récupère l'objet en session
  * Appelle les zones agendamenu et agendaeditlecon
  * @author Audrey Vassal <*****@*****.**>
  */
 public function processGetEdit()
 {
     CopixHTMLHeader::addCSSLink(_resource("styles/module_agenda.css"));
     require_once COPIX_UTILS_PATH . 'CopixDateTime.class.php';
     $serviceAuth = new AgendaAuth();
     $serviceType = new AgendaType();
     $serviceAgenda = new AgendaService();
     $serviceDate = new DateService();
     if (!($toEdit = $this->_getSessionLecon())) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.unableToGetEdited'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine')));
     }
     $serviceAuth->getCapability($toEdit->id_agenda);
     if ($serviceAuth->getCapability($toEdit->id_agenda) < $serviceAuth->getWriteLecon() || $serviceAgenda->getTypeAgendaByIdAgenda($toEdit->id_agenda) != $serviceType->getClassRoom()) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.error.enableToWrite'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine')));
     }
     $listAgendas = $serviceAgenda->getAvailableAgenda();
     $listAgendasAffiches = $serviceAgenda->getAgendaAffiches();
     //template pour agenda
     $tplAgenda = new CopixTpl();
     $tplAgenda->assign('MAIN_AGENDA', CopixZone::process('agenda|agendaeditlecon', array('e' => _request('e'), 'errors' => _request('errors'), 'toEdit' => $toEdit)));
     //template principal
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', CopixI18N::get('agenda|agenda.title.lecon', array('jour' => CopixDateTime::yyyymmddToDate($toEdit->date_lecon))));
     $menu = $serviceAgenda->getAgendaMenu('');
     $tpl->assign('MENU', $menu);
     $tpl->assign('MAIN', $tplAgenda->fetch('agenda|main.agenda.tpl'));
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
コード例 #4
0
 /**
  * R�cup�re l'objet en session
  * Cr�� un objet vide  et initialise la propri�t� id_agenda
  * @author Audrey Vassal <*****@*****.**>
  */
 public function processGetEdit()
 {
     CopixHTMLHeader::addCSSLink(_resource("styles/module_agenda.css"));
     CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.ui.datepicker-fr.js"));
     $serviceAuth = new AgendaAuth();
     $serviceAgenda = new AgendaService();
     if (!($toEdit = $this->_getSessionEvent())) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.unableToGetEdited'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine')));
     }
     //var_dump($toEdit);
     //r�cup�ration de la liste des agendas affich�s
     $listAgendasAffiches = $serviceAgenda->getAgendaAffiches();
     //on v�rifie les droits des utilisateurs sur la liste des agendas affich�s
     foreach ((array) $listAgendasAffiches as $id_agenda) {
         //on v�rifie si l'utilisateur a les droits d'�criture sur un des agendas affich�
         if ($serviceAuth->getCapability($id_agenda) >= $serviceAuth->getWriteAgenda()) {
             $ableToWrite = true;
         }
     }
     if (!$ableToWrite) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.error.enableToWrite'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine')));
     }
     $obj = new AgendaService();
     $listAgendas = $obj->getAvailableAgenda();
     //r�cup�ration de la liste des agendas affich�s
     $serviceAgenda = new AgendaService();
     //on r�cup�re en session la liste des agendas en cours de visualisation
     $arAgendasAffiches = $serviceAgenda->getAgendaAffiches();
     $arTitleAgendasAffiches = $serviceAgenda->getArTitleAgendaByArIdAgenda($arAgendasAffiches);
     //template pour agenda
     $tplAgenda = new CopixTpl();
     $tplAgenda->assign('MAIN_AGENDA', CopixZone::process('agenda|agendaeditevent', array('arTitleAgendasAffiches' => $arTitleAgendasAffiches, 'e' => $this->getRequest('e'), 'errors' => $this->getRequest('errors'), 'toEdit' => $toEdit)));
     //template principal
     $tpl = new CopixTpl();
     $tpl->assign('BODY_ON_LOAD', "setDatePicker('#datedeb_event,#datefin_event,#dateendrepeat_event')");
     $tpl->assign('TITLE_PAGE', CopixI18N::get('agenda|agenda.title.editEvent'));
     $menu = $serviceAgenda->getAgendaMenu('create');
     $tpl->assign('MENU', $menu);
     $tpl->assign('MAIN', $tplAgenda->fetch('agenda|main.agenda.tpl'));
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }