use_jquery = true; $this->default_template = " "; parent::__construct($id); } public function get_form(){ if(!isset($this->parameters['css']) || !$this->parameters['css']){ $this->parameters['css'] = (isset($this->managed_datas['css']) ? $this->managed_datas['css'] : ''); } if (!isset($this->parameters["mode"])) $this->parameters["mode"] = ""; if (!isset($this->parameters["speed"])) $this->parameters["speed"] = ""; if (!isset($this->parameters["pause"])) $this->parameters["pause"] = ""; if (!isset($this->parameters["display_quantity"])) $this->parameters["display_quantity"] = ""; if (!isset($this->parameters["slide_quantity"])) $this->parameters["slide_quantity"] = ""; if (!isset($this->parameters["autostart"])) $this->parameters["autostart"] = ""; if (!isset($this->parameters["autohover"])) $this->parameters["autohover"] = ""; if (!isset($this->parameters["pager"])) $this->parameters["pager"] = ""; if (!isset($this->parameters["used_template"])) $this->parameters["used_template"] = ""; $form = "
parameters['autostart'] ? "checked='checked'" : "")."/> ".$this->format_text($this->msg['cms_module_carousel_view_carousel_yes'])."  parameters['autostart'] ? "checked='checked'" : "")."/> ".$this->format_text($this->msg['cms_module_carousel_view_carousel_no'])."
parameters['autohover'] ? "checked='checked'" : "")."/> ".$this->format_text($this->msg['cms_module_carousel_view_carousel_yes'])."  parameters['autohover'] ? "checked='checked'" : "")."/> ".$this->format_text($this->msg['cms_module_carousel_view_carousel_no'])."
parameters['pager'] ? "checked='checked'" : "")."/> ".$this->format_text($this->msg['cms_module_carousel_view_carousel_yes'])."  parameters['pager'] ? "checked='checked'" : "")."/> ".$this->format_text($this->msg['cms_module_carousel_view_carousel_no'])."
". parent::get_form() ."
".notice_tpl::gen_tpl_select("cms_module_common_view_django_template_record_content",$this->parameters['used_template'])."
"; return $form; } public function save_form(){ global $cms_module_carousel_view_carousel_mode; global $cms_module_carousel_view_carousel_speed; global $cms_module_carousel_view_carousel_pause; global $cms_module_carousel_view_carousel_display_quantity; global $cms_module_carousel_view_carousel_slide_quantity; global $cms_module_carousel_view_carousel_autostart; global $cms_module_carousel_view_carousel_css; global $cms_module_common_view_django_template_record_content; global $cms_module_carousel_view_carousel_autohover; global $cms_module_carousel_view_carousel_pager; $this->parameters['mode'] = $cms_module_carousel_view_carousel_mode; $this->parameters['speed'] = (int) $cms_module_carousel_view_carousel_speed; $this->parameters['pause'] = (int) $cms_module_carousel_view_carousel_pause; $this->parameters['display_quantity'] = (int) $cms_module_carousel_view_carousel_display_quantity; $this->parameters['slide_quantity'] = (int) $cms_module_carousel_view_carousel_slide_quantity; $this->parameters['autostart'] = $cms_module_carousel_view_carousel_autostart==1 ? true : false; $this->parameters['css'] = stripslashes($cms_module_carousel_view_carousel_css); $this->parameters['used_template'] = $cms_module_common_view_django_template_record_content; $this->parameters['autohover'] = $cms_module_carousel_view_carousel_autohover==1 ? true : false; $this->parameters['pager'] = $cms_module_carousel_view_carousel_pager==1 ? true : false; return parent::save_form(); } public function get_headers($datas=array()){ global $base_path; $headers = parent::get_headers($datas); $headers[]= ""; $args = array( 'do' => "generate_css" ); $headers[]= ""; return $headers; } public function render($datas){ $html2return = ""; if(count($datas['records'])){ $id = "carousel_".$this->get_module_dom_id(); $datas['id']=$this->get_module_dom_id(); $html2return.= H2o::parseString($this->parameters['active_template'])->render($datas); $html2return.= " "; } return $html2return; } public function execute_ajax(){ global $do; $response = array(); switch($do){ case "generate_css" : $response['content'] = $this->generate_css(); $response['content-type'] = 'text/css'; break; } return $response; } protected function generate_css(){ return str_replace("{{identifiant_dom_du_cadre}}",$this->get_module_dom_id(),$this->parameters['css']); } protected function get_managed_template_form($cms_template){ global $opac_url_base; $form =""; if($cms_template != "new"){ $infos = $this->managed_datas['templates'][$cms_template]; }else{ $infos = array( 'name' => "Nouveau Template", 'content' => $this->default_template ); } if(!$this->managed_datas) $this->managed_datas = array(); if (!isset($this->managed_datas['css']) || $this->managed_datas['css'] == ""){ $this->managed_datas['css'] = " #{{identifiant_dom_du_cadre}} { overflow : hidden; } #{{identifiant_dom_du_cadre}} .bx-wrapper { width : inherit !important; height : inherit !important; } #{{identifiant_dom_du_cadre}} ul li { text-align: center; } #{{identifiant_dom_du_cadre}} .bx-wrapper { width : inherit !important; height : inherit !important; } #{{identifiant_dom_du_cadre}} ul li a { display: block; width: 150px; margin: 0 auto; text-align: center; text-decoration: none; } /* pour l'image vide...*/ #{{identifiant_dom_du_cadre}} .bx-wrapper ul li a img { height: 145px; background-repeat: no-repeat; -moz-box-shadow: 1px 1px 2px #cccccc; -o-box-shadow: 1px 1px 2px #cccccc; -webkit-box-shadow: 1px 1px 2px #cccccc; box-shadow: 1px 1px 2px #cccccc; }"; } //nom $form.="
"; //contenu $form.="
".$this->get_format_data_structure_tree("cms_module_common_view_django_template_content")."
"; // css $form.="
"; 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; global $cms_module_carousel_view_carousel_manage_default_css; 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), 'css' => stripslashes($cms_module_carousel_view_carousel_manage_default_css) ); } return $managed_datas; } public function get_format_data_structure(){ if (static::class == "cms_module_carousel_view_carousel") { $datas = new cms_module_carousel_datasource_notices(); $format_datas = $datas->get_format_data_structure(); $format_datas[0]['children'][] = array( 'var' => "records[i].content", 'desc' => $this->msg['cms_module_carousel_view_carousel_record_content_desc'] ); $format_datas = array_merge($format_datas,parent::get_format_data_structure()); return $format_datas; } return parent::get_format_data_structure(); } }