public function _createContent(&$toReturn)
 {
     $arModuleToInstall = CopixSession::get('arModuleToInstall', 'copix');
     $arInstalledModule = CopixSession::get('arInstalledModule', 'copix');
     $moduleName = array_pop($arModuleToInstall);
     $url = $this->getParam('url');
     if (($message = CopixModule::installModule($moduleName)) === true) {
         $toReturn = _i18n('install.module.install') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />';
         if (count($arModuleToInstall) > 0) {
             $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|installmodule', 'url' => $url, 'auto' => true, 'ajax' => true));
         } elseif ($url) {
             $toReturn .= sprintf('<form action="%s" method="post"><input type="submit" value="%s"/></form>', htmlspecialchars($url), _i18n('copix:common.buttons.next'));
         } else {
             $toReturn .= "<script>\$('back').setStyle('display','');</script>";
         }
         array_push($arInstalledModule, $moduleName);
     } else {
         array_push($arInstalledModule, $moduleName);
         $toReturn = _i18n('install.module.install') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message);
         $toReturn .= '<div class="errorMessage">' . $message . '</div>';
         if (count($arInstalledModule) > 0) {
             CopixSession::set('arModuleToDelete', $arInstalledModule, 'copix');
             CopixSession::set('arInstalledModule', null, 'copix');
             CopixSession::set('arModuleToInstall', null, 'copix');
             $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true));
         }
     }
     CopixSession::set('arModuleToInstall', $arModuleToInstall, 'copix');
     CopixSession::set('arInstalledModule', $arInstalledModule, 'copix');
     return true;
 }
 public function process($pParams)
 {
     // paramètres requis
     $requestedParameters = array('form', 'submit', 'divErrors', 'urlVerif', 'urlSubmit');
     foreach ($requestedParameters as $param) {
         if (!isset($pParams[$param])) {
             throw new CopixTemplateTagException(_i18n('copix:copix.smarty.badTagParamValue', array('null', $param, 'ajax_submitform')));
         }
     }
     // on a besoin de mootools
     _tag('mootools');
     // code javascript
     $jsCode = '
         window.addEvent(\'domready\', function(){
             $(\'' . $pParams['submit'] . '\').addEvent(\'click\', function(e) {
                 $(\'' . $pParams['submit'] . '\').disabled = true;
                 $(\'' . $pParams['form'] . '\').action = \'' . _url($pParams['urlVerif']) . '\';
                 new Event (e).stop ();
                 $(\'' . $pParams['form'] . '\').send ({
                     update: $(\'formErrors\'),
                     onComplete: function (response) {
                         if (response == \'true\') {
                             $(\'' . $pParams['form'] . '\').action = \'' . _url($pParams['urlSubmit']) . '\';
                             $(\'' . $pParams['form'] . '\').submit ();
                         } else {
                             $(\'' . $pParams['submit'] . '\').disabled = false;
                         }
                     },
                 });
             });
         });';
     CopixHTMLHeader::addJSCode($jsCode, 'ajax_submitform_' . $pParams['form']);
 }
/**
 * Plugin smarty type fonction
 * Purpose:  send form by javascript to given href.
 *
 * Input:    href     = (required)  where to send the form
 *           form     = (required) id of the form
 *           assign   = (optional) name of the template variable we'll assign
 *                      the output to instead of displaying it directly
 *
 * Examples:
 */
function smarty_function_jssubmitform($params, $me)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('jssubmitform', $params));
    } else {
        return _tag('jssubmitform', $params);
    }
}
/**
 * Plugin smarty type fonction
 * Purpose:  LinkBar for navigation.
 *
 * Input:    pageNum  = (required)  the page number we wants to display
 *           nbLink = (obtional) number of link in the bar
 *           nbTotalPage = (required) total number of pages.
 *           url = (required) url which is called when you clic on a link
 *                 (for example url = 'index.php?pageNum='
 *                  if we click on the second page we'll go to :
 *                  index.php?pageNum=2)
 *
 *
 * Examples:
 * {linkbar url="index.php?showPage=" nbLink=2 pageNum=1 nbTotalPage=100}
 */
function smarty_function_linkbar($params, $this)
{
    if (isset($params['assign'])) {
        $this->assign($params['assign'], _tag('linkbar', $params));
    } else {
        return _tag('linkbar', $params);
    }
}
/**
 * Plugin smarty type fonction
 * Purpose:  generation of a radio buttons group
 *
 * Input:    name     = (required  name of the select box
 *           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
 *           objectMap   = (optional) if given idProperty;captionProperty
 *           extra       = (optionnal) extra parameters we may give to the radio elements
 */
function smarty_function_checkbox($params, &$me)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('checkbox', $params));
    } else {
        return _tag('checkbox', $params);
    }
}
/**
 * Création d'une liste déroulante à séléction multiple
 */
function smarty_function_multipleselect($params, $me)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('multipleselect', $params));
    } else {
        return _tag('multipleselect', $params);
    }
}
/**
 * Plugin smarty type fonction
 * Purpose:  generation of a radio buttons group
 *
 * Input:    name     = (required  name of the select box
 *           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
 *           objectMap   = (optional) if given idProperty;captionProperty
 *           extra       = (optionnal) extra parameters we may give to the radio elements
 */
function smarty_function_radiobutton($params, &$me)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('radiobutton', $params));
    } else {
        return _tag('radiobutton', $params);
    }
}
/**
 * Plugin smarty type fonction
 * Génération d'input text
 */
function smarty_function_copixpicture($params, $me)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('copixpicture', $params));
    } else {
        return _tag('copixpicture', $params);
    }
}
/**
 * Div d'une zone chargé en ajax
 */
function smarty_function_ajax_divzone($params, &$smarty)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('ajax_divzone', $params));
    } else {
        return _tag('ajax_divzone', $params);
    }
}
/**
 * Plugin smarty type fonction
 * Generation d'un textarea
 *
 */
function smarty_function_textarea($params, $me)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('textarea', $params));
    } else {
        return _tag('textarea', $params);
    }
}
/**
 * Div d'une zone chargé en ajax
 */
function smarty_function_ajax_popupinformation($params, &$smarty)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('ajax_popupinformation', $params));
    } else {
        return _tag('ajax_popupinformation', $params);
    }
}
/**
 * Plugin smarty type fonction
 * Génération d'input text
 *
 */
function smarty_block_wikieditor($params, $content, $me)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('inputtext', $params, $content));
    } else {
        return _tag('wikieditor', $params, $content);
    }
}
/**
 * Plugin smarty type fonction
 * Génération d'input text
 *
 */
function smarty_function_inputtext($params, $me)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('inputtext', $params));
    } else {
        return _tag('inputtext', $params);
    }
}
/**
 * Permet d'afficher un logo 'copix' dans les sources HTML sous la forme d'un commentaire
 *
 * input: type : big   -> the big one
 *               small -> simply made with Copix, http://copix.org
 *        default is small
 * Examples: {copixlogo}
 * Simply output the made with Copix Logo
 * -------------------------------------------------------------
 */
function smarty_function_copixlogo($params, &$smarty)
{
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], _tag('copixlogo', $params));
    } else {
        return _tag('copixlogo', $params);
    }
}
/**
 * Smarty plugin
 * -------------------------------------------------------------
* Type:     function
* input: type :
* Examples: {htmleditor name="text_content" content="Default XHTML content"}
*
* includes the required library for the js library fckeditor
* you can find this library at http://www.fckeditor.net
* -------------------------------------------------------------
*/
function smarty_function_htmleditor($params, $smarty)
{
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], _tag('htmleditor', $params));
    } else {
        return _tag('htmleditor', $params);
    }
}
/**
 * Plugin smarty type fonction
 * Purpose:  automated error message.
 *
 * Input:    message = (required if you want to display a message) the error message
 *           class = (optional) class css to use for the paragraph
 *           assign = (optional) text to display, default is address
 *
 * Examples: {errormsg message="Please give an adress"}
 *           {errormsg message="Please give an adress" class="redText"}
 *           {errormsg message=$Message assign=$errorMessage}
 */
function smarty_function_errormsg($params, $me)
{
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('errormsg', $params));
    } else {
        return _tag('errormsg', $params);
    }
}
/**
* Plugin smarty type fonction pour encapsuler tous les appels aux tag copix
*
* <code>
*  {copixtag type="select" selected=$value values=$values}
* </code>
*
* @see CopixTpl::tag
*/
function smarty_function_copixtag($params, &$me)
{
    $toReturn = '';
    if (file_exists(COPIX_PATH . 'taglib/' . strtolower($params['type']) . '.templatetag.php')) {
        $toReturn = _tag($params['type'], $params);
    }
    return $toReturn;
}
 public function process($pParams, $pContent = null)
 {
     $toReturn = '    ' . $pContent . '<br /><br />';
     $toReturn .= '    <a href="' . CopixUrl::get($pParams['yes']) . '">' . _i18n('copix:common.buttons.yes') . '</a>';
     $toReturn .= '    <a href="' . CopixUrl::get($pParams['no']) . '">' . _i18n('copix:common.buttons.no') . '</a>';
     _tag('mootools');
     CopixHTMLHeader::addJsCode("\n        window.addEvent('domready', function () {\n            var elem = new Element('div');\n            elem.setStyles({'z-index':99999,'background-color':'white','border':'1px solid black','width':'200px','height':'100px','top': window.getScrollTop().toInt()+window.getHeight ().toInt()/2-100+'px','left':window.getScrollLeft().toInt()+window.getWidth ().toInt()/2-100+'px','position':'absolute','text-align':'center'});\n            elem.setHTML ('{$toReturn}');\n            elem.injectInside(document.body);\n\n        });\n\n        ");
     return null;
 }
/**
 * Smarty {tabs}{/tabs} block plugin
 *
 * Type:     block function
 * Name:     tabs
 * Purpose:  make tabs with ul / li and css styles
 * @param ul_class: string -> class du tag ul
 * @param li_class: string -> class du tag li, si non selectionne
 * @param li_class_selected: string -> class du tag li, si selectionne
 * @param values: string -> url*caption|url*caption, lien et texte de chaque onglet
 * @param selected: string -> url de l'onglet selectionne
 * @return string -> html du ul / li
 */
function smarty_block_tabs($params, $content, &$me)
{
    if (is_null($content)) {
        return;
    }
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('tabs', $params, $content));
    }
    return _tag('tabs', $params, $content);
}
/**
 * Smarty {popupinformation}{/popupinformation} block plugin
 *
 * Type:     block function<br>
 * Name:     popupinformation<br>
 * Purpose:  Add div wich display when mouse is over img<br>
 * @param array
 *
 * <pre>
 * Params:   img: string
 * Params:   text: string
 * Params:   divclass: (optional)string, css class
 * Params:   displayimg: (optional, default true)boolean, display img ?
 * Params:   displaytext: (optional, default false) boolean , displaty text after img ?
 * Params:   assign :(optional) name of the template variable we'll assign
 *                      the output to instead of displaying it directly
 * </pre>
 *
 * @param string contents of the block
 * @param Smarty clever simulation of a method
 * @return string string $content re-formatted
 */
function smarty_block_popupinformation($params, $content, &$me, $first)
{
    if (is_null($pContent) && $first === true) {
        return;
    }
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('popupinformation', $params, $content));
    }
    return _tag('popupinformation', $params, $content);
}
/**
 * Tag permettant de générer rapidement une image et un lien sur une image dans img/tools/
 */
function smarty_function_copixicon($params, $me)
{
    if (isset($params['assign'])) {
        $assignVar = $params['assign'];
        unset($params['assign']);
        $me->assign($assignVar, _tag('copixicon', $params));
    } else {
        return _tag('copixicon', $params);
    }
}
/**
* Plugin smarty type function
* Purpose: Génère une inclusion de Flash.
*
* Input:
*
* @param array $params les paramètres passés au tag
* @param Smarty $me l'objet Smarty en cours d'exécution
*/
function smarty_function_swfobject($params, &$me)
{
    if (isset($params['assign'])) {
        $name = $params['assign'];
        unset($params['assign']);
        $me->assign($name, _tag('swfobject', $params));
    } else {
        return _tag('swfobject', $params);
    }
}
 public function _createContent(&$toReturn)
 {
     $moduleName = CopixZone::getParam('moduleName');
     if (($message = CopixModule::updateModule($moduleName)) === true) {
         $toReturn = _i18n('install.module.update') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />';
     } else {
         $toReturn = _i18n('install.module.update') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message);
         $toReturn .= '<div class="errorMessage">' . $message . '</div>';
     }
     return true;
 }
/**
 * Plugin smarty type fonction
 * Génération d'input text
 *
 */
function smarty_function_autocomplete($params, $me)
{
    if (!isset($params['datasource'])) {
        $params['datasource'] = 'dao';
    }
    if (!isset($params['field'])) {
        throw new Exception('Vous devez remplir le champ "field"');
    }
    if (isset($params['assign'])) {
        $me->assign($params['assign'], _tag('autocomplete', $params));
    } else {
        return _tag('autocomplete', $params);
    }
}
 /**
  * Construction du message
  * @param    mixed   $pParams    tableau de paramètre ou clef
  * @param    mixed   $pContent   null (ImageProtect n'est pas censé recevoir de contenu)
  * @return   string  balise html contenant le bouton de selection i18n
  */
 public function process($pParams, $pContent = null)
 {
     if (!isset($pParams['name'])) {
         throw new CopixTagException("[ImageProtect] Missing name parameter");
     }
     if (!isset($pParams['id'])) {
         throw new CopixTagException("[ImageProtect] Missing id parameter");
     }
     $caption = isset($pParams['caption']) ? $pParams['caption'] : '';
     $listeModules = CopixModule::getList(false);
     sort($listeModules);
     $winSelecter = '<div id="divpopup_' . $pParams['id'] . '" style="display:none; border:1px; border-style:solid; border-color:#000; background-color:#FFF ;" >' . "\n\n" . '    <div id="divpopup1_' . $pParams['id'] . '" style="float:left;" >' . "\n" . '    ' . _tag('select', array('id' => 'selectmodule1_' . $pParams['id'], 'name' => 'selectmodule_' . $pParams['id'], 'values' => $listeModules, 'extra' => 'style="width:200px;" size="12"', 'emptyShow' => false)) . "\n" . '    </div>' . "\n\n" . '    <div id="divpopup2_' . $pParams['id'] . '" style="display:none;float:left;" >' . "\n" . '        ' . _tag('select', array('id' => 'selectmodule2_' . $pParams['id'], 'name' => 'selectmodule_' . $pParams['id'], 'values' => $listeModules, 'extra' => 'style="width:200px;" size="10"', 'emptyShow' => false)) . "\n" . '        <div id="divtrad_' . $pParams['id'] . '" > ' . "\n" . '             <textarea cols="30" rows="1" readonly="readonly" style="width:200px; overflow:hidden;" >traduction de  \'i18n</textarea>' . "\n" . '        </div>' . "\n" . '    </div>' . "\n\n" . '</div>' . "\n";
     $javascript = '<script type="text/javascript">' . "\n" . '$("' . $pParams['id'] . '").addEvent("mouseover", function (){' . "\n" . '    $("divpopup_' . $pParams['id'] . '").setStyles({' . "\n" . '        "position":"absolute",' . "\n" . '        "top" : 200+"px",' . "\n" . '        "left" : 200+"px",' . "\n" . '        "zIndex":"1000",' . "\n" . '        "display":"block"' . "\n" . '    });' . "\n" . '});' . "\n\n" . '$("selectmodule1_' . $pParams['id'] . '").addEvent("change", function () {' . "\n" . '    $("divpopup2_' . $pParams['id'] . '").setStyle("display","block");' . "\n" . '});' . "\n" . '</script>' . "\n";
     return '<label>' . $caption . '<input type="text" name="' . $pParams['name'] . '" /></label>' . "\n" . '<img src="' . _resource("img/icons/languages.gif") . '" id="' . $pParams['id'] . '" alt="' . _i18n('copix:common.buttons.select') . '" />' . "\n" . $winSelecter . $javascript;
 }
/**
 * Plugin smarty type fonction
 * Purpose:  I18N interface for CopiX.
 *
 * Input:    key      = (required  name of the select box
 *           bundle   = (optional) values to display the values captions will be
 *                        html_escaped, not the ids
 *           lang      = (optional) id of the selected element
 *           assign   = (optional) name of the template variable we'll assign
 *                      the output to instead of displaying it directly
 *
 * Examples:
 */
function smarty_function_customi18n($params, &$me)
{
    if (isset($params['assign'])) {
        $assignVar = $params['assign'];
        unset($params['assign']);
        $me->assign($assignVar, _tag('customi18n', $params));
        return;
    } else {
        $res = _tag('customi18n', $params);
        if (isset($params['addslashes']) && $params['addslashes']) {
            $res = addslashes($res);
        }
        return $res;
    }
}
/**
* Plugin smarty type fonction
* Purpose: appelle d'une zone Copix directement depuis le template
*
* Input:    id=module|desc|action
*           assign=variable ou la sortie sera assignée
*           * = tout autre paramètre sera passé à la zone
*
* @param array $params les paramètres passés au tag
* @param Smarty $me l'objet Smarty en cours d'exécution
*/
function smarty_function_copixzone($params, &$me)
{
    //On regarde si l'on assigne la sortie à un élément
    if (isset($params['assign'])) {
        $assign = $params['assign'];
        unset($params['assign']);
    } else {
        $assign = null;
    }
    $toReturn = _tag('copixzone', $params);
    if (strlen($assign) > 0) {
        $me->assign($assign, $toReturn);
        return '';
    } else {
        return $toReturn;
    }
}
 public function _createContent(&$toReturn)
 {
     $arModuleToDelete = CopixSession::get('arModuleToDelete', 'copix');
     $moduleName = array_pop($arModuleToDelete);
     if (($message = CopixModule::deleteModule($moduleName)) === true) {
         $toReturn = _i18n('install.module.delete') . ' ' . $moduleName . ' <img src="' . _resource('img/tools/valid.png') . '" />';
         if (count($arModuleToDelete) > 0) {
             $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true));
         } else {
             $toReturn .= "<script>\$('back').setStyle('display','');</script>";
         }
     } else {
         $toReturn = _i18n('install.module.delete') . ' ' . $moduleName . ' ' . _tag('popupinformation', array('img' => _resource('img/tools/delete.png')), $message);
         $toReturn .= '<div class="errorMessage">' . $message . '</div>';
         if (count($arModuleToDelete) > 0) {
             $toReturn .= _tag('copixzone', array('id' => uniqid(), 'process' => 'admin|deletemodule', 'auto' => true, 'ajax' => true));
         } else {
             $toReturn .= "<script>\$('back').setStyle('display','');</script>";
         }
     }
     CopixSession::set('arModuleToDelete', $arModuleToDelete, 'copix');
     return true;
 }
Example #29
0
<?php

echo _tag('div.clearfix', _link('@blog_rss')->text('Diem blog syndication')->title('Subscribe to the blog feed')->set('.rss_link') . _tag('h1.t_big', 'Blog'));
Example #30
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="search" type="application/opensearchdescription+xml" title="Documentation Copix" href="<?php 
echo _url();
?>
goodies/copix.xml" />
<title><?php 
echo $TITLE_BAR;
?>
</title>
<?php 
_tag('mootools', array('plugin' => 'elementmover;transcorners;toolbar;shadows;fixhrefbutton;moopanes'));
echo $HTML_HEAD;
?>
<link rel="stylesheet"
    href="<?php 
echo _resource("styles/copix.css.php");
?>
?copixurl=<?php 
echo _url();
?>
"
    type="text/css" />
<link rel="stylesheet"
    href="<?php 
echo _resource("styles/theme.css.php");
?>
?copixurl=<?php 
echo _url();