get_sel_header_template(); print $this->get_search_form(); print $this->get_js_script(); if(!$this->user_input) { $this->user_input = '*'; } print $this->get_display_list(); print $this->get_sel_footer_template(); } protected function get_display_element($index='', $value='') { global $charset; global $caller; global $callback; $display = "
".htmlentities($value,ENT_QUOTES, $charset)."
"; return $display; } protected function get_display_list() { global $charset; global $nb_per_page; global $page; global $base_path; $display_list = ''; if(!$page) { $debut = 0; } else { $debut = ($page-1)*$nb_per_page; } $list = array(); $user_input = str_replace('*', '', $this->user_input); if(!$this->source_id && $this->source_url && $this->connector_path && $this->connector_name) { require_once($base_path."/admin/connecteurs/in/".$this->connector_path."/".$this->connector_name.".class.php"); eval("\$conn=new ".$this->connector_name."(\"".$base_path."/admin/connecteurs/in/".$this->connector_path."\");"); } else { $conn = connecteurs::get_connector_instance_from_source_id($this->source_id); } if ($conn) { $source_params = $conn->get_source_params($this->source_id); $parameters = unserialize($source_params["PARAMETERS"]); if(empty($parameters['url']) && !empty($this->source_url)) { $parameters['url'] = $this->source_url; } switch ($conn->get_id()) { case 'cairn': case 'oai': case 'divercities' : //Intérogation du serveur $oai_p = new oai20($parameters['url'], $charset, $conn->timeout); if (empty($oai_p->error)) { if (!empty($oai_p->has_feature("SETS"))) { foreach ($oai_p->sets as $code => $set) { if (empty($user_input) || strpos($set['name'], $user_input) !== false) { $description = ''; if(!empty($set['description'])) { if(strlen($set['description']) > 80) { $description .= substr($set['description'], 0, 80)." [...]"; } else { $description .= $set['description']; } } $list[$code] = $set['name'].($description ? " (".$description.")" : ""); } } } } break; default: break; } } $this->nbr_lignes = count($list); if($this->nbr_lignes) { $list = array_slice($list, $debut, $nb_per_page, true); foreach ($list as $key=>$element) { $display_list .= $this->get_display_element($key, $element); } $display_list .= $this->get_pagination(); } else { $display_list .= $this->get_message_not_found(); } return $display_list; } public function set_source_id($source_id) { $this->source_id = $source_id; } public function set_source_url($source_url) { $this->source_url = $source_url; } public function set_connector_path($connector_path) { $this->connector_path = $connector_path; } public function set_connector_name($connector_name) { $this->connector_name = $connector_name; } } ?>