diff --git a/swad_attendance.c b/swad_attendance.c
index b8079170..967b9983 100644
--- a/swad_attendance.c
+++ b/swad_attendance.c
@@ -1868,9 +1868,9 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt);
/***** Get and order list of students in this course *****/
- Usr_GetListUsrs (&Gbl.Usrs.LstStds,Rol_STUDENT,Sco_SCOPE_CRS);
+ Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
- if (Gbl.Usrs.LstStds.NumUsrs)
+ if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs)
{
/***** Get my preference about photos in users' list for current course *****/
Usr_GetMyPrefAboutListWithPhotosFromDB ();
@@ -1908,13 +1908,13 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
/* List of students */
for (NumStd = 0, Gbl.RowEvenOdd = 0;
- NumStd < Gbl.Usrs.LstStds.NumUsrs;
+ NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumStd++)
{
- UsrDat.UsrCod = Gbl.Usrs.LstStds.Lst[NumStd].UsrCod;
+ UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod;
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
{
- UsrDat.Accepted = Gbl.Usrs.LstStds.Lst[NumStd].Accepted;
+ UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].Accepted;
Att_WriteRowStdToCallTheRoll (NumStd + 1,&UsrDat,Att);
}
}
@@ -1932,7 +1932,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
/***** Free memory for students list *****/
- Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
+ Usr_FreeUsrsList (Rol_STUDENT);
/***** Free memory for list of selected groups *****/
Grp_FreeListCodSelectedGrps ();
@@ -2154,12 +2154,12 @@ void Att_RegisterMeAsStdInAttEvent (void)
/***************** Save students who attended to an event ********************/
/*****************************************************************************/
/* Algorithm:
- 1. Get list of students in the groups selected: Gbl.Usrs.LstStds
+ 1. Get list of students in the groups selected: Gbl.Usrs.LstUsrs[Rol_STUDENT]
2. Mark all students in the groups selected setting Remove=true
3. Get list of students marked as present by me: Gbl.Usrs.Select.Std
4. Loop over the list Gbl.Usrs.Select.Std,
that holds the list of the students marked as present,
- marking the students in Gbl.Usrs.LstStds.Lst as Remove=false
+ marking the students in Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst as Remove=false
5. Delete from att_usr all the students marked as Remove=true
6. Replace (insert without duplicated) into att_usr all the students marked as Remove=false
*/
@@ -2188,17 +2188,17 @@ void Att_RegisterStudentsInAttEvent (void)
/***** Get groups selected *****/
Grp_GetParCodsSeveralGrpsToShowUsrs ();
- /***** 1. Get list of students in the groups selected: Gbl.Usrs.LstStds *****/
+ /***** 1. Get list of students in the groups selected: Gbl.Usrs.LstUsrs[Rol_STUDENT] *****/
/* Get list of students in the groups selected */
- Usr_GetListUsrs (&Gbl.Usrs.LstStds,Rol_STUDENT,Sco_SCOPE_CRS);
+ Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
- if (Gbl.Usrs.LstStds.NumUsrs) // If there are students in the groups selected...
+ if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs) // If there are students in the groups selected...
{
/***** 2. Mark all students in the groups selected setting Remove=true *****/
for (NumStd = 0;
- NumStd < Gbl.Usrs.LstStds.NumUsrs;
+ NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumStd++)
- Gbl.Usrs.LstStds.Lst[NumStd].Remove = true;
+ Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].Remove = true;
/***** 3. Get list of students marked as present by me: Gbl.Usrs.Select.Std *****/
Usr_GetListsSelectedUsrs ();
@@ -2208,7 +2208,7 @@ void Att_RegisterStudentsInAttEvent (void)
/***** 4. Loop over the list Gbl.Usrs.Select.Std,
that holds the list of the students marked as present,
- marking the students in Gbl.Usrs.LstStds.Lst as Remove=false *****/
+ marking the students in Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst as Remove=false *****/
Ptr = Gbl.Usrs.Select.Std;
while (*Ptr)
{
@@ -2217,11 +2217,11 @@ void Att_RegisterStudentsInAttEvent (void)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrData)) // Get student's data from the database
/***** Mark student to not be removed *****/
for (NumStd = 0;
- NumStd < Gbl.Usrs.LstStds.NumUsrs;
+ NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumStd++)
- if (Gbl.Usrs.LstStds.Lst[NumStd].UsrCod == UsrData.UsrCod)
+ if (Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod == UsrData.UsrCod)
{
- Gbl.Usrs.LstStds.Lst[NumStd].Remove = false;
+ Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].Remove = false;
break; // Found! Exit loop
}
}
@@ -2236,25 +2236,25 @@ void Att_RegisterStudentsInAttEvent (void)
// 5. Delete from att_usr all the students marked as Remove=true
// 6. Replace (insert without duplicated) into att_usr all the students marked as Remove=false
for (NumStd = 0, NumStdsAbsent = NumStdsPresent = 0;
- NumStd < Gbl.Usrs.LstStds.NumUsrs;
+ NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumStd++)
{
/***** Get comments for this student *****/
- Att_CheckIfUsrIsPresentInAttEventAndGetComments (Att.AttCod,Gbl.Usrs.LstStds.Lst[NumStd].UsrCod,CommentStd,CommentTch);
- sprintf (CommentParamName,"CommentTch%ld",Gbl.Usrs.LstStds.Lst[NumStd].UsrCod);
+ Att_CheckIfUsrIsPresentInAttEventAndGetComments (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod,CommentStd,CommentTch);
+ sprintf (CommentParamName,"CommentTch%ld",Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod);
Par_GetParToHTML (CommentParamName,CommentTch,Cns_MAX_BYTES_TEXT);
- Present = !Gbl.Usrs.LstStds.Lst[NumStd].Remove;
+ Present = !Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].Remove;
if (Present ||
CommentStd[0] ||
CommentTch[0])
/***** Register student *****/
- Att_RegUsrInAttEventChangingComments (Att.AttCod,Gbl.Usrs.LstStds.Lst[NumStd].UsrCod,
+ Att_RegUsrInAttEventChangingComments (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod,
Present,CommentStd,CommentTch);
else
/***** Remove student *****/
- Att_RemoveUsrFromAttEvent (Att.AttCod,Gbl.Usrs.LstStds.Lst[NumStd].UsrCod);
+ Att_RemoveUsrFromAttEvent (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod);
if (Present)
NumStdsPresent++;
@@ -2263,7 +2263,7 @@ void Att_RegisterStudentsInAttEvent (void)
}
/***** Free memory for students list *****/
- Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
+ Usr_FreeUsrsList (Rol_STUDENT);
/***** Write final message *****/
sprintf (Format,"%s: %%u %s: %%u",Txt_Presents,Txt_Absents);
@@ -2271,7 +2271,7 @@ void Att_RegisterStudentsInAttEvent (void)
NumStdsPresent,NumStdsAbsent);
Lay_ShowAlert (Lay_INFO,Gbl.Message);
}
- else // Gbl.Usrs.LstStds.NumUsrs == 0
+ else // Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs == 0
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_STUDENT]);
/***** Show the attendance event again *****/
@@ -2533,11 +2533,11 @@ void Usr_ReqListStdsAttendanceCrs (void)
Grp_ShowFormToSelectSeveralGroups (ActReqLstStdAtt);
/***** Get and order lists of users from current course *****/
- Usr_GetListUsrs (&Gbl.Usrs.LstStds,Rol_STUDENT,Sco_SCOPE_CRS);
+ Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
- if (Gbl.Usrs.LstStds.NumUsrs)
+ if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs)
{
- if (Usr_GetIfShowBigList (Gbl.Usrs.LstStds.NumUsrs))
+ if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs))
{
/***** Get list of selected users *****/
Usr_GetListsSelectedUsrs ();
@@ -2575,7 +2575,7 @@ void Usr_ReqListStdsAttendanceCrs (void)
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
/***** Free memory for students list *****/
- Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
+ Usr_FreeUsrsList (Rol_STUDENT);
/***** Free memory for list of selected groups *****/
Grp_FreeListCodSelectedGrps ();
diff --git a/swad_changelog.h b/swad_changelog.h
index 16b1937d..86d371c4 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -129,13 +129,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.227.1 (2016-06-23)"
+#define Log_PLATFORM_VERSION "SWAD 15.228 (2016-06-23)"
#define CSS_FILE "swad15.226.css"
#define JS_FILE "swad15.226.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 15.228 Jun 23, 2015 Code refactoring in lists of users. (202814 lines)
Version 15.227.1 Jun 23, 2015 Code refactoring in getting/searching users. (202854 lines)
Version 15.227: Jun 21, 2015 Query optimization in search of users. (202820 lines)
Version 15.226.7: Jun 19, 2015 One new social network. (202969 lines)
diff --git a/swad_enrollment.c b/swad_enrollment.c
index 6ed33fff..f86cac1c 100644
--- a/swad_enrollment.c
+++ b/swad_enrollment.c
@@ -1240,7 +1240,6 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
unsigned NumUsrsRegistered = 0;
unsigned NumUsrsRemoved = 0;
unsigned NumUsrsEliminated = 0;
- struct ListUsers *LstCurrentUsrs;
struct ListCodGrps LstGrps;
struct UsrData UsrDat;
bool ItLooksLikeAUsrID;
@@ -1371,28 +1370,15 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
if (WhatToDo.RemoveUsrs)
{
/***** Get list of users in current course *****/
- switch (Role)
- {
- case Rol_STUDENT:
- LstCurrentUsrs = &Gbl.Usrs.LstStds;
- break;
- case Rol_TEACHER:
- LstCurrentUsrs = &Gbl.Usrs.LstTchs;
- break;
- default:
- LstCurrentUsrs = NULL; // To avoid warning
- Lay_ShowErrorAndExit ("Wrong role."); // If user manipulated the form
- break;
- }
- Usr_GetListUsrs (LstCurrentUsrs,Rol_STUDENT,Sco_SCOPE_CRS);
+ Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
- if (LstCurrentUsrs->NumUsrs)
+ if (Gbl.Usrs.LstUsrs[Role].NumUsrs)
{
/***** Initialize list of users to remove *****/
for (NumCurrentUsr = 0;
- NumCurrentUsr < LstCurrentUsrs->NumUsrs;
+ NumCurrentUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs;
NumCurrentUsr++)
- LstCurrentUsrs->Lst[NumCurrentUsr].Remove = !WhatToDo.RemoveSpecifiedUsrs;
+ Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].Remove = !WhatToDo.RemoveSpecifiedUsrs;
/***** Loop 1: go through form list setting if a student must be removed *****/
/* Step a: Get students from a list of official groups */
@@ -1464,21 +1450,21 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
{
if (ListUsrCods.NumUsrs == 1) // If more than one user found ==> do not remove
for (NumCurrentUsr = 0;
- NumCurrentUsr < LstCurrentUsrs->NumUsrs;
+ NumCurrentUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs;
NumCurrentUsr++)
- if (LstCurrentUsrs->Lst[NumCurrentUsr].UsrCod == ListUsrCods.Lst[0]) // User found
- LstCurrentUsrs->Lst[NumCurrentUsr].Remove = true; // Mark as removable
+ if (Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].UsrCod == ListUsrCods.Lst[0]) // User found
+ Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].Remove = true; // Mark as removable
}
else // Remove all the users (of the role) except these specified
{
for (NumCurrentUsr = 0;
- NumCurrentUsr < LstCurrentUsrs->NumUsrs;
+ NumCurrentUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs;
NumCurrentUsr++)
for (NumUsrFound = 0;
NumUsrFound < ListUsrCods.NumUsrs;
NumUsrFound++)
- if (LstCurrentUsrs->Lst[NumCurrentUsr].UsrCod == ListUsrCods.Lst[NumUsrFound]) // User found
- LstCurrentUsrs->Lst[NumCurrentUsr].Remove = false; // Mark as not removable
+ if (Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].UsrCod == ListUsrCods.Lst[NumUsrFound]) // User found
+ Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].Remove = false; // Mark as not removable
}
/* Free memory used for list of users' codes found for this ID */
@@ -1487,11 +1473,11 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
/***** Loop 2: go through users list removing users *****/
for (NumCurrentUsr = 0;
- NumCurrentUsr < LstCurrentUsrs->NumUsrs;
+ NumCurrentUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs;
NumCurrentUsr++)
- if (LstCurrentUsrs->Lst[NumCurrentUsr].Remove) // If this student must be removed
+ if (Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].Remove) // If this student must be removed
{
- UsrDat.UsrCod = LstCurrentUsrs->Lst[NumCurrentUsr].UsrCod;
+ UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].UsrCod;
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
{
if (WhatToDo.EliminateUsrs) // Eliminate user completely from the platform
@@ -1527,7 +1513,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
}
/***** Free memory for users list *****/
- Usr_FreeUsrsList (LstCurrentUsrs);
+ Usr_FreeUsrsList (Role);
}
/***** Register users *****/
@@ -1776,13 +1762,13 @@ static void Enr_MarkOfficialStdsAsRemovable (long ImpGrpCod,bool RemoveSpecified
if (ID_GetListUsrCodsFromUsrID (&Gbl.Usrs.Other.UsrDat,NULL,&ListUsrCods,false)) // User(s) found
{
for (NumUsr = 0;
- NumUsr < Gbl.Usrs.LstStds.NumUsrs;
+ NumUsr < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumUsr++)
for (NumUsrFound = 0;
NumUsrFound < ListUsrCods.NumUsrs;
NumUsrFound++)
- if (Gbl.Usrs.LstStds.Lst[NumUsr].UsrCod == ListUsrCods.Lst[NumUsrFound]) // User found
- Gbl.Usrs.LstStds.Lst[NumUsr].Remove = RemoveSpecifiedUsrs;
+ if (Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].UsrCod == ListUsrCods.Lst[NumUsrFound]) // User found
+ Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].Remove = RemoveSpecifiedUsrs;
/* Free memory used for list of users' codes found for this ID */
Usr_FreeListUsrCods (&ListUsrCods);
@@ -1879,21 +1865,21 @@ unsigned Enr_RemAllStdsInCrs (struct Course *Crs)
/***** Get list of students in current course *****/
Gbl.Usrs.ClassPhoto.AllGroups = true; // Get all the students of the current course
- Usr_GetListUsrs (&Gbl.Usrs.LstStds,Rol_STUDENT,Sco_SCOPE_CRS);
- NumStdsInCrs = Gbl.Usrs.LstStds.NumUsrs;
+ Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
+ NumStdsInCrs = Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
/***** Remove all the students *****/
for (NumUsr = 0;
NumUsr < NumStdsInCrs;
NumUsr++)
{
- Gbl.Usrs.Other.UsrDat.UsrCod = Gbl.Usrs.LstStds.Lst[NumUsr].UsrCod;
+ Gbl.Usrs.Other.UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].UsrCod;
Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,Crs,
Enr_REMOVE_WORKS,Cns_QUIET);
}
/***** Free memory for students list *****/
- Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
+ Usr_FreeUsrsList (Rol_STUDENT);
return NumStdsInCrs;
}
diff --git a/swad_file_browser.c b/swad_file_browser.c
index c8ef2d1a..727c3c2b 100644
--- a/swad_file_browser.c
+++ b/swad_file_browser.c
@@ -3096,14 +3096,14 @@ void Brw_AskEditWorksCrs (void)
Grp_ShowFormToSelectSeveralGroups (ActReqAsgWrkCrs);
/***** Get and order lists of users from this course *****/
- Usr_GetListUsrs (&Gbl.Usrs.LstTchs,Rol_TEACHER,Sco_SCOPE_CRS);
- Usr_GetListUsrs (&Gbl.Usrs.LstStds,Rol_STUDENT,Sco_SCOPE_CRS);
+ Usr_GetListUsrs (Rol_TEACHER,Sco_SCOPE_CRS);
+ Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
- if (Gbl.Usrs.LstTchs.NumUsrs ||
- Gbl.Usrs.LstStds.NumUsrs)
+ if (Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs ||
+ Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs)
{
- if (Usr_GetIfShowBigList (Gbl.Usrs.LstTchs.NumUsrs +
- Gbl.Usrs.LstStds.NumUsrs))
+ if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs +
+ Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs))
{
/***** Draw class photos to select users *****/
Lay_StartRoundFrame (NULL,Txt_Users,NULL);
@@ -3136,8 +3136,8 @@ void Brw_AskEditWorksCrs (void)
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN);
/***** Free memory for users' list *****/
- Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
- Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
+ Usr_FreeUsrsList (Rol_TEACHER);
+ Usr_FreeUsrsList (Rol_STUDENT);
/***** Free the memory used by the list of users *****/
Usr_FreeListsSelectedUsrCods ();
diff --git a/swad_global.c b/swad_global.c
index 44c0ee45..1f1046f5 100644
--- a/swad_global.c
+++ b/swad_global.c
@@ -183,17 +183,17 @@ void Gbl_InitializeGlobals (void)
Gbl.Action.UsesAJAX = false;
Gbl.Action.Tab = TabUnk;
- Gbl.Usrs.LstGsts.NumUsrs = 0;
- Gbl.Usrs.LstGsts.Lst = NULL;
+ Gbl.Usrs.LstUsrs[Rol__GUEST_].Lst = NULL;
+ Gbl.Usrs.LstUsrs[Rol__GUEST_].NumUsrs = 0;
- Gbl.Usrs.LstStds.NumUsrs = 0;
- Gbl.Usrs.LstStds.Lst = NULL;
+ Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst = NULL;
+ Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs = 0;
- Gbl.Usrs.LstTchs.NumUsrs = 0;
- Gbl.Usrs.LstTchs.Lst = NULL;
+ Gbl.Usrs.LstUsrs[Rol_TEACHER].Lst = NULL;
+ Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs = 0;
- Gbl.Usrs.LstAdms.NumUsrs = 0;
- Gbl.Usrs.LstAdms.Lst = NULL;
+ Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst = NULL; // Used to list of administrators of any scope, not only degree administrators
+ Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs = 0;
Gbl.ExamAnnouncements.NumExaAnns = 0;
Gbl.ExamAnnouncements.Lst = NULL;
@@ -462,9 +462,10 @@ void Gbl_Cleanup (void)
Hld_FreeListHolidays ();
Lnk_FreeListLinks ();
Plg_FreeListPlugins ();
- Usr_FreeUsrsList (&Gbl.Usrs.LstAdms);
- Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
- Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
+ Usr_FreeUsrsList (Rol__GUEST_);
+ Usr_FreeUsrsList (Rol_STUDENT);
+ Usr_FreeUsrsList (Rol_TEACHER);
+ Usr_FreeUsrsList (Rol_DEG_ADM);
Usr_FreeListOtherRecipients ();
Usr_FreeListsSelectedUsrCods ();
Syl_FreeListItemsSyllabus ();
diff --git a/swad_global.h b/swad_global.h
index 6ee812f0..dd4c68e0 100644
--- a/swad_global.h
+++ b/swad_global.h
@@ -362,10 +362,7 @@ struct Globals
{
struct UsrData UsrDat;
} Other; // Another user, used for example to register in / remove from a course
- struct ListUsers LstGsts;
- struct ListUsers LstStds;
- struct ListUsers LstTchs;
- struct ListUsers LstAdms;
+ struct ListUsrs LstUsrs[Rol_NUM_ROLES];
struct
{
char *All;
diff --git a/swad_message.c b/swad_message.c
index 5a5c1e1c..acf5fca3 100644
--- a/swad_message.c
+++ b/swad_message.c
@@ -162,11 +162,11 @@ void Msg_ListEMails (void)
Grp_ShowFormToSelectSeveralGroups (ActMaiStd);
/***** Get and order list of students in this course *****/
- Usr_GetListUsrs (&Gbl.Usrs.LstStds,Rol_STUDENT,Sco_SCOPE_CRS);
+ Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
- if (Gbl.Usrs.LstStds.NumUsrs)
+ if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs)
{
- if (Usr_GetIfShowBigList (Gbl.Usrs.LstStds.NumUsrs))
+ if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs))
{
/***** Start of the frame used to list the e-mails *****/
Lay_StartRoundFrameTable (NULL,0,Txt_Students_who_have_accepted_and_who_have_e_mail);
@@ -178,13 +178,13 @@ void Msg_ListEMails (void)
/***** List the students' e-mail addresses *****/
for (NumUsr = 0;
- NumUsr < Gbl.Usrs.LstStds.NumUsrs;
+ NumUsr < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumUsr++)
{
- UsrDat.UsrCod = Gbl.Usrs.LstStds.Lst[NumUsr].UsrCod;
+ UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].UsrCod;
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
{
- UsrDat.Accepted = Gbl.Usrs.LstStds.Lst[NumUsr].Accepted;
+ UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].Accepted;
if (UsrDat.Email[0])
{
NumStdsWithEmail++;
@@ -224,7 +224,7 @@ void Msg_ListEMails (void)
"