public function _createContent(&$toReturn)
 {
     //Création du sous template.
     $tpl = new CopixTpl();
     CopixClassesFactory::fileInclude('cms|ServicesCMSPage');
     CopixContext::push('cms');
     $sHeadings = CopixClassesFactory::getInstanceOf('copixheadings|CopixHeadingsServices');
     $headings = $sHeadings->getTree();
     $cmsPages = new ServicesCMSPage();
     $pages = $cmsPages->getList();
     if (isset($this->_params['onlyLastVersion']) && $this->_params['onlyLastVersion'] == 1) {
         $pages = $this->_filterLastVersion($pages);
     }
     CopixContext::pop();
     //pagination
     foreach ($pages as $page) {
         $arPages[$page->id_head][] = $page;
     }
     $tpl->assign('arPublished', $arPages);
     $tpl->assign('arHeadings', $headings);
     $tpl->assign('select', $this->getParam('select'));
     $tpl->assign('back', $this->getParam('back'));
     $tpl->assign('popup', $this->getParam('popup'));
     $tpl->assign('height', Copixconfig::get('htmleditor|height'));
     $tpl->assign('width', Copixconfig::get('htmleditor|width'));
     //$tpl->assign ('editorType' , CopixConfig::get('htmleditor|type'));
     $tpl->assign('editorName', $this->getParam('editorName'));
     $toReturn = $tpl->fetch('page.select.ptpl');
     return true;
 }
 /**
  * Test des quelques fonctions de base
  */
 public function testNormalization()
 {
     //Test des éléments de module simple
     $this->assertEquals(CopixSelectorFactory::normalize('module:copixtest|classedetest'), 'module:copixtest|classedetest');
     $this->assertEquals(CopixSelectorFactory::normalize('copixtest|classedetest'), 'module:copixtest|classedetest');
     CopixContext::push('copixtest');
     $this->assertEquals(CopixSelectorFactory::normalize('classedetest'), 'module:copixtest|classedetest');
     $this->assertEquals(CopixSelectorFactory::normalize('module:classedetest'), 'module:copixtest|classedetest');
     CopixContext::pop();
     CopixContext::push('default');
     $this->assertEquals(CopixSelectorFactory::normalize('classedetest'), 'module:default|classedetest');
     $this->assertEquals(CopixSelectorFactory::normalize('module:classedetest'), 'module:default|classedetest');
     CopixContext::pop();
     //Test des éléments ActionGroup
     CopixContext::push('copixtest');
     $this->assertEquals(CopixSelectorFactory::normalize('module:copixtest|ActionGroup::methode'), 'module:copixtest|ActionGroup::methode');
     $this->assertEquals(CopixSelectorFactory::normalize('copixtest|ActionGroup::methode'), 'module:copixtest|ActionGroup::methode');
     $this->assertEquals(CopixSelectorFactory::normalize('ActionGroup::methode'), 'module:copixtest|ActionGroup::methode');
     CopixContext::pop();
     //Test des éléments de type "non modifiables" lors de la normalisation
     $this->assertEquals(CopixSelectorFactory::normalize('file:/mon/chemin/de/fichier'), 'file:/mon/chemin/de/fichier');
     $this->assertEquals(CopixSelectorFactory::normalize('var:/mon/chemin/de/fichier'), 'var:/mon/chemin/de/fichier');
     $this->assertEquals(CopixSelectorFactory::normalize('resource:/mon/chemin/de/fichier'), 'resource:/mon/chemin/de/fichier');
     $this->assertEquals(CopixSelectorFactory::normalize('copix:/mon/chemin/de/fichier'), 'copix:/mon/chemin/de/fichier');
 }
 /**
  * Encapsulation de l'appel des fonctions pour les transmettre directement à l'objet tout
  * en ayant au préalable indiqué les informations de contexte
  *
  * @param	string	$pName	nom de la fonction
  * @param	array	$pArgs	arguments passés à la fonction
  * @return mixed
  */
 public function __call($pName, $pArgs)
 {
     CopixContext::push($this->_context);
     $toReturn = parent::__call($pName, $pArgs);
     CopixContext::pop();
     return $toReturn;
 }
 function _createContent(&$toReturn)
 {
     //Création du sous template.
     $tpl =& new CopixTpl();
     //require_once (COPIX_MODULE_PATH.'cms/'.COPIX_CLASSES_DIR.'cmsworkflow.class.php');
     require_once COPIX_MODULE_PATH . 'cms/' . COPIX_CLASSES_DIR . 'cmspage.services.class.php';
     CopixContext::push('cms');
     $sHeadings =& CopixClassesFactory::instanceOf('copixheadings|CopixHeadingsServices');
     $headings = $sHeadings->getTree();
     $cmsPages =& new ServicesCMSPage();
     $pages = $cmsPages->getList();
     if (isset($this->params['onlyLastVersion']) && $this->params['onlyLastVersion'] == 1) {
         $pages = $this->_filterLastVersion($pages);
     }
     CopixContext::pop();
     //pagination
     foreach ($pages as $page) {
         $arPages[$page->id_head][] = $page;
     }
     $tpl->assign('arPublished', $arPages);
     $tpl->assign('arHeadings', $headings);
     $tpl->assign('select', $this->params['select']);
     $tpl->assign('back', $this->params['back']);
     $tpl->assign('popup', $this->params['popup']);
     $tpl->assign('height', Copixconfig::get('htmleditor|height'));
     $tpl->assign('width', Copixconfig::get('htmleditor|width'));
     $tpl->assign('editorType', CopixConfig::get('htmleditor|type'));
     $tpl->assign('editorName', $this->params['editorName']);
     $toReturn = $tpl->fetch('page.select.ptpl');
     return true;
 }
 /**
  * gets the parameters list
  */
 function _getParams($module)
 {
     $toReturn = array();
     CopixContext::push($module);
     foreach (CopixConfig::getParams($module) as $params) {
         $params['Caption'] = CopixI18N::get($params['Caption']);
         $toReturn[] = $params;
     }
     CopixContext::pop();
     return $toReturn;
 }
 public function tearDown()
 {
     $c = trim(ob_get_contents());
     ob_end_clean();
     /*
     if($c) {
         $n = $this->getName();
         printf('<div style="background-color: white"><a name="%s" href="#%s"><h3>%s</h3></a><pre>%s</pre></div>', $n, $n, $n, $c);
     }
     */
     CopixContext::pop();
 }
 function CopixModuleFileSelector($selector)
 {
     $this->type = 'module';
     $match = null;
     if (preg_match("/^(([_0-9a-zA-Z-]*)\\|)?(.*)\$/", $selector, $match)) {
         if ($match[1] != '') {
             $this->module = $match[2];
         }
         $this->fileName = $match[3];
         //le nom correspond à tout ce qui suit l'éventuel séparateur
         if ($this->module === null) {
             $this->module = CopixContext::get();
         }
         $this->isValid = true;
     }
 }
 /**
  * extrait le nom du module de la chaine, utilise le contexte pour retourner
  *   un résultat.
  * @param    string  $from   le nom formaté du fichier
  * @return   string  le nom du module, null si projet
  */
 function getModuleUsingContext($from)
 {
     //vérifie que le nom soit sur.
     if (!CopixNamingConvention::isSafe($from)) {
         trigger_error('Invalid ' . $from . '', E_USER_ERROR);
     }
     //récupération des deux éléments.
     $into = explode('|', $from);
     //Si un élément module est demandé, retour.
     if (count($into) > 1) {
         return $into[0] !== '' ? $into[0] : null;
     } else {
         //Pas d'élément trouvé, retourne le contexte courant.
         return CopixContext::get();
     }
 }
 /**
  * Zone that passes all its parameters to the given template
  * @param: * abstract
  * @param: template string the template name where the datas will be assigned to.
  */
 function _createContent(&$toReturn)
 {
     //we wants to go back to the current context.
     $context = CopixContext::pop();
     $tpl =& new CopixTpl();
     //assign the template variables
     foreach ($this->params as $var => $value) {
         if ($var !== 'template') {
             $tpl->assign($var, $value);
         }
     }
     $toReturn = $tpl->fetch($this->params['template']);
     //then we wants to bring back the context we poped
     CopixContext::push($context);
     return true;
 }
 /**
  * Analyse et découpe une sélecteur de ressource.
  *
  * Accepte les deux formes suivantes :
  * - chemin/vers/ressource.txt
  * - module|chemin/vers/ressource.txt
  *
  * Le '/' initial du chemin est supprimé.
  *
  * @param unknown_type $pResourcePath Sélecteur de la ressource.
  * @return array Tableau de la forme (chemin, nom_du_module ou null, chemin_du_module ou null)
  */
 private static function _parseResourcePath($pResourcePath)
 {
     if (!preg_match('@^((\\w+)?\\|)?/?(.+)$@', $pResourcePath, $parts)) {
         throw new CopixException(_i18n("copix:copix.error.resource.invalidResource", $pResourcePath));
     }
     list(, $modulePrefix, $moduleName, $resourcePath) = $parts;
     if (!empty($modulePrefix) && empty($moduleName)) {
         $moduleName = CopixContext::get();
     }
     return array($resourcePath, $moduleName, empty($moduleName) ? null : CopixModule::getPath($moduleName));
 }
 /**
  * Méthode qui efface le cache de la zone
  * @param array  $Params les paramètres de contexte pour la zone.
  * @return   boolean  si tout s'est bien passé
  * @access public
  */
 function clearZone($params = array())
 {
     $this->params = $params;
     //if (count ($this->_cacheParams) > 0){
     if ($this->_useCache) {
         $module = CopixContext::get();
         if ($module .= '') {
             $module .= '_';
         }
         $cache =& new CopixCache($this->_makeId(), 'zones|' . $module . get_class($this));
         $cache->remove();
     }
     return true;
 }
 /**
  * Execution d'une action
  *
  * @param string $pPath Identifier 'module|AG::method'
  * @param array $pVars Paramètres
  * @param bool $pFromDesc Indique si l'on viens d'un fichier de description (à raison de compatibilité)
  * @return CopixActionReturn
  * @todo Supprimer $pFromDesc dans les prochaines versions de copix
  * @throws Exception
  */
 public static function process($pPath, $pVars = array(), $pFromDesc = false)
 {
     $extractedPath = CopixActionGroup::_extractPath($pPath);
     if ($extractedPath === null) {
         throw new Exception(_i18n('copix:copix.error.load.actiongroup', $pPath));
     }
     $actiongroup = CopixActionGroup::instance($extractedPath);
     $methName = $pFromDesc === false ? 'process' . $extractedPath->method : $extractedPath->method;
     if (!method_exists($actiongroup, $methName)) {
         $methName = 'otherAction';
     }
     // on défini le module
     CopixContext::push($extractedPath->module);
     foreach ($pVars as $varName => $varValue) {
         CopixRequest::set($varName, $varValue);
     }
     // on essaye d'exécuter l'action
     try {
         if (($result = $actiongroup->_beforeAction($extractedPath->method)) === null) {
             if ($methName == 'otherAction') {
                 $toReturn = $actiongroup->{$methName}($extractedPath);
             } else {
                 $toReturn = $actiongroup->{$methName}();
             }
         } else {
             $extractedPath->method = '_beforeAction';
             $toReturn = $result;
         }
         if (($result = $actiongroup->_afterAction($extractedPath->method, $toReturn)) !== null) {
             $toReturn = $result;
         }
         // si on n'a pas fait de return valide
         if (!$toReturn instanceof CopixActionReturn) {
             throw new CopixException(_i18n('copix:copix.error.invalidActionReturn', array(gettype($toReturn))));
         }
     } catch (Exception $e) {
         try {
             $toReturn = $actiongroup->_catchActionExceptions($e, $extractedPath->method);
         } catch (Exception $e) {
             // on est obligé de relancer un try/catch pour pouvoir faire un pop du contexte
             CopixContext::pop();
             throw $e;
         }
     }
     CopixContext::pop();
     return $toReturn;
 }
 /**
  * gets the module info
  * @return object module informations
  */
 function getInformations($moduleName)
 {
     if (!CopixModule::isValid($moduleName)) {
         return null;
     }
     $toReturn = null;
     require_once COPIX_UTILS_PATH . 'CopixSimpleXml.class.php';
     $xmlParser =& new CopixSimpleXML();
     $fileName = COPIX_MODULE_PATH . $moduleName . '/module.xml';
     if (!($parsedFile = $xmlParser->parseFile($fileName))) {
         $xmlParser->raiseError();
     }
     if (isset($parsedFile->GENERAL)) {
         $defaultAttr = $parsedFile->GENERAL->DEFAULT->__attributes;
         $toReturn->name = $defaultAttr['NAME'];
         CopixContext::push($toReturn->name);
         $toReturn->description = CopixI18N::get($defaultAttr['DESCRIPTIONI18N']);
         $toReturn->longDescription = isset($defaultAttr['LONGDESCRIPTIONI18N']) ? CopixI18N::get($defaultAttr['LONGDESCRIPTIONI18N']) : '';
         CopixContext::pop();
         $toReturn->dependencies = array();
         if (isset($parsedFile->DEPENDENCIES)) {
             if (is_array($parsedFile->DEPENDENCIES->DEPENDENCY)) {
                 foreach ($parsedFile->DEPENDENCIES->DEPENDENCY as $dependency) {
                     $attributes = $dependency->attributes();
                     $toReturn->dependencies[] = $attributes['NAME'];
                 }
             } else {
                 $attributes = $parsedFile->DEPENDENCIES->DEPENDENCY->__attributes;
                 $toReturn->dependencies[] = $attributes['NAME'];
             }
         }
     }
     return $toReturn;
 }
 /**
  * Creation d'un objet zone et appel de sa méthode process.
  * @param string $name le nom de la zone a instancier.
  * @param array   $params un tableau a passer a la fonction processZone de l'objet zone.
  */
 function processZone($name, $params = array())
 {
     //Récupération des éléments critiques.
     $fileInfo =& new CopixModuleFileSelector($name);
     CopixContext::push($fileInfo->module);
     //Récupère le nom du fichier en fonction du module courant.
     $fileName = $fileInfo->getPath(COPIX_ZONES_DIR) . strtolower($fileInfo->fileName) . COPIX_ZONE_EXT;
     if (!is_readable($fileName)) {
         trigger_error(CopixI18N::get('copix:copix.error.load.zone', $fileInfo->fileName), E_USER_ERROR);
     }
     //inclusion du fichier.
     require_once $fileName;
     $objName = COPIX_ZONE_CLASSNAME . $fileInfo->fileName;
     $objTraitement =& new $objName();
     $toReturn = $objTraitement->processZone($params);
     CopixContext::pop();
     return $toReturn;
 }
 function CopixModuleFileSelector($selector)
 {
     $this->type = 'module';
     //ok, I don't use regexp here cause it's 0,40 ms slower :-)
     $tab = explode('|', $selector);
     if (($counted = count($tab)) > 1) {
         $this->module = $tab[0] == '' ? null : $tab[0];
         $this->fileName = $tab[1];
         $this->isValid = true;
     } else {
         if ($counted == 1) {
             $this->module = CopixContext::get();
             $this->fileName = $tab[0];
             $this->isValid = true;
         } else {
             $this->isValid = false;
         }
     }
     //we wants to check if the module name is valid, in case we got a non project demand.
     if ($this->isValid && $this->module !== null) {
         $this->isValid = CopixModule::isValid($this->module);
     }
 }
 public function tearDown()
 {
     CopixContext::pop();
 }
 /**
  * Réinitialise le contexte.
  *
  * Il existe très peu de cas ou vous devrez vous même appeler cette méthode.
  * Cette méthode existe principalement pour permettre à CopixController de manipuler
  * la pile de contexte complète
  */
 public static function clear()
 {
     CopixContext::$_contextStack = array();
 }
 /**
  * réinitialise le contexte.
  */
 function clear()
 {
     $stack =& CopixContext::instance();
     $stack->_contextStack = array();
 }
 /**
  * Constructeur
  * @param string $selector le sélecteur Copix "module|element"
  */
 public function __construct($selector)
 {
     $this->type = 'module';
     //ok, I don't use regexp here cause it's 0,40 ms slower :-)
     $tab = explode('|', $selector);
     if (($counted = count($tab)) > 1) {
         $this->module = $tab[0] == '' ? "default" : $tab[0];
         $this->fileName = $tab[1];
     } else {
         if ($counted == 1) {
             $this->module = CopixContext::get();
             $this->fileName = $tab[0];
         } else {
             throw new Exception(_i18n('copix:copix.error.fileselector.invalidSelector', $selector));
         }
     }
     $this->module = strtolower($this->module);
 }
 public function tearDown()
 {
     CopixConfig::Instance()->i18n_path_enabled = $this->saveConfigi18n;
     CopixContext::pop();
 }
 /**
  * Retourne un objet contenant des infos sur la paramètre (propriétés : name, id
  *
  * @param string $pId Nom du paramètre, sous la forme [module|]name
  * @return object
  */
 private static function _getParamInfos($pId)
 {
     if (($pos = strpos($pId, '|')) === false) {
         $module = CopixContext::get() . '|';
         $pId = $module . $pId;
     } else {
         $module = substr($pId, 0, $pos) . '|';
     }
     if ($module == '|') {
         $module = 'default|';
         $pId = 'default' . $pId;
     }
     $toReturn = new StdClass();
     $toReturn->module = $module;
     $toReturn->id = $pId;
     return $toReturn;
 }
 /**
  * @param CopixUrl    $urlorigin    url à transformer
  */
 function transformUrl($urlorigin)
 {
     $url = $urlorigin;
     // Attention, il faut une copie ici, pas une référence ! (PHP5 -> clone !)
     /*
     a) recupere module|desc|action -> obtient les infos pour la creation de l'url
     b) récupère un à un les parametres indiqués dans params à partir de CopixUrl
     c) remplace la valeur récupérée dans le result et supprime le paramètre de l'url
     d) remplace scriptname de CopixUrl par le resultat
     */
     $module = $url->get('module');
     if ($module === null) {
         $module = CopixContext::get();
     }
     $desc = $url->get('desc');
     if ($desc === null) {
         $desc = COPIX_DEFAULT_VALUE_DESC;
     }
     $action = $url->get('action');
     if ($action === null) {
         $action = COPIX_DEFAULT_VALUE_ACTION;
     }
     $id = $module . '|' . $desc . '|' . $action;
     //if ($module !== null && isset ($this->scriptnameList[$module])){
     //    $url->scriptName = $this->scriptnameList[$module];
     //}
     /*$_compile_createUrl = array('test1|default|default'=>
       array('test',true, array('annee','mois','id'), '/%1/%2/%3',''));
       */
     if (isset($this->dataCreateUrl[$id])) {
         $urlinfo =& $this->dataCreateUrl[$id];
         if ($urlinfo[1]) {
             $dturl =& $urlinfo[2];
             $result = $urlinfo[3];
             foreach ($dturl as $k => $param) {
                 $result = str_replace('%' . ($k + 1), $url->get($param), $result);
                 $url->del($param);
             }
             $url->pathInfo = $result;
         } else {
             $class = $urlinfo[2];
             $method = $urlinfo[3];
             $file = CopixCoordination::extractFilePath($module . '|' . $class, 'classes', '.url.php');
             if ($file) {
                 include_once $file;
                 $obj = new $class();
                 $url = $obj->{$method}($url);
             } else {
             }
         }
         // rajouter le suffixe
         if ($urlinfo[0] != '') {
             $url->pathInfo .= '.' . $urlinfo[0];
         }
         // indiquer l'entrypoint
         if ($urlinfo[4] != '') {
             $url->scriptName = $urlinfo[4];
         }
     }
     $url->del('module');
     $url->del('desc');
     $url->del('action');
     // vraiment supprimer ?
     return $url;
 }
 /**
  * Pop le contexte (alias à CopixContext::pop au sein de la classe)
  * @return string
  */
 private function _popContext()
 {
     CopixContext::pop();
 }
 /**
  * gets the bundle for a given language.
  * @param string $bundleKey la clef du bundle
  * @param string $lang la langue dans laquelle on veut récupérer le bundle
  * @return CopixI18NBundle
  */
 public static function getBundle($pBundleKey, $pLang)
 {
     $context = CopixContext::get();
     if (isset(self::$_bundles[$context][$pBundleKey][$pLang])) {
         return self::$_bundles[$context][$pBundleKey][$pLang];
     }
     $fileSelector = CopixSelectorFactory::create($pBundleKey);
     $s = $fileSelector->getSelector();
     if (!isset(self::$_bundles[$context][$s][$pLang])) {
         self::$_bundles[$context][$s][$pLang] = new CopixI18NBundle($fileSelector, $pLang);
         self::$_bundles[$context][$pBundleKey][$pLang] = self::$_bundles[$context][$s][$pLang];
     }
     return self::$_bundles[$context][$s][$pLang];
 }
 public function setUp()
 {
     CopixContext::push('copixtest');
 }
 /**
  * sets the value of a parameter
  */
 function set($id, $value)
 {
     if (($pos = strpos($id, '|')) === false) {
         $id = CopixContext::get() . '|' . $id;
         $group = CopixContext::get() . '|';
     } else {
         $group = substr($id, 0, $pos) . '|';
     }
     $me =& CopixConfig::instance();
     $group =& $me->_getGroupConfig($group);
     return $group->set($id, $value);
 }
 /**
  * Launch an actiongroup method
  * @param string $path identifier 'module|AG::method'
  * @param array $vars parameters
  */
 function &process($path, $vars = array())
 {
     static $instance = array();
     $toReturn = null;
     $extractedPath = CopixActionGroup::extractPath($path);
     if ($extractedPath === null) {
         trigger_error(CopixI18N::get('copix:copix.error.load.actiongroup', $path), E_USER_ERROR);
         return $toReturn;
     }
     $actionGroupID = $extractedPath->module . '|' . $extractedPath->actiongroup;
     if (!isset($instance[$actionGroupID])) {
         if ($extractedPath->module === null) {
             $execPath = COPIX_PROJECT_PATH;
         } else {
             $execPath = COPIX_MODULE_PATH . $extractedPath->module . '/';
         }
         $fileName = $execPath . COPIX_ACTIONGROUP_DIR . strtolower(strtolower($extractedPath->actiongroup)) . '.actiongroup.php';
         if (is_readable($fileName)) {
             require_once $fileName;
         } else {
             trigger_error(CopixI18N::get('copix:copix.error.load.actiongroup', $path . '-' . $fileName), E_USER_ERROR);
             return $toReturn;
         }
         //Nom des objets/méthodes à utiliser.
         $objName = 'ActionGroup' . $extractedPath->actiongroup;
         //instance de l'objet, qui s'enregistre dans GLOBALS['COPIX']['ACTIONGROUP']
         $instance[$actionGroupID] =& new $objName();
     }
     $methName = $extractedPath->method;
     CopixContext::push($extractedPath->module);
     $instance[$actionGroupID]->vars =& $vars;
     $toReturn = $instance[$actionGroupID]->{$methName}();
     CopixContext::pop();
     return $toReturn;
 }
 /**
  * Demande le chargement de Mootools.
  *
  * @param array $pPlugins Liste de plugins à charger.
  */
 public static function addJSFramework($pPlugins = null)
 {
     // Charge le noyau
     if (!isset(self::$_JSFrameworkAdded['*core*'])) {
         self::$_JSFrameworkAdded['*core*'] = true;
         // Initialise Mootools et l'identifiant de session
         if (!CopixAJAX::isAJAXRequest()) {
             // Ajoute MooTools et FirebugLite
             if (CopixConfig::instance()->getMode() == CopixConfig::DEVEL) {
                 // MooTools non compressé et FirebugLite normal
                 self::addJSLink(_resource('js/firebuglite/firebug.js'), array('id' => 'firebug_js'));
                 self::addJSLink(_resource('js/mootools/mootools-devel.js'), array('id' => 'mootools_core_js'));
             } else {
                 // MooTools compressé et FirebugLite qui ne fait rien.
                 self::addJSLink(_resource('js/firebuglite/firebugx.js'), array('id' => 'firebug_js'));
                 self::addJSLink(_resource('js/mootools/mootools.js'), array('id' => 'mootools_core_js'));
             }
             // Ajoute le framework JS spécifique de Copix
             self::addJSLink(_resource('js/copix.js'), array('id' => 'copix_js', 'charset' => 'UTF-8'));
             // Ajoute le code d'initialisation
             $urlBase = CopixUrl::get();
             self::addJSCode(sprintf('Copix = new CopixClass(%s);', CopixJSON::encode(array('ajaxSessionId' => CopixAJAX::getSessionId(), 'module' => CopixContext::get(), 'urlBase' => $urlBase, 'resourceUrlBase' => CopixResource::getResourceBaseUrl($urlBase, CopixTpl::getTheme(), CopixI18N::getLang(), CopixI18N::getCountry())))), 'copixajax_init', CopixHTMLHeader::DOMREADY_ALWAYS);
         }
     }
     // Charge les plugins
     if (is_array($pPlugins)) {
         foreach ($pPlugins as $pluginName) {
             if (!isset(self::$_JSFrameworkAdded[$pluginName])) {
                 self::$_JSFrameworkAdded[$pluginName] = true;
                 $pluginId = 'mootools_plugin_' . $pluginName;
                 $scriptId = $pluginId . '_js';
                 $stylesheetId = $pluginId . '_css';
                 if (file_exists(CopixUrl::getResourcePath($path = 'js/mootools/plugins/' . $pluginName . '.js'))) {
                     self::addJSLink(_resource($path), array("id" => $scriptId));
                 } elseif (file_exists(CopixUrl::getResourcePath($path = 'js/mootools/plugins/' . $pluginName . '.js.php'))) {
                     self::addJSLink(_resource($path), array("id" => $scriptId));
                 } else {
                     throw new CopixException('[Mootools] Plugin ' . $pluginName . ' not found in ' . $pluginPath);
                 }
                 if (file_exists(CopixUrl::getResourcePath($path = 'js/mootools/css/' . $pluginName . '.css'))) {
                     self::addCssLink(_resource($path), array("id" => $stylesheetId));
                 }
             }
         }
     }
 }
 /**
  * Renvoi des infos sur un paramètre
  *
  * @param string $pParam Nom du paramètre
  * @return array
  */
 private function _getParam($pParam)
 {
     // ce module n'a pas de paramètres sauvegardés
     if (!isset($this->_xmlParameters[$this->module]) || count($this->_xmlParameters[$this->module]) == 0) {
         return null;
     }
     $module = $this->module === "|" ? "default" : substr($this->module, 0, -1);
     CopixContext::push($module);
     // boucle sur tous les paramètres
     foreach ($this->_xmlParameters[$this->module] as $groupKey => $groupChild) {
         foreach ($groupChild as $key => $child) {
             $attributes = $child->attributes();
             // si c'est le paramètre $pParam
             if (isset($attributes['name']) && $attributes['name'] == $pParam) {
                 $type = isset($attributes['type']) && in_array($attributes['type'], $this->_allowedTypes) ? (string) $attributes['type'] : 'text';
                 $default = (string) $attributes['default'];
                 // récupération de la valeur par défaut "à afficher"
                 if ($type == 'select' || $type == 'multiSelect') {
                     $values = $this->_strToArray((string) $attributes['listValues']);
                     $defaultStr = isset($values[$default]) ? trim($values[$default]) : $default;
                 } elseif ($type == 'bool') {
                     //echo '[$groupKey] [' . $groupKey . '] [$attributes] [' . $attributes['name'] . '] [$type] [' . $type . ']<br />';
                     $defaultStr = $default == 0 ? _i18n('copix:copix.no') : _i18n('copix:copix.yes');
                 } else {
                     $defaultStr = (string) $attributes['default'];
                 }
                 $toReturn = array('Name' => (string) $attributes['name'], 'Caption' => isset($attributes['captioni18n']) ? _i18n((string) $attributes['captioni18n']) : utf8_decode((string) $attributes['caption']), 'Default' => utf8_decode($default), 'DefaultStr' => $defaultStr, 'Value' => $default, 'ValueStr' => $defaultStr, 'Type' => $type, 'MinValue' => isset($attributes['minValue']) ? (string) $attributes['minValue'] : null, 'MaxValue' => isset($attributes['maxValue']) ? (string) $attributes['maxValue'] : null, 'MaxLength' => isset($attributes['maxLength']) ? (string) $attributes['maxLength'] : null, 'ListValues' => isset($attributes['listValues']) ? (string) $attributes['listValues'] : null, 'Group' => $groupKey);
                 CopixContext::pop();
                 return $toReturn;
             }
         }
     }
     CopixContext::pop();
     return null;
 }
 /**
  * Gets the module info
  *
  * @return object module informations
  */
 public static function getInformations($moduleName)
 {
     if (!self::isValid($moduleName)) {
         throw new CopixException('Nom de module ' . $moduleName . ' invalide');
     }
     $toReturn = new CopixModuleDescription();
     $parsedFile = simplexml_load_file(self::getPath($moduleName) . 'module.xml');
     if (isset($parsedFile->general)) {
         $defaultAttr = $parsedFile->general->default->attributes();
         $toReturn->name = _copix_utf8_decode((string) $defaultAttr['name']);
         //Récupération de la version des sources
         $toReturn->version = 0;
         if (isset($defaultAttr['version'])) {
             $toReturn->version = _copix_utf8_decode((string) $defaultAttr['version']);
         }
         CopixContext::push($toReturn->name);
         $toReturn->description = isset($defaultAttr['descriptioni18n']) ? _i18n((string) $defaultAttr['descriptioni18n']) : _copix_utf8_decode((string) $defaultAttr['description']);
         $toReturn->longDescription = isset($defaultAttr['longdescriptioni18n']) ? _i18n((string) $defaultAttr['longdescriptioni18n']) : (isset($defaultAttr['longdescription']) ? _copix_utf8_decode((string) $defaultAttr['longdescription']) : $toReturn->description);
         $toReturn->path = self::getBasePath($moduleName);
         if (isset($defaultAttr['icon']) && file_exists(_resourcePath('img/icons/' . (string) $defaultAttr['icon']))) {
             $toReturn->icon = _resource('img/icons/' . (string) $defaultAttr['icon']);
         } else {
             $toReturn->icon = null;
         }
         // informations sur le groupe du module (node group)
         if (isset($parsedFile->general->group)) {
             $attributes = $parsedFile->general->group->attributes();
             // pas d'id renseigné
             if (!isset($attributes['id'])) {
                 throw new CopixException(_i18n('copix:copixmodule.error.moduleGroupIdEmpty'));
             }
             $toReturn->group->id = isset($attributes['id']) ? (string) $attributes['id'] : null;
             if (isset($attributes['caption'])) {
                 $toReturn->group->caption = (string) $attributes['caption'];
             } elseif (isset($attributes['captioni18n'])) {
                 $toReturn->group->caption = _i18n((string) $attributes['captioni18n']);
             } else {
                 $toReturn->group->caption = $toReturn->group_id;
             }
             // pas d'information de groupe
         } else {
             $toReturn->group->id = null;
             $toReturn->group->caption = null;
         }
         // dépendances
         $toReturn->dependencies = array();
         $toReturn->XMLDependencies = isset($parsedFile->dependencies) ? $parsedFile->dependencies : null;
         if (isset($parsedFile->dependencies)) {
             foreach ($parsedFile->dependencies->dependency as $dependency) {
                 $attributes = $dependency->attributes();
                 $currentDependency = new stdClass();
                 $currentDependency->name = _copix_utf8_decode((string) $attributes['name']);
                 $currentDependency->kind = _copix_utf8_decode((string) $attributes['kind']);
                 $toReturn->dependencies[] = $currentDependency;
             }
         }
         // liens dans la partie admin
         $toReturn->admin_links = array();
         if (isset($parsedFile->admin)) {
             $adminAttributes = $parsedFile->admin->attributes();
             $toReturn->admin_links_group->id = isset($adminAttributes['groupid']) ? (string) $adminAttributes['groupid'] : null;
             $toReturn->admin_links_group->caption = null;
             if (isset($adminAttributes['groupcaption'])) {
                 $toReturn->admin_links_group->caption = (string) $adminAttributes['groupcaption'];
             } elseif (isset($adminAttributes['groupcaptioni18n'])) {
                 $toReturn->admin_links_group->caption = _i18n((string) $adminAttributes['groupcaptioni18n']);
             }
             $toReturn->admin_links_group->icon = isset($adminAttributes['groupicon']) ? _resource('img/icons/' . (string) $adminAttributes['groupicon']) : null;
             foreach ($parsedFile->admin->link as $link) {
                 $attributes = $link->attributes();
                 $linkInformations = array();
                 if (isset($attributes['captioni18n'])) {
                     $linkInformations['caption'] = _i18n((string) $attributes['captioni18n']);
                 } else {
                     $linkInformations['caption'] = isset($attributes['caption']) ? _copix_utf8_decode((string) $attributes['caption']) : $toReturn->name;
                 }
                 $linkInformations['url'] = _url((string) $attributes['url']);
                 $linkInformations['credentials'] = isset($attributes['credentials']) ? (string) $attributes['credentials'] : null;
                 $toReturn->admin_links[] = $linkInformations;
             }
         }
         //Récupération des droits
         $toReturn->credential = array();
         $toReturn->credential_notspecific = array();
         if (isset($parsedFile->credentials)) {
             foreach ($parsedFile->credentials->credential as $credential) {
                 if (isset($credential['specific']) && (string) $credential['specific'] == "false") {
                     $toReturn->credential_notspecific[(string) $credential['name']] = array();
                     $currentCredential =& $toReturn->credential_notspecific[(string) $credential['name']];
                 } else {
                     $toReturn->credential[(string) $credential['name']] = array();
                     $currentCredential =& $toReturn->credential[(string) $credential['name']];
                 }
                 foreach ($credential->value as $value) {
                     $currentValue = new StdClass();
                     $currentValue->name = (string) $value['name'];
                     $currentValue->level = isset($value['level']) ? (string) $value['level'] : null;
                     $currentCredential[] = $currentValue;
                 }
             }
         }
         //Récupération de la list des scripts d'update
         $toReturn->update = array();
         if (isset($parsedFile->updates)) {
             foreach ($parsedFile->updates->update as $update) {
                 $currentUpdate = new stdClass();
                 $attributes = $update->attributes();
                 $currentUpdate->script = isset($attributes['script']) ? (string) $attributes['script'] : null;
                 $currentUpdate->from = isset($attributes['from']) ? (string) $attributes['from'] : null;
                 $currentUpdate->to = isset($attributes['to']) ? (string) $attributes['to'] : null;
                 $toReturn->update[] = $currentUpdate;
             }
         }
         CopixContext::pop();
     } else {
         throw new Exception('Impossible de lire le fichier ' . self::getPath($moduleName) . 'module.xml');
     }
     return $toReturn;
 }