get_simple_search_form();
break;
case 'advanced_search':
$entity_form = $this->get_advanced_search_form();
break;
case 'add':
$entity_form = '
';
if($form_display_mode == 2) {
$entity_form.= $this->get_html_button($this->get_change_link(1), $msg['selector_toggle_simple_entry_data']);
ob_start();
$this->get_advanced_form();
$entity_form.= ob_get_contents();
ob_end_clean();
} else {
$entity_form.= $this->get_html_button($this->get_change_link(2), $msg['selector_toggle_full_entry_data']);
$entity_form.= $this->get_form();
}
$entity_form.='
';
break;
case 'update':
ob_start();
if($form_display_mode == 2) {
$saved_id = $this->get_advanced_save();
} else {
$saved_id = $this->save();
}
// /**
// * TODO -> retourner une structure json de l'objet que l'ont vient d'ajouter (isbd + id);
// */
// print $this->get_search_form();
// print $this->get_js_script();
// if($saved_id) {
// print $this->get_display_object(0, $saved_id);
// }
$entities_controller = $this->get_entities_controller_instance($saved_id);
$instance = $entities_controller->get_object_instance();
$html = ob_get_clean();
print
'';
break;
case 'results_search':
ob_start();
print $this->results_search();
$results_search = ob_get_contents();
ob_end_clean();
$entity_form = $results_search;
break;
case 'element_display':
global $id_authority;
$id_authority += 0;
if($id_authority) {
$elements_authorities_selectors_list_ui = new elements_authorities_selectors_list_ui(array($id_authority), 1, 1);
$elements = $elements_authorities_selectors_list_ui->get_elements_list();
search_authorities::get_caddie_link();
$entity_form = $elements;
}
break;
default:
print $this->get_sel_header_template();
print $this->get_js_script();
print $this->get_sel_footer_template();
print $this->get_sub_tabs();
break;
}
if ($entity_form) {
header("Content-Type: text/html; charset=UTF-8");
print encoding_normalize::utf8_normalize($entity_form);
}
}
protected function get_advanced_categ() {
global $what;
$categ = '';
switch($what) {
case 'auteur':
$categ = 'auteurs';
break;
case 'editeur':
$categ = 'editeurs';
break;
case 'collection':
$categ = 'collections';
break;
case 'subcollection':
$categ = 'souscollections';
break;
case 'categorie':
$categ = 'categories';
break;
case 'serie':
$categ = 'series';
break;
case 'indexint':
$categ = 'indexint';
break;
case 'titre_uniforme':
$categ = 'titres_uniformes';
break;
case 'authperso':
$categ = 'authperso';
break;
}
return $categ;
}
protected function get_advanced_form() {
global $form_display_mode;
$entities_controller = $this->get_entities_controller_instance();
$entities_controller->set_url_base(static::get_base_url()."&action=update&form_display_mode=".$form_display_mode);
$entities_controller->proceed_form();
}
protected function get_advanced_save() {
$entities_controller = $this->get_entities_controller_instance();
$entities_controller->set_url_base(static::get_base_url());
return $entities_controller->proceed_update();
}
protected function get_add_link() {
global $no_display;
global $pmb_popup_form_display_mode;
global $form_display_mode;
$link = static::get_base_url();
if(!$form_display_mode) {
$form_display_mode = $pmb_popup_form_display_mode;
}
if($form_display_mode == 2) {
$link .= "&categ=".$this->get_advanced_categ()."&sub=form";
}
$link .= "&form_display_mode=".$form_display_mode;
$link .= "&action=add&deb_rech='+this.form.f_user_input.value+'&no_display=".$no_display;
return $link;
}
protected function get_add_label() {
global $msg;
return $msg[static::class.'_add'];
}
protected function get_search_form() {
global $charset;
global $bt_ajouter;
$sel_search_form = $this->get_sel_search_form_template();
if($bt_ajouter == "no"){
$sel_search_form = str_replace("!!bouton_ajouter!!", '', $sel_search_form);
} else {
$bouton_ajouter = "get_add_link()."'\" value='".htmlentities($this->get_add_label(), ENT_QUOTES, $charset)."' />";
$sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form);
}
return $sel_search_form;
}
protected function get_display_list() {
global $nb_per_page;
global $page;
global $no_display;
$display_list = '';
if(!$page) {
$debut = 0;
} else {
$debut = ($page-1)*$nb_per_page;
}
$searcher_instance = $this->get_searcher_instance();
$this->nbr_lignes = $searcher_instance->get_nb_results();
if($this->nbr_lignes) {
$sorted_objects = $searcher_instance->get_sorted_result('default', $debut, $nb_per_page);
foreach ($sorted_objects as $object_id) {
$display_list .= $this->get_display_object($object_id);
}
$display_list .= $this->get_pagination();
} else {
$display_list .= $this->get_message_not_found();
}
return $display_list;
}
public function get_sel_search_form_template() {
global $msg, $charset;
$sel_search_form ="
";
return $sel_search_form;
}
protected function get_message_not_found() {
global $msg;
return $msg['no_'.str_replace('selector_', '', static::class).'_found'];
}
protected function get_change_link($display_mode) {
global $no_display;
global $deb_rech;
$link = static::get_base_url();
if($display_mode == 2) {
$link .= "&categ=".$this->get_advanced_categ()."&sub=form";
}
$link .= "&form_display_mode=".$display_mode;
$link .= "&action=add&deb_rech=".$deb_rech."&no_display=".$no_display;
return $link;
}
protected function get_html_button($location='', $label='') {
global $charset;
return "";
}
protected function get_search_fields_filtered_objects_types() {
return array($this->get_objects_type(), "authorities");
}
protected function get_searcher_tabs_instance() {
if(!isset($this->searcher_tabs_instance)) {
$this->searcher_tabs_instance = new searcher_selectors_tabs('authorities');
}
return $this->searcher_tabs_instance;
}
protected function get_search_perso_instance($id=0) {
return new search_perso($id, 'AUTHORITIES');
}
protected function get_search_instance() {
$search = new search_authorities(true, 'search_fields_authorities');
$search->add_context_parameter('in_selector', true);
return $search;
}
}
?>