/**
  * Affiche la liste des messages envoy�s pour l'utilisateur connect�
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2005/10/18
  */
 public function getListSend()
 {
     $this->addJs('js/iconito/module_minimail.js');
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', CopixI18N::get('minimail.mess_send'));
     $menu = array();
     $menu[] = array('txt' => CopixI18N::get('minimail.mess_recv'), 'url' => CopixUrl::get('minimail||getListRecv'));
     $menu[] = array('txt' => CopixI18N::get('minimail.mess_send'), 'url' => CopixUrl::get('minimail||getListSend'), 'current' => true);
     $menu[] = array('txt' => CopixI18N::get('minimail.mess_write'), 'url' => CopixUrl::get('minimail||getNewForm'));
     $tpl->assign('MENU', $menu);
     $tplListe = new CopixTpl();
     $messagesAll = _ioDAO("minimail_from")->getListSendAll(_currentUser()->getId());
     if (count($messagesAll)) {
         $params = array('perPage' => intval(CopixConfig::get('minimail|list_nblines')), 'delta' => 5, 'recordSet' => $messagesAll, 'template' => '|pager.tpl');
         $Pager = CopixPager::Load($params);
         $tplListe->assign('pager', $Pager->GetMultipage());
         $list = $Pager->data;
         // Infos des utilisateurs sur les messages a afficher
         foreach ($list as $k => $null) {
             $dest = _ioDAO("minimail_to")->selectDestFromId($list[$k]->id);
             foreach ($dest as $j => $null) {
                 //print_r($dest[$j]->to_id);
                 $userInfo = Kernel::getUserInfo("ID", $dest[$j]->to_id);
                 $dest[$j]->to = $userInfo;
                 $dest[$j]->to_id_infos = $userInfo["prenom"] . " " . $userInfo["nom"] . " (" . $userInfo["login"] . ")";
             }
             $list[$k]->destin = $dest;
         }
         $tplListe->assign('list', $list);
     }
     $result = $tplListe->fetch("getlistsend.tpl");
     $tpl->assign("MAIN", $result);
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 function _createContent(&$toReturn)
 {
     $tpl =& new CopixTpl();
     $dao =& CopixDAOFactory::create('Comment');
     $sp =& CopixDAOFactory::createSearchConditions();
     $sp->addCondition('id_cmt', '=', $this->params['id']);
     $sp->addCondition('type_cmt', '=', $this->params['type']);
     $sp->addItemOrder('position_cmt', 'desc');
     $arData = $dao->findBy($sp);
     if (count($arData) > 0) {
         $perPage = isset($this->params['perPage']) ? intval($this->params['perPage']) : intval(CopixConfig::get('comment|perPage'));
         $params = array('perPage' => $perPage, 'delta' => 5, 'recordSet' => $arData, 'template' => '|pager.tpl');
         $Pager = CopixPager::Load($params);
         $tpl->assign('pager', $Pager->GetMultipage());
         $tpl->assign('comments', $Pager->data);
     }
     $tpl->assign('back', $this->params['back']);
     $tpl->assign('id', $this->params['id']);
     $tpl->assign('type', $this->params['type']);
     $adminEnabled = CopixUserProfile::valueOf('site', 'siteAdmin') >= PROFILE_CCV_MODERATE;
     $tpl->assign('adminEnabled', $adminEnabled);
     $plugAuth =& $GLOBALS['COPIX']['COORD']->getPlugin('auth|auth');
     $user =& $plugAuth->getUser();
     $tpl->assign('login', $user->login);
     $toReturn = $tpl->fetch('comment.list.tpl');
     return true;
 }
 public function _createContent(&$toReturn)
 {
     $tpl = new CopixTpl();
     $blog = $this->getParam('blog', '');
     $cat = $this->getParam('cat', null);
     $critere = $this->getParam('critere', null);
     //on récupère l'ensemble des articles du blog
     $dao = _dao('blog|blogarticle');
     if ($cat == null) {
         $date = $this->getParam('date', null);
         $arData = $dao->getAllArticlesFromBlog($blog->id_blog, $date);
     } else {
         $arData = $dao->getAllArticlesFromBlogByCat($blog->id_blog, $cat->id_bacg);
         $tpl->assign('cat', $cat);
     }
     //on filtre si on a fait une recherche sur les articles
     if ($critere != null) {
         $arData = $dao->getAllArticlesFromBlogByCritere($blog->id_blog, $critere);
     }
     //var_dump($arData);
     //on construit un tableau associatif entre l'identifiant de l'article et le nombre de commentaires
     foreach ($arData as $article) {
         //var_dump($article);
         $daoArticleComment =& CopixDAOFactory::getInstanceOf('blog|blogarticlecomment');
         $record = _record('blog|blogarticlecomment');
         $criteres = _daoSp();
         $criteres->addCondition('id_bact', '=', $article->id_bact);
         $criteres->addCondition('is_online', '=', 1);
         $resultat = $daoArticleComment->findBy($criteres);
         $arNbCommentByArticle[$article->id_bact] = count($resultat);
     }
     if (count($arData) > 0) {
         //encodage des URL des catégories pour caractères spéciaux
         foreach ($arData as $key => $data) {
             //Modification suite à apparition d'un warning due à l'absence de catégories , vboniface 06.11.2006
             $arData[$key]->key = $key;
             if (isset($arData[$key]->categories)) {
                 foreach ($arData[$key]->categories as $keyCat => $categorie) {
                     $arData[$key]->categories[$keyCat]->url_bacg = urlencode($categorie->url_bacg);
                 }
             }
         }
         if (count($arData) <= intval(CopixConfig::get('blog|nbMaxArticles'))) {
             $tpl->assign('pager', "");
             $tpl->assign('listArticle', $arData);
             $tpl->assign('arNbCommentByArticle', $arNbCommentByArticle);
         } else {
             $params = array('perPage' => intval(CopixConfig::get('blog|nbMaxArticles')), 'delta' => 5, 'recordSet' => $arData, 'template' => '|pager.tpl');
             $Pager = CopixPager::Load($params);
             $tpl->assign('pager', $Pager->GetMultipage());
             $tpl->assign('listArticle', $Pager->data);
             $tpl->assign('arNbCommentByArticle', $arNbCommentByArticle);
         }
         //rajout suite à bug mantis 54 vboniface 06.11.2006
         $tpl->assign('blog', $blog);
     }
     // retour de la fonction :
     $toReturn = $tpl->fetch('listarticle.tpl');
     return true;
 }
 /**
  * Affichage des dernieres pages d'un blog au format Javascript
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2009/01/23
  * @param mixed $blog Recordset du blog
  * @param integer $nb (option) Nombre de pages a afficher. Si null, prend nbJsArticles dans la conf. Par defaut : null
  * @param integer $page (option) Id d'une page precise a afficher
  * @param boolean $content (option) Indique si on affiche le corps des pages. Par defaut : false
  * @param integer $colonnes Nb de colonnes. Par defaut : 1
  * @param boolean $hr (option) Si on veut afficher un HR entre les pages. Par defaut : false
  * @param boolean $showtitle (option) Si on veut afficher le titre des articles. Par defaut : true
  * @param integer $truncate (option) Limit de cesure du texte. Par defaut : 0 (pas de cesure)
  */
 public function _createContent(&$toReturn)
 {
     $blog = $this->getParam('blog', null);
     $nb = $this->getParam('nb', null);
     $nb = intval($nb);
     $colonnes = $this->getParam('colonnes');
     $colonnes = intval($colonnes);
     if (!$colonnes) {
         $colonnes = 1;
     }
     $content = $this->getParam('content', false);
     $hr = $this->getParam('hr', false);
     $page = $this->getParam('page', null);
     $page = intval($page);
     $showtitle = $this->getParam('showtitle', true);
     $truncate = $this->getParam('truncate', 0);
     $tpl = new CopixTpl();
     $listPage = array();
     if ($page) {
         // Page precise
         if (($rPage = _dao('blog|blogpage')->get($page)) && $rPage->id_blog == $blog->id_blog) {
             $listPage[] = $rPage;
         }
     } else {
         // Les dernieres pages
         if (!$nb || $nb < 0 || $nb > 20) {
             $nb = CopixConfig::get('blog|nbJsArticles');
         }
         //on récupère l'ensemble des articles du blog
         $dao = _dao('blog|blogpage');
         $arData = $dao->getAllPagesFromBlog($blog->id_blog);
         if (count($arData) <= $nb) {
             $listPage = $arData;
         } else {
             $params = array('perPage' => $nb, 'delta' => 1, 'recordSet' => $arData, 'template' => '|pager.tpl');
             $Pager = CopixPager::Load($params);
             $tpl->assign('pager', $Pager->GetMultipage());
             $listPage = $Pager->data;
         }
     }
     $tpl->assign('listPage', $listPage);
     $nbPages = count($listPage);
     // Nb elements par colonnes
     $parCols = ceil($nbPages / $colonnes);
     $tpl->assign('blog', $blog);
     $tpl->assign('content', $content);
     $tpl->assign('hr', $hr);
     $tpl->assign('parCols', $parCols);
     $tpl->assign('widthColonne', round(100 / $colonnes, 1) . '%');
     $tpl->assign('showtitle', $showtitle);
     $tpl->assign('truncate', $truncate);
     $txt = $tpl->fetch('listpagejs.tpl');
     $txt = trim(str_replace("\r\n", "", $txt));
     $txt = trim(str_replace("\n", "", $txt));
     $toReturn = "var blogJsPages='" . addslashes($txt) . "';";
     return true;
 }
 function _createContent(&$toReturn)
 {
     $tpl =& new CopixTpl();
     $dao =& CopixDAOFactory::create('comment|comment');
     $sp =& CopixDAOFactory::createSearchConditions();
     $sp->addItemOrder('date_cmt', 'desc');
     $sp->addItemOrder('position_cmt', 'desc');
     $arComments = array();
     $arComments = $dao->findby($sp);
     if (count($arComments) > 0) {
         $perPage = intval(CopixConfig::get('comment|quickAdminPerPage'));
         $params = array('perPage' => $perPage, 'delta' => 5, 'recordSet' => $arComments, 'template' => '|pager.tpl');
         $pager = CopixPager::Load($params);
         $tpl->assign('pager', $pager->GetMultipage());
         $tpl->assign('comments', $pager->data);
     }
     $toReturn = $lastComments === array() ? '' : $tpl->fetch('comment.quickadmin.tpl');
     return true;
 }
 /**
  * Affichage du flux RSS d'un blog (flux sortant)
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/11/28
  * @param mixed $blog Recordset du blog
  */
 public function _createContent(&$toReturn)
 {
     $blog = $this->getParam('blog', null);
     $tpl = new CopixTpl();
     //on récupère l'ensemble des articles du blog
     $dao = _dao('blog|blogarticle');
     $arData = $dao->getAllArticlesFromBlog($blog->id_blog, NULL);
     //print_r($arData);
     //$arData = $dao->getAllArticlesFromBlogByCritere($blog->id_blog, NULL);
     if (count($arData) <= intval(CopixConfig::get('blog|nbRssArticles'))) {
         $tpl->assign('listArticle', $arData);
     } else {
         $params = array('perPage' => intval(CopixConfig::get('blog|nbRssArticles')), 'delta' => 5, 'recordSet' => $arData, 'template' => '|pager.tpl');
         $Pager = CopixPager::Load($params);
         $tpl->assign('pager', $Pager->GetMultipage());
         $tpl->assign('listArticle', $Pager->data);
     }
     //print_r($blog);
     $rss = array('title' => $blog->name_blog, 'link' => CopixUrl::get() . CopixUrl::get('blog||', array('blog' => $blog->url_blog)), 'description' => $blog->name_blog, 'language' => 'fr-fr', 'copyright' => "Iconito", 'generator' => "Iconito", 'logo' => $blog->logo_blog ? 1 : 0);
     $tpl->assign('rss', $rss);
     $tpl->assign('blog', $blog);
     $toReturn = $tpl->fetch('listarticlerss.tpl');
     return true;
 }
 public function _createContent(&$toReturn)
 {
     //Getting the user.
     //Create Services, and DAO
     $tpl = new CopixTpl();
     $id_blog = $this->getParam('id_blog', null);
     $blog = $this->getParam('blog', null);
     $kind = $this->getParam('kind', '0');
     $selectCategory = $this->getParam('selectCategory', '');
     $selectMonth = $this->getParam('selectMonth', '');
     $id_bact = $this->getParam('id_bact', '');
     // Recherche de toutes les catégories de la base
     $query = null;
     $clause = '';
     if (strlen($selectCategory) > 0) {
         $clause = ' AND ';
         $query = ' artctg.id_bacg = ' . $selectCategory;
     }
     if (strlen($selectMonth) > 0) {
         $query = $query . $clause . ' art.date_bact LIKE \'' . $selectMonth . '%\'';
     }
     $id_bacg = null;
     $blogArticleDAO = _dao('blog|blogarticle');
     $res = $blogArticleDAO->findArticles($id_blog, $id_bacg, $query);
     //print_r($res);
     // Manipulation du tableau résultat.
     $commentDAO = _dao('blog|blogarticlecomment');
     $tabArticles = array();
     foreach ($res as $r) {
         $r->categories = array();
         $r->categories = $blogArticleDAO->findCategoriesForArticle($r->id_bact);
         $r->nbComment = $commentDAO->countNbCommentForArticle($r->id_bact);
         $r->nbComment_offline = $commentDAO->countNbCommentForArticle($r->id_bact, 0);
         if ($id_bact == $r->id_bact) {
             $r->expand = true;
         } else {
             $r->expand = false;
         }
         array_push($tabArticles, $r);
     }
     // Préparation du filtre CATEGORIES
     $blogArticleCategoryDAO = _dao('blog|blogarticlecategory');
     $tabArticleCategory = $blogArticleCategoryDAO->findAllOrder($id_blog);
     // Préparation du filtre MOIS
     $resArticleMonth = $blogArticleDAO->findListMonthForArticle($id_blog);
     $tabArticleMonth = array();
     $lastMonth = null;
     foreach ($resArticleMonth as $month) {
         $monthYear = substr($month->date_bact, 4, 2) . '/' . substr($month->date_bact, 0, 4);
         if ($monthYear != $lastMonth) {
             $tmp = array('value' => substr($month->date_bact, 0, 6), 'text' => $monthYear);
             $tabArticleMonth[] = $tmp;
             $lastMonth = $monthYear;
         }
     }
     //capability
     //$tpl->assign ('canManageArticle' , BlogAuth::canMakeInBlog('ADMIN_ARTICLES',create_blog_object($id_blog)));
     $tpl->assign('id_blog', $id_blog);
     $tpl->assign('blog', $blog);
     $tpl->assign('kind', $kind);
     $tpl->assign('tabArticleMonth', $tabArticleMonth);
     $tpl->assign('tabArticleCategory', $tabArticleCategory);
     $tpl->assign('selectCategory', $selectCategory);
     $tpl->assign('selectMonth', $selectMonth);
     $tpl->assign('id_bact', $id_bact);
     // Uniquement pour la partie Article
     if (count($tabArticles) > 0) {
         $params = array('perPage' => intval(CopixConfig::get('blog|nbMaxArticles')), 'delta' => 5, 'recordSet' => $tabArticles);
         $pager = CopixPager::Load($params);
         //print_r($pager);
         $tpl->assign('pagerArticles', $pager->GetMultipage());
         $tpl->assign('tabArticles', $pager->data);
         $tpl->assign('p', $this->getParam('p', ''));
     } else {
         $tpl->assign('p', $this->getParam('p', ''));
         $tpl->assign('tabArticles', array());
     }
     $tpl->assign('canDelete', BlogAuth::canMakeInBlog('ADMIN_ARTICLE_DELETE', $blog));
     $tpl->assign('canAdminComments', BlogAuth::canMakeInBlog('ADMIN_COMMENTS', $blog));
     // retour de la fonction :
     $toReturn = $tpl->fetch('blog.show.article.tpl');
     return $toReturn;
 }
 /**
  * Affichage des derniers articles d'un blog au format Javascript
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/12/19
  * @param mixed $blog Recordset du blog
  * @param integer $nb (option) Nombre d'articles a afficher. Si null, prend nbJsArticles dans la conf. Par defaut : null
  * @param integer $article (option) Id d'un article precise a afficher
  * @param boolean $chapo (option) Indique si on affiche le chapo des articles. Par defaut : false
  * @param integer $colonnes Nb de colonnes. Par defaut : 1
  * @param boolean $hr (option) Si on veut afficher un HR entre les pages. Par defaut : false
  * @param boolean $showtitle (option) Si on veut afficher le titre des articles. Par defaut : true
  * @param boolean $showdate (option) Si on veut afficher la date des articles. Par defaut : true
  * @param boolean $showcategorie (option) Si on veut afficher les categories des articles. Par defaut : true
  */
 public function _createContent(&$toReturn)
 {
     $blog = $this->getParam('blog', null);
     $nb = $this->getParam('nb', null);
     $nb = intval($nb);
     $colonnes = $this->getParam('colonnes');
     $colonnes = intval($colonnes);
     if (!$colonnes) {
         $colonnes = 1;
     }
     $chapo = $this->getParam('chapo', false);
     $hr = $this->getParam('hr', false);
     $article = $this->getParam('article', null);
     $article = intval($article);
     $showtitle = $this->getParam('showtitle', true);
     $showdate = $this->getParam('showdate', true);
     $showcategorie = $this->getParam('showcategorie', true);
     $tpl = new CopixTpl();
     $listArticle = array();
     if ($article) {
         // Article precis
         if (($rArticle = _dao('blog|blogarticle')->get($article)) && $rArticle->id_blog == $blog->id_blog) {
             $daoLink = _dao('blog|blogarticle_blogarticlecategory');
             $sp = _daoSp();
             $sp->addCondition('id_bact', '=', $rArticle->id_bact);
             $rArticle->categories = array();
             foreach ($daoLink->findBy($sp) as $object) {
                 $rArticle->categories[] = _dao('blog|blogarticlecategory')->get($object->id_bacg);
             }
             $listArticle[] = $rArticle;
         }
     } else {
         // Les derniers articles
         if (!$nb || $nb < 0 || $nb > 20) {
             $nb = CopixConfig::get('blog|nbJsArticles');
         }
         //on récupère l'ensemble des articles du blog
         $dao = _dao('blog|blogarticle');
         $arData = $dao->getAllArticlesFromBlog($blog->id_blog, NULL);
         if (count($arData) > 0) {
             foreach ($arData as $key => $data) {
                 if (isset($arData[$key]->categories)) {
                     foreach ($arData[$key]->categories as $keyCat => $categorie) {
                         $arData[$key]->categories[$keyCat]->url_bacg = urlencode($categorie->url_bacg);
                     }
                 }
             }
         }
         if (count($arData) <= $nb) {
             $listArticle = $arData;
         } else {
             $params = array('perPage' => $nb, 'delta' => 1, 'recordSet' => $arData, 'template' => '|pager.tpl');
             $Pager = CopixPager::Load($params);
             $tpl->assign('pager', $Pager->GetMultipage());
             $listArticle = $Pager->data;
         }
     }
     $tpl->assign('listArticle', $listArticle);
     $nbArticles = count($listArticle);
     // Nb elements par colonnes
     $parCols = ceil($nbArticles / $colonnes);
     //    print_r($arData);
     $tpl->assign('blog', $blog);
     $tpl->assign('chapo', $chapo);
     $tpl->assign('hr', $hr);
     $tpl->assign('parCols', $parCols);
     $tpl->assign('widthColonne', round(100 / $colonnes, 1) . '%');
     $tpl->assign('showtitle', $showtitle);
     $tpl->assign('showdate', $showdate);
     $tpl->assign('showcategorie', $showcategorie);
     $txt = $tpl->fetch('listarticlejs.tpl');
     $txt = trim(str_replace("\r\n", "", $txt));
     $txt = trim(str_replace("\n", "", $txt));
     $toReturn = "var blogJs='" . addslashes($txt) . "';";
     return true;
 }
 function CopixArrayPager($options)
 {
     $this->recordSet = '';
     parent::CopixPager($options);
 }
 /**
  * Affichage des memos
  */
 public function processVoirMemos()
 {
     $ppo = new CopixPPO();
     if (is_null($ppo->cahierId = _request('cahierId'))) {
         return CopixActionGroup::process('generictools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.errorOccurred'), '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->eleve = _request('eleve', null);
     $time = mktime(0, 0, 0, $ppo->mois, $ppo->jour, $ppo->annee);
     $cahierInfos = Kernel::getModParent('MOD_CAHIERDETEXTES', $ppo->cahierId);
     $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId);
     $ppo->estAdmin = $ppo->niveauUtilisateur >= PROFILE_CCV_PUBLISH ? true : false;
     $ppo->nodeId = isset($cahierInfos[0]) ? $cahierInfos[0]->node_id : null;
     $ppo->nodeType = isset($cahierInfos[0]) ? $cahierInfos[0]->node_type : null;
     // Récupération des mémos suivant le type de l'utilisateur courant
     $memoDAO = _ioDAO('cahierdetextes|cahierdetextesmemo');
     if ($ppo->estAdmin) {
         $memos = $memoDAO->findByClasse($ppo->nodeId);
     } elseif (Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId) == PROFILE_CCV_READ) {
         $memos = $memoDAO->findByEleve($ppo->eleve);
     } else {
         $memos = $memoDAO->findByEleve(_currentUser()->getExtra('id'));
     }
     // Pager
     if (count($memos) > CopixConfig::get('cahierdetextes|nombre_max_memos')) {
         require_once COPIX_UTILS_PATH . 'CopixPager.class.php';
         $params = array('perPage' => intval(CopixConfig::get('cahierdetextes|nombre_max_memos')), 'delta' => 5, 'recordSet' => $memos, 'template' => '|pager.tpl');
         $pager = CopixPager::Load($params);
         $ppo->pager = $pager->GetMultipage();
         $ppo->memos = $pager->data;
     } else {
         $ppo->memos = $memos;
     }
     if (CopixRequest::isMethod('post')) {
         $memo2eleveDAO = _ioDAO('cahierdetextes|cahierdetextesmemo2eleve');
         if (is_null($memo2eleve = $memo2eleveDAO->get(_request('memoId', null), $ppo->eleve)) || !Kernel::isParentOfEleve($ppo->eleve)) {
             return CopixActionGroup::process('generictools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.errorOccurred'), 'back' => CopixUrl::get('')));
         }
         $memo2eleve->signe_le = date('Ymd');
         $memo2eleve->commentaire = _request('commentaire', null);
         $memo2eleveDAO->update($memo2eleve);
         if ($ppo->niveauUtilisateur == PROFILE_CCV_READ) {
             return _arRedirect(CopixUrl::get('cahierdetextes||voirMemos', array('cahierId' => $ppo->cahierId, 'eleve' => $ppo->eleve)));
         } else {
             return _arRedirect(CopixUrl::get('cahierdetextes||voirMemos', array('cahierId' => $ppo->cahierId)));
         }
     }
     $modParentInfo = Kernel::getModParentInfo('MOD_CAHIERDETEXTES', $ppo->cahierId);
     $ppo->TITLE_PAGE = $modParentInfo['nom'];
     return _arPPO($ppo, 'voir_memos.tpl');
 }