public function __construct($type, $id, $isbd = "")
 {
     if ($id * 1) {
         $id = onto_common_uri::get_uri($id);
     }
     parent::__construct($type, $id, $isbd);
 }
 public function __construct($params, $type, $id, $isbd = "")
 {
     $this->params = $params;
     if (!is_int($id)) {
         $id = onto_common_uri::get_id($id);
     }
     parent::__construct($type, $id, $isbd);
 }
 public function __construct($params, $type, $id, $isbd = "")
 {
     $auth = new authperso(0, $id);
     $params['id_authority'] = $auth->id;
     $params['label'] = $auth->info['name'];
     $this->params = $params;
     parent::__construct($type, $id, $isbd);
 }
예제 #4
0
 /**
  * Renvoie le formulaire de la vedette composée
  * 
  * @param $property onto_common_property
  * @param $restrictions onto_restriction
  * @param $datas
  * @param $instance_name
  *
  * @return string
  * @access public
  */
 public function get_form($property, $order, $instance_name)
 {
     global $dbh, $base_path, $charset, $lang;
     global $vedette_tpl;
     //TODO Retirer le style brut
     $form_html = $vedette_tpl['css'] . $vedette_tpl['form_body'];
     if (!count($this->vedette_composee->get_elements())) {
         $form_html = str_replace("!!vedette_composee_apercu!!", "", $form_html);
     } else {
         $form_html = str_replace("!!vedette_composee_apercu!!", $this->vedette_composee->get_label(), $form_html);
     }
     $form_html = str_replace("!!vedette_composee_id!!", $this->vedette_composee->get_id(), $form_html);
     $form_html = str_replace("!!vedette_composee_type!!", $property->range[0], $form_html);
     //les champs disponibles
     $available_fields_html = '';
     $available_fields_scripts = "";
     $get_vedette_element_switchcases = "";
     foreach ($this->vedette_composee->get_available_fields() as $key => $available_field) {
         $vedette_element_ui_class_name = vedette_element::search_vedette_element_ui_class_name($available_field["class_name"]);
         if ($available_field['params']) {
             $available_fields_scripts .= $vedette_element_ui_class_name::get_create_box_js($available_field['params']);
         } else {
             $available_fields_scripts .= $vedette_element_ui_class_name::get_create_box_js();
         }
         $get_vedette_element_switchcases .= str_replace("!!vedette_type!!", $available_field["class_name"], $vedette_tpl["vedette_composee_get_vedette_element_switchcase"]);
         $tmp_html = $vedette_tpl['vedette_composee_available_field'];
         $tmp_html = str_replace("!!available_field_id!!", $key, $tmp_html);
         $tmp_html = str_replace("!!available_field_type!!", $available_field["class_name"], $tmp_html);
         $tmp_html = str_replace("!!vedette_composee_available_field_label!!", get_msg_to_display($available_field['name']), $tmp_html);
         $available_fields_html .= $tmp_html;
     }
     $form_html = str_replace("!!available_fields_scripts!!", $available_fields_scripts, $form_html);
     $form_html = str_replace("!!vedette_composee_available_fields!!", $available_fields_html, $form_html);
     $form_html = str_replace("!!get_vedette_element_switchcases!!", $get_vedette_element_switchcases, $form_html);
     //les zones de subdivision
     $subdivisions_html = '';
     $tab_vedette_elements = array();
     //On parcourt les subdivisions
     foreach ($this->vedette_composee->get_subdivisions() as $key => $subdivision) {
         $tmp_html = $vedette_tpl['vedette_composee_subdivision'];
         $tab_vedette_elements[$subdivision["order"]] = array();
         if ($subdivision["min"]) {
             $tmp_html = str_replace("!!vedette_composee_subdivision_cardmin!!", $subdivision["min"], $tmp_html);
         } else {
             $tmp_html = str_replace("!!vedette_composee_subdivision_cardmin!!", "", $tmp_html);
         }
         if ($subdivision["max"]) {
             $tmp_html = str_replace("!!vedette_composee_subdivision_cardmax!!", $subdivision["max"], $tmp_html);
         } else {
             $tmp_html = str_replace("!!vedette_composee_subdivision_cardmax!!", "", $tmp_html);
         }
         $tmp_html = str_replace("!!vedette_composee_subdivision_order!!", $subdivision["order"], $tmp_html);
         $elements_html = '';
         if ($elements = $this->vedette_composee->get_at_elements_subdivision($subdivision['code'])) {
             // tableau pour la gestion de l'ordre à l'intérieur d'une subdivision
             $elements_order = array();
             // On parcourt les éléments de la subdivision
             foreach ($elements as $position => $element) {
                 $current_element_html = $vedette_tpl['vedette_composee_element'];
                 $elements_order[] = $position;
                 $tab_vedette_elements[$subdivision["order"]][$position] = $element->get_isbd();
                 $element_ui_class_name = vedette_element::search_vedette_element_ui_class_name(get_class($element));
                 if ($element->params) {
                     $current_element_html = str_replace("!!vedette_composee_element_form!!", $element_ui_class_name::get_form($element->params), $current_element_html);
                 } else {
                     $current_element_html = str_replace("!!vedette_composee_element_form!!", $element_ui_class_name::get_form(), $current_element_html);
                 }
                 $current_element_html = str_replace("!!vedette_composee_element_order!!", $position, $current_element_html);
                 $current_element_html = str_replace("!!vedette_composee_element_type!!", get_class($element), $current_element_html);
                 $current_element_html = str_replace("!!vedette_element_rawlabel!!", $element->get_isbd(), $current_element_html);
                 $field_class_name = $this->vedette_composee->get_at_available_field_class_name(get_class($element));
                 $autority_type = get_msg_to_display($field_class_name["name"]);
                 $current_element_html = str_replace("!!vedette_element_label!!", "[" . $autority_type . "] " . $element->get_isbd(), $current_element_html);
                 $current_element_html = str_replace("!!vedette_element_id!!", $element->get_id(), $current_element_html);
                 $elements_html .= $current_element_html;
             }
             $tmp_html = str_replace("!!vedette_composee_subdivision_elements!!", $elements_html, $tmp_html);
             $tmp_html = str_replace("!!elements_order!!", implode(",", $elements_order), $tmp_html);
         } else {
             $tmp_html = str_replace("!!vedette_composee_subdivision_elements!!", "", $tmp_html);
             $tmp_html = str_replace("!!elements_order!!", "", $tmp_html);
         }
         $tmp_html = str_replace("!!vedette_composee_subdivision_label!!", get_msg_to_display($subdivision['name']), $tmp_html);
         $tmp_html = str_replace("!!vedette_composee_subdivision_id!!", $subdivision['code'], $tmp_html);
         $subdivisions_html .= $tmp_html;
     }
     $form_html = str_replace("!!vedette_composee_subdivisions!!", $subdivisions_html, $form_html);
     $form_html = str_replace("!!caller!!", $instance_name, $form_html);
     $form_html = str_replace("!!vedette_composee_order!!", $order, $form_html);
     $form_html = str_replace("!!property_name!!", $property->pmb_name . "_composed", $form_html);
     $form_html = str_replace("!!tab_vedette_elements!!", encoding_normalize::json_encode($tab_vedette_elements), $form_html);
     $form_html = str_replace("!!vedette_separator!!", htmlentities($this->vedette_composee->get_separator(), ENT_QUOTES), $form_html);
     return $form_html;
 }
 public function __construct($params, $type, $id, $isbd = "")
 {
     $this->params = $params;
     parent::__construct($type, $id, $isbd);
 }