available_filters = array('main_fields' => array( 'user_input' => 'global_search', 'state' => 'acquisition_sug_etat', 'source' => 'acquisition_sugg_filtre_src', 'origins' => 'acquisition_sugg_filtre_user', 'date' => 'date_creation_query' ) ); if ($acquisition_sugg_localises) { $this->available_filters['main_fields']['location'] = 'acquisition_location'; } if ($acquisition_sugg_categ) { $this->available_filters['main_fields']['category'] = 'acquisition_categ'; } $this->available_filters['custom_fields'] = array(); } /** * Initialisation des filtres de recherche */ public function init_filters($filters=array()) { global $acquisition_sugg_localises; global $deflt_docs_location; $this->filters = array( 'user_input' => '', 'entite' => '', 'location' => ($acquisition_sugg_localises && $deflt_docs_location ? $deflt_docs_location : 0), 'category' => -1, 'source' => '', 'state' => -1, 'date_start' => '', 'date_end' => '', 'user_status' => '', 'user_id' => '' ); parent::init_filters($filters); } protected function init_default_selected_filters() { global $acquisition_sugg_localises; global $acquisition_sugg_categ; $this->add_selected_filter('user_input'); if ($acquisition_sugg_localises) { $this->add_selected_filter('location'); } else { $this->add_empty_selected_filter(); } if ($acquisition_sugg_categ) { $this->add_selected_filter('category'); } else { $this->add_empty_selected_filter(); } $this->add_selected_filter('state'); $this->add_selected_filter('source'); $this->add_selected_filter('origins'); $this->add_selected_filter('date'); } /** * Initialisation de la pagination par défaut */ protected function init_default_pager() { global $nb_per_page_search; parent::init_default_pager(); $this->pager['nb_per_page'] = $nb_per_page_search; } /** * Tri SQL */ protected function _get_query_order() { if($this->applied_sort[0]['by']) { $order = ''; $sort_by = $this->applied_sort[0]['by']; switch($sort_by) { case 'category': $order .= "libelle_categ"; break; case 'url': $order .= "url_suggestion"; break; case 'source': $order .= "libelle_source"; break; case 'etat': $this->applied_sort_type = 'OBJECTS'; break; default : $order .= $sort_by; break; } if($order) { return $this->_get_query_order_sql_build($order); } else { return ""; } } } /** * Afin de gérer les passages en GET de rétro-compatibilité */ protected function set_filters_for_retrocompatible() { global $user_id; if(isset($user_id) && is_array($user_id)) { $this->filters['user_id'] = $user_id; } global $user_statut; if(isset($user_statut) && is_array($user_statut)) { $this->filters['user_status'] = $user_statut; } } /** * Filtres provenant du formulaire */ public function set_filters_from_form() { $this->set_filters_for_retrocompatible(); $user_input = $this->objects_type.'_user_input'; global ${$user_input}; if(isset(${$user_input})) { $this->filters['user_input'] = ${$user_input}; } $location = $this->objects_type.'_location'; global ${$location}; if(isset(${$location})) { $this->filters['location'] = ${$location}; } $category = $this->objects_type.'_category'; global ${$category}; if(isset(${$category})) { $this->filters['category'] = ${$category}; } $state = 'statut'; global ${$state}; if(isset(${$state})) { $this->filters['state'] = ${$state}; } $source = $this->objects_type.'_source'; global ${$source}; if(isset(${$source})) { $this->filters['source'] = ${$source}; } $date_start = $this->objects_type.'_date_start'; global ${$date_start}; if(isset(${$date_start})) { $this->filters['date_start'] = ${$date_start}; } $date_end = $this->objects_type.'_date_end'; global ${$date_end}; if(isset(${$date_end})) { $this->filters['date_end'] = ${$date_end}; } $user_id = $this->objects_type.'_user_id'; global ${$user_id}; if(isset(${$user_id}) && is_array(${$user_id})) { $this->filters['user_id'] = ${$user_id}; } $user_status = $this->objects_type.'_user_status'; global ${$user_status}; if(isset(${$user_status}) && is_array(${$user_status})) { $this->filters['user_status'] = ${$user_status}; } parent::set_filters_from_form(); } protected function get_selector_query($type) { $query = ''; switch ($type) { case 'locations': $query = 'select idlocation as id, location_libelle as label from docs_location order by label'; break; case 'sources': $query = "select id_source as id, libelle_source as label from suggestions_source order by libelle_source"; break; } return $query; } protected function get_search_filter_user_input() { global $charset; return ""; } protected function get_search_filter_location() { global $msg; return $this->get_simple_selector($this->get_selector_query('locations'), 'location', $msg['all_location']); } protected function get_search_filter_category() { global $msg, $charset; global $acquisition_sugg_categ; $selector = ''; if ($acquisition_sugg_categ == '1') { $tab_categ = suggestions_categ::getCategList(); $selector .= ""; } return $selector; } protected function get_search_filter_state() { return $this->get_suggestions_map()->getStateSelector($this->filters['state']); } protected function get_search_filter_source() { global $msg; return $this->get_simple_selector($this->get_selector_query('sources'), 'source', $msg['acquisition_sugg_all_sources']); } protected function get_search_filter_date() { return $this->get_search_filter_interval_date('date'); } protected function get_search_filter_origins_others($indice) { global $msg; return "
get_form_name()."¶m1=".$this->objects_type."_user_id".$indice."¶m2=".$this->objects_type."_user_txt".$indice."¶m3=".$this->objects_type."_user_statut".$indice."&deb_rech='+".pmb_escape()."(this.form.".$this->objects_type."_user_txt".$indice.".value), 'selector')\" /> objects_type."_user_id".$indice.".value=0;this.form.".$this->objects_type."_user_statut".$indice.".value=0;this.form.".$this->objects_type."_user_txt".$indice.".value=''\"/>
"; } protected function get_search_filter_origins() { global $msg, $charset; $origins_inputs_form = " get_form_name()."¶m1=".$this->objects_type."_user_id0¶m2=".$this->objects_type."_user_txt0¶m3=".$this->objects_type."_user_status0&deb_rech='+".pmb_escape()."(this.form.".$this->objects_type."_user_txt0.value), 'selector')\" /> objects_type."_user_id0.value='';this.form.".$this->objects_type."_user_status0.value='';this.form.".$this->objects_type."_user_txt0.value=''\"/>
"; //Affichage origine $i=0; if (is_array($this->filters['user_id']) && count($this->filters['user_id']) && is_array($this->filters['user_status']) && count($this->filters['user_status'])) { foreach($this->filters['user_id'] as $k=>$v) { if ($v) { $user_txt = $this->objects_type."_user_txt"; global ${$user_txt}; $user_name = ${$user_txt}[$k]; if(!${$user_txt}[$k]){ if ($this->filters['user_status'][$k]==='0') { $req = "select nom, prenom from users where userid='".$this->filters['user_id'][$k]."'"; $res = pmb_mysql_query($req); $user = pmb_mysql_fetch_object($res); $user_name = $user->nom.($user->prenom ? ", ".$user->prenom : ""); } else { $req = "select concat(empr_nom,', ',empr_prenom) as nom from empr where id_empr='".$this->filters['user_id'][$k]."'"; $res = pmb_mysql_query($req); $empr = pmb_mysql_fetch_object($res); $user_name = $empr->nom; } } if($i>0) { $origins_inputs_form=str_replace('',$this->get_search_filter_origins_others($k).'',$origins_inputs_form); } $origins_inputs_form = str_replace('!!user_txt!!',htmlentities($user_name,ENT_QUOTES,$charset), $origins_inputs_form); $origins_inputs_form = str_replace('!!user_id!!',htmlentities($this->filters['user_id'][$k],ENT_QUOTES,$charset), $origins_inputs_form); $origins_inputs_form = str_replace('!!user_status!!',htmlentities($this->filters['user_status'][$k],ENT_QUOTES,$charset), $origins_inputs_form); $i++; } } $origins_inputs_form=str_replace('!!max_orig!!',$i,$origins_inputs_form); } if (!$i) { $origins_inputs_form=str_replace('!!user_id!!','',$origins_inputs_form); $origins_inputs_form=str_replace('!!user_status!!','',$origins_inputs_form); $origins_inputs_form=str_replace('!!user_txt!!','',$origins_inputs_form); $origins_inputs_form=str_replace('!!max_orig!!','1',$origins_inputs_form); } return $origins_inputs_form; } public function get_search_filters_form() { global $msg; $search_filters_form = " "; $search_filters_form .= parent::get_search_filters_form(); return $search_filters_form; } /** * Jointure externes SQL pour les besoins des filtres */ protected function _get_query_join_filters() { $filter_join_query = ''; return $filter_join_query; } /** * Filtre SQL */ protected function _get_query_filters() { $filter_query = ''; $this->set_filters_from_form(); $filters = array(); if($this->filters['location']) { $filters[] = 'sugg_location = "'.$this->filters['location'].'"'; } if($this->filters['category'] && $this->filters['category'] != '-1') { $filters[] = 'num_categ = "'.$this->filters['category'].'"'; } if($this->filters['state'] != '-1') { $mask = $this->get_suggestions_map()->getMask_FILED(); if ($this->filters['state'] == $mask) { $filters[] = "(statut & '".$mask."') = '".$mask."' "; } else { $filters[] = "(statut & '".$mask."') = 0 and (statut & ".$this->filters['state'].") = '".$this->filters['state']."' "; } } if($this->filters['source']) { $filters[] = 'sugg_source = "'.$this->filters['source'].'"'; } if($this->filters['date_start']) { $filters[] = 'date_creation >= "'.$this->filters['date_start'].'"'; } if($this->filters['date_end']) { $filters[] = 'date_creation <= "'.$this->filters['date_end'].'"'; } $tab_empr=array(); $tab_user=array(); $tab_visitor=array(); if (is_array($this->filters['user_id']) && is_array($this->filters['user_status'])) { foreach ($this->filters['user_id'] as $k=>$id) { if ($this->filters['user_status'][$k] == "0") { $tab_user[] = $id; } if ($this->filters['user_status'][$k] == "1") { $tab_empr[] = $id; } if ($this->filters['user_status'][$k] == "2") { $tab_visitor[] = $id; } } $filters_origins = array(); if(count($tab_empr)) { $filters_origins[] = 'suggestions_origine.origine IN ("'.implode('","', $tab_empr).'") AND type_origine="1"'; } if(count($tab_user)) { $filters_origins[] = 'suggestions_origine.origine IN ("'.implode('","', $tab_user).'") AND type_origine="0"'; } if(count($tab_visitor)) { $filters_origins[] = 'suggestions_origine.origine IN ("'.implode('","', $tab_visitor).'") AND type_origine="2"'; } if(count($filters_origins)) { $filters[] = "(".implode(") or (", $filters_origins).")"; } } if($this->filters['user_input']) { $aq = $this->get_analyse_query(); $isbn = ''; $t_codes = array(); if (isEAN($this->filters['user_input'])) { // la saisie est un EAN -> on tente de le formater en ISBN $isbn = EANtoISBN($this->filters['user_input']); if($isbn) { $t_codes[] = $isbn; $t_codes[] = formatISBN($isbn,10); } } elseif (isISBN($this->filters['user_input'])) { // si la saisie est un ISBN $isbn = formatISBN($this->filters['user_input']); if($isbn) { $t_codes[] = $isbn ; $t_codes[] = formatISBN($isbn,13); } } if (count($t_codes)) { $q_codes = "("; foreach ($t_codes as $k=>$v) { if($k) { $q_codes.= "or code like '%".$v."%' "; } else { $q_codes.= "code like '%".$v."%' "; } } $q_codes.=") "; $filters[] = $q_codes; } else { $members=$aq->get_query_members("suggestions","concat(titre,' ',editeur,' ',auteur,' ',commentaires)","index_suggestion","id_suggestion"); $filters[] = $members["where"]; } } if(count($filters)) { $filter_query .= $this->_get_query_join_filters(); $filter_query .= ' where '.implode(' and ', $filters); } return $filter_query; } protected function get_link_action($action, $act) { global $msg; global $base_path; global $acquisition_sugg_to_cde; $href = ''; switch ($action) { case 'MERGE': $href = $base_path."/acquisition.php?categ=sug&action=fusChk"; break; case 'ESTIMATED': if ($acquisition_sugg_to_cde) { $href = $base_path."/acquisition.php?categ=ach&sub=devi&action=from_sug"; } break; case 'ORDERED': if ($acquisition_sugg_to_cde) { $href = $base_path."/acquisition.php?categ=ach&sub=cde&action=from_sug"; } break; case 'TODO': $href = $base_path."/acquisition.php?categ=sug&transition=TODO"; break; case 'TO_CATEG': $href = $base_path."/acquisition.php?categ=sug&action=to_categ"; break; } if(!$href) { $href = static::get_controller_url_base()."&transition=".$action."&action=list"; } return array( 'href' => $href, 'confirm' => $msg['acquisition_sug_msg_'.$act] ); } /** * Fonction de callback * @param object $a * @param object $b */ protected function _compare_objects($a, $b) { if($this->applied_sort[0]['by']) { $sort_by = $this->applied_sort[0]['by']; switch($sort_by) { case 'etat' : return strcmp($this->get_suggestions_map()->getHtmlComment($a->statut), $this->get_suggestions_map()->getHtmlComment($b->statut)); break; default : return parent::_compare_objects($a, $b); break; } } } /** * Construction dynamique de la fonction JS de tri */ protected function get_js_sort_script_sort() { $display = parent::get_js_sort_script_sort(); $display = str_replace('!!categ!!', 'sugg', $display); $display = str_replace('!!sub!!', '', $display); $display = str_replace('!!action!!', 'list', $display); return $display; } protected function get_cell_content($object, $property) { global $msg, $charset; global $base_path; $content = ''; switch($property) { case 'etat': $content .= $this->get_suggestions_map()->getHtmlComment($object->statut); break; case 'catalog': if($object->num_notice) { $req_ana = "select analysis_bulletin as bull , analysis_notice as noti from analysis where analysis_notice ='".$object->num_notice."'"; $res_ana = pmb_mysql_query($req_ana); $num_rows_ana = pmb_mysql_num_rows($res_ana); if($num_rows_ana){ $ana = pmb_mysql_fetch_object($res_ana); $url_view = analysis::get_permalink($ana->noti, $ana->bull); } else $url_view = notice::get_permalink($object->num_notice); $content .= "\"".$msg['acquisition_sug_view_not']."\""; } break; case 'url': if($object->url_suggestion) { $content .= "".htmlentities($object->url_suggestion, ENT_QUOTES, $charset).""; } break; case 'date_creation': $content .= formatdate($object->date_creation); break; case 'source': $source = new suggestion_source($object->sugg_source); $content .= $source->libelle_source; break; case 'piece_jointe': $sug = new suggestions($object->id_suggestion); $img_pj = "get_explnum('id')."\" target=\"_blank\">"; $img_import = "get_explnum('id')." \">"; $content .= ($sug->get_explnum('id') ? "$img_pj $img_import" : '' ); break; case 'category': $categ = new suggestions_categ($object->num_categ); $content .= $categ->libelle_categ; break; case 'origin': $origines_labels = array(); $sug = new suggestions($object->id_suggestion); $origines = $sug->getOrigines(); if(count($origines)) { foreach ($origines as $origine) { switch($origine['type_origine']) { case 1: // Lecteurs $origines_labels[] = emprunteur::get_name($origine['origine'], 1); break; case 2: // Visiteurs $origines_labels[] = $origine['origine']; break; default: // Utilisateurs $origines_labels[] = user::get_name($origine['origine']); break; } } } $content .= implode(' / ', $origines_labels); break; default : $content .= parent::get_cell_content($object, $property); break; } return $content; } protected function get_name_selected_objects() { return "chk"; } protected function get_display_cell($object, $property) { switch($property) { case 'catalog': $display = "".$this->get_cell_content($object, $property).""; break; case 'url': $display = "".$this->get_cell_content($object, $property).""; break; default: $display = "filters['entite']."&id_sug=".$object->id_suggestion."'\" style='cursor:pointer;'>".$this->get_cell_content($object, $property).""; break; } return $display; } public function get_error_message_empty_list() { global $msg; return return_error_message($msg['acquisition_sug_rech'], str_replace('!!sug_cle!!', $this->filters['user_input'], $msg['acquisition_sug_rech_error']), 0, './acquisition.php?categ=sug&sub=todo&action=list&id_bibli='.$this->filters['entite']); } protected function _get_query_human_user_input() { if($this->filters['user_input'] !== '*') { return $this->filters['user_input']; } return ''; } protected function _get_query_human_location() { if($this->filters['location']) { $docs_location = new docs_location($this->filters['location']); return $docs_location->libelle; } return ''; } protected function _get_query_human_category() { if($this->filters['category'] && $this->filters['category'] != '-1') { $categ = new suggestions_categ($this->filters['category']); return $categ->libelle_categ; } return ''; } protected function _get_query_human_state() { if($this->filters['state'] && $this->filters['state'] != '-1') { $states = $this->get_suggestions_map()->getStateList(); return $states[$this->filters['state']]; } return ''; } protected function _get_query_human_source() { $source = new suggestion_source($this->filters['source']); return $source->libelle_source; } protected function _get_query_human_date() { return $this->_get_query_human_interval_date('date'); } protected function _get_query_human_origins() { $labels = array(); if(is_array($this->filters['user_id']) && count($this->filters['user_id'])) { foreach ($this->filters['user_id'] as $k=>$user_id) { if($user_id) { if($this->filters['user_status'][$k]) { $labels[] = emprunteur::get_name($user_id); } else { $labels[] = user::get_name($user_id); } } } } return $labels; } protected function _get_query_human() { global $msg; $humans = $this->_get_query_human_main_fields(); if($this->filters['entite']) { $entites = new entites($this->filters['entite']); $humans['entite'] = $this->_get_label_query_human($msg['acquisition_coord_lib'], $entites->raison_sociale); } return $this->get_display_query_human($humans); } public function get_analyse_query() { global $msg; if(!isset($this->analyse_query)) { $this->analyse_query = new analyse_query(stripslashes($this->filters['user_input']),0,0,0,0); if ($this->analyse_query->error) { error_message($msg["searcher_syntax_error"],sprintf($msg["searcher_syntax_error_desc"],$this->analyse_query->current_car,$this->analyse_query->input_html,$this->analyse_query->error_message)); exit; } } return $this->analyse_query; } protected function get_button_add() { global $msg; return "filters['entite']."&sugg_location_id=".$this->filters['location']."';\" />"; } /** * Initialisation des colonnes disponibles */ protected function init_available_columns() { global $acquisition_sugg_categ; $this->available_columns = array('main_fields' => array( 'date_creation' => 'acquisition_sug_dat_cre', 'titre' => 'acquisition_sug_tit', 'editeur' => 'acquisition_sug_edi', 'auteur' => 'acquisition_sug_aut', 'etat' => 'acquisition_sug_etat', 'catalog' => 'acquisition_sug_iscat', 'url' => 'acquisition_sug_url', 'source' => 'acquisition_sugg_src', 'date_publication' => 'acquisition_sugg_date_publication', 'piece_jointe' => 'acquisition_sugg_piece_jointe', 'origin' => 'acquisition_sug_orig' ) ); if ($acquisition_sugg_categ) { $this->available_columns['main_fields']['category'] = 'acquisition_categ'; } } protected function init_default_columns() { global $acquisition_sugg_categ; $this->add_column_selection(); $this->add_column('date_creation'); $this->add_column('titre'); $this->add_column('editeur'); $this->add_column('auteur'); $this->add_column('etat'); $this->add_column('catalog'); $this->add_column('url'); if ($acquisition_sugg_categ) { $this->add_column('category'); } $this->add_column('source'); $this->add_column('date_publication'); $this->add_column('piece_jointe'); } protected function init_default_settings() { parent::init_default_settings(); $this->set_setting_display('search_form', 'options', true); $this->set_setting_display('search_form', 'export_icons', false); } protected function init_no_sortable_columns() { $this->no_sortable_columns = array( 'catalog', 'piece_jointe' ); } /** * Initialisation du tri par défaut appliqué */ protected function init_default_applied_sort() { $this->add_applied_sort('statut'); } public static function get_controller_url_base() { global $base_path; return $base_path.'/acquisition.php?categ=sug'; } protected function get_action_print_url() { global $base_path; $print_url = $base_path.'/pdf.php?pdfdoc=listsug'; $print_url .= "&user_input=".urlencode($this->filters['user_input'])."&statut=".$this->filters['state']."&num_categ=".$this->filters['category']."&sugg_location_id=".$this->filters['location']."&date_inf=".$this->filters['date_end']."&date_sup=".$this->filters['date_start']."&filtre_src=".$this->filters['source']; if (is_array($this->filters['user_id']) && count($this->filters['user_id']) && is_array($this->filters['user_status']) && count($this->filters['user_status'])) { foreach($this->filters['user_id'] as $k=>$v) { if ($v && (isset($this->filters['user_status'][$k]))) { $print_url.="&origine_id[]=".$v."&type_origine[]=".$this->filters['user_status'][$k]; } } }else{ $print_url .= "&origine_id=".$this->filters['user_id']."&type_origine=".$this->filters['user_status']; } return $print_url; } protected function get_selection_actions() { global $msg; if(!isset($this->selection_actions)) { $this->selection_actions = array(); $this->selection_actions[] = $this->get_selection_action('print', $msg['imprimer'], '', array('openPopUp' => $this->get_action_print_url(), 'openPopUpTitle' => 'print_PDF')); $this->selection_actions[] = $this->get_selection_action('merge', $msg['acquisition_sug_bt_fus'], '', $this->get_link_action('MERGE', 'fus')); $this->selection_actions[] = $this->get_selection_action('validated', $msg['acquisition_sug_bt_val'], '', $this->get_link_action('VALIDATED', 'val')); $this->selection_actions[] = $this->get_selection_action('rejected', $msg['acquisition_sug_bt_rej'], '', $this->get_link_action('REJECTED', 'rej')); $this->selection_actions[] = $this->get_selection_action('confirmed', $msg['acquisition_sug_bt_con'], '', $this->get_link_action('CONFIRMED', 'con')); $this->selection_actions[] = $this->get_selection_action('givenup', $msg['acquisition_sug_bt_aba'], '', $this->get_link_action('GIVENUP', 'aba')); $this->selection_actions[] = $this->get_selection_action('estimated', $msg['acquisition_sug_bt_dev'], '', $this->get_link_action('ESTIMATED', 'dev')); $this->selection_actions[] = $this->get_selection_action('ordered', $msg['acquisition_sug_bt_cde'], '', $this->get_link_action('ORDERED', 'cde')); $this->selection_actions[] = $this->get_selection_action('received', $msg['acquisition_sug_bt_rec'], '', $this->get_link_action('RECEIVED', 'rec')); $this->selection_actions[] = $this->get_selection_action('filed', $msg['acquisition_sug_bt_arc'], '', $this->get_link_action('FILED', 'arc')); if ($this->filters['state'] == '-1') { //Tous états possibles $this->selection_actions[] = $this->get_selection_action('deleted', $msg['63'], '', $this->get_link_action('DELETED', 'sup')); } else { $state_name=$this->get_suggestions_map()->id_to_name[$this->filters['state']]; $tostates=$this->get_suggestions_map()->transitions[$state_name]; if (in_array('DELETED', $tostates)) { $this->selection_actions[] = $this->get_selection_action('deleted', $msg['63'], '', $this->get_link_action('DELETED', 'sup')); } } } return $this->selection_actions; } protected function get_selection_mode() { return 'button'; } protected function add_event_on_selection_action($action=array()) { global $msg; $display = " on(dom.byId('".$this->objects_type."_selection_action_".$action['name']."_link'), 'click', function() { var selection = new Array(); query('.".$this->objects_type."_selection:checked').forEach(function(node) { selection.push(node.value); }); if(selection.length) { var confirm_msg = '".(isset($action['link']['confirm']) ? addslashes($action['link']['confirm']) : '')."'; if(!confirm_msg || confirm(confirm_msg)) { ".(isset($action['link']['href']) && $action['link']['href'] ? " var selected_objects_form = domConstruct.create('form', { action : '".$action['link']['href']."', name : '".$this->objects_type."_selected_objects_form', id : '".$this->objects_type."_selected_objects_form', method : 'POST' }); selection.forEach(function(selected_option) { var selected_objects_hidden = domConstruct.create('input', { type : 'hidden', name : '".$this->get_name_selected_objects()."[]', value : selected_option }); domConstruct.place(selected_objects_hidden, selected_objects_form); }); if(dom.byId('".$this->objects_type."_selection_action_to_categ_link')) { var to_categ_hidden = domConstruct.create('input', { type : 'hidden', name : 'to_categ', value : dom.byId('".$this->objects_type."_selection_action_to_categ_link').value }); domConstruct.place(to_categ_hidden, selected_objects_form); } if(dom.byId('".$this->objects_type."_selection_action_export_list')) { var export_list_hidden = domConstruct.create('input', { type : 'hidden', name : 'export_list', value : dom.byId('".$this->objects_type."_selection_action_export_list').value }); domConstruct.place(export_list_hidden, selected_objects_form); } domConstruct.place(selected_objects_form, dom.byId('list_ui_selection_actions')); dom.byId('".$this->objects_type."_selected_objects_form').submit(); " : "")." ".(isset($action['link']['openPopUp']) && $action['link']['openPopUp'] ? "openPopUp('".$action['link']['openPopUp']."&selected_objects='+selection.join(','), '".$action['link']['openPopUpTitle']."'); return false;" : "")." ".(isset($action['link']['onClick']) && $action['link']['onClick'] ? $action['link']['onClick']."(selection); return false;" : "")." } } else { alert('".addslashes($msg['list_ui_no_selected'])."'); } }); "; return $display; } protected function add_event_on_selection_other_action($action=array()) { $display = ""; return $display; } protected function get_display_spreadsheet_cell($object, $property, $row, $col) { switch ($property) { case 'url': $this->spreadsheet->write_string($row,$col, $object->url_suggestion); break; default: $this->spreadsheet->write_string($row,$col, strip_tags($this->get_cell_content($object, $property))); break; } } protected function get_display_other_action_export() { global $base_path; global $msg, $charset; $display = ""; $action = array( 'name' => 'export', 'link' => array( 'href' => $base_path.'/acquisition.php?categ=sug&sub=export' ) ); $display .= $this->add_event_on_selection_other_action($action); //Génération de la liste des conversions possibles $catalog=_parser_text_no_function_(file_get_contents($base_path."/admin/convert/imports/catalog.xml"),"CATALOG"); $display .= ""; return $display; } protected function get_display_other_action_export_tableau() { global $base_path; global $msg; $display = ""; $action = array( 'name' => 'export_tableau', 'link' => array( 'href' => $base_path.'/acquisition.php?categ=sug&sub=export_tableau' ) ); $display .= $this->add_event_on_selection_other_action($action); return $display; } protected function get_display_other_action_todo() { global $msg; $display = ""; $action = array('name' => 'todo' ,'link' => $this->get_link_action('TODO', 'todo')); if (!$this->filters['state']) $this->filters['state']='-1'; if ($this->filters['state'] == '-1') { //Tous états possibles $display .= $this->add_event_on_selection_other_action($action); return $display; } else { $state_name=$this->get_suggestions_map()->id_to_name[$this->filters['state']]; $tostates=$this->get_suggestions_map()->transitions[$state_name]; if (in_array('TODO', $tostates)) { $display .= $this->add_event_on_selection_other_action($action); return $display; } } return ""; } protected function get_display_other_action_to_categ() { global $msg, $charset; $display = " "; $display.= ""; $action = array('name' => 'to_categ' ,'link' => $this->get_link_action('TO_CATEG', 'tocateg')); if ($this->filters['state'] == '-1') { //Tous états possibles $display .= $this->add_event_on_selection_other_action($action); return $display; } else { $state_name=$this->get_suggestions_map()->id_to_name[$this->filters['state']]; if ($this->get_suggestions_map()->getState_CATEG($state_name) == 'YES') { $display .= $this->add_event_on_selection_other_action($action); return $display; } } return ""; } protected function get_display_others_actions() { global $acquisition_sugg_categ; return "
 
".$this->get_display_other_action_export()."  ".$this->get_display_other_action_export_tableau()."  ".$this->get_display_other_action_todo()."  ".($acquisition_sugg_categ == '1' ? $this->get_display_other_action_to_categ() : '')."
 
"; } public function get_suggestions_map() { if(!isset($this->suggestions_map)) { $this->suggestions_map = new suggestions_map(); } return $this->suggestions_map; } }