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 process($pParams) { extract($pParams); if (!isset($tips) && !isset($warning)) { return ''; } $toReturn = ''; if (isset($warning)) { foreach ($warning as $warn) { $toReturn .= '<li style="color: #FF2222;font-weight:bold;">' . $warn . '</li>'; } } if (isset($tips)) { foreach ($tips as $tip) { $toReturn .= '<li>' . $tip . '</li>'; } } if (strlen($toReturn)) { $toReturn = '<ul>' . $toReturn . '</ul>'; if (isset($title)) { $toReturn = '<h2><img src="' . _resource('img/icons/help.gif') . '" /> ' . $title . '</h2>' . $toReturn; } elseif (isset($titlei18n)) { $toReturn = '<h2><img src="' . _resource('img/icons/help.gif') . '" /> ' . _i18n($titlei18n) . '</h2>' . $toReturn; } } return $toReturn; }
public function _createContent(&$toReturn) { $arModuleToInstall = CopixSession::get('arModuleToInstall', 'copix'); $arInstalledModule = CopixSession::get('arInstalledModule', 'copix'); $moduleName = array_pop($arModuleToInstall); $url = $this->getParam('url'); if (($message = CopixModule::installModule($moduleName)) === true) { $toReturn = _i18n('install.module.install') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />'; if (count($arModuleToInstall) > 0) { $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|installmodule', 'url' => $url, 'auto' => true, 'ajax' => true)); } elseif ($url) { $toReturn .= sprintf('<form action="%s" method="post"><input type="submit" value="%s"/></form>', htmlspecialchars($url), _i18n('copix:common.buttons.next')); } else { $toReturn .= "<script>\$('back').setStyle('display','');</script>"; } array_push($arInstalledModule, $moduleName); } else { array_push($arInstalledModule, $moduleName); $toReturn = _i18n('install.module.install') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message); $toReturn .= '<div class="errorMessage">' . $message . '</div>'; if (count($arInstalledModule) > 0) { CopixSession::set('arModuleToDelete', $arInstalledModule, 'copix'); CopixSession::set('arInstalledModule', null, 'copix'); CopixSession::set('arModuleToInstall', null, 'copix'); $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true)); } } CopixSession::set('arModuleToInstall', $arModuleToInstall, 'copix'); CopixSession::set('arInstalledModule', $arInstalledModule, 'copix'); return true; }
/** * Configuration de MagicMail * * @author Frederic Mossmann <*****@*****.**> * @since 2006/08/09 */ public function getMagicMail() { $id = _request("id"); if (Kernel::getLevel("MOD_MAGICMAIL", $id) < PROFILE_CCV_ADMIN) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get('||'))); } $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('magicmail.message.title')); $dao = CopixDAOFactory::create("magicmail|magicmail"); $magic_result = $dao->get($id); $tplForm = new CopixTpl(); $tplForm->assign('id', $id); $tplForm->assign('infos', $magic_result); // $tplForm->assign ('magicmail_mail', CopixConfig::get ('magicmail|magicmail_mail')); if (_request("return")) { $tplForm->assign('return', _request("return")); } CopixHTMLHeader::addCSSLink(_resource("styles/module_prefs.css")); $tplForm->assign('msg', array('type' => 'ok', 'image_url' => _resource('img/prefs/smiley_black.png'), 'image_alt' => 'Ok !', 'value' => CopixI18N::get('prefs|prefs.msg.prefsrecorded'))); $result = $tplForm->fetch("login_form.tpl"); $tpl->assign("MAIN", $result); $menu = array(); $tpl->assign('MENU', $menu); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Récupère l'objet en session * Appelle les zones agendamenu et agendaeditlecon * @author Audrey Vassal <*****@*****.**> */ public function processGetEdit() { CopixHTMLHeader::addCSSLink(_resource("styles/module_agenda.css")); require_once COPIX_UTILS_PATH . 'CopixDateTime.class.php'; $serviceAuth = new AgendaAuth(); $serviceType = new AgendaType(); $serviceAgenda = new AgendaService(); $serviceDate = new DateService(); if (!($toEdit = $this->_getSessionLecon())) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.unableToGetEdited'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine'))); } $serviceAuth->getCapability($toEdit->id_agenda); if ($serviceAuth->getCapability($toEdit->id_agenda) < $serviceAuth->getWriteLecon() || $serviceAgenda->getTypeAgendaByIdAgenda($toEdit->id_agenda) != $serviceType->getClassRoom()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.error.enableToWrite'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine'))); } $listAgendas = $serviceAgenda->getAvailableAgenda(); $listAgendasAffiches = $serviceAgenda->getAgendaAffiches(); //template pour agenda $tplAgenda = new CopixTpl(); $tplAgenda->assign('MAIN_AGENDA', CopixZone::process('agenda|agendaeditlecon', array('e' => _request('e'), 'errors' => _request('errors'), 'toEdit' => $toEdit))); //template principal $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('agenda|agenda.title.lecon', array('jour' => CopixDateTime::yyyymmddToDate($toEdit->date_lecon)))); $menu = $serviceAgenda->getAgendaMenu(''); $tpl->assign('MENU', $menu); $tpl->assign('MAIN', $tplAgenda->fetch('agenda|main.agenda.tpl')); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
public function process($pParams) { extract($pParams); if (!isset($name)) { throw new CopixTemplateTagException('[AutoComplete] Required parameter name'); } if (!isset($field)) { $field = $name; } if (!isset($id)) { $id = $name; } if (!isset($value)) { $value = ""; } if (!isset($onSelect)) { $onSelect = ""; } if (!isset($onRequest)) { $onRequest = ''; } if (!isset($extra)) { $extra = ''; } if (!isset($pParams['datasource'])) { $pParams['datasource'] = 'dao'; } $toMaj = ''; $onSelectTemp = ''; if (isset($maj)) { $onSelectTemp .= "eleme.selected.id = 'selector_autocomplete';"; foreach ($maj as $key => $field) { $onSelectTemp .= "\n \$\$('#selector_autocomplete .{$key}').each (function (el) {\n \$('{$field}').value = el.innerHTML;\n });\n "; $toMaj .= $key . ';'; } } $onSelect = $onSelectTemp . $onSelect; $url = 'generictools|ajax|getAutoComplete'; if (isset($pParams['url'])) { $url = $pParams['url']; } $length = isset($length) ? $length : 1; $pParams['view'] = isset($pParams['view']) ? $pParams['view'] : $field; $tab = array(); foreach ($pParams as $key => $param) { $tab[$key] = $param; } $tab['nb'] = 10; $tab['tomaj'] = $toMaj; $js = new CopixJSWidget(); $js->tag_autocomplete($id, $name, $length, $tab, _url($url), $js->function_(null, 'el', $onRequest), $js->function_(null, 'el,eleme,element', $onSelect)); CopixHTMLHeader::addJSDOMReadyCode($js); CopixHTMLHeader::addJSLink(_resource('js/taglib/tag_autocomplete.js')); _eTag("mootools", array('plugin' => "observer;autocompleter")); $toReturn = '<input type="text" id="' . $name . '" name="' . $name . '" value="' . $value . '" ' . $extra . ' /><span id="autocompleteload_' . $name . '"><img src="' . CopixUrl::getResource('img/tools/load.gif') . '" /></span>'; return $toReturn; }
/** * Génération du code HTML * @return string */ public function process($pParams) { //Test si le parametre correspondant au type existe if (isset($pParams['type'])) { $type = $pParams['type']; } else { //Sinon on génère une exception précisant que le type est manquant throw new CopixTemplateTagException('CopixImage: missing type parameter'); } //Si une propriété correspond au type saisi if (CopixI18N::exists('copix:common.buttons.' . $type)) { //On récupère le libellé de ce type $alt = _i18n('copix:common.buttons.' . $type); } else { //Sinon on génère une erreur throw new CopixException('You must enter an existing type'); } //identifiant sur le href $idimg = ''; $idhref = ''; if (isset($pParams['id'])) { $idimg = 'id="' . $pParams['id'] . '_img"'; $idhref = 'id="' . $pParams['id'] . '_href"'; } //Initialisation du type if (isset($pParams['title'])) { $title = $pParams['title']; } else { $title = $alt; } if (isset($pParams['class'])) { $class = 'class="' . $pParams['class'] . '"'; } else { $class = ''; } //Création du chemin ou se trouve l'image $fileName = str_replace(CopixUrl::getRequestedBaseUrl(), './', _resource("img/tools/" . $type . ".png")); //Test si le fichier existe if (file_exists($fileName)) { $src = _resource("img/tools/" . $type . ".png"); } else { throw new CopixException('No icon does not correspond to your application'); } if (isset($pParams['text'])) { $text = $pParams['text']; } else { $text = ''; } //si une url a été renseignée if (isset($pParams['href'])) { $href = $pParams['href']; return '<a href="' . $href . '" ' . $idhref . ' title="' . $title . '" ' . $class . '><img src="' . $src . '" ' . $idimg . ' alt="' . $alt . '"/>' . $text . '</a>'; } else { return '<img src="' . $src . '" ' . $idimg . ' alt="' . $alt . '" title="' . $title . '" ' . $class . ' />' . $text; } }
function beforeDisplay(&$display) { $HTTP_USER_AGENT = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : ''; if (preg_match("/MSIE 6.0/", $HTTP_USER_AGENT)) { CopixHTMLHeader::addCSSLink(_resource("styles/theme_ie.css")); CopixHTMLHeader::addCSSLink(_resource("styles/theme_ie6.css")); } elseif (preg_match("/MSIE 7.0/", $HTTP_USER_AGENT)) { CopixHTMLHeader::addCSSLink(_resource("styles/theme_ie.css")); CopixHTMLHeader::addCSSLink(_resource("styles/theme_ie7.css")); } }
/** * Plugin smarty type fonction * Purpose: génération du chemin d'une ressoruce pour les templates * * Input: path=le/chemin/de/la/ressource.ext */ function smarty_function_copixresource($params, &$me) { $toReturn = _resource($params['path']); $assign = isset($params['assign']) ? $params['assign'] : null; if (strlen($assign) > 0) { $me->assign($assign, $toReturn); return ''; } else { return $toReturn; } }
public function _createContent(&$toReturn) { $moduleName = CopixZone::getParam('moduleName'); if (($message = CopixModule::updateModule($moduleName)) === true) { $toReturn = _i18n('install.module.update') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />'; } else { $toReturn = _i18n('install.module.update') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message); $toReturn .= '<div class="errorMessage">' . $message . '</div>'; } return true; }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $tpl->assign("prefs", $this->getParam('prefs')); $msg = $this->getParam('msg'); if ($msg && $msg == 'save') { $tpl->assign('msg', array('type' => 'ok', 'image_url' => _resource('img/prefs/smiley_black.png'), 'image_alt' => CopixI18N::get('prefs.msg.prefsrecorded_alt'), 'value' => CopixI18N::get('prefs.msg.prefsrecorded'))); } $toReturn = $tpl->fetch("getprefs.tpl"); return true; }
/** * Construction de l'input * @param mixed $pParams tableau de paramètre ou clef * @param mixed $pContent * @return string l'input fabriqué * Paramètres recommandés : * id : identifiant utile pour les labels, le javascript.. * name : nom de l'input utile pour récupérer sa valeur avec php * * Autres paramètres (liste non exhaustive) * value : valeur à afficher * maxlength : nombre de caractères maximals * size : taille de l'input affiché * next : zone suivante qui prendra le focus lorsque maxlenght sera atteind * previous : zone précédente qui prendra le focus lorsque tous les caratères seront effacés * (ces deux derniers paramètres sont gérés à l'aide de javascript) */ public function process($pParams) { extract($pParams); if (!isset($pParams['id']) && !isset($pParams['name'])) { throw new CopixTagException("[CopixTagInput] Missing id or name parameter"); } if (!isset($pParams['id'])) { $pParams['id'] = $pParams['name']; } elseif (!isset($pParams['name'])) { $pParams['name'] = $pParams['id']; } $readonly = ''; if (isset($pParams['readonly'])) { if ($pParams['readonly']) { $readonly = 'readonly="readonly"'; } unset($pParams['readonly']); } if (isset($pParams['value']) && !empty($pParams['value'])) { $pParams['value'] = htmlspecialchars($pParams['value'], ENT_QUOTES); } if (!isset($extra)) { $extra = ''; } else { unset($pParams['extra']); } $toReturn = '<input type="text" ' . $readonly . ' ' . $extra . ' '; foreach ($pParams as $key => $param) { if ($key != 'next' && $key != 'previous') { $toReturn .= $key . '="' . $param . '" '; } } if (!isset($maxlength)) { $maxlength = '1'; } if (isset($next) && $next != null && $maxlength != null || isset($previous) && $previous != null) { CopixHTMLHeader::addJSLink(_resource('js/taglib/tag_inputtext.js')); if (!isset($previous)) { $previous = 'null'; } if (!isset($next)) { $next = ''; } if ($next == 'true') { $toReturn .= 'onKeyDown="javascript:autofocus(this,' . $maxlength . ',event,\'' . $previous . '\');" '; } else { $toReturn .= 'onKeyDown="javascript:focusid(this,' . $maxlength . ',event,\'' . $next . '\',\'' . $previous . '\');" '; } } $toReturn .= ' />'; return $toReturn; }
/** * 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 2007/05/22 * @param string $field Nom du champ dans le formulaire. * @param string $format Format à utiliser (html, wiki...) * @param string $content Contenu "brut" saisi * @param array $objet (option) Module dans lequel se trouve la zone d'édition, 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, et si oui on affiche le lien vers l'album photos en mode popup * @param integer $width (option) Largeur de la zone de saisie * @param integer $height (option) Hauteur de la zone de saisie * @param array $options (option) Options permettant de personnaliser la zone */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $field = $this->getParam('field', NULL); $format = $this->getParam('format', NULL); $content = $this->getParam('content', NULL); $object = $this->getParam('object', array()); $width = $this->getParam('width', 650); $height = $this->getParam('height', 300); $class = $this->getParam('class'); $options = $this->getParam('options', array()); $html = ''; if ($field && $format) { if ('USER' === $object) { } else { $object_type = isset($object['type']) ? $object['type'] : null; $object_id = isset($object['id']) ? $object['id'] : null; $object = $object_type && $object_id ? array('type' => $object_type, 'id' => $object_id) : null; } switch ($format) { case "wiki": $tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => $format, 'object' => $object))); break; case "html": $tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => $format, 'object' => $object))); break; case "htmlnl2br": $tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => $format, 'object' => $object))); break; case "dokuwiki": $tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => $format, 'object' => $object))); break; case "fckeditor": case "ckeditor": CopixHTMLHeader::addJSLink(_resource('js/ckeditor/ckeditor.js')); CopixHTMLHeader::addJSLink(_resource('js/ckeditor/config.js')); $tpl->assign('wikibuttons', CopixZone::process('kernel|wikibuttons', array('field' => $field, 'format' => 'ckeditor', 'object' => $object))); break; } $tpl->assign('field', $field); $tpl->assign('format', $format); $tpl->assign('content', $content); $tpl->assign('width', $width); $tpl->assign('height', $height); $tpl->assign('class', $class); $tpl->assign('options', $options); } //_dump($options); $toReturn = $tpl->fetch('zone.edition.tpl'); return true; }
/** * Construction du message * @param mixed $pParams tableau de paramètre ou clef * @param mixed $pContent null (ImageProtect n'est pas censé recevoir de contenu) * @return string balise html contenant le bouton de selection i18n */ public function process($pParams, $pContent = null) { if (!isset($pParams['name'])) { throw new CopixTagException("[ImageProtect] Missing name parameter"); } if (!isset($pParams['id'])) { throw new CopixTagException("[ImageProtect] Missing id parameter"); } $caption = isset($pParams['caption']) ? $pParams['caption'] : ''; $listeModules = CopixModule::getList(false); sort($listeModules); $winSelecter = '<div id="divpopup_' . $pParams['id'] . '" style="display:none; border:1px; border-style:solid; border-color:#000; background-color:#FFF ;" >' . "\n\n" . ' <div id="divpopup1_' . $pParams['id'] . '" style="float:left;" >' . "\n" . ' ' . _tag('select', array('id' => 'selectmodule1_' . $pParams['id'], 'name' => 'selectmodule_' . $pParams['id'], 'values' => $listeModules, 'extra' => 'style="width:200px;" size="12"', 'emptyShow' => false)) . "\n" . ' </div>' . "\n\n" . ' <div id="divpopup2_' . $pParams['id'] . '" style="display:none;float:left;" >' . "\n" . ' ' . _tag('select', array('id' => 'selectmodule2_' . $pParams['id'], 'name' => 'selectmodule_' . $pParams['id'], 'values' => $listeModules, 'extra' => 'style="width:200px;" size="10"', 'emptyShow' => false)) . "\n" . ' <div id="divtrad_' . $pParams['id'] . '" > ' . "\n" . ' <textarea cols="30" rows="1" readonly="readonly" style="width:200px; overflow:hidden;" >traduction de \'i18n</textarea>' . "\n" . ' </div>' . "\n" . ' </div>' . "\n\n" . '</div>' . "\n"; $javascript = '<script type="text/javascript">' . "\n" . '$("' . $pParams['id'] . '").addEvent("mouseover", function (){' . "\n" . ' $("divpopup_' . $pParams['id'] . '").setStyles({' . "\n" . ' "position":"absolute",' . "\n" . ' "top" : 200+"px",' . "\n" . ' "left" : 200+"px",' . "\n" . ' "zIndex":"1000",' . "\n" . ' "display":"block"' . "\n" . ' });' . "\n" . '});' . "\n\n" . '$("selectmodule1_' . $pParams['id'] . '").addEvent("change", function () {' . "\n" . ' $("divpopup2_' . $pParams['id'] . '").setStyle("display","block");' . "\n" . '});' . "\n" . '</script>' . "\n"; return '<label>' . $caption . '<input type="text" name="' . $pParams['name'] . '" /></label>' . "\n" . '<img src="' . _resource("img/icons/languages.gif") . '" id="' . $pParams['id'] . '" alt="' . _i18n('copix:common.buttons.select') . '" />' . "\n" . $winSelecter . $javascript; }
public function process($pParams, $pContent = null) { $tabGroupId = $this->getParam('id', uniqid('tab')); $tabs = $this->requireParam('tabs', null, array()); $groupClass = $this->getParam('groupClass', ''); $tabClass = $this->getParam('tabClass', ''); $selectedClass = $this->getParam('selectedClass', 'tabSelected'); $onSelect = $this->getParam('onSelect', null, 'string'); $onUnselect = $this->getParam('onUnselect', null, 'string'); $default = $this->getParam('default'); $this->validateParams(); if ($default && !isset($tabs[$default])) { _log('[tag tabgroup] invalid default for tabgroup ' . $tabGroupId . ': ' . $default, 'errors'); $default = null; } $toReturn = array(); $toReturn[] = sprintf('<div class="tabGroup %s" id="%s">', $groupClass, $tabGroupId); $tabIds = array(); $tabKeys = array(); $i = 0; $tabIndexes = array(); foreach ($tabs as $key => $caption) { $tabId = $tabGroupId . '_tab' . $i; //preg_replace('/[^\w]/', '_', $key); //$tabIds[$tabId] = $key; $elementIds[$key] = $tabId; $tabIndexes[$key] = $i++; $toReturn[] = sprintf('<span class="tabCaption %s %s" id="%s">%s</span>', $tabClass, $key == $default ? $selectedClass : '', $tabId, _copix_utf8_htmlentities($caption)); } $toReturn[] = '</div>'; CopixHTMLHeader::addJSLink(_resource('js/taglib/tabgroup.js'), array('id' => 'taglib_tabgroup_js')); $params = array('id' => $tabGroupId, 'selectedClass' => $selectedClass, 'tabs' => array_keys($tabs)); if ($default) { $params['defaultTab'] = $tabIndexes[$default]; } $js = new CopixJSWidget(); if ($onSelect) { $params['onSelect'] = $js->function_(null, 'tabId', $onSelect); } if ($onUnselect) { $params['onUnselect'] = $js->function_(null, 'tabId', $onUnselect); } $js->Copix->registerTabGroup($params); CopixHTMLHeader::addJSDOMReadyCode($js); return implode("\n", $toReturn); }
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; }
public function beforeAction($actionName) { CopixHTMLHeader::addJSLink(_resource('js/iconito/module_cahierdetextes.js')); // Contrôle d'accès au module if (Kernel::getLevel('MOD_CAHIERDETEXTES', _request('cahierId', _request('id', null))) < PROFILE_CCV_READ) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get())); } elseif (Kernel::getLevel('MOD_CAHIERDETEXTES', _request('cahierId', _request('id', null))) == PROFILE_CCV_READ) { if ($actionName == "processVoirTravaux" && is_null($eleve = _request('eleve', null))) { $myNode = CopixSession::get('myNode'); $eleve = $myNode['type'] == "USER_ELE" ? $myNode['id'] : null; } else { $eleve = _request('eleve', null); } if (is_null($eleve) && $actionName != 'go') { return CopixActionGroup::process('generictools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.errorOccurred'), 'back' => CopixUrl::get(''))); } } }
/** * Affiche la matrice des droits de visibilité entre utilisateurs * * @author Frédéric Mossmann <*****@*****.**> * @since 2006/12/07 */ public function view() { CopixHTMLHeader::addCSSLink(_resource("styles/module_sysutils.css")); if (!Admin::canAdmin()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get())); } $user_types = array('USER_VIL', 'USER_ENS', 'USER_ADM', 'USER_RES', 'USER_ELE', 'USER_EXT'); $visibility_matrice = array(); foreach ($user_types as $src) { foreach ($user_types as $dst) { $visibility_matrice[$src][$dst] = Kernel::getUserTypeVisibility($dst, $src); } } $tplUserVisibility = new CopixTpl(); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|admin.moduleDescription')); $tplUserVisibility->assign('visibility', $visibility_matrice); $tplUserVisibility->assign('user_types', $user_types); $tpl->assign('MAIN', $tplUserVisibility->fetch('sysutils|uservisibility.tpl')); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
public function processAdmin() { //check if the user is admin : if (!Kernel::isAdmin()) { return $this->error('charte.noRight', true, '||'); } $ppo = new CopixPPO(); $ppo->errors = isset($this->flash->errors) ? $this->flash->errors : null; $ppo->success = isset($this->flash->success) ? $this->flash->success : null; $ppo->chartes = $this->service('CharteService')->getChartesTypes(); $ppo->radio = array(1 => 'oui', 0 => 'non'); $ppo->idClasseur = $ppo->idMalle = null; $modsAvailable = Kernel::getModAvailable($this->user->type); $malleAvailable = Kernel::filterModuleList($modsAvailable, 'MOD_MALLE'); // Malle activée if (!empty($malleAvailable)) { $modsEnabled = Kernel::getModEnabled($this->user->type, $this->user->idEn); $mal = Kernel::filterModuleList($modsEnabled, 'MOD_MALLE'); // Si la malle est bien initialisée if (!empty($mal)) { $ppo->idMalle = $mal[0]->module_id; } else { return $this->error('charte.admin.noMalle', true, 'malle||'); } } else { $classeurAvailable = Kernel::filterModuleList($modsAvailable, 'MOD_CLASSEUR'); // Classeur activé if (!empty($classeurAvailable)) { Kernel::createMissingModules($this->user->type, $this->user->idEn); $modsEnabled = Kernel::getModEnabled($this->user->type, $this->user->idEn); $classeur = Kernel::filterModuleList($modsEnabled, 'MOD_CLASSEUR'); if (!empty($classeur)) { $ppo->idClasseur = $classeur[0]->module_id; } } } CopixHTMLHeader::addCSSLink(_resource("styles/module_charte.css")); return _arPPO($ppo, 'charte.admin.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 _createContent(&$toReturn) { $arModuleToDelete = CopixSession::get('arModuleToDelete', 'copix'); $moduleName = array_pop($arModuleToDelete); if (($message = CopixModule::deleteModule($moduleName)) === true) { $toReturn = _i18n('install.module.delete') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />'; if (count($arModuleToDelete) > 0) { $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true)); } else { $toReturn .= "<script>\$('back').setStyle('display','');</script>"; } } else { $toReturn = _i18n('install.module.delete') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message); $toReturn .= '<div class="errorMessage">' . $message . '</div>'; if (count($arModuleToDelete) > 0) { $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true)); } else { $toReturn .= "<script>\$('back').setStyle('display','');</script>"; } } CopixSession::set('arModuleToDelete', $arModuleToDelete, 'copix'); return true; }
/** * Accueil d'une liste * * @author Christophe Beyer <*****@*****.**> * @since 2005/11/23 * @param integer $id Id de la liste */ public function getListe() { $kernel_service =& CopixClassesFactory::Create('kernel|kernel'); $id = _request("id") ? _request("id") : NULL; $errors = array(); $dao = CopixDAOFactory::create("liste|liste_listes"); $liste = $dao->get($id); if (!$liste) { $errors[] = CopixI18N::get('liste|liste.error.noListe'); } else { $mondroit = $kernel_service->getLevel("MOD_LISTE", $id); if (!ListeService::canMakeInListe('VIEW_HOME', $mondroit)) { $errors[] = CopixI18N::get('kernel|kernel.error.noRights'); } else { $parent = $kernel_service->getModParentInfo("MOD_LISTE", $id); $liste->parent = $parent; } } //print_r($liste); if ($errors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get('liste||'))); } else { CopixHTMLHeader::addCSSLink(_resource("styles/module_liste.css")); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', $liste->parent["nom"]); $menu = array(); $menu[] = array('txt' => CopixI18N::get('liste|liste.homeLinkMsgSend'), 'url' => CopixUrl::get('minimail||getListSend')); $tpl->assign('MENU', $menu); $tplListe = new CopixTpl(); $tplListe->assign('liste', $liste); $tplListe->assign('canWrite', ListeService::canMakeInListe('WRITE', $mondroit)); $result = $tplListe->fetch('getliste.tpl'); $tpl->assign('MAIN', $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); } }
" type="text/css" /> <link rel="stylesheet" href="<?php echo _resource("js/mootools/css/moopanes.css"); ?> " type="text/css" /> <script type="text/javascript" src="<?php echo _resource("js/site.js.php"); ?> "></script> <!--[if IE]> <link rel="stylesheet" href="<?php echo _resource("styles/ie.css"); ?> " type="text/css"/> <![endif]--> </head> <body> <div id="allcontent"> <div id="banner"><span id="slogan">100% communautaire, 100% professionnel... 200% efficace.</span></div> <!-- end banner --> <div id="menu"> <?php if (CopixModule::isEnabled('quicksearch')) { echo CopixZone::process('quicksearch|quicksearchform'); } ?>
public function cleanCode(&$content, $title = "") { $content = preg_replace('/<</', '«', $content); $content = preg_replace('/>>/', '»', $content); $content = preg_replace('/\\(c\\)/', '©', $content); $content = preg_replace('/\\(r\\)/', '®', $content); $content = preg_replace('/¿/', '¿', $content); //money $content = preg_replace('/€/', '€', $content); $content = preg_replace('/¥/', '¥', $content); $content = preg_replace('/¢/', '¢', $content); $content = preg_replace('/£/', '£', $content); //arrows $content = preg_replace('/-->/', '→', $content); $content = preg_replace('/<--/', '←', $content); $content = preg_replace('/<->/', '↔', $content); $content = preg_replace('/==>/', '⇒', $content); $content = preg_replace('/<==/', '⇐', $content); $content = preg_replace('/<=>/', '⇔', $content); //math //$content = preg_replace('/`(.*?)`/', '&\\1;', $content); $content = preg_replace('/=</', '≤', $content); $content = preg_replace('/>=/', '≥', $content); $content = preg_replace('/!=/', '≠', $content); $content = preg_replace('/~=/', '≅', $content); //remove tags $content = str_replace('<', '_lower_', $content); $content = str_replace('>', '_greater_', $content); //now replace _lower_ and _greater_ codes... $content = str_replace('_lower_', '<', $content); $content = str_replace('_greater_', '>', $content); //recreate some tags $content = str_replace('_end_strike_', "</del>", $content); $content = str_replace('_strike_', "<del>", $content); //rule $content = preg_replace('/\\n*\\-{4}\\n*/', "<hr />", $content); //code $content = preg_replace('/\'\'(.*?)\'\'/', "<code>\\1</code>", $content); //links $links = array(); preg_match_all('/\\[\\[(.*?)\\]\\]/', $content, $links); $foundlinks = $links[1]; $i = 0; foreach ($foundlinks as $foundlink) { //seek if we have | to set caption $elem = explode("|", $foundlink); $link = $elem[0]; $caption = isset($elem[1]) ? $elem[1] : $elem[0]; $style = "wiki_exists"; //anchors $anchor = explode("#", $link); $link = strlen($anchor[0]) ? $anchor[0] : $title; if (isset($anchor[1])) { $anchor = $anchor[1]; } else { $anchor = ""; } //is it an external link ? if (!preg_match('/http:/', $link)) { //no, so i think this is a wiki link //page exists ? $parts = explode('/', $link); $heading = ''; $lang = ''; if (count($parts) == 3) { $heading = $parts[0]; $link = $parts[1]; } elseif (count($parts) == 2) { $heading = $parts[0]; $link = $parts[1]; } $dao = _ioDao('wikipages'); $res = $dao->findBy(_daoSp()->startGroup()->addCondition('title_wiki', "=", CopixUrl::escapeSpecialChars($link))->addCondition('heading_wiki', '=', $heading)->endGroup()); if (!$res) { $style = "wiki_no_exists"; } else { $anchor = preg_replace("/[^a-zA-Z0-9]/", $this->anchor_separator, $anchor); } $link = _url('wiki||show', array('title' => $link, 'heading' => $heading)); } $link .= isset($anchor) && strlen($anchor) ? "#" . $anchor : ""; //now, replace link $link = "<a href=\"" . $link . "\" title=\"" . $caption . "\" class=\"{$style}\">{$caption}</a>"; //link has "//" but this is used for italic... so we have to //change it for now... see end function to restore links $link = str_replace("//", "_double_slashes_", $link); $content = str_replace($links[0][$i], $link, $content); $i++; } //images $images = array(); preg_match_all('/\\{\\{(.*?)\\}\\}/', $content, $images); $foundimages = $images[1]; $i = 0; foreach ($foundimages as $foundimg) { $elem = explode(":", $foundimg); if ($elem[0] == "file") { //case of file $class = "wiki_dl_file"; $image = "<a href=\"" . _url('wiki|file|getfile', array('title' => $elem[1])) . "\" title=\"" . $elem[1] . "\" class=\"{$class}\">" . $elem[1] . "</a>"; } else { $elem = explode("|", $foundimg); $foundimg = $elem[0]; $width = isset($elem[1]) ? $elem[1] : ""; $align = isset($elem[2]) ? $elem[2] : ""; $disp = ""; //is it an external link ? if (preg_match('/http:/', $foundimg)) { $alt = explode("/", $foundimg); $alt = $alt[count($alt) - 1]; $alt = explode('.', $alt); $alt = $alt[0]; if ($width) { //$disp = '<a href="' . $foundimg . '" target="_blank" title="' . _i18n ("wiki|wiki.show.fullsize") . '">(-)</a>'; $icon = "<img src=\"" . _resource('img/tools/loupe.png') . "\" alt=\"download\"/>"; $disp = '<a href="' . $foundimg . '" target="_blank" title="' . _i18n("wiki|wiki.show.fullsize") . '">' . $icon . '</a>'; $disp = "<span style=\"height:15px;margin-left: -15px;\">{$disp}</span>"; } } else { //no, so i think this is a wiki link $alt = $foundimg; $foundimg = _url('wiki|file|getFile', array('title' => $alt, 'size' => $width)); $_foundimg = _url('wiki|file|getFile', array('title' => $alt)); //$_foundimg="javascript:WikiSeeImage('$_foundimg','$alt')"; $_foundimg = '<a href="' . $_foundimg . '" rel="lightbox[' . $title . ']" title="' . $alt . '">'; if ($width) { $icon = "<img src=\"" . _resource("img/tools/loupe.png") . "\" alt=\"download\" style=\"z-index: 99\" />"; $disp = $_foundimg . $icon . "</a>"; $disp = "<span style=\"height:20px;margin-left: -15px;\">{$disp}</span>"; } if (function_exists("gd_info")) { $width = ""; //because gd resized image } } if (strlen($align) > 0) { $align = ' align="' . $align . '"'; } if (strlen($width) > 0) { $width = ' width="' . $width . '"'; } $image = ""; $image = "<span style=\"display: inline\">"; $image .= '<img name="wiki_image" src="' . $foundimg . '"' . $width . $align . ' alt="' . $alt . '" />'; $image .= $disp . "</span>"; } $content = str_replace($images[0][$i], $image, $content); $i++; } //footnotes preg_match_all('/\\(\\((.*?)\\)\\)/', $content, $fn); $fns = $fn[1]; $i = count($this->footnotes); $j = 0; foreach ($fns as $footnote) { $this->footnotes[] = $footnote; $content = str_replace($fn[0][$j], "<a href=\"#wiki_footnotes\" title=\"{$footnote}\"><sup>" . ($i + 1) . "</sup></a>", $content); $i++; $j++; } //other $content = preg_replace('/\\*{2}(.*?)\\*{2}/', "<strong>\\1</strong>", $content); $content = str_replace("http://", "_URI_STRING_", $content); $content = preg_replace('/\\/{2}(.*?)\\/{2}/', "<em>\\1</em>", $content); $content = str_replace("_URI_STRING_", "http://", $content); $content = preg_replace('/_{2}(.*?)_{2}/', "<u>\\1</u>", $content); //sup $content = preg_replace('/(.+?)\\^\\((.+?)\\)/', '\\1<sup>\\2</sup>', $content); $content = preg_replace('/sqrt\\((.+?)\\)/', ' √<span style="text-decoration: overline">\\1</span>', $content); //last modification: //$content = preg_replace("/(\s)+/", "\\1", $content); $content = str_replace("<br>", "<br />", $content); $content = preg_replace('/<h(\\d)><br \\/>/', "<h\\1>", $content); $content = str_replace("_double_slashes_", "//", $content); }
public function beforeAction() { _currentUser()->assertCredential('group:[current_user]'); CopixHTMLHeader::addCSSLink(_resource("styles/module_visio.css")); }
/** * Fonction appelée lorsque l'on clique sur le lien export du menu * Récupère en session les agendas visualisables de l'utilisateur * récupère l'objet exportParams en session s'il existe, le créer sinon, puis stock en session * @since 2006/08/17 * @author Audrey Vassal <*****@*****.**> * appelle les zones agendamenu et agendaexport */ public function processGetPrepareExport() { CopixHTMLHeader::addCSSLink(_resource("styles/module_agenda.css")); CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.ui.datepicker-fr.js")); $serviceAuth = new AgendaAuth(); $serviceAgenda = new AgendaService(); //on vérifie les droits des utilisateurs sur la liste des agendas affichés $listAgendasAffiches = $serviceAgenda->getAgendaAffiches(); foreach ((array) $listAgendasAffiches as $id_agenda) { //on vérifie si l'utilisateur a les droits d'écriture sur un des agendas affiché if ($serviceAuth->getCapability($id_agenda) >= $serviceAuth->getRead()) { $ableToRead = true; } } if (!$ableToRead) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.error.enableToWrite'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine'))); } //on récupère en session la liste des agendas en cours de visualisation $arAgendasAffiches = $serviceAgenda->getAgendaAffiches(); $arTitleAgendasAffiches = $serviceAgenda->getArTitleAgendaByArIdAgenda($arAgendasAffiches); if (!($exportParams = $this->_getSessionExport())) { //initialisation de l'objet exportParams avec le premier agenda affiché de la liste $exportParams->id_agenda = current($arAgendasAffiches); $this->_setSessionExport($exportParams); } //récupération de la liste des agendas en bdd (pour l'affichage du menu) $listAgendas = $serviceAgenda->getAvailableAgenda(); //récupération de la liste des agendas affichés $listAgendasAffiches = $serviceAgenda->getAgendaAffiches(); //template pour agenda $tplAgenda = new CopixTpl(); $tplAgenda->assign('MAIN_AGENDA', CopixZone::process('agenda|agendaexport', array('arTitleAgendasAffiches' => $arTitleAgendasAffiches, 'e' => $this->getRequest('e'), 'errors' => $this->getRequest('errors'), 'exportParams' => $exportParams))); //template principal $tpl = new CopixTpl(); $tpl->assign('BODY_ON_LOAD', "setDatePicker('#datedeb_export,#datefin_export')"); $tpl->assign('TITLE_PAGE', CopixI18N::get('agenda|agenda.message.export')); $menu = $serviceAgenda->getAgendaMenu('export'); $tpl->assign('MENU', $menu); $tpl->assign('MAIN', $tplAgenda->fetch('agenda|main.agenda.tpl')); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
public function process($pParams, $pContent = null) { // paramètre id if (!isset($pParams['id'])) { throw new CopixTemplateTagException(_i18n('copix:taglib.showdiv.missingIdParameter')); } // paramètre show if (!isset($pParams['show'])) { $pParams['show'] = true; } else { $pParams['show'] = $pParams['show'] == 'true' || $pParams['show'] == 1; } // paramètre captioni18n fourni, qui vaut dans le cas up et le cas down if (isset($pParams['captioni18n'])) { $pParams['captionup'] = _i18n($pParams['captioni18n']); $pParams['captiondown'] = $pParams['captionup']; // si on a un paramètre caption qui s'occupe de tout les cas } elseif (isset($pParams['caption'])) { $pParams['captionup'] = $pParams['caption']; $pParams['captiondown'] = $pParams['caption']; // paramètres captionupi18n et captiondowni18n, qui valent chacun pour leur cas } elseif (isset($pParams['captionupi18n']) && isset($pParams['captiondowni18n'])) { $pParams['captionup'] = _i18n($pParams['captionupi18n']); $pParams['captiondown'] = _i18n($pParams['captiondowni18n']); // pas de paramètre captionup ou captiondown } elseif (!isset($pParams['captionup']) || !isset($pParams['captiondown'])) { $pParams['captionup'] = null; $pParams['captiondown'] = null; } // paramètre showicon $pParams['showicon'] = !isset($pParams['showicon']) || isset($pParams['showicon']) && ($pParams['showicon'] == 'true' || $pParams['showicon'] == 1); // paramètre iconup $pParams['iconup'] = isset($pParams['iconup']) ? _resource($pParams['iconup']) : _resource('img/tools/way_up.png'); // paramètre icondown $pParams['icondown'] = isset($pParams['icondown']) ? _resource($pParams['icondown']) : _resource('img/tools/way_down.png'); // code javascript pour afficher / cacher un div CopixHTMLHeader::addJsCode('if (!window.smarty_show_div_infos) { smarty_show_div_infos = new Array (); } function smarty_show_div (id, show) { if (show) { img = (window.smarty_show_div_infos[id] && window.smarty_show_div_infos[id][\'img_up\']) ? smarty_show_div_infos[id][\'img_up\'] : null; style = \'\'; caption = (window.smarty_show_div_infos[id] && window.smarty_show_div_infos[id][\'caption_up\']) ? smarty_show_div_infos[id][\'caption_up\'] : null; } else { img = (window.smarty_show_div_infos[id] && window.smarty_show_div_infos[id][\'img_down\']) ? smarty_show_div_infos[id][\'img_down\'] : null; style = \'none\'; caption = (window.smarty_show_div_infos[id] && window.smarty_show_div_infos[id][\'caption_down\']) ? smarty_show_div_infos[id][\'caption_down\'] : null; } document.getElementById (id).style.display = style; if (document.getElementById (\'img_\' + id) != undefined) { document.getElementById (\'img_\' + id).src = img; if (caption != null) { document.getElementById (\'caption_\' + id).innerHTML = caption; } } } function smarty_invert_show (id) { smarty_show_div (id, (document.getElementById (id).style.display != \'\')); }', 'smarty_show_div'); // code JS pour créer le tableau des infos de cet ID CopixHTMLHeader::addJsCode('smarty_show_div_infos[\'' . $pParams['id'] . '\'] = new Array ();', 'smarty_show_div_' . $pParams['id']); // code JS pour les images if ($pParams['showicon'] && !is_null($pParams['iconup']) && !is_null($pParams['icondown'])) { CopixHTMLHeader::addJsCode('smarty_show_div_infos[\'' . $pParams['id'] . '\'][\'img_up\'] = \'' . $pParams['iconup'] . '\';' . "\n" . 'smarty_show_div_infos[\'' . $pParams['id'] . '\'][\'img_down\'] = \'' . $pParams['icondown'] . '\';', 'smarty_show_div_img_' . $pParams['id']); } // code javascript pour les captions if (!is_null($pParams['captionup']) && !is_null($pParams['captiondown'])) { CopixHTMLHeader::addJsCode('smarty_show_div_infos[\'' . $pParams['id'] . '\'][\'caption_up\'] = \'' . str_replace("'", "\\'", $pParams['captionup']) . '\';' . "\n" . 'smarty_show_div_infos[\'' . $pParams['id'] . '\'][\'caption_down\'] = \'' . str_replace("'", "\\'", $pParams['captiondown']) . '\';', 'smarty_show_div_captions_' . $pParams['id']); } // création du code HTML if ($pParams['showicon'] || !is_null($pParams['captionup']) && !is_null($pParams['captiondown'])) { if ($pParams['show']) { $imgSrc = $pParams['iconup']; $caption = $pParams['captionup']; } else { $imgSrc = $pParams['icondown']; $caption = $pParams['captiondown']; } $out = '<a href="javascript: smarty_invert_show (\'' . $pParams['id'] . '\');">'; // si on veut afficher un icon if ($pParams['showicon']) { $out .= '<img id="img_' . $pParams['id'] . '" src="' . $imgSrc . '" style="cursor:pointer" alt="showdiv" />'; } // si on veut afficher un caption if (!is_null($caption)) { $out .= ' <span id="caption_' . $pParams['id'] . '">' . $caption . "</span>"; } $out .= '</a>'; } else { $out = null; } return $out; }
public function getGroup() { if (!Kernel::isAdmin()) { return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('||')); } $tpl = new CopixTpl(); $tplGrVilles = new CopixTpl(); CopixHTMLHeader::addCSSLink(_resource("styles/module_regroupements.css")); $regroupements_service =& CopixClassesFactory::Create('regroupements|regroupements'); $tpl->assign('TITLE_PAGE', CopixI18N::get('regroupements|regroupements.villes.titre')); $tpl->assign('MENU', $regroupements_service->getMenu()); $dao_grvilles_gr2ville = CopixDAOFactory::create("regroupements|grvilles_gr2ville"); $dao_grvilles = CopixDAOFactory::create("regroupements|grvilles"); $dao_villes = CopixDAOFactory::create("kernel|kernel_tree_vil"); $villes = $dao_villes->findAll(); $tplGrVilles->assign('villes', $villes); if (_request("delete")) { $dao_grvilles->delete(_request("delete")); $dao_grvilles_gr2ville->deleteByGroupe(_request("delete")); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('regroupements|villes|')); } if (_request("save") && _request("save") == 1) { $date = date("Y-m-d H:i:s"); $user = Kernel::getUserInfo(); if (_request("form_id") > 0) { $grvilles_infos = $dao_grvilles->get(_request("form_id")); $grvilles_infos->nom = _request("form_nom"); $grvilles_infos->updated_at = $date; $grvilles_infos->updated_by = $user['login']; $dao_grvilles->update($grvilles_infos); $dao_grvilles_gr2ville->deleteByGroupe(_request("form_id")); } else { $grvilles_infos = CopixDAOFactory::createRecord("regroupements|grvilles"); $grvilles_infos->nom = _request("form_nom"); if ($grvilles_infos->nom == '') { $grvilles_infos->nom = 'Sans nom'; } $grvilles_infos->updated_at = date("Y-m-d H:i:s"); $grvilles_infos->updated_by = $user['login']; $dao_grvilles->insert($grvilles_infos); } $grvilles_gr2ville = _record("regroupements|grvilles_gr2ville"); $grvilles_gr2ville->id_groupe = $grvilles_infos->id; $grvilles_gr2ville->updated_at = $date; $grvilles_gr2ville->updated_by = $user['login']; foreach ($villes as $ville) { if (_request("ville_" . $ville->vil_id_vi) == 1) { $grvilles_gr2ville->id_ville = $ville->vil_id_vi; _dao("regroupements|grvilles_gr2ville")->insert($grvilles_gr2ville); } } if (_request("form_id") == 0) { return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('regroupements|villes|', array('groupe' => $grvilles_infos->id))); } } if (_request("groupe")) { $tplGrVilles->assign('grvilles_id', _request("groupe")); $tplGrVilles->assign('grvilles_form', true); if (_request("groupe") > 0) { // Edition d'un groupe $grvilles_infos = $dao_grvilles->get(_request("groupe")); $grvilles_villes_raw = $dao_grvilles_gr2ville->findByGroupe(_request("groupe")); // Tableau indexé par id de ville $grvilles_villes = array(); foreach ($grvilles_villes_raw as $grvilles_villes_item) { $grvilles_villes[$grvilles_villes_item->id_ville] = $grvilles_villes_item; } $tplGrVilles->assign('grvilles_infos', $grvilles_infos); $tplGrVilles->assign('grvilles_villes', $grvilles_villes); } else { // Création d'un nouveau groupe } } $grvilles_list = $dao_grvilles->findAll(); // print_r($grvilles_list); $tplGrVilles->assign('grvilles_list', $grvilles_list); $main = $tplGrVilles->fetch('getgrvilles.tpl'); $tpl->assign('MAIN', $main); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
<?php /** * @package copix * @subpackage copixtools * @version $Id: CopixPager.config.php,v 1.4 2006-10-04 16:21:18 fmossmann Exp $ * @author <*****@*****.**>, Bertrand Yan * @copyright 2001-2005 CopixTeam * @link http://copix.org * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file */ /** * * Fichier de configuration de la classe CopixPager pour un projet entier * Ce fichier sert de valeurs par défaut pour un projet entier, mais rien n'empêche de les paramétrer directement * lors de la création d'un objet Multipage * */ /************************************** * Paramètrage global du multipage **************************************/ $options['PAGER'] = array('perPage' => 10, 'delta' => 5, 'alwaysShow' => true, 'toHtmlEntities' => false, 'encodeVarUrl' => false, 'display' => 'sliding'); /**************************** * Paramètrage divers ****************************/ $options['PARAMS'] = array('nextPage' => '<img src="' . _resource('images/icon-16/pager-next.png') . '" alt="next"/> ', 'previousPage' => '<img src="' . _resource('images/icon-16/pager-previous.png') . '" alt="previous"/> ', 'lastPage' => '<img src="' . _resource('images/icon-16/pager-last.png') . '" alt="last"/>', 'firstPage' => '<img src="' . _resource('images/icon-16/pager-first.png') . '" alt="first"/> ', 'separator' => ' - ', 'curPageSpanPre' => '<strong>', 'curPageSpanPost' => '</strong>', 'linkClass' => 'multipage'); /************************************************************************************************** * Configuration avancée (optionnel, vous pouvez laisser les paramètres par défaut. * C'est uniquement pour ceux qui aiment bidouiller.) **************************************************************************************************/ $options['ADVANCED'] = array('varUrl' => 'p');
public function processEndQuestions() { $pId = CopixRequest::getInt('id', false); if (!$pId || is_null(qSession('id')) || $pId != qSession('id')) { return CopixActionGroup::process('quiz|default::Quiz', array('id' => $pId)); } $ppo = new CopixPPO(); CopixHTMLHeader::addCSSLink(_resource("styles/module_quiz.css")); return _arPPO($ppo, 'end_questions.tpl'); }