parameters) || !is_array($this->parameters)){
$this->parameters=[];
}
if(!isset($this->parameters['help'])) $this->parameters['help'] = 0;
if(!isset($this->parameters['title'])) $this->parameters['title'] = '';
if(!isset($this->parameters['link_search_advanced'])) $this->parameters['link_search_advanced'] = 0;
if(!isset($this->parameters['link_search_advanced_go_tab'])) $this->parameters['link_search_advanced_go_tab'] = '';
if(!isset($this->parameters['input_placeholder'])) $this->parameters['input_placeholder'] = '';
if(!isset($this->parameters['others_links'])) $this->parameters['others_links'] = [];
if(!isset($this->parameters['nofill'])) $this->parameters['nofill'] = 0;
if(!isset($this->parameters['limit_completion'])) $this->parameters['limit_completion'] = 1;
}
public function get_form(){
global $charset;
$form ="
".$this->get_selector_go_tabs()."
";
$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;
}
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_link_search_advanced_go_tab;
global $cms_module_search_view_input_placeholder;
global $cms_module_search_view_others_links;
global $cms_module_search_view_nofill;
global $cms_module_search_view_limit_completion;
if(!isset($cms_module_search_view_help)) $cms_module_search_view_help = 0;
if(!isset($cms_module_search_view_title)) $cms_module_search_view_title = '';
if(!isset($cms_module_search_view_link_search_advanced)) $cms_module_search_view_link_search_advanced = 0;
if(!isset($cms_module_search_view_link_search_advanced_go_tab)) $cms_module_search_view_link_search_advanced_go_tab = '';
if(!isset($cms_module_search_view_input_placeholder)) $cms_module_search_view_input_placeholder = '';
if(!isset($cms_module_search_view_others_links)) $cms_module_search_view_others_links = [];
if(!isset($cms_module_search_view_nofill)) $cms_module_search_view_nofill = 0;
if(!isset($cms_module_search_view_limit_completion)) $cms_module_search_view_limit_completion = 1;
$this->parameters = [];
$this->parameters['help'] = (int) $cms_module_search_view_help;
$this->parameters['title'] = stripslashes($cms_module_search_view_title);
$this->parameters['link_search_advanced'] = (int) $cms_module_search_view_link_search_advanced;
$this->parameters['link_search_advanced_go_tab'] = stripslashes($cms_module_search_view_link_search_advanced_go_tab);
$this->parameters['input_placeholder'] = stripslashes($cms_module_search_view_input_placeholder);
$this->parameters['nofill'] = (int) $cms_module_search_view_nofill;
$this->parameters['limit_completion'] = (int) $cms_module_search_view_limit_completion;
$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'] = (int) $other_link['linktarget'];
$nb_others_link++;
}
}
}
$this->parameters['others_links'] = $others_links;
return parent::save_form();
}
protected function get_tabs() {
global $opac_allow_personal_search, $opac_allow_extended_search, $opac_allow_extended_search_authorities;
global $opac_allow_term_search, $opac_allow_tags_search, $opac_show_onglet_perio_a2z;
$tabs = array();
$tabs[] = 'simple_search';
if ($opac_allow_personal_search) {
$tabs[] = 'search_perso';
}
if ($opac_allow_extended_search) {
$tabs[] = 'extended_search';
}
if ($opac_allow_extended_search_authorities) {
$tabs[] = 'extended_search_authorities';
}
if ($opac_allow_term_search) {
$tabs[] = 'term_search';
}
if ($opac_allow_tags_search) {
$tabs[] = 'tags_search';
}
if ($opac_show_onglet_perio_a2z) {
$tabs[] = 'perio_a2z';
}
return $tabs;
}
protected function get_selector_go_tabs() {
$selector = "
";
return $selector;
}
public function render($datas){
global $base_path,$include_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_concept,$opac_modules_search_docnum,$opac_simple_search_suggestions;
global $dest,$user_query,$charset;
$onsubmit = "if (".$this->get_module_dom_id()."_searchbox.user_query.value.length == 0) { ".$this->get_module_dom_id()."_searchbox.user_query.value='*';}";
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";
}
//juste une searchbox...
if(count($datas) == 1){
if ($datas[0]['universe']) {
if($datas[0]['default_segment'] != 0){
$action = $base_path."/index.php?lvl=search_segment&action=segment_results&id=".$datas[0]['default_segment'];
}else{
$action=$base_path."/index.php?lvl=search_universe&id=".$datas[0]['universe'];
}
}else if ($datas[0]['page']>0) {
$action = $base_path."/index.php?lvl=cmspage&pageid=".$datas[0]['page'];
}
if (strpos($datas[0]['page'], 'view_') !== false) {
$action.= "&opac_view=".substr($datas[0]['page'], 5);
}
}else{
$onsubmit.= $this->get_module_dom_id()."_change_dest();";
}
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 ;
if ($opac_modules_search_concept==2) $look["look_CONCEPT"] = 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;
}
}