1000 GROUP BY vedette_object.object_id"; $result = pmb_mysql_query($query, $dbh); if ($result && pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $filtered_results = self::get_filtered_results($row->elements_ids, $tab); if($filtered_results){ if(!isset($groups[$row->object_id])){ $authperso = new authority(0,$row->object_id, AUT_TABLE_AUTHPERSO); $groups[$row->object_id] = array( 'label' => $authperso->get_object_instance()->get_header(), 'nb_results' => (substr_count($filtered_results,",") + 1) ); } } } } $elements_ids = array(); if (count($groups)) { // On trie le tableau uasort($groups, array('authority_tabs', '_sort_groups_by_label')); $tab->add_groups($filter['name'], array( 'label' => $filter['label'], 'elements' => $groups )); $filter_values = $tab->get_filter_values($filter['name']); //Si on a des résultats; on passe à la suite if($filter_values && count($filter_values)){ $query = "select group_concat(distinct responsability_notice separator ',') from responsability join vedette_link on vedette_link.num_object=responsability.id_responsability and vedette_link.type_object in (".TYPE_NOTICE_RESPONSABILITY_PRINCIPAL.",".TYPE_NOTICE_RESPONSABILITY_SECONDAIRE.",".TYPE_NOTICE_RESPONSABILITY_AUTRE.") join vedette_object on vedette_object.num_vedette=vedette_link.num_vedette where responsability.responsability_author = ".$element_id." and vedette_object.object_type > 1000"; $query.= ' and vedette_object.object_id in ("'.implode('","', $filter_values).'")'; // $query.= ' group by responsability.responsability_notice'; $result = pmb_mysql_query($query, $dbh); if($result){ $filtered_result = explode(',', self::get_filtered_results(pmb_mysql_result($result, 0, 0),$tab)); if(is_array($filtered_result)){ return $filtered_result; } return $elements_ids; } } } return $elements_ids; } public static function get_author_tu_per_role($tab, $filter, $element_id) { global $dbh, $msg; //Récupération du nombre de notice liées $groups = array(); $query = "SELECT count(responsability_tu_num) as nb, vedette_object.object_id from responsability_tu join vedette_link on vedette_link.num_object=responsability_tu.id_responsability_tu and vedette_link.type_object= ".TYPE_TU_RESPONSABILITY." join vedette_object on vedette_object.num_vedette=vedette_link.num_vedette where responsability_tu.responsability_tu_author_num = ".$element_id." and vedette_object.object_type > 1000 GROUP BY vedette_object.object_id"; $result = pmb_mysql_query($query, $dbh); if ($result && pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { if(!isset($groups[$row->object_id])){ $authperso = new authority(0,$row->object_id, AUT_TABLE_AUTHPERSO); $groups[$row->object_id] = array( 'label' => $authperso->get_object_instance()->get_header(), 'nb_results' => $row->nb ); } $nb_results+= $row->nb; } } $elements_ids = array(); if (count($groups)) { // On trie le tableau uasort($groups, array('authority_tabs', '_sort_groups_by_label')); $tab->add_groups($filter['name'], array( 'label' => $filter['label'], 'elements' => $groups )); $filter_values = $tab->get_filter_values($filter['name']); //Si on a des résultats; on passe à la suite if($filter_values && count($filter_values)){ $query = "select distinct responsability_tu_num, vedette_object.object_id from responsability_tu join vedette_link on vedette_link.num_object=responsability_tu.id_responsability_tu and vedette_link.type_object= ".TYPE_TU_RESPONSABILITY." join vedette_object on vedette_object.num_vedette=vedette_link.num_vedette join titres_uniformes on titres_uniformes.tu_id=responsability_tu.responsability_tu_num where responsability_tu.responsability_tu_author_num = ".$element_id." and vedette_object.object_type > 1000"; $query.= ' and vedette_object.object_id in ("'.implode('","', $filter_values).'")'; $query.= ' group by responsability_tu.responsability_tu_num'; $result = pmb_mysql_query($query,$dbh); if(pmb_mysql_num_rows($result)){ while($row = pmb_mysql_fetch_object($result)){ $elements_ids[] = $row->responsability_tu_num; } } } } return $elements_ids; } }