/** * go * * Appel automatique, avec détection du noeud à afficher. * @author Frédéric Mossmann * @since 10.03.2009 * */ public function go() { if (!Kernel::is_connected()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.nologin'), 'back' => CopixUrl::get('auth|default|login'))); } CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_concerto.js'); if (!_request("id") || !ereg('^[0-9]+$', _request("id"))) { return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('kernel||getNodes')); } $sql = 'SELECT login,password FROM kernel_bu_auth WHERE node_type=\'responsable\' AND node_id=' . _currentUser()->getExtra('id') . ' AND id=\'' . addslashes(_request("id")) . '\' AND service=\'concerto\''; $concerto = _doQuery($sql); if (!$concerto) { return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('kernel||getNodes')); } $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('concerto|concerto.title')); // $tpl->assign ('MENU', '<a href="'.CopixUrl::get ('groupe||getListPublic').'">'.CopixI18N::get ('groupe|groupe.annuaire').'</a> :: <a href="'.CopixUrl::get ('groupe||getListMy').'">'.CopixI18N::get ('groupe|groupe.my').'</a>'); $tplListe = new CopixTpl(); $tplListe->assign('login', $concerto[0]->login); $tplListe->assign('password', $concerto[0]->password); $result = $tplListe->fetch("concerto-form.tpl"); $tpl->assign("MAIN", $result); $tpl->assign('BODY_ON_LOAD', 'concerto_redirect();'); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Affichage de la fiche d'une ecole * * @author Christophe Beyer <*****@*****.**> * @since 2008/09/03 * @param integer $id Id de l'ecole * @param integer $popup 1 pour afficher la fiche en popup Fancybox */ public function fiche() { $id = $this->getRequest('id', null); $iPopup = CopixRequest::getInt('popup'); $ecoleDAO = CopixDAOFactory::create('kernel|kernel_bu_ecole'); $ficheDAO = CopixDAOFactory::create("fiches_ecoles"); $criticErrors = array(); if (!($rEcole = $ecoleDAO->get($id))) { $criticErrors[] = CopixI18N::get('fichesecoles.error.param'); } elseif (!FichesEcolesService::canMakeInFicheEcole($id, 'VIEW')) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('annuaire||'))); } $rFiche = $ficheDAO->get($id); $tpl = new CopixTpl(); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); $fiche = CopixZone::process('fiche', array('rEcole' => $rEcole, 'rFiche' => $rFiche)); $main = $fiche; $title = $rEcole->nom; if ($rEcole->type) { $title .= ' (' . $rEcole->type . ')'; } $tpl->assign('TITLE_PAGE', $title); // Get vocabulary catalog to use $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog'); $vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode('BU_ECOLE', $rEcole->numero); if (strtolower($rEcole->type) == 'crèche') { $tpl->assign('TITLE_CONTEXT', CopixI18N::get('kernel|kernel.codes.mod_fichesecoles_creche')); } else { $tpl->assign('TITLE_CONTEXT', CopixCustomI18N::get('kernel|kernel.codes.mod_fiche%%structure%%', array('catalog' => $vocabularyCatalog->id_vc))); } $menu = array(); $menu[] = array('url' => CopixUrl::get('public||getListBlogs'), 'txt' => CopixCustomI18N::get('public|public.blog.annuaire.%%structures%%', array('catalog' => $vocabularyCatalog->id_vc))); if (Kernel::is_connected()) { $menu[] = array('url' => CopixUrl::get('annuaire||getAnnuaireEcole', array('ecole' => $rEcole->numero)), 'txt' => CopixCustomI18N::get('annuaire|annuaire.back%%structure%%', array('catalog' => $vocabularyCatalog->id_vc))); } if (CopixConfig::exists('|can_annuaire_menu') && !CopixConfig::get('|can_annuaire_menu')) { $menu = array(); } $tpl->assign('MENU', $menu); $tpl->assign("MAIN", $main); if ($iPopup) { $ppo = new CopixPPO(); $ppo->fiche = $fiche; $ppo->TITLE = $title; return _arPPO($ppo, array('template' => 'fiche_popup.tpl', 'mainTemplate' => 'main|main_fancy.php')); } return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Affiche la liste des blogs ayant au moins un article * * @author Christophe Beyer <*****@*****.**> * @since 2006/03/23 * @param string $kw Mot-clé pour la recherche (option) */ public function _createContent(&$toReturn) { CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); $kw = $this->getParam('kw', null); $tpl = new CopixTpl(); $dao = _dao("blog|blog"); if ($kw) { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND name_blog LIKE '%" . addslashes($kw) . "%' ORDER BY name_blog"; } else { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND 1 ORDER BY name_blog"; } $sql = _doQuery($critere); $list = array(); //print_r($sql); foreach ($sql as $blog) { $parent = Kernel::getModParentInfo("MOD_BLOG", $blog->id_blog); if ($parent) { $blog->parent = $parent['nom']; switch ($parent['type']) { case 'CLUB': $blog->type = CopixI18N::get('public.blog.typeClub'); break; case 'BU_CLASSE': $blog->type = CopixI18N::get('public.blog.typeClasse'); break; case 'BU_ECOLE': $blog->type = CopixI18N::get('public.blog.typeEcole'); break; case 'BU_VILLE': $blog->type = CopixI18N::get('public.blog.typeVille'); break; default: $blog->type = $parent['type']; break; } } $blog->stats = KernelBlog::getStats($blog->id_blog); //print_r($blog); if ($blog->stats['nbArticles']['value'] > 0) { $list[] = $blog; } } usort($list, "order_tab_blogs"); $tpl->assign('list', $list); $toReturn = $tpl->fetch('getlistblogszone.tpl'); return true; }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO CopixHTMLHeader::addCSSLink(_resource("styles/module_blog_admin.css")); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_blog.js'); $tpl = new CopixTpl(); $id_blog = $this->getParam('id_blog', ''); $tpl->assign('article', $this->getParam('article', null)); $tpl->assign('kind', $this->getParam('kind', null)); $tpl->assign('id_blog', $id_blog); $tpl->assign('id_bact', $this->getParam('id_bact', '')); $tpl->assign('errors', $this->getParam('errors', '')); $tpl->assign('showErrors', $this->getParam('showErrors', false)); $tpl->assign('preview', $this->getParam('preview', '0')); $tpl->assign('tabArticleCategory', $this->getParam('tabArticleCategory', null)); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('default_format_articles', CopixConfig::get('blog|blog.default.default_format_articles')); $formats = CopixConfig::get('blog|blog.formats_articles'); $tabFormats = explode(',', $formats); $values = $output = array(); foreach ($tabFormats as $k) { $values[] = $k; $output[] = CopixI18N::get('blog|blog.default_format_articles.' . $k); } $tpl->assign('format_bact', array('values' => $values, 'output' => $output)); $art = $this->getParam('article'); $tpl->assign('edition_sumary', CopixZone::process('kernel|edition', array('field' => 'sumary_bact', 'format' => $art->format_bact, 'content' => $art->sumary_bact, 'options' => array('toolbarSet' => 'IconitoBlog'), 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 160))); $tpl->assign('edition_content', CopixZone::process('kernel|edition', array('field' => 'content_bact', 'format' => $art->format_bact, 'content' => $art->content_bact, 'options' => array('toolbarSet' => 'IconitoBlog'), 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 290))); //cat�gorie de l'article if ($this->getParam('kind', null) == 1) { $article = $this->getParam('article', null); $idCategorie = $article->tabSelectCat[0]; foreach ($this->getParam('tabArticleCategory', null) as $key => $obj) { if ($obj->id_bacg == $idCategorie) { $categorie = $obj->name_bacg; } } $tpl->assign('categorie', $categorie); } $tpl->assign('canWriteOnline', BlogAuth::canMakeInBlog('ADMIN_ARTICLE_MAKE_ONLINE', create_blog_object($id_blog))); // retour de la fonction : $toReturn = $tpl->fetch('article.edit.tpl'); return true; }
/** * Affiche la liste des blogs * * @author Christophe Beyer <*****@*****.**> * @since 2006/03/09 * @todo Positionner $grville */ public function processGetListBlogs() { if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) { CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('public||rss', array()) . '" type="application/rss+xml" title="' . htmlentities(CopixI18N::get('public|public.rss.flux.title')) . '" />'); } CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_annuaire.js'); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('public|public.blog.annuaire')); $kw = $this->getRequest('kw', null); $grville = 1; $tplListe = new CopixTpl(); if ($ville_as_array = Kernel::getKernelLimits('ville_as_array')) { $tplListe->assign('list', CopixZone::process('GetListBlogs2', array('kw' => $kw, 'ville' => $ville_as_array))); } else { $tplListe->assign('list', CopixZone::process('GetListBlogs2', array('kw' => $kw, 'grville' => $grville))); } $tplListe->assign('kw', $kw); $result = $tplListe->fetch("getlistblogs.tpl"); $tpl->assign("MAIN", $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO CopixHTMLHeader::addCSSLink(_resource("styles/module_blog_admin.css")); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_blog.js'); $tpl = new CopixTpl(); $id_blog = $this->getParam('id_blog', ''); $tpl->assign('page', $this->getParam('page', null)); $tpl->assign('id_blog', $this->getParam('id_blog', '')); $tpl->assign('id_bpge', $this->getParam('id_bpge', '')); $tpl->assign('errors', $this->getParam('errors', '')); $tpl->assign('showErrors', $this->getParam('showErrors', '')); $tpl->assign('preview', $this->getParam('preview', '0')); $tpl->assign('kind', $this->getParam('kind', '0')); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('default_format_articles', CopixConfig::get('blog|blog.default.default_format_articles')); //$tpl->assign ('wikibuttons', CopixZone::process ('kernel|wikibuttons', array('field'=>'content_bpge', 'object'=>array('type'=>'MOD_BLOG', 'id'=>$this->getParam('id_blog'))))); $formats = CopixConfig::get('blog|blog.formats_articles'); $tabFormats = explode(',', $formats); $values = $output = array(); foreach ($tabFormats as $k) { $values[] = $k; $output[] = CopixI18N::get('blog|blog.default_format_articles.' . $k); } $tpl->assign('format_bpge', array('values' => $values, 'output' => $output)); $pag = $this->getParam('page'); //print_r($pag); if (!isset($pag->content_bpge)) { $pag->content_bpge = ''; } //$content = (isset($pag->content_bpge)) ? $pag->content_bpge : ''; //$tpl->assign ('content_bpge', CopixZone::process ('kernel|edition', array('field'=>'content_bpge', 'format'=>'wiki', 'content'=>$content, 'object'=>array('type'=>'MOD_BLOG', 'id'=>$this->getParam('id_blog')), 'height'=>290))); $tpl->assign('edition_content', CopixZone::process('kernel|edition', array('field' => 'content_bpge', 'format' => $pag->format_bpge, 'content' => $pag->content_bpge, 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 290))); $tpl->assign('canWriteOnline', BlogAuth::canMakeInBlog('ADMIN_ARTICLE_MAKE_ONLINE', create_blog_object($id_blog))); // retour de la fonction : $toReturn = $tpl->fetch('page.edit.tpl'); return true; }
/** * Affichage d'un annuaire de classe * * @author Christophe Beyer <*****@*****.**> * @since 2006/01/18 * @param integer $classe Id de la classe */ public function getAnnuaireClasse() { if (!Kernel::is_connected()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('annuaire|annuaire.error.noLogged'), 'back' => CopixUrl::get('||'))); } $classe = _request("classe") ? _request("classe") : NULL; $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); $criticErrors = array(); $rClasse = Kernel::getNodeInfo('BU_CLASSE', $classe, false); $matrix =& enic::get('matrixCache'); if (!$rClasse) { $criticErrors[] = CopixI18N::get('annuaire|annuaire.error.noClasse'); } elseif (!$matrix->classe($classe)->_right->count->voir > 0) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('annuaire||'))); } CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); // Si c'est le détail d'une classe, on en déduit l'école $parent = Kernel::getNodeParents('BU_CLASSE', $classe); if ($parent[0]['type'] == 'BU_ECOLE') { $ecole = $parent[0]['id']; } $rEcole = Kernel::getNodeInfo('BU_ECOLE', $ecole, false); // Blog de l'école $blog = getNodeBlog('BU_ECOLE', $ecole, array('is_public' => 1)); if ($blog) { $rEcole['blog'] = CopixUrl::get('blog||', array('blog' => $blog->url_blog)); } $tplListe = new CopixTpl(); $tplListe->assign('infosecole', CopixZone::process('annuaire|infosecole', array('rEcole' => $rEcole))); $tplListe->assign('infosclasse', CopixZone::process('annuaire|infosclasse', array('rClasse' => $rClasse))); $tplListe->assign('classe', $rClasse); $result = $tplListe->fetch('getannuaireclasse.tpl'); //print_r($rEcole); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', $rClasse["nom"]); $menu = array(); if (!CopixConfig::exists('|can_group_showlist') || CopixConfig::get('|can_group_showlist')) { $menu[] = array('txt' => CopixI18N::get('groupe|groupe.annuaire'), 'url' => CopixUrl::get('groupe||getListPublic'), 'size' => '110'); } $menu[] = array('txt' => CopixI18N::get('public|public.blog.annuaire'), 'url' => CopixUrl::get('public||getListBlogs')); $menu[] = array('txt' => CopixI18N::get('annuaire|annuaire.backEcole'), 'url' => CopixUrl::get('|getAnnuaireEcole', array('ecole' => $ecole))); $menu[] = array('txt' => CopixI18N::get('annuaire|annuaire.backVille'), 'url' => CopixUrl::get('|getAnnuaireVille', array('ville' => $rEcole['ALL']->vil_id_vi))); if (CopixConfig::exists('|can_annuaire_menu') && !CopixConfig::get('|can_annuaire_menu')) { $menu = array(); } $tpl->assign('MENU', $menu); $tpl->assign('MAIN', $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Affiche la liste des blogs ayant au moins un article, pour un groupe de ville, ou une ou plusieurs villes * * @author Christophe Beyer <*****@*****.**> * @since 2006/03/23 * @param string $kw Mot-cl� pour la recherche (option) * @param integer grville Id de groupe de ville * @param array ville Tableau avec les ID des villes */ public function _createContent(&$toReturn) { CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); $kw = $this->getParam('kw', null); $pGrVille = $this->getParam('grville', null); $pVille = $this->getParam('ville', null); // Tableau $tpl = new CopixTpl(); if ($pVille) { $villes = AnnuaireService::getVilles($pVille); } else { $villes = AnnuaireService::getVillesInGrville($pGrVille); } //print_r($villes); $tpl->assign('villes', $villes); $ecoles = array(); foreach ($villes as $ville) { //$ecoles $ec = AnnuaireService::getEcolesInVille($ville['id'], array('directeur' => false)); foreach ($ec as $k => $e) { $blog = getNodeBlog('BU_ECOLE', $e['id']); //print_r($blog); if ($blog && $blog->is_public == 1) { $ec[$k]['blog']['url_blog'] = $blog->url_blog; } } $ecoles[$ville['id']] = $ec; } //print_r($ecoles); $tpl->assign('ecoles', $ecoles); if ($kw) { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND name_blog LIKE '%" . addslashes($kw) . "%' ORDER BY name_blog"; } else { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND 1 ORDER BY name_blog"; } $sql = _doQuery($critere); $list = array(); $arTypes = array(); if (CopixConfig::exists('public|blogs.types') && CopixConfig::get('public|blogs.types')) { $arTypes = explode(",", CopixConfig::get('public|blogs.types')); } $arTypes[] = 'CLUB'; //print_r($sql); foreach ($sql as $blog) { $parent = Kernel::getModParentInfo("MOD_BLOG", $blog->id_blog); if ($parent) { if ($arTypes && !in_array($parent['type'], $arTypes)) { continue; } //var_dump($parent); $blog->parent = $parent['nom']; switch ($parent['type']) { case 'CLUB': if (Kernel::getKernelLimits('ville')) { $ville = GroupeService::getGroupeVille($parent['id']); if (!in_array($ville, Kernel::getKernelLimits('ville_as_array'))) { continue; } } $blog->type = CopixI18N::get('public.blog.typeClub'); break; /* case 'BU_CLASSE' : $blog->type = CopixI18N::get ('public.blog.typeClasse'); $blog->parent .= ' - '.$parent['ALL']->eco_nom; if ($parent['ALL']->eco_type) $blog->parent .= ' - '.$parent['ALL']->eco_type.''; break; */ //case 'BU_ECOLE' : $blog->type = CopixI18N::get ('public.blog.typeEcole'); break; //case 'BU_VILLE' : $blog->type = CopixI18N::get ('public.blog.typeVille'); break; //case 'BU_GRVILLE' : $blog->type = CopixI18N::get ('public.blog.typeGrville'); break; //default : $blog->type = $parent['type']; break; } if (!isset($blog->type)) { continue; } $blog->stats = KernelBlog::getStats($blog->id_blog); //print_r($blog); /* Activer pour cacher les blogs non lisibles */ // if( !blogauth::canMakeInBlog('READ', $blog) ) continue; if ($blog->stats['nbArticles']['value'] > 0) { $list[] = $blog; } } } usort($list, "order_tab_blogs"); $tpl->assign('list', $list); if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) { $tpl->assign('can_public_rssfeed', 1); } else { $tpl->assign('can_public_rssfeed', 0); } $toReturn = $tpl->fetch('getlistblogszone2.tpl'); return true; }
/** * Affichage du formulaire d'écriture d'un message (réponse à une discussion) * * @author Christophe Beyer <*****@*****.**> * @since 2005/11/16 * @see doMessageForm() * @param integer $topic Id de la discussion * @param integer $eleve (option) Id de l'élève concerné * @param string $message Texte du message (si formulaire soumis) * @param array $errors (option) Erreurs rencontrées * @param integer $preview (option) Si 1, affichera la preview du message soumis, si 0 validera le formulaire */ public function processGetMessageForm() { $carnet_service =& CopixClassesFactory::Create('carnet|CarnetService'); $dao_carnets_to = CopixDAOFactory::create("carnet|carnet_topics_to"); //$eleves = $carnet_service->getHisCarnetEleves(); // Ses élèves $criticErrors = array(); $id = NULL; $topic = $this->getRequest('topic', null); $eleve = $this->getRequest('eleve', null); $message = $this->getRequest('message', null); $errors = $this->getRequest('errors', array()); $preview = $this->getRequest('preview', 0); $format = CopixConfig::get('carnet|default_format'); if ($id) { // Edition d'un message $criticErrors[] = CopixI18N::get('carnet|carnet.error.impossible'); } elseif ($topic && $eleve) { // Réponse dans un topic, sur un élève $rTopic = $dao_carnets_to->get($topic, $eleve); if (!$rTopic) { $criticErrors[] = CopixI18N::get('carnet|carnet.error.noTopic'); } else { $mondroit = $carnet_service->getUserDroitInCarnet(array("eleve" => $eleve)); if (!$mondroit) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } } } else { $criticErrors[] = CopixI18N::get('carnet|carnet.error.impossible'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('carnet||'))); } else { $tpl = new CopixTpl(); //$titre = ($id) ? 'Modification du message' : 'Nouveau message'; CopixHTMLHeader::addCSSLink(_resource("styles/module_carnet.css")); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_carnet.js'); $tpl->assign('TITLE_PAGE', $rTopic->topic_titre); $tplForm = new CopixTpl(); $tplForm->assign('topic', $topic); $tplForm->assign('eleve', $eleve); $tplForm->assign('message', $message); $tplForm->assign('format', $format); $tplForm->assign("errors", $errors); $tplForm->assign("id", $id); $tplForm->assign('preview', $preview); $tplForm->assign('message_edition', CopixZone::process('kernel|edition', array('field' => 'message', 'format' => $format, 'content' => $message, 'height' => 200))); $result = $tplForm->fetch('getmessageform.tpl'); $tpl->assign('MAIN', $result); //$tpl->assign ('MENU', '<a href="'.CopixUrl::get ('carnet||getTopic', array("id"=>$topic, "eleve"=>$eleve)).'">'.CopixI18N::get ('carnet|carnet.backTopic').'</a> :: <a href="'.CopixUrl::get ('carnet||getCarnet', array("eleve"=>$eleve)).'">'.CopixI18N::get ('carnet|carnet.backCarnet').'</a>'); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); } }
/** * 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); }
/** * Affiche la liste des ecoles * * @author Christophe Beyer <*****@*****.**> * @since 2008/11/10 * @param string $titre Titre a donner a la zone * @param integer $ajaxpopup 1 si on veut afficher le lien vers la fiche en Ajax, 0 pour afficher le lien Href classique. Par defaut : 0 * @param integer $colonnes Nb de colonnes. Par defaut : 1 * @param integer $grville Id du groupe de villes dans lequel on pioche les ecoles. Par defaut : 1 * @param integer $ville Id de la ville dans laquelle on pioche les ecoles. Par defaut : null (prend le groupe de ville). Si on passe un grville et une ville, on prend la ville * @param string $groupBy Si regroupement. Peut valoir "type" * @param integer $dispType 1 pour afficher le type des ecoles, 0 pour n'afficher que leur nom. Par defaut : 1 */ public function _createContent(&$toReturn) { //params exclusion list $IdExclusionList = array(); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); $titre = $this->getParam('titre'); $ajaxpopup = $this->getParam('ajaxpopup', false); $colonnes = $this->getParam('colonnes'); $colonnes = intval($colonnes); if (!$colonnes) { $colonnes = 1; } $grville = $this->getParam('grville', null); $ville = $this->getParam('ville', null); $search = $this->getParam('search', null); $pGroupBy = $this->getParam('groupBy'); $pDispType = $this->getParam('dispType'); $pDispFilter = $this->getParam('dispFilter') === '' ? true : $this->getParam('dispFilter') ? true : false; $pDispHeader = $this->getParam('dispHeader', 1); if ($ville <= 0 && ($ville_as_array = Kernel::getKernelLimits('ville_as_array'))) { $list = array(); if (!empty($search)) { $list = $annuaireService->searchEcolesByVilles($search, $ville_as_array); } else { foreach ($ville_as_array as $ville_item) { $list_tmp = $annuaireService->getEcolesInVille($ville_item); $list = array_merge($list, $list_tmp); } } } else { //add default city : $ville = empty($ville) ? empty($this->defaultVille) ? null : $this->defaultVille : $ville; if (!empty($search)) { $list = $annuaireService->searchEcoles($search); } elseif (!empty($ville) && $ville > 0) { $list = $annuaireService->getEcolesInVille($ville); } elseif (!empty($grville)) { $list = $annuaireService->getEcolesInGrville($grville); } else { $list = $annuaireService->getAllEcoles(); } } if ($pGroupBy == 'type') { usort($list, array($this, "usort_ecoles_type")); } elseif ($pGroupBy == 'ville') { usort($list, array($this, "usort_ecoles_ville")); } elseif ($pGroupBy == 'villeType') { $listByCityAndType = array(); foreach ($list as $item) { if (!array_key_exists('ville', $item)) { continue; } if (in_array($item['id'], $IdExclusionList)) { continue; } $listByCityAndType[$item['ville_nom']][$item['type']][] = $item; } $listByCityAndTypeFinal = array(); //order type foreach ($listByCityAndType as $k => $typeCollection) { if (array_key_exists('Elémentaire', $typeCollection)) { $listByCityAndTypeFinal[$k]['Elémentaire'] = $typeCollection['Elémentaire']; } if (array_key_exists('Primaire', $typeCollection)) { $listByCityAndTypeFinal[$k]['Primaire'] = $typeCollection['Primaire']; } if (array_key_exists('Maternelle', $typeCollection)) { $listByCityAndTypeFinal[$k]['Maternelle'] = $typeCollection['Maternelle']; } if (array_key_exists('Privée', $typeCollection)) { $listByCityAndTypeFinal[$k]['Privée'] = $typeCollection['Privée']; } } $list = $listByCityAndTypeFinal; } //kernel::myDebug($list); $nbEcoles = 0; foreach ($list as $k => $ecole) { if ($ecole['id'] > 0) { $nbEcoles++; } } //kernel::myDebug($list); // Nb elements par colonnes $parCols = ceil($nbEcoles / $colonnes); if (($ville_as_array = Kernel::getKernelLimits('ville_as_array')) && is_array($ville_as_array) && count($ville_as_array) > 0) { $listVille = $this->db->query('SELECT * FROM kernel_bu_ville WHERE id_vi IN (' . implode(',', $ville_as_array) . ') ORDER BY canon')->toArray(); $displayVille = count($listVille) > 1 ? true : false; } else { $listVille = $this->db->query('SELECT * FROM kernel_bu_ville ORDER BY canon')->toArray(); $displayVille = count($listVille) > 1 ? true : false; } $tpl = new CopixTpl(); $tpl->assign('titre', $titre); $tpl->assign('ajaxpopup', $ajaxpopup); $tpl->assign('list', $list); $tpl->assign('parCols', $parCols); $tpl->assign('widthColonne', round(100 / $colonnes, 1) . '%'); $tpl->assign('displayVille', $displayVille); $tpl->assign('villes', $listVille); $tpl->assign('defaultVille', $ville); $tpl->assign('groupBy', $pGroupBy); $tpl->assign('dispType', $pDispType); $tpl->assign('dispFilter', $pDispFilter); $tpl->assign('dispHeader', $pDispHeader); $searchInputValue = empty($search) ? $this->i18n('welcome.ecoles.search') : $search; $tpl->assign('searchInputValue', $searchInputValue); $toReturn = $tpl->fetch('zone_ecoles.tpl'); return true; }
public function addFile($iPathToJs) { CopixHtmlHeader::addJSLink(CopixUrl::get() . $iPathToJs); }
/** * Affiche la série de boutons permettant à l'utilisateur de mettre en forme simplement le texte qu'il saisit dans une zone de texte libre. * * @author Christophe Beyer <*****@*****.**> * @since 2005/12/28 * @param string $field Nom du champ dans le formulaire. Correspond à l'attribut "name" et "id" dans le template (les deux doivent être positionnés) * @param string $format Format de la zone de saisie (wiki, html, fckeditor...) * @param array $objet (option) Module dans lequel se trouve la barre wiki, dans un tableau indexé avec TYPE et ID (exemple: type=>MOD_BLOG, ID=>4). Si positionné, on va vérifier si le parent de cet objet a un album photos, une malle et un classeur, et si oui on affiche les liens vers l'album photos, la malle et le classeur en mode popup */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $field = $this->getParam('field', NULL); $format = $this->getParam('format', NULL); $object = $this->getParam('object', NULL); $withAlbum = $this->getParam('withAlbum', true); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/wikibuttons.js'); if ($field && $format) { $buttonAlbum = $buttonMalle = $buttonClasseur = array(); // Bouton album photos et malle $buttons = array(); // Tableau avec les boutons switch ($format) { case "wiki": CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/format_' . $format . '.js'); $buttons[] = array('titre' => CopixI18N::get('wikibuttons.bold'), 'accesskey' => 'g', 'tabindex' => 10, 'link' => "javascript:bbstyle('','{$field}',0);"); // Gras $buttons[] = array('titre' => CopixI18N::get('wikibuttons.italic'), 'accesskey' => 'i', 'tabindex' => 11, 'link' => "javascript:bbstyle('','{$field}',2);"); // Italique $buttons[] = array('titre' => CopixI18N::get('wikibuttons.image'), 'accesskey' => 'm', 'tabindex' => 12, 'link' => "javascript:bblink('','{$field}',12);"); // Image $buttons[] = array('titre' => CopixI18N::get('wikibuttons.link'), 'accesskey' => 'l', 'tabindex' => 13, 'link' => "javascript:bblink('','{$field}',8);"); // Lien $buttons[] = array('titre' => CopixI18N::get('wikibuttons.hr'), 'accesskey' => 'h', 'tabindex' => 14, 'link' => "javascript:bbcar('','{$field}',4);"); // HR $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h1'), 'accesskey' => 'j', 'tabindex' => 15, 'link' => "javascript:bblink('','{$field}',20);"); // H1 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h2'), 'accesskey' => 'v', 'tabindex' => 16, 'link' => "javascript:bblink('','{$field}',22);"); // H2 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h3'), 'accesskey' => 'w', 'tabindex' => 17, 'link' => "javascript:bblink('','{$field}',24);"); // H3 break; case "dokuwiki": CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/format_' . $format . '.js'); $buttons[] = array('titre' => CopixI18N::get('wikibuttons.bold'), 'accesskey' => 'g', 'tabindex' => 10, 'link' => "javascript:bbstyle('','{$field}',0);", 'icon' => 'bold.png'); // Gras $buttons[] = array('titre' => CopixI18N::get('wikibuttons.italic'), 'accesskey' => 'i', 'tabindex' => 11, 'link' => "javascript:bbstyle('','{$field}',2);", 'icon' => 'italic.png'); // Italique $buttons[] = array('titre' => CopixI18N::get('wikibuttons.underline'), 'accesskey' => 's', 'tabindex' => 12, 'link' => "javascript:bbstyle('','{$field}',4);", 'icon' => 'underline.png'); // Souligne $buttons[] = array('titre' => CopixI18N::get('wikibuttons.image'), 'accesskey' => 'm', 'tabindex' => 12, 'link' => "javascript:bblink('','{$field}',12);", 'icon' => 'image.png'); // Image $buttons[] = array('titre' => CopixI18N::get('wikibuttons.link'), 'accesskey' => 'l', 'tabindex' => 13, 'link' => "javascript:bblink('','{$field}',8);", 'icon' => 'linkextern.png'); // Lien $buttons[] = array('titre' => CopixI18N::get('wikibuttons.email'), 'accesskey' => 'e', 'tabindex' => 13, 'link' => "javascript:bblink('','{$field}',10);", 'icon' => '../../tpl/default/images/mail_icon.gif'); // Email $buttons[] = array('titre' => CopixI18N::get('wikibuttons.hr'), 'accesskey' => 'h', 'tabindex' => 14, 'link' => "javascript:bbcar('','{$field}',4);", 'icon' => 'hr.png'); // HR $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h1'), 'accesskey' => 'j', 'tabindex' => 15, 'link' => "javascript:bblink('','{$field}',20);", 'icon' => 'h1.png'); // H1 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h2'), 'accesskey' => 'v', 'tabindex' => 16, 'link' => "javascript:bblink('','{$field}',22);", 'icon' => 'h2.png'); // H2 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h3'), 'accesskey' => 'w', 'tabindex' => 17, 'link' => "javascript:bblink('','{$field}',24);", 'icon' => 'h3.png'); // H3 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.ul'), 'accesskey' => 'w', 'tabindex' => 17, 'link' => "javascript:bbcar('','{$field}',5);", 'icon' => 'ul.png'); // UL $buttons[] = array('titre' => CopixI18N::get('wikibuttons.ol'), 'accesskey' => 'w', 'tabindex' => 17, 'link' => "javascript:bbcar('','{$field}',6);", 'icon' => 'ol.png'); // OL break; } if ($object) { $user_type = _currentUser()->getExtra('type'); $user_id = _currentUser()->getExtra('id'); if ('USER' === $object) { Kernel::createMissingModules($user_type, $user_id); $parent = array('type' => $user_type, 'id' => $user_id); } elseif (preg_match('/^MOD_/', $object['type'])) { $parent = Kernel::getModParentInfo($object['type'], $object['id']); } else { $parent = Kernel::getNodeInfo($object['type'], $object['id']); } if ($parent) { $mods = Kernel::getModEnabled($parent['type'], $parent['id']); $alb = Kernel::filterModuleList($mods, 'MOD_ALBUM'); if ($alb && $withAlbum) { $url = CopixUrl::get('album||getpopup', array('album_id' => $alb[0]->module_id, 'field' => $field, 'format' => $format)); $buttonAlbum = array('titre' => CopixI18N::get('wikibuttons.album'), 'accesskey' => 'a', 'tabindex' => 18, 'link' => $url); // Album photos } $mal = Kernel::filterModuleList($mods, 'MOD_MALLE'); if ($mal) { $url = CopixUrl::get('malle|malle|getMallePopup', array('id' => $mal[0]->module_id, 'field' => $field, 'format' => $format)); $buttonMalle = array('titre' => CopixI18N::get('wikibuttons.malleTxt'), 'accesskey' => 'd', 'tabindex' => 19, 'link' => $url); // Malle } $cla = Kernel::filterModuleList($mods, 'MOD_CLASSEUR'); if ($cla) { $url = CopixUrl::get('classeur||getClasseurPopup', array('classeurId' => $cla[0]->module_id, 'field' => $field, 'format' => $format, 'withPersonal' => 1, 'moduleType' => $object['type'], 'moduleId' => $object['id'])); $buttonClasseur = array('titre' => CopixI18N::get('wikibuttons.classeurTxt'), 'accesskey' => 'd', 'tabindex' => 20, 'link' => $url); // Classeur } } } $tpl->assign('format', $format); $tpl->assign('buttons', $buttons); $tpl->assign('buttonAlbum', $buttonAlbum); $tpl->assign('buttonMalle', $buttonMalle); $tpl->assign('buttonClasseur', $buttonClasseur); $tpl->assign('field', $field); $toReturn = $tpl->fetch('wikibuttons.tpl'); } return true; }