default_template = "
>> {{home.title}}
{% for section in sections %}
> {{section.title}}
{% endfor %}
";
}
public function get_form(){
$form="
";
$form.= $this->get_constructor_link_form("section");
$form.="
";
$form.= parent::get_form();
return $form;
}
public function save_form(){
$this->save_constructor_link_form("section");
return parent::save_form();
}
public function render($datas){
global $opac_url_base;
$render_datas = array();
$render_datas['sections'] = array();
$render_datas['home'] = array(
'title' => $this->msg['home'],
'link' => $opac_url_base
);
$links = [
"article" => $this->get_constructed_link("article", "!!id!!"),
"section" => $this->get_constructed_link("section", "!!id!!")
];
if($datas['article']){
$render_datas['article'] = $datas['article'];
}
foreach($datas['sections'] as $section){
$cms_section = new cms_section($section);
$infos= $cms_section->format_datas($links);
$render_datas['sections'][]=$infos;
}
//on rappelle le tout...
return parent::render($render_datas);
}
public function get_format_data_structure(){
//dans ce cas là, c'est assez simple, c'est la vue qui va chercher les données...
$format = array();
$format[] = array(
'var' => 'home',
'desc' => "",
'children' => array(
array(
'var' => "home.title",
'desc' => $this->msg['cms_module_common_view_home_title_desc'],
),
array(
'var' => "home.link",
'desc' => $this->msg['cms_module_common_view_home_link_desc'],
)
)
);
$sections = array(
'var' => "sections",
'desc' => $this->msg['cms_module_common_view_section_desc'],
'children' => $this->prefix_var_tree(cms_section::get_format_data_structure(false,false),"sections[i]")
);
$sections['children'][] = array(
'var' => "sections[i].link",
'desc'=> $this->msg['cms_module_common_view_section_link_desc']
);
$format[]=$sections;
$format = array_merge($format,parent::get_format_data_structure());
return $format;
}
}