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); } }
/** * go * * Appel automatique, avec détection du noeud à afficher. * @author Frédéric Mossmann * @since 10.03.2009 * */ public function go() { if (!Kernel::is_connected()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.nologin'), 'back' => CopixUrl::get('auth|default|login'))); } CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_concerto.js'); if (!_request("id") || !ereg('^[0-9]+$', _request("id"))) { return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('kernel||getNodes')); } $sql = 'SELECT login,password FROM kernel_bu_auth WHERE node_type=\'responsable\' AND node_id=' . _currentUser()->getExtra('id') . ' AND id=\'' . addslashes(_request("id")) . '\' AND service=\'concerto\''; $concerto = _doQuery($sql); if (!$concerto) { return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('kernel||getNodes')); } $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('concerto|concerto.title')); // $tpl->assign ('MENU', '<a href="'.CopixUrl::get ('groupe||getListPublic').'">'.CopixI18N::get ('groupe|groupe.annuaire').'</a> :: <a href="'.CopixUrl::get ('groupe||getListMy').'">'.CopixI18N::get ('groupe|groupe.my').'</a>'); $tplListe = new CopixTpl(); $tplListe->assign('login', $concerto[0]->login); $tplListe->assign('password', $concerto[0]->password); $result = $tplListe->fetch("concerto-form.tpl"); $tpl->assign("MAIN", $result); $tpl->assign('BODY_ON_LOAD', 'concerto_redirect();'); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Plugin smarty type fonction * Purpose: send form by javascript to given href. * * Input: href = (required) where to send the form * form = (required) id of the form * assign = (optional) name of the template variable we'll assign * the output to instead of displaying it directly * * Examples: */ function smarty_function_jssubmitform($params, &$this) { if (!isset($params['href'])) { $this->_trigger_fatal_error("[smarty jssubmitform] Missing href parameter"); return; } if (!isset($params['form'])) { $this->_trigger_fatal_error("[smarty jssubmitform] Missing form parameter"); return; } static $_init = false; if (!$_init) { $jsCode = 'function doSubmitForm (pUrl, formId) { var myForm = document.getElementById(formId); myForm.action = pUrl; myForm.submit (); return false; }'; CopixHtmlHeader::addJsCode($jsCode); $_init = true; } $toReturn = 'return doSubmitForm(\'' . $params['href'] . '\', \'' . $params['form'] . '\')'; if (isset($params['assign'])) { $this->assign($params['assign'], $toReturn); return ''; } else { return $toReturn; } }
function smarty_function_htmlarea($params, &$smarty) { static $_init = false; extract($params); //check the initialisation if (!$_init) { CopixHtmlHeader::addJsCode('_editor_url = "' . CopixUrl::get() . 'js/htmlarea/";'); //path of the library if (empty($path)) { $path = CopixUrl::get() . 'js/htmlarea/'; //default path under CopiX } CopixHTMLHeader::addJSLink($path . 'htmlarea.js'); CopixHTMLHeader::addJSLink($path . 'dialog.js'); if (empty($lang)) { $lang = CopixI18N::getLang(); } CopixHTMLHeader::addJSLink($path . 'lang/' . $lang . '.js'); CopixHTMLHeader::addCSSLink($path . 'htmlarea.css'); CopixHTMLHeader::addJSLink($path . 'popupwin.js'); CopixHTMLHeader::addJSCode(' HTMLArea.loadPlugin("TableOperations"); HTMLArea.loadPlugin("InsertAnchor"); HTMLArea.loadPlugin("TableToggleBorder"); HTMLArea.loadPlugin("AstonTools"); HTMLArea.loadPlugin("ContextMenu"); '); $_init = true; } if (empty($content)) { $content = ''; } //name of the textarea. if (empty($name)) { $smarty->trigger_error('htmlarea: missing name parameter'); } else { // CopixHTMLHeader::addOthers ($script); if (!$width) { $width = 500; } if (!$height) { $height = 500; } $out = '<textarea id="' . $name . '" name="' . $name . '" style="width: ' . $width . 'px; height:' . $height . 'px;" >' . $content . '</textarea>'; $out .= '<script type="text/javascript" defer="1"> var editor' . $name . ' = null; editor' . $name . ' = new HTMLArea("' . $name . '"); editor' . $name . '.registerPlugin("TableOperations"); editor' . $name . '.registerPlugin("TableToggleBorder"); editor' . $name . '.registerPlugin("InsertAnchor"); editor' . $name . '.registerPlugin("AstonTools"); editor' . $name . '.registerPlugin("ContextMenu"); editor' . $name . '.config.pageStyle = "@import url(\\"' . CopixUrl::get() . 'styles/styles_copix.css\\");"; editor' . $name . '.generate (); </script>'; } return $out; }
/** * Affichage de la fiche d'une ecole * * @author Christophe Beyer <*****@*****.**> * @since 2008/09/03 * @param integer $id Id de l'ecole * @param integer $popup 1 pour afficher la fiche en popup Fancybox */ public function fiche() { $id = $this->getRequest('id', null); $iPopup = CopixRequest::getInt('popup'); $ecoleDAO = CopixDAOFactory::create('kernel|kernel_bu_ecole'); $ficheDAO = CopixDAOFactory::create("fiches_ecoles"); $criticErrors = array(); if (!($rEcole = $ecoleDAO->get($id))) { $criticErrors[] = CopixI18N::get('fichesecoles.error.param'); } elseif (!FichesEcolesService::canMakeInFicheEcole($id, 'VIEW')) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('annuaire||'))); } $rFiche = $ficheDAO->get($id); $tpl = new CopixTpl(); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); $fiche = CopixZone::process('fiche', array('rEcole' => $rEcole, 'rFiche' => $rFiche)); $main = $fiche; $title = $rEcole->nom; if ($rEcole->type) { $title .= ' (' . $rEcole->type . ')'; } $tpl->assign('TITLE_PAGE', $title); // Get vocabulary catalog to use $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog'); $vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode('BU_ECOLE', $rEcole->numero); if (strtolower($rEcole->type) == 'crèche') { $tpl->assign('TITLE_CONTEXT', CopixI18N::get('kernel|kernel.codes.mod_fichesecoles_creche')); } else { $tpl->assign('TITLE_CONTEXT', CopixCustomI18N::get('kernel|kernel.codes.mod_fiche%%structure%%', array('catalog' => $vocabularyCatalog->id_vc))); } $menu = array(); $menu[] = array('url' => CopixUrl::get('public||getListBlogs'), 'txt' => CopixCustomI18N::get('public|public.blog.annuaire.%%structures%%', array('catalog' => $vocabularyCatalog->id_vc))); if (Kernel::is_connected()) { $menu[] = array('url' => CopixUrl::get('annuaire||getAnnuaireEcole', array('ecole' => $rEcole->numero)), 'txt' => CopixCustomI18N::get('annuaire|annuaire.back%%structure%%', array('catalog' => $vocabularyCatalog->id_vc))); } if (CopixConfig::exists('|can_annuaire_menu') && !CopixConfig::get('|can_annuaire_menu')) { $menu = array(); } $tpl->assign('MENU', $menu); $tpl->assign("MAIN", $main); if ($iPopup) { $ppo = new CopixPPO(); $ppo->fiche = $fiche; $ppo->TITLE = $title; return _arPPO($ppo, array('template' => 'fiche_popup.tpl', 'mainTemplate' => 'main|main_fancy.php')); } return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Affiche la liste des blogs ayant au moins un article * * @author Christophe Beyer <*****@*****.**> * @since 2006/03/23 * @param string $kw Mot-clé pour la recherche (option) */ public function _createContent(&$toReturn) { CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); $kw = $this->getParam('kw', null); $tpl = new CopixTpl(); $dao = _dao("blog|blog"); if ($kw) { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND name_blog LIKE '%" . addslashes($kw) . "%' ORDER BY name_blog"; } else { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND 1 ORDER BY name_blog"; } $sql = _doQuery($critere); $list = array(); //print_r($sql); foreach ($sql as $blog) { $parent = Kernel::getModParentInfo("MOD_BLOG", $blog->id_blog); if ($parent) { $blog->parent = $parent['nom']; switch ($parent['type']) { case 'CLUB': $blog->type = CopixI18N::get('public.blog.typeClub'); break; case 'BU_CLASSE': $blog->type = CopixI18N::get('public.blog.typeClasse'); break; case 'BU_ECOLE': $blog->type = CopixI18N::get('public.blog.typeEcole'); break; case 'BU_VILLE': $blog->type = CopixI18N::get('public.blog.typeVille'); break; default: $blog->type = $parent['type']; break; } } $blog->stats = KernelBlog::getStats($blog->id_blog); //print_r($blog); if ($blog->stats['nbArticles']['value'] > 0) { $list[] = $blog; } } usort($list, "order_tab_blogs"); $tpl->assign('list', $list); $toReturn = $tpl->fetch('getlistblogszone.tpl'); return true; }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO CopixHTMLHeader::addCSSLink(_resource("styles/module_blog_admin.css")); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_blog.js'); $tpl = new CopixTpl(); $id_blog = $this->getParam('id_blog', ''); $tpl->assign('article', $this->getParam('article', null)); $tpl->assign('kind', $this->getParam('kind', null)); $tpl->assign('id_blog', $id_blog); $tpl->assign('id_bact', $this->getParam('id_bact', '')); $tpl->assign('errors', $this->getParam('errors', '')); $tpl->assign('showErrors', $this->getParam('showErrors', false)); $tpl->assign('preview', $this->getParam('preview', '0')); $tpl->assign('tabArticleCategory', $this->getParam('tabArticleCategory', null)); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('default_format_articles', CopixConfig::get('blog|blog.default.default_format_articles')); $formats = CopixConfig::get('blog|blog.formats_articles'); $tabFormats = explode(',', $formats); $values = $output = array(); foreach ($tabFormats as $k) { $values[] = $k; $output[] = CopixI18N::get('blog|blog.default_format_articles.' . $k); } $tpl->assign('format_bact', array('values' => $values, 'output' => $output)); $art = $this->getParam('article'); $tpl->assign('edition_sumary', CopixZone::process('kernel|edition', array('field' => 'sumary_bact', 'format' => $art->format_bact, 'content' => $art->sumary_bact, 'options' => array('toolbarSet' => 'IconitoBlog'), 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 160))); $tpl->assign('edition_content', CopixZone::process('kernel|edition', array('field' => 'content_bact', 'format' => $art->format_bact, 'content' => $art->content_bact, 'options' => array('toolbarSet' => 'IconitoBlog'), 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 290))); //cat�gorie de l'article if ($this->getParam('kind', null) == 1) { $article = $this->getParam('article', null); $idCategorie = $article->tabSelectCat[0]; foreach ($this->getParam('tabArticleCategory', null) as $key => $obj) { if ($obj->id_bacg == $idCategorie) { $categorie = $obj->name_bacg; } } $tpl->assign('categorie', $categorie); } $tpl->assign('canWriteOnline', BlogAuth::canMakeInBlog('ADMIN_ARTICLE_MAKE_ONLINE', create_blog_object($id_blog))); // retour de la fonction : $toReturn = $tpl->fetch('article.edit.tpl'); return true; }
/** * Affiche la liste des blogs * * @author Christophe Beyer <*****@*****.**> * @since 2006/03/09 * @todo Positionner $grville */ public function processGetListBlogs() { if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) { CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('public||rss', array()) . '" type="application/rss+xml" title="' . htmlentities(CopixI18N::get('public|public.rss.flux.title')) . '" />'); } CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_annuaire.js'); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('public|public.blog.annuaire')); $kw = $this->getRequest('kw', null); $grville = 1; $tplListe = new CopixTpl(); if ($ville_as_array = Kernel::getKernelLimits('ville_as_array')) { $tplListe->assign('list', CopixZone::process('GetListBlogs2', array('kw' => $kw, 'ville' => $ville_as_array))); } else { $tplListe->assign('list', CopixZone::process('GetListBlogs2', array('kw' => $kw, 'grville' => $grville))); } $tplListe->assign('kw', $kw); $result = $tplListe->fetch("getlistblogs.tpl"); $tpl->assign("MAIN", $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO CopixHTMLHeader::addCSSLink(_resource("styles/module_blog_admin.css")); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_blog.js'); $tpl = new CopixTpl(); $id_blog = $this->getParam('id_blog', ''); $tpl->assign('page', $this->getParam('page', null)); $tpl->assign('id_blog', $this->getParam('id_blog', '')); $tpl->assign('id_bpge', $this->getParam('id_bpge', '')); $tpl->assign('errors', $this->getParam('errors', '')); $tpl->assign('showErrors', $this->getParam('showErrors', '')); $tpl->assign('preview', $this->getParam('preview', '0')); $tpl->assign('kind', $this->getParam('kind', '0')); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('default_format_articles', CopixConfig::get('blog|blog.default.default_format_articles')); //$tpl->assign ('wikibuttons', CopixZone::process ('kernel|wikibuttons', array('field'=>'content_bpge', 'object'=>array('type'=>'MOD_BLOG', 'id'=>$this->getParam('id_blog'))))); $formats = CopixConfig::get('blog|blog.formats_articles'); $tabFormats = explode(',', $formats); $values = $output = array(); foreach ($tabFormats as $k) { $values[] = $k; $output[] = CopixI18N::get('blog|blog.default_format_articles.' . $k); } $tpl->assign('format_bpge', array('values' => $values, 'output' => $output)); $pag = $this->getParam('page'); //print_r($pag); if (!isset($pag->content_bpge)) { $pag->content_bpge = ''; } //$content = (isset($pag->content_bpge)) ? $pag->content_bpge : ''; //$tpl->assign ('content_bpge', CopixZone::process ('kernel|edition', array('field'=>'content_bpge', 'format'=>'wiki', 'content'=>$content, 'object'=>array('type'=>'MOD_BLOG', 'id'=>$this->getParam('id_blog')), 'height'=>290))); $tpl->assign('edition_content', CopixZone::process('kernel|edition', array('field' => 'content_bpge', 'format' => $pag->format_bpge, 'content' => $pag->content_bpge, 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 290))); $tpl->assign('canWriteOnline', BlogAuth::canMakeInBlog('ADMIN_ARTICLE_MAKE_ONLINE', create_blog_object($id_blog))); // retour de la fonction : $toReturn = $tpl->fetch('page.edit.tpl'); return true; }
public function process($params) { static $_init = false; if (!isset($params['href'])) { throw new CopixTemplateTagException("[smarty jssubmitform] Missing href parameter"); return; } if (!isset($params['form'])) { throw new CopixTemplateTagException("[smarty jssubmitform] Missing form parameter"); return; } if (!$_init) { $jsCode = 'function doSubmitForm (pUrl, formId) { var myForm = document.getElementById(formId); myForm.action = pUrl; myForm.submit (); return false; }'; CopixHtmlHeader::addJsCode($jsCode); $_init = true; } $toReturn = 'return doSubmitForm(\'' . $params['href'] . '\', \'' . $params['form'] . '\')'; return $toReturn; }
/** * 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); }
function smarty_function_htmleditor($params, &$smarty) { static $_init = false; extract($params); //check the initialisation if (!$_init) { switch (strtolower(CopixConfig::get('htmleditor|type'))) { case 'htmlarea': CopixHtmlHeader::addJsCode('_editor_url = "' . CopixUrl::get() . 'js/htmlarea/";'); //path of the library if (empty($htmlPath)) { $htmlPath = CopixUrl::get() . 'js/htmlarea/'; //default path under CopiX } CopixHTMLHeader::addJSLink($htmlPath . 'htmlarea.js'); CopixHTMLHeader::addJSLink($htmlPath . 'dialog.js'); if (empty($lang)) { $lang = CopixI18N::getLang(); } CopixHTMLHeader::addJSLink($htmlPath . 'lang/' . $lang . '.js'); CopixHTMLHeader::addCSSLink($htmlPath . 'htmlarea.css'); CopixHTMLHeader::addJSLink($htmlPath . 'popupwin.js'); $jsCode = 'HTMLArea.loadPlugin("TableOperations"); HTMLArea.loadPlugin("InsertAnchor"); HTMLArea.loadPlugin("TableToggleBorder"); HTMLArea.loadPlugin("ContextMenu");'; if (CopixModule::isValid('pictures') && CopixModule::isValid('cms') && CopixModule::isValid('document')) { $jsCode = 'HTMLArea.loadPlugin("AstonTools");'; } CopixHTMLHeader::addJSCode($jsCode); break; case 'fckeditor': default: $path = COPIX_MODULE_PATH . 'htmleditor/' . COPIX_CLASSES_DIR; $htmlPath = CopixUrl::get() . 'js/FCKeditor/'; require_once $path . 'fckeditor.php'; break; } // CopixHTMLHeader::addJSLink ($path.'fckconfig.js'); // CopixHTMLHeader::addJSLink ($path.'fckeditor.js'); $_init = true; } if (empty($content)) { $content = ' '; } //name of the textarea. if (empty($name)) { $smarty->trigger_error('htmleditor: missing name parameter'); } else { if (!$width) { $width = CopixConfig::get('htmleditor|width'); //$width = '100%'; } if (!$height) { $height = CopixConfig::get('htmleditor|height'); //$height = '450px'; } switch (strtolower(CopixConfig::get('htmleditor|type'))) { case 'htmlarea': $out = '<textarea id="' . $name . '" name="' . $name . '" style="width: ' . $width . 'px; height:' . $height . 'px;" >' . $content . '</textarea>'; $out .= '<script type="text/javascript" defer="1"> var editor' . $name . ' = null; editor' . $name . ' = new HTMLArea("' . $name . '"); editor' . $name . '.registerPlugin("TableOperations"); editor' . $name . '.registerPlugin("TableToggleBorder"); editor' . $name . '.registerPlugin("InsertAnchor"); editor' . $name . '.registerPlugin("ContextMenu");'; if (CopixModule::isValid('pictures') && CopixModule::isValid('cms') && CopixModule::isValid('document')) { $out .= 'editor' . $name . '.registerPlugin("AstonTools");'; } $out .= 'editor' . $name . '.config.pageStyle = "@import url(\\"' . CopixUrl::get() . 'styles/styles_copix.css\\");"; editor' . $name . '.generate (); </script>'; break; case 'fckeditor': default: /* * ATTENTION les éléments de config viewPhototèque etc font doublon avec la sélection de la toolbarset, mais sont nécessaire à Copix * Par contre si on ne les load pas, on a une erreur de FCKeditor, il faut donc supprimer ce gestionnaire d'erreur sinon on se prend un alert javascript * le gestionnaire en question se trouve dans "FCKToolbarItems.GetItem" (chercher cette chaîne pour le trouver) et désactiver "alert( FCKLang.UnknownToolbarItem.replace( /%1/g, itemName ) ) ;" */ $oFCKeditor = new FCKeditor($name); $oFCKeditor->BasePath = $htmlPath; $oFCKeditor->Value = $content; $oFCKeditor->ToolbarSet = 'Copix'; $oFCKeditor->Width = $width; $oFCKeditor->Height = $height; $oFCKeditor->Config['viewPhototheque'] = CopixModule::isValid('pictures') ? 'true' : 'false'; $oFCKeditor->Config['viewCmsLink'] = CopixModule::isValid('cms') ? 'true' : 'false'; $oFCKeditor->Config['viewLinkPopup'] = CopixModule::isValid('cms') ? 'true' : 'false'; $oFCKeditor->Config['viewDocument'] = CopixModule::isValid('document') ? 'true' : 'false'; // Configuration de la feuille de style à utiliser. $oFCKeditor->Config['EditorAreaCSS'] = CopixUrl::get() . 'styles/styles_copix.css'; $out = $oFCKeditor->CreateHtml(); break; } } return $out; }
public function addFile($iPathToJs) { CopixHtmlHeader::addJSLink(CopixUrl::get() . $iPathToJs); }
/** * Affichage d'un annuaire de classe * * @author Christophe Beyer <*****@*****.**> * @since 2006/01/18 * @param integer $classe Id de la classe */ public function getAnnuaireClasse() { if (!Kernel::is_connected()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('annuaire|annuaire.error.noLogged'), 'back' => CopixUrl::get('||'))); } $classe = _request("classe") ? _request("classe") : NULL; $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); $criticErrors = array(); $rClasse = Kernel::getNodeInfo('BU_CLASSE', $classe, false); $matrix =& enic::get('matrixCache'); if (!$rClasse) { $criticErrors[] = CopixI18N::get('annuaire|annuaire.error.noClasse'); } elseif (!$matrix->classe($classe)->_right->count->voir > 0) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('annuaire||'))); } CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); // Si c'est le détail d'une classe, on en déduit l'école $parent = Kernel::getNodeParents('BU_CLASSE', $classe); if ($parent[0]['type'] == 'BU_ECOLE') { $ecole = $parent[0]['id']; } $rEcole = Kernel::getNodeInfo('BU_ECOLE', $ecole, false); // Blog de l'école $blog = getNodeBlog('BU_ECOLE', $ecole, array('is_public' => 1)); if ($blog) { $rEcole['blog'] = CopixUrl::get('blog||', array('blog' => $blog->url_blog)); } $tplListe = new CopixTpl(); $tplListe->assign('infosecole', CopixZone::process('annuaire|infosecole', array('rEcole' => $rEcole))); $tplListe->assign('infosclasse', CopixZone::process('annuaire|infosclasse', array('rClasse' => $rClasse))); $tplListe->assign('classe', $rClasse); $result = $tplListe->fetch('getannuaireclasse.tpl'); //print_r($rEcole); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', $rClasse["nom"]); $menu = array(); if (!CopixConfig::exists('|can_group_showlist') || CopixConfig::get('|can_group_showlist')) { $menu[] = array('txt' => CopixI18N::get('groupe|groupe.annuaire'), 'url' => CopixUrl::get('groupe||getListPublic'), 'size' => '110'); } $menu[] = array('txt' => CopixI18N::get('public|public.blog.annuaire'), 'url' => CopixUrl::get('public||getListBlogs')); $menu[] = array('txt' => CopixI18N::get('annuaire|annuaire.backEcole'), 'url' => CopixUrl::get('|getAnnuaireEcole', array('ecole' => $ecole))); $menu[] = array('txt' => CopixI18N::get('annuaire|annuaire.backVille'), 'url' => CopixUrl::get('|getAnnuaireVille', array('ville' => $rEcole['ALL']->vil_id_vi))); if (CopixConfig::exists('|can_annuaire_menu') && !CopixConfig::get('|can_annuaire_menu')) { $menu = array(); } $tpl->assign('MENU', $menu); $tpl->assign('MAIN', $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Affiche la liste des blogs ayant au moins un article, pour un groupe de ville, ou une ou plusieurs villes * * @author Christophe Beyer <*****@*****.**> * @since 2006/03/23 * @param string $kw Mot-cl� pour la recherche (option) * @param integer grville Id de groupe de ville * @param array ville Tableau avec les ID des villes */ public function _createContent(&$toReturn) { CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); $kw = $this->getParam('kw', null); $pGrVille = $this->getParam('grville', null); $pVille = $this->getParam('ville', null); // Tableau $tpl = new CopixTpl(); if ($pVille) { $villes = AnnuaireService::getVilles($pVille); } else { $villes = AnnuaireService::getVillesInGrville($pGrVille); } //print_r($villes); $tpl->assign('villes', $villes); $ecoles = array(); foreach ($villes as $ville) { //$ecoles $ec = AnnuaireService::getEcolesInVille($ville['id'], array('directeur' => false)); foreach ($ec as $k => $e) { $blog = getNodeBlog('BU_ECOLE', $e['id']); //print_r($blog); if ($blog && $blog->is_public == 1) { $ec[$k]['blog']['url_blog'] = $blog->url_blog; } } $ecoles[$ville['id']] = $ec; } //print_r($ecoles); $tpl->assign('ecoles', $ecoles); if ($kw) { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND name_blog LIKE '%" . addslashes($kw) . "%' ORDER BY name_blog"; } else { $critere = " SELECT * FROM module_blog WHERE is_public=1 AND 1 ORDER BY name_blog"; } $sql = _doQuery($critere); $list = array(); $arTypes = array(); if (CopixConfig::exists('public|blogs.types') && CopixConfig::get('public|blogs.types')) { $arTypes = explode(",", CopixConfig::get('public|blogs.types')); } $arTypes[] = 'CLUB'; //print_r($sql); foreach ($sql as $blog) { $parent = Kernel::getModParentInfo("MOD_BLOG", $blog->id_blog); if ($parent) { if ($arTypes && !in_array($parent['type'], $arTypes)) { continue; } //var_dump($parent); $blog->parent = $parent['nom']; switch ($parent['type']) { case 'CLUB': if (Kernel::getKernelLimits('ville')) { $ville = GroupeService::getGroupeVille($parent['id']); if (!in_array($ville, Kernel::getKernelLimits('ville_as_array'))) { continue; } } $blog->type = CopixI18N::get('public.blog.typeClub'); break; /* case 'BU_CLASSE' : $blog->type = CopixI18N::get ('public.blog.typeClasse'); $blog->parent .= ' - '.$parent['ALL']->eco_nom; if ($parent['ALL']->eco_type) $blog->parent .= ' - '.$parent['ALL']->eco_type.''; break; */ //case 'BU_ECOLE' : $blog->type = CopixI18N::get ('public.blog.typeEcole'); break; //case 'BU_VILLE' : $blog->type = CopixI18N::get ('public.blog.typeVille'); break; //case 'BU_GRVILLE' : $blog->type = CopixI18N::get ('public.blog.typeGrville'); break; //default : $blog->type = $parent['type']; break; } if (!isset($blog->type)) { continue; } $blog->stats = KernelBlog::getStats($blog->id_blog); //print_r($blog); /* Activer pour cacher les blogs non lisibles */ // if( !blogauth::canMakeInBlog('READ', $blog) ) continue; if ($blog->stats['nbArticles']['value'] > 0) { $list[] = $blog; } } } usort($list, "order_tab_blogs"); $tpl->assign('list', $list); if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) { $tpl->assign('can_public_rssfeed', 1); } else { $tpl->assign('can_public_rssfeed', 0); } $toReturn = $tpl->fetch('getlistblogszone2.tpl'); return true; }
/** * Affichage du formulaire d'écriture d'un message (réponse à une discussion) * * @author Christophe Beyer <*****@*****.**> * @since 2005/11/16 * @see doMessageForm() * @param integer $topic Id de la discussion * @param integer $eleve (option) Id de l'élève concerné * @param string $message Texte du message (si formulaire soumis) * @param array $errors (option) Erreurs rencontrées * @param integer $preview (option) Si 1, affichera la preview du message soumis, si 0 validera le formulaire */ public function processGetMessageForm() { $carnet_service =& CopixClassesFactory::Create('carnet|CarnetService'); $dao_carnets_to = CopixDAOFactory::create("carnet|carnet_topics_to"); //$eleves = $carnet_service->getHisCarnetEleves(); // Ses élèves $criticErrors = array(); $id = NULL; $topic = $this->getRequest('topic', null); $eleve = $this->getRequest('eleve', null); $message = $this->getRequest('message', null); $errors = $this->getRequest('errors', array()); $preview = $this->getRequest('preview', 0); $format = CopixConfig::get('carnet|default_format'); if ($id) { // Edition d'un message $criticErrors[] = CopixI18N::get('carnet|carnet.error.impossible'); } elseif ($topic && $eleve) { // Réponse dans un topic, sur un élève $rTopic = $dao_carnets_to->get($topic, $eleve); if (!$rTopic) { $criticErrors[] = CopixI18N::get('carnet|carnet.error.noTopic'); } else { $mondroit = $carnet_service->getUserDroitInCarnet(array("eleve" => $eleve)); if (!$mondroit) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } } } else { $criticErrors[] = CopixI18N::get('carnet|carnet.error.impossible'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('carnet||'))); } else { $tpl = new CopixTpl(); //$titre = ($id) ? 'Modification du message' : 'Nouveau message'; CopixHTMLHeader::addCSSLink(_resource("styles/module_carnet.css")); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_carnet.js'); $tpl->assign('TITLE_PAGE', $rTopic->topic_titre); $tplForm = new CopixTpl(); $tplForm->assign('topic', $topic); $tplForm->assign('eleve', $eleve); $tplForm->assign('message', $message); $tplForm->assign('format', $format); $tplForm->assign("errors", $errors); $tplForm->assign("id", $id); $tplForm->assign('preview', $preview); $tplForm->assign('message_edition', CopixZone::process('kernel|edition', array('field' => 'message', 'format' => $format, 'content' => $message, 'height' => 200))); $result = $tplForm->fetch('getmessageform.tpl'); $tpl->assign('MAIN', $result); //$tpl->assign ('MENU', '<a href="'.CopixUrl::get ('carnet||getTopic', array("id"=>$topic, "eleve"=>$eleve)).'">'.CopixI18N::get ('carnet|carnet.backTopic').'</a> :: <a href="'.CopixUrl::get ('carnet||getCarnet', array("eleve"=>$eleve)).'">'.CopixI18N::get ('carnet|carnet.backCarnet').'</a>'); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); } }
/** * 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; }
public function _createContent(&$toReturn) { CopixHtmlHeader::addCSSLink(_resource('styles/comments.css')); //Si pas d'éléments d'identifiant donné, alors on utilise l'ensemble des paramètres de la requête if (($id = $this->getParam('id')) == "") { $id = array_keys(CopixRequest::asArray()); } if (($mode = $this->getParam('mode')) == "" || $mode == "request") { if (($mode = _request('comments')) == "") { $mode = "summary"; } } if (($newUrl = $this->getParam('moreUrl')) == "") { $newUrl = _url('#', array('comments' => 'list')); } $tpl = new CopixTpl(); $tpl->assign('mode', $mode); $tpl->assign('newUrl', $newUrl); // On teste si nous sommes dans l'actions de prévisualisation if (_request('preview') !== null) { $tpl->assign('preview', 1); $tpl->assign('previewDate', date('YmdHis')); } if (CopixAuth::getCurrentUser()->testCredential('basic:admin')) { $tpl->assign('isAdmin', 1); } else { $tpl->assign('isAdmin', 0); } $idComment = _ioClass('commentsservices')->getId($id); // On vérifie si les commentaires sont ouvert $tpl->assign('locked', _dao('commentslocked')->countBy(_daoSp()->addCondition('locked_page_comment', '=', $idComment))); if ($informations = _ioClass('commentsservices')->getEnabled($idComment)) { $tpl->assign('newComment', $informations['object']); if (_request('errors') !== null) { $tpl->assign('errors', _ioDAO('comments')->check($informations['object'])); } } _ioClass('commentsservices')->addEnabled(array('fromPage' => _url('#'), 'writeCredential' => $this->getParam('credentialWrite'), 'id' => $idComment)); $tpl->assign('idComment', $idComment); switch ($mode) { case "list": if ($this->getParam('credentialRead') != "") { CopixAuth::getCurrentUser()->assertCredential($this->getParam('credentialRead')); } $tpl->assign('arrComments', _dao('comments')->findBy(_daoSp()->addCondition('page_comment', '=', $idComment))); break; case "summary": $tpl->assign('nbComments', _dao('comments')->countBy(_daoSp()->addCondition('page_comment', '=', $idComment))); break; } // Mise en place du captcha si besoin : if (CopixConfig::get('comments|captcha') != 0) { $arrCaptchaMax = _ioDao('commentscaptcha')->findBy(_daoSp()->orderBy(array('captcha_id', 'DESC'))->setLimit(0, 1)); $arrCaptchaMin = _ioDao('commentscaptcha')->findBy(_daoSp()->orderBy('captcha_id')->setLimit(0, 1)); $captcha = false; while (!$captcha || is_null($captcha)) { srand(); $rand = rand($arrCaptchaMin[0]->captcha_id, $arrCaptchaMax[0]->captcha_id); $captcha = _ioDao('commentscaptcha')->get($rand); } $tpl->assign('captcha', $captcha); } $toReturn = $tpl->fetch('zone.comment.tpl'); //_log ('URL: '._url('#')); //_log ('ID: ' . $idComment); return true; }
/** * Affiche la liste des ecoles * * @author Christophe Beyer <*****@*****.**> * @since 2008/11/10 * @param string $titre Titre a donner a la zone * @param integer $ajaxpopup 1 si on veut afficher le lien vers la fiche en Ajax, 0 pour afficher le lien Href classique. Par defaut : 0 * @param integer $colonnes Nb de colonnes. Par defaut : 1 * @param integer $grville Id du groupe de villes dans lequel on pioche les ecoles. Par defaut : 1 * @param integer $ville Id de la ville dans laquelle on pioche les ecoles. Par defaut : null (prend le groupe de ville). Si on passe un grville et une ville, on prend la ville * @param string $groupBy Si regroupement. Peut valoir "type" * @param integer $dispType 1 pour afficher le type des ecoles, 0 pour n'afficher que leur nom. Par defaut : 1 */ public function _createContent(&$toReturn) { //params exclusion list $IdExclusionList = array(); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js'); $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); $titre = $this->getParam('titre'); $ajaxpopup = $this->getParam('ajaxpopup', false); $colonnes = $this->getParam('colonnes'); $colonnes = intval($colonnes); if (!$colonnes) { $colonnes = 1; } $grville = $this->getParam('grville', null); $ville = $this->getParam('ville', null); $search = $this->getParam('search', null); $pGroupBy = $this->getParam('groupBy'); $pDispType = $this->getParam('dispType'); $pDispFilter = $this->getParam('dispFilter') === '' ? true : $this->getParam('dispFilter') ? true : false; $pDispHeader = $this->getParam('dispHeader', 1); if ($ville <= 0 && ($ville_as_array = Kernel::getKernelLimits('ville_as_array'))) { $list = array(); if (!empty($search)) { $list = $annuaireService->searchEcolesByVilles($search, $ville_as_array); } else { foreach ($ville_as_array as $ville_item) { $list_tmp = $annuaireService->getEcolesInVille($ville_item); $list = array_merge($list, $list_tmp); } } } else { //add default city : $ville = empty($ville) ? empty($this->defaultVille) ? null : $this->defaultVille : $ville; if (!empty($search)) { $list = $annuaireService->searchEcoles($search); } elseif (!empty($ville) && $ville > 0) { $list = $annuaireService->getEcolesInVille($ville); } elseif (!empty($grville)) { $list = $annuaireService->getEcolesInGrville($grville); } else { $list = $annuaireService->getAllEcoles(); } } if ($pGroupBy == 'type') { usort($list, array($this, "usort_ecoles_type")); } elseif ($pGroupBy == 'ville') { usort($list, array($this, "usort_ecoles_ville")); } elseif ($pGroupBy == 'villeType') { $listByCityAndType = array(); foreach ($list as $item) { if (!array_key_exists('ville', $item)) { continue; } if (in_array($item['id'], $IdExclusionList)) { continue; } $listByCityAndType[$item['ville_nom']][$item['type']][] = $item; } $listByCityAndTypeFinal = array(); //order type foreach ($listByCityAndType as $k => $typeCollection) { if (array_key_exists('Elémentaire', $typeCollection)) { $listByCityAndTypeFinal[$k]['Elémentaire'] = $typeCollection['Elémentaire']; } if (array_key_exists('Primaire', $typeCollection)) { $listByCityAndTypeFinal[$k]['Primaire'] = $typeCollection['Primaire']; } if (array_key_exists('Maternelle', $typeCollection)) { $listByCityAndTypeFinal[$k]['Maternelle'] = $typeCollection['Maternelle']; } if (array_key_exists('Privée', $typeCollection)) { $listByCityAndTypeFinal[$k]['Privée'] = $typeCollection['Privée']; } } $list = $listByCityAndTypeFinal; } //kernel::myDebug($list); $nbEcoles = 0; foreach ($list as $k => $ecole) { if ($ecole['id'] > 0) { $nbEcoles++; } } //kernel::myDebug($list); // Nb elements par colonnes $parCols = ceil($nbEcoles / $colonnes); if (($ville_as_array = Kernel::getKernelLimits('ville_as_array')) && is_array($ville_as_array) && count($ville_as_array) > 0) { $listVille = $this->db->query('SELECT * FROM kernel_bu_ville WHERE id_vi IN (' . implode(',', $ville_as_array) . ') ORDER BY canon')->toArray(); $displayVille = count($listVille) > 1 ? true : false; } else { $listVille = $this->db->query('SELECT * FROM kernel_bu_ville ORDER BY canon')->toArray(); $displayVille = count($listVille) > 1 ? true : false; } $tpl = new CopixTpl(); $tpl->assign('titre', $titre); $tpl->assign('ajaxpopup', $ajaxpopup); $tpl->assign('list', $list); $tpl->assign('parCols', $parCols); $tpl->assign('widthColonne', round(100 / $colonnes, 1) . '%'); $tpl->assign('displayVille', $displayVille); $tpl->assign('villes', $listVille); $tpl->assign('defaultVille', $ville); $tpl->assign('groupBy', $pGroupBy); $tpl->assign('dispType', $pDispType); $tpl->assign('dispFilter', $pDispFilter); $tpl->assign('dispHeader', $pDispHeader); $searchInputValue = empty($search) ? $this->i18n('welcome.ecoles.search') : $search; $tpl->assign('searchInputValue', $searchInputValue); $toReturn = $tpl->fetch('zone_ecoles.tpl'); return true; }
/** * Smarty {popupinformation}{/popupinformation} block plugin * * Type: block function<br> * Name: popupinformation<br> * Purpose: Add div wich display when mouse is over img<br> * @param array * <pre> * Params: img: string * Params: text: string * Params: divclass: (optional)string, css class * Params: displayimg: (optional, default true)boolean, display img ? * Params: displaytext: (optional, default false) boolean , displaty text after img ? * Params: assign :(optional) name of the template variable we'll assign * the output to instead of displaying it directly * </pre> * @param string contents of the block * @param Smarty clever simulation of a method * @return string string $content re-formatted */ function smarty_block_popupinformation($params, $content, &$smarty) { static $_init = false; if (!$_init) { $jsCode = 'function displayPopupInformation(id) { document.getElementById(id).style.visibility = \'visible\'; } function hidePopupInformation(id) { document.getElementById(id).style.visibility = \'hidden\'; } function toggleDisplayPopupInformation(id) { if (document.getElementById(id).style.visibility==\'hidden\') { document.getElementById(id).style.visibility=\'visible\'; }else{ document.getElementById(id).style.visibility=\'hidden\'; } if (document.getElementById(id).style.display==\'none\') { document.getElementById(id).style.display=\'\'; }else{ document.getElementById(id).style.display=\'none\'; } return false; } '; /*$jsCode .= ' function selfHiddePopupInformation(){ this.style.visibility = \'hidden\'; } function selfShowPopupInformation(){ this.style.visibility = \'visible\'; }';*/ CopixHtmlHeader::addJsCode($jsCode); $_init = true; } if (is_null($content)) { return; } if (!isset($params['text'])) { $params['text'] = ''; } if (!isset($params['displaytext'])) { $params['displaytext'] = false; } if (!isset($params['alternativlink'])) { $params['alternativlink'] = '#'; } if (!isset($params['displayimg'])) { $params['displayimg'] = true; } if (!isset($params['img'])) { $params['img'] = CopixUrl::get() . 'img/tools/information.png'; } if (!isset($params['divclass'])) { $params['divclass'] = 'popupInformation'; } if (!isset($params['handler'])) { $params['handler'] = 'onmouseover'; } $id = uniqid('popupInformation'); switch ($params['handler']) { case 'onmouseover': $toReturn = '<div id="div' . $id . '" style="display:inline;" '; $toReturn .= 'onmouseover="javascript:displayPopupInformation(\'' . $id . '\')" onmouseout="javascript:hidePopupInformation(\'' . $id . '\');" >'; break; case 'onclick': $toReturn = '<a id="a' . $id . '" href="' . $params['alternativlink'] . '" '; $toReturn .= 'onclick="return toggleDisplayPopupInformation(\'' . $id . '\')">'; break; case 'overEvent': $toReturn = '<div id="div' . $id . '" style="display:inline;" '; $toReturn .= 'onmouseover="javascript:displayPopupInformation(\'' . $id . '\')" onmouseout="javascript:hidePopupInformation(\'' . $id . '\')" onblur="javascript:hidePopupInformation(\'' . $id . '\')">'; break; default: $toReturn = '<div id="div' . $id . '" style="display:inline;" '; $toReturn .= 'onmouseover="javascript:displayPopupInformation(\'' . $id . '\')" onmouseout="javascript:hidePopupInformation(\'' . $id . '\');" >'; break; } $toReturn .= $params['displayimg'] === true ? '<img src="' . $params['img'] . '" alt="' . $params['text'] . '" />' : ''; $toReturn .= $params['displaytext'] === true ? $params['text'] : ''; if ($params['handler'] == 'onclick') { $toReturn .= '</a>'; } $toReturn .= '<div class="' . $params['divclass'] . '" id="' . $id . '" style="visibility:hidden;'; $toReturn .= $params['handler'] != 'onclick' ? '" >' : 'display:none" >'; $toReturn .= $content; $toReturn .= '</div>'; if ($params['handler'] != 'onclick') { $toReturn .= '</div>'; } if (isset($params['assign'])) { $this->assign($params['assign'], $toReturn); return ''; } else { return $toReturn; } }
/** * 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); }