Esempio n. 1
0
 /**
  * Renvoie l'affichage html de la liste pour le selecteur d'autorité
  *
  * @param onto_common_controler $controler
  * @param onto_param $params
  *
  * @return string $form
  */
 public static function get_list_selector($controler, $params)
 {
     global $msg, $charset, $element_form, $ontology_tpl, $list_form, $lang;
     if ($params->objs) {
         $property = $controler->get_onto_property_from_pmb_name($params->objs);
         $element = $property->range[$params->range];
     } else {
         $element = $controler->get_class_uri($params->element);
     }
     $elements = $controler->get_list_elements($params);
     $elements_form = "";
     $list = $list_form;
     if ($elements["nb_total_elements"]) {
         foreach ($elements['elements'] as $uri => $item) {
             switch ($element) {
                 case "http://www.w3.org/2004/02/skos/core#Concept":
                     if ($controler->has_narrower($uri, $params)) {
                         $current_element_form = $ontology_tpl['skos_concept_list_selector_line_folder'];
                         $current_element_form = str_replace("!!folder_href!!", $params->base_url . "&parent_id=" . onto_common_uri::get_id($uri), $current_element_form);
                     } else {
                         $current_element_form = $ontology_tpl['skos_concept_list_selector_line_doc'];
                     }
                     break;
                 default:
                     $current_element_form = $element_form;
                     break;
             }
             $current_element_form = str_replace("!!caller!!", $params->caller, $current_element_form);
             $current_element_form = str_replace("!!element!!", $params->element, $current_element_form);
             $current_element_form = str_replace("!!order!!", $params->order, $current_element_form);
             $current_element_form = str_replace("!!uri!!", $uri, $current_element_form);
             $current_element_form = str_replace("!!item!!", addslashes(isset($item[substr($lang, 0, 2)]) ? $item[substr($lang, 0, 2)] : $item['default']), $current_element_form);
             $current_element_form = str_replace("!!range!!", rawurlencode($element ? $element : $controler->get_class_uri($params->sub)), $current_element_form);
             $current_element_form = str_replace("!!callback!!", $params->callback, $current_element_form);
             $current_element_form = str_replace("!!item_libelle!!", htmlentities(isset($item[substr($lang, 0, 2)]) ? $item[substr($lang, 0, 2)] : $item['default'], ENT_QUOTES, $charset), $current_element_form);
             $infobulle_libelle = "";
             if ($controler->has_broader($uri, $params)) {
                 $parents = $controler->get_broaders($uri, $params);
                 if ($parents[0]["id"]) {
                     $infobulle_libelle .= $msg["onto_skos_concept_broader"] . " " . $parents[0]["label"] . ". ";
                 }
             }
             $infos = $controler->get_informations_concept($uri);
             if ($infos[0]["scopeNote"]) {
                 $infobulle_libelle .= $msg["onto_skos_concept_scopenote"] . " " . $infos[0]["scopeNote"];
             }
             $current_element_form = str_replace("!!infobulle_libelle!!", htmlentities($infobulle_libelle, ENT_QUOTES, $charset), $current_element_form);
             $elements_form .= $current_element_form;
         }
         $list = str_replace("!!elements_form!!", $elements_form, $list);
         $list = str_replace("!!aff_pagination!!", aff_pagination($params->base_url . "&concept_scheme=" . $params->concept_scheme . "&parent_id=" . $params->parent_id, $elements['nb_total_elements'], $elements['nb_onto_element_per_page'], $params->page, 10, true, true), $list);
     } else {
         $list = $msg["1915"];
     }
     return $list;
 }