managed_datas['templates'])){ //sélection d'un template définie en adminsitration $form="
"; }else if($this->parameters['active_template'] == ""){ $this->parameters['active_template'] = $this->default_template; } $form.="
".$this->get_format_data_structure_tree("cms_module_common_view_django_template_content")."
"; return $form; } /* * Sauvegarde du formulaire, revient à remplir la propriété parameters et appeler la méthode parente... */ public function save_form(){ global $cms_module_common_view_template_choice; global $cms_module_common_view_templates; global $cms_module_common_view_django_template_content; $this->parameters['active_template'] = $this->stripslashes($cms_module_common_view_django_template_content); return parent::save_form(); } public function render($datas){ return H2o::parseString($this->parameters['active_template'])->render($datas); } public function get_manage_form(){ global $base_path; //variables persos... global $cms_template; global $cms_template_delete; if(!$this->managed_datas) $this->managed_datas = array(); if($this->managed_datas['templates'][$cms_template_delete]) unset($this->managed_datas['templates'][$cms_template_delete]); $form="
"; if($this->managed_datas['templates']){ foreach($this->managed_datas['templates'] as $key => $infos){ $form.="

".$this->format_text($infos['name'])."   ".$this->format_text($this->msg[

"; } } $form.=" ".$this->format_text($this->msg['cms_module_common_view_django_add_template'])." "; $form.="
"; if($cms_template){ $form.=$this->get_managed_form_start(array('cms_template'=>$cms_template)); $form.=$this->get_managed_template_form($cms_template); $form.=$this->get_managed_form_end(); } $form.="
"; return $form; } protected function get_managed_template_form($cms_template){ global $opac_url_base; if($cms_template != "new"){ $infos = $this->managed_datas['templates'][$cms_template]; }else{ $infos = array( 'name' => "Nouveau Template", 'content' => $this->default_template ); } //nom $form.="
"; //contenu $form.="

".$this->get_format_data_structure_tree("cms_module_common_view_django_template_content")."
"; return $form; } public function save_manage_form($managed_datas){ global $cms_template; global $cms_template_delete; global $cms_module_common_view_django_template_name,$cms_module_common_view_django_template_content; if($cms_template_delete){ unset($managed_datas['templates'][$cms_template_delete]); }else{ if($cms_template == "new"){ $cms_template = "template".(cms_module_common_view_django::get_max_template_id($managed_datas['templates'])+1); } $managed_datas['templates'][$cms_template] = array( 'name' => stripslashes($cms_module_common_view_django_template_name), 'content' => stripslashes($cms_module_common_view_django_template_content) ); } return $managed_datas; } protected function get_max_template_id($datas){ $max = 0; if(count($datas)){ foreach ($datas as $key => $val){ $key = str_replace("template","",$key)*1; if($key>$max) $max = $key; } } return $max; } public function get_format_data_structure_tree($textarea){ $html = "
"; return $html; } }