コード例 #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
 /**
  * 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);
 }
コード例 #3
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);
 }
コード例 #4
0
 /**
  * Liste des agendas disponibles
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/08/24
  * @param integer $id Id de l'agenda (si aucun, l'envoie dans l'agenda perso)
  */
 public function processAgendaList()
 {
     $serviceAuth = new AgendaAuth();
     $serviceType = new AgendaType();
     $serviceAgenda = new AgendaService();
     $tpl = new CopixTpl();
     $agendaDispos = AgendaService::getAvailableAgenda();
     $agendaAffiches = AgendaService::getAgendaAffiches();
     $ableToWrite = $ableToModerate = false;
     //on vérifie les droits des utilisateurs sur la liste des agendas affichés
     foreach ((array) $agendaAffiches as $id_agenda) {
         //on vérifie si l'utilisateur a les droits d'écriture sur un des agendas affiché
         //print_r($serviceAuth->getWriteAgenda());
         if ($serviceAuth->getCapability($id_agenda) >= $serviceAuth->getWriteAgenda()) {
             $ableToWrite = true;
             break;
         }
     }
     //on vérifie les droits des utilisateurs sur la liste des agendas affichés
     foreach ((array) $agendaAffiches as $id_agenda) {
         //on vérifie si l'utilisateur a les droits d'import
         if ($serviceAuth->getCapability($id_agenda) >= $serviceAuth->getModerate()) {
             $ableToModerate = true;
             break;
         }
     }
     $listeFiltre = $agendaDispos;
     //on vérifie les droits de lecture des utilisateurs
     foreach ((array) $listeFiltre as $key => $agenda) {
         //on vérifie si l'utilisateur a les droits de lecture sur la liste des agendas
         if ($serviceAuth->getCapability($agenda->id_agenda) < $serviceAuth->getRead()) {
             unset($listeFiltre[$key]);
         }
     }
     //on construit le tableau de couleurs associées au type d'agenda
     $arColorByIdAgenda = array();
     foreach ((array) $listeFiltre as $agenda) {
         $arColor = $serviceType->getColors($serviceAgenda->getTypeAgendaByIdAgenda($agenda->id_agenda));
         $i = 0;
         foreach ($arColorByIdAgenda as $idAgenda => $couleurAgenda) {
             if ($arColorByIdAgenda[$idAgenda] == $arColor[$i]) {
                 $i = $i + 1;
             }
         }
         if ($i < count($arColor)) {
             $arColorByIdAgenda[$agenda->id_agenda] = $arColor[$i];
         } else {
             $arColorByIdAgenda[$agenda->id_agenda] = $arColor[0];
         }
     }
     $ppo = new CopixPPO();
     $ppo->arColorByIdAgenda = $arColorByIdAgenda;
     $ppo->listAgendas = $listeFiltre;
     $ppo->agendasSelectionnes = $agendaAffiches;
     CopixHTMLHeader::addCSSLink(_resource("styles/module_agenda.css"));
     return _arPPO($ppo, array('template' => 'popup_agendalist.agenda.tpl', 'mainTemplate' => 'main|main_fancy.php'));
 }
コード例 #5
0
 /**
  * Renvoie le menu des agendas
  * @author Christophe Beyer <*****@*****.**>
  * @since 2010/10/20
  * @param string $iCurrent Onglet a allumer
  * @return array Tableau du menu a afficher
  */
 public function getAgendaMenu($iCurrent)
 {
     $menu = array();
     // Affichage hebdomadaire
     $menu_txt = CopixI18N::get('agenda.menu.back');
     $menu_type = 'week';
     $menu_url = CopixUrl::get('agenda|agenda|vueSemaine');
     $menu[] = array('txt' => $menu_txt, 'type' => $menu_type, 'current' => $iCurrent == $menu_type, 'url' => $menu_url);
     // Liste des agendas (popup)
     $menu_txt = CopixI18N::get('agenda|agenda.menu.agendalist');
     $menu_type = 'agendalist';
     $menu_behavior = 'fancybox';
     $menu_url = CopixUrl::get('agenda|agenda|agendaList');
     $menu[] = array('txt' => $menu_txt, 'type' => $menu_type, 'current' => $iCurrent == $menu_type, 'behavior' => $menu_behavior, 'url' => $menu_url);
     // Nouvel evenement
     $listAgendasAffiches = AgendaService::getAgendaAffiches();
     $ableToWrite = false;
     $ableToModerate = false;
     //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 (AgendaAuth::getCapability($id_agenda) >= AgendaAuth::getWriteAgenda()) {
             $ableToWrite = true;
         }
         if (AgendaAuth::getCapability($id_agenda) >= AgendaAuth::getModerate()) {
             $ableToModerate = true;
         }
     }
     if ($ableToWrite) {
         $menu_txt = CopixI18N::get('agenda.menu.ajoutEvent');
         $menu_type = 'create';
         $menu_url = CopixUrl::get('agenda|event|create');
         $menu[] = array('txt' => $menu_txt, 'type' => $menu_type, 'current' => $iCurrent == $menu_type, 'url' => $menu_url);
     }
     if ($ableToModerate) {
         $menu_txt = CopixI18N::get('agenda.menu.import');
         $menu_type = 'import';
         $menu_url = CopixUrl::get('agenda|importexport|prepareImport');
         $menu[] = array('txt' => $menu_txt, 'type' => $menu_type, 'current' => $iCurrent == $menu_type, 'url' => $menu_url);
     }
     // Export
     $menu_txt = CopixI18N::get('agenda.menu.export');
     $menu_type = 'export';
     $menu_url = CopixUrl::get('agenda|importexport|prepareExport');
     $menu[] = array('txt' => $menu_txt, 'type' => $menu_type, 'current' => $iCurrent == $menu_type, 'url' => $menu_url);
     return $menu;
 }