public function processGetTable()
 {
     $ppo = new CopixPPO();
     // Si c'est pour de l'ajax
     if (CopixRequest::get('url') == null) {
         try {
             //Recup les données
             $id = CopixRequest::get('table_id');
             $table = CopixListFactory::get($id);
             if (CopixRequest::get('submit') !== 'false') {
                 $table->getFromRequest();
             }
             //On génère le HTML
             $ppo->MAIN = $table->generateTable();
         } catch (Exception $e) {
             //En cas d'erreur en etant en ajax, on renvoi l'erreur
             $ppo->MAIN = $e->getMessage();
             return _arDirectPPO($ppo, 'blank.tpl');
         }
         return _arDirectPPO($ppo, 'blank.tpl');
         //Si c'est pas en ajax
     } else {
         //On récup les données
         $id = CopixRequest::get('table_id');
         $table = CopixListFactory::get($id);
         if (CopixRequest::get('submit') !== 'false') {
             $table->getFromRequest();
         }
         //Et on redirige
         return _arRedirect(_url(CopixRequest::get('url')));
     }
 }
/**
 * Plugin smarty type fonction
 */
function smarty_function_copixlist_list($params, &$me)
{
    $assign = '';
    if (isset($params['assign'])) {
        $assign = $params['assign'];
        unset($params['assign']);
    }
    if (!isset($params['tplvars'])) {
        $params['tplvars'] = array();
    }
    $params['tplvars'] = array_merge($params['tplvars'], $me->_tpl_vars);
    if (!isset($params['list'])) {
        $params['list'] = null;
    }
    $list = CopixListFactory::get($params['list']);
    if (!isset($params['datasource'])) {
        $params['datasource'] = 'dao';
    }
    $toReturn = $list->getList($params['datasource'], $params);
    if (strlen($assign) > 0) {
        $me->assign($assign, $toReturn);
        return '';
    } else {
        return $toReturn;
    }
}
/**
 * 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_copixlist_button($params, $content, &$me)
{
    if (!isset($content)) {
        return null;
    }
    if (!isset($params['list'])) {
        $params['list'] = null;
    }
    if (!isset($params['type'])) {
        throw new CopixException(_i18n('copix:copixlist.button.typeundefined'));
    }
    if (isset($params['assign'])) {
        $me->assign($params['assign'], CopixListFactory::get($params['list'])->getButton($params['type'], $content));
    }
    return CopixListFactory::get($params['list'])->getButton($params['type'], $content);
}
/**
* Plugin smarty type fonction
* Purpose:  generation of a copixed url
*
* Input:    dest=module|desc|action
*           complete syntax will be:
*           desc|action for current module, desc and action
*           [action or |action] default desc, action
*           [|desc|action] project, desc and action
*           [||action] action in the project
*           [module||action] action in the default desc for the module
*           [|||] the only syntax for the current page
*
*           * = any extra params will be used to generate the url
*
*/
function smarty_function_copixlist_start($params, &$me)
{
    $assign = '';
    if (isset($params['assign'])) {
        $assign = $params['assign'];
        unset($params['assign']);
    }
    if (!isset($params['list'])) {
        $params['list'] = null;
    }
    $list = CopixListFactory::get($params['list']);
    if (!isset($params['action'])) {
        $params['action'] = null;
    }
    $toReturn = $list->start($params['action']);
    if (strlen($assign) > 0) {
        $me->assign($assign, $toReturn);
        return '';
    } else {
        return $toReturn;
    }
}
/**
* Plugin smarty type fonction
* Purpose:  generation of a copixed url
*
* Input:    dest=module|desc|action
*           complete syntax will be:
*           desc|action for current module, desc and action
*           [action or |action] default desc, action
*           [|desc|action] project, desc and action
*           [||action] action in the project
*           [module||action] action in the default desc for the module
*           [|||] the only syntax for the current page
*
*           * = any extra params will be used to generate the url
*
*/
function smarty_function_copixlist_field($params, &$me)
{
    $assign = '';
    if (isset($params['assign'])) {
        $assign = $params['assign'];
        unset($params['assign']);
    }
    if (!isset($params['list'])) {
        $params['list'] = null;
    }
    $list = CopixListFactory::get($params['list']);
    if (!isset($params['name'])) {
        throw new Exception("You must specify a name");
    }
    $type = isset($params['type']) ? $params['type'] : 'varchar';
    $toReturn = $list->getField($type, $params);
    if (strlen($assign) > 0) {
        $me->assign($assign, $toReturn);
        return '';
    } else {
        return $toReturn;
    }
}
 /**
  * Récupération / création d'un formulaire
  * @param string $pId l'identifiant du formulaire à créer.
  *  Si rien n'est donné, un nouveau formulaire est crée
  * @return CopixList
  */
 public static function get($pId = null)
 {
     //Aucun identifiant donné ? bizarre, mais créons lui un identifiant
     if ($pId === null) {
         if (CopixListFactory::getCurrentId() === null) {
             //@TODO I18N
             throw new CopixException("Aucun ID en cours, vous devez en spécifier un pour votre formulaire");
         } else {
             $pId = CopixListFactory::getCurrentId();
         }
     }
     if ($pId != CopixListFactory::getCurrentId()) {
         CopixListFactory::pushCurrentId($pId);
     }
     //le formulaire existe ?
     $list = CopixSession::get($pId, 'COPIXLIST');
     if ($list != null) {
         return $list;
     }
     $list = new CopixList($pId);
     CopixSession::set($pId, $list, 'COPIXLIST');
     //Création du nouveau formulaire
     return $list;
 }