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 500e519..48352a7 100644 (file)
@@ -79,13 +79,13 @@ function generate_table_admin_for_persons( $status ) {
                                foreach ( $teams_id as $id ) {
                                        $teams_links[] = "<a href='#' title='".$teams_information[$id]->name_fr."'>$id</a>";
                                }
-                               $person_array['equipes'] = ( ( is_array( $teams_links ) ) ? implode( ', ', $teams_links ): $teams_links );
+                               $person_array['equipes'] = MonLaboLib::secured_implode( ', ', $teams_links );
                        } else {
                                $person_array['equipes'] = '';
                        }
                        $mentors_name = $MonLabo_access_data->get_mentors_name_for_a_person( $person_information->id );
                        if ( !empty( $mentors_name ) ) {
-                               $person_array['mentors'] = '<small>'.( ( is_array( $mentors_name ) ) ? implode( ', ', $mentors_name ) : $mentors_name ).'</small>';
+                               $person_array['mentors'] = '<small>' . MonLaboLib::secured_implode( ', ', $mentors_name ) . '</small>';
                        } else {
                                $person_array['mentors'] = '';
                        }
@@ -141,7 +141,7 @@ function generate_table_admin_for_teams() {
                                foreach ( explode( ', ', $team_information->wp_post_id ) as $id ) {
                                        $teams_links[] = '<a href="'.get_edit_post_link( $id ).'&action=edit">'.$id.'</a>';
                                }
-                               $team_array['wp_post_id'] = ( ( is_array( $teams_links ) ) ? implode( ', ', $teams_links ) : $teams_links );
+                               $team_array['wp_post_id'] = MonLaboLib::secured_implode( ', ', $teams_links );
                        } else {
                                $team_array['wp_post_id'] = '';
                        }
@@ -155,7 +155,7 @@ function generate_table_admin_for_teams() {
                        }
                        $team_array['color'] = $team_information->color;
                        $team_names = $MonLabo_access_data->get_leaders_name_for_a_team( $team_information->id );
-                       $team_array['leaders'] = ( ( is_array( $team_names ) ) ? implode( ', ', $team_names ) : $team_names );
+                       $team_array['leaders'] = MonLaboLib::secured_implode( ', ', $team_names );
 
                        if ( MAIN_STRUCT_NO_UNIT === $team_information->id_unit ) {
                                $team_array['id_unit'] = __( 'Structure principale', 'mon-laboratoire' );
@@ -170,7 +170,7 @@ function generate_table_admin_for_teams() {
                                        foreach ( $thematics_information as $thematic ) {
                                                $thematics_links[] = "<a href='#' title='".$thematic->name_fr."'>$thematic->id</a>";
                                        }
-                                       $team_array['thematics'] = ( ( is_array( $thematics_links ) ) ? implode( ', ', $thematics_links ) : $thematics_links );
+                                       $team_array['thematics'] = MonLaboLib::secured_implode( ', ', $thematics_links );
                                } else {
                                        $team_array['thematics'] = '';
                                }
@@ -217,7 +217,7 @@ function generate_table_admin_for_thematics() {
                                foreach ( $teams_information as $team ) {
                                        $teams_links[] = "<a href='#' title='".$team->name_fr."'>$team->id</a>";
                                }
-                               $thematic_array['thematics'] = ( ( is_array( $teams_links ) ) ? implode( ', ', $teams_links ) : $teams_links );
+                               $thematic_array['thematics'] = MonLaboLib::secured_implode( ', ', $teams_links );
                        } else {
                                $thematic_array['thematics'] = '';
                        }
@@ -263,7 +263,11 @@ function generate_table_admin_for_units() {
                                                          __( 'Contact alt.', 'mon-laboratoire' ),
                                                          __( 'Directeurs', 'mon-laboratoire' ) );
        $list_array = array();
-       $number_of_units = count( $units_information );
+       if( !empty( $units_information ) ) {
+               $number_of_units = count( $units_information );
+       } else {
+               $number_of_units = 0;
+       }
        $a_afficher = '';
        if ( '0' != $number_of_units ) {
                foreach ( $units_information as $unit_information ) {
@@ -289,7 +293,7 @@ function generate_table_admin_for_units() {
                        $unit_array['contact_alt'] = $unit_information->contact_alt;
                        $directors = $MonLabo_access_data->get_directors_name_for_an_unit( $unit_information->id );
                        if ( !empty( $directors ) ) {
-                               $unit_array['directors'] = ( ( is_array( $directors ) ) ? implode( ', ', $directors ): $directors );
+                               $unit_array['directors'] = MonLaboLib::secured_implode( ', ', $directors );
                        } else {
                                $unit_array['directors'] = '';
                        }