| 17 | | public function process ($pParams, $pContent = null) { |
|---|
| 18 | | if (is_null ($pContent) && !isset($pParams['zone'])) { |
|---|
| 19 | | return; |
|---|
| 20 | | } |
|---|
| 21 | | |
|---|
| 22 | | _tag ('mootools', array('plugin'=>array('overlayfix'))); |
|---|
| 23 | | |
|---|
| 24 | | $alt = $this->getParam ('alt',''); |
|---|
| 25 | | $text = $this->getParam ('text', ''); |
|---|
| 26 | | $displayimg = $this->getParam ('displayimg', true); |
|---|
| 27 | | $img = $this->getParam ('img', _resource ('img/tools/information.png')); |
|---|
| 28 | | $divclass = $this->getParam ('divclass', 'popupInformation'); |
|---|
| 29 | | $handler = $this->getParam ('handler', 'onmouseover'); |
|---|
| 30 | | $namespace = $this->getParam ('namespace', 'default'); |
|---|
| 31 | | $wHandle = $this->getParam ('handlerWindow'); |
|---|
| 32 | | $wHandle = ($wHandle != null) ? ( 'handle="'.$wHandle.'" ') : ''; |
|---|
| 33 | | $title = $this->getParam ('popuptitle'); |
|---|
| 34 | | |
|---|
| 35 | | $id = uniqid ('popupInformation'); |
|---|
| 36 | | |
|---|
| 37 | | switch ($handler) { |
|---|
| 38 | | case 'window': |
|---|
| 39 | | $toReturn = '<a rel="'.$id.'" '.$wHandle.' id="div'.$id.'" class="divwindowpopup" href="javascript:void(null);"'; |
|---|
| 40 | | if (isset($pParams['title'])) { |
|---|
| 41 | | $toReturn .= ' title="'.$pParams['title'].'"'; |
|---|
| 42 | | } |
|---|
| 43 | | $toReturn .= '>'; |
|---|
| 44 | | $close = '</a>'; |
|---|
| 45 | | CopixHTMLHeader::addJsLink (_resource ('js/taglib/popupinfo_window.js')); |
|---|
| 46 | | $js = new CopixJSWidget (); |
|---|
| 47 | | CopixHTMLHeader::addJSDOMReadyCode ($js->popupinfo_window (), 'popupinfo_window'); |
|---|
| 48 | | break; |
|---|
| 49 | | case 'clickdelay': |
|---|
| 50 | | $toReturn = '<a rel="'.$id.'" id="div'.$id.'" class="divclickdelaypopup" href="javascript:void(null);">'; |
|---|
| 51 | | $close = '</a>'; |
|---|
| 52 | | CopixHTMLHeader::addJsLink (_resource ('js/taglib/popupinfo_clickdelay.js')); |
|---|
| 53 | | CopixHTMLHeader::addJSDOMReadyCode ('popupinfo_clickdelay ();', 'popupinfo_clickdelay'); |
|---|
| 54 | | break; |
|---|
| 55 | | case 'onclick': |
|---|
| 56 | | $toReturn = '<a rel="'.$id.'" id="div'.$id.'" class="divclickpopup" href="javascript:void(null);">'; |
|---|
| 57 | | $close = '</a>'; |
|---|
| 58 | | CopixHTMLHeader::addJsLink (_resource ('js/taglib/popupinfo_click.js')); |
|---|
| 59 | | CopixHTMLHeader::addJSDOMReadyCode ('popupinfo_click ();', 'popupinfo_click'); |
|---|
| 60 | | |
|---|
| 61 | | break; |
|---|
| 62 | | default: |
|---|
| 63 | | //prend également en charge onmouseover qui est le handler par défaut. |
|---|
| 64 | | $toReturn = '<div rel="'.$id.'" id="div'.$id.'" class="divpopup" style="display:inline;">'; |
|---|
| 65 | | $close = '</div>'; |
|---|
| 66 | | CopixHTMLHeader::addJsLink (_resource ('js/taglib/popupinfo.js')); |
|---|
| 67 | | CopixHTMLHeader::addJSDOMReadyCode ('popupinfo ();', 'popupinfo'); |
|---|
| 68 | | break; |
|---|
| 69 | | } |
|---|
| 70 | | $toReturn .= $displayimg === true ? '<img src="'.$img.'" title="'.$alt.'" alt="'.$alt.'" />' : ''; |
|---|
| 71 | | $toReturn .= strlen ($text) ? $text : ''; |
|---|
| 72 | | $toReturn .= isset($pParams['imgnext']) ? '<img src="'.$pParams['imgnext'].'" />' : ''; |
|---|
| 73 | | $toReturn .= $close; |
|---|
| 74 | | $toReturn .= '<div class="'.$divclass.'" id="'.$id.'" style="display:none;" rel='.$namespace.' >'; |
|---|
| 75 | | |
|---|
| 76 | | if ($title !== null) { |
|---|
| 77 | | $toReturn .= '<div class="' . $divclass . 'Title">' . $title . '</div>'; |
|---|
| | 18 | /** |
|---|
| | 19 | * Retourne le contenu HTML |
|---|
| | 20 | * |
|---|
| | 21 | * @param array $pParams Paramètres |
|---|
| | 22 | * @param string $pContent Contenu à écrire |
|---|
| | 23 | * @return string |
|---|
| | 24 | */ |
|---|
| | 25 | public function process ($pParams, $pContent = null) { |
|---|
| | 26 | if (is_null ($pContent) && !isset ($pParams['zone'])) { |
|---|
| | 27 | return; |
|---|
| 79 | | |
|---|
| 80 | | if (isset($pParams['zone'])) { |
|---|
| 81 | | $zone = $pParams['zone']; |
|---|
| 82 | | unset($pParams['zone']); |
|---|
| 83 | | $toReturn .= _tag('copixzone', array_merge($this->getExtraParams(),array('onComplete'=>'$(\'div'.$id.'\').fireEvent(\'sync\');','process'=>$zone,'ajax'=>true, 'id'=>'zone_'.$id))); |
|---|
| 84 | | } else { |
|---|
| 85 | | $toReturn .= $pContent; |
|---|
| 86 | | } |
|---|
| 87 | | $toReturn .= '</div>'; |
|---|
| 88 | | return $toReturn; |
|---|
| 89 | | } |
|---|
| | 29 | |
|---|
| | 30 | _tag ('mootools', array ('plugin'=>array ('overlayfix'))); |
|---|
| | 31 | |
|---|
| | 32 | $alt = $this->getParam ('alt',''); |
|---|
| | 33 | $text = $this->getParam ('text', ''); |
|---|
| | 34 | $displayimg = $this->getParam ('displayimg', true); |
|---|
| | 35 | $img = $this->getParam ('img', _resource ('img/tools/information.png')); |
|---|
| | 36 | $divclass = $this->getParam ('divclass', 'popupInformation'); |
|---|
| | 37 | $handler = $this->getParam ('handler', 'onmouseover'); |
|---|
| | 38 | $namespace = $this->getParam ('namespace', 'default'); |
|---|
| | 39 | $wHandle = $this->getParam ('handlerWindow'); |
|---|
| | 40 | $wHandle = ($wHandle != null) ? ( 'handle="'.$wHandle.'" ') : ''; |
|---|
| | 41 | $title = $this->getParam ('popuptitle'); |
|---|
| | 42 | $width = $this->getParam ('width'); |
|---|
| | 43 | $id = uniqid ('popupInformation'); |
|---|
| | 44 | $zoneajax = ($this->getParam ('zoneajax', 'true') == 'true'); |
|---|
| | 45 | $template = $this->getParam ('template', 'generictools|popupinformation.tpl'); |
|---|
| | 46 | $templateParams = array ( |
|---|
| | 47 | 'alt' => $alt, |
|---|
| | 48 | 'text' => $text, |
|---|
| | 49 | 'displayimg' => $displayimg, |
|---|
| | 50 | 'img' => $img, |
|---|
| | 51 | 'divclass' => $divclass, |
|---|
| | 52 | 'handler' => $handler, |
|---|
| | 53 | 'namespace' => $namespace, |
|---|
| | 54 | 'handlerWindow' => $this->getParam ('handlerWindow'), |
|---|
| | 55 | 'popuptitle' => $title, |
|---|
| | 56 | 'id' => $id, |
|---|
| | 57 | 'width' => $width, |
|---|
| | 58 | 'zoneajax' => $zoneajax |
|---|
| | 59 | ); |
|---|
| | 60 | |
|---|
| | 61 | switch ($handler) { |
|---|
| | 62 | case 'window': |
|---|
| | 63 | $toReturn = '<a rel="'.$id.'" '.$wHandle.' id="div'.$id.'" class="divwindowpopup" href="javascript:void(null);"'; |
|---|
| | 64 | if (isset($pParams['title'])) { |
|---|
| | 65 | $toReturn .= ' title="'.$pParams['title'].'"'; |
|---|
| | 66 | } |
|---|
| | 67 | $toReturn .= '>'; |
|---|
| | 68 | $close = '</a>'; |
|---|
| | 69 | CopixHTMLHeader::addJsLink (_resource ('js/taglib/popupinfo_window.js')); |
|---|
| | 70 | $js = new CopixJSWidget (); |
|---|
| | 71 | CopixHTMLHeader::addJSDOMReadyCode ($js->popupinfo_window (), 'popupinfo_window'); |
|---|
| | 72 | break; |
|---|
| | 73 | case 'clickdelay': |
|---|
| | 74 | $toReturn = '<a rel="'.$id.'" id="div'.$id.'" class="divclickdelaypopup" href="javascript:void(null);">'; |
|---|
| | 75 | $close = '</a>'; |
|---|
| | 76 | CopixHTMLHeader::addJsLink (_resource ('js/taglib/popupinfo_clickdelay.js')); |
|---|
| | 77 | CopixHTMLHeader::addJSDOMReadyCode ('popupinfo_clickdelay ();', 'popupinfo_clickdelay'); |
|---|
| | 78 | break; |
|---|
| | 79 | case 'onclick': |
|---|
| | 80 | $toReturn = '<a rel="'.$id.'" id="div'.$id.'" class="divclickpopup" href="javascript:void(null);">'; |
|---|
| | 81 | $close = '</a>'; |
|---|
| | 82 | CopixHTMLHeader::addJsLink (_resource ('js/taglib/popupinfo_click.js')); |
|---|
| | 83 | CopixHTMLHeader::addJSDOMReadyCode ('popupinfo_click ();', 'popupinfo_click'); |
|---|
| | 84 | |
|---|
| | 85 | break; |
|---|
| | 86 | default: |
|---|
| | 87 | //prend également en charge onmouseover qui est le handler par défaut. |
|---|
| | 88 | $toReturn = '<div rel="'.$id.'" id="div'.$id.'" class="divpopup" style="display:inline;">'; |
|---|
| | 89 | $close = '</div>'; |
|---|
| | 90 | CopixHTMLHeader::addJsLink (_resource ('js/taglib/popupinfo.js')); |
|---|
| | 91 | CopixHTMLHeader::addJSDOMReadyCode ('popupinfo ();', 'popupinfo'); |
|---|
| | 92 | break; |
|---|
| | 93 | } |
|---|
| | 94 | $toReturn .= $displayimg === true ? '<img src="'.$img.'" title="'.$alt.'" alt="'.$alt.'" />' : ''; |
|---|
| | 95 | $toReturn .= strlen ($text) ? $text : ''; |
|---|
| | 96 | $toReturn .= isset($pParams['imgnext']) ? '<img src="'.$pParams['imgnext'].'" />' : ''; |
|---|
| | 97 | $toReturn .= $close; |
|---|
| | 98 | |
|---|
| | 99 | if (isset ($pParams['zone'])) { |
|---|
| | 100 | $zone = $pParams['zone']; |
|---|
| | 101 | unset ($pParams['zone']); |
|---|
| | 102 | $content = _tag ('copixzone', array_merge ($this->getExtraParams (), array ('onComplete'=>'$(\'div'.$id.'\').fireEvent(\'sync\');','process'=>$zone,'ajax'=>$zoneajax, 'id'=>'zone_'.$id))); |
|---|
| | 103 | } else { |
|---|
| | 104 | $content = $pContent; |
|---|
| | 105 | } |
|---|
| | 106 | |
|---|
| | 107 | $tpl = new CopixTPL (); |
|---|
| | 108 | $tpl->assign ('MAIN', $content); |
|---|
| | 109 | $tpl->assign ('params', $templateParams); |
|---|
| | 110 | $toReturn .= $tpl->fetch ($template); |
|---|
| | 111 | return $toReturn; |
|---|
| | 112 | } |
|---|