/** * Actiongroup qui permet de gérer la suppression * */ public function processDelete() { $form = CopixFormFactory::get(_request('form_id')); $form->delete(CopixRequest::asArray()); $url = _request('url'); return _arRedirect(_url($url)); }
/** * 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_copixform_edit($params, $content, &$me) { if (is_null($content)) { return; } if (!isset($params['form'])) { $params['form'] = null; } if (isset($params['assign']) && isset($content)) { $me->assign($params['assign'], CopixFormFactory::get($params['form'])->getButton('edit', $content)); } return CopixFormFactory::get($params['form'])->getButton('edit', $content); }
/** * @param string contents of the block * @param Smarty clever simulation of a method * @return string string $content re-formatted */ function smarty_block_copixform_button($params, $content, &$me) { if (!isset($content)) { return null; } if (!isset($params['form'])) { $params['form'] = null; } if (!isset($params['type'])) { throw new CopixException(_i18n('copix:copixform.button.typeundefined')); } if (isset($params['assign'])) { $me->assign($params['assign'], CopixFormFactory::get($params['form'])->getButton($params['type'], $content)); } return CopixFormFactory::get($params['form'])->getButton($params['type'], $content); }
/** * Demande d'exécution du tag */ public function process($pParams, $pContent = null) { //récupération du formulaire, création d'un nouveau formulaire si besoin $form = CopixFormFactory::get(isset($pParams['id']) ? $pParams['id'] : null); //ajout d'un DAO au formulaire if (isset($pParams['dao'])) { $form->setDAOId($pParams['dao']); } //ajout de l'enregistrement à éditer if (isset($pParams['record'])) { $form->setRecord($pParams['record']); } if (isset($pParams['action'])) { $form->setAction($pParams['action']); } //retour du code HTML attendu return '<form id="' . $form->getId() . '" method="' . $form->getMethod() . '" action="' . $form->getAction() . '">' . "\n"; }
/** * 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_copixform_end($params, &$me) { $assign = ''; if (isset($params['assign'])) { $assign = $params['assign']; unset($params['assign']); } if (!isset($params['form'])) { $params['form'] = null; } $form = CopixFormFactory::get($params['form']); $toReturn = $form->end(); 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_copixform_start($params, &$me) { $assign = ''; if (isset($params['assign'])) { $assign = $params['assign']; unset($params['assign']); } if (!isset($params['form'])) { $params['form'] = null; } $form = CopixFormFactory::get($params['form'], $params); if (!isset($params['datasource']) && isset($params['dao'])) { $params['datasource'] = 'dao'; } $toReturn = $form->getHTMLHeader(); 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_copixform_field($params, &$me) { $assign = ''; if (isset($params['assign'])) { $assign = $params['assign']; unset($params['assign']); } if (!isset($params['form'])) { $params['form'] = null; } $form = CopixFormFactory::get($params['form']); if (!isset($params['name'])) { throw new Exception("You must specify a name"); } $type = isset($params['type']) ? $params['type'] : 'varchar'; $toReturn = $form->getFieldHTML($type, $params); if (strlen($assign) > 0) { $me->assign($assign, $toReturn); return ''; } else { return $toReturn; } }
/** * Surcharge du beforeAction qui instancie le _form et qui met dans le CopixRequest tout les champs du form (form|champs) */ public function _beforeAction($pActionName) { $this->_form = CopixFormFactory::get(_request('form_id')); $validUrl = _request('onValid'); $urlParams = array(); $urlParams['mode_' . _request('form_id')] = 'view'; $urlParams['error_' . _request('form_id')] = false; $urlParams['form_id'] = _request('form_id'); $urlParams['url'] = _request('url'); $this->_form->doValid(); $this->_form->doRecord(); foreach ($this->_form->getFields() as $fields) { $fields->fillRequest('form|'); } }
/** * Demande d'exécution du tag */ public function process($pParams, $pContent = null) { //récupération du formulaire, création d'un nouveau formulaire si besoin $form = CopixFormFactory::get(isset($pParams['id']) ? $pParams['id'] : null); return '</form>'; }