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; }
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; }
/** * 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; }
/** * Plugin smarty type fonction * init for tooltip function plugin * Part of tooltip package, written by Laurent Jouanneau * http://ljouanneau.com/softs/javascript/ * use : * {tooltipinit} * {tooltipinit path="path_to_tooltip.js"} * */ function smarty_function_tooltipinit($params, &$smarty) { static $tooltipinit = 0; if ($tooltipinit == 0 || isset($params['force'])) { extract($params); if (!isset($path)) { $path = 'js/'; } CopixHTMLHeader::addJSLink($path . 'tooltip.js'); $tooltipinit = 1; return '<div id="tooltip"></div>'; } else { return ''; } }
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 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(''))); } } }
function smarty_function_calendar($params, &$smarty) { static $_init = false; extract($params); //check the initialisation if (!$_init) { //path of the library CopixHTMLHeader::addCSSLink(CopixUrl::get() . "js/dynCal/dynCalendar.css", array('media' => 'screen')); CopixHTMLHeader::addJSLink(CopixUrl::get() . "js/dynCal/browserSniffer.js"); CopixHTMLHeader::addJSLink(CopixUrl::get() . "js/dynCal/dynCalendar.js"); if (empty($lang)) { $lang = CopixI18N::getLang(); } CopixHTMLHeader::addJSLink(CopixUrl::get() . "js/dynCal/lang/" . $lang . ".js"); $_init = true; } //Calculating the jsCode (kind of silly trick to use a separator as a part of jsCode, but still quick) $jsCode = str_replace(array('d', 'm', 'Y'), array('day', 'month', 'year'), CopixI18N::getDateFormat(" + '/' + ")); CopixHTMLHeader::addJSCode("\n\r" . ' function calendarCallback' . $name . '(day, month, year) { var tmp; if (String(month).length == 1) { month = \'0\' + month; } if (String(day).length == 1) { day = \'0\' + day; } tmp = document.getElementById (\'' . $name . '\'); tmp.value = ' . $jsCode . '; } ' . "\n\r"); //name of the textarea. if (empty($name)) { $smarty->trigger_error('[smarty_calendar] missing name parameter'); } else { $out = '<input type="text" class="calendar" id="' . $name . '" name="' . $name . '" value="' . $value . '">' . "\n\r"; $out .= '<script language="javascript" type="text/javascript">' . "\n\r"; $out .= '<!--' . "\n\r"; $out .= 'calendar_' . $name . ' = new dynCalendar(\'calendar_' . $name . '\', \'calendarCallback' . $name . '\', \'' . CopixUrl::get() . 'js/dynCal/images/\');' . "\n\r"; $out .= '//-->' . "\n\r"; $out .= '</script>' . "\n\r"; } return $out; }
/** * Validation d'un article. */ public function doValidArticle() { CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.ui.datepicker-fr.js")); $id_blog = $this->getRequest('id_blog', null); $go = $this->getRequest('go', 'preview'); //die ("go=$go"); if ($id_blog == null) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.param'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } if (!BlogAuth::canMakeInBlog('ADMIN_ARTICLES', create_blog_object($id_blog))) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotManageCategory'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } $tpl = new CopixTpl(); // On r�cup�re l'utilisateur connect� $user = BlogAuth::getUserInfos(); $articleDAO = CopixDAOFactory::create('blog|blogarticle'); // Cat�gories coch�es... $tabSelectCat = array(); if (_request('tabSelectCat')) { $tabSelectCat = (array) _request('tabSelectCat'); } $id_bact = $this->getRequest('id_bact', null); if (strlen($id_bact) == 0) { $id_bact = null; } $showErrors = false; if ($id_bact != null) { // EDITION D'UN ARTICLE $article = $articleDAO->get($id_bact); $this->_validFromPostProperties($article); if (!$article->date_bact) { $article->date_bact = date('d/m/Y'); } if (!$article->time_bact) { $article->time_bact = date('H:i'); } $article->date_bact = CopixDateTime::dateToTimestamp($article->date_bact); $article->time_bact = timeToBD($article->time_bact); $article->author_bact = $user->userId; $tpl->assign('TITLE_PAGE', CopixI18N::get('blog.get.edit.article.title')); //print_r($article); $errors = $articleDAO->check($article); if (count($tabSelectCat) == 0) { $errors = array(); array_push($errors, CopixI18N::get('blog.error.nocategoryselect')); } if ($errors != 1) { // Traitement des erreurs $showErrors = true; } elseif ($go == 'save') { // Modification dans la base $article->url_bact = killBadUrlChars($article->id_bact . '-' . $article->name_bact); $article->sumary_html_bact = smarty_modifier_blog_format_article($article->sumary_bact, $article->format_bact); $article->content_html_bact = smarty_modifier_blog_format_article($article->content_bact, $article->format_bact); $articleDAO->update($article); // Insertion dans la base blogarticle_blogarticlecategory $artctgDAO = CopixDAOFactory::create('blog|blogarticle_blogarticlecategory'); $artctgDAO->deleteAndInsert($article->id_bact, $tabSelectCat); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog|admin|showBlog', array("id_blog" => $id_blog, "kind" => $this->getRequest('kind', '0')))); } } else { // CREATION D'UN ARTICLE $article = CopixDAOFactory::createRecord('blogarticle'); $this->_validFromPostProperties($article); if (!$article->date_bact) { $article->date_bact = date('d/m/Y'); } if (!$article->time_bact) { $article->time_bact = date('H:i'); } $article->date_bact = CopixDateTime::dateToTimestamp($article->date_bact); $article->time_bact = timeToBD($article->time_bact); $article->author_bact = $user->userId; $tpl->assign('TITLE_PAGE', CopixI18N::get('blog.get.create.article.title')); $errors = $articleDAO->check($article); if (count($tabSelectCat) == 0) { $errors = array(); array_push($errors, CopixI18N::get('blog.error.nocategoryselect')); } if ($errors != 1) { // Traitement des erreurs $showErrors = true; } elseif ($go == 'save') { // Insertion dans la base $article->sumary_html_bact = smarty_modifier_blog_format_article($article->sumary_bact, $article->format_bact); $article->content_html_bact = smarty_modifier_blog_format_article($article->content_bact, $article->format_bact); $articleDAO->insert($article); $article->url_bact = killBadUrlChars($article->id_bact . '-' . $article->name_bact); $articleDAO->update($article); // Insertion dans la base blogarticle_blogarticlecategory $artctgDAO = CopixDAOFactory::create('blog|blogarticle_blogarticlecategory'); $artctgDAO->deleteAndInsert($article->id_bact, $tabSelectCat); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog|admin|showBlog', array("id_blog" => $id_blog, "kind" => $this->getRequest('kind', '0')))); } } // Pr�paration du filtre CATEGORIES $blogArticleCategoryDAO = CopixDAOFactory::create('blog|blogarticlecategory'); $resArticleCategory = $blogArticleCategoryDAO->findAllOrder($id_blog); $tabArticleCategory = array(); foreach ($resArticleCategory as $cat) { if (in_array($cat->id_bacg, $tabSelectCat)) { $cat->selected = true; } else { $cat->selected = false; } array_push($tabArticleCategory, $cat); } $article->time_bact = BDToTime($article->time_bact); $tpl->assign('BODY_ON_LOAD', "setDatePicker('#date_bact')"); $tpl->assign('MAIN', CopixZone::process('EditArticle', array('id_blog' => $id_blog, 'id_bact' => $id_bact, 'article' => $article, 'kind' => $this->getRequest('kind', '0'), 'errors' => $errors, 'showErrors' => $showErrors, 'tabArticleCategory' => $tabArticleCategory, 'preview' => $go == 'preview' ? 1 : 0))); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
public function process($pParams, $pContent = null) { // Récupère les paramètres $src = $this->requireParam('src'); $attributes = array(); $attributes['quality'] = $quality = $this->getParam('quality', 'high'); $attributes['width'] = $width = $this->getParam('width'); $attributes['height'] = $height = $this->getParam('height'); $attributes['bgcolor'] = $bgcolor = $this->getParam('bgcolor'); $attributes['style'] = $style = $this->getParam('style'); $id = $this->getParam('id', uniqid('swf')); $name = $this->getParam('name', $id); $attributes = array_filter($attributes); $version = $this->getParam('version', '8'); @(list($major, $minor, $rev) = explode('.', $version)); $version = sprintf('%d.%d.%d', $major, $minor, $rev); //$doExpressInstall = $this->getParam('doExpressInstall'); $params = $this->getParam('params', array()); $vars = $this->getParam('vars', array()); $extra = $this->getExtraParams(); $this->validateParams(); // Intègre les paramètres de la forme params_X et vars_X dans les bons tableaux foreach ($extra as $key => $value) { if (substr($key, 0, 7) == 'params_') { $params[substr($key, 7)] = $value; unset($extra[$key]); } elseif (substr($key, 0, 5) == 'vars_') { $vars[substr($key, 5)] = $value; unset($extra[$key]); } } // Calcule la chaîne de variables $flashVars = count($vars) > 0 ? http_build_query($vars) : ''; $toReturn = array(); // Génère le tag Object (pour IE et compat HTML 4) $toReturn[] = '<object'; $toReturn[] = ' id="' . $id . '"'; $toReturn[] = ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'; $toReturn[] = ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' . str_replace('.', ',', $version) . ',0" '; foreach (array_merge($attributes, $extra) as $key => $value) { if ($value === true) { $toReturn[] = ' ' . $key; } elseif ($vale !== false) { $toReturn[] = sprintf(' %s="%s"', $key, htmlspecialchars($value)); } } $toReturn[] = '>'; $toReturn[] = '<param name="movie" value="' . $src . '" />'; if ($flashVars) { $toReturn[] = '<param name="flashvars" value="' . $flashVars . '" />'; } foreach ($params as $key => $value) { $toReturn[] = sprintf('<param name="%s" value="%s" />', $key, htmlspecialchars($value)); } // Génère le tag Embed (pour FF/Moz) $toReturn[] = '<embed '; $toReturn[] = ' id="' . $id . '"'; $toReturn[] = ' src="' . $src . '"'; foreach (array_merge($attributes, $extra, $params) as $key => $value) { if ($value === true) { $toReturn[] = ' ' . $key; } elseif ($vale !== false) { $toReturn[] = sprintf(' %s="%s"', $key, htmlspecialchars($value)); } } if ($flashVars) { $toReturn[] = ' flashvars="' . $flashVars . '"'; } $toReturn[] = ' name="' . htmlspecialchars($name) . '"'; $toReturn[] = ' type="application/x-shockwave-flash"'; $toReturn[] = ' pluginspage="http://www.macromedia.com/go/getflashplayer"'; $toReturn[] = ' />'; // Fin du tag Object $toReturn[] = '</object>'; // IE a besoin d'un coup de pouce (ça ne fait pas de mal aux navigateurs qui prétendraient être IE). if (strpos($_SERVER['HTTP_USER_AGENT'], ' MSIE ') !== false) { CopixHTMLHeader::addJSLink(_resource('js/taglib/swfobject.js'), array('id' => 'tag_swfobject_js', 'defer' => true)); // Si on est en AJAX, force un appelle à processSWFObjects if (CopixAJAX::isAJAXRequest()) { CopixHTMLHeader::addJSDOMReadyCode('processSWFObjects();', 'tag_swfobject_processSWFObjects'); } } return implode("", $toReturn); }
/** * Input: name = (required name of the select box * id = (optional) id of SELECT element. * values = (optional) values to display the values captions will be * html_escaped, not the ids * selected = (optional) id of the selected element * assign = (optional) name of the template variable we'll assign * the output to instead of displaying it directly * emptyValues = id / value for the empty selection * emptyShow = [true] / false - wether to show or not the "emptyString" * objectMap = (optional) if given idProperty;captionProperty * extra = (optional) if given, will be added directly in the select tag */ public function process($pParams, $pContent = null) { extract($pParams); //input check if (empty($name)) { throw new CopixTemplateTagException("[plugin copixselect] parameter 'name' cannot be empty"); } if (!empty($objectMap)) { $tab = explode(';', $objectMap); if (count($tab) != 2) { throw new CopixTemplateTagException("[plugin copixselect] parameter 'objectMap' must looks like idProp;captionProp"); } $idProp = $tab[0]; $captionProp = $tab[1]; $shortCaptionProp = $captionProp; if (isset($tab[2])) { $shortCaptionProp = $tab[2]; } } if (empty($extra)) { $extra = ''; } if (empty($id)) { $id = $name; } if (empty($values)) { $values = array(); } if (!is_array($values) && !$values instanceof Iterator) { $values = (array) $values; } if (empty($zIndex)) { $zIndex = '1000'; } if (empty($heightDiv)) { $heightDiv = 'auto'; } else { $heightDiv = intval($heightDiv) . 'px'; } if (empty($widthDiv)) { $widthDiv = 'auto'; } else { $widthDiv = intval($widthDiv) . 'px'; } if (empty($width)) { $width = 'auto'; } else { $width = intval($width) . 'px'; } if (!isset($img)) { $img = 'img/tools/multiple.gif'; } if (!isset($selected)) { $selected = ''; } if (!isset($selectedIsIdentical)) { $selectedIsIdentical = false; } if (!isset($class)) { $class = 'copixselect'; } $js = new CopixJSWidget(); $toReturn = "\n <span id='clicker_{$id}'>\n <input id='caption{$id}' name='caption{$name}' type='text' readonly='readonly' class='{$class}' style='width:{$width};cursor:default;text-align:left;padding-left:3px;height:13px;' value ='' /><img src=" . CopixUrl::getResource('img/tools/multiple.gif') . " align='absbottom' vspace='1' alt='' />\n <input id='{$id}' name='{$name}' type='hidden' class='{$class}' value ='{$selected}' />\n </span>\n <div class='{$class}' style='position:absolute;z-index:{$zIndex};display:none;width:{$widthDiv};height:{$heightDiv}' id='div{$id}'>\n <table class='{$class}' style='width:{$widthDiv};'>"; //each of the values.s $arValues = array(); $toReturnValue = ''; $event = "onmouseover = \"\$(this).setStyle('cursor','pointer');\$(this).setStyle ('background-color','#AAAAAA');\" onmouseout = \"\$(this).setStyle('background-color','white');\" onclick =\" \$('{$id}').value = \$(this).getProperty('rel');\$('caption{$id}').value = \$(this).innerHTML;\$('caption{$id}').fireEvent ('mouseleavezone');\" "; if (empty($objectMap)) { $arValues = $values; $compteur = 0; foreach ($values as $key => $caption) { if ($selectedIsIdentical && $selected === $key || !$selectedIsIdentical && $selected == $key) { $js->_("caption" . $id)->value = $caption; } $toReturn .= "<tr>\n <td class='{$id}' rel='{$key}' " . $event . " >{$values}</td>\n </tr>"; } } else { //if given an object mapping request. $compteur = 0; foreach ($values as $object) { if ($selectedIsIdentical && $selected === $object->{$idProp} || !$selectedIsIdentical && $selected == $object->{$idProp}) { $js->_("caption" . $id)->value = $object->{$shortCaptionProp}; } $arValues[$object->{$idProp}] = $object->{$captionProp}; $toReturn .= "<tr>\n <td class='{$id}' rel='" . $object->{$idProp} . "' " . $event . " >" . $arValues[$object->{$idProp}] . "</td>\n </tr>"; } } $toReturn .= "</table>\n </div>"; _tag('mootools', array('plugin' => array('zone', 'overlayfix'))); CopixHTMLHeader::addCSSLink(_resource('styles/taglib/copixselect.css'), array('id' => 'taglib_copix_select_css')); CopixHTMLHeader::addJSLink(_resource('js/taglib/copixselect.js')); $js->selectoverload($id); CopixHTMLHeader::addJSDOMReadyCode($js); return $toReturn; }
/** * Affiche le contenu d'un album * * V�rifie l'existance et les droits d'un album, et affiche les vignettes. * V�rifie �galement la pr�sence de toutes les vignettes, et lance la g�n�ration au cas ou. * * @author Fr�d�ric Mossmann <*****@*****.**> */ public function getAlbum() { CopixHTMLHeader::addCSSLink(_resource("styles/module_album.css")); CopixHTMLHeader::addJSLink(_resource("js/iconito/module_malle.js")); $tpl = new CopixTpl(); $kernel_service =& CopixClassesFactory::Create('kernel|kernel'); if (!_request("album_id") || trim(_request("album_id")) == "" || !preg_match("/^[0-9]+\$/", _request("album_id"))) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('album.error.noalbumnumber'), 'back' => CopixUrl::get('||'))); } $album_id = _request("album_id"); if (_request("dossier_id") && preg_match("/^[0-9]+\$/", _request("dossier_id"))) { $dossier_id = _request("dossier_id"); } else { $dossier_id = 0; } if (Kernel::getLevel("MOD_ALBUM", $album_id) < PROFILE_CCV_READ) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get('||'))); } $tplAlbum = new CopixTpl(); $album_dao = CopixDAOFactory::create("album"); $album = $album_dao->get($album_id); if (!$album) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('album.error.noalbum'), 'back' => CopixUrl::get('||'))); } $dossier_dao = CopixDAOFactory::create("dossier"); if ($dossier_id > 0) { $dossier = $dossier_dao->get($dossier_id); } else { $dossier->dossier_id = 0; $dossier->dossier_album = $album_id; $dossier->dossier_parent = -1; $dossier->dossier_nom = "Racine"; $dossier->dossier_comment = ""; $dossier->album_id = $album_id; } // V�rification des vignettes $key = $album->album_id . '_' . $album->album_cle; CopixSession::delete('modules|album|vignettes|' . $key); CopixSession::delete('modules|album|vignettes|nb-' . $key); $errors = Album::checkThumbnails($album_id, $key); if ($errors > 0) { //die (".".$errors); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('album|default|vignettes', array('album' => $album_id, 'dossier' => $dossier_id, 'key' => $key))); } $parent = $kernel_service->getModParentInfo("MOD_ALBUM", $album_id); $album->parent = $parent; $tplAlbum->assign("album", $album); $tplAlbum->assign("dossier", $dossier); $dossiermenu = array(); if (Kernel::getLevel("MOD_ALBUM", $album_id) >= PROFILE_CCV_PUBLISH) { $dossiermenu[] = array('txt' => CopixI18N::get('album.folder.action.newfolder.menu'), 'url' => '#', 'onclick' => 'openbox(\'folder_new\');', 'type' => 'add'); if ($dossier_id > 0) { $dossiermenu[] = array('txt' => CopixI18N::get('album.folder.action.rename.menu'), 'url' => '#', 'onclick' => 'openbox(\'folder_rename\');', 'type' => 'update'); $dossiermenu[] = array('txt' => CopixI18N::get('album.folder.action.move.menu'), 'url' => '#', 'onclick' => 'openbox(\'folder_move\');', 'type' => 'next'); $dossiermenu[] = array('txt' => CopixI18N::get('album.folder.action.delete.menu'), 'url' => '#', 'onclick' => 'openbox(\'folder_delete\');', 'type' => 'delete'); } $dossiermenu[] = array('txt' => CopixI18N::get('album.folder.action.movephotos.menu'), 'url' => CopixUrl::get('album|default|editphotos', array('album_id' => $album_id, 'dossier_id' => $dossier_id)), 'type' => 'next'); } $dossiers_list = Album::getFoldersTree($album_id); $tplAlbum->assign("dossiers", CopixZone::process('album|dossierstree', array('tree' => $dossiers_list, 'mode' => 'combo', 'album_id' => $album_id, 'dossier_id' => $dossier_id, 'dossier' => $dossier, 'dossiermenu' => $dossiermenu))); $photo_dao = CopixDAOFactory::create("photo"); $photolist = $photo_dao->findAllByAlbumAndFolder($album_id, $dossier_id); $tplAlbum->assign("photolist", $photolist); $dossiers_childs = Album::getFoldersTree($album_id, $dossier_id); $tplAlbum->assign("dossierlist", $dossiers_childs); foreach ($photolist as $photothumb) { Album::createThumbnails($photothumb->album_id . '_' . $photothumb->album_cle, $photothumb->photo_id . '_' . $photothumb->photo_cle, $photothumb->photo_ext); } $tplAlbum->assign('album_thumbsize', "_s128"); $tplAlbum->assign('album_thumbsize_height', "128"); $tplAlbum->assign('album_thumbsize_width', "128"); // Debut petit poucet $petit_poucet_array = array(); $dossier_walk = clone $dossier; if ($dossier->dossier_id > 0) { array_unshift($petit_poucet_array, clone $dossier_walk); } // _dump($dossier_walk); while ($dossier_walk->dossier_parent > 0) { $dossier_walk = $dossier_dao->get($dossier_walk->dossier_parent); array_unshift($petit_poucet_array, clone $dossier_walk); } $dossier_walk->dossier_id = 0; $dossier_walk->dossier_parent = -1; $dossier_walk->dossier_nom = 'Racine'; array_unshift($petit_poucet_array, clone $dossier_walk); $tplAlbum->assign('petit_poucet', $petit_poucet_array); // Fin petit poucet $result = $tplAlbum->fetch("album.tpl"); $tpl->assign('MAIN', $result); $album_nom = isset($album->parent["nom"]) ? $album->parent["nom"] : CopixI18N::get('album.moduleDescription'); if ($dossier_id > 0) { $album_nom .= " / " . $dossier->dossier_nom; } $tpl->assign('TITLE_PAGE', CopixI18N::get('album.title.album', array($album_nom))); $menu = array(); $simpleviewer_path = realpath("simpleviewer"); if (file_exists($simpleviewer_path . '/viewer.swf') && file_exists($simpleviewer_path . '/flashobject.js')) { $path2data = realpath("static"); $path2album = $path2data . "/album/" . $album_id . "_" . $album->album_cle; $addtopath = ''; if ($dossier_id > 0) { $addtopath = '/' . $dossier->dossier_id . "_" . $dossier->dossier_cle; } $path2album .= $addtopath; if (file_exists($path2album . '/imageData.xml')) { $menu[] = array('txt' => CopixI18N::get('album|album.menu.viewfolder'), 'url' => CopixUrl::get() . 'static/album/' . $album_id . "_" . $album->album_cle . $addtopath, 'target' => '_blank', 'size' => 110, 'type' => 'read'); if (Kernel::getLevel("MOD_ALBUM", $album_id) >= PROFILE_CCV_PUBLISH) { $menu[] = array('txt' => CopixI18N::get('album|album.menu.deletefolder'), 'url' => CopixUrl::get('album||depublier', array("album_id" => $album->album_id, "dossier_id" => $dossier->dossier_id)), 'size' => 140, 'type' => 'delete'); } } if (Kernel::getLevel("MOD_ALBUM", $album_id) >= PROFILE_CCV_PUBLISH) { $menu[] = array('txt' => CopixI18N::get('album|album.menu.publishfolder'), 'url' => CopixUrl::get('album||publier', array("album_id" => $album->album_id, "dossier_id" => $dossier_id)), 'size' => 100); } } // endif( simpleviewer ) if (Kernel::getLevel("MOD_ALBUM", $album_id) >= PROFILE_CCV_PUBLISH) { $menu[] = array('txt' => CopixI18N::get('album|album.menu.addzip'), 'url' => CopixUrl::get('album||addzip', array("album_id" => $album->album_id, "dossier_id" => $dossier_id)), 'behavior' => 'fancybox', 'size' => 140, 'type' => 'addfile'); $menu[] = array('txt' => CopixI18N::get('album|album.menu.addphoto'), 'url' => CopixUrl::get('album||addphoto', array("album_id" => $album->album_id, "dossier_id" => $dossier_id)), 'behavior' => 'fancybox', 'size' => 100, 'type' => 'addfile'); } $tpl->assign('MENU', $menu); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
private function _doJavascript() { if ($this->_jsLoad) { return true; } $this->_jsLoad = true; _tag('mootools', array('plugin' => 'overlayfix')); CopixHTMLHeader::addJSLink(_resource('js/taglib/copixlist.js')); if ($this->_url !== null) { CopixHTMLHeader::addJSDOMReadyCode('copixlist_setnonajax ("' . $this->_id . '","' . _url('#', array('submit' => 'false')) . '");'); } CopixHTMLHeader::addJSDOMReadyCode('copixlist_launch ("' . $this->_id . '")'); }
/** * Input: name = (required name of the select box * id = (optional) id of SELECT element. * values = (optional) values to display the values captions will be * html_escaped, not the ids * selected = (optional) id of the selected element * assign = (optional) name of the template variable we'll assign * the output to instead of displaying it directly * emptyValues = id / value for the empty selection * emptyShow = [true] / false - wether to show or not the "emptyString" * objectMap = (optional) if given idProperty;captionProperty * extra = (optional) if given, will be added directly in the select tag */ public function process($pParams, $pContent = null) { extract($pParams); //input check if (empty($name)) { throw new CopixTemplateTagException("[plugin multipleselect] parameter 'name' cannot be empty"); } if (!empty($objectMap)) { $tab = explode(';', $objectMap); if (count($tab) != 2) { throw new CopixTemplateTagException("[plugin multipleselect] parameter 'objectMap' must looks like idProp;captionProp"); } $idProp = $tab[0]; $captionProp = $tab[1]; } if (empty($extra)) { $extra = ''; } if (empty($id)) { $id = $name; } if (empty($values)) { $values = array(); } if (!is_array($values) && !$values instanceof Iterator) { $values = (array) $values; } if (empty($height)) { $height = 'auto'; } else { $height = intval($height) . 'px'; } if (empty($width)) { $width = 'auto'; } else { $width = intval($width) . 'px'; } if (!isset($img)) { $img = 'img/tools/multiple.gif'; } //each of the values. $idDiv = 'divdata_' . $id; $arValues = array(); $toReturnValue = ''; if (empty($objectMap)) { $arValues = $values; $compteur = 0; foreach ($values as $key => $caption) { $selectedString = isset($selected) && in_array($key, is_array($selected) ? $selected : array($selected), true) ? ' checked="checked" ' : ''; $currentId = uniqid('ch'); $compteur++; $color = $compteur % 2 == 0 ? '#cccccc' : '#ffffff'; $toReturnValue .= '<div class="multipleselect_checker_' . $id . '" rel="' . $id . '" style="width:auto;background-color:' . $color . ';color:black"><input type="checkbox" class="multipleselect_check_' . $id . '" rel="' . $id . '" id="' . $currentId . '" value="' . $key . '"' . $selectedString . ' /><label id="label_' . $currentId . '" for="' . $currentId . '" style="color:black">' . _copix_utf8_htmlentities($caption) . '</label><br /></div>'; } } else { //if given an object mapping request. $compteur = 0; foreach ($values as $object) { $arValues[$object->{$idProp}] = $object->{$captionProp}; $currentId = uniqid('check'); $compteur++; $color = $compteur % 2 == 0 ? '#cccccc' : '#ffffff'; $selectedString = array_key_exists('selected', $pParams) && in_array($object->{$idProp}, is_array($selected) ? $selected : array($selected)) ? ' checked="checked" ' : ''; $toReturnValue .= '<div class="multipleselect_checker_' . $id . '" rel="' . $id . '" style="width:auto;background-color:' . $color . ';color:black"><input type="checkbox" class="multipleselect_check_' . $id . '" rel="' . $id . '" id="' . $currentId . '" value="' . $object->{$idProp} . '"' . $selectedString . ' /><label id="label_' . $currentId . '" for="' . $currentId . '" style="color:black">' . _copix_utf8_htmlentities($object->{$captionProp}) . '</label><br /></div>'; } } _tag('mootools', array('plugin' => array('zone', 'overlayfix'))); CopixHTMLHeader::addJSLink(_resource('js/taglib/multipleselect.js')); CopixHTMLHeader::addJsDomReadyCode('multipleselect ();', 'multipleselect'); //proceed $value = ''; $hidden = ''; if (isset($selected) && is_array($selected)) { foreach ($selected as $select) { if ($value != null) { $value .= ','; } $value .= isset($arValues[$select]) ? $arValues[$select] : ''; $hidden .= '<input type="hidden" name="' . $name . '[]" value="' . $select . '" />'; } } elseif (isset($selected)) { $value .= isset($arValues[$select]) ? $arValues[$selected] : ''; } //Div caché pour avoir des paramètres disponible dans le DOM $toReturn = '<div style="display:none;" class="multipleselect_id" rel="' . $id . '"></div><div style="display:none;" id="name_' . $id . '" rel="' . $name . '"></div><div style="display:none;" id="height_' . $id . '" rel="' . $height . '"></div>'; //Commence par un car bug d'alignement dans certains nav $noreset = false; if (isset($pParams['noreset']) && $pParams['noreset']) { $noreset = true; } $toReturn .= '<span id="div_' . $id . '" style="width:' . $width . ';vertical-align:center;" ><input type="text" id="input_' . $id . '" name="input_' . $name . '" value="' . $value . '" ' . $extra . ' style="width:' . $width . '" readonly="readonly" noreset="' . $noreset . '"/><img src="' . CopixUrl::getResource($img) . '" align="absbottom" vspace="1" alt="" /></span>'; //Div contenant la liste $toReturn .= '<div id="' . $idDiv . '" style="margin:auto;visibility:hidden;top:1px;left:1px;position:absolute;z-index:9999;background-color:white;border:1px solid #bbbbbb">' . $toReturnValue . '</div>'; //Div contenant les champs hidden permettant de passer les valeurs sélectionner $toReturn .= '<div id="hidden_' . $id . '" style="visibility:hidden;position:absolute">' . $hidden . '</div>'; return $toReturn; }
public function addFileByTheme($iPathToJs) { CopixHTMLHeader::addJSLink(_resource($iPathToJs)); }
public function process($pParams, $pContent = null) { $id = $this->getParam('id', uniqid('modalbox')); $customContent = $this->getParam('customContent'); if (!$customContent) { $title = $this->getParam('title', ''); $icon = $this->getParam('icon'); } $openTriggers = $this->getParam('openTriggers'); $closeTriggers = $this->getParam('closeTriggers'); $onOpen = $this->getParam('onOpen'); $onClose = $this->getParam('onClose'); $this->validateParams(); CopixHTMLHeader::addJSFramework(); $options = array('id' => $id); if ($customContent) { $options['contentId'] = $customContent; } if ($openTriggers) { if (!is_array($openTriggers)) { $openTriggers = split(',', $openTriggers); } $options['openTriggers'] = $openTriggers; } if ($closeTriggers) { if (!is_array($closeTriggers)) { $closeTriggers = split(',', $closeTriggers); } $options['closeTriggers'] = $closeTriggers; } if ($customContent) { $boxContent = $pContent; } else { $boxContent = '<td width="100%">' . $pContent . '</td>'; if ($icon) { $titleColspan = 2; $boxContent = '<td style="text-align: center"><img src="' . _resource($icon) . '"/></td>' . $boxContent; } else { $titleColspan = 1; } $boxContent = '<tbody><tr>' . $boxContent . '</tr></tbody>'; if ($title) { $boxContent = '<thead><tr><th width="100%" colspan="' . $titleColspan . '">' . htmlEntities($title) . '</th></tr></thead>' . $boxContent; } $boxContent = '<table id="' . $id . '_content" class="CopixModalBox_Content CopixTable">' . $boxContent . '</table>'; } CopixHTMLHeader::addCSSLink(_resource('styles/taglib/js_modalbox.css'), array('id' => 'taglib_js_modalbox_css')); CopixHTMLHeader::addJSLink(_resource('js/taglib/js_modalbox.js'), array('id' => 'taglib_js_modalbox_js')); $js = new CopixJSWidget(); $js->Copix->ModalBox->register($options); $events = array(); if ($onOpen) { $events['open'] = $js->function_(null, null, $onOpen); } if ($onClose) { $events['close'] = $js->function_(null, null, $onClose); } if (count($events)) { $js->_($id)->addEvents($events); } CopixHTMLHeader::addJSDOMReadyCode($js); return '<div id="' . $id . '" style="display:none">' . $boxContent . '</div>'; }
/** * POPUP de selection ou d'upload d'un fichier unique * * @author Stephane Holtz <*****@*****.**> * @since 2010/07/29 * @param integer $id Id de la malle * @param integer $folder Id du répertoire * @param array $errors (option) Erreurs rencontrées * @param string $field Champ utilisé dans la fenêtre "en-dessous" * @param string $format Format de la zone de saisie (wiki, html, fckeditor...) */ public function processGetFilePopup() { $ppo = new CopixPPO(); $kernelService =& CopixClassesFactory::Create('kernel|kernel'); $malleService =& CopixClassesFactory::Create('malle|malleService'); $daoMalles = CopixDAOFactory::create("malle|malle_malles"); $daoFolders = CopixDAOFactory::create("malle|malle_folders"); $daoFiles = CopixDAOFactory::create("malle|malle_files"); $id = $this->getRequest('id', null); $folder = $this->getRequest('folder', 0); $errors = $this->getRequest('errors', array()); $field = $this->getRequest('field', null); $format = $this->getRequest('format', null); $criticErrors = array(); if ($folder) { $rFolder = $daoFolders->get($folder); if (!$rFolder) { $criticErrors[] = CopixI18N::get('malle|malle.error.noFolder'); } elseif ($rFolder->malle != $id) { $criticErrors[] = CopixI18N::get('malle|malle.error.noFolder'); } } else { $rMalle = $daoMalles->get($id); if (!$rMalle) { $criticErrors[] = CopixI18N::get('malle|malle.error.noMalle'); } } if (!$criticErrors) { $mondroit = $kernelService->getLevel("MOD_MALLE", $id); //print_r($mondroit); if (!$malleService->canMakeInMalle("READ", $mondroit)) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } else { $parent = $kernelService->getModParentInfo("MOD_MALLE", $id); //print_r($parent); } } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('malle||'))); } else { // On récupère les dossiers de ce répertoire $folders = $daoFolders->getFoldersInFolder($id, $folder); // On récupère les fichiers de ce répertoire $files = $daoFiles->getFilesInFolder($id, $folder); foreach ($files as $k => $file) { // Ajout des infos sur le type du fichier $mime = $malleService->getTypeInfos($file->type, $file->fichier); $files[$k]->type_text = $mime['type_text']; $files[$k]->type_icon = $mime['type_icon']; } $dispMenu = true; if (substr($parent['type'], 0, 5) == 'USER_') { $title = CopixI18N::get('malle|malle.perso'); $dispMenu = false; } else { $title = isset($parent["nom"]) ? $parent["nom"] : CopixI18N::get('malle.moduleDescription'); } $ppo->TITLE_PAGE = CopixI18N::get('malle|malle.popup.title'); $ppo->id = $id; $ppo->folder = $folder; $ppo->folders = $folders; $ppo->files = $files; $ppo->errors = $errors; $ppo->field = $field; $ppo->format = $format; $ppo->combofolders = CopixZone::process('malle|combofolders', array('malle' => $id, 'folder' => $folder, 'fieldName' => 'folder', 'attribs' => 'ONCHANGE="this.form.submit();"', 'linesSup' => array(0 => array('value' => '', 'libelle' => CopixI18N::get('malle|malle.comboDirectAccess'))))); $ppo->uploadMaxSize = CopixConfig::get('malle|uploadMaxSize'); CopixHTMLHeader::addJSLink(_resource("js/iconito/module_malle.js")); return _arPPO($ppo, array('template' => 'getfilepopup.tpl', 'mainTemplate' => 'main|main_popup.php')); } }
/** * Affichage de l'annuaire en version popup * * Affiche les discussions d'un forum et les informations sur les discussions (titre, dernier message...), avec un lien pour lire chaque discussion. * * @author Christophe Beyer <*****@*****.**> * @since 2006/01/18 */ public function getPopup() { if (!Kernel::is_connected()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('annuaire|annuaire.error.noLogged'), 'back' => CopixUrl::get('||'))); } CopixHTMLHeader::addJSLink(_resource("js/iconito/module_annuaire_popup.js")); CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.tablesorter.min.js")); CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.metadata.js")); CopixHTMLHeader::addCSSLink(_resource("js/jquery/css/jquery.tablesorter.css")); $grville = _request('grville') ? _request('grville') : NULL; $ville = _request('ville') ? _request('ville') : NULL; $ecole = _request('ecole') ? _request('ecole') : NULL; $classe = _request('classe') ? _request('classe') : NULL; $field = _request('field') ? _request('field') : ''; $profils = _request('profils') ? _request('profils') : array(); $profil = $this->getRequest('profil'); // Si on force sur un profil unique a afficher $ALL = CopixConfig::get('annuaire|annu_combo_all'); $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); // Annuaire par défaut, on regarde sa session if (!$classe && !$ecole && !$ville) { $home = $annuaireService->getAnnuaireHome(); //print_r($home); switch ($home['type']) { case 'BU_GRVILLE': $grville = $home['id']; $ville = $ALL; $ecole = $ALL; $classe = $ALL; break; case 'BU_VILLE': $info = Kernel::getNodeInfo($home['type'], $home['id']); if ($info) { $grville = $info['ALL']->vil_id_grville; } $ville = $home['id']; $ecole = $ALL; $classe = $ALL; break; case 'BU_ECOLE': $info = Kernel::getNodeInfo($home['type'], $home['id']); if ($info) { $grville = $info['ALL']->vil_id_grville; $ville = $info['ALL']->eco_id_ville; } $ecole = $home['id']; $classe = $ALL; break; case 'BU_CLASSE': $info = Kernel::getNodeInfo($home['type'], $home['id']); //_dump($info); if ($info) { $grville = $info['parent']['ALL']->vil_id_grville; $ville = $info['parent']['ALL']->eco_id_ville; $ecole = $info['parent']['id']; } $classe = $home['id']; //echo "grville=$grville / ville=$ville / ecole=$ecole / classe=$classe"; break; } } $comboEcoles = $comboClasses = true; // On force les valeurs des combos if ($profil) { switch ($profil) { case 'USER_VIL': $comboEcoles = $comboClasses = false; $ecole = $classe = $ALL; break; } } $matrix =& enic::get('matrixCache'); $helper =& enic::get('matrixHelpers'); $right = _request('right', 'voir'); // voir ou communiquer $iCan = 'communiquer' == $right ? 'iCanTalkToThisType' : 'iCanSeeThisType'; $tplListe = new CopixTpl(); $visib = array('USER_ELE' => $helper->{$iCan}('USER_ELE'), 'USER_ENS' => $helper->{$iCan}('USER_ENS') || $helper->{$iCan}('USER_DIR'), 'USER_RES' => $helper->{$iCan}('USER_RES'), 'USER_EXT' => $helper->{$iCan}('USER_EXT'), 'USER_ADM' => $helper->{$iCan}('USER_ADM'), 'USER_VIL' => $helper->{$iCan}('USER_VIL')); //_dump($visib); $debug = false; $start = microtime(true); $tplListe->assign('combogrvilles', CopixZone::process('annuaire|combogrvilles', array('droit' => $right, 'value' => $grville, 'fieldName' => 'grville', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_grville(this,this.form);"', 'linesSup' => array()))); if ($debug) { echo "combogrvilles " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } $start = microtime(true); $tplListe->assign('combovilles', CopixZone::process('annuaire|combovilles', array('droit' => $right, 'grville' => $grville, 'value' => $ville, 'fieldName' => 'ville', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_ville(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllVilles')))))); if ($debug) { echo "combovilles " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } $start = microtime(true); if ($ville == $ALL && $comboEcoles) { $tplListe->assign('comboecoles', CopixZone::process('annuaire|comboecolesingrville', array('droit' => $right, 'grville' => $grville, 'value' => $ecole, 'fieldName' => 'ecole', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_ecole(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllEcoles')))))); if ($debug) { echo "comboecolesingrville " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } elseif ($comboEcoles) { $tplListe->assign('comboecoles', CopixZone::process('annuaire|comboecolesinville', array('droit' => $right, 'ville' => $ville, 'value' => $ecole, 'fieldName' => 'ecole', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_ecole(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllEcoles')))))); if ($debug) { echo "comboecolesinville " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } $start = microtime(true); if ($ville == $ALL && $ecole == $ALL && $comboClasses) { $tplListe->assign('comboclasses', CopixZone::process('annuaire|comboclassesingrville', array('droit' => $right, 'grville' => $grville, 'value' => $classe, 'fieldName' => 'classe', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_classe(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllClasses')))))); if ($debug) { echo "comboclassesingrville " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } elseif ($ecole == $ALL && $comboClasses) { $tplListe->assign('comboclasses', CopixZone::process('annuaire|comboclassesinville', array('droit' => $right, 'ville' => $ville, 'value' => $classe, 'fieldName' => 'classe', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_classe(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllClasses')))))); if ($debug) { echo "comboclassesinville " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } elseif ($ecole && $comboClasses) { $tplListe->assign('comboclasses', CopixZone::process('annuaire|comboclassesinecole', array('droit' => $right, 'ecole' => $ecole, 'value' => $classe, 'fieldName' => 'classe', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_classe(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllClasses')))))); if ($debug) { echo "comboclassesinecole " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } elseif ($comboClasses) { $tplListe->assign('comboclasses', CopixZone::process('annuaire|comboempty', array('fieldName' => 'classe', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_classe(this,this.form);"'))); if ($debug) { echo "comboempty " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } if ($ville_as_array = Kernel::getKernelLimits('ville_as_array')) { // Limitation par URL, on verifie les parametres if ($ville && $ville != $ALL && !in_array($ville, $ville_as_array)) { $ville = 0; } if ($ecole && $ecole != $ALL && ($rEcole = Kernel::getNodeInfo('BU_ECOLE', $ecole, false)) && !in_array($rEcole['ALL']->vil_id_grville, $ville_as_array)) { $ecole = 0; } if ($classe && $classe != $ALL && ($rClasse = Kernel::getNodeInfo('BU_CLASSE', $classe, false)) && !in_array($rClasse['ALL']->eco_id_ville, $ville_as_array)) { $classe = 0; } } //kernel::myDebug ("grville=$grville / ville=$ville / ecole=$ecole / classe=$classe"); //kernel::myDebug ($profils); if ($classe && $classe !== $ALL) { // Une classe précise $visib['USER_ELE'] = $matrix->classe($classe)->_right->USER_ELE->{$right}; $visib['USER_ENS'] = $matrix->classe($classe)->_right->USER_ENS->{$right} || $matrix->classe($classe)->_right->USER_DIR->{$right}; $visib['USER_RES'] = $matrix->classe($classe)->_right->USER_RES->{$right}; $visib['USER_ADM'] = $matrix->classe($classe)->_right->USER_ADM->{$right}; $visib['USER_EXT'] = $matrix->classe($classe)->_right->USER_EXT->{$right}; $visib['USER_VIL'] = $matrix->classe($classe)->_right->USER_VIL->{$right}; } elseif ($ecole && $classe == $ALL && $ecole !== $ALL) { // Une école $visib['USER_ELE'] = $matrix->ecole($ecole)->_right->USER_ELE->{$right}; $visib['USER_ENS'] = $matrix->ecole($ecole)->_right->USER_ENS->{$right} || $matrix->ecole($ecole)->_right->USER_DIR->{$right}; $visib['USER_RES'] = $matrix->ecole($ecole)->_right->USER_RES->{$right}; $visib['USER_ADM'] = $matrix->ecole($ecole)->_right->USER_ADM->{$right}; $visib['USER_EXT'] = $matrix->ecole($ecole)->_right->USER_EXT->{$right}; $visib['USER_VIL'] = $matrix->ecole($ecole)->_right->USER_VIL->{$right}; } elseif ($ville && $classe == $ALL && $ecole == $ALL && $ville !== $ALL) { // Une ville $visib['USER_ELE'] = $matrix->ville($ville)->_right->USER_ELE->{$right}; $visib['USER_ENS'] = $matrix->ville($ville)->_right->USER_ENS->{$right} || $matrix->ville($ville)->_right->USER_DIR->{$right}; $visib['USER_RES'] = $matrix->ville($ville)->_right->USER_RES->{$right}; $visib['USER_ADM'] = $matrix->ville($ville)->_right->USER_ADM->{$right}; $visib['USER_EXT'] = $matrix->ville($ville)->_right->USER_EXT->{$right}; $visib['USER_VIL'] = $matrix->ville($ville)->_right->USER_VIL->{$right}; } elseif ($grville && $classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Un groupe de villes $visib['USER_ELE'] = $matrix->grville($grville)->_right->USER_ELE->{$right}; $visib['USER_ENS'] = $matrix->grville($grville)->_right->USER_ENS->{$right} || $matrix->grville($grville)->_right->USER_DIR->{$right}; $visib['USER_RES'] = $matrix->grville($grville)->_right->USER_RES->{$right}; $visib['USER_ADM'] = $matrix->grville($grville)->_right->USER_ADM->{$right}; $visib['USER_EXT'] = $matrix->grville($grville)->_right->USER_EXT->{$right}; $visib['USER_VIL'] = $matrix->grville($grville)->_right->USER_VIL->{$right}; } //_dump($visib); // Si on restreint a un profil if ($profil && $visib[$profil]) { switch ($profil) { case 'USER_VIL': $profils = array(); $profils['VIL'] = 1; break; } } if (!$profils && $visib['USER_ELE']) { $profils['ELE'] = 1; } elseif (!$profils && $visib['USER_ENS']) { $profils['PEC'] = 1; } elseif (!$profils && $visib['USER_RES']) { $profils['PAR'] = 1; } elseif (!$profils && $visib['USER_EXT']) { $profils['EXT'] = 1; } elseif (!$profils && $visib['USER_ADM']) { $profils['ADM'] = 1; } elseif (!$profils && $visib['USER_VIL']) { $profils['VIL'] = 1; } //kernel::myDebug($visib); // =============== ELEVES ========================= $eleves = array(); if (isset($profils['ELE']) && $grville && $ville && $ecole && $classe && $visib['USER_ELE']) { if ($classe != $ALL) { // Une classe précise $eleves = $annuaireService->getEleves('BU_CLASSE', $classe); } elseif ($classe == $ALL && $ecole != $ALL) { // Les eleves d'une école $eleves = $annuaireService->getEleves('BU_ECOLE', $ecole); } elseif ($classe == $ALL && $ecole == $ALL && $ville != $ALL) { // Les eleves d'une ville $eleves = $annuaireService->getEleves('BU_VILLE', $ville); } elseif ($classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Les eleves d'un groupe de villes $eleves = $annuaireService->getEleves('BU_GRVILLE', $grville); } } // =============== PERSONNEL ========================= $personnel = array(); if (isset($profils['PEC']) && $grville && $ville && $ecole && $classe && $visib['USER_ENS']) { if ($classe != $ALL) { // Une classe précise $personnel = $annuaireService->getPersonnel('BU_CLASSE', $classe); } elseif ($classe == $ALL && $ecole != $ALL) { // Les classes d'une école $personnel = $annuaireService->getPersonnel('BU_ECOLE', $ecole); } elseif ($classe == $ALL && $ecole == $ALL && $ville != $ALL) { // Les classes d'une ville $personnel = $annuaireService->getPersonnel('BU_VILLE', $ville); } elseif ($classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Les classes d'un groupe de villes $personnel = $annuaireService->getPersonnel('BU_GRVILLE', $grville); } } // =============== PARENTS ========================= $parents = array(); if (isset($profils['PAR']) && $grville && $ville && $ecole && $classe && $visib['USER_RES']) { if ($classe != $ALL) { // Une classe précise $parents = $annuaireService->getParents('BU_CLASSE', $classe); } elseif ($classe == $ALL && $ecole != $ALL) { // Les classes d'une école $parents = $annuaireService->getParents('BU_ECOLE', $ecole); } elseif ($classe == $ALL && $ecole == $ALL && $ville != $ALL) { // Les classes d'une ville $parents = $annuaireService->getParents('BU_VILLE', $ville); } elseif ($classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Les classes d'un groupe de villes $parents = $annuaireService->getParents('BU_GRVILLE', $grville); } } // =============== PERSONNEL ADMINISTRATIF ========================= $adm = array(); if (isset($profils['ADM']) && $grville && $ville && $ecole && $classe && $visib['USER_ADM']) { if (($classe != $ALL || $classe == $ALL) && $ecole != $ALL) { // Les classes d'une école $adm = $annuaireService->getPersonnelAdm('BU_ECOLE', $ecole); } elseif ($classe == $ALL && $ecole == $ALL && $ville != $ALL) { // Les classes d'une ville $adm = $annuaireService->getPersonnelAdm('BU_VILLE', $ville); } elseif ($classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Les classes d'un groupe de villes $adm = $annuaireService->getPersonnelAdm('BU_GRVILLE', $grville); } } // =============== PERSONNEL EXTERIEUR ========================= $ext = array(); if (isset($profils['EXT']) && $grville && $ville && $ecole && $classe && $visib['USER_EXT']) { $ext = $annuaireService->getPersonnelExt('ROOT', 0); } // =============== PERSONNEL VILLE ========================= $vil = array(); if (isset($profils['VIL']) && $grville && $ville && $visib['USER_VIL']) { if ($ville != $ALL) { // Dans une ville $vil = $annuaireService->getPersonnelVil('BU_VILLE', $ville); } elseif ($ville == $ALL) { // Dans un groupe de villes $vil = $annuaireService->getPersonnelVil('BU_GRVILLE', $grville); } } $droits = array('checkAll' => $annuaireService->canMakeInAnnuaire('POPUP_CHECK_ALL')); $users = array(); foreach ($eleves as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($parents as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($personnel as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($adm as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($vil as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($ext as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } //_dump($eleves); /* if ('communiquer' === $right) { foreach ($users as $k => $user) { //print_r($user); //$matrix->communiquer(); } } */ usort($users, array('ActionGroupAnnuaire', '_usortPopup')); $tplListe->assign('field', $field); $tplListe->assign('grville', $grville); $tplListe->assign('eleves', $eleves); $tplListe->assign('personnel', $personnel); $tplListe->assign('parents', $parents); $tplListe->assign('ext', $ext); $tplListe->assign('adm', $adm); $tplListe->assign('vil', $vil); $tplListe->assign('profils', $profils); $tplListe->assign('droits', $droits); $tplListe->assign('ville', $ville); $tplListe->assign('ecole', $ecole); $tplListe->assign('classe', $classe); $tplListe->assign('visib', $visib); $tplListe->assign('profil', $profil); $tplListe->assign('users', $users); $tplListe->assign('right', $right); $result = $tplListe->fetch('getpopup.tpl'); $ppo = new CopixPPO(); $ppo->result = $result; $ppo->TITLE_PAGE = CopixI18N::get('annuaire|annuaire.moduleDescription'); CopixHTMLHeader::addJSLink(_resource("js/iconito/module_annuaire.js")); return _arPPO($ppo, array('template' => 'getpopup_ppo.tpl', 'mainTemplate' => 'default|main_popup.php')); }
public function process($pParams, $pContent = null) { // Récupère les paramètres $zone = $this->requireParam('process'); $required = $this->getParam('required'); $ajax = $this->getParam('ajax', false); $id = $this->getParam('id'); $idClick = $this->getParam('idClick'); $text = $this->getParam('text', ''); $extra = $this->getParam('extra', ''); $handlers = array_filter($this->getParam(array('onDisplay', 'onHide', 'onComplete'), null, 'string')); $auto = $this->getParam('auto', false); $zoneParams = array_merge($this->getParam('zoneParams', array()), $this->getExtraParams()); // Valide les paramètres $this->validateParams(); // Supprime le préfixe "zoneParams_" des paramètres de la zone // Cela peut servir à passer des paramètres supplémentaires au niveau du tag // qui rentrent en conflit avec les noms des paramètres standard. foreach ($zoneParams as $key => $value) { if (preg_match('/^zoneParams_(.+)$/i', $key, $parts)) { unset($zoneParams[$key]); $zoneParams[$parts[1]] = $value; } } // Vérifie l'existence du module $fileInfo = new CopixModuleFileSelector($zone); if (!CopixModule::isEnabled($fileInfo->module) && $required === false) { return ""; } // Génère un identifiant si nécessaire $idProvided = $id !== null; if (!$idProvided) { $id = uniqid('copixzone'); } $toReturn = array(); // On a spécifié un texte : on l'ajoute comme trigger if ($text) { if ($idClick === null) { $idClick = $id . '_trigger'; } $toReturn[] = '<span id="' . $idClick . '">' . $text . '</span>'; } // Zone javascript si on a un clicker, de l'AJAX ou des gestionnaires d'événéments if ($idProvided || $ajax || count($handlers) || $idClick) { // Initialise le Javascript CopixHTMLHeader::addJSFramework(); CopixHTMLHeader::addJSLink(_resource('js/taglib/copixzone.js'), array('id' => 'taglib_copixzone_js')); $js = new CopixJSWidget(); // Options de la zone $options = array('zoneId' => $id); // Met en session AJAX les paramètres de la zone if ($ajax) { $options['instanceId'] = $instanceId = uniqid(); CopixAJAX::getSession()->set($instanceId, array($zone, $zoneParams)); } if ($auto) { $options['auto'] = true; } // Ajoute les handlers foreach ($handlers as $name => $code) { $options[$name] = $js->function_(null, "div,trigger", $code); } // Identifiant du trigger if ($idClick) { $options['triggerId'] = $idClick; } // Initialise la zone $js->Copix->registerZone($options); // Ajoute le code CopixHTMLHeader::addJSDOMReadyCode($js, "tag_copixzone_" . $id); } // Contenu de la zone if ($ajax) { $zoneContent = ''; $style = 'style="display:none;" '; } else { $zoneContent = CopixZone::process($zone, $zoneParams); $style = ''; } if ($idProvided || $style || $extra || $ajax || count($handlers) || $idClick) { $toReturn[] = '<div id="' . $id . '" ' . trim($style . $extra) . '>' . $zoneContent . '</div>'; } else { $toReturn[] = $zoneContent; } return join('', $toReturn); }
/** * Affichage du classeur en popup pour intégration dans les autres modules */ public function processGetClasseurPopup() { $classeurDAO = _ioDAO('classeur|classeur'); if (is_null($ppo->classeur = $classeurDAO->get(_request('classeurId', null)))) { return CopixActionGroup::process('generictools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.errorOccurred'), 'back' => CopixUrl::get(''))); } $ppo->dossierId = _request('dossierId', 0); $ppo->field = _request('field', null); $ppo->format = _request('format', null); $ppo->withPersonal = _request('withPersonal', true); $ppo->moduleType = _request('moduleType', null); $ppo->moduleId = _request('moduleId', null); $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeur->id); _classInclude('classeur|classeurService'); $dossierDAO = _ioDAO('classeur|classeurdossier'); $fichierDAO = _ioDAO('classeur|classeurfichier'); // Récupération des dossiers & des fichiers / favoris $ppo->dossiers = $dossierDAO->getEnfantsDirects($ppo->classeur->id, $ppo->dossierId)->fetchAll(); $ppo->fichiers = $fichierDAO->getParDossier($ppo->classeur->id, $ppo->dossierId)->fetchAll(); foreach ($ppo->fichiers as $fichier) { $fichier->fullUrl = $fichier->getLienMiniature(); $fichier->url = substr($fichier->getLienMiniature(), 0, strlen($fichier->getLienMiniature()) - strlen(strrchr($fichier->getLienMiniature(), '.'))); $fichier->extension = $fichier->getExtension(); } // Ouverture du dossier courant dans l'arborescence if ($ppo->dossierId != 0) { classeurService::openTree($ppo->classeur->id, $ppo->dossierId); $dossier = $dossierDAO->get($ppo->dossierId); if ($dossier->parent_id != 0) { $ppo->dossierParent = $dossierDAO->get($dossier->parent_id); } else { $ppo->classeurParent = $ppo->classeur; } } // Dossier temporaire pour l'upload des fichiers _classInclude('classeur|classeurService'); $dossierTmp = classeurService::getTmpFolder(); $ppo->dossierTmp = $dossierTmp . classeurService::createKey(); CopixHTMLHeader::addJSLink(_resource('js/iconito/module_classeur.js')); return _arPPO($ppo, array('template' => 'classeur_popup.tpl', 'mainTemplate' => 'main|main_popup.php')); }
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; }
/** * R�cup�re l'objet en session * Cr�� un objet vide et initialise la propri�t� id_agenda * @author Audrey Vassal <*****@*****.**> */ public function processGetEdit() { CopixHTMLHeader::addCSSLink(_resource("styles/module_agenda.css")); CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.ui.datepicker-fr.js")); $serviceAuth = new AgendaAuth(); $serviceAgenda = new AgendaService(); if (!($toEdit = $this->_getSessionEvent())) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.unableToGetEdited'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine'))); } //var_dump($toEdit); //r�cup�ration de la liste des agendas affich�s $listAgendasAffiches = $serviceAgenda->getAgendaAffiches(); //on v�rifie les droits des utilisateurs sur la liste des agendas affich�s 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->getWriteAgenda()) { $ableToWrite = true; } } if (!$ableToWrite) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('agenda.error.enableToWrite'), 'back' => CopixUrl::get('agenda|agenda|vueSemaine'))); } $obj = new AgendaService(); $listAgendas = $obj->getAvailableAgenda(); //r�cup�ration de la liste des agendas affich�s $serviceAgenda = new AgendaService(); //on r�cup�re en session la liste des agendas en cours de visualisation $arAgendasAffiches = $serviceAgenda->getAgendaAffiches(); $arTitleAgendasAffiches = $serviceAgenda->getArTitleAgendaByArIdAgenda($arAgendasAffiches); //template pour agenda $tplAgenda = new CopixTpl(); $tplAgenda->assign('MAIN_AGENDA', CopixZone::process('agenda|agendaeditevent', array('arTitleAgendasAffiches' => $arTitleAgendasAffiches, 'e' => $this->getRequest('e'), 'errors' => $this->getRequest('errors'), 'toEdit' => $toEdit))); //template principal $tpl = new CopixTpl(); $tpl->assign('BODY_ON_LOAD', "setDatePicker('#datedeb_event,#datefin_event,#dateendrepeat_event')"); $tpl->assign('TITLE_PAGE', CopixI18N::get('agenda|agenda.title.editEvent')); $menu = $serviceAgenda->getAgendaMenu('create'); $tpl->assign('MENU', $menu); $tpl->assign('MAIN', $tplAgenda->fetch('agenda|main.agenda.tpl')); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * 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); }
/** * Modification d'un membre d'un groupe * * @author Christophe Beyer <*****@*****.**> * @since 2007/01/09 * @param integer $id Id du groupe * @param string $user_type Type du membre * @param integer $user_id Id du membre * @param array $errors (option) Erreurs rencontr�es * @param integer $droit (option) Valeur du droit si formulaire d�j� soumis * @param string $droit (option) Valeur du d�but de validit� si formulaire d�j� soumis * @param string $fin (option) Valeur de fin de validit� si formulaire d�j� soumis */ public function processGetHomeAdminMember() { CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.ui.datepicker-fr.js")); $dao = CopixDAOFactory::create("groupe"); $kernel_service =& CopixClassesFactory::Create('kernel|kernel'); $groupeService =& CopixClassesFactory::Create('groupe|groupeService'); $id = $this->getRequest('id', null); $errors = $this->getRequest('errors', array()); $user_type = $this->getRequest('user_type', null); $user_id = $this->getRequest('user_id', null); $droit = $this->getRequest('droit', null); $debut = $this->getRequest('debut', null); $fin = $this->getRequest('fin', null); $critical_errors = array(); $groupe = $dao->getGroupe($id); if (!$groupe) { $critical_errors[] = CopixI18N::get('groupe|groupe.error.noGroup'); } else { $mondroit = $kernel_service->getLevel("CLUB", $id); if (!$groupeService->canMakeInGroupe('ADMIN', $mondroit)) { $critical_errors[] = CopixI18N::get('kernel|kernel.error.noRights'); } else { // On v�rifie que le membre demand� fait bien partie du groupe /* et qu'il n'est pas le propri�taire */ $dao = CopixDAOFactory::create("kernel|kernel_link_user2node"); $his = $dao->get($user_type, $user_id, "CLUB", $id); //print_r($his); //$level = Kernel::getLevel ('CLUB', $id, $user_type, $user_id); if ($his->droit <= PROFILE_CCV_SHOW) { $critical_errors[] = CopixI18N::get('kernel|kernel.error.noRights'); } } } if ($critical_errors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $critical_errors), 'back' => CopixUrl::get('groupe||'))); } else { CopixHTMLHeader::addCSSLink(_resource("styles/module_groupe_admin.css")); if ($errors) { $his->droit = $droit; $his->debut = $debut; $his->fin = $fin; } else { //$his->debut = ($his->debut) ? CopixI18N::timestampToDate($his->debut) : null; //$his->fin = ($his->fin) ? CopixI18N::timestampToDate($his->fin) : null; } $userInfo = $kernel_service->getUserInfo($user_type, $user_id); //print_r($userInfo); $tpl = new CopixTpl(); $tpl->assign('BODY_ON_LOAD', "setDatePicker('#debut,#fin')"); $tpl->assign('TITLE_PAGE', $groupe[0]->titre . ' - ' . $userInfo['prenom'] . ' ' . $userInfo['nom']); // $tpl->assign ('MENU', '<a href="'.CopixUrl::get ('groupe||getHome', array("id"=>$id)).'">'.CopixI18N::get ('groupe|groupe.backHome').'</a> :: <a href="'.CopixUrl::get ('groupe||getHomeAdminMembers', array("id"=>$id)).'">'.CopixI18N::get ('groupe|groupe.backHomeAdminMembers').'</a>'); $menu = array(); // $menu[] = array('url' => CopixUrl::get ('groupe||getHome', array("id"=>$id)), 'txt'=>CopixI18N::get ('groupe|groupe.backHome'), 'size'=>100); //$menu[] = array('url' => CopixUrl::get ('groupe||getHomeAdminMembers', array("id"=>$id)), 'txt'=>CopixI18N::get ('groupe|groupe.backHomeAdminMembers'), 'size'=>120); $tpl->assign('MENU', $menu); $tplHome = new CopixTpl(); $tplHome->assign('groupe', $groupe[0]); $tplHome->assign('errors', $errors); $tplHome->assign('user', $userInfo); $tplHome->assign('his', $his); $tplHome->assign('values', array(PROFILE_CCV_READ => $groupeService->getRightName(PROFILE_CCV_READ), PROFILE_CCV_MEMBER => $groupeService->getRightName(PROFILE_CCV_MEMBER), PROFILE_CCV_MODERATE => $groupeService->getRightName(PROFILE_CCV_MODERATE), PROFILE_CCV_ADMIN => $groupeService->getRightName(PROFILE_CCV_ADMIN))); $result = $tplHome->fetch('gethomeadminmember.tpl'); $tpl->assign('MAIN', $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); } }