render(array('concepts_list' => $datas, 'parameters' => $parameters)); // return H2o::parseString(${$template})->render(array('concepts_list' => $datas, 'parameters' => $parameters)); } /** * Retourne l'affichage des concepts liés à une notice * * Recompose le tableau de paramètres via les globales et transmet le bon template au render * @param skos_concepts_list $concepts_list Liste des concepts associés à la notice * @return string */ static public function get_list_in_notice($concepts_list, $all_links=true) { global $msg; global $thesaurus_concepts_concept_in_line; $concepts = $concepts_list->get_concepts(); $datas = array( 'title' => $msg['skos_view_concepts_concepts'], 'elements' => self::get_sorted_concepts($concepts, $all_links) ); return self::render($datas, "skos_view_concepts_list_in_notice", array('concepts_in_line' => $thesaurus_concepts_concept_in_line*1)); } /** * Retourne l'affichage des concepts liés à une autorité * * Recompose le tableau de paramètres via les globales et transmet le bon template au render * @param skos_concepts_list $concepts_list Liste des concepts associés à l'autorité * @return string */ static public function get_list_in_authority($concepts_list) { global $thesaurus_concepts_concept_in_line; global $msg; $concepts = $concepts_list->get_concepts(); $datas = array( 'title' => $msg['skos_view_concepts_concepts'], 'elements' => self::get_sorted_concepts($concepts, true) ); return self::render($datas, "skos_view_concepts_list_in_authority", array('concepts_in_line' => $thesaurus_concepts_concept_in_line*1)); } /** * * @param unknown $concepts_list */ static public function get_schemes_list($schemes_list) { return self::render($schemes_list, "skos_view_concepts_schemes_list", 0); } /** * Retourne l'affichage des enfants d'un concept * @param skos_concepts_list $concepts_list Liste des enfants * @return string */ static public function get_narrowers_list($concepts_list) { return self::render(self::get_narrowers_data_list($concepts_list), "skos_view_concepts_narrowers_list", 0); } /** * Retourne les data enfants d'un concept * @param skos_concepts_list $concepts_list Liste des enfants * @return array */ static public function get_narrowers_data_list($concepts_list) { return array( 'title' => skos_onto::get_property_label("http://www.w3.org/2004/02/skos/core#Concept", "http://www.w3.org/2004/02/skos/core#narrower"), 'elements' => self::get_sorted_concepts($concepts_list->get_concepts(), false) ); } /** * Retourne l'affichage des parents d'un concept * @param skos_concepts_list $concepts_list Liste des parents * @return string */ static public function get_broaders_list($concepts_list) { return self::render(self::get_broaders_data_list($concepts_list), "skos_view_concepts_broaders_list", 0); } /** * Retourne les data parents d'un concept * @param skos_concepts_list $concepts_list Liste des parents * @return array */ static public function get_broaders_data_list($concepts_list) { return array( 'title' => skos_onto::get_property_label("http://www.w3.org/2004/02/skos/core#Concept", "http://www.w3.org/2004/02/skos/core#broader"), 'elements' => self::get_sorted_concepts($concepts_list->get_concepts(), false) ); } /** * Retourne l'affichage des relations associatives d'un concept * @param skos_concepts_list $concepts_list Liste des parents * @return string */ static public function get_related_list($concepts_list) { return self::render(self::get_related_data_list($concepts_list), "skos_view_concepts_related_list", 0); } /** * Retourne les data des relations associatives d'un concept * @param skos_concepts_list $concepts_list Liste des parents * @return array */ static public function get_related_data_list($concepts_list) { return array( 'title' => skos_onto::get_property_label("http://www.w3.org/2004/02/skos/core#Concept", "http://www.w3.org/2004/02/skos/core#related"), 'elements' => self::get_sorted_concepts($concepts_list->get_concepts(), false) ); } /** * Retourne l'affichage des termes associés d'un concept * @param skos_concepts_list $concepts_list Liste des parents * @return string */ static public function get_related_match_list($concepts_list) { //on garde le même template que pour les relation associatives (skos_view_concepts_related_list) return self::render(self::get_related_match_data_list($concepts_list), "skos_view_concepts_related_list", 0); } /** * Retourne les data des termes associés d'un concept * @param skos_concepts_list $concepts_list Liste des parents * @return array */ static public function get_related_match_data_list($concepts_list) { return array( 'title' => skos_onto::get_property_label("http://www.w3.org/2004/02/skos/core#Concept", "http://www.w3.org/2004/02/skos/core#relatedMatch"), 'elements' => self::get_sorted_concepts($concepts_list->get_concepts(), false) ); } /** * Retourne l'affichage des concepts composés qui utilisent un concept * @param skos_concepts_list $concepts_list Liste des concepts composés * @return string */ static public function get_composed_concepts_list($concepts_list) { global $thesaurus_concepts_concept_in_line; global $msg; $concepts = $concepts_list->get_concepts(); $datas = array( 'title' => $msg['skos_view_concepts_composed_concepts'], 'elements' => self::get_sorted_concepts($concepts, false) ); return self::render($datas, "skos_view_concepts_composed_concepts_list", array('concepts_in_line' => $thesaurus_concepts_concept_in_line*1)); } /** * Renvoie un tableau trié des concepts selon leurs schémas * @param skos_concept $concepts Tableau des concepts à trier * @param boolean $all_links Spécifie si les liens vers les concepts composés doivent étre décomposés * @return skos_concept Tableau trié [schema][] = concept */ static protected function get_sorted_concepts($concepts, $all_links) { global $msg; global $thesaurus_concepts_affichage_ordre; // On trie le tableau des concepts selon leurs schemas $sorted_concepts = array(); foreach ($concepts as $concept) { $schemes = $concept->get_schemes(); if ($schemes) { $scheme = implode(',', $schemes); } else { $scheme = $msg['skos_view_concept_no_scheme']; } $sorted_concepts[$scheme][] = ($all_links ? skos_view_concept::get_concept_in_list_with_all_links($concept) : skos_view_concept::get_concept_in_list($concept)); } //On génère la liste foreach ($sorted_concepts as $scheme => $concepts) { // On trie par ordre alphabétique si spécifié en paramètre if ($thesaurus_concepts_affichage_ordre != 1) { usort($sorted_concepts[$scheme],function($a,$b){ return strcmp(strip_tags($a),strip_tags($b)); }); } } return $sorted_concepts; } }