objects_type)) { $this->objects_type = str_replace('list_', '', get_class($this)); } $this->init_session_values(); $this->init_available_filters(); $this->init_selected_filters(); $this->init_filters($filters); $this->init_settings(); $this->init_applied_group(); $this->init_available_columns(); $this->init_selected_columns(); $this->init_no_sortable_columns(); $this->init_pager($pager); $this->init_applied_sort($applied_sort); $this->init_global_values(); $this->init_data(); if(empty($this->dataset_id)) { $this->init_columns(); } } public function set_dataset_id($dataset_id) { $this->dataset_id = intval($dataset_id); } protected function set_property_class_from_json_data($property, $json_data, $merge=false) { if(!empty($json_data)) { if($merge) { //$data = encoding_normalize::json_decode($json_data, true); //$this->{$property} = array_merge($this->{$property}, $data); $this->{$property} = encoding_normalize::json_decode($json_data, true); } else { $this->{$property} = encoding_normalize::json_decode($json_data, true); } } } protected function set_data_from_database($property='all') { $this->get_datasets(); if(!$this->dataset_id) { $this->dataset_id = $this->get_dataset_default_selected(); } if($this->dataset_id) { if(in_array($this->dataset_id, $this->datasets['my']) || in_array($this->dataset_id, $this->datasets['shared'])) { $query = "select * from lists where id_list = ".$this->dataset_id; $result = pmb_mysql_query($query); if(pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); switch($property) { case 'selected_columns': $this->set_property_class_from_json_data($property, $row->list_selected_columns); if(!empty($row->list_selected_columns)) { $this->columns = array(); $this->init_columns(); } break; case 'filters': $this->set_property_class_from_json_data($property, $row->list_filters, true); break; case 'applied_group': $this->set_property_class_from_json_data($property, $row->list_applied_group); break; case 'applied_sort': $this->set_property_class_from_json_data($property, $row->list_applied_sort); break; case 'pager': $this->set_property_class_from_json_data($property, $row->list_pager, true); break; case 'selected_filters': $this->set_property_class_from_json_data($property, $row->list_selected_filters); break; case 'settings': $this->set_property_class_from_json_data($property, $row->list_settings, true); if(!empty($row->list_settings)) { $this->set_data_from_database_settings(); //Mise en session - paramétrage uniquement personnalisable dans une liste $this->set_settings_in_session(); } break; default: $this->set_property_class_from_json_data($property, $row->list_selected_columns); if(!empty($row->list_selected_columns)) { $this->columns = array(); $this->init_columns(); } $this->set_property_class_from_json_data($property, $row->list_filters, true); $this->set_property_class_from_json_data($property, $row->list_applied_group); $this->set_property_class_from_json_data($property, $row->list_applied_sort); $this->set_property_class_from_json_data($property, $row->list_pager, true); $this->set_property_class_from_json_data($property, $row->list_selected_filters); $this->set_property_class_from_json_data($property, $row->list_settings, true); if(!empty($row->list_settings)) { $this->set_data_from_database_settings(); //Mise en session - paramétrage uniquement personnalisable dans une liste $this->set_settings_in_session(); } break; } } } } } protected function set_data_from_database_settings() { if(!empty($this->settings['columns'])) { foreach ($this->settings['columns'] as $property=>$settings_column) { if($settings_column['visible'] == 0) { foreach ($this->columns as $indice=>$column) { if($column['property'] == $property) { unset($this->columns[$indice]); break; } } foreach ($this->available_columns as $group_name=>$group_columns) { foreach ($group_columns as $indice=>$label) { if($indice == $property) { unset($this->available_columns[$group_name][$indice]); break; } } } unset($this->selected_columns[$property]); } } } if(!empty($this->settings['filters'])) { foreach ($this->settings['filters'] as $property=>$filter) { if($filter['visible'] == 0) { unset($this->filters[$property]); foreach ($this->available_filters as $group_name=>$group_filters) { foreach ($group_filters as $indice=>$label) { if($indice == $property) { unset($this->available_filters[$group_name][$indice]); break; } } } unset($this->selected_filters[$property]); } } } } protected function _get_query_base() { return ''; } protected function get_object_instance($row) { return null; } protected function add_object($row) { if($this->is_deffered_load()) { //Objet non utilisé dans ce contexte $this->objects[] = new stdClass(); } else { $object_instance = $this->get_object_instance($row); if(!empty($object_instance)) { $this->objects[] = $object_instance; } else { $this->objects[] = $row; } } } protected function _get_query() { $query = $this->_get_query_base(); $query .= $this->_get_query_filters(); $query .= $this->_get_query_order(); if($this->applied_sort_type == "SQL"){ $this->pager['nb_results'] = pmb_mysql_num_rows(pmb_mysql_query($query)); $query .= $this->_get_query_pager(); } return $query; } protected function fetch_data() { $this->objects = array(); $query = $this->_get_query(); $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { while($row = pmb_mysql_fetch_object($result)) { $this->add_object($row); } if($this->applied_sort_type != "SQL"){ $this->pager['nb_results'] = pmb_mysql_num_rows($result); } } $this->messages = ""; } protected function init_data() { if(empty(static::$without_data) || static::$without_data !== true) { $this->fetch_data(); $this->_sort(); $this->_limit(); } } /** * Initialisation de la session si demandé */ public function init_session_values() { $initialization = $this->objects_type.'_initialization'; global ${$initialization}; if(isset(${$initialization}) && ${$initialization} == 'reset') { $this->unset_session_values('filter'); $this->unset_session_values('applied_group'); $this->unset_session_values('selected_columns'); $this->unset_session_values('applied_sort'); $this->unset_session_values('pager'); $this->unset_session_values('selected_filters'); } } /** * Initialisation des filtres disponibles */ protected function init_available_filters() { $this->available_filters = array(); } /** * Initialisation des filtres appliqués par défaut */ protected function init_default_selected_filters() { $this->selected_filters = array(); } /** * Initialisation des filtres sélectionnées */ protected function init_selected_filters() { $this->init_default_selected_filters(); $this->set_data_from_database('selected_filters'); $this->sign_selected_filters = $this->get_sign($this->selected_filters); if(isset($_SESSION['list_'.$this->objects_type.'_selected_filters']) && is_array($_SESSION['list_'.$this->objects_type.'_selected_filters'])) { $this->selected_filters = array(); foreach($_SESSION['list_'.$this->objects_type.'_selected_filters'] as $property=>$label) { $this->add_selected_filter($property); } } $this->set_selected_filters_from_form(); } /** * Initialisation des filtres de recherche */ public function init_filters($filters=array()) { $this->set_data_from_database('filters'); if(empty($this->filters)) { $this->filters = array(); } $this->sign_filters = $this->get_sign(array_merge_recursive($this->filters, $filters)); foreach ($this->filters as $key => $val){ if(isset($_SESSION['list_'.$this->objects_type.'_filter'][$key])) { $this->filters[$key] = $_SESSION['list_'.$this->objects_type.'_filter'][$key]; } } if(count($filters)){ foreach ($filters as $key => $val){ $this->filters[$key]=$val; } } } /** * Initialisation des settings par défaut */ protected function init_default_settings() { $this->settings = array( 'display' => array( 'search_form' => array( 'visible' => true, 'filters' => true, 'unfolded_filters' => false, 'add_filters' => false, 'sorts' => true, 'options' => false, 'unfolded_options' => false, 'datasets' => false, 'export_icons' => true ), 'query' => array( 'human' => true, ), 'objects_list' => array( 'deffered_load' => false, 'visible' => true ) ), 'selector_size' => 5, 'columns' => array( 'default' => array( 'align' => 'center', 'text' => '', 'level' => 0, 'visible' => 1, 'display_mode' => 'normal', 'edition_type' => 'text' ) ), 'filters' => array( 'default' => array( 'visible' => 1 ) ), 'objects' => array( 'default' => array( 'visible' => 1, 'display_mode' => 'table', 'expanded_display' => 1 ) ), 'grouped_objects' => array( 'default' => array( 'sort' => 1, 'display_mode' => 'table', 'expanded_display' => 1 ) ) ); } /** * Initialisation des paramétrages */ public function init_settings($settings=array()) { $this->init_default_settings(); $this->set_data_from_database('settings'); $this->sign_settings = $this->get_sign(array_merge_recursive($this->settings, $settings)); if(isset($_SESSION['list_'.$this->objects_type.'_settings'])) { foreach ($_SESSION['list_'.$this->objects_type.'_settings'] as $key => $val){ $this->settings[$key] = $val; } } if(count($settings)){ foreach ($settings as $key => $val){ $this->settings[$key]=$val; } } $initialization = $this->objects_type.'_initialization'; global ${$initialization}; if(empty(${$initialization}) || ${$initialization} != 'reset') { $this->set_settings_from_form(); } } /** * Initialisation du groupement appliqué à la recherche */ public function init_applied_group($applied_group=array()) { if(!isset($this->applied_group)) { $this->applied_group = array(0 => ''); } $this->set_data_from_database('applied_group'); $this->sign_applied_group = $this->get_sign(array_merge_recursive($this->applied_group, $applied_group)); if(isset($_SESSION['list_'.$this->objects_type.'_applied_group'])) { foreach ($_SESSION['list_'.$this->objects_type.'_applied_group'] as $key => $val){ $this->applied_group[$key] = $val; } } if(count($applied_group)){ foreach ($applied_group as $key => $val){ $this->applied_group[$key]=$val; } } $initialization = $this->objects_type.'_initialization'; global ${$initialization}; if(empty(${$initialization}) || ${$initialization} != 'reset') { $this->set_applied_group_from_form(); } } /** * Initialisation des colonnes disponibles */ protected function init_available_columns() { $this->available_columns = array(); } /** * Initialisation des colonnes sélectionnées */ protected function init_selected_columns() { $this->selected_columns = array(); $this->set_data_from_database('selected_columns'); $this->sign_selected_columns = $this->get_sign($this->selected_columns); if(isset($_SESSION['list_'.$this->objects_type.'_selected_columns']) && is_array($_SESSION['list_'.$this->objects_type.'_selected_columns'])) { $this->selected_columns = array(); foreach($_SESSION['list_'.$this->objects_type.'_selected_columns'] as $property=>$label) { $this->add_selected_column($property); } } $this->set_selected_columns_from_form(); } /** * Initialisation des colonnes non triables */ protected function init_no_sortable_columns() { $this->no_sortable_columns = array(); } /** * Initialisation de la pagination par défaut */ protected function init_default_pager() { $this->pager = array( 'page' => 1, 'nb_per_page' => 20, 'nb_per_page_on_group' => false, 'nb_results' => 0, 'nb_page' => 1, 'allow_force_all_on_page' => false ); } /** * Initialisation de la pagination */ public function init_pager($pager=array()) { $this->init_default_pager(); $this->set_data_from_database('pager'); $this->sign_pager = $this->get_sign($this->pager['nb_per_page']); if(isset($_SESSION['list_'.$this->objects_type.'_pager']['nb_per_page'])) { $this->pager['nb_per_page'] = $_SESSION['list_'.$this->objects_type.'_pager']['nb_per_page']; } if(isset($_SESSION['list_'.$this->objects_type.'_pager']['nb_per_page_on_group'])) { $this->pager['nb_per_page_on_group'] = $_SESSION['list_'.$this->objects_type.'_pager']['nb_per_page_on_group']; } if(isset($_SESSION['list_'.$this->objects_type.'_pager']['page'])) { $this->pager['page'] = $_SESSION['list_'.$this->objects_type.'_pager']['page']; } if(count($pager)){ foreach ($pager as $key => $val){ $this->pager[$key]=$val; } } } /** * Ajout d'un tri */ protected function add_applied_sort($by, $asc_desc='asc') { if(empty($this->applied_sort)) { $this->applied_sort = array(); } array_push($this->applied_sort, array('by' => $by, 'asc_desc' => $asc_desc)); } /** * Initialisation du tri par défaut appliqué */ protected function init_default_applied_sort() { $this->applied_sort = array( 'by' => 'id', 'asc_desc' => 'desc' ); } /** * Initialisation du tri appliqué */ public function init_applied_sort($applied_sort=array()) { $this->init_default_applied_sort(); $this->set_data_from_database('applied_sort'); $this->sign_applied_sort = $this->get_sign(array_merge_recursive($this->applied_sort, $applied_sort)); if(isset($_SESSION['list_'.$this->objects_type.'_applied_sort'][0]['by'])) { $this->applied_sort[0]['by'] = $_SESSION['list_'.$this->objects_type.'_applied_sort'][0]['by']; if(isset($_SESSION['list_'.$this->objects_type.'_applied_sort'][0]['asc_desc'])) { $this->applied_sort[0]['asc_desc'] = $_SESSION['list_'.$this->objects_type.'_applied_sort'][0]['asc_desc']; } else { $this->applied_sort[0]['asc_desc'] = 'asc'; } } if(count($applied_sort)){ foreach ($applied_sort as $key => $val){ if(is_array($val)) { $this->applied_sort[$key] = $val; } else { $this->applied_sort[0][$key]=$val; } } } $initialization = $this->objects_type.'_initialization'; global ${$initialization}; if(empty(${$initialization}) || ${$initialization} != 'reset') { $this->set_applied_sort_from_form(); } } /** * Initialisation demandée - Destruction des variables globales */ public function init_global_values() { $initialization = $this->objects_type.'_initialization'; global ${$initialization}; if(isset(${$initialization}) && ${$initialization} == 'reset') { $this->unset_global_values('filters'); $this->unset_global_values('applied_group'); $this->unset_global_values('applied_sort'); $this->unset_global_values('pager'); } } protected function get_label_available_filter($property, $group_label='main_fields') { if(isset($this->available_filters[$group_label][$property])) { return $this->available_filters[$group_label][$property]; } return ''; } public function add_selected_filter($property, $label='') { if(!empty($this->available_filters['custom_fields'][$property])) { $this->selected_filters[$property] = ($label ? $label : $this->get_label_available_filter($property, 'custom_fields')); } else { $this->selected_filters[$property] = ($label ? $label : $this->get_label_available_filter($property)); } } protected function add_empty_selected_filter() { global $empty_selected_filter; //Pas propre mais ça fait le job if($empty_selected_filter) { $empty_selected_filter++; } else { $empty_selected_filter = 1; } $this->selected_filters['empty_'.$empty_selected_filter] = ''; } /** * Filtres provenant du formulaire */ public function set_selected_filters_from_form() { $initialization = $this->objects_type.'_initialization'; global ${$initialization}; if(empty(${$initialization})) { $selected_filters = $this->objects_type.'_selected_filters'; global ${$selected_filters}; if(isset(${$selected_filters})) { $this->selected_filters = encoding_normalize::json_decode(stripslashes(${$selected_filters}), true); // foreach (${$selected_filters} as $property=>$label) { // $this->add_selected_filter(stripslashes($property), stripslashes($label)); // } } } //A-t-on demandé l'ajout d'un filtre ? $add_filter = $this->objects_type.'_add_filter'; global ${$add_filter}; if(!empty(${$add_filter})) { $this->add_selected_filter(${$add_filter}); } //Sauvegarde des filtres en session $this->set_selected_filters_in_session(); } /** * Filtre provenant du formulaire */ public function set_filter_from_form($name, $type='string') { $field_value = $this->objects_type.'_'.$name; global ${$field_value}; if(isset(${$field_value})) { switch ($type) { case 'integer': if(is_array(${$field_value})) { $this->filters[$name] = array(); if(${$field_value}[0]) { $this->filters[$name] = ${$field_value}; } } else { $this->filters[$name] = intval(${$field_value}); } break; default: if(is_array(${$field_value})) { $this->filters[$name] = array(); if(${$field_value}[0]) { $this->filters[$name] = stripslashes_array(${$field_value}); } } else { $this->filters[$name] = stripslashes(${$field_value}); } break; } } } /** * Filtres de champs personnalisés provenant du formulaire */ public function set_filters_custom_fields_from_form() { //Traitement des champs personnalisés if(!empty($this->custom_fields_available_filters)) { foreach ($this->custom_fields_available_filters as $property=>$data) { $type = $data['type']; $parametres_perso = $this->get_custom_parameters_instance($type); $property_id = $parametres_perso->get_field_id_from_name($property); $valeurs_post=$property; $v=array(); global ${$valeurs_post}; if (${$valeurs_post}) $v=${$valeurs_post}; $t=array(); if(!empty($parametres_perso->t_fields[substr($property_id,2)]['OPTIONS'][0]['UNSELECT_ITEM'][0]['VALUE'])) { $t[0]=$parametres_perso->t_fields[substr($property_id,2)]['OPTIONS'][0]['UNSELECT_ITEM'][0]['VALUE']; } $w=array_diff($v,$t); $this->filters["#custom_field#".$property] = array(); if(count($w) > 1 || (is_array($w) && isset($w[0]) && $w[0] != "-1" && $w[0] != "")){ $this->filters["#custom_field#".$property] = stripslashes_array($w); } } } } /** * Filtres provenant du formulaire */ public function set_filters_from_form() { $this->set_filters_custom_fields_from_form(); //Sauvegarde des filtres en session $this->set_filter_in_session(); } /** * Paramétrages provenant du formulaire */ public function set_settings_from_form() { $settings = $this->objects_type.'_settings'; global ${$settings}; if(isset(${$settings})) { foreach (${$settings} as $group_settings_name=>$group_settings) { if($group_settings_name && !empty($group_settings)) { $this->settings[$group_settings_name] = stripslashes_array($group_settings); } } } //Sauvegarde des settings en session //Pas de mise en session - paramétrage uniquement personnalisable dans une liste // $this->set_settings_in_session(); } /** * Groupement provenant du formulaire */ public function set_applied_group_from_form() { $applied_group = $this->objects_type.'_applied_group'; global ${$applied_group}; if(isset(${$applied_group})) { $this->applied_group = array(); foreach (${$applied_group} as $name) { if($name) { $this->applied_group[] = $name; } } } //Sauvegarde du groupement en session $this->set_applied_group_in_session(); } /** * Tri provenant du formulaire */ public function set_applied_sort_from_form() { $applied_sort = $this->objects_type.'_applied_sort'; global ${$applied_sort}; if(isset(${$applied_sort})) { $this->applied_sort = ${$applied_sort}; } //Sauvegarde du tri en session $this->set_applied_sort_in_session(); } /** * Pagination provenant du formulaire */ public function set_pager_from_form() { $page = $this->objects_type.'_page'; global ${$page}; $nb_per_page = $this->objects_type.'_nb_per_page'; global ${$nb_per_page}; if(${$page}*1) { $this->pager['page'] = ${$page}*1; } if(${$nb_per_page}*1) { $this->pager['nb_per_page'] = ${$nb_per_page}*1; } //Sauvegarde de la pagination en session $this->set_pager_in_session(); } protected function get_title() { return ''; } protected function get_form_title() { global $msg, $charset; if(isset($msg[$this->objects_type.'_form_title'])) { return htmlentities($msg[$this->objects_type.'_form_title'], ENT_QUOTES, $charset); } return ''; } protected function get_form_name() { return $this->objects_type."_search_form"; } /** * Retourne l'instance de parametres_perso * @param string $type */ protected function get_custom_parameters_instance($type) { if(!isset($this->custom_parameters_instance[$type])) { switch($type) { case 'pret': $this->custom_parameters_instance[$type] = new pret_parametres_perso($type); break; default: $this->custom_parameters_instance[$type] = new parametres_perso($type); break; } } return $this->custom_parameters_instance[$type]; } /** * Liste des filtres disponibles sur les champs personnalisés * @param string $type */ protected function add_custom_fields_available_filters($type, $property_id) { $t_fields = $this->get_custom_parameters_instance($type)->t_fields; foreach ($t_fields as $field) { if(!empty($field["FILTERS"]) || !empty($field["SEARCH"])) { $this->available_filters['custom_fields'][$field['NAME']] = $field['TITRE']; $this->custom_fields_available_filters[$field['NAME']] = array( 'type' => $type, 'property_id' => $property_id ); } } } /** * Liste des colonnes disponibles sur les champs personnalisés * @param string $type */ protected function add_custom_fields_available_columns($type, $property_id) { foreach ($this->get_custom_parameters_instance($type)->t_fields as $field) { $this->available_columns['custom_fields'][$field['NAME']] = $field['TITRE']; $this->custom_fields_available_columns[$field['NAME']] = array( 'type' => $type, 'property_id' => $property_id ); } } protected function get_available_columns_selector() { $size = $this->settings['selector_size']; $selector = ""; return $selector; } protected function get_selected_columns_selector() { $size = $this->settings['selector_size']; $selector = ""; return $selector; } protected function set_setting_display($property, $css_property, $value) { $this->set_setting('display', $property, $css_property, $value); } protected function get_selected_setting_column($property, $css_property) { return $this->get_setting('columns', $property, $css_property); } protected function set_setting_column($property, $css_property, $value) { $this->set_setting('columns', $property, $css_property, $value); } protected function get_selected_setting_filter($property, $css_property) { return $this->get_setting('filters', $property, $css_property); } protected function set_setting_filter($property, $css_property, $value) { $this->set_setting('filters', $property, $css_property, $value); } protected function get_settings_property_input_form($name, $property, $css_property, $settings, $type) { global $msg, $charset; switch ($name) { case 'columns': $selected_setting = $this->get_selected_setting_column($property, $css_property); break; case 'filters': $selected_setting = $this->get_selected_setting_filter($property, $css_property); break; } $content_form = ""; switch ($type) { case 'checkbox': foreach($settings as $setting) { $content_form .= " ".htmlentities($msg['list_ui_settings_'.$name.'_'.$css_property.'_'.$setting], ENT_QUOTES, $charset); } break; case 'radio': foreach($settings as $setting) { $content_form .= " ".htmlentities($msg['list_ui_settings_'.$name.'_'.$css_property.'_'.$setting], ENT_QUOTES, $charset); } break; case 'color': $content_form .= ""; break; } return $content_form; } protected function get_settings_display_content_form() { global $msg, $charset; global $list_ui_settings_display_content_form_tpl; $content_form = $list_ui_settings_display_content_form_tpl; $settings_display = ''; foreach ($this->settings['display'] as $group_name=>$settings) { $settings_display .= "
".htmlentities($msg['list_ui_settings_display_'.$group_name], ENT_QUOTES, $charset)."
"; foreach ($settings as $name=>$value) { $settings_display .= "
".htmlentities($msg['list_ui_settings_display_'.$group_name.'_'.$name], ENT_QUOTES, $charset)."
"; } } $content_form = str_replace('!!settings_display!!', $settings_display, $content_form); $content_form = str_replace('!!objects_type!!', $this->objects_type, $content_form); return $content_form; } protected function get_settings_column_content_form($property, $label) { $content_form = " ".$this->_get_label_cell_header($label)." ".$this->get_settings_property_input_form('columns', $property, 'align', array('left', 'center', 'right'), 'radio')." ".$this->get_settings_property_input_form('columns', $property, 'text', array('bold', 'italic', 'underline'), 'checkbox')." ".$this->get_settings_property_input_form('columns', $property, 'visible', array('0', '1'), 'radio')." "; return $content_form; } protected function get_settings_columns_content_form() { global $list_ui_settings_columns_content_form_tpl; $content_form = $list_ui_settings_columns_content_form_tpl; $settings_columns = ''; foreach ($this->get_sorted_available_columns() as $property=>$label) { $settings_columns .= $this->get_settings_column_content_form($property, $label); } $content_form = str_replace('!!settings_columns!!', $settings_columns, $content_form); $content_form = str_replace('!!objects_type!!', $this->objects_type, $content_form); return $content_form; } protected function get_settings_filter_content_form($property, $label) { $content_form = " ".$this->_get_label_cell_header($label)." ".$this->get_settings_property_input_form('filters', $property, 'visible', array('0', '1'), 'radio')." "; return $content_form; } protected function get_settings_filters_content_form() { global $list_ui_settings_filters_content_form_tpl; $content_form = $list_ui_settings_filters_content_form_tpl; $settings_filters = ''; foreach ($this->get_sorted_available_filters() as $property=>$label) { $settings_filters .= $this->get_settings_filter_content_form($property, $label); } $content_form = str_replace('!!settings_filters!!', $settings_filters, $content_form); $content_form = str_replace('!!objects_type!!', $this->objects_type, $content_form); return $content_form; } protected function get_applied_group_selector($indice, $applied_group='') { $selector = ""; return $selector; } protected function get_applied_group_selectors() { global $msg, $charset; $selectors = ''; if(empty($this->applied_group)) { $this->applied_group = array(0 => ''); } foreach ($this->applied_group as $indice=>$applied_group) { if($indice) { $selectors .= $this->get_display_add_applied_group($indice, $applied_group); } else { $selectors .= $this->get_applied_group_selector($indice, $applied_group); $selectors .= " "; } } $selectors .= "
"; return $selectors; } public function get_display_add_applied_group($indice, $applied_group='') { global $msg, $charset; $display = "
"; $display .= $this->get_applied_group_selector($indice, $applied_group); $display .= "  
"; return $display; } /** * Affichage du formulaire d'options */ public function get_options_content_form() { global $list_ui_options_content_form_tpl; $options_content_form = $list_ui_options_content_form_tpl; $options_content_form = str_replace('!!objects_type!!', $this->objects_type, $options_content_form); $options_content_form = str_replace('!!available_columns!!', $this->get_available_columns_selector(), $options_content_form); $options_content_form = str_replace('!!selected_columns!!', $this->get_selected_columns_selector(), $options_content_form); $options_content_form = str_replace('!!applied_group_selectors!!', $this->get_applied_group_selectors(), $options_content_form); return $options_content_form; } /** * Affichage du formulaire de paramétrages avancés */ public function get_settings_content_form() { global $list_ui_settings_content_form_tpl; $settings_content_form = $list_ui_settings_content_form_tpl; $settings_content_form = str_replace('!!objects_type!!', $this->objects_type, $settings_content_form); $settings_content_form = str_replace('!!list_settings_display_content_form_tpl!!', $this->get_settings_display_content_form(), $settings_content_form); $settings_content_form = str_replace('!!list_settings_columns_content_form_tpl!!', $this->get_settings_columns_content_form(), $settings_content_form); $settings_content_form = str_replace('!!list_settings_filters_content_form_tpl!!', $this->get_settings_filters_content_form(), $settings_content_form); return $settings_content_form; } protected function get_dataset_action_content_form($name, $id=0, $icon='', $label='') { global $charset; return " ".htmlentities($label, ENT_QUOTES, $charset)." ".htmlentities($label, ENT_QUOTES, $charset)." "; } /** * Affichage du formulaire de rapports personnalisés (my or shared) */ public function get_datasets_content_form($which='my') { global $msg, $charset; global $list_ui_datasets_content_form_tpl; $datasets_content_form = $list_ui_datasets_content_form_tpl; $datasets_content_form = str_replace('!!datasets_label!!', htmlentities($msg['list_ui_datasets_'.$which], ENT_QUOTES, $charset), $datasets_content_form); $datasets_content = ''; foreach ($this->get_datasets()[$which] as $dataset) { $list_model = new list_model($dataset); $datasets_content .= "
".$list_model->get_label()." ".$this->get_dataset_action_content_form('apply', $dataset, 'tick.gif', $msg['apply'])." ".$this->get_dataset_action_content_form('edit', $dataset, 'b_edit.png', $msg['62'])." ".$this->get_dataset_action_content_form('delete', $dataset, 'interdit.gif', $msg['63'])."
"; } $datasets_content_form = str_replace('!!datasets_content!!', $datasets_content, $datasets_content_form); $datasets_content_form = str_replace('!!objects_type!!', $this->objects_type, $datasets_content_form); $datasets_content_form = str_replace('!!which!!', $which, $datasets_content_form); $datasets_content_form = str_replace('!!controller_url_base!!', static::get_controller_url_base(), $datasets_content_form); return $datasets_content_form; } protected function get_simple_selector($query, $name='', $message_all='') { global $msg, $charset; $selector = ""; return $selector; } protected function get_multiple_selector($query, $name='', $message_all='') { global $charset; $selector = ""; return $selector; } protected function get_search_filter_interval_date($name) { return " - "; } public function is_custom_field_filter($property) { if(array_key_exists($property, $this->available_filters['custom_fields']) !== false) { return true; } return false; } protected function get_search_filter_custom_field($property) { //Temporaire pour éviter de recalculer les filtres à chaque fois global $perso_show_search_fields; if(empty($perso_show_search_fields)) { $perso_show_search_fields = array(); } $type = $this->custom_fields_available_filters[$property]['type']; $custom_instance = $this->get_custom_parameters_instance($type); if(empty($perso_show_search_fields[$type])) { //On fait comme on peut pour revaloriser les filtres if(!empty($this->filters["#custom_field#".$property])) { global ${$property}; ${$property} = $this->filters["#custom_field#".$property]; } $perso_show_search_fields[$type]=$custom_instance->show_search_fields(); } $perso_ = $perso_show_search_fields[$type]; for ($i=0; $iselected_filters)); $search_filter_form = "
"; if(!empty($this->is_displayed_add_filters_block) || $delete_is_allow) { if($label && substr($label, 0, 6) != 'empty_') { $search_filter_form .= ""; } else { $search_filter_form .= "