autorisations); // if ($PMBuserid==1 || $row->autorisations_all || array_search ($PMBuserid, $rqt_autorisation)!==FALSE) { $this->objects[] = $row; // } } protected function _get_query_order() { if ($this->applied_sort[0]['by']) { $order = ''; $sort_by = $this->applied_sort[0]['by']; switch($sort_by) { case 'nom_vue': $order .= 'nom_vue,name'; break; default : $order .= parent::_get_query_order(); break; } if($order) { return $this->_get_query_order_sql_build($order); } else { return ""; } } } public function get_display_search_form() { if(static::class == 'list_statopac_ui') { //Ne pas retourner le formulaire car non compatible avec le formulaire d'encapsulation return ''; } else { return parent::get_display_search_form(); } } protected function init_default_settings() { parent::init_default_settings(); $this->set_setting_display('search_form', 'visible', false); $this->set_setting_display('search_form', 'export_icons', false); $this->set_setting_display('query', 'human', false); $this->set_setting_column('default', 'align', 'left'); $this->settings['objects']['default']['display_mode'] = 'expandable_table'; $this->settings['grouped_objects']['level_1']['display_mode'] = 'expandable_table'; } protected function init_no_sortable_columns() { $this->no_sortable_columns = array( 'execute', 'name', 'configuration', 'export' ); } protected function init_default_pager() { parent::init_default_pager(); $this->pager['nb_per_page'] = pmb_mysql_result(pmb_mysql_query("SELECT count(*) FROM statopac_request"), 0, 0); //Illimité; $this->set_pager_in_session(); } protected function pager() { return ""; } /** * Initialisation du tri par défaut appliqué */ protected function init_default_applied_sort() { $this->add_applied_sort('nom_vue'); $this->add_applied_sort('name'); } public function init_applied_group($applied_group=array()) { $this->applied_group = array(0 => 'nom_vue'); } /** * Initialisation des filtres disponibles */ protected function init_available_filters() { $this->available_filters = array('main_fields' => array( 'name' => '705', 'autorisations' => '25', ) ); $this->available_filters['custom_fields'] = array(); } /** * Initialisation des filtres de recherche */ public function init_filters($filters=array()) { $this->filters = array( 'name' => '', 'autorisations' => array() ); parent::init_filters($filters); } /** * Filtres provenant du formulaire */ public function set_filters_from_form() { $this->set_filter_from_form('name'); parent::set_filters_from_form(); } protected function get_search_filter_name() { global $msg; return "filters['name']."\" title='$msg[3001]' />"; } protected function get_search_filter_autorisations() { //TODO } /** * Initialisation des colonnes disponibles */ protected function init_available_columns() { $this->available_columns = array('main_fields' => array( 'name' => '705', 'comment' => '707', ) ); $this->available_columns['custom_fields'] = array(); } protected function init_default_columns() { $this->add_column_execute(); $this->add_column('name'); $this->add_column('configuration'); $this->add_column_export(); } protected function get_display_cell_html_value($object, $value) { $value = str_replace('!!id_vue!!', $object->id_vue, $value); return parent::get_display_cell_html_value($object, $value); } protected function add_column_execute() { global $msg; $this->columns[] = array( 'property' => 'execute', 'label' => '', 'html' => "", 'exportable' => false ); } protected function add_column_export() { global $msg; $this->columns[] = array( 'property' => 'export', 'label' => '', 'html' => "", 'exportable' => false ); } protected function get_button_add() { global $msg; return ""; } protected function get_buttons_list() { global $base_path, $msg; return "
".$this->get_button_add()."
".$msg['interpreter_doc_consolidation_link']."
"; } protected function get_grouped_label($object, $property) { global $msg, $charset; $grouped_label = parent::get_grouped_label($object, $property); if(static::class == 'list_statopac_ui') { $view_scope = htmlentities($msg['stat_no_scope'],ENT_QUOTES,$charset); $min_date=$object->date_debut_log; $max_date=$object->date_fin_log; if ($min_date!='0000-00-00 00:00:00' && $max_date!='0000-00-00 00:00:00') { $view_scope = sprintf(htmlentities($msg['stat_view_scope'],ENT_QUOTES,$charset),formatdate($min_date),formatdate($max_date)); } $lien = "".htmlentities($grouped_label,ENT_QUOTES, $charset).""; $space = ""; $checkbox = ""; $date_conso=''; if ($object->date_consolidation!=='0000-00-00 00:00:00') { $date_conso = sprintf($msg['stat_view_date_conso'],formatdate($object->date_consolidation,true),$view_scope); } $grouped_label = $space.$checkbox.$space.$lien.$space.$date_conso; } return $grouped_label; } /** * Construction dynamique de la fonction JS de tri */ protected function get_js_sort_script_sort() { global $sub; $display = parent::get_js_sort_script_sort(); $display = str_replace('!!categ!!', 'statopac', $display); $display = str_replace('!!sub!!', $sub, $display); $display = str_replace('!!action!!', 'list', $display); return $display; } protected function get_cell_content($object, $property) { global $msg; $content = ''; switch($property) { case 'name': $content .= "".$object->name."
".$object->comment.""; break; case 'configuration': if (preg_match_all("|!!(.*)!!|U",$object->requete,$query_parameters)) { $content .= "".$msg["procs_options_config_param"].""; } break; default : $content .= parent::get_cell_content($object, $property); break; } return $content; } protected function get_display_cell($object, $property) { switch ($property) { case 'name': $attributes = array( 'onclick' => "document.location=\"".static::get_controller_url_base()."§ion=query&act=update_request&id_req=".$object->idproc."&id_view=".$object->id_vue."\"" ); break; default: break; } $content = $this->get_cell_content($object, $property); $display = $this->get_display_format_cell($content, $property, $attributes); return $display; } protected function gen_plus($id, $titre, $contenu, $maximise=0) { global $msg; if(static::class == 'list_statopac_ui') { $cleaned_title = strip_tags($titre); $cleaned_title = trim(substr($cleaned_title, 0, strpos($cleaned_title, "("))); $id_view = stat_view::get_id_from_label($cleaned_title); $contenu .= "
"; } return parent::gen_plus($id, $titre, $contenu, $maximise); } //Liste des options de consolidation protected function get_options_consolidation() { global $msg, $charset; $space = ""; $min_date=''; $max_date=''; $stat_scope = htmlentities($msg['stat_no_scope'],ENT_QUOTES,$charset); $q_sc = 'select min(date_log) as min_date, max(date_log) as max_date from statopac'; $r_sc = pmb_mysql_query($q_sc); if ($r_sc && pmb_mysql_num_rows($r_sc)) { $res_sc=pmb_mysql_fetch_object($r_sc); $min_date=$res_sc->min_date; $max_date=$res_sc->max_date; if ($min_date!='0000-00-00 00:00:00' && $min_date!='0000-00-00 00:00:00') { $stat_scope = sprintf(htmlentities($msg['stat_scope'],ENT_QUOTES,$charset),formatdate($res_sc->min_date),formatdate($res_sc->max_date)); } } $options = "
"; $options .= ""; $options .= "$space ".htmlentities($msg['stat_options_consolidation'],ENT_QUOTES,$charset).""; $options .= "$space $stat_scope"; $options .= "
"; $options_contenu ="









"; $options.=""; $btn_date_deb = ""; $btn_date_fin = ""; $btn_date_echeance = ""; $btn_remove_data_interval_date_deb = ""; $btn_remove_data_interval_date_fin = ""; $date_debut = strftime("%Y-%m-%d", mktime(0, 0, 0, date('m'), date('d')-1, date('y'))); $btn_date_deb=str_replace("!!date_deb!!",$date_debut,$btn_date_deb); $btn_date_deb=str_replace("!!date_deb_lib!!",formatdate($date_debut),$btn_date_deb); $date_fin = today(); $btn_date_fin=str_replace("!!date_fin!!",$date_fin,$btn_date_fin); $btn_date_fin=str_replace("!!date_fin_lib!!",formatdate($date_fin),$btn_date_fin); $date_echeance = today(); $btn_date_echeance=str_replace("!!date_ech!!",$date_echeance,$btn_date_echeance); $btn_date_echeance=str_replace("!!date_ech_lib!!",formatdate($date_echeance),$btn_date_echeance); $options=str_replace("!!date_deb_btn!!",$btn_date_deb,$options); $options=str_replace("!!date_fin_btn!!",$btn_date_fin,$options); $options=str_replace("!!echeance_btn!!",$btn_date_echeance,$options); $options=str_replace("!!remove_data_interval_date_deb!!",$btn_remove_data_interval_date_deb,$options); $options=str_replace("!!remove_data_interval_date_fin!!",$btn_remove_data_interval_date_fin,$options); return $options; } /** * Affiche la recherche + la liste */ public function get_display_list() { global $msg; if(static::class == 'list_statopac_ui') { $requete_vue = "select * from statopac_vues order by date_consolidation desc, nom_vue"; $res = pmb_mysql_query($requete_vue); if(pmb_mysql_num_rows($res) == 0){ $options_consolidation = ''; } else { $options_consolidation = $this->get_options_consolidation(); } $display = "

$msg[stat_view_list]

".parent::get_display_list()."
".$options_consolidation."
".$this->get_buttons_list()."
"; } else { $display = parent::get_display_list(); } return $display; } protected function get_error_message_empty_selection($action=array()) { global $msg; return $msg['stat_no_view_created']; } }