default_template = "

{{record.header}}

{{record.content}}
"; } public function get_form(){ if(!isset($this->parameters['height'])) $this->parameters['height'] = '500'; if(!isset($this->parameters['last_event'])) $this->parameters['last_event'] = 0; $last_event_checked = ''; if ($this->parameters['last_event']) { $last_event_checked = 'checked'; } $form = parent::get_form(); $form.="
"; return $form; } public function save_form(){ $this->parameters['height'] = $this->get_value_from_form('height')*1; if($this->parameters['height'] == 0){ $this->parameters['height'] = 500; } if ($this->get_value_from_form('last_event')) { $this->parameters['last_event'] = $this->get_value_from_form('last_event'); } else { $this->parameters['last_event'] = 0; } return parent::save_form(); } public function get_headers($datas = array()){ global $base_path; $headers = parent::get_headers($datas); $headers[]= ""; $headers[]= ""; return $headers; } public function render($datas){ global $base_path; $json = $this->get_JSON($datas['items']); if(count($json['events']) == 0){ $json['events'][] = array( 'start_date' => array( 'year' => 1985, 'month' => 06, 'day' => 17, ), 'text' => array( 'headline' => 'headline', 'text' => 'text' ) ); } $html = '
'; $html.= ""; return $html; } protected function get_JSON($infos){ $json = array(); $title = array( 'start_date' => array( ), 'text' => array( 'text' => "TIMELINE" ) ); $events = $eras = array(); for($i=0 ; $i array( 'year' => date('Y',strtotime($infos[$i]['start_date'])), 'month' => date('m',strtotime($infos[$i]['start_date'])), 'day' =>date('d',strtotime($infos[$i]['start_date'])), ), 'text' => array( 'headline' => $infos[$i]['title'], 'text' => (!empty($infos[$i]['resume']) ? $infos[$i]['resume'] : '') ) ); if($infos[$i]['end_date']){ $event['end_date'] = array( 'year' => date('Y',strtotime($infos[$i]['end_date'])), 'month' => date('m',strtotime($infos[$i]['end_date'])), 'day' =>date('d',strtotime($infos[$i]['end_date'])), ); } if($infos[$i]['image']){ $event['media'] = array( 'url' => $infos[$i]['image'], 'thumbnail' => $infos[$i]['image'] ); } $events[]= $event; } $json = array( 'title' => $title, 'events' => $events, 'eras' => $eras ); return $json; } public function get_format_data_structure(){ return array_merge(array( array( 'var' => "record", 'desc'=> "", 'children' => array( array( 'var' => "record.header", 'desc'=> $this->msg['cms_module_common_view_record_header_desc'] ), array( 'var' => "record.content", 'desc'=> $this->msg['cms_module_common_view_record_content_desc'] ), array( 'var' => "record.link", 'desc'=> $this->msg['cms_module_common_view_record_link_desc'] ) ) ) ),parent::get_format_data_structure()); } }