diff --git a/swad_changelog.h b/swad_changelog.h index d1eccd705..d513aacbd 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -231,19 +231,21 @@ // TODO: Statistics of hits in course accessible by non-editing teachers. -// TODO: Include non-editing teachers in Usr_ListAllDataTchs () and Usr_SeeTchClassPhotoPrn () +// TODO: Fix order of teachers when listing record cards of teachers +// TODO: Include non-editing teachers in Usr_SeeTchClassPhotoPrn () /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.225.1 (2017-05-26)" +#define Log_PLATFORM_VERSION "SWAD 16.225.2 (2017-05-26)" #define CSS_FILE "swad16.222.css" #define JS_FILE "swad16.206.3.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.225.2: May 26, 2017 Fixed bug in lists of teachers. (220601 lines) Version 16.225.1: May 26, 2017 Fixed bug related with new role. (220580 lines) Version 16.225: May 25, 2017 Changes and bug fixing related with new role. (220580 lines) Version 16.224.2: May 25, 2017 Button to show big list of users/courses integrated in alert. (220465 lines) diff --git a/swad_user.c b/swad_user.c index b0229e8ae..c5ec7f08f 100644 --- a/swad_user.c +++ b/swad_user.c @@ -172,6 +172,9 @@ static void Usr_PutCheckboxListWithPhotos (void); static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr); static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr); static void Usr_ListMainDataTchs (Rol_Role_t Role,bool PutCheckBoxToSelectUsr); +static void Usr_ListRowsAllDataTchs (Rol_Role_t Role, + const char *FieldNames[Usr_NUM_ALL_FIELDS_DATA_TCH], + unsigned NumColumns); static void Usr_GetAndUpdateUsrListType (void); static void Usr_GetUsrListTypeFromForm (void); static void Usr_GetMyUsrListTypeFromDB (void); @@ -6519,10 +6522,8 @@ void Usr_ListAllDataTchs (void) extern const char *Txt_Department; extern const char *Txt_Office; extern const char *Txt_Phone; + unsigned NumUsrs; unsigned NumColumns; - unsigned NumCol; - unsigned NumUsr; - struct UsrData UsrDat; const char *FieldNames[Usr_NUM_ALL_FIELDS_DATA_TCH]; /***** Initialize field names *****/ @@ -6554,50 +6555,24 @@ void Usr_ListAllDataTchs (void) Sco_GetScope ("ScopeUsr"); /***** Get list of teachers *****/ - Usr_GetListUsrs (Gbl.Scope.Current,Rol_TCH); + Usr_GetListUsrs (Gbl.Scope.Current,Rol_NET); // Non-editing teachers + Usr_GetListUsrs (Gbl.Scope.Current,Rol_TCH); // Teachers + NumUsrs = Usr_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current, + 1 << Rol_NET | + 1 << Rol_TCH); - if (Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs) + if (NumUsrs) { /***** Initialize number of columns *****/ NumColumns = Usr_NUM_ALL_FIELDS_DATA_TCH; - /***** Start table with list of teachers *****/ + /***** Start table with lists of teachers *****/ Lay_StartTableWide (0); - /* Start row */ - fprintf (Gbl.F.Out,""); - for (NumCol = (Gbl.Usrs.Listing.WithPhotos ? 0 : - 1); - NumCol < NumColumns; - NumCol++) - fprintf (Gbl.F.Out,"" - "%s " - "", - FieldNames[NumCol]); - - /* End row */ - fprintf (Gbl.F.Out,""); - - /***** Initialize structure with user's data *****/ - Usr_UsrDataConstructor (&UsrDat); - - /***** List data of teachers *****/ - for (NumUsr = 0, Gbl.RowEvenOdd = 0; - NumUsr < Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs; ) - { - UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_TCH].Lst[NumUsr].UsrCod; - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist... - { - UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_TCH].Lst[NumUsr].Accepted; - NumUsr++; - Usr_WriteRowTchAllData (&UsrDat); - - Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; - } - } - - /***** Free memory used for user's data *****/ - Usr_UsrDataDestructor (&UsrDat); + /***** List teachers and non-editing teachers *****/ + Gbl.RowEvenOdd = 0; + Usr_ListRowsAllDataTchs (Rol_TCH,FieldNames,NumColumns); + Usr_ListRowsAllDataTchs (Rol_NET,FieldNames,NumColumns); /***** End of table *****/ Lay_EndTable (); @@ -6610,6 +6585,52 @@ void Usr_ListAllDataTchs (void) Usr_FreeUsrsList (Rol_TCH); } +/*****************************************************************************/ +/*********************** List all teachers' data rows ************************/ +/*****************************************************************************/ + +static void Usr_ListRowsAllDataTchs (Rol_Role_t Role, + const char *FieldNames[Usr_NUM_ALL_FIELDS_DATA_TCH], + unsigned NumColumns) + { + unsigned NumCol; + struct UsrData UsrDat; + unsigned NumUsr; + + /***** Heading row *****/ + fprintf (Gbl.F.Out,""); + for (NumCol = (Gbl.Usrs.Listing.WithPhotos ? 0 : + 1); + NumCol < NumColumns; + NumCol++) + fprintf (Gbl.F.Out,"" + "%s " + "", + FieldNames[NumCol]); + fprintf (Gbl.F.Out,""); + + /***** Initialize structure with user's data *****/ + Usr_UsrDataConstructor (&UsrDat); + + /***** List data of teachers *****/ + for (NumUsr = 0; + NumUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs; ) + { + UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod; + if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist... + { + UsrDat.Accepted = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted; + NumUsr++; + Usr_WriteRowTchAllData (&UsrDat); + + Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; + } + } + + /***** Free memory used for user's data *****/ + Usr_UsrDataDestructor (&UsrDat); + } + /*****************************************************************************/ /****************************** List users found *****************************/ /*****************************************************************************/