default_template = "
{{title}}
{{resume}}
{{content}}
Sous-rubriques
Articles
";
}
public function get_form(){
$form="
";
$form.= $this->get_constructor_link_form("section");
$form.="
";
$form.= $this->get_constructor_link_form("article");
$form.="
";
$form.=parent::get_form();
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_section_page_section;
// global $cms_module_common_view_section_page_section_var;
// global $cms_module_common_view_section_page_article;
// global $cms_module_common_view_section_page_article_var;
// $this->parameters['links'] = array(
// 'section' => array(
// 'page' => (int) $cms_module_common_view_section_page_section,
// 'var' => $cms_module_common_view_section_page_section_var
// ),
// 'article' => array(
// 'page' => (int) $cms_module_common_view_section_page_article,
// 'var' => $cms_module_common_view_section_page_article_var
// )
// );
$this->save_constructor_link_form('section');
$this->save_constructor_link_form('article');
return parent::save_form();
}
public function gen_section_select($type,$name=""){
if(!$name) $name = "cms_module_common_view_section_page_".$type;
$form = "
";
$href = "";
if($this->parameters['links'][$type]['page']){
$href = "./ajax.php?module=cms&elem=".$this->class_name."&categ=module&action=get_env&name=".$this->class_name."_page_".$type."_var"."&pageid=".$this->parameters['links'][$type]['page']."&var=".$this->parameters['links'][$type]['var'];
}
$form.="
";
return $form;
}
public function get_page_env_select($pageid,$name,$var=""){
$pageid+=0;
$page = new cms_page($pageid);
$form="
";
return $form;
}
public function render($datas) {
$render_datas = [];
$links = [
"article" => $this->get_constructed_link("article", "!!id!!"),
"section" => $this->get_constructed_link("section", "!!id!!")
];
$cms_section = cms_provider::get_instance("section", $datas->id);
// Dans le cas d'une liste de rubriques affichée via un template django, on écrase les valeurs de lien définies par celles du module
if ($this->parameters['links']['section']['var'] && $this->parameters['links']['section']['page']) {
$cms_section->set_var_name($this->parameters['links']['section']['var']);
$cms_section->set_num_page($this->parameters['links']['section']['page']);
$cms_section->update_permalink();
}
$render_datas = $cms_section->format_datas($links);
return parent::render($render_datas);
}
public function get_format_data_structure(){
$format = array();
$datasource = new cms_module_common_datasource_section();
$format = $datasource->get_format_data_structure();
for ($i=0; $i "parent.link",
'desc'=> $this->msg['cms_module_common_view_section_link_desc']
);
}
if($format[$i]['var'] == 'children') {
$format[$i]['children'][] = array(
'var' => "children[i].link",
'desc'=> $this->msg['cms_module_common_view_section_link_desc']
);
}
if($format[$i]['var'] == 'articles') {
$format[$i]['children'][] = array(
'var' => "articles[i].link",
'desc'=> $this->msg['cms_module_common_view_article_link_desc']
);
}
}
$format[] = array(
'var' => "link",
'desc'=> $this->msg['cms_module_common_view_section_link_desc']
);
return $format;
}
}