module_path = str_replace(basename(__FILE__),"",__FILE__); parent::__construct($id); } public function get_manage_form(){ global $base_path; global $search_dest; $form="

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

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

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

"; } } $form.=" ".$this->format_text($this->msg['cms_module_search_add_search_dest'])." "; $form.="
"; if($search_dest){ $form.=$this->get_managed_form_start(array('search_dest'=>$search_dest)); $form.=$this->get_managed_search_dest_form($search_dest); $form.=$this->get_managed_form_end(); } $form.="
"; return $form; } protected function get_managed_search_dest_form($search_dest){ global $opac_opac_view_activate; if($search_dest != "new"){ $infos = $this->managed_datas['module']['search_dests'][$search_dest]; }else{ $infos = array( 'name' => "", 'page' => 0 ); } $form = ""; //nom $form.="
"; //page $form.="
"; return $form; } protected function get_opac_views_list(){ $opac_views = array(); $query = "select opac_view_id, opac_view_name from opac_views"; $result = pmb_mysql_query($query); if(pmb_mysql_num_rows($result)){ while($row = pmb_mysql_fetch_object($result)) { $opac_views[$row->opac_view_id] = $row->opac_view_name; } } return $opac_views; } protected function gen_options_opac_view($selected){ $opac_views = $this->get_opac_views_list(); $select = " "; foreach($opac_views as $key => $name){ $select.=" "; } $select.= " "; return $select; } public function save_manage_form(){ global $search_dest; global $search_dest_delete; global $cms_module_search_search_dest_name; global $cms_module_search_page_dest; $params = $this->managed_datas['module']; if($search_dest_delete){ unset($params['search_dests'][$search_dest_delete]); }else{ if($search_dest == "new"){ $search_dest = "search_dest".(cms_module_search::get_max_search_dest_id($params['search_dests'])+1); } $params['search_dests'][$search_dest] = array( 'name' => stripslashes($cms_module_search_search_dest_name), 'page' => stripslashes($cms_module_search_page_dest) ); } return $params; } protected static function get_max_search_dest_id($datas){ $max = 0; if(count($datas)){ foreach ($datas as $key => $val){ $key = str_replace("search_dest","",$key)*1; if($key>$max) $max = $key; } } return $max; } }