/**
  * Déclare la fonction getHTTPObject () dans l'en tête HTML.
  * @param mixed $pParams aucun paramètre attendu ici.
  */
 public function process($pParams, $pContent = null)
 {
     $pluginList = null;
     // Charge les plugins demandés
     if (isset($pParams['plugins'])) {
         $pParams['plugin'] = $pParams['plugins'];
     }
     if (isset($pParams['plugin'])) {
         $pluginList = $pParams['plugin'];
         if (!is_array($pluginList)) {
             $pluginList = explode(';', $pluginList);
         }
     }
     CopixHTMLHeader::addJSFramework($pluginList);
 }
 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);
 }
 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>';
 }