managed_datas['templates']) && count($this->managed_datas['templates'])){
//sélection d'un template définie en adminsitration
$form.="
".$this->format_text($this->msg['cms_module_common_view_django_template_choice'])."
".$this->format_text($this->msg['cms_module_common_view_django_template_choice'])."";
foreach($this->managed_datas['templates'] as $key => $infos){
$form.="
".$this->format_text($infos['name'])." ";
}
$form.="
";
}
if(!isset($this->parameters['active_template']) || $this->parameters['active_template'] == ""){
$this->parameters['active_template'] = $this->default_template;
}
$form.="
".$this->format_text($this->msg['cms_module_common_view_django_template_content'])."
".$this->get_format_data_structure_tree("cms_module_common_view_django_template_content")."
".$this->get_ace_editor_script();
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){
if(!isset($datas) || !is_array($datas)){
$datas=array();
}
if(!isset($datas['id']) || !$datas['id']){
$datas['id'] = $this->get_module_dom_id();
}
if(!isset($datas['get_vars']) || !$datas['get_vars']){
$datas['get_vars'] = $_GET;
}
if(!isset($datas['post_vars']) || !$datas['post_vars']){
$datas['post_vars'] = $_POST;
}
try{
$html = H2o::parseString($this->parameters['active_template'])->render($datas);
if (!empty($datas['css'])) $html.= '';
}catch(Exception $e){
$html = '';
$html .= '';
$html .= $this->msg["cms_module_common_view_error_template"];
$html .= '
';
}
return $html;
}
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(isset($this->managed_datas['templates'][$cms_template_delete])) unset($this->managed_datas['templates'][$cms_template_delete]);
$form="
";
if(isset($this->managed_datas['templates'])){
foreach($this->managed_datas['templates'] as $key => $infos){
$form.="
".$this->format_text($infos['name'])."
";
}
}
$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' => (isset($this->default_template) ? $this->default_template : '')
);
}
//nom
$form = "
";
//contenu
$form .= "
".$this->format_text($this->msg['cms_module_common_view_django_template_content'])."
".$this->get_format_data_structure_tree("cms_module_common_view_django_template_content")."
".$this->get_ace_editor_script();
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(){
$format_datas = array();
$format_datas[]= array(
'var' => "id",
'desc'=> $this->msg['cms_module_common_view_django_id_desc']
);
$format_datas[] = array(
'var' => "get_vars.",
'desc' => $this->msg['cms_module_common_view_django_get_vars_desc']
);
$format_datas[] = array(
'var' => "post_vars.",
'desc' => $this->msg['cms_module_common_view_django_post_vars_desc']
);
$format_datas[] = array(
'var' => "session_vars",
'desc' => $this->msg['cms_module_common_view_django_session_vars_desc'],
'children' =>array(
array(
'var' => "session_vars.view",
'desc' => $this->msg['cms_module_common_view_django_session_vars_view_desc'],
),
array(
'var' => "session_vars.id_empr",
'desc' => $this->msg['cms_module_common_view_django_session_vars_id_empr_desc'],
),
array(
'var' => "session_vars.empr_nom",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_nom_desc'],
),
array(
'var' => "session_vars.empr_prenom",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_prenom_desc'],
),
array(
'var' => "session_vars.empr_mail",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_mail_desc'],
),
array(
'var' => "session_vars.empr_login",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_login_desc'],
),
array(
'var' => "session_vars.empr_adr1",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_adr1_desc'],
),
array(
'var' => "session_vars.empr_adr2",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_adr2_desc'],
),
array(
'var' => "session_vars.empr_cp",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_cp_desc'],
),
array(
'var' => "session_vars.empr_ville",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_ville_desc'],
),
array(
'var' => "session_vars.empr_categ",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_categ_desc'],
),
array(
'var' => "session_vars.empr_codestat",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_codestat_desc'],
),
array(
'var' => "session_vars.empr_sexe",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_sexe_desc'],
),
array(
'var' => "session_vars.empr_year",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_year_desc'],
),
array(
'var' => "session_vars.empr_cb",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_cb_desc'],
),
array(
'var' => "session_vars.empr_prof",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_prof_desc'],
),
array(
'var' => "session_vars.empr_tel1",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_tel1_desc'],
),
array(
'var' => "session_vars.empr_tel2",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_tel2_desc'],
),
array(
'var' => "session_vars.empr_location",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_location_desc'],
),
array(
'var' => "session_vars.empr_date_adhesion",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_date_adhesion_desc'],
),
array(
'var' => "session_vars.empr_date_expiration",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_date_expiration_desc'],
),
array(
'var' => "session_vars.empr_statut",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_statut_desc'],
),
array(
'var' => "session_vars.empr_first_authentification",
'desc' => $this->msg['cms_module_common_view_django_session_vars_empr_first_authentification_desc'],
)
)
);
$format_datas[] = array(
'var' => "env_vars",
'desc' => $this->msg['cms_module_common_view_django_env_vars_desc'],
'children' =>array(
array(
'var' => "env_vars.script",
'desc' => $this->msg['cms_module_common_view_django_session_vars_script_desc'],
),
array(
'var' => "env_vars.request",
'desc' => $this->msg['cms_module_common_view_django_session_vars_request_desc'],
),
array(
'var' => "env_vars.opac_url",
'desc' => $this->msg['cms_module_common_view_django_session_vars_opac_url_desc'],
),
array(
'var' => "env_vars.platform",
'desc' => $this->msg['cms_module_common_view_django_session_vars_platform_desc'],
),
array(
'var' => "env_vars.browser",
'desc' => $this->msg['cms_module_common_view_django_session_vars_browser_desc'],
),
array(
'var' => "env_vars.server_addr",
'desc' => $this->msg['cms_module_common_view_django_session_vars_server_addr_desc'],
),
array(
'var' => "env_vars.remote_addr",
'desc' => $this->msg['cms_module_common_view_django_session_vars_remote_addr_desc'],
)
)
);
return $format_datas;
}
public function get_format_data_structure_tree($textarea){
$html = "
";
return $html;
}
}