The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings MonLabo
Summary Activity Tracker Tasks Docs SCM Files Dokuwiki Continious Integration Listes Sympa

SCM Repository

index 2193b41..e70a95c 100644 (file)
@@ -557,9 +557,25 @@ class MonLabo_shortcodes_publications extends MonLabo_shortcodes_mother_class {
             } else {
                 //Determine la liste des ID HAL a utiliser
                 $HAL_ids=array();
+                $idHal=array();
                 if ($page_mode=="team_or_unit_page") { //Equipe
                     $HAL_ids =                       self::_MonLaboTeamsIds_into_publicationServerTeamsIds($teams_id);
-                    $HAL_ids = array_merge($HAL_ids, self::_MonLaboUnitsIds_into_publicationServerUnitsIds($units_id));
+                    // Si pas de hal_publi_team_id définis pour les équipes
+                    if( (!empty($teams_id)) and (empty($HAL_ids))) {
+                        //Retourner les publications des membres de l'équipe
+                        foreach ($teams_id as $team_id) {
+                            $idHal=array_merge($idHal, self::_MonLaboPersonsIds_into_publicationServerAuthorsIds($MonLabo_access_data->get_persons_id_for_a_team($team_id)));
+                        }
+                    }
+                    $unitHAL_ids=self::_MonLaboUnitsIds_into_publicationServerUnitsIds($units_id);
+                    $HAL_ids = array_merge($HAL_ids, $unitHAL_ids);
+                    // Si pas de hal_publi_team_id définis pour les unités
+                    if( (!empty($units_id)) and (empty($unitHAL_ids))) {
+                        //Retourner les publications des membres de l'unité
+                        foreach ($units_id as $unit_id) {
+                            $idHal=array_merge($idHal, self::_MonLaboPersonsIds_into_publicationServerAuthorsIds(array_keys($MonLabo_access_data->get_persons_information_for_an_unit($unit_id))));
+                        }
+                    }
                 } elseif($page_mode=="main_structure_page") {
                     if (!empty($options1["MonLabo_hal_publi_struct_id"])) {
                         $HAL_ids = MonLaboLib::prepare_multiple_values_variable_into_array($options1["MonLabo_hal_publi_struct_id"]);
@@ -574,7 +590,10 @@ class MonLabo_shortcodes_publications extends MonLabo_shortcodes_mother_class {
                     }
                 }
                 //Formatage de la requête
-                if(!empty($HAL_ids)) {
+                //Les paramètres idHal et struct sont incompatibles.
+                if(!empty($idHal)) {
+                    $POST_query["idHal"]=implode(";", $idHal);
+                } elseif(!empty($HAL_ids)) {
                     $POST_query["struct"]=implode(";", $HAL_ids);
                 } else {
                     return array("", ""); /*Vide*/