parameters) || !is_array($this->parameters)){
$this->parameters=array();
}
if(!isset($this->parameters['help'])) $this->parameters['help'] = '';
if(!isset($this->parameters['title'])) $this->parameters['title'] = '';
if(!isset($this->parameters['link_search_advanced'])) $this->parameters['link_search_advanced'] = '';
if(!isset($this->parameters['input_placeholder'])) $this->parameters['input_placeholder'] = '';
if(!isset($this->parameters['others_links'])) $this->parameters['others_links'] = '';
$form ="
";
if($opac_opac_view_activate) {
$form .= "
";
$form.=$this->gen_select_opac_view();
$form.="
";
}
$advanced_parameters = "
";
if(is_array($this->parameters['others_links']) && count($this->parameters['others_links'])) {
$advanced_parameters .= "
";
foreach ($this->parameters['others_links'] as $key=>$other_link) {
$advanced_parameters .= "
";
}
} else {
$advanced_parameters .= "
";
}
$advanced_parameters .= "
";
$form.= gen_plus("advanced_parameters", $this->format_text($this->msg['cms_module_search_view_advanced_parameters']),$advanced_parameters);
$form .= parent::get_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_select_opac_view(){
$opac_views = $this->get_opac_views_list();
if(!$this->parameters['link_to_opac_view']) $this->parameters['link_to_opac_view'] = 0;
$select = "
";
return $select;
}
public function save_form(){
global $cms_module_search_view_help;
global $cms_module_search_view_title;
global $cms_module_search_view_link_search_advanced;
global $cms_module_search_view_input_placeholder;
global $cms_module_search_view_link_to_opac_view;
global $cms_module_search_view_others_links;
if(!isset($this->parameters) || !is_array($this->parameters)){
$this->parameters=array();
}
$this->parameters['help'] = $cms_module_search_view_help+0;
$this->parameters['title'] = stripslashes($cms_module_search_view_title);
$this->parameters['link_search_advanced'] = $cms_module_search_view_link_search_advanced+0;
$this->parameters['input_placeholder'] = stripslashes($cms_module_search_view_input_placeholder);
$this->parameters['link_to_opac_view'] = $cms_module_search_view_link_to_opac_view+0;
$others_links = array();
$nb_others_link = 0;
if(is_array($cms_module_search_view_others_links)) {
foreach ($cms_module_search_view_others_links as $other_link) {
if($other_link['url'] != '') {
$others_links[$nb_others_link]['url'] = $other_link['url'];
$others_links[$nb_others_link]['label'] = stripslashes($other_link['label']);
$others_links[$nb_others_link]['linktarget'] = $other_link['linktarget']+0;
$nb_others_link++;
}
}
}
$this->parameters['others_links'] = $others_links;
return parent::save_form();
}
public function render($datas){
global $base_path,$opac_autolevel2;
global $opac_modules_search_title,$opac_modules_search_author,$opac_modules_search_publisher,$opac_modules_search_titre_uniforme;
global $opac_modules_search_collection,$opac_modules_search_subcollection,$opac_modules_search_category,$opac_modules_search_indexint;
global $opac_modules_search_keywords,$opac_modules_search_abstract,$opac_modules_search_docnum;
global $dest,$user_query,$charset;
//juste une searchbox...
if(count($datas) == 1){
if($datas[0]['page']>0){
$action = $base_path."/index.php?lvl=cmspage&pageid=".$datas[0]['page'];
}else{
if ($opac_autolevel2==2) {
$action = $base_path."/index.php?lvl=more_results&autolevel1=1";
} else {
$action = $base_path."/index.php?lvl=search_result&search_type_asked=simple_search";
}
}
$onsubmit = "if (".$this->get_module_dom_id()."_searchbox.user_query.value.length == 0) { ".$this->get_module_dom_id()."_searchbox.user_query.value='*';}".$this->get_module_dom_id()."_change_dest();";
}else{
if ($opac_autolevel2==2) {
$action = $base_path."/index.php?lvl=more_results&autolevel1=1";
} else {
$action = $base_path."/index.php?lvl=search_result&search_type_asked=simple_search";
}
$onsubmit = $this->get_module_dom_id()."_change_dest();";
}
if(!isset($this->parameters) || !is_array($this->parameters)){
$this->parameters=array();
}
if(isset($this->parameters['link_to_opac_view']) && $this->parameters['link_to_opac_view']) {
$action .= "&opac_view=".$this->parameters['link_to_opac_view'];
}
if ($opac_modules_search_title==2) $look["look_TITLE"]=1;
if ($opac_modules_search_author==2) $look["look_AUTHOR"]=1 ;
if ($opac_modules_search_publisher==2) $look["look_PUBLISHER"] = 1 ;
if ($opac_modules_search_titre_uniforme==2) $look["look_TITRE_UNIFORME"] = 1 ;
if ($opac_modules_search_collection==2) $look["look_COLLECTION"] = 1 ;
if ($opac_modules_search_subcollection==2) $look["look_SUBCOLLECTION"] = 1 ;
if ($opac_modules_search_category==2) $look["look_CATEGORY"] = 1 ;
if ($opac_modules_search_indexint==2) $look["look_INDEXINT"] = 1 ;
if ($opac_modules_search_keywords==2) $look["look_KEYWORDS"] = 1 ;
if ($opac_modules_search_abstract==2) $look["look_ABSTRACT"] = 1 ;
$look["look_ALL"] = 1 ;
if ($opac_modules_search_docnum==2) $look["look_DOCNUM"] = 1;
$html = "
";
return $html;
}
public function get_headers($datas=array()){
global $base_path;
$headers = array();
$headers[] = "
";
return $headers;
}
}