public function _createContent(&$toReturn) { $ppo = new CopixPPO(); $ppo->conf = new CopixPPO(); $ppo->conf->directorGlobalAffectation = CopixConfig::get('gestionautonome|directorGlobalAffectation'); // Récupérations des filtres en session $ppo->selected = $this->getParam('selected', null); $ppo->withLabel = $this->getParam('with_label', true); $ppo->withEmpty = $this->getParam('with_empty', true); $ppo->labelEmpty = $this->getParam('label_empty', null); $ppo->name = $this->getParam('name', null); if (!is_null($cityGroupId = $this->getParam('city_group_id', null))) { $cityDAO = _dao('kernel|kernel_bu_ville'); if (_currentUser()->testCredential('module:cities_group|' . $cityGroupId . '|city|create@gestionautonome') || _currentUser()->isDirector && $ppo->conf->directorGlobalAffectation) { $cities = $cityDAO->getByIdGrville($cityGroupId); } else { $groups = _currentUser()->getGroups(); $cities = $cityDAO->findByCitiesGroupIdAndUserGroups($cityGroupId, $groups['gestionautonome|iconitogrouphandler']); } $ppo->citiesIds = array(); $ppo->citiesNames = array(); foreach ($cities as $city) { $ppo->citiesIds[] = $city->id_vi; $ppo->citiesNames[] = $city->nom; } } $toReturn = $this->_usePPO($ppo, '_filter_city.tpl'); }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $module_type = $this->getParam('module_type'); $module_id = $this->getParam('module_id'); $action = $this->getParam('action'); $date_debut = $this->getParam('date_debut', null); $date_fin = $this->getParam('date_fin', null); $dao = _dao('stats|logs'); $stats = $dao->getStatsModuleAction(array('module_type' => $module_type, 'module_id' => $module_id, 'action' => $action, 'date_debut' => $date_debut, 'date_fin' => $date_fin)); //print_r($stats); foreach ($stats as $k => $s) { // Détection du nom Copix du module list(, $module) = explode("_", strtolower($module_type)); $class = CopixClassesFactory::create("{$module}|Stats{$module}"); $obj = $class->getObjet($action, $s->objet_a); //print_r($obj); $stats[$k]->objet_name = isset($obj->name) ? $obj->name : ''; } $tpl->assign('name', CopixI18N::get('stats.action.' . $module_type . '-' . $action)); $tpl->assign('stats', $stats); //$tpl->assign ('canWriteOnline' , BlogAuth::canMakeInBlog('ADMIN_ARTICLE_MAKE_ONLINE',create_blog_object($id_blog))); // retour de la fonction : $toReturn = $tpl->fetch('module.action.tpl'); return true; }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $motcle = $this->getParam('motcle'); $clos = $this->getParam('clos'); $type = $this->getParam('type'); $ecole = $this->getParam('ecole'); $rTelep = $this->getParam('rTelep'); $admin = $this->getParam('admin'); $mondroit = $this->getParam('mondroit'); $daoType =& _dao('teleprocedures|type'); $tpl->assign('arTypes', $daoType->findForTeleprocedure($rTelep->id)); //print_r($rTelep); $canViewComboEcoles = TeleproceduresService::canMakeInTelep('VIEW_COMBO_ECOLES', $mondroit); if ($canViewComboEcoles) { $tpl->assign('comboEcolesLinesSup', array(0 => array('value' => '', 'libelle' => '---'), 1 => array('value' => '', 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllEcoles')))); } $tpl->assign('rTelep', $rTelep); $tpl->assign('admin', $admin); $tpl->assign('motcle', $motcle); $tpl->assign('clos', $clos); $tpl->assign('type', $type); $tpl->assign('ecole', $ecole); $tpl->assign('canViewComboEcoles', $canViewComboEcoles); $toReturn = $tpl->fetch('filtre-zone.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; }
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; }
/** * Renvoie les infos de la dernière connexion d'un login * * @author Frédéric Mossmann <*****@*****.**> * @since 2006/05/10 * @param string $login Login de l'utilisateur * @return mixed Objet DAO */ public function lastLogin($login) { $dao = _dao("logs|logs"); $criteres = _daoSp(); $criteres->addCondition('logs_type', '=', 'LOG'); $criteres->addCondition('logs_mod_name', '=', 'auth'); $criteres->addCondition('logs_mod_action', '=', 'in'); $criteres->addCondition('logs_message', '=', 'Login ok: ' . $login); $criteres->orderBy(array('logs_date', 'DESC')); $lastlog = $dao->findBy($criteres); $criteres = _daoSp(); $criteres->addCondition('logs_type', '=', 'LOG'); $criteres->addCondition('logs_mod_name', '=', 'auth'); $criteres->addCondition('logs_mod_action', '=', 'in'); $criteres->addCondition('logs_message', ' LIKE ', 'Login failed: ' . $login . '/%'); $criteres->orderBy(array('logs_date', 'DESC')); $lastfailed = $dao->findBy($criteres); $return = false; if (sizeof($lastlog) > 0) { $return['nb'] = sizeof($lastlog); $return['last'] = $lastlog[0]; if (sizeof($lastfailed) > 0) { $return['failed'] = $lastfailed[0]; } } return $return; }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $pAlbumId = $this->getParam('album_id'); $pDossierId = $this->getParam('dossier_id'); // $album_dao = _dao("album"); $dossier_dao = _dao("dossier"); $photo_dao = _dao("photo"); if ($pDossierId > 0) { $dossier = $dossier_dao->get($pDossierId); } else { $dossier->dossier_id = 0; $dossier->dossier_album = $this->getParam('album_id'); $dossier->dossier_parent = -1; $dossier->dossier_nom = CopixI18N::get('album|album.message.topfolder'); $dossier->dossier_comment = ""; $dossier->album_id = $pAlbumId; } if ($dossier->dossier_album != $pAlbumId) { return false; } $pictures = $photo_dao->findAllByAlbumAndFolder($pAlbumId, $pDossierId); $tpl->assign('album_id', $pAlbumId); $tpl->assign('dossier_id', $pDossierId); $tpl->assign('dossier', $dossier); $tpl->assign('pictures', $pictures); $tpl->assign('picture_thumbsize', '_s64'); $dossiers_tree = Album::getFoldersTree($pAlbumId); $dossiers_commands = Album::tree2commands($dossiers_tree); $tpl->assign('commands_move', $dossiers_commands); $toReturn = $tpl->fetch('editphotos.tpl'); return true; }
/** * Commentaires d'une procedure * * @author Christophe Beyer <*****@*****.**> * @since 2008/01/30 * @param object $rFiche Recordset de la procedure */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $rFiche = $this->getParam('rFiche'); $mondroit = $this->getParam('mondroit'); $daoinfo =& _dao('infosupp'); $sql = 'SELECT * FROM module_teleprocedure_infosupp WHERE idinter=' . $rFiche->idinter . ''; $canCheckVisible = TeleproceduresService::canMakeInTelep('CHECK_VISIBLE', $mondroit); $canAddComment = TeleproceduresService::canMakeInTelep('ADD_COMMENT', $mondroit); if (!$canCheckVisible) { $sql .= " AND info_message!='' AND info_message IS NOT NULL"; } $sql .= " ORDER BY dateinfo ASC, idinfo ASC"; $results = _doQuery($sql); // Pour chaque message on cherche les infos de son auteur $list = array(); foreach ($results as $r) { $userInfo = Kernel::getUserInfo("ID", $r->iduser); //var_dump($userInfo); $avatar = Prefs::get('prefs', 'avatar', $r->iduser); $userInfo['avatar'] = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : ''; $r->user = $userInfo; $list[] = $r; } //print_r($rFiche); $tpl->assign('info_message_edition', CopixZone::process('kernel|edition', array('field' => 'info_message', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false')))); $tpl->assign('info_commentaire_edition', CopixZone::process('kernel|edition', array('field' => 'info_commentaire', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false')))); $tpl->assign('canCheckVisible', $canCheckVisible); $tpl->assign('canAddComment', $canAddComment); $tpl->assign('list', $list); $tpl->assign('rFiche', $rFiche); $toReturn = $tpl->fetch('fiche-comms-zone.tpl'); return true; }
public function _createContent(&$toReturn) { $ppo = new CopixPPO(); $ppo->conf = new CopixPPO(); $ppo->conf->directorGlobalAffectation = CopixConfig::get('gestionautonome|directorGlobalAffectation'); // Récupérations des filtres en session $ppo->selected = $this->getParam('selected', null); $ppo->withLabel = $this->getParam('with_label', true); $ppo->withEmpty = $this->getParam('with_empty', true); $ppo->name = $this->getParam('name', null); if (!is_null($cityId = $this->getParam('city_id', null))) { // Récupération des écoles de la ville sélectionnée pour liste déroulante $schoolDAO = _dao('kernel|kernel_bu_ecole'); if (_currentUser()->testCredential('module:city|' . $cityId . '|school|create@gestionautonome') || _currentUser()->isDirector && $ppo->conf->directorGlobalAffectation) { $schools = $schoolDAO->getByCity($cityId); } else { $groups = _currentUser()->getGroups(); $schools = $schoolDAO->findByCityIdAndUserGroups($cityId, $groups['gestionautonome|iconitogrouphandler']); } $ppo->schoolsIds = array(); $ppo->schoolsNames = array(); foreach ($schools as $school) { $ppo->schoolsIds[] = $school->numero; $ppo->schoolsNames[] = $school->nom; } } $toReturn = $this->_usePPO($ppo, '_filter_school.tpl'); }
/** * Statistiques d'un agenda * * Renvoie des éléments chiffrés relatifs à un agenda : nombre d'évènements... * * @author Christophe Beyer <*****@*****.**> * @since 2006/08/24 * @param integer $id_agenda Id de l'agenda * @return array Tableau dont les clefs représentent les libellés des stats et les valeurs les stats chiffrées. Clefs utilisées : ["nbEvenements"] */ public function getStats($id_agenda) { $res = array(); $dao = _dao("agenda|agenda"); $infos = $dao->getNbsEvenementsInAgenda($id_agenda); $res['nbEvenements'] = array('name' => CopixI18N::get('agenda|agenda.stats.nbEvenements', array($infos[0]->nbEvenements))); return $res; }
public function getStats($id_liste) { $res = array(); $daoListe = _dao("liste|liste_listes"); $infos = $daoListe->getNbMessagesInListe($id_liste); $res['nbMessages'] = array('name' => CopixI18N::get('liste|liste.stats.nbMessages', array($infos[0]->nb))); return $res; }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $blog = $this->getParam('blog', ''); $dao = _dao('blog|blogfluxrss'); $tpl->assign('listFluxRss', $dao->getAllFluxRssFromBlog($blog->id_blog)); $toReturn = $tpl->fetch('listfluxrss.tpl'); return true; }
public function testFoo() { $dao1 = _ioDAO('copix:copixmodule'); $dao2 = _ioDAO('copix:copixmodule'); $dao3 = _dao('copix:copixmodule'); $this->assertSame($dao1, $dao2); $this->assertNotSame($dao1, $dao3); _daoInclude('copix:copixmodule'); }
/** * 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; }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $blog = $this->getParam('blog', ''); $dao = _dao('blog|bloglink'); $tpl->assign('listLink', $dao->getAllLinksFromBlog($blog->id_blog)); $toReturn = $tpl->fetch('listlink.tpl'); return true; }
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'); }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $blog = $this->getParam('blog', ''); $dao = _dao('blog|blogarticle'); $tpl->assign('listArchive', $dao->getAllArchivesFromBlog($blog->id_blog)); $tpl->assign('blog', $blog); $toReturn = $tpl->fetch('listarchive.tpl'); return true; }
public function getStats($id_sso) { $dao = _dao("sso|sso"); $res = array(); /* $infos = $dao->getSso($id_sso); $res['nbPhotos'] = array ('name'=>CopixI18N::get ('album|album.stats.nbPhotos'), 'value'=>$infos[0]->nb); */ return $res; }
/** * Suppression d'un module de contacts * * @author Christophe Beyer <*****@*****.**> * @since 2010/08/25 * @param integer $id Id du module a supprimer * @return boolean true si la suppression s'est bien passée, false sinon */ public function delete($idContacts) { $res = false; if ($record = _dao('contact|contacts')->get($idContacts)) { _dao('contact|contacts')->delete($idContacts); $res = true; } Kernel::unregisterModule("MOD_CONTACT", $idContacts); return $res; }
public function create() { $return = null; $dao = _dao("cahierdetextes|cahierdetextes"); $new = _record("cahierdetextes|cahierdetextes"); $dao->insert($new); if ($new->id !== null) { $return = $new->id; } return $return; }
/** * Suppression définitive * * @author Christophe Beyer <*****@*****.**> * @since 2009/01/23 * @param integer $id Id du module * @return boolean true si la suppression s'est bien passée, false sinon */ public function delete($id) { $dao = _dao("teleprocedures|teleprocedure"); $r = $dao->get($id); $res = false; if ($r) { // todo : supprimer en-dessous $dao->delete($id); $res = true; } return $res; }
/** * Statistiques d'une malle * * Renvoie des �l�ments chiffr�s relatifs � une malle : taille occup�e (format "humain"), nombre de dossiers, nombre de fichiers * * @author Christophe Beyer <*****@*****.**> * @since 2005/12/07 * @param integer $malle Id de la malle * @return array Tableau dont les clefs repr�sentent les libell�s des stats et les valeurs les stats chiffr�es. Clefs utilis�es : ["nbFiles"] ["nbFolders"] ["size"] */ public function getStats($malle) { _classInclude('systutils|StatsServices'); $daoMalles = _dao("malle|malle_malles"); $res = array(); $infosFiles = $daoMalles->getNbsFilesInMalle($malle); $infosFolders = $daoMalles->getNbsFoldersInMalle($malle); $res['nbFiles'] = array('name' => CopixI18N::get('malle|malle.stats.nbFiles', array($infosFiles[0]->nbFiles))); $res['nbFolders'] = array('name' => CopixI18N::get('malle|malle.stats.nbFolders', array($infosFolders[0]->nbFolders))); $res['size'] = array('name' => CopixI18N::get('malle|malle.stats.size', array(StatsServices::human_file_size($infosFiles[0]->taille)))); return $res; }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $blog = $this->getParam('blog', ''); $comment = $this->getParam('comment', NULL); //on récupère l'ensemble des articles du blog $dao = _dao('blog|blogarticle'); //$article = $dao->getArticleByUrl($blog->id_blog, $this->getParam('article', '')); list($id_bact, ) = explode("-", $this->getParam('article', '')); $article = $dao->getArticleById($blog->id_blog, $id_bact); if (!$article) { $toReturn = '{/}' . $tpl->fetch('showarticle.tpl'); return true; } //encodage des URL des catégories pour caractères spéciaux if (is_array($article->categories)) { foreach ($article->categories as $key => $categorie) { $article->categories[$key]->url_bacg = urlencode($categorie->url_bacg); } } $tpl->assign('article', $article); // Recherche de tous les commentaires associés à cet article $commentDAO = _dao('blog|blogarticlecomment'); $res = $commentDAO->findCommentOrderBy($article->id_bact, 1); $listComment = array(); foreach ($res as $r) { $r->time_bacc = BDToTime($r->time_bacc); array_push($listComment, $r); } if ($comment) { $toEdit = $comment; } else { // On récupère l'utilisateur connecté $user = BlogAuth::getUserInfos(); $toEdit = _record('blogarticlecomment'); $toEdit->authorid_bacc = $user->userId; $toEdit->authorname_bacc = $user->name; $toEdit->authoremail_bacc = $user->email; $toEdit->authorweb_bacc = $user->web; } $tpl->assign('blog', $blog); $tpl->assign('toEdit', $toEdit); $tpl->assign('listComment', $listComment); $tpl->assign('errors', $this->getParam('errors', null)); $tpl->assign('showErrors', $this->getParam('showErrors', false)); $tpl->assign('canComment', BlogAuth::canComment($blog->id_blog)); $plugStats = CopixPluginRegistry::get("stats|stats"); $plugStats->setParams(array('objet_a' => $article->id_bact)); // retour de la fonction : $toReturn = $article->name_bact . '{/}' . $tpl->fetch('showarticle.tpl'); return true; }
public function setUp() { $this->_client = new soapClient(CopixUrl::getRequestedProtocol() . CopixUrl::getRequestedBasePath() . "index.php/wsserver/default/wsdl"); $sp = _daoSearchParams(); $sp->addCondition('login_dbuser', '=', 'WSUser'); _dao('auth|dbuser')->deleteBy($sp); $record = _daoRecord('auth|dbuser'); $record->login_dbuser = '******'; $record->password_dbuser = md5('WSUserPassword'); $record->email_dbuser = "******"; $record->enabled_dbuser = "******"; _dao('auth|dbuser')->insert($record); }
public function getStats($id_magicmail) { $dao = _dao("magicmail|magicmail"); $magic_result = $dao->get($id_magicmail); $res = array(); if ($magic_result && trim($magic_result->magicmail_login) != '' && trim($magic_result->magicmail_domain) != '') { $mail = '<a href="mailto:' . $magic_result->magicmail_login . '@' . $magic_result->magicmail_domain . '">' . $magic_result->magicmail_login . '@' . $magic_result->magicmail_domain . '</a>'; $res['email'] = array('name' => CopixI18N::get('magicmail|magicmail.message.stats_yourmailis', array('mail' => $mail))); } else { $res['email'] = array('name' => CopixI18N::get('magicmail|magicmail.message.stats_nomail')); } return $res; }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $blog = $this->getParam('blog', ''); $dao = _dao('blog|blogpage'); $arPage = $dao->getAllPagesFromBlog($blog->id_blog); foreach ($arPage as $key => $page) { $arPage[$key]->url_bpge = urlencode($page->url_bpge); } $tpl->assign('listPage', $arPage); $toReturn = $tpl->fetch('listpage.tpl'); return true; }
public function setPrefs($module, $data) { // Traiter passwd1 et passwd2 if ($data['passwd1'] == $data['passwd2'] && strlen($data['passwd1']) > 0) { $bu = Kernel::getSessionBU(); $dao = _dao('kernel|kernel_copixuser'); $user = $dao->get($bu['user_id']); $user->password_dbuser = md5($data['passwd1']); $dao->update($user); } unset($data['passwd1']); unset($data['passwd2']); // Traiter l'effacement d'un avatar if (isset($data['avatar_delete']) && $data['avatar_delete'] == '1') { $path2data = realpath("static"); $path2prefs = $path2data . "/prefs"; $path2avatars = $path2prefs . "/avatar"; if ($avatar_old = Prefs::get('prefs', 'avatar')) { @unlink($path2avatars . '/' . $avatar_old); Prefs::del('prefs', 'avatar'); } } // Traiter l'ajout d'un avatar if (ereg("^image/(.+)\$", $_FILES['prefs_avatar_upload']['type'], $regs)) { if (in_array($regs[1], array('jpeg', 'gif', 'png'))) { $path2data = realpath("static"); $path2prefs = $path2data . "/prefs"; // if( !is_dir($path2prefs) ) mkdir($path2prefs); $path2avatars = $path2prefs . "/avatar"; // if( !is_dir($path2avatars) ) mkdir($path2avatars); if ($avatar_old = Prefs::get('prefs', 'avatar')) { @unlink($path2avatars . '/' . $avatar_old); } $avatar_file = $path2avatars . "/" . _currentUser()->getLogin() . '.' . $regs[1]; move_uploaded_file($_FILES['prefs_avatar_upload']['tmp_name'], $avatar_file); $data['avatar'] = _currentUser()->getLogin() . '.' . $regs[1]; } } if (!isset($data['assistance'])) { $data['assistance'] = 0; } if (!isset($data['assistance_ien'])) { $data['assistance_ien'] = 0; } /* if( !isset($data['alerte_mail_active']) ) $data['alerte_mail_active']=0; */ // Enregistrement du reste dans la base principale $pref_service =& CopixClassesFactory::Create('prefs|prefs'); $pref_service->setPrefs($module, $data); }
/** * Affiche le nb de messages non lus de l'utilisateur courant * * Le nb de messages est cliquable et renvoie vers sa boîte de réception. S'il n'y a pas de messages, la zone n'affiche rien. * * @author Christophe Beyer <*****@*****.**> * @since 2005/10/17 */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $idUser = _currentUser()->getId(); if ($idUser) { $dao = _dao("minimail|minimail_to"); $messages = $dao->getListRecvUnread($idUser); $nbMessages = count($messages); $tpl->assign('nbMessages', $nbMessages); // retour de la fonction : $toReturn = $tpl->fetch('newminimail.tpl'); } return true; }
/** * Affiche la liste des pages d'un blog * * @author Christophe Beyer <*****@*****.**> * @since 2009/01/23 * @param string $titre Titre a donner a la zone * @param string $blog URL_blog du blog * @param integer $nb Nombre de pages a afficher * @param integer $page Id d'une page precise a afficher * @param integer $colonnes Nb de colonnes. Par defaut : 1 * @param integer $content Si on veut afficher le contenu des pages. Par defaut : 0 * @param boolean $hr Affiche un HR entre chaque page. Par defaut : 0 * @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) { $titre = $this->getParam('titre'); $blog = $this->getParam('blog'); $nb = $this->getParam('nb'); $tpl = new CopixTpl(); $tpl->assign('titre', $titre); $tpl->assign('blog', $blog); $tpl->assign('nb', $nb); $dao = _dao('blog|blogpage'); $tpl->assign('listPages', $dao->getAllPagesFromBlog($blog)); $toReturn = $tpl->fetch('zone_pages2.tpl'); return true; }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $blog = $this->getParam('blog', ''); $dao = _dao('blog|blogarticlecategory'); $listCategory = $dao->getAllCategoriesFromBlog($blog->id_blog); //encodage des URL à cause des caractères spéciaux foreach ($listCategory as $key => $category) { $listCategory[$key]->url_bacg = urlencode($category->url_bacg); } $tpl->assign('listCategory', $listCategory); $tpl->assign('blog', $blog); $toReturn = $tpl->fetch('listcategory.tpl'); return true; }