id = intval($id); $this->type = $type; $this->is_external = $is_external; } public function proceed() { global $sub; global $action; if($sub == 'facettes_authorities') { print $this->get_authorities_tabs(); } $facette_search = self::get_facette_search_opac_instance($this->type, $this->is_external); switch($action) { case "add": case "edit": $facette = $this->get_facette_instance(); $facette->set_type($this->type); print $facette->get_form(); break; case "save": $facette = $this->get_facette_instance(); $facette->set_type($this->type); $facette->set_properties_from_form(); $facette->save(); print $facette_search->get_display_list(); break; case "delete": $facette = $this->get_facette_instance(); $facette->delete(); print $facette_search->get_display_list(); break; case "up": facette_search_opac::facette_up($this->id, $this->type); print $facette_search->get_display_list(); break; case "down": facette_search_opac::facette_down($this->id, $this->type); print $facette_search->get_display_list(); break; case "order": facette_search_opac::facette_order_by_name($this->type); print $facette_search->get_display_list(); break; default: print $facette_search->get_display_list(); break; } } public function get_authority_tab($type, $label='') { global $msg; global $base_path; $url_base = $base_path.'/admin.php?categ=opac&sub=facettes_authorities'; return " ".$msg[$type]." "; } public function get_authorities_tabs() { $authorities_tabs = "
"; $authorities_tabs .= $this->get_authority_tab('authors'); $authorities_tabs .= $this->get_authority_tab('categories'); $authorities_tabs .= $this->get_authority_tab('publishers'); $authorities_tabs .= $this->get_authority_tab('collections'); $authorities_tabs .= $this->get_authority_tab('subcollections'); $authorities_tabs .= $this->get_authority_tab('series'); $authorities_tabs .= $this->get_authority_tab('titres_uniformes'); $authorities_tabs .= $this->get_authority_tab('indexint'); $authorities_tabs .= $this->get_authority_tab('authperso'); $authorities_tabs .= "
"; return $authorities_tabs; } public function proceed_ajax() { global $sub; global $action; global $type; global $list_crit,$sub_field; global $suffixe_id, $no_label; global $authperso_id, $field; switch($sub){ case "lst_fields_facet": case "lst_fields_facettes_authorities": case "lst_fields_facettes": if( strpos($type, "authperso") !== false && !empty($authperso_id)) { $type = "authperso_".$authperso_id; } $facettes = self::get_facette_search_opac_instance($type); print $facettes->create_list_fields($field); break; case "lst_facet": case "lst_facettes_authorities": case "lst_facettes": $facettes = self::get_facette_search_opac_instance($type); print $facettes->create_list_subfields($list_crit,$sub_field,$suffixe_id,$no_label); break; case "lst_facettes_external": $facettes_external = self::get_facette_search_opac_instance('notices_externes',1); print $facettes_external->create_list_subfields($list_crit,$sub_field,$suffixe_id,$no_label); break; default: $facette = $this->get_facette_instance(); switch($action) { case "add": case "edit": $facette->set_type($this->type); print $facette->get_form(); break; case "save": $facette->set_type($this->type); $facette->set_properties_from_form(); $facette->save(); return $facette->get_id(); break; } break; } } private function get_facette_instance() { if (strpos($this->type, "authperso") !== false) { return new facette_authperso($this->id, $this->is_external); } if (strpos($this->type, "external") !== false) { $this->is_external = true; } return new facette($this->id, $this->is_external); } public static function get_facette_search_opac_instance($type='notices', $is_external=false) { if (strpos($type, "authperso") !== false) { return new facette_authperso_search_opac($type, $is_external); } return new facette_search_opac($type, $is_external); } }