public function _createContent(&$toReturn)
 {
     //Getting the user.
     //Create Services, and DAO
     $tpl = new CopixTpl();
     $id_blog = $this->getParam('id_blog', '');
     $tpl->assign('blog', $this->getParam('blog', null));
     $tpl->assign('id_blog', $id_blog);
     $tpl->assign('kind', $this->getParam('kind', ''));
     $tpl->assign('tabBlogFunctions', $this->getParam('tabBlogFunctions', null));
     $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles'));
     $tpl->assign('RESULT', $this->getParam('RESULT', ''));
     $parent = Kernel::getModParentInfo("MOD_BLOG", $id_blog);
     if ($parent) {
         $mods = Kernel::getModEnabled($parent['type'], $parent['id'], '', 0, 1);
         // _dump($mods);
         $mods = Kernel::filterModuleList($mods, 'MOD_MAGICMAIL');
         if (count($mods)) {
             $magicmail_infos = _dao('module_magicmail')->get($mods[0]->module_id);
             $tpl->assign('magicmail_infos', $magicmail_infos);
             // _dump($magicmail_infos);
             /*
                'id' => '32',
                'login' => 'cepapeti',
                'domain' => 'magicmail.iconito.fr',
             */
         }
     }
     // retour de la fonction :
     $toReturn = $tpl->fetch('blog.show.tpl');
     return true;
 }
 /**
  * Affichage d'un forum (ses discussions)
  *
  * Affiche les discussions d'un forum et les informations sur les discussions (titre, dernier message...), avec un lien pour lire chaque discussion.
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2005/11/08
  * @param integer $id Id du forum
  * @param string $orderby Ordre d'affichage (last_msg_date ou date_creation)
  */
 public function getForum()
 {
     $forumService =& CopixClassesFactory::Create('forum|forumService');
     $id = _request("id") ? _request("id") : NULL;
     $orderby = _request("orderby") ? _request("orderby") : NULL;
     if ($orderby != "last_msg_date" && $orderby != "date_creation") {
         $orderby = "last_msg_date";
     }
     $errors = array();
     $dao_forums = CopixDAOFactory::create("forum|forum_forums");
     $dao_topics = CopixDAOFactory::create("forum|forum_topics");
     $forum = $dao_forums->getForum($id);
     if (!count($forum)) {
         $errors[] = CopixI18N::get('forum|forum.error.noForum');
     } else {
         $mondroit = Kernel::getLevel("MOD_FORUM", $id);
         if (!$forumService->canMakeInForum("READ", $mondroit)) {
             $errors[] = CopixI18N::get('kernel|kernel.error.noRights');
         } else {
             $parent = Kernel::getModParentInfo("MOD_FORUM", $id);
             $forum[0]->parent = $parent;
         }
     }
     if ($errors) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get('forum||')));
     } else {
         // Les topics de ce forum
         $page = _request("page") ? _request("page") : 1;
         $offset = ($page - 1) * CopixConfig::get('forum|list_nbtopics');
         $all = $dao_topics->getListTopicsInForumAll($id);
         $nbPages = ceil(count($all) / CopixConfig::get('forum|list_nbtopics'));
         $user = _currentUser()->getId();
         $list = $dao_topics->getListTopicsInForum($id, $offset, CopixConfig::get('forum|list_nbtopics'), $orderby, $user);
         // Pour chaque message on cherche les infos de son createur et du dernier message
         //print_r($list);
         foreach ($list as $k => $topic) {
             $userInfo = Kernel::getUserInfo("ID", $list[$k]->createur);
             $list[$k]->createur_infos = $userInfo["prenom"] . " " . $userInfo["nom"];
             if ($list[$k]->last_msg_auteur) {
                 $userInfo = Kernel::getUserInfo("ID", $list[$k]->last_msg_auteur);
                 $list[$k]->last_msg_auteur_infos = $userInfo["prenom"] . " " . $userInfo["nom"];
             }
             //print_r($infos);
         }
         //print_r($list);
         $tpl = new CopixTpl();
         $tpl->assign('TITLE_PAGE', $forum[0]->parent["nom"]);
         $tplForum = new CopixTpl();
         $tplForum->assign('forum', $forum[0]);
         $tplForum->assign('list', $list);
         $tplForum->assign('page', $page);
         $tplForum->assign('petitpoucet', CopixZone::process('forum|petitpoucet', array('forum' => $forum[0])));
         $tplForum->assign('canAddTopic', $forumService->canMakeInForum('ADD_TOPIC', $mondroit) ? 1 : 0);
         $tplForum->assign('reglettepages', CopixZone::process('kernel|reglettepages', array('page' => $page, 'nbPages' => $nbPages, 'separator' => '&', 'url' => CopixUrl::get('forum||getForum', array("id" => $id, "orderby" => $orderby)))));
         $result = $tplForum->fetch('getforum.tpl');
         $tpl->assign('MAIN', $result);
         return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
     }
 }
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     // Récupération des paramètres
     $ppo->classeurId = $this->getParam('classeurId');
     $ppo->dossierCourant = $this->getParam('dossierCourant');
     // Paramètres pour la vue popup
     $ppo->field = $this->getParam('field');
     $ppo->format = $this->getParam('format');
     $ppo->withPersonal = _sessionGet('user_animateur') ? false : $this->getParam('withPersonal', true);
     $ppo->moduleType = $this->getParam('moduleType', null);
     $ppo->moduleId = $this->getParam('moduleId', null);
     // Récupération des classeurs accessibles à l'utilisateur
     $classeurIds = array();
     // Récupération de ses ressources (obligatoire pour récupérer le classeur personnel)
     $nodes = Kernel::getMyNodes(_currentUser()->getExtra('type'), _currentUser()->getExtra('id'));
     foreach ($nodes as $node) {
         $modules = Kernel::getModEnabled($node->type, $node->id, _currentUser()->getExtra('type'), _currentUser()->getExtra('id'));
         foreach ($modules as $module) {
             if ($module->module_type == 'MOD_CLASSEUR' && Kernel::getLevel('MOD_CLASSEUR', $module->module_id) >= PROFILE_CCV_READ) {
                 // Le module correspond-il au classeur personnel
                 if ($ppo->withPersonal && strpos($module->node_type, 'USER_') !== false && ($module->node_type == _currentUser()->getExtra('type') && $module->node_id == _currentUser()->getExtra('id'))) {
                     $ppo->classeurPersonnel = $module->module_id;
                     $classeurIds[] = $module->module_id;
                 } elseif (null === $ppo->moduleType) {
                     $classeurIds[] = $module->module_id;
                 }
             }
         }
     }
     // Récupération des ressources
     if (null !== $ppo->moduleType) {
         $node = Kernel::getModParentInfo($ppo->moduleType, $ppo->moduleId);
         $modules = Kernel::getModEnabled($node['type'], $node['id'], _currentUser()->getExtra('type'), _currentUser()->getExtra('id'));
         foreach ($modules as $module) {
             if ($module->module_type == 'MOD_CLASSEUR' && Kernel::getLevel('MOD_CLASSEUR', $module->module_id) >= PROFILE_CCV_READ) {
                 $classeurIds[] = $module->module_id;
             }
         }
     }
     // Dédoublonnage des classeurs (responsables avec plusieurs enfants)
     $classeurIds = array_unique($classeurIds);
     $ppo->classeurs = array();
     $classeurDAO = _dao("classeur|classeur");
     foreach ($classeurIds as $classeurId) {
         $classeur = $classeurDAO->get($classeurId);
         $classeur->titre = $classeur->realName();
         $ppo->classeurs[] = $classeur;
     }
     _classInclude('classeurservice');
     $ppo->classeursOuverts = ClasseurService::getClasseursTreeState();
     if (!is_array($ppo->classeursOuverts)) {
         $ppo->classeursOuverts = array();
     }
     $this->flash->addCycle();
     $toReturn = $this->_usePPO($ppo, '_arborescence_classeurs.tpl');
 }
 /**
  * Liste des teleprocedures
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2008/01/30
  * @param integer $id Id du module
  */
 public function processListTeleprocedures()
 {
     $id = $this->getRequest('id', null);
     $motcle = _request("motcle");
     $type = _request("type");
     $clos = _request("clos");
     $ecole = _request("ecole");
     $dao = CopixDAOFactory::create("teleprocedures|teleprocedure");
     $rTelep = $dao->get($id);
     $criticErrors = array();
     if (!$rTelep) {
         $criticErrors[] = CopixI18N::get('teleprocedures|teleprocedures.error.noParameter');
     } else {
         $mondroit = Kernel::getLevel("MOD_TELEPROCEDURES", $id);
         if (!TeleproceduresService::canMakeInTelep('VIEW', $mondroit)) {
             $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights');
         } else {
             $parent = Kernel::getModParentInfo("MOD_TELEPROCEDURES", $id);
             $rTelep->parent = $parent;
         }
     }
     //print_r($rTelep);
     if ($criticErrors) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('||')));
     }
     $title = $rTelep->parent["nom"];
     $ville = $rTelep->parent["id"];
     $rBlog = TeleproceduresService::checkIfBlogExists($rTelep);
     $canInsert = TeleproceduresService::canMakeInTelep('ADD_INTERVENTION', $mondroit);
     $canViewBlog = TeleproceduresService::canMakeInTelep('VIEW_BLOG', $mondroit);
     if (!TeleproceduresService::canMakeInTelep('VIEW_COMBO_ECOLES', $mondroit)) {
         $ecole = null;
     }
     $tplListe = new CopixTpl();
     $tplListe->assign('filtre', CopixZone::process('filtre', array('rTelep' => $rTelep, 'motcle' => $motcle, 'clos' => $clos, 'type' => $type, 'ecole' => $ecole, 'mondroit' => $mondroit)));
     $tplListe->assign('list', CopixZone::process('list', array('rTelep' => $rTelep, 'motcle' => $motcle, 'clos' => $clos, 'type' => $type, 'ecole' => $ecole, 'mondroit' => $mondroit)));
     $tplListe->assign('types', CopixZone::process('types', array('rTelep' => $rTelep, 'canInsert' => $canInsert)));
     if ($canViewBlog && $rBlog) {
         $tplListe->assign("infosVille", CopixZone::process('welcome|Actualites', array('blog' => $rBlog->url_blog, 'nb' => 3, 'colonnes' => 1, 'chapo' => true, 'hreflib' => CopixI18N::get('teleprocedures.blog.infosVille.viewAll'), 'hr' => true)));
         $tplListe->assign("pagesVille", CopixZone::process('welcome|Pages', array('blog' => $rBlog->url_blog, 'nb' => 3, 'content' => true, 'hr' => true)));
     }
     $main = $tplListe->fetch('list.tpl');
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', $title);
     $MENU = array();
     if (TeleproceduresService::canMakeInTelep('ADMIN', $mondroit)) {
         $MENU[] = array('txt' => CopixI18N::get('teleprocedures|teleprocedures.admin'), 'type' => '', 'url' => CopixUrl::get('admin|admin', array('id' => $rTelep->id)));
     }
     $tpl->assign("MENU", $MENU);
     $tpl->assign("MAIN", $main);
     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)
 {
     $res = '';
     $blog = $this->getParam('blog', null);
     $editFile = $this->getParam('editFile', false);
     $hisFile = COPIX_VAR_PATH . CopixConfig::get('blog|cssPath') . $blog->id_blog . '.css';
     if (file_exists($hisFile) && ($blog->style_blog_file == 1 || $editFile)) {
         // CSS personnalisée
         $file = $hisFile;
     } else {
         // CSS de base
         //$file = COPIX_WWW_PATH.CopixConfig::get ('blog|cssPath').$blog->logo_blog;
         $parent = Kernel::getModParentInfo("MOD_BLOG", $blog->id_blog);
         //print_r($parent);
         switch ($parent['type']) {
             case 'BU_CLASSE':
                 $file = 'styles/module_blog_classe.css';
                 break;
             case 'BU_VILLE':
                 $file = 'styles/module_blog_ville.css';
                 break;
             case 'BU_ECOLE':
                 $file = 'styles/module_blog_ecole.css';
                 break;
             case 'BU_GRVILLE':
                 $file = 'styles/module_blog_grville.css';
                 break;
             default:
                 $file = 'styles/module_blog_groupe.css';
                 break;
         }
     }
     //print_r("file=$file");
     if (file_exists($file)) {
         $res = file_get_contents($file);
     }
     // retour de la fonction :
     $toReturn = $res;
     return true;
 }
 public function _createContent(&$toReturn)
 {
     //Getting the user.
     //Create Services, and DAO
     $tpl = new CopixTpl();
     $id_blog = $this->getParam('id_blog', '');
     //capability
     //$tpl->assign ('canManageDocument' , BlogAuth::canMakeInBlog('ADMIN_DOCUMENTS',create_blog_object($id_blog)));
     // On regarde si le parent a un album photos
     $parent = Kernel::getModParentInfo("MOD_BLOG", $id_blog);
     //print_r($parent);
     if ($parent) {
         $mods = Kernel::getModEnabled($parent['type'], $parent['id']);
         $mods = Kernel::filterModuleList($mods, 'MOD_MALLE');
         if ($mods) {
             $tpl->assign('album', $mods[0]->module_id);
         }
     }
     $tpl->assign('id_blog', $id_blog);
     $tpl->assign('kind', $this->getParam('kind', ''));
     // retour de la fonction :
     $toReturn = $tpl->fetch('blog.show.document.tpl');
     return true;
 }
 public function realName()
 {
     $node = Kernel::getModParentInfo("MOD_CLASSEUR", $this->id);
     switch ($node['type']) {
         case "CLUB":
             return $node['nom'];
             break;
         case "BU_GRVILLE":
             return $node['nom_groupe'];
             break;
         case "BU_VILLE":
             return $node['nom'];
             break;
         case "BU_ECOLE":
             return $node['nom'];
             break;
         case "BU_CLASSE":
             return $node['nom'];
             break;
         default:
             return $this->titre;
             break;
     }
 }
 /**
  * Validation d'un commentaire.
  */
 public function doValidComment()
 {
     if (Kernel::isSpam()) {
         return new CopixActionReturn(CopixActionReturn::HTTPCODE, CopixHTTPHeader::get404(), "Page introuvable");
     }
     $url_bact = _request('url_bact');
     //On verifit que le blog existe (on r�cup�re le blog avec son nom)
     $dao = CopixDAOFactory::create('blog|blog');
     if (!($blog = $dao->getBlogByName(_request('blog')))) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.unableToFindBlog'), 'back' => CopixUrl::get('')));
     }
     // On v�rifie que le droit de lecture est pr�sent
     if (!BlogAuth::canMakeInBlog('READ', $blog)) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get('')));
     }
     if (!$blog->has_comments_activated) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.add.comment.closed'), 'back' => CopixUrl::get('', array('blog' => _request('blog')))));
     }
     $id_bact = $this->getRequest('id_bact', null);
     if (!BlogAuth::canComment($blog->id_blog)) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotManageComment'), 'back' => CopixUrl::get('', array('blog' => _request('blog')))));
     }
     $tpl = new CopixTpl();
     $commentDAO = CopixDAOFactory::create('blog|blogarticlecomment');
     $comment = CopixDAOFactory::createRecord('blog|blogarticlecomment');
     $this->_validFromPostProperties($comment);
     $comment->date_bacc = date('Ymd');
     $comment->time_bacc = date('Hi');
     $comment->is_online = $blog->type_moderation_comments != 'POST' ? 0 : 1;
     $comment->authorip_bacc = $_SERVER["REMOTE_ADDR"];
     CopixHTMLHeader::addCSSLink(CopixUrl::get('blog||getBlogCss', array('id_blog' => $blog->id_blog)));
     $tpl->assign('blog', $blog);
     $errors = $commentDAO->check($comment);
     //print_r($comment);
     $showErrors = false;
     if ($errors != 1) {
         // Traitement des erreurs
         $showErrors = true;
     } else {
         // Insertion dans la base
         $commentDAO->insert($comment);
     }
     $zoneArticle = CopixZone::process('ShowArticle', array('blog' => $blog, 'article' => $this->getRequest('article', ''), 'errors' => $errors, 'showErrors' => $showErrors, 'comment' => $comment));
     list($title, $article) = explode("{/}", $zoneArticle);
     $tpl->assign('TITLE_PAGE', $title . ' - ' . $blog->name_blog);
     $tpl->assign('Article', $article);
     $tpl->assign('ListLink', CopixZone::process('ListLink', array('blog' => $blog)));
     $tpl->assign('ListCategory', CopixZone::process('ListCategory', array('blog' => $blog)));
     $tpl->assign('ListArchive', CopixZone::process('ListArchive', array('blog' => $blog)));
     $tpl->assign('ListPage', CopixZone::process('ListPage', array('blog' => $blog)));
     $tpl->assign('ListSearch', CopixZone::process('ListSearch', array('blog' => $blog)));
     if (!$showErrors) {
         if ($comment->is_online == 1) {
             return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog||showArticle', array('blog' => urlencode($blog->url_blog), 'article' => _request('article'))) . '#comments');
         } else {
             return CopixActionGroup::process('genericTools|Messages::getInformation', array('message' => CopixI18N::get('blog.comments.offline.info'), 'continue' => CopixUrl::get('blog|default|showArticle', array('blog' => $blog->url_blog, 'article' => $url_bact))));
         }
     }
     //		$menu = array();
     $parent = Kernel::getModParentInfo("MOD_BLOG", $blog->id_blog);
     //print_r($parent);
     $blog->parent = $parent;
     /*
             if ($parent['type']=='CLUB') {
                 $droit = Kernel::getLevel($parent['type'], $parent['id']);
                 //print_r($droit);
                 if (GroupeService::canMakeInGroupe('VIEW_HOME', $droit))
                     $menu[] = array('url'=>CopixUrl::get ('groupe||getHome', array("id"=>$parent['id'])), 'txt'=>CopixI18N::get ('blog.menuToGroup'));
             }
             if (BlogAuth::canMakeInBlog('ACCESS_ADMIN',$blog))
                 $menu[] = array('url'=>CopixUrl::get ('admin|showBlog', array("id_blog"=>$blog->id_blog)), 'txt'=>CopixI18N::get ('blog.menuAdmin'));
     */
     //print_r($menu);
     $menu = array();
     if (BlogAuth::canMakeInBlog('ACCESS_ADMIN', $blog)) {
         $menu = getBlogAdminMenu($blog);
     }
     $tpl->assign('MENU', $menu);
     CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('blog||rss', array("blog" => $blog->url_blog)) . '" type="application/rss+xml" title="' . htmlentities($blog->name_blog) . '" />');
     if ($blog->template) {
         $MAIN = $tpl->fetch($blog->template);
     } else {
         $MAIN = $tpl->fetch('blog_main.tpl');
     }
     $tpl->assign('MAIN', $MAIN);
     $tpl->assign('HEADER_MODE', 'compact');
     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;
 }
 /**
  * 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);
 }
 /**
  * Publication de l'album
  *
  * Copie les fichiers image et vignette, et g�n�re le fichier XML pour SimpleViewer
  *
  * @author Fr�d�ric Mossmann <*****@*****.**>
  */
 public function doPublier()
 {
     $kernel_service =& CopixClassesFactory::Create('kernel|kernel');
     if (!_request("album_id") || trim(_request("album_id")) == "" || !preg_match("/^[0-9]+\$/", _request("album_id"))) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('album.error.noalbumnumber'), 'back' => CopixUrl::get('||')));
     }
     $album_id = _request("album_id");
     if (Kernel::getLevel("MOD_ALBUM", $album_id) < PROFILE_CCV_PUBLISH) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get('||')));
     }
     $album_dao = CopixDAOFactory::create("album");
     $album = $album_dao->get($album_id);
     if (_request("dossier_id") && preg_match("/^[0-9]+\$/", _request("dossier_id"))) {
         $dossier_id = _request("dossier_id");
     } else {
         $dossier_id = 0;
     }
     $dossier_dao = CopixDAOFactory::create("dossier");
     if ($dossier_id > 0) {
         $dossier = $dossier_dao->get($dossier_id);
     } else {
         $dossier->dossier_id = 0;
         $dossier->dossier_album = $album_id;
         $dossier->dossier_parent = -1;
         $dossier->dossier_nom = CopixI18N::get('album|album.message.topfolder');
         $dossier->dossier_comment = "";
         $dossier->album_id = $album_id;
     }
     $path2data = realpath("static");
     $path2album = $path2data . "/album/" . $album_id . "_" . $album->album_cle;
     if ($dossier_id > 0) {
         $path2public = $path2album . "/" . $dossier->dossier_id . "_" . $dossier->dossier_cle;
         if (!is_dir($path2public)) {
             mkdir($path2public, 0775);
         }
         @chmod($path2public, 0775);
     } else {
         $path2public = $path2album;
     }
     $parent = Kernel::getModParentInfo("MOD_ALBUM", $album_id);
     $publ_size = CopixConfig::exists('album|photo_publ_size') ? CopixConfig::get('album|photo_publ_size') : 640;
     $file_xml = fopen($path2public . '/imageData.xml', 'w');
     $tplXml = new CopixTpl();
     $tplXml->assign("publ_size", $publ_size);
     $tplXml->assign("album_id", $album_id);
     $tplXml->assign("album_key", $album->album_cle);
     $tplXml->assign("album_titre", $parent['nom']);
     $tplXml->assign("dossier_id", $dossier_id);
     if (isset($dossier->dossier_cle)) {
         $tplXml->assign("dossier_key", $dossier->dossier_cle);
     }
     if (isset($dossier->dossier_nom)) {
         $tplXml->assign("dossier_titre", $dossier->dossier_nom);
     }
     $photo_dao = CopixDAOFactory::create("photo");
     // $photolist = $photo_dao->findAllByAlbum($album_id);
     $photolist = $photo_dao->findAllByAlbumAndFolder($album_id, $dossier_id);
     $tplXml->assign("photolist", $photolist);
     if (!is_dir($path2public . '/images/')) {
         mkdir($path2public . '/images/', 0775);
     }
     if (!is_dir($path2public . '/thumbs/')) {
         mkdir($path2public . '/thumbs/', 0775);
     }
     @chmod($path2public . '/images/', 0775);
     @chmod($path2public . '/thumbs/', 0775);
     foreach ($photolist as $photo) {
         Album::createThumbnail($photo->album_id . '_' . $photo->album_cle, $photo->photo_id . '_' . $photo->photo_cle, $photo->photo_ext, "s64", false, 'jpg');
         Album::createThumbnail($photo->album_id . '_' . $photo->album_cle, $photo->photo_id . '_' . $photo->photo_cle, $photo->photo_ext, $publ_size, false, 'jpg');
         copy($path2album . '/' . $photo->photo_id . '_' . $photo->photo_cle . '_' . $publ_size . '.jpg', $path2public . '/images/' . $photo->photo_id . '_' . $photo->photo_cle . '.jpg');
         copy($path2album . '/' . $photo->photo_id . '_' . $photo->photo_cle . '_s64.jpg', $path2public . '/thumbs/' . $photo->photo_id . '_' . $photo->photo_cle . '.jpg');
     }
     $result = $tplXml->fetch("simpleviewer_xml.tpl");
     fwrite($file_xml, $result);
     fclose($file_xml);
     $file_html = fopen($path2public . '/index.html', 'w');
     $tplHtml = new CopixTpl();
     $tplHtml->assign("album_id", $album_id);
     $tplHtml->assign("album_key", $album->album_cle);
     $tplHtml->assign("album_titre", $parent['nom']);
     $tplHtml->assign("dossier_id", $dossier_id);
     if (isset($dossier->dossier_cle)) {
         $tplHtml->assign("dossier_key", $dossier->dossier_cle);
     }
     if (isset($dossier->dossier_nom)) {
         $tplHtml->assign("dossier_nom", $dossier->dossier_nom);
     }
     $result = $tplHtml->fetch("simpleviewer_html.tpl");
     fwrite($file_html, $result);
     fclose($file_html);
     return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('album|default|album', array('album_id' => $album_id, 'dossier_id' => $dossier_id)));
 }
 /**
  * Edition d'un mémo - * Enseignant *
  */
 public function processEditerMemo()
 {
     $ppo = new CopixPPO();
     if (is_null($ppo->cahierId = _request('cahierId', null))) {
         return CopixActionGroup::process('generictools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.errorOccurred'), 'back' => CopixUrl::get('')));
     } elseif (Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId) < PROFILE_CCV_PUBLISH) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get('')));
     }
     // Récupération des paramètres
     $ppo->jour = _request('jour', date('d'));
     $ppo->mois = _request('mois', date('m'));
     $ppo->annee = _request('annee', date('Y'));
     $ppo->msgSuccess = _request('msgSuccess', false);
     $ppo->dateSelectionnee = mktime(0, 0, 0, $ppo->mois, $ppo->jour, $ppo->annee);
     $ppo->format = CopixConfig::get('cahierdetextes|format_par_defaut');
     $cahierInfos = Kernel::getModParent('MOD_CAHIERDETEXTES', $ppo->cahierId);
     $ppo->nodeInfos = array('type' => $cahierInfos[0]->module_type, 'id' => $cahierInfos[0]->module_id);
     if (is_null($memoId = _request('memoId', null))) {
         $ppo->memo = _record('cahierdetextes|cahierdetextesmemo');
     } else {
         $memoDAO = _ioDAO('cahierdetextes|cahierdetextesmemo');
         $ppo->memo = $memoDAO->get($memoId);
         $ppo->memo->date_creation = CopixDateTime::yyyymmddToDate($ppo->memo->date_creation);
         $ppo->memo->date_validite = CopixDateTime::yyyymmddToDate($ppo->memo->date_validite);
         $ppo->memo->date_max_signature = CopixDateTime::yyyymmddToDate($ppo->memo->date_max_signature);
         // Récupération des élèves liés au mémo
         $memo2eleveDAO = _ioDAO('cahierdetextes|cahierdetextesmemo2eleve');
         $ppo->elevesSelectionnes = $memo2eleveDAO->findElevesParMemo($ppo->memo->id);
         // Récupération des fichiers liés au mémo
         $fichierMalleDAO = _ioDAO('malle|malle_files');
         $fichierClasseurDAO = _ioDAO('classeur|classeurfichier');
         $memo2fichiersDAO = _ioDAO('cahierdetextes|cahierdetextesmemo2files');
         $memo2fichiers = $memo2fichiersDAO->retrieveByMemo($ppo->memo->id);
         $ppo->fichiers = array();
         $fichiers = array();
         foreach ($memo2fichiers as $memo2fichier) {
             if ($memo2fichier->module_file == 'MOD_MALLE') {
                 if ($fichier = $fichierMalleDAO->get($memo2fichier->file_id)) {
                     $ppo->fichiers[] = array('type' => $memo2fichier->module_file, 'id' => $memo2fichier->file_id, 'nom' => $fichier->nom);
                 }
             } elseif ($memo2fichier->module_file == 'MOD_CLASSEUR') {
                 if ($fichier = $fichierClasseurDAO->get($memo2fichier->file_id)) {
                     $ppo->fichiers[] = array('type' => $memo2fichier->module_file, 'id' => $memo2fichier->file_id, 'nom' => $fichier);
                 }
             }
         }
     }
     if (CopixRequest::isMethod('post')) {
         $cahierInfos = Kernel::getModParent('MOD_CAHIERDETEXTES', $ppo->cahierId);
         $ppo->memo->classe_id = $cahierInfos[0]->node_id;
         $ppo->memo->date_creation = CopixDateTime::dateToyyyymmdd(_request('memo_date_creation', null));
         $ppo->memo->date_validite = CopixDateTime::dateToyyyymmdd(_request('memo_date_validite', null));
         $ppo->memo->message = _request('memo_message', null);
         $ppo->memo->avec_signature = _request('memo_avec_signature', 0);
         $ppo->memo->date_max_signature = CopixDateTime::dateToyyyymmdd(_request('memo_date_max_signature', null));
         $ppo->memo->supprime = 0;
         $ppo->elevesSelectionnes = _request('eleves', array());
         $ppo->fichiers = _request('memo_fichiers', array());
         // Traitement des erreurs
         $ppo->erreurs = array();
         if ($ppo->memo->date_creation == '') {
             $ppo->erreurs[] = CopixI18N::get('cahierdetextes|cahierdetextes.error.noCreationDate');
         }
         if ($ppo->memo->date_validite == '') {
             $ppo->erreurs[] = CopixI18N::get('cahierdetextes|cahierdetextes.error.noValidityDate');
         }
         if (!is_null($ppo->memo->date_validite) && $ppo->memo->date_validite < $ppo->memo->date_creation) {
             $ppo->erreurs[] = CopixI18N::get('cahierdetextes|cahierdetextes.error.wrongValidityDate');
         }
         if ($ppo->memo->message == '') {
             $ppo->erreurs[] = CopixI18N::get('cahierdetextes|cahierdetextes.error.noContent');
         }
         if ($ppo->memo->avec_signature && $ppo->memo->date_max_signature == '') {
             $ppo->erreurs[] = CopixI18N::get('cahierdetextes|cahierdetextes.error.noSignatureDate');
         }
         if (!is_null($ppo->memo->date_max_signature) && !is_null($ppo->memo->date_validite) && ($ppo->memo->date_max_signature > $ppo->memo->date_validite || $ppo->memo->date_max_signature < $ppo->memo->date_creation)) {
             $ppo->erreurs[] = CopixI18N::get('cahierdetextes|cahierdetextes.error.wrongMaxSignatureDate');
         }
         if (empty($ppo->elevesSelectionnes)) {
             $ppo->erreurs[] = CopixI18N::get('cahierdetextes|cahierdetextes.error.noStudents');
         }
         if (!empty($ppo->fichiers)) {
             $ppo->fichiers = array_unique($ppo->fichiers);
             // Récupération de l'identifiant de la malle du node
             $mods = Kernel::getModEnabled($cahierInfos[0]->node_type, $cahierInfos[0]->node_id);
             if ($malle = Kernel::filterModuleList($mods, 'MOD_MALLE')) {
                 $malleId = $malle[0]->module_id;
             }
             // Récupération des identifiants de classeur
             $classeurIds = array();
             // Classeur du node
             $mods = Kernel::getModEnabled($cahierInfos[0]->node_type, $cahierInfos[0]->node_id);
             if ($classeur = Kernel::filterModuleList($mods, 'MOD_CLASSEUR')) {
                 $classeurIds[] = $classeur[0]->module_id;
             }
             // Classeur personnel
             $mods = Kernel::getModEnabled(_currentUser()->getExtra('type'), _currentUser()->getExtra('id'));
             if ($classeur = Kernel::filterModuleList($mods, 'MOD_CLASSEUR')) {
                 $classeurIds[] = $classeur[0]->module_id;
             }
             // On détermine s'il s'agit de documents de la malle ou du classeur
             foreach ($ppo->fichiers as $fichierInfos) {
                 $fichierInfos = explode('-', $fichierInfos);
                 if ($fichierInfos[0] == 'MOD_MALLE') {
                     // Erreur : le fichier n'appartient pas à la malle du node
                     if (!$fichierMalleDAO->isFileOfMalle($fichierInfos[1], $malleId)) {
                         $ppo->erreurs[] = CopixI18N::get('cahierdetextes|cahierdetextes.error.invalidFile');
                         break;
                     } else {
                         $fichier = $fichierMalleDAO->get($fichierInfos[1]);
                         $fichiers[] = array('type' => $fichierInfos[0], 'id' => $fichierInfos[1], 'nom' => $fichier->nom);
                     }
                 } elseif ($fichierInfos[0] == 'MOD_CLASSEUR') {
                     $fichier = $fichierClasseurDAO->get($fichierInfos[1]);
                     // Erreur : le fichier n'appartient pas aux classeurs disponible à l'utilisateur
                     if (!in_array($fichier->classeur_id, $classeurIds)) {
                         $ppo->erreurs[] = CopixI18N::get('cahierdetextes|cahierdetextes.error.invalidFile');
                         break;
                     } else {
                         $fichiers[] = array('type' => $fichierInfos[0], 'id' => $fichierInfos[1], 'nom' => $fichier);
                     }
                 }
             }
         }
         if (!empty($ppo->erreurs)) {
             $ppo->memo->date_creation = _request('memo_date_creation', null);
             $ppo->memo->date_validite = _request('memo_date_validite', null);
             $ppo->memo->date_max_signature = _request('memo_date_max_signature', null);
             if (isset($fichiers)) {
                 $ppo->fichiers = $fichiers;
             }
             $modParentInfo = Kernel::getModParentInfo('MOD_CAHIERDETEXTES', $ppo->cahierId);
             $ppo->TITLE_PAGE = $modParentInfo['nom'];
             return _arPPO($ppo, 'editer_memo.tpl');
         }
         $memoDAO = _ioDAO('cahierdetextes|cahierdetextesmemo');
         $memo2eleveDAO = _ioDAO('cahierdetextes|cahierdetextesmemo2eleve');
         $memo2fichierDAO = _ioDAO('cahierdetextes|cahierdetextesmemo2files');
         // Création
         if ($ppo->memo->id == '') {
             // Insertion de l'enregistrement "memo"
             $memoDAO->insert($ppo->memo);
         } else {
             // Mise à jour de l'enregistrement "memo"
             $memoDAO->update($ppo->memo);
             // Suppression des relations memo - eleves existantes
             $memo2eleveDAO->deleteByMemo($ppo->memo->id);
             // Suppression des relations memo - fichiers existantes
             $memo2fichierDAO->deleteByMemo($ppo->memo->id);
         }
         // Insertion des nouveaux liens memo > eleve
         foreach ($ppo->elevesSelectionnes as $eleveId) {
             $memo2eleve = _record('cahierdetextes|cahierdetextesmemo2eleve');
             $memo2eleve->memo_id = $ppo->memo->id;
             $memo2eleve->eleve_id = $eleveId;
             $memo2eleveDAO->insert($memo2eleve);
         }
         // Insertion des liens "mémo > fichiers"
         if (!empty($fichiers)) {
             foreach ($fichiers as $fichier) {
                 $memo2fichier = _record('cahierdetextes|cahierdetextesmemo2files');
                 $memo2fichier->memo_id = $ppo->memo->id;
                 $memo2fichier->module_file = $fichier['type'];
                 $memo2fichier->file_id = $fichier['id'];
                 $memo2fichierDAO->insert($memo2fichier);
             }
         }
         return _arRedirect(CopixUrl::get('cahierdetextes||voirMemos', array('cahierId' => $ppo->cahierId, 'msgSuccess' => CopixI18N::get('cahierdetextes|cahierdetextes.message.success'))));
     }
     $modParentInfo = Kernel::getModParentInfo('MOD_CAHIERDETEXTES', $ppo->cahierId);
     $ppo->TITLE_PAGE = $modParentInfo['nom'];
     return _arPPO($ppo, 'editer_memo.tpl');
 }
 /**
  * Préparation de l'édition d'un blog.
  */
 public function processGetShowBlog()
 {
     $id_blog = $this->getRequest('id_blog', null);
     $blogDAO = CopixDAOFactory::create('blog|blog');
     $blog = $blogDAO->get($id_blog);
     if (!BlogAuth::canMakeInBlog('ACCESS_ADMIN', $blog)) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotManageBlog'), 'back' => $blog ? CopixUrl::get('|', array('blog' => $blog->url_blog)) : CopixUrl::get('||')));
     }
     if ($id_blog == null) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.param'), 'back' => CopixUrl::get('||')));
     }
     $kind = $this->getRequest('kind', '0');
     $tpl = new CopixTpl();
     $tabBlogFunctions = null;
     $result = null;
     if ($kind == '0') {
         // Articles
         CopixHTMLHeader::addCSSLink(_resource("styles/module_blog.css"));
         $selectCategory = $this->getRequest('selectCategory', '');
         $selectMonth = $this->getRequest('selectMonth', '');
         $id_bact = $this->getRequest('id_bact', '');
         $result = CopixZone::process('ShowBlogArticle', array('id_blog' => $id_blog, 'blog' => $blog, 'kind' => $kind, 'selectCategory' => $selectCategory, 'selectMonth' => $selectMonth, 'id_bact' => $id_bact, 'p' => $this->getRequest('p', '')));
     } else {
         if ($kind == '1') {
             // Catégories
             $result = CopixZone::process('ShowBlogCategory', array('id_blog' => $id_blog, 'kind' => $kind));
         } else {
             if ($kind == '2') {
                 // Liens
                 $result = CopixZone::process('ShowBlogLink', array('id_blog' => $id_blog, 'kind' => $kind));
             } else {
                 if ($kind == '3') {
                     // Photos
                     $can = BlogAuth::canMakeInBlog('ADMIN_PHOTOS', $blog);
                     if ($can) {
                         $parent = Kernel::getModParentInfo("MOD_BLOG", $id_blog);
                         if ($parent) {
                             $mods = Kernel::getModEnabled($parent['type'], $parent['id']);
                             $mods = Kernel::filterModuleList($mods, 'MOD_ALBUM');
                             if ($mods && $mods[0]) {
                                 return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('album||go', array('id' => $mods[0]->module_id)));
                             }
                         }
                     }
                     // Si on arrive là, c'est pas normal
                     $result = CopixZone::process('ShowBlogPhoto', array('id_blog' => $id_blog, 'kind' => $kind));
                 } else {
                     if ($kind == '7') {
                         // Documents
                         $can = BlogAuth::canMakeInBlog('ADMIN_DOCUMENTS', $blog);
                         if ($can) {
                             $parent = Kernel::getModParentInfo("MOD_BLOG", $id_blog);
                             if ($parent) {
                                 $mods = Kernel::getModEnabled($parent['type'], $parent['id']);
                                 $mods = Kernel::filterModuleList($mods, 'MOD_MALLE');
                                 if ($mods && $mods[0]) {
                                     return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('malle||go', array('id' => $mods[0]->module_id)));
                                 }
                             }
                         }
                         // Si on arrive là, c'est pas normal
                         $result = CopixZone::process('ShowBlogDocument', array('id_blog' => $id_blog, 'kind' => $kind));
                     } else {
                         if ($kind == '5') {
                             // Pages
                             $result = CopixZone::process('ShowBlogPage', array('id_blog' => $id_blog, 'kind' => $kind));
                         } else {
                             if ($kind == '6') {
                                 // RSS
                                 $result = CopixZone::process('ShowBlogFluxRss', array('id_blog' => $id_blog, 'kind' => $kind));
                             } else {
                                 if ($kind == '8') {
                                     // Droits particuliers sur le blog
                                     $result = CopixZone::process('ShowBlogDroits', array('blog' => $blog, 'kind' => $kind, 'errors' => $this->getRequest('errors'), 'membres' => $this->getRequest('membres'), 'droit' => $this->getRequest('droit')));
                                 } else {
                                     if ($kind == '9') {
                                         // Stats du blog
                                         $result = CopixZone::process('stats|module', array('module_type' => 'MOD_BLOG', 'module_id' => $id_blog, 'date' => $this->getRequest('date'), 'mois' => $this->getRequest('mois'), 'annee' => $this->getRequest('annee'), 'url' => CopixUrl::get('blog|admin|showBlog', array("id_blog" => $id_blog, "kind" => $kind)), 'errors' => $this->getRequest('errors')));
                                     } else {
                                         // Options
                                         $kind = 4;
                                         $tabFunctions = returnAllBlogFunctions();
                                         $blogFunctionsDAO = CopixDAOFactory::create('blog|blogfunctions');
                                         $resBlogFunctions = $blogFunctionsDAO->get($id_blog);
                                         $tabBlogFunctions = array();
                                         if ($resBlogFunctions != null) {
                                             foreach ($tabFunctions as $fct) {
                                                 eval('if($resBlogFunctions->' . $fct->value . '==\'1\')array_push($tabBlogFunctions, $fct);');
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $menu = getBlogAdminMenu($blog, $kind);
     $tpl->assign('TITLE_PAGE', $blog->name_blog);
     $tpl->assign('MENU', $menu);
     // _dump($blog);
     $tpl->assign('MAIN', CopixZone::process('ShowBlog', array('id_blog' => $id_blog, 'blog' => $blog, 'kind' => $kind, 'tabBlogFunctions' => $tabBlogFunctions, 'RESULT' => $result)));
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 /**
  * Edition d'un album public
  */
 public function processEditerAlbumPublic()
 {
     $classeurDAO = _ioDAO('classeur|classeur');
     if (is_null($ppo->classeur = $classeurDAO->get(_request('classeurId', null)))) {
         return CopixActionGroup::process('generictools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.errorOccurred'), 'back' => CopixUrl::get('')));
     } elseif (Kernel::getLevel('MOD_CLASSEUR', $ppo->classeur->id) < PROFILE_CCV_MODERATE) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get('classeur||voirContenu', array('classeurId' => $ppo->classeur->id))));
     }
     $ppo->confirmMessage = _request('confirmMessage', null);
     _classInclude('classeur|classeurservice');
     $dossierDAO = _ioDAO('classeur|classeurdossier');
     $fichierDAO = _ioDAO('classeur|classeurfichier');
     if (($ppo->dossierId = _request('dossierId', 0)) != 0) {
         $ppo->dossier = $dossierDAO->get($ppo->dossierId);
         if ($ppo->dossier->casier) {
             return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('classeur|classeur.error.albumLocker'), 'back' => CopixUrl::get('classeur||voirContenu', array('classeurId' => $ppo->classeur->id, 'dossierId' => $ppo->dossier->id))));
         }
         $ppo->album = $ppo->dossier;
         if ($ppo->album->public == 1) {
             $ppo->albumUrl = CopixUrl::get() . 'static/classeur/' . $ppo->classeur->id . '-' . $ppo->classeur->cle . '/' . $ppo->album->id . '-' . $ppo->album->cle . '/index.html';
         }
     } else {
         $ppo->album = $ppo->classeur;
         if ($ppo->album->public == 1) {
             $ppo->albumUrl = CopixUrl::get() . 'static/classeur/' . $ppo->album->id . '-' . $ppo->album->cle . '/index.html';
         }
     }
     $ppo->images = array();
     $ppo->documents = array();
     $ppo->fichiers = classeurService::getFilesInFolder($ppo->classeur->id, $ppo->dossierId);
     foreach ($ppo->fichiers as $fichier) {
         if ($fichier->estUneImage()) {
             $ppo->images[] = $fichier;
         } else {
             $ppo->documents[] = $fichier;
         }
     }
     $modParentInfo = Kernel::getModParentInfo('MOD_CLASSEUR', $ppo->classeur->id);
     $ppo->TITLE_PAGE = $modParentInfo['nom'];
     return _arPPO($ppo, array('template' => 'editer_album_public.tpl'));
 }
 /**
  * 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;
 }