objects_type = 'concepts'; } public function proceed() { global $msg; global $class_path; global $action; global $objs, $caller, $element, $order, $callback; global $range; global $param1, $param2; global $item_uri; global $deflt_concept_scheme; global $bt_ajouter; global $nb_per_page_gestion; global $authority_statut; global $pmb_base_url; global $mode; global $element_id; global $att_id_filter; global $concept_scheme; global $deb_rech; global $dyn; global $page; $entity_form = ''; $autoloader = new autoloader(); $autoloader->add_register("onto_class",true); global $base_url; $base_url = $this->get_base_url(); $params_array = array( 'base_url' => $base_url, 'categ'=>'concepts', 'sub'=> 'concept', 'objs'=>$objs, 'action' => $action, 'nb_per_page'=> $nb_per_page_gestion, 'id'=>'', 'parent_id'=>'', 'param1'=> $param1, 'param2'=> $param2, 'range'=>$range, 'page' => '1', 'user_input'=>'', 'item_uri' => $item_uri, 'concept_scheme'=>((isset($concept_scheme) && $concept_scheme != '') ? $concept_scheme : ((isset($_SESSION['onto_skos_concept_last_concept_scheme']) && ($_SESSION['onto_skos_concept_last_concept_scheme'] !== "")) ? $_SESSION['onto_skos_concept_last_concept_scheme'] : $deflt_concept_scheme)), 'only_top_concepts' => ((!isset($skos_concept_search_form_submitted) && isset($_SESSION['onto_skos_concept_only_top_concepts'])) ? $_SESSION['onto_skos_concept_only_top_concepts'] : 0), 'base_resource'=> "autorites.php", 'element' => $element, 'caller' => $caller, 'deb_rech' => $deb_rech, /* Pour le replace */ 'by' => '', 'dyn' => $dyn, 'link_save' => '', 'authority_statut' => $authority_statut, 'selector_context' => 1, 'type' => '', 'callback' => '', 'return_concept_id' => false ); if(!isset($element) || $element != 'concept'){ if(empty($action)){ $action = "list_selector"; } $onto_ui = new onto_ui($class_path."/rdf/skos_pmb.rdf", skos_onto::get_store(), "", skos_datastore::get_store(), "", array(), 'http://www.w3.org/2004/02/skos/core#prefLabel', new onto_param($params_array)); $onto_ui->proceed(); }else { switch($action){ case 'simple_search': $entity_form = $this->get_simple_search_form(); break; case 'advanced_search': $entity_form = $this->get_advanced_search_form(); break; case 'add': case 'list': case 'last': case 'search': $onto_ui = new onto_ui($class_path."/rdf/skos_pmb.rdf", skos_onto::get_store(), "", skos_datastore::get_store(), "", array(), 'http://www.w3.org/2004/02/skos/core#prefLabel', new onto_param($params_array)); ob_start(); $onto_ui->proceed(); $entity_form = ob_get_contents(); ob_end_clean(); break; case 'results_search': ob_start(); print $this->results_search(); $entity_form = ob_get_contents(); ob_end_clean(); break; case 'element_display': global $id_authority, $caller, $element; $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; case 'update': $onto_ui = new onto_ui($class_path."/rdf/skos_pmb.rdf", skos_onto::get_store(), "", skos_datastore::get_store(), "", array(),'http://www.w3.org/2004/02/skos/core#prefLabel', new onto_param($params_array)); $id = $onto_ui->proceed(); $auth_instance = new authority(0, $id, AUT_TABLE_CONCEPT); $concept_instance = $auth_instance->get_object_instance(); $entity_form = ''; break; case 'authority_searcher': $entity_form = "
"; //onglets de recherche autorites $searcher_tabs = new searcher_tabs('authorities'); ob_start(); $searcher_tabs->proceed($this->get_current_mode(), '','selector'); $entity_form.= ob_get_contents(); ob_end_clean(); $entity_form.= $this->get_search_tabs(); break; default: print $this->get_js_script(); print $this->get_sub_tabs(); break; } if ($entity_form) { header("Content-Type: text/html; charset=UTF-8"); print encoding_normalize::utf8_normalize($entity_form); } if($action=='selector_save'){ print ''; } } } public static function get_params_url() { global $objs, $element, $unique_scheme, $return_concept_id, $concept_scheme; global $order, $grammar, $perso_id, $custom_prefixe, $perso_name; global $att_id_filter; $params_url = parent::get_params_url(); $params_url .= ($objs ? "&objs=".$objs : ""); $params_url .= ($element ? "&element=".$element : ""); $params_url .= ($unique_scheme ? "&unique_scheme=".$unique_scheme : ""); $params_url .= ($return_concept_id ? "&return_concept_id=".$return_concept_id : ""); $params_url .= ($concept_scheme ? "&concept_scheme=".$concept_scheme : ""); $params_url .= ($order ? "&order=".$order : ""); $params_url .= ($grammar ? "&grammar=".$grammar : ""); $params_url .= ($perso_id ? "&perso_id=".$perso_id : ""); $params_url .= ($custom_prefixe ? "&custom_prefixe=".$custom_prefixe : ""); $params_url .= ($perso_name ? "&perso_name=".$perso_name : ""); $params_url .= ($att_id_filter ? "&att_id_filter=".$att_id_filter : ""); return $params_url; } protected function get_change_link($display_mode) { $link = static::get_base_url(); if($display_mode == 2) { $link .= "&action=edit"; } else { $link .= "&action=selector_add"; } 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() { return new search_authorities('search_fields_authorities'); } protected function get_sub_tabs(){ global $mode; $current_url = static::get_selector_url(); $current_url = str_replace('select.php?', 'ajax.php?module=selectors&', $current_url); $searcher_tab = $this->get_searcher_tabs_instance(); $url_concept = static::get_base_url(); $url_concept = str_replace('select.php?', 'ajax.php?module=selectors&', $url_concept); $script = ' '; return $script ; } protected function get_search_tabs(){ global $mode; $current_url = static::get_selector_url(); $current_url = str_replace('select.php?', 'ajax.php?module=selectors&', $current_url); $searcher_tab = $this->get_searcher_tabs_instance(); $url_concept = static::get_base_url(); $url_concept = str_replace('select.php?', 'ajax.php?module=selectors&', $url_concept); $script = ' '; return $script ; } protected function get_current_mode(){ global $mode; if(empty($mode)){ $searcher_tab = $this->get_searcher_tabs_instance(); $mode = $searcher_tab->get_default_selector_mode(); } return $mode; } protected function get_selector_url(){ global $base_path; global $entity_type; global $mode; global $caller; global $no_display, $bt_ajouter, $dyn, $callback, $infield; global $max_field, $field_id, $field_name_id, $add_field, $nb_per_page; $selector_url = $base_path."/select.php?what=".$this->get_what_from_type($entity_type)."&caller=".$caller."&mode=".$this->get_current_mode(); $selector_url .= static::get_params_url(); if($no_display) $selector_url .= "&no_display=".$no_display; if($bt_ajouter) $selector_url .= "&bt_ajouter=".$bt_ajouter; if($dyn) $selector_url .= "&dyn=".$dyn; if($callback) $selector_url .= "&callback=".$callback; if($infield) $selector_url .= "&infield=".$infield; if($max_field) $selector_url .= "&max_field=".$max_field; if($field_id) $selector_url .= "&field_id=".$field_id; if($field_name_id) $selector_url .= "&field_name_id=".$field_name_id; if($add_field) $selector_url .= "&add_field=".$add_field; if($nb_per_page) $selector_url .= "&nb_per_page=".$nb_per_page; foreach($_GET as $name => $value){ if(strpos($selector_url, $name) === false){ $selector_url .= "&".$name."=".$value; } } return $selector_url; } protected function get_composed_concept($element_id){ $authority = new authority($element_id); $vedette = new vedette_composee(0, 'rameau'); $composed_concept = array(); $vedette_class_name = $authority->get_vedette_class(); $vedette_field = $vedette->get_at_available_field_class_name($vedette_class_name); $num_type = $vedette_field['num']; $composed_concept = concept::get_concepts_composed_with_entity($authority->get_num_object(), $num_type, 'rameau', ''); if(!count($composed_concept)){ if(class_exists($vedette_class_name)){ $vedette_elt = new $vedette_class_name($num_type, $authority->get_num_object()); $vedette->add_element($vedette_elt, 'subdivision_tete', 0); $vedette->update_label(); $vedette->save(); $composed_concept = array($this->create_concept_from_vedette($vedette)); } } /** * TODO: Ajouter le cas de retour d'une liste de * concepts utilisant cette autorité dans sa composition * */ return $composed_concept; } protected function create_concept_from_vedette($vedette){ global $base_path; global $opac_url_base; $autoloader = new autoloader(); $autoloader->add_register("onto_class",true); $data_store_config = array( /* db */ 'db_name' => DATA_BASE, 'db_user' => USER_NAME, 'db_pwd' => USER_PASS, 'db_host' => SQL_SERVER, /* store */ 'store_name' => 'rdfstore', /* stop after 100 errors */ 'max_errors' => 100, 'store_strip_mb_comp_str' => 0 ); $tab_namespaces=array( "skos" => "http://www.w3.org/2004/02/skos/core#", "dc" => "http://purl.org/dc/elements/1.1", "dct" => "http://purl.org/dc/terms/", "owl" => "http://www.w3.org/2002/07/owl#", "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs" => "http://www.w3.org/2000/01/rdf-schema#", "xsd" => "http://www.w3.org/2001/XMLSchema#", "pmb" => "http://www.pmbservices.fr/ontology#" ); $store = ARC2::getStore($data_store_config); $onto_store_config = array( /* db */ 'db_name' => DATA_BASE, 'db_user' => USER_NAME, 'db_pwd' => USER_PASS, 'db_host' => SQL_SERVER, /* store */ 'store_name' => 'ontology', /* stop after 100 errors */ 'max_errors' => 100, 'store_strip_mb_comp_str' => 0 ); $handler = new onto_handler($base_path."/classes/rdf/skos_pmb.rdf", "arc2", $onto_store_config, "arc2", $data_store_config, $tab_namespaces, 'http://www.w3.org/2004/02/skos/core#prefLabel'); $uri = onto_common_uri::get_new_uri("",$opac_url_base."concept#"); $num_concept = onto_common_uri::get_id($uri); $query = "insert into