set_type($entity_type); $entity_form = ''; switch($action){ case 'get_form': $entity_form = $this->get_manage_form("sort"); break; case 'get_already_selected_sorting' : ajax_http_send_response($this->get_already_selected_fields('sort')); break; default: parent::proceed(); break; } if ($entity_form) { header("Content-Type: text/html; charset=UTF-8"); print encoding_normalize::utf8_normalize($entity_form); } } protected function set_type($type) { if (!empty($type)) { $this->type = $type; } } protected function get_manage_form($type){ global $msg, $current_module; global $base_path; global $num_page; global $charset; //entite appelant le selecteur global $entity; global $entity_id; global $class_name; global ${$type."_data"}; //identifiant du tri ou du filtre $manage_id = 0; $name = ''; $entity_manage_controller = ""; $fields_class_name = ''; switch ($type) { case 'sort': $entity_manage_controller = "SortingEntityManageController"; $fields_class_name = 'sort_fields'; break; } $instance_fields = new $fields_class_name($this->get_indexation_type(), $this->get_indexation_path()); if (!empty(${$type."_data"})) { if (is_string(${$type."_data"})) { ${$type."_data"} = encoding_normalize::json_decode(stripslashes(${$type."_data"}), true); } $instance_fields->unformat_fields(${$type."_data"}); } $form = "

".$instance_fields->get_selector($entity."_".$type."_".$manage_id."_add_field")."

".$instance_fields->get_already_selected()."

".($manage_id ? "" : "")."
"; $form .= "
"; return $form; } protected function get_indexation_path() { global $include_path; $string_type = entities::get_string_from_const_type($this->type); switch ($string_type) { case 'ontology' : break; case 'notices' : return $include_path."/indexation/notices/champs_base.xml"; default : return $include_path."/indexation/authorities/$string_type/champs_base.xml"; } } protected function get_indexation_type() { switch ($this->type) { case TYPE_NOTICE : return "notices"; default : return "authorities"; } } public function get_already_selected_fields($type) { global $add_field; $fields_class_name = ""; switch ($type) { case 'filters': $fields_class_name = 'filter_fields'; break; case 'sort': $fields_class_name = 'sort_fields'; break; case 'backbones': $fields_class_name = 'backbone_fields'; break; } $instance_fields = new $fields_class_name($this->get_indexation_type(), $this->get_indexation_path()); if($add_field) { $instance_fields->add_field($add_field); } return $instance_fields->get_already_selected(); } }