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) { $ppo = new CopixPPO(); // Récupération des paramètres $ppo->classeurId = $this->getParam('classeurId'); $ppo->dossierId = $this->getParam('dossierId'); $ppo->current = $this->getParam('current'); // Gestion des droits $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeurId); $ppo->typeUtilisateur = _currentUser()->getExtra('type'); $ppo->vue = !is_null(_sessionGet('classeur|typeVue')) ? _sessionGet('classeur|typeVue') : 'liste'; $ppo->conf_ModClasseur_options = CopixConfig::exists('default|conf_ModClasseur_options') ? CopixConfig::get('default|conf_ModClasseur_options') : 0; // L'album public est t-il publié ? $ppo->estPublic = false; if (!is_null($ppo->dossierId) && $ppo->dossierId != 0) { $dossierDAO = _ioDAO('classeur|classeurdossier'); $ppo->dossier = $dossierDAO->get($ppo->dossierId); if ($ppo->dossier->public) { $ppo->estPublic = true; } } else { $classeurDAO = _ioDAO('classeur|classeur'); $classeur = $classeurDAO->get($ppo->classeurId); if ($classeur->public) { $ppo->estPublic = true; } } $toReturn = $this->_usePPO($ppo, '_affichage_menu.tpl'); }
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', 0); $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); $ppo->cityGroupsIds = array(); $ppo->cityGroupsNames = array(); $citiesGroupDAO = _ioDAO('kernel|kernel_bu_groupe_villes'); if (_currentUser()->testCredential('module:*||cities_group|create@gestionautonome') || _currentUser()->isDirector && $ppo->conf->directorGlobalAffectation) { $criteria = _daoSp(); $criteria->orderBy('nom_groupe'); $cityGroups = $citiesGroupDAO->findBy($criteria); } else { $groups = _currentUser()->getGroups(); $cityGroups = $citiesGroupDAO->findByUserGroups($groups['gestionautonome|iconitogrouphandler']); } foreach ($cityGroups as $cityGroup) { $ppo->cityGroupsIds[] = $cityGroup->id_grv; $ppo->cityGroupsNames[] = $cityGroup->nom_groupe; } $toReturn = $this->_usePPO($ppo, '_filter_groupcity.tpl'); }
function _createContent(&$toReturn) { //Création du sous template. $tpl =& new CopixTpl(); //require_once (COPIX_MODULE_PATH.'cms/'.COPIX_CLASSES_DIR.'cmsworkflow.class.php'); require_once COPIX_MODULE_PATH . 'cms/' . COPIX_CLASSES_DIR . 'cmspage.services.class.php'; CopixContext::push('cms'); $sHeadings =& CopixClassesFactory::instanceOf('copixheadings|CopixHeadingsServices'); $headings = $sHeadings->getTree(); $cmsPages =& new ServicesCMSPage(); $pages = $cmsPages->getList(); if (isset($this->params['onlyLastVersion']) && $this->params['onlyLastVersion'] == 1) { $pages = $this->_filterLastVersion($pages); } CopixContext::pop(); //pagination foreach ($pages as $page) { $arPages[$page->id_head][] = $page; } $tpl->assign('arPublished', $arPages); $tpl->assign('arHeadings', $headings); $tpl->assign('select', $this->params['select']); $tpl->assign('back', $this->params['back']); $tpl->assign('popup', $this->params['popup']); $tpl->assign('height', Copixconfig::get('htmleditor|height')); $tpl->assign('width', Copixconfig::get('htmleditor|width')); $tpl->assign('editorType', CopixConfig::get('htmleditor|type')); $tpl->assign('editorName', $this->params['editorName']); $toReturn = $tpl->fetch('page.select.ptpl'); 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; }
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; }
/** * Surcharge de la fonction de vérification de l'enregistrement pour avoir les bons libellés. * @param DAORecord $pRecord L'enregistrement à vérifier */ public function check($pRecord) { //vérifications standards. if (($arErrors = $this->_compiled_check($pRecord)) === true) { $arErrors = array(); } //vérification du format du mail try { if (isset($pRecord->authoremail_comment)) { CopixFormatter::getMail($pRecord->authoremail_comment); } } catch (Exception $e) { $arErrors[] = $e->getMessage(); } // vérification de l'antispam if (CopixConfig::get('comments|captcha') != 0 && !isset($pRecord->noCaptcha)) { $results = _ioDAO('commentscaptcha')->findBy(_ioDAOSp()->addCondition("captcha_id", "=", $pRecord->captcha_id)); if (!(isset($results[0]) && $results[0]->captcha_answer == $pRecord->captcha_answer)) { $arErrors[] = _i18n('comments.admin.captcha.error'); } } //on remplace avec les bons libellés foreach ($arErrors as $key => $error) { $arErrors[$key] = str_replace(array('"content_comment"', '"authoremail_comment"', '"authorsite_comment"', '"authorlogin_comment"'), array(_i18n('comments.list.content'), _i18n('comments.list.mail'), _i18n('comments.list.site'), _i18n('comments.list.author')), $error); } //erreurs s'il en existe, true sinon return count($arErrors) == 0 ? true : $arErrors; }
/** * Pr�paration � l'�dition d'une page. */ public function doPrepareEditPage() { $id_blog = $this->getRequest('id_blog', null); $blogDAO = CopixDAOFactory::create('blog|blog'); $blog = $blogDAO->get($id_blog); if ($id_blog == null) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.param'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } if (!BlogAuth::canMakeInBlog('ADMIN_PAGES', $blog)) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotManagePage'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } $tpl = new CopixTpl(); $id_bpge = $this->getRequest('id_bpge', null); $page = null; if ($id_bpge != null) { // EDITION D'UNE PAGE $pageDAO = CopixDAOFactory::create('blog|blogpage'); $page = $pageDAO->get($id_bpge); } else { $page->is_online = CopixConfig::get('blog|blog.default.default_is_online_page'); $page->format_bpge = $blog->default_format_articles; } $tpl->assign('TITLE_PAGE', $blog->name_blog); // $menu = '<a href="'.CopixUrl::get ('blog|admin|showBlog', array("id_blog"=>$id_blog, "kind"=>5)).'">'.CopixI18N::get('blog|blog.nav.pages').'</a>'; $menu = getBlogAdminMenu($blog, 5); $tpl->assign('MENU', $menu); $tpl->assign('MAIN', CopixZone::process('EditPage', array('id_blog' => $id_blog, 'id_bpge' => $id_bpge, 'page' => $page, 'kind' => $this->getRequest('kind', '0')))); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
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'); }
/** * Retourne le catalogue de vocabulaire par défaut * * @return DAORecordKernel_i18n_vocabulary_catalog or false */ public function getDefaultCatalog() { $criteria = _daoSp(); $criteria->addCondition('id_vc', '=', CopixConfig::get('kernel|defaultVocabularyCatalog')); $results = $this->findBy($criteria); return isset($results[0]) ? $results[0] : false; }
/** * 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->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 getTagsByGroups($idGroups = array()) { $groupsCollection = array(); foreach ($idGroups as $idGroup) { $groupsCollection[$idGroup]['tags'] = $this->getTagsByGroup($idGroup); } //calculate tags weight for group List $tagCollection = array(); $max = 1; foreach ($groupsCollection as $group) { foreach ($group['tags'] as $tag) { if (!isset($tagCollection[$tag['name']])) { $tagCollection[$tag['name']] = 1; } else { $tagCollection[$tag['name']]++; if ($tagCollection[$tag['name']] > $max) { $max = $tagCollection[$tag['name']]; } } } } //ponderate between 1 and 100 $ponde = 100 / $max; $ponderation = CopixConfig::get('groupe|ponderation'); foreach ($tagCollection as $tagName => $weight) { $tagCollection[$tagName] = round($weight * $ponde / $ponderation); } return $return = array('tags' => $tagCollection, 'groups' => $groupsCollection); }
public function create($infos = array()) { $blogDAO = _dao('blog|blog'); $res = null; $tabBlogFunctions = returnAllBlogFunctions(); $blog = _record('blog|blog'); if ($infos['title']) { $blog->name_blog = $infos['title'] . (isset($infos['subtitle']) && strlen($infos['subtitle']) > 0 ? ' (' . $infos['subtitle'] . ')' : ''); } else { $blog->name_blog = CopixI18N::get('blog|blog.default.titre'); } $blog->id_ctpt = 1; $blog->style_blog_file = 0; $is_public_default = CopixConfig::exists('blog|blog.default.is_public') ? CopixConfig::get('blog|blog.default.is_public') : 1; $blog->is_public = isset($infos['is_public']) ? $infos['is_public'] : $is_public_default; $blog->has_comments_activated = 0; $blog->type_moderation_comments = CopixConfig::get('blog|blog.default.type_moderation_comments'); $blog->default_format_articles = CopixConfig::get('blog|blog.default.default_format_articles'); $blog->privacy = CopixConfig::exists('blog|blog.default.privacy') ? CopixConfig::get('blog|blog.default.privacy') : 0; $blogDAO->insert($blog); if ($blog->id_blog !== NULL) { // On détermine l'URL titre $blog->url_blog = KernelBlog::calcule_url_blog($blog->id_blog, $blog->name_blog); $blogDAO->update($blog); // On ajoute une catégorie $categoryDAO = _dao('blog|blogarticlecategory'); $category = _record('blog|blogarticlecategory'); $category->id_blog = $blog->id_blog; $category->name_bacg = CopixI18N::get('blog|blog.default.categorie'); $category->url_bacg = killBadUrlChars($category->name_bacg) . date('YmdHis'); $category->order_bacg = $categoryDAO->getNewPos($blog->id_blog); $categoryDAO->insert($category); } return $blog->id_blog !== NULL ? $blog->id_blog : NULL; }
function _createContent(&$toReturn) { $tpl =& new CopixTpl(); $tpl->assign('login', $this->params['login']); $tpl->assign('enabledSendLogin', CopixConfig::get('auth|enableSendLostPassword')); $toReturn = $tpl->fetch('login.failed.tpl'); }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $tpl->assign('homepageUrl', CopixConfig::get('|homePage')); $toReturn = $tpl->fetch('selecthomepage.form.tpl'); return true; }
public function getChart($php_source, $width = 400, $height = 250, $bg_color = "666666", $transparent = false) { $flash_file = $this->swf_file; $library_path = $this->library; $php_source = urlencode($php_source); $library_path = urlencode($library_path); $html = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "; $html .= "WIDTH=" . $width . " HEIGHT=" . $height . " id='charts' ALIGN=''>"; $u = strpos($flash_file, "?") === false ? "?" : (substr($flash_file, -1) === "&" ? "" : "&"); $html .= "<PARAM NAME=movie VALUE='" . $flash_file . $u . "library_path=" . $library_path . "&php_source=" . $php_source; if (($license = CopixConfig::get('chart_swf|license')) != "") { $html .= "&license=" . $license; } $html .= "'> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#" . $bg_color . "> "; if ($transparent) { $html .= "<PARAM NAME=wmode VALUE=transparent> "; } $html .= "<EMBED src='" . $flash_file . $u . "library_path=" . $library_path . "&php_source=" . $php_source; if (($license = CopixConfig::get('chart_swf|license')) != "") { $html .= "&license=" . $license; } $html .= "' quality=high bgcolor=#" . $bg_color . " WIDTH=" . $width . " HEIGHT=" . $height . " NAME='charts' ALIGN='' swLiveConnect='true' "; if ($transparent) { $html .= "wmode=transparent "; } $html .= "TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>"; return $html; }
public function processDefault() { $tpl = new CopixTpl(); $tplModule = new CopixTpl(); //if user is not connected : if (1) { // S'il y a un blog prevu a l'accueil $dispBlog = false; $getKernelLimitsIdBlog = Kernel::getKernelLimits('id_blog'); if ($getKernelLimitsIdBlog) { _classInclude('blog|kernelblog'); if ($blog = _ioDao('blog|blog')->getBlogById($getKernelLimitsIdBlog)) { // On v�rifie qu'il y a au moins un article $stats = KernelBlog::getStats($blog->id_blog); if ($stats['nbArticles']['value'] > 0) { $dispBlog = true; } } } if ($dispBlog) { //return CopixActionGroup::process ('blog|frontblog::getListArticle', array ('blog'=>$blog->url_blog)); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog||', array('blog' => $blog->url_blog))); } if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) { CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('public||rss', array()) . '" type="application/rss+xml" title="' . htmlentities(CopixI18N::get('public|public.rss.flux.title')) . '" />'); } CopixHTMLHeader::addCSSLink(_resource("styles/module_fichesecoles.css")); $tplModule->assign('user', _currentUser()); $result = $tplModule->fetch('welcome|welcome_' . CopixI18N::getLang() . '.tpl'); $tpl->assign('TITLE_PAGE', '' . CopixI18N::get('public|public.welcome.title')); $tpl->assign('MAIN', $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); } }
public function _createContent(&$toReturn) { //load PPO $ppo = new CopixPPO(); $ppo->user = _currentUser(); //if user is connected : load personal informations if ($ppo->user->isConnected()) { $ppo->animateur = _sessionGet('user_animateur') ? 1 : 0; $ppo->ien = _sessionGet('prisedecontrole_ien') ? 1 : 0; $type = $ppo->user->getExtra('type'); $sexe = $ppo->user->getExtra('sexe') == 2 ? 2 : ''; $ppo->usertype = strtolower($type) . $sexe; } // Get vocabulary catalog to use if ($myNode = CopixSession::get('myNode')) { $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog'); $vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode($myNode['type'], $myNode['id']); } $ppo->vocabularyCatalogId = isset($vocabularyCatalog) ? $vocabularyCatalog->id_vc : CopixConfig::get('kernel|defaultVocabularyCatalog'); $this->addJs('js/iconito/module_auth.js'); $this->addCss('styles/module_auth.css'); $ppo->conf_Cas_actif = CopixConfig::exists('default|conf_Cas_actif') ? CopixConfig::get('default|conf_Cas_actif') : 0; $ppo->conf_Saml_actif = CopixConfig::exists('default|conf_Saml_actif') ? CopixConfig::get('default|conf_Saml_actif') : 0; //load tpl $toReturn = $this->_usePPO($ppo, 'userlogged.tpl'); }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO $tpl = new CopixTpl(); $tpl->assign('blog', $this->getParam('blog', null)); $tpl->assign('kind', $this->getParam('kind', null)); $tpl->assign('id_blog', $this->getParam('id_blog', '')); $tpl->assign('errors', $this->getParam('errors', '')); $tpl->assign('showErrors', $this->getParam('showErrors', '')); $tpl->assign('logoPath', $this->getParam('logoPath', null)); $tpl->assign('tabBlogFunctions', $this->getParam('tabBlogFunctions', null)); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('is_public', array('values' => array(1, 0), 'output' => array(CopixI18N::get('blog|blog.oui'), CopixI18N::get('blog|blog.non')))); $tpl->assign('has_comments_activated', array('values' => array(1, 0), 'output' => array(CopixI18N::get('blog|blog.oui'), CopixI18N::get('blog|blog.non')))); $tpl->assign('type_moderation_comments', array('values' => array('POST', 'PRE'), 'output' => array(CopixI18N::get('blog|blog.type_moderation_comments.post'), CopixI18N::get('blog|blog.type_moderation_comments.pre')))); if (CopixConfig::get('blog|blog.default.can_format_articles')) { $formats = CopixConfig::get('blog|blog.formats_articles'); $tabFormats = explode(',', $formats); $values = $output = array(); foreach ($tabFormats as $k) { $values[] = $k; $output[] = CopixI18N::get('blog|blog.default_format_articles.' . $k); } $tpl->assign('default_format_articles', array('values' => $values, 'output' => $output)); } else { $tpl->assign('default_format_articles', CopixConfig::get('blog|blog.default.default_format_articles')); } $tpl->assign('logo_max_width', CopixConfig::get('blog|blog.default.logo_max_width')); // retour de la fonction : $toReturn = $tpl->fetch('blog.edit.tpl'); return true; }
/** * Par défaut, on redirige vers l'url d'accueil définie dans les paramètres */ public function processDefault() { $home = CopixConfig::get('|homePage'); if (strpos($home, 'http://') !== 0) { $home = _url() . $home; } return _arRedirect($home); }
/** * ici on retourne la factory en fonction des parametres dans module.xml */ public static function getChartFactory() { switch (CopixConfig::get('Chart|chartfactory')) { case 'SwfChart': return CopixClassesFactory::getInstanceOf('chart_swf|SwfChartFactory'); break; } }
/** * Récupère une lettre au hazard * */ private function _pickLetter() { $pick = $this->_hash[rand(0, count($this->_hash) - 1)]; if (!in_array($pick, explode(';', CopixConfig::get('generictools|excludeFromPassword')))) { return $pick; } return $this->_pickLetter(); }
/** * Tests de get/set avec des valeurs spéciales */ public function testSpecialValues() { CopixConfig::set('copixtest|test', 'fooValue avec des \' " / / \\ '); $this->assertEquals(CopixConfig::get('copixtest|test'), 'fooValue avec des \' " / / \\ '); CopixConfig::get('copixtest|test'); CopixConfig::set('copixtest|test', 'foo'); $this->assertEquals(CopixConfig::get('copixtest|testSpecial'), "mon\\chemin\\et\\sous\\chemin"); }
/** * get all available format and their caption */ function getFormatList() { $list = explode(';', CopixConfig::get('comment|textFormatList')); $toReturn = array(); foreach ((array) $list as $format) { $toReturn[$format] = CopixI18N::get('comment|comment.format.' . $format); } return $toReturn; }
/** * 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; }
/** * Création de la zone de login */ public function _createContent(&$toReturn) { $ppo = new CopixPPO(); $ppo->user = CopixAuth::getCurrentUser()->isConnected() ? CopixAuth::getCurrentUser() : null; $ppo->auth_url_return = $this->getParam('auth_url_return', _url('#')); $ppo->createUser = CopixConfig::get('auth|createUser'); $ppo->ask_remember = false; $toReturn = $this->_usePPO($ppo, $this->getParam('template', 'login.form.php')); }
/** * Envoie un minimail * * @author Christophe Beyer <*****@*****.**> * @since 2005/10/18 * @param string title Titre du minimail * @param string message Corps du minimail * @param integer from_id Id utilisateur de l'exp�diteur * @param array destin Id tableau avec les destinataires (cl� = id user) * @return mixed Id du message cr�� ou NULL si erreur */ public function sendMinimail($title, $message, $from_id, $destin, $format) { $res = NULL; $DAOminimail_from = _dao("minimail|minimail_from"); $DAOminimail_to = _dao("minimail|minimail_to"); $newMp = _record("minimail|minimail_from"); $newMp->title = $title; $newMp->message = $message; $newMp->format = $format; $newMp->date_send = date("Y-m-d H:i:s"); $newMp->from_id = $from_id; $newMp->is_deleted = 0; $DAOminimail_from->insert($newMp); if ($newMp->id !== NULL) { //print_r($newMp); // On parcourt chaque destinataire while (list($to_id, ) = each($destin)) { // print_r("to_id=$to_id / to_login=$to_login"); $newDest = _record("minimail|minimail_to"); $newDest->id_message = $newMp->id; $newDest->to_id = $to_id; $newDest->date_read = 0; $newDest->is_read = 0; $newDest->is_replied = 0; $newDest->is_deleted = 0; $DAOminimail_to->insert($newDest); // ======= Alerte mail =============== // On vérifie que l'envoi de mails est activé, qu'un serveur SMTP est configuré, que le destinataire a coché l'option "etre prêvenu par mail" et qu'il a renseigné un mail if ($newDest->id2 && CopixConfig::get('|mailEnabled') == 1 && CopixConfig::get('|mailSmtpHost')) { $prefs = Prefs::getPrefs($to_id); if (isset($prefs['prefs']['alerte_mail_email']) && isset($prefs['minimail']['alerte_minimail']) && $prefs['prefs']['alerte_mail_email'] && $prefs['minimail']['alerte_minimail'] == 1) { $userInfoFrom = Kernel::getUserInfo("ID", $from_id); //print_r($userInfoFrom); $to = $prefs['prefs']['alerte_mail_email']; $auteur = utf8_decode($userInfoFrom['prenom'] . ' ' . $userInfoFrom['nom'] . ' (' . $userInfoFrom['login'] . ')'); $subject = CopixI18N::get('minimail|minimail.mail.alert.subject', array($auteur)); $message = str_replace('<br />', "\n", CopixI18N::get('minimail|minimail.mail.alert.body', array($auteur, CopixUrl::get('minimail||getMessage', array('id' => $newMp->id)), CopixUrl::get()))); $from = CopixConfig::get('default|mailFrom'); $fromName = CopixConfig::get('default|mailFromName'); $cc = $cci = ''; $monMail = new CopixTextEMail($to, $cc, $cci, $subject, $message); $send = $monMail->send($from, $fromName); } } // ======= Fin alerte mail =============== } $res = $newMp->id; if ($res) { $plugStats = CopixPluginRegistry::get("stats|stats"); $plugStats->setParams(array('module' => 'minimail', 'action' => 'sendMinimail', 'objet_a' => $res)); } } return $res; }
/** * @author Christophe Beyer <*****@*****.**> * @since 2006/03/23 */ public function _createContent(&$toReturn) { $blog = $this->getParam('blog', null); $tpl = new CopixTpl(); $arArticle = _ioDAO('blog|blogarticle')->findPublic(array('categories' => true, 'nb' => intval(CopixConfig::get('public|rss.nbArticles')))); $rss = array('title' => CopixI18N::get('public|public.rss.flux.title'), 'link' => CopixUrl::get(), 'description' => CopixI18N::get('public|public.rss.flux.description'), 'language' => 'fr-fr', 'copyright' => "Iconito", 'generator' => "Iconito", 'logo' => 0); $tpl->assign('rss', $rss); $tpl->assign('blog', $blog); $tpl->assign('listArticle', $arArticle); $toReturn = $tpl->fetch('rss.tpl'); return true; }
/** * Valeur de la conf pour un parametre * * @author Christophe Beyer <*****@*****.**> * @param string $parameter * @since 2009/08/13 */ function smarty_function_copixconf($params, &$smarty) { $conf = CopixConfig::exists($params['parameter']) ? CopixConfig::get($params['parameter']) : null; if (isset($params['assign'])) { $assignVar = $params['assign']; //unset ($params['assign']); $smarty->assign($assignVar, $conf); return; } else { return $conf; } }