module_path = str_replace(basename(__FILE__),"",__FILE__); parent::__construct($id); } public function get_manage_form(){ global $base_path; //variables persos... global $calendar; $form="

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

"; if($this->managed_datas['module']['calendars']){ foreach($this->managed_datas['module']['calendars'] as $key => $cal){ $form.="

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

"; } } $form.=" ".$this->format_text($this->msg['cms_module_agenda_add_calendar'])." "; $form.="
"; if($calendar){ $form.=$this->get_managed_form_start(array('calendar'=>$calendar)); $form.=$this->get_managed_calendar_form($calendar); $form.=$this->get_managed_form_end(); } $form.="
"; return $form; } protected function get_managed_calendar_form($calendar){ if($calendar != "new"){ $infos = $this->managed_datas['module']['calendars'][$calendar]; }else{ $infos = array( 'name' => "" ); } $form = ""; //nom $form.="
"; //couleur $form.="
"; //type de contenu à prendre en compte... $form.="
"; //date évènement $form.="
"; return $form; } function save_manage_form(){ global $calendar; global $calendar_delete; global $cms_module_agenda_calendar_name; global $cms_module_agenda_calendar_color; global $cms_module_agenda_calendar_type; global $cms_module_agenda_calendar_start_date; global $cms_module_agenda_calendar_end_date; $params = $this->managed_datas['module']; if($calendar_delete){ unset($params['calendars'][$calendar_delete]); }else{ if($calendar == "new"){ $calendar = "calendar".(cms_module_agenda::get_max_calendar_id($params['calendars'])+1); } $params['calendars'][$calendar] = array( 'name' => stripslashes($cms_module_agenda_calendar_name), 'color' => stripslashes($cms_module_agenda_calendar_color), 'type' => stripslashes($cms_module_agenda_calendar_type), 'start_date' => stripslashes($cms_module_agenda_calendar_start_date), 'end_date' => stripslashes($cms_module_agenda_calendar_end_date) ); } return $params; } protected function get_max_calendar_id($datas){ $max = 0; if(count($datas)){ foreach ($datas as $key => $val){ $key = str_replace("calendar","",$key)*1; if($key>$max) $max = $key; } } return $max; } public function execute_ajax(){ global $calendar,$id_type; $response = array(); $fields = new cms_editorial_parametres_perso($id_type); $select="
"; $response['content'] = $select; $response['content-type'] = 'text/html'; return $response; } }