Version 16.216

This commit is contained in:
Antonio Cañas Vargas 2017-05-18 19:13:41 +02:00
parent bf2c0b5ab4
commit 489c687c77
52 changed files with 1232 additions and 1233 deletions

View File

@ -406,13 +406,13 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
/***** Check if I have permission to see another user's IDs *****/ /***** Check if I have permission to see another user's IDs *****/
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
/* Check 1: I can see the IDs of users who do not exist in database */ /* Check 1: I can see the IDs of users who do not exist in database */
if (UsrDat->UsrCod <= 0) // User does not exist (when creating a new user) if (UsrDat->UsrCod <= 0) // User does not exist (when creating a new user)
return true; return true;
/* Check 2: I can see the IDs of confirmed students */ /* Check 2: I can see the IDs of confirmed students */
if (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT && // A student if (UsrDat->RoleInCurrentCrsDB == Rol_STD && // A student
UsrDat->Accepted) // who accepted registration UsrDat->Accepted) // who accepted registration
return true; return true;
@ -450,8 +450,8 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID,
extern const char *Txt_Confirm_ID; extern const char *Txt_Confirm_ID;
/***** Start form *****/ /***** Start form *****/
Act_FormStartAnchor ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActCnfID_Std : Act_FormStartAnchor ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActCnfID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActCnfID_Tch : (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActCnfID_Tch :
ActCnfID_Oth), ActCnfID_Oth),
Anchor); Anchor);
if (Gbl.Action.Original != ActUnk) if (Gbl.Action.Original != ActUnk)
@ -498,8 +498,8 @@ void ID_PutLinkToChangeUsrIDs (void)
Txt_Change_IDs,Txt_Change_IDs, Txt_Change_IDs,Txt_Change_IDs,
NULL); NULL);
else // Not me else // Not me
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActFrmIDsStd : Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActFrmIDsStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActFrmIDsTch : (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActFrmIDsTch :
ActFrmIDsOth), // Guest, visitor or admin ActFrmIDsOth), // Guest, visitor or admin
NULL,Usr_PutParamOtherUsrCodEncrypted, NULL,Usr_PutParamOtherUsrCodEncrypted,
"arroba64x64.gif", "arroba64x64.gif",
@ -587,8 +587,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActRemID_Me); Act_FormStart (ActRemID_Me);
else else
{ {
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActRemID_Std : Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActRemID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActRemID_Tch : (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActRemID_Tch :
ActRemID_Oth)); // Guest, visitor or admin ActRemID_Oth)); // Guest, visitor or admin
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
} }
@ -641,8 +641,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActNewIDMe); Act_FormStart (ActNewIDMe);
else else
{ {
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActNewID_Std : Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActNewID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActNewID_Tch : (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActNewID_Tch :
ActNewID_Oth)); // Guest, visitor or admin ActNewID_Oth)); // Guest, visitor or admin
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
} }

View File

@ -312,8 +312,8 @@ static void Acc_WriteRowEmptyAccount (unsigned NumUsr,const char *ID,struct UsrD
"<td colspan=\"2\" class=\"LEFT_TOP COLOR%u\">", "<td colspan=\"2\" class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
UsrDat->Sex = Usr_SEX_UNKNOWN; UsrDat->Sex = Usr_SEX_UNKNOWN;
Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_TEACHER); Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_TCH);
Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_STUDENT); Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_STD);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
} }

View File

@ -5073,7 +5073,7 @@ void Act_AdjustCurrentAction (void)
or if I'm a teacher and I haven't filled my centre or department, or if I'm a teacher and I haven't filled my centre or department,
the only action possible is to show a form to change my common record *****/ the only action possible is to show a form to change my common record *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TEACHER)); IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TCH));
if (Gbl.Usrs.Me.UsrDat.InsCod < 0 || if (Gbl.Usrs.Me.UsrDat.InsCod < 0 ||
(IAmATeacher && (Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 || (IAmATeacher && (Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 ||
Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0))) Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0)))
@ -5111,7 +5111,7 @@ void Act_AdjustCurrentAction (void)
the only action possible is show a form to ask for enrolment *****/ the only action possible is show a form to ask for enrolment *****/
if (!Gbl.Usrs.Me.UsrDat.Accepted && Gbl.Action.Act != ActLogOut) if (!Gbl.Usrs.Me.UsrDat.Accepted && Gbl.Action.Act != ActLogOut)
{ {
Gbl.Action.Act = (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT) ? ActReqAccEnrStd : Gbl.Action.Act = (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STD) ? ActReqAccEnrStd :
ActReqAccEnrTch; ActReqAccEnrTch;
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
return; return;
@ -5120,7 +5120,7 @@ void Act_AdjustCurrentAction (void)
/***** Depending on the role I am logged... *****/ /***** Depending on the role I am logged... *****/
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
switch (Gbl.Action.Act) switch (Gbl.Action.Act)
{ {
case ActLogIn: case ActLogIn:
@ -5154,7 +5154,7 @@ void Act_AdjustCurrentAction (void)
/* If I have no photo, and current action is not available for unknown users, /* If I have no photo, and current action is not available for unknown users,
then update number of clicks without photo */ then update number of clicks without photo */
if (!Gbl.Usrs.Me.MyPhotoExists) if (!Gbl.Usrs.Me.MyPhotoExists)
if (!(Act_Actions[Gbl.Action.Act].PermissionCrsIfIBelong & (1 << Rol_UNKNOWN)) && // If current action is not available for unknown users... if (!(Act_Actions[Gbl.Action.Act].PermissionCrsIfIBelong & (1 << Rol_UNK)) && // If current action is not available for unknown users...
Gbl.Action.Act != ActReqMyPho) // ...and current action is not ActReqMyPho... Gbl.Action.Act != ActReqMyPho) // ...and current action is not ActReqMyPho...
if ((Gbl.Usrs.Me.NumAccWithoutPhoto = Pho_UpdateMyClicksWithoutPhoto ()) > Pho_MAX_CLICKS_WITHOUT_PHOTO) if ((Gbl.Usrs.Me.NumAccWithoutPhoto = Pho_UpdateMyClicksWithoutPhoto ()) > Pho_MAX_CLICKS_WITHOUT_PHOTO)
{ {
@ -5171,7 +5171,7 @@ void Act_AdjustCurrentAction (void)
if (Gbl.Action.Act == ActMnu) // Do the following check sometimes, for example when the user changes the current tab if (Gbl.Action.Act == ActMnu) // Do the following check sometimes, for example when the user changes the current tab
Gbl.CurrentCrs.Info.ShowMsgMustBeRead = Inf_GetIfIMustReadAnyCrsInfoInThisCrs (); Gbl.CurrentCrs.Info.ShowMsgMustBeRead = Inf_GetIfIMustReadAnyCrsInfoInThisCrs ();
break; break;
case Rol_TEACHER: case Rol_TCH:
if (Gbl.Action.Act == ActReqTst || if (Gbl.Action.Act == ActReqTst ||
Gbl.Action.Act == ActEdiTstQst) Gbl.Action.Act == ActEdiTstQst)
/***** If current course has tests and pluggable is unknown, /***** If current course has tests and pluggable is unknown,

View File

@ -115,7 +115,7 @@ void Ann_ShowAllAnnouncements (void)
" WHERE Status=%u AND (Roles&%u)<>0 " " WHERE Status=%u AND (Roles&%u)<>0 "
" ORDER BY AnnCod DESC", " ORDER BY AnnCod DESC",
(unsigned) Ann_ACTIVE_ANNOUNCEMENT, (unsigned) Ann_ACTIVE_ANNOUNCEMENT,
(unsigned) (1 << Rol_UNKNOWN)); (unsigned) (1 << Rol_UNK));
NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements"); NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements");
/***** Start frame *****/ /***** Start frame *****/
@ -343,8 +343,8 @@ static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status,
/* Users' roles who can view this announcement */ /* Users' roles who can view this announcement */
fprintf (Gbl.F.Out,"<p class=\"%s\">%s:", fprintf (Gbl.F.Out,"<p class=\"%s\">%s:",
UsersClass[Status],Txt_Users); UsersClass[Status],Txt_Users);
for (Role = Rol_UNKNOWN, SomeRolesAreSelected = false; for (Role = Rol_UNK, SomeRolesAreSelected = false;
Role <= Rol_TEACHER; Role <= Rol_TCH;
Role++) Role++)
if (Roles & (1 << Role)) if (Roles & (1 << Role))
{ {
@ -425,14 +425,14 @@ void Ann_ShowFormAnnouncement (void)
"<td class=\"DAT LEFT_TOP\">", "<td class=\"DAT LEFT_TOP\">",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Users); Txt_Users);
Rol_WriteSelectorRoles (1 << Rol_UNKNOWN | Rol_WriteSelectorRoles (1 << Rol_UNK |
1 << Rol__GUEST_ | 1 << Rol_GST |
1 << Rol_STUDENT | 1 << Rol_STD |
1 << Rol_TEACHER, 1 << Rol_TCH,
1 << Rol_UNKNOWN | 1 << Rol_UNK |
1 << Rol__GUEST_ | 1 << Rol_GST |
1 << Rol_STUDENT | 1 << Rol_STD |
1 << Rol_TEACHER, 1 << Rol_TCH,
false,false); false,false);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");

View File

@ -241,7 +241,7 @@ static void Asg_PutHeadForSeeing (bool PrintView)
static bool Asg_CheckIfICanCreateAssignments (void) static bool Asg_CheckIfICanCreateAssignments (void)
{ {
return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
} }
@ -508,7 +508,7 @@ static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView)
bool ICanSendFiles = !Asg->Hidden && // It's visible (not hidden) bool ICanSendFiles = !Asg->Hidden && // It's visible (not hidden)
Asg->Open && // It's open (inside dates) Asg->Open && // It's open (inside dates)
Asg->IBelongToCrsOrGrps && // I belong to course or groups Asg->IBelongToCrsOrGrps && // I belong to course or groups
Gbl.Usrs.Me.LoggedRole == Rol_STUDENT; // I am a student Gbl.Usrs.Me.LoggedRole == Rol_STD; // I am a student
/***** Folder icon *****/ /***** Folder icon *****/
if (!PrintView && // Not print view if (!PrintView && // Not print view
@ -574,7 +574,7 @@ static void Asg_PutFormsToRemEditOneAsg (long AsgCod,bool Hidden)
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
/***** Put form to remove assignment *****/ /***** Put form to remove assignment *****/
Lay_PutContextualIconToRemove (ActReqRemAsg,Asg_PutParams); Lay_PutContextualIconToRemove (ActReqRemAsg,Asg_PutParams);
@ -588,7 +588,7 @@ static void Asg_PutFormsToRemEditOneAsg (long AsgCod,bool Hidden)
/***** Put form to edit assignment *****/ /***** Put form to edit assignment *****/
Lay_PutContextualIconToEdit (ActEdiOneAsg,Asg_PutParams); Lay_PutContextualIconToEdit (ActEdiOneAsg,Asg_PutParams);
// no break // no break
case Rol_STUDENT: case Rol_STD:
/***** Put form to print assignment *****/ /***** Put form to print assignment *****/
Lay_PutContextualIconToPrint (ActPrnOneAsg,Asg_PutParams); Lay_PutContextualIconToPrint (ActPrnOneAsg,Asg_PutParams);
break; break;
@ -630,7 +630,7 @@ void Asg_GetListAssignments (void)
/***** Get list of assignments from database *****/ /***** Get list of assignments from database *****/
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
HiddenSubQuery[0] = '\0'; HiddenSubQuery[0] = '\0';
break; break;
@ -1713,8 +1713,8 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod)
{ {
char Query[512]; char Query[512];
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT || if (Gbl.Usrs.Me.LoggedRole == Rol_STD ||
Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) Gbl.Usrs.Me.LoggedRole == Rol_TCH)
{ {
// Students and teachers can edit assignments depending on groups // Students and teachers can edit assignments depending on groups
/***** Get if I can edit an assignment from database *****/ /***** Get if I can edit an assignment from database *****/
@ -1733,7 +1733,7 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod)
return (DB_QueryCOUNT (Query,"can not check if I can do an assignment") != 0); return (DB_QueryCOUNT (Query,"can not check if I can do an assignment") != 0);
} }
else else
return (Gbl.Usrs.Me.LoggedRole > Rol_TEACHER); // Admins can edit assignments return (Gbl.Usrs.Me.LoggedRole > Rol_TCH); // Admins can edit assignments
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -163,10 +163,10 @@ void Att_SeeAttEvents (void)
if (Gbl.AttEvents.Num) if (Gbl.AttEvents.Num)
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
Att_PutFormToListMyAttendance (); Att_PutFormToListMyAttendance ();
break; break;
case Rol_TEACHER: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
Att_PutFormToListStdsAttendance (); Att_PutFormToListStdsAttendance ();
break; break;
@ -203,7 +203,7 @@ static void Att_ShowAllAttEvents (void)
Dat_StartEndTime_t Order; Dat_StartEndTime_t Order;
struct Pagination Pagination; struct Pagination Pagination;
unsigned NumAttEvent; unsigned NumAttEvent;
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
/***** Compute variables related to pagination *****/ /***** Compute variables related to pagination *****/
@ -261,7 +261,7 @@ static void Att_ShowAllAttEvents (void)
"</th>" "</th>"
"</tr>", "</tr>",
Txt_Event, Txt_Event,
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]); Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN]);
/***** Write all the attendance events *****/ /***** Write all the attendance events *****/
for (NumAttEvent = Pagination.FirstItemVisible, Gbl.RowEvenOdd = 0; for (NumAttEvent = Pagination.FirstItemVisible, Gbl.RowEvenOdd = 0;
@ -372,7 +372,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
Att_PutFormsToRemEditOneAttEvent (Att->AttCod,Att->Hidden); Att_PutFormsToRemEditOneAttEvent (Att->AttCod,Att->Hidden);
break; break;
@ -597,7 +597,7 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order)
/***** Get list of attendance events from database *****/ /***** Get list of attendance events from database *****/
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
HiddenSubQuery[0] = '\0'; HiddenSubQuery[0] = '\0';
break; break;
@ -1819,10 +1819,10 @@ void Att_SeeOneAttEvent (void)
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
Att_ListAttOnlyMeAsStudent (&Att); Att_ListAttOnlyMeAsStudent (&Att);
break; break;
case Rol_TEACHER: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
/***** Show list of students *****/ /***** Show list of students *****/
Att_ListAttStudents (&Att); Att_ListAttStudents (&Att);
@ -1874,7 +1874,7 @@ static void Att_ListAttOnlyMeAsStudent (struct AttendanceEvent *Att)
"%s" "%s"
"</th>" "</th>"
"</tr>", "</tr>",
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_SINGUL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Txt_Student_comment, Txt_Student_comment,
Txt_Teachers_comment); Txt_Teachers_comment);
@ -1912,7 +1912,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order list of students in this course *****/ /***** Get and order list of students in this course *****/
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
/***** Start frame *****/ /***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_Attendance,NULL,Hlp_USERS_Attendance); Lay_StartRoundFrame (NULL,Txt_Attendance,NULL,Hlp_USERS_Attendance);
@ -1920,7 +1920,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
/***** Form to select groups *****/ /***** Form to select groups *****/
Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt); Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt);
if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs) if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs)
{ {
/***** Get my preference about photos in users' list for current course *****/ /***** Get my preference about photos in users' list for current course *****/
Usr_GetMyPrefAboutListWithPhotosFromDB (); Usr_GetMyPrefAboutListWithPhotosFromDB ();
@ -1952,17 +1952,17 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
"%s" "%s"
"</th>" "</th>"
"</tr>", "</tr>",
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_SINGUL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Txt_Student_comment, Txt_Student_comment,
Txt_Teachers_comment); Txt_Teachers_comment);
/* List of students */ /* List of students */
for (NumStd = 0, Gbl.RowEvenOdd = 0; for (NumStd = 0, Gbl.RowEvenOdd = 0;
NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; NumStd < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
NumStd++) NumStd++)
{ {
/* Copy user's basic data from list */ /* Copy user's basic data from list */
Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd]); Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd]);
/* Get list of user's IDs */ /* Get list of user's IDs */
ID_GetListIDsFromUsrCod (&UsrDat); ID_GetListIDsFromUsrCod (&UsrDat);
@ -1982,13 +1982,13 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
Usr_UsrDataDestructor (&UsrDat); Usr_UsrDataDestructor (&UsrDat);
} }
else else
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
/***** End frame *****/ /***** End frame *****/
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
/***** Free memory for students list *****/ /***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
/***** Free memory for list of selected groups *****/ /***** Free memory for list of selected groups *****/
Grp_FreeListCodSelectedGrps (); Grp_FreeListCodSelectedGrps ();
@ -2036,7 +2036,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
UsrDat->EncryptedUsrCod); UsrDat->EncryptedUsrCod);
if (Present) // This student has attended to the event? if (Present) // This student has attended to the event?
fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," checked=\"checked\"");
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) // A student can not change his attendance if (Gbl.Usrs.Me.LoggedRole == Rol_STD) // A student can not change his attendance
fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," />" fprintf (Gbl.F.Out," />"
"</td>"); "</td>");
@ -2084,7 +2084,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
/***** Student's comment: write form or text */ /***** Student's comment: write form or text */
fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL LEFT_TOP COLOR%u\">", fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && Att->Open) // Show with form if (Gbl.Usrs.Me.LoggedRole == Rol_STD && Att->Open) // Show with form
fprintf (Gbl.F.Out,"<textarea name=\"CommentStd%ld\"" fprintf (Gbl.F.Out,"<textarea name=\"CommentStd%ld\""
" cols=\"40\" rows=\"3\">" " cols=\"40\" rows=\"3\">"
"%s" "%s"
@ -2101,7 +2101,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
/***** Teacher's comment: write form, text or nothing */ /***** Teacher's comment: write form, text or nothing */
fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL LEFT_TOP COLOR%u\">", fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) // Show with form if (Gbl.Usrs.Me.LoggedRole == Rol_TCH) // Show with form
fprintf (Gbl.F.Out,"<textarea name=\"CommentTch%ld\"" fprintf (Gbl.F.Out,"<textarea name=\"CommentTch%ld\""
" cols=\"40\" rows=\"3\">" " cols=\"40\" rows=\"3\">"
"%s" "%s"
@ -2219,12 +2219,12 @@ void Att_RegisterMeAsStdInAttEvent (void)
/***************** Save students who attended to an event ********************/ /***************** Save students who attended to an event ********************/
/*****************************************************************************/ /*****************************************************************************/
/* Algorithm: /* Algorithm:
1. Get list of students in the groups selected: Gbl.Usrs.LstUsrs[Rol_STUDENT] 1. Get list of students in the groups selected: Gbl.Usrs.LstUsrs[Rol_STD]
2. Mark all students in the groups selected setting Remove=true 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 3. Get list of students marked as present by me: Gbl.Usrs.Select.Std
4. Loop over the list Gbl.Usrs.Select.Std, 4. Loop over the list Gbl.Usrs.Select.Std,
that holds the list of the students marked as present, that holds the list of the students marked as present,
marking the students in Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst as Remove=false marking the students in Gbl.Usrs.LstUsrs[Rol_STD].Lst as Remove=false
5. Delete from att_usr all the students marked as Remove=true 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 6. Replace (insert without duplicated) into att_usr all the students marked as Remove=false
*/ */
@ -2252,17 +2252,17 @@ void Att_RegisterStudentsInAttEvent (void)
/***** Get groups selected *****/ /***** Get groups selected *****/
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** 1. Get list of students in the groups selected: Gbl.Usrs.LstUsrs[Rol_STUDENT] *****/ /***** 1. Get list of students in the groups selected: Gbl.Usrs.LstUsrs[Rol_STD] *****/
/* Get list of students in the groups selected */ /* Get list of students in the groups selected */
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs) // If there are students in the groups selected... if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs) // If there are students in the groups selected...
{ {
/***** 2. Mark all students in the groups selected setting Remove=true *****/ /***** 2. Mark all students in the groups selected setting Remove=true *****/
for (NumStd = 0; for (NumStd = 0;
NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; NumStd < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
NumStd++) NumStd++)
Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].Remove = true; Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].Remove = true;
/***** 3. Get list of students marked as present by me: Gbl.Usrs.Select.Std *****/ /***** 3. Get list of students marked as present by me: Gbl.Usrs.Select.Std *****/
Usr_GetListsSelectedUsrsCods (); Usr_GetListsSelectedUsrsCods ();
@ -2272,7 +2272,7 @@ void Att_RegisterStudentsInAttEvent (void)
/***** 4. Loop over the list Gbl.Usrs.Select.Std, /***** 4. Loop over the list Gbl.Usrs.Select.Std,
that holds the list of the students marked as present, that holds the list of the students marked as present,
marking the students in Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst as Remove=false *****/ marking the students in Gbl.Usrs.LstUsrs[Rol_STD].Lst as Remove=false *****/
Ptr = Gbl.Usrs.Select.Std; Ptr = Gbl.Usrs.Select.Std;
while (*Ptr) while (*Ptr)
{ {
@ -2282,11 +2282,11 @@ void Att_RegisterStudentsInAttEvent (void)
if (UsrData.UsrCod > 0) // Student exists in database if (UsrData.UsrCod > 0) // Student exists in database
/***** Mark student to not be removed *****/ /***** Mark student to not be removed *****/
for (NumStd = 0; for (NumStd = 0;
NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; NumStd < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
NumStd++) NumStd++)
if (Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod == UsrData.UsrCod) if (Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].UsrCod == UsrData.UsrCod)
{ {
Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].Remove = false; Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].Remove = false;
break; // Found! Exit loop break; // Found! Exit loop
} }
} }
@ -2301,25 +2301,25 @@ void Att_RegisterStudentsInAttEvent (void)
// 5. Delete from att_usr all the students marked as Remove=true // 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 // 6. Replace (insert without duplicated) into att_usr all the students marked as Remove=false
for (NumStd = 0, NumStdsAbsent = NumStdsPresent = 0; for (NumStd = 0, NumStdsAbsent = NumStdsPresent = 0;
NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; NumStd < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
NumStd++) NumStd++)
{ {
/***** Get comments for this student *****/ /***** Get comments for this student *****/
Att_CheckIfUsrIsPresentInAttEventAndGetComments (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod,CommentStd,CommentTch); Att_CheckIfUsrIsPresentInAttEventAndGetComments (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].UsrCod,CommentStd,CommentTch);
sprintf (CommentParamName,"CommentTch%ld",Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod); sprintf (CommentParamName,"CommentTch%ld",Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].UsrCod);
Par_GetParToHTML (CommentParamName,CommentTch,Cns_MAX_BYTES_TEXT); Par_GetParToHTML (CommentParamName,CommentTch,Cns_MAX_BYTES_TEXT);
Present = !Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].Remove; Present = !Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].Remove;
if (Present || if (Present ||
CommentStd[0] || CommentStd[0] ||
CommentTch[0]) CommentTch[0])
/***** Register student *****/ /***** Register student *****/
Att_RegUsrInAttEventChangingComments (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod, Att_RegUsrInAttEventChangingComments (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].UsrCod,
Present,CommentStd,CommentTch); Present,CommentStd,CommentTch);
else else
/***** Remove student *****/ /***** Remove student *****/
Att_RemoveUsrFromAttEvent (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod); Att_RemoveUsrFromAttEvent (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].UsrCod);
if (Present) if (Present)
NumStdsPresent++; NumStdsPresent++;
@ -2328,7 +2328,7 @@ void Att_RegisterStudentsInAttEvent (void)
} }
/***** Free memory for students list *****/ /***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
/***** Write final message *****/ /***** Write final message *****/
sprintf (Format,"%s: %%u<br />%s: %%u",Txt_Presents,Txt_Absents); sprintf (Format,"%s: %%u<br />%s: %%u",Txt_Presents,Txt_Absents);
@ -2336,9 +2336,9 @@ void Att_RegisterStudentsInAttEvent (void)
NumStdsPresent,NumStdsAbsent); NumStdsPresent,NumStdsAbsent);
Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt); Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt);
} }
else // Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs == 0 else // Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs == 0
/***** Show warning indicating no students found *****/ /***** Show warning indicating no students found *****/
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
/***** Show the attendance event again *****/ /***** Show the attendance event again *****/
Gbl.AttEvents.AttCod = Att.AttCod; Gbl.AttEvents.AttCod = Att.AttCod;
@ -2608,18 +2608,18 @@ void Usr_ReqListStdsAttendanceCrs (void)
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order lists of users from current course *****/ /***** Get and order lists of users from current course *****/
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
/***** Start frame *****/ /***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Lay_StartRoundFrame (NULL,Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
NULL,Hlp_USERS_Attendance_attendance_list); NULL,Hlp_USERS_Attendance_attendance_list);
/***** Form to select groups *****/ /***** Form to select groups *****/
Grp_ShowFormToSelectSeveralGroups (ActReqLstStdAtt); Grp_ShowFormToSelectSeveralGroups (ActReqLstStdAtt);
if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs) if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs)
{ {
if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs,NULL)) if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs,NULL))
{ {
/***** Get list of selected users *****/ /***** Get list of selected users *****/
Usr_GetListsSelectedUsrsCods (); Usr_GetListsSelectedUsrsCods ();
@ -2634,7 +2634,7 @@ void Usr_ReqListStdsAttendanceCrs (void)
/* Write list of students to select some of them */ /* Write list of students to select some of them */
Lay_StartTableCenter (0); Lay_StartTableCenter (0);
Usr_ListUsersToSelect (Rol_STUDENT); Usr_ListUsersToSelect (Rol_STD);
Lay_EndTable (); Lay_EndTable ();
/* Send button */ /* Send button */
@ -2648,13 +2648,13 @@ void Usr_ReqListStdsAttendanceCrs (void)
} }
} }
else else
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
/***** End frame *****/ /***** End frame *****/
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
/***** Free memory for students list *****/ /***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
/***** Free memory for list of selected groups *****/ /***** Free memory for list of selected groups *****/
Grp_FreeListCodSelectedGrps (); Grp_FreeListCodSelectedGrps ();
@ -3049,7 +3049,7 @@ static void Att_ListEventsToSelect (Att_TypeOfView_t TypeOfView)
"</th>" "</th>"
"</tr>", "</tr>",
Txt_Event, Txt_Event,
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]); Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN]);
/***** List the events *****/ /***** List the events *****/
for (NumAttEvent = 0, UniqueId = 1, Gbl.RowEvenOdd = 0; for (NumAttEvent = 0, UniqueId = 1, Gbl.RowEvenOdd = 0;
@ -3232,7 +3232,7 @@ static void Att_WriteTableHeadSeveralAttEvents (void)
"</th>", "</th>",
Gbl.Usrs.Listing.WithPhotos ? 4 : Gbl.Usrs.Listing.WithPhotos ? 4 :
3, 3,
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]); Txt_ROLES_SINGUL_Abc[Rol_STD][Usr_SEX_UNKNOWN]);
for (NumAttEvent = 0; for (NumAttEvent = 0;
NumAttEvent < Gbl.AttEvents.Num; NumAttEvent < Gbl.AttEvents.Num;
@ -3475,7 +3475,7 @@ static void Att_ListAttEventsForAStd (unsigned NumStd,struct UsrData *UsrDat)
Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Gbl.AttEvents.Lst[NumAttEvent].AttCod,UsrDat->UsrCod,CommentStd,CommentTch); Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Gbl.AttEvents.Lst[NumAttEvent].AttCod,UsrDat->UsrCod,CommentStd,CommentTch);
ShowCommentStd = CommentStd[0]; ShowCommentStd = CommentStd[0];
ShowCommentTch = CommentTch[0] && ShowCommentTch = CommentTch[0] &&
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.AttEvents.Lst[NumAttEvent].CommentTchVisible); Gbl.AttEvents.Lst[NumAttEvent].CommentTchVisible);
/***** Write a row for this event *****/ /***** Write a row for this event *****/

View File

@ -628,8 +628,8 @@ static void Ctr_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCtr (Rol_TEACHER,Gbl.CurrentCtr.Ctr.CtrCod)); Usr_GetNumUsrsInCrssOfCtr (Rol_TCH,Gbl.CurrentCtr.Ctr.CtrCod));
/***** Number of students in courses of this centre *****/ /***** Number of students in courses of this centre *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -641,8 +641,8 @@ static void Ctr_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCtr (Rol_STUDENT,Gbl.CurrentCtr.Ctr.CtrCod)); Usr_GetNumUsrsInCrssOfCtr (Rol_STD,Gbl.CurrentCtr.Ctr.CtrCod));
/***** Number of users in courses of this centre *****/ /***** Number of users in courses of this centre *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -654,9 +654,9 @@ static void Ctr_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCtr (Rol_UNKNOWN,Gbl.CurrentCtr.Ctr.CtrCod)); Usr_GetNumUsrsInCrssOfCtr (Rol_UNK,Gbl.CurrentCtr.Ctr.CtrCod));
} }
/***** End table *****/ /***** End table *****/
@ -793,7 +793,7 @@ static void Ctr_ListCentres (void)
static bool Ctr_CheckIfICanCreateCentres (void) static bool Ctr_CheckIfICanCreateCentres (void)
{ {
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_); return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_GST);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1089,7 +1089,7 @@ void Ctr_GetListCentres (long InsCod)
Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod); Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod);
/* Get number of users in courses of this centre */ /* Get number of users in courses of this centre */
Ctr->NumUsrs = Usr_GetNumUsrsInCrssOfCtr (Rol_UNKNOWN,Ctr->CtrCod); // Here Rol_UNKNOWN means "all users" Ctr->NumUsrs = Usr_GetNumUsrsInCrssOfCtr (Rol_UNK,Ctr->CtrCod); // Here Rol_UNK means "all users"
} }
} }
else else
@ -1187,7 +1187,7 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod); Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod);
/* Get number of users in courses of this centre */ /* Get number of users in courses of this centre */
Ctr->NumUsrs = Usr_GetNumUsrsInCrssOfCtr (Rol_UNKNOWN,Ctr->CtrCod); // Here Rol_UNKNOWN means "all users" Ctr->NumUsrs = Usr_GetNumUsrsInCrssOfCtr (Rol_UNK,Ctr->CtrCod); // Here Rol_UNK means "all users"
/* Set return value */ /* Set return value */
CtrFound = true; CtrFound = true;
@ -2417,7 +2417,7 @@ static void Ctr_PutFormToCreateCentre (void)
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
Act_FormStart (ActNewCtr); Act_FormStart (ActNewCtr);
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_) else if (Gbl.Usrs.Me.MaxRole >= Rol_GST)
Act_FormStart (ActReqCtr); Act_FormStart (ActReqCtr);
else else
Lay_ShowErrorAndExit ("You can not edit centres."); Lay_ShowErrorAndExit ("You can not edit centres.");

View File

@ -233,13 +233,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.215.4 (2017-05-18)" #define Log_PLATFORM_VERSION "SWAD 16.216 (2017-05-18)"
#define CSS_FILE "swad16.209.3.css" #define CSS_FILE "swad16.209.3.css"
#define JS_FILE "swad16.206.3.js" #define JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 16.216: May 18, 2017 Role visitor is renamed as role user. (218867 lines)
Version 16.215.4: May 18, 2017 Changed layout of assignments. Version 16.215.4: May 18, 2017 Changed layout of assignments.
Removed alert with number of users notified via email. (218868 lines) Removed alert with number of users notified via email. (218868 lines)
Version 16.215.3: May 15, 2017 Fixed bug in layout of alerts. (218950 lines) Version 16.215.3: May 15, 2017 Fixed bug in layout of alerts. (218950 lines)

View File

@ -140,8 +140,8 @@ void Cht_ShowListOfAvailableChatRooms (void)
Txt_Chat_rooms); Txt_Chat_rooms);
/***** Link to chat available for all the users *****/ /***** Link to chat available for all the users *****/
IsLastItemInLevel[1] = (Gbl.Usrs.Me.LoggedRole != Rol_STUDENT && IsLastItemInLevel[1] = (Gbl.Usrs.Me.LoggedRole != Rol_STD &&
Gbl.Usrs.Me.LoggedRole != Rol_TEACHER && Gbl.Usrs.Me.LoggedRole != Rol_TCH &&
!Gbl.Usrs.Me.MyDegs.Num); !Gbl.Usrs.Me.MyDegs.Num);
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]); sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
Cht_WriteLinkToChat1 ("GBL_USR",Txt_SEX_PLURAL_Abc[Usr_SEX_ALL],ThisRoomFullName,1,IsLastItemInLevel); Cht_WriteLinkToChat1 ("GBL_USR",Txt_SEX_PLURAL_Abc[Usr_SEX_ALL],ThisRoomFullName,1,IsLastItemInLevel);
@ -156,8 +156,8 @@ void Cht_ShowListOfAvailableChatRooms (void)
IsLastItemInLevel[1] = !Gbl.Usrs.Me.MyDegs.Num; IsLastItemInLevel[1] = !Gbl.Usrs.Me.MyDegs.Num;
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_ALL]); sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_STD][Usr_SEX_ALL]);
Cht_WriteLinkToChat1 ("GBL_STD",Txt_Students_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel); Cht_WriteLinkToChat1 ("GBL_STD",Txt_Students_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel);
fprintf (Gbl.F.Out,"<img src=\"%s/chat64x64.gif\"" fprintf (Gbl.F.Out,"<img src=\"%s/chat64x64.gif\""
" alt=\"%s\" title=\"%s\"" " alt=\"%s\" title=\"%s\""
@ -166,8 +166,8 @@ void Cht_ShowListOfAvailableChatRooms (void)
ThisRoomFullName,ThisRoomFullName); ThisRoomFullName,ThisRoomFullName);
Cht_WriteLinkToChat2 ("GBL_STD",ThisRoomFullName); Cht_WriteLinkToChat2 ("GBL_STD",ThisRoomFullName);
break; break;
case Rol_TEACHER: case Rol_TCH:
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_TEACHER][Usr_SEX_ALL]); sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_TCH][Usr_SEX_ALL]);
Cht_WriteLinkToChat1 ("GBL_TCH",Txt_Teachers_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel); Cht_WriteLinkToChat1 ("GBL_TCH",Txt_Teachers_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel);
fprintf (Gbl.F.Out,"<img src=\"%s/chat64x64.gif\"" fprintf (Gbl.F.Out,"<img src=\"%s/chat64x64.gif\""
" alt=\"%s\" title=\"%s\"" " alt=\"%s\" title=\"%s\""
@ -463,7 +463,7 @@ void Cht_OpenChatWindow (void)
Cht_MAX_BYTES_ROOM_FULL_NAMES); Cht_MAX_BYTES_ROOM_FULL_NAMES);
} }
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
if (strcmp (RoomCode,"GBL_STD")) if (strcmp (RoomCode,"GBL_STD"))
{ {
Str_Concat (ListRoomCodes,"|#GBL_STD", Str_Concat (ListRoomCodes,"|#GBL_STD",
@ -474,12 +474,12 @@ void Cht_OpenChatWindow (void)
Cht_MAX_BYTES_ROOM_SHRT_NAMES); Cht_MAX_BYTES_ROOM_SHRT_NAMES);
sprintf (RoomFullName,"|%s (%s)",Txt_General, sprintf (RoomFullName,"|%s (%s)",Txt_General,
Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_ALL]); Txt_ROLES_PLURAL_abc[Rol_STD][Usr_SEX_ALL]);
Str_Concat (ListRoomFullNames,RoomFullName, Str_Concat (ListRoomFullNames,RoomFullName,
Cht_MAX_BYTES_ROOM_FULL_NAMES); Cht_MAX_BYTES_ROOM_FULL_NAMES);
} }
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) if (Gbl.Usrs.Me.LoggedRole == Rol_TCH)
if (strcmp (RoomCode,"GBL_TCH")) if (strcmp (RoomCode,"GBL_TCH"))
{ {
Str_Concat (ListRoomCodes,"|#GBL_TCH", Str_Concat (ListRoomCodes,"|#GBL_TCH",
@ -490,7 +490,7 @@ void Cht_OpenChatWindow (void)
Cht_MAX_BYTES_ROOM_SHRT_NAMES); Cht_MAX_BYTES_ROOM_SHRT_NAMES);
sprintf (RoomFullName,"|%s (%s)", sprintf (RoomFullName,"|%s (%s)",
Txt_General,Txt_ROLES_PLURAL_abc[Rol_TEACHER][Usr_SEX_ALL]); Txt_General,Txt_ROLES_PLURAL_abc[Rol_TCH][Usr_SEX_ALL]);
Str_Concat (ListRoomFullNames,RoomFullName, Str_Concat (ListRoomFullNames,RoomFullName,
Cht_MAX_BYTES_ROOM_FULL_NAMES); Cht_MAX_BYTES_ROOM_FULL_NAMES);
} }

View File

@ -354,7 +354,7 @@ void Con_ShowGlobalConnectedUsrs (void)
unsigned NumUsrsTotal; unsigned NumUsrsTotal;
/***** Get number of connected users *****/ /***** Get number of connected users *****/
for (Role = Rol__GUEST_, NumUsrsTotal = 0; for (Role = Rol_GST, NumUsrsTotal = 0;
Role <= Rol_SYS_ADM; Role <= Rol_SYS_ADM;
Role++) Role++)
{ {
@ -392,7 +392,7 @@ void Con_ShowGlobalConnectedUsrs (void)
Txt_users[Usr_SEX_UNKNOWN]); Txt_users[Usr_SEX_UNKNOWN]);
/***** Write total number of users with each role *****/ /***** Write total number of users with each role *****/
for (Role = Rol__GUEST_, NumUsrsTotal = 0; for (Role = Rol_GST, NumUsrsTotal = 0;
Role <= Rol_SYS_ADM; Role <= Rol_SYS_ADM;
Role++) Role++)
Con_ShowGlobalConnectedUsrsRole (Role,NumUsrs[Role]); Con_ShowGlobalConnectedUsrsRole (Role,NumUsrs[Role]);
@ -433,10 +433,10 @@ void Con_ComputeConnectedUsrsBelongingToCurrentCrs (void)
Gbl.Scope.Current = Sco_SCOPE_CRS; Gbl.Scope.Current = Sco_SCOPE_CRS;
/***** Number of teachers *****/ /***** Number of teachers *****/
Con_ComputeConnectedUsrsWithARoleBelongingToCurrentCrs (Rol_TEACHER); Con_ComputeConnectedUsrsWithARoleBelongingToCurrentCrs (Rol_TCH);
/***** Number of students *****/ /***** Number of students *****/
Con_ComputeConnectedUsrsWithARoleBelongingToCurrentCrs (Rol_STUDENT); Con_ComputeConnectedUsrsWithARoleBelongingToCurrentCrs (Rol_STD);
} }
} }
@ -467,7 +467,7 @@ static void Con_ShowConnectedUsrsBelongingToLocation (void)
" style=\"width:390px; margin-top:6px;\">"); " style=\"width:390px; margin-top:6px;\">");
/***** Number of connected users who belong to scope *****/ /***** Number of connected users who belong to scope *****/
Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_UNKNOWN,&Usrs); Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_UNK,&Usrs);
fprintf (Gbl.F.Out,"<div class=\"CONNECTED_TXT\">%u %s ", fprintf (Gbl.F.Out,"<div class=\"CONNECTED_TXT\">%u %s ",
Usrs.NumUsrs, Usrs.NumUsrs,
Txt_from); Txt_from);
@ -481,10 +481,10 @@ static void Con_ShowConnectedUsrsBelongingToLocation (void)
/***** Number of teachers and students *****/ /***** Number of teachers and students *****/
fprintf (Gbl.F.Out,"<table class=\"CONNECTED_LIST\">"); fprintf (Gbl.F.Out,"<table class=\"CONNECTED_LIST\">");
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_TEACHER); Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_TCH);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_STUDENT); Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_STD);
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol__GUEST_); Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_GST);
fprintf (Gbl.F.Out,"</table>"); fprintf (Gbl.F.Out,"</table>");
/***** End container *****/ /***** End container *****/
@ -516,7 +516,7 @@ void Con_ShowConnectedUsrsBelongingToCurrentCrs (void)
Act_LinkFormSubmitUnique (Txt_Connected_users,"CONNECTED_TXT"); Act_LinkFormSubmitUnique (Txt_Connected_users,"CONNECTED_TXT");
Str_Copy (CourseName,Gbl.CurrentCrs.Crs.ShrtName, Str_Copy (CourseName,Gbl.CurrentCrs.Crs.ShrtName,
Hie_MAX_BYTES_SHRT_NAME); Hie_MAX_BYTES_SHRT_NAME);
Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_UNKNOWN,&Usrs); Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_UNK,&Usrs);
fprintf (Gbl.F.Out,"%u %s %s" fprintf (Gbl.F.Out,"%u %s %s"
"</a>", "</a>",
Usrs.NumUsrs,Txt_from,CourseName); Usrs.NumUsrs,Txt_from,CourseName);
@ -527,8 +527,8 @@ void Con_ShowConnectedUsrsBelongingToCurrentCrs (void)
Gbl.Usrs.Connected.NumUsr = 0; Gbl.Usrs.Connected.NumUsr = 0;
Gbl.Usrs.Connected.NumUsrs = 0; Gbl.Usrs.Connected.NumUsrs = 0;
Gbl.Usrs.Connected.NumUsrsToList = 0; Gbl.Usrs.Connected.NumUsrsToList = 0;
Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Rol_TEACHER); Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Rol_TCH);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Rol_STUDENT); Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Rol_STD);
fprintf (Gbl.F.Out,"</table>"); fprintf (Gbl.F.Out,"</table>");
/***** End container *****/ /***** End container *****/
@ -685,7 +685,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
/***** Get number of connected users who belong to current course from database *****/ /***** Get number of connected users who belong to current course from database *****/
switch (Role) switch (Role)
{ {
case Rol_UNKNOWN: // Here Rol_ROLE_UNKNOWN means "any role" case Rol_UNK: // Here Rol_UNK means "any role"
switch (Gbl.Scope.Current) switch (Gbl.Scope.Current)
{ {
case Sco_SCOPE_SYS: // Show connected users in the whole platform case Sco_SCOPE_SYS: // Show connected users in the whole platform
@ -754,15 +754,15 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
break; break;
} }
break; break;
case Rol__GUEST_: case Rol_GST:
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod)," sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)" "COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
" FROM connected,usr_data" " FROM connected,usr_data"
" WHERE connected.UsrCod NOT IN (SELECT UsrCod FROM crs_usr)" " WHERE connected.UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" AND connected.UsrCod=usr_data.UsrCod"); " AND connected.UsrCod=usr_data.UsrCod");
break; break;
case Rol_STUDENT: case Rol_STD:
case Rol_TEACHER: case Rol_TCH:
switch (Gbl.Scope.Current) switch (Gbl.Scope.Current)
{ {
case Sco_SCOPE_SYS: // Show connected users in the whole platform case Sco_SCOPE_SYS: // Show connected users in the whole platform
@ -988,7 +988,7 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
/***** Write full name and link *****/ /***** Write full name and link *****/
fprintf (Gbl.F.Out,"<td class=\"CON_USR_NARROW %s COLOR%u\">", fprintf (Gbl.F.Out,"<td class=\"CON_USR_NARROW %s COLOR%u\">",
Font,Gbl.RowEvenOdd); Font,Gbl.RowEvenOdd);
Act_FormStartUnique ((Role == Rol_STUDENT) ? ActSeeRecOneStd : Act_FormStartUnique ((Role == Rol_STD) ? ActSeeRecOneStd :
ActSeeRecOneTch); // Must be unique because ActSeeRecOneTch); // Must be unique because
// the list of connected users // the list of connected users
// is dynamically updated via AJAX // is dynamically updated via AJAX
@ -1044,15 +1044,15 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
/***** Get connected users who belong to current location from database *****/ /***** Get connected users who belong to current location from database *****/
switch (Role) switch (Role)
{ {
case Rol__GUEST_: case Rol_GST:
sprintf (Query,"SELECT UsrCod,LastCrsCod," sprintf (Query,"SELECT UsrCod,LastCrsCod,"
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(LastTime) AS Dif" "UNIX_TIMESTAMP()-UNIX_TIMESTAMP(LastTime) AS Dif"
" FROM connected" " FROM connected"
" WHERE UsrCod NOT IN (SELECT UsrCod FROM crs_usr)" " WHERE UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" ORDER BY Dif"); " ORDER BY Dif");
break; break;
case Rol_STUDENT: case Rol_STD:
case Rol_TEACHER: case Rol_TCH:
switch (Gbl.Scope.Current) switch (Gbl.Scope.Current)
{ {
case Sco_SCOPE_SYS: // Show connected users in the whole platform case Sco_SCOPE_SYS: // Show connected users in the whole platform
@ -1182,7 +1182,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
Font,Gbl.RowEvenOdd); Font,Gbl.RowEvenOdd);
if (PutLinkToRecord) if (PutLinkToRecord)
{ {
Act_FormStart ((Role == Rol_STUDENT) ? ActSeeRecOneStd : Act_FormStart ((Role == Rol_STD) ? ActSeeRecOneStd :
ActSeeRecOneTch); ActSeeRecOneTch);
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
} }

View File

@ -438,8 +438,8 @@ static void Cty_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,Gbl.CurrentCty.Cty.CtyCod)); Usr_GetNumUsrsInCrssOfCty (Rol_TCH,Gbl.CurrentCty.Cty.CtyCod));
/***** Number of students in courses of this country *****/ /***** Number of students in courses of this country *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -451,8 +451,8 @@ static void Cty_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,Gbl.CurrentCty.Cty.CtyCod)); Usr_GetNumUsrsInCrssOfCty (Rol_STD,Gbl.CurrentCty.Cty.CtyCod));
/***** Number of users in courses of this country *****/ /***** Number of users in courses of this country *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -464,9 +464,9 @@ static void Cty_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,Gbl.CurrentCty.Cty.CtyCod)); Usr_GetNumUsrsInCrssOfCty (Rol_UNK,Gbl.CurrentCty.Cty.CtyCod));
} }
/***** End table *****/ /***** End table *****/
@ -567,7 +567,7 @@ void Cty_ListCountries2 (void)
Ctr_GetNumCtrsInCty (0), Ctr_GetNumCtrsInCty (0),
Deg_GetNumDegsInCty (0), Deg_GetNumDegsInCty (0),
Crs_GetNumCrssInCty (0), Crs_GetNumCrssInCty (0),
Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,0)); Usr_GetNumUsrsInCrssOfCty (Rol_TCH,0));
/***** Write users and institutions with unknown country *****/ /***** Write users and institutions with unknown country *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -1139,7 +1139,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
Cty->NumCrss = Crs_GetNumCrssInCty (Cty->CtyCod); Cty->NumCrss = Crs_GetNumCrssInCty (Cty->CtyCod);
/* Get number of users in courses of this country */ /* Get number of users in courses of this country */
Cty->NumUsrs = Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,Cty->CtyCod); // Here Rol_UNKNOWN means "all users" Cty->NumUsrs = Usr_GetNumUsrsInCrssOfCty (Rol_UNK,Cty->CtyCod); // Here Rol_UNK means "all users"
break; break;
} }
} }
@ -1385,7 +1385,7 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraD
Cty->NumUsrsWhoClaimToBelongToCty = 0; Cty->NumUsrsWhoClaimToBelongToCty = 0;
/* Get number of user in courses of this institution */ /* Get number of user in courses of this institution */
Cty->NumUsrs = Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,Cty->CtyCod); // Here Rol_UNKNOWN means "all users" Cty->NumUsrs = Usr_GetNumUsrsInCrssOfCty (Rol_UNK,Cty->CtyCod); // Here Rol_UNK means "all users"
/* Get number of institutions in this country */ /* Get number of institutions in this country */
Cty->NumInss = Ins_GetNumInssInCty (Cty->CtyCod); Cty->NumInss = Ins_GetNumInssInCty (Cty->CtyCod);

View File

@ -177,15 +177,15 @@ static void Crs_Configuration (bool PrintView)
unsigned Year; unsigned Year;
int NumIndicatorsFromDB; int NumIndicatorsFromDB;
struct Ind_IndicatorsCrs Indicators; struct Ind_IndicatorsCrs Indicators;
bool IsForm = (!PrintView && Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER); bool IsForm = (!PrintView && Gbl.Usrs.Me.LoggedRole >= Rol_TCH);
bool PutLink = !PrintView && Gbl.CurrentDeg.Deg.WWW[0]; bool PutLink = !PrintView && Gbl.CurrentDeg.Deg.WWW[0];
/***** Messages and links above the frame *****/ /***** Messages and links above the frame *****/
if (!PrintView) if (!PrintView)
{ {
/* Link to request enrolment in the current course */ /* Link to request enrolment in the current course */
if (Gbl.Usrs.Me.LoggedRole == Rol__GUEST_ || if (Gbl.Usrs.Me.LoggedRole == Rol_GST ||
Gbl.Usrs.Me.LoggedRole == Rol_VISITOR) Gbl.Usrs.Me.LoggedRole == Rol_USR)
{ {
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Enr_PutLinkToRequestSignUp (); Enr_PutLinkToRequestSignUp ();
@ -437,7 +437,7 @@ static void Crs_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumTchs); Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumTchs);
/***** Number of students *****/ /***** Number of students *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -449,7 +449,7 @@ static void Crs_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumStds); Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumStds);
/***** Indicators *****/ /***** Indicators *****/
NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (Gbl.CurrentCrs.Crs.CrsCod); NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (Gbl.CurrentCrs.Crs.CrsCod);
@ -1167,7 +1167,7 @@ static void Crs_ListCourses (void)
static bool Crs_CheckIfICanCreateCourses (void) static bool Crs_CheckIfICanCreateCourses (void)
{ {
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_); return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_GST);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1619,7 +1619,7 @@ static void Crs_PutFormToCreateCourse (void)
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM) if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
Act_FormStart (ActNewCrs); Act_FormStart (ActNewCrs);
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_) else if (Gbl.Usrs.Me.MaxRole >= Rol_GST)
Act_FormStart (ActReqCrs); Act_FormStart (ActReqCrs);
else else
Lay_ShowErrorAndExit ("You can not edit courses."); Lay_ShowErrorAndExit ("You can not edit courses.");
@ -2048,10 +2048,10 @@ static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row)
Hie_MAX_BYTES_FULL_NAME); Hie_MAX_BYTES_FULL_NAME);
/***** Get number of teachers *****/ /***** Get number of teachers *****/
Crs->NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,Crs->CrsCod); Crs->NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,Crs->CrsCod);
/***** Get number of students *****/ /***** Get number of students *****/
Crs->NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,Crs->CrsCod); Crs->NumStds = Usr_GetNumUsrsInCrs (Rol_STD,Crs->CrsCod);
Crs->NumUsrs = Crs->NumStds + Crs->NumUsrs = Crs->NumStds +
Crs->NumTchs; Crs->NumTchs;
@ -2770,16 +2770,16 @@ void Crs_ContEditAfterChgCrs (void)
PutButtonToRequestRegistration = false; PutButtonToRequestRegistration = false;
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol__GUEST_: // I do not belong to any course case Rol_GST: // I do not belong to any course
PutButtonToRequestRegistration = true; PutButtonToRequestRegistration = true;
break; break;
case Rol_VISITOR: case Rol_USR:
PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod, PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Degs.EditingCrs.CrsCod, Gbl.Degs.EditingCrs.CrsCod,
false); false);
break; break;
case Rol_STUDENT: case Rol_STD:
case Rol_TEACHER: case Rol_TCH:
if (Gbl.Degs.EditingCrs.CrsCod != Gbl.CurrentCrs.Crs.CrsCod) if (Gbl.Degs.EditingCrs.CrsCod != Gbl.CurrentCrs.Crs.CrsCod)
PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod, PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Degs.EditingCrs.CrsCod, Gbl.Degs.EditingCrs.CrsCod,
@ -2960,8 +2960,8 @@ void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role)
unsigned NumCrs; unsigned NumCrs;
/***** Get courses of a user from database *****/ /***** Get courses of a user from database *****/
if (Role == Rol_UNKNOWN) if (Role == Rol_UNK)
SubQuery[0] = '\0'; // Role == Rol_UNKNOWN ==> any role SubQuery[0] = '\0'; // Role == Rol_UNK ==> any role
else else
sprintf (SubQuery," AND crs_usr.Role=%u",(unsigned) Role); sprintf (SubQuery," AND crs_usr.Role=%u",(unsigned) Role);
sprintf (Query,"SELECT degrees.DegCod,courses.CrsCod,degrees.ShortName,degrees.FullName," sprintf (Query,"SELECT degrees.DegCod,courses.CrsCod,degrees.ShortName,degrees.FullName,"
@ -2982,7 +2982,7 @@ void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role)
/* Heading row */ /* Heading row */
sprintf (Gbl.Title,Txt_USER_in_COURSE, sprintf (Gbl.Title,Txt_USER_in_COURSE,
Role == Rol_UNKNOWN ? Txt_User[Usr_SEX_UNKNOWN] : // Role == Rol_UNKNOWN ==> any role Role == Rol_UNK ? Txt_User[Usr_SEX_UNKNOWN] : // Role == Rol_UNK ==> any role
Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]); Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<th colspan=\"7\" class=\"LEFT_MIDDLE\">%s:</th>" "<th colspan=\"7\" class=\"LEFT_MIDDLE\">%s:</th>"
@ -3154,8 +3154,8 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
Lay_ShowErrorAndExit ("Wrong code of course."); Lay_ShowErrorAndExit ("Wrong code of course.");
/***** Get number of teachers and students in this course *****/ /***** Get number of teachers and students in this course *****/
NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,CrsCod); NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,CrsCod);
NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,CrsCod); NumStds = Usr_GetNumUsrsInCrs (Rol_STD,CrsCod);
if (NumTchs + NumStds) if (NumTchs + NumStds)
{ {
Style = "DAT_N"; Style = "DAT_N";
@ -3254,7 +3254,7 @@ void Crs_UpdateCrsLast (void)
char Query[256]; char Query[256];
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT) Gbl.Usrs.Me.LoggedRole >= Rol_STD)
{ {
/***** Update my last access to current course *****/ /***** Update my last access to current course *****/
sprintf (Query,"REPLACE INTO crs_last" sprintf (Query,"REPLACE INTO crs_last"

View File

@ -524,8 +524,8 @@ static void Deg_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfDeg (Rol_TEACHER,Gbl.CurrentDeg.Deg.DegCod)); Usr_GetNumUsrsInCrssOfDeg (Rol_TCH,Gbl.CurrentDeg.Deg.DegCod));
/***** Number of students *****/ /***** Number of students *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -537,8 +537,8 @@ static void Deg_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfDeg (Rol_STUDENT,Gbl.CurrentDeg.Deg.DegCod)); Usr_GetNumUsrsInCrssOfDeg (Rol_STD,Gbl.CurrentDeg.Deg.DegCod));
} }
/***** End table *****/ /***** End table *****/
@ -927,7 +927,7 @@ static void Deg_PutFormToCreateDegree (void)
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM) if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
Act_FormStart (ActNewDeg); Act_FormStart (ActNewDeg);
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_) else if (Gbl.Usrs.Me.MaxRole >= Rol_GST)
Act_FormStart (ActReqDeg); Act_FormStart (ActReqDeg);
else else
Lay_ShowErrorAndExit ("You can not edit degrees."); Lay_ShowErrorAndExit ("You can not edit degrees.");
@ -1205,7 +1205,7 @@ static void Deg_ListDegrees (void)
static bool Deg_CheckIfICanCreateDegrees (void) static bool Deg_CheckIfICanCreateDegrees (void)
{ {
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_); return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_GST);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1414,7 +1414,7 @@ void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs)
" AND courses.CrsCod=crs_usr.CrsCod" " AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role=%u" " AND crs_usr.Role=%u"
" ORDER BY degrees.ShortName", " ORDER BY degrees.ShortName",
(unsigned) Rol_STUDENT); (unsigned) Rol_STD);
Degs->Num = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get degrees admin by you"); Degs->Num = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get degrees admin by you");
if (Degs->Num) // Degrees found... if (Degs->Num) // Degrees found...

View File

@ -180,7 +180,7 @@ void Dpt_SeeDepts (void)
"</tr>", "</tr>",
Txt_Department_unspecified, Txt_Department_unspecified,
Sta_GetTotalNumberOfUsersInCourses (Sco_SCOPE_INS, Sta_GetTotalNumberOfUsersInCourses (Sco_SCOPE_INS,
Rol_TEACHER) - NumTchsInsWithDpt); Rol_TCH) - NumTchsInsWithDpt);
/***** End table *****/ /***** End table *****/
Lay_EndRoundFrameTable (); Lay_EndRoundFrameTable ();
@ -288,8 +288,8 @@ void Dpt_GetListDepartments (long InsCod)
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr" " (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
" WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))" " WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))"
" ORDER BY %s", " ORDER BY %s",
InsCod,(unsigned) Rol_TEACHER, InsCod,(unsigned) Rol_TCH,
InsCod,(unsigned) Rol_TEACHER, InsCod,(unsigned) Rol_TCH,
OrderBySubQuery); OrderBySubQuery);
else // All the departments else // All the departments
sprintf (Query,"(SELECT departments.DptCod,departments.InsCod," sprintf (Query,"(SELECT departments.DptCod,departments.InsCod,"
@ -307,8 +307,8 @@ void Dpt_GetListDepartments (long InsCod)
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr" " (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
" WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))" " WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))"
" ORDER BY %s", " ORDER BY %s",
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
OrderBySubQuery); OrderBySubQuery);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get departments"); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get departments");
@ -405,8 +405,8 @@ void Dpt_GetDataOfDepartmentByCod (struct Department *Dpt)
" WHERE DptCod=%ld AND DptCod NOT IN" " WHERE DptCod=%ld AND DptCod NOT IN"
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr" " (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
" WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))", " WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))",
Dpt->DptCod,(unsigned) Rol_TEACHER, Dpt->DptCod,(unsigned) Rol_TCH,
Dpt->DptCod,(unsigned) Rol_TEACHER); Dpt->DptCod,(unsigned) Rol_TCH);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a department"); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a department");
if (NumRows) // Department found... if (NumRows) // Department found...

View File

@ -85,7 +85,7 @@ void Dup_ReportUsrAsPossibleDuplicate (void)
{ {
/* Check if it's allowed to me to report users as possible duplicatedr */ /* Check if it's allowed to me to report users as possible duplicatedr */
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TCH)
{ {
/***** Insert possible duplicate into database *****/ /***** Insert possible duplicate into database *****/
sprintf (Query,"REPLACE INTO usr_duplicated" sprintf (Query,"REPLACE INTO usr_duplicated"
@ -225,7 +225,7 @@ void Dup_ListDuplicateUsrs (void)
} }
else // There are no users else // There are no users
/***** Show warning indicating no users found *****/ /***** Show warning indicating no users found *****/
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN); Usr_ShowWarningNoUsersFound (Rol_UNK);
/***** End frame *****/ /***** End frame *****/
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
@ -328,8 +328,8 @@ static void Dup_ListSimilarUsrs (void)
Prf_ShowDetailsUserProfile (&UsrDat); Prf_ShowDetailsUserProfile (&UsrDat);
/* Write all the courses this user belongs to */ /* Write all the courses this user belongs to */
Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_TEACHER); Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_TCH);
Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_STUDENT); Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_STD);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
@ -365,7 +365,7 @@ static void Dup_ListSimilarUsrs (void)
} }
else // There are no users else // There are no users
/***** Show warning indicating no users found *****/ /***** Show warning indicating no users found *****/
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN); Usr_ShowWarningNoUsersFound (Rol_UNK);
/***** End frame *****/ /***** End frame *****/
Lay_EndRoundFrame (); Lay_EndRoundFrame ();

View File

@ -145,7 +145,7 @@ void Enr_PutButtonToEnrolStudents (void)
/***** Form to enrol several students *****/ /***** Form to enrol several students *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) // I am logged as teacher Gbl.Usrs.Me.LoggedRole == Rol_TCH) // I am logged as teacher
{ {
Act_FormStart (ActReqEnrSevStd); Act_FormStart (ActReqEnrSevStd);
Lay_PutConfirmButton (Txt_Register_students); Lay_PutConfirmButton (Txt_Register_students);
@ -197,8 +197,8 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
/***** Check if user's role is allowed *****/ /***** Check if user's role is allowed *****/
switch (NewRole) switch (NewRole)
{ {
case Rol_STUDENT: case Rol_STD:
case Rol_TEACHER: case Rol_TCH:
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Lay_ShowErrorAndExit ("Wrong role.");
@ -235,8 +235,8 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
/***** Check if user's role is allowed *****/ /***** Check if user's role is allowed *****/
switch (NewRole) switch (NewRole)
{ {
case Rol_STUDENT: case Rol_STD:
case Rol_TEACHER: case Rol_TCH:
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Lay_ShowErrorAndExit ("Wrong role.");
@ -285,10 +285,10 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole)
/***** Check if user's role is allowed *****/ /***** Check if user's role is allowed *****/
switch (NewRole) switch (NewRole)
{ {
case Rol_STUDENT: case Rol_STD:
NotifyEvent = Ntf_EVENT_ENROLMENT_STUDENT; NotifyEvent = Ntf_EVENT_ENROLMENT_STUDENT;
break; break;
case Rol_TEACHER: case Rol_TCH:
NotifyEvent = Ntf_EVENT_ENROLMENT_TEACHER; NotifyEvent = Ntf_EVENT_ENROLMENT_TEACHER;
break; break;
default: default:
@ -365,13 +365,13 @@ void Enr_ReqAcceptRegisterInCrs (void)
Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt); Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt);
/***** Send button to accept register in the current course *****/ /***** Send button to accept register in the current course *****/
Act_FormStart (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActAccEnrStd : Act_FormStart (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActAccEnrStd :
ActAccEnrTch); ActAccEnrTch);
Lay_PutCreateButtonInline (Txt_Confirm_my_enrolment); Lay_PutCreateButtonInline (Txt_Confirm_my_enrolment);
Act_FormEnd (); Act_FormEnd ();
/***** Send button to refuse register in the current course *****/ /***** Send button to refuse register in the current course *****/
Act_FormStart (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActRemMe_Std : Act_FormStart (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActRemMe_Std :
ActRemMe_Tch); ActRemMe_Tch);
Lay_PutRemoveButtonInline (Txt_Remove_me_from_this_course); Lay_PutRemoveButtonInline (Txt_Remove_me_from_this_course);
Act_FormEnd (); Act_FormEnd ();
@ -380,7 +380,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
/***** Mark possible notification as seen *****/ /***** Mark possible notification as seen *****/
Ntf_MarkNotifAsSeen (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? Ntf_EVENT_ENROLMENT_STUDENT : Ntf_MarkNotifAsSeen (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STD ? Ntf_EVENT_ENROLMENT_STUDENT :
Ntf_EVENT_ENROLMENT_TEACHER, Ntf_EVENT_ENROLMENT_TEACHER,
-1L,Gbl.CurrentCrs.Crs.CrsCod, -1L,Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
@ -520,12 +520,12 @@ void Enr_UpdateInstitutionCentreDepartment (void)
void Enr_ReqAdminStds (void) void Enr_ReqAdminStds (void)
{ {
Enr_ReqAdminUsrs (Rol_STUDENT); Enr_ReqAdminUsrs (Rol_STD);
} }
void Enr_ReqAdminTchs (void) void Enr_ReqAdminTchs (void)
{ {
Enr_ReqAdminUsrs (Rol_TEACHER); Enr_ReqAdminUsrs (Rol_TCH);
} }
static void Enr_ReqAdminUsrs (Rol_Role_t Role) static void Enr_ReqAdminUsrs (Rol_Role_t Role)
@ -534,18 +534,18 @@ static void Enr_ReqAdminUsrs (Rol_Role_t Role)
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol__GUEST_: case Rol_GST:
Enr_AskIfRegRemMe (Rol__GUEST_); Enr_AskIfRegRemMe (Rol_GST);
break; break;
case Rol_STUDENT: case Rol_STD:
Enr_AskIfRegRemMe (Rol_STUDENT); Enr_AskIfRegRemMe (Rol_STD);
break; break;
case Rol_TEACHER: case Rol_TCH:
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Role == Rol_STUDENT) Role == Rol_STD)
Enr_ShowFormRegRemSeveralUsrs (Rol_STUDENT); Enr_ShowFormRegRemSeveralUsrs (Rol_STD);
else else
Enr_AskIfRegRemMe (Rol_TEACHER); Enr_AskIfRegRemMe (Rol_TCH);
break; break;
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
@ -582,7 +582,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
extern const char *Txt_Confirm; extern const char *Txt_Confirm;
/***** Put contextual links *****/ /***** Put contextual links *****/
if (Role == Rol_STUDENT && // Users to admin: students if (Role == Rol_STD && // Users to admin: students
Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
Gbl.CurrentCrs.Crs.NumStds) // This course has students Gbl.CurrentCrs.Crs.NumStds) // This course has students
{ {
@ -595,12 +595,12 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
} }
/***** Form to send students to be enroled / removed *****/ /***** Form to send students to be enroled / removed *****/
Act_FormStart (Role == Rol_STUDENT ? ActRcvFrmEnrSevStd : Act_FormStart (Role == Rol_STD ? ActRcvFrmEnrSevStd :
ActRcvFrmEnrSevTch); ActRcvFrmEnrSevTch);
/***** Start frame *****/ /***** Start frame *****/
Lay_StartRoundFrame (NULL, Lay_StartRoundFrame (NULL,
Role == Rol_STUDENT ? Txt_Administer_multiple_students : Role == Rol_STD ? Txt_Administer_multiple_students :
Txt_Administer_multiple_teachers, Txt_Administer_multiple_teachers,
NULL, NULL,
Hlp_USERS_Administration_administer_multiple_users); Hlp_USERS_Administration_administer_multiple_users);
@ -893,7 +893,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user in course / Modify user's data *****/ /***** Register user in course / Modify user's data *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) Gbl.Usrs.Me.LoggedRole >= Rol_TCH)
{ {
sprintf (Gbl.Alert.Txt,UsrBelongsToCrs ? (ItsMe ? Txt_Modify_me_in_the_course_X : sprintf (Gbl.Alert.Txt,UsrBelongsToCrs ? (ItsMe ? Txt_Modify_me_in_the_course_X :
Txt_Modify_user_in_the_course_X) : Txt_Modify_user_in_the_course_X) :
@ -1002,7 +1002,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
} }
/***** Report user as possible duplicate *****/ /***** Report user as possible duplicate *****/
if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TCH)
{ {
fprintf (Gbl.F.Out,"<li>" fprintf (Gbl.F.Out,"<li>"
"<label>" "<label>"
@ -1242,12 +1242,12 @@ static void Enr_PutActionsRegRemSeveralUsrs (void)
void Enr_ReceiveFormAdminStds (void) void Enr_ReceiveFormAdminStds (void)
{ {
Enr_ReceiveFormUsrsCrs (Rol_STUDENT); Enr_ReceiveFormUsrsCrs (Rol_STD);
} }
void Enr_ReceiveFormAdminTchs (void) void Enr_ReceiveFormAdminTchs (void)
{ {
Enr_ReceiveFormUsrsCrs (Rol_TEACHER); Enr_ReceiveFormUsrsCrs (Rol_TCH);
} }
static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
@ -1285,9 +1285,9 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
/***** Check the role of users to register / remove *****/ /***** Check the role of users to register / remove *****/
switch (Role) switch (Role)
{ {
case Rol_STUDENT: case Rol_STD:
break; break;
case Rol_TEACHER: case Rol_TCH:
if (Gbl.Usrs.Me.LoggedRole < Rol_DEG_ADM) // Can I register/remove teachers? if (Gbl.Usrs.Me.LoggedRole < Rol_DEG_ADM) // Can I register/remove teachers?
// No, I can not (TODO: teachers should be able to register/remove existing teachers) // No, I can not (TODO: teachers should be able to register/remove existing teachers)
Lay_ShowErrorAndExit ("You are not allowed to perform this action."); Lay_ShowErrorAndExit ("You are not allowed to perform this action.");
@ -1368,7 +1368,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
/***** A student can't belong to more than one group when the type of group only allows to register in one group *****/ /***** A student can't belong to more than one group when the type of group only allows to register in one group *****/
if (WhatToDo.RegisterUsrs && if (WhatToDo.RegisterUsrs &&
Role == Rol_STUDENT && Role == Rol_STD &&
LstGrps.NumGrps >= 2) LstGrps.NumGrps >= 2)
/* Check if I have selected more than one group of single enrolment */ /* Check if I have selected more than one group of single enrolment */
if (!Grp_CheckIfSelectionGrpsIsValid (&LstGrps)) if (!Grp_CheckIfSelectionGrpsIsValid (&LstGrps))
@ -1395,7 +1395,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
if (WhatToDo.RemoveUsrs) if (WhatToDo.RemoveUsrs)
{ {
/***** Get list of users in current course *****/ /***** Get list of users in current course *****/
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
if (Gbl.Usrs.LstUsrs[Role].NumUsrs) if (Gbl.Usrs.LstUsrs[Role].NumUsrs)
{ {
@ -1673,8 +1673,8 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered) struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered)
{ {
/***** Check if I can register this user *****/ /***** Check if I can register this user *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER && if (Gbl.Usrs.Me.LoggedRole == Rol_TCH &&
RegRemRole != Rol_STUDENT) RegRemRole != Rol_STD)
Lay_ShowErrorAndExit ("A teacher only can register several users as students."); Lay_ShowErrorAndExit ("A teacher only can register several users as students.");
/***** Check if the record of the user exists and get the type of user *****/ /***** Check if the record of the user exists and get the type of user *****/
@ -1745,7 +1745,7 @@ void Enr_AskRemAllStdsThisCrs (void)
Lay_StartRoundFrame (NULL,Txt_Remove_all_students,NULL, Lay_StartRoundFrame (NULL,Txt_Remove_all_students,NULL,
Hlp_USERS_Administration_remove_all_students); Hlp_USERS_Administration_remove_all_students);
if ((NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,Gbl.CurrentCrs.Crs.CrsCod))) if ((NumStds = Usr_GetNumUsrsInCrs (Rol_STD,Gbl.CurrentCrs.Crs.CrsCod)))
{ {
/***** Show question and button to remove students *****/ /***** Show question and button to remove students *****/
/* Start alert */ /* Start alert */
@ -1765,7 +1765,7 @@ void Enr_AskRemAllStdsThisCrs (void)
} }
else else
/***** Show warning indicating no students found *****/ /***** Show warning indicating no students found *****/
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
/***** End frame *****/ /***** End frame *****/
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
@ -1790,7 +1790,7 @@ void Enr_RemAllStdsThisCrs (void)
} }
else else
/***** Show warning indicating no students found *****/ /***** Show warning indicating no students found *****/
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
} }
} }
@ -1806,21 +1806,21 @@ unsigned Enr_RemAllStdsInCrs (struct Course *Crs)
/***** Get list of students in current course *****/ /***** Get list of students in current course *****/
Gbl.Usrs.ClassPhoto.AllGroups = true; // Get all the students of the current course Gbl.Usrs.ClassPhoto.AllGroups = true; // Get all the students of the current course
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumStdsInCrs = Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; NumStdsInCrs = Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
/***** Remove all the students *****/ /***** Remove all the students *****/
for (NumUsr = 0; for (NumUsr = 0;
NumUsr < NumStdsInCrs; NumUsr < NumStdsInCrs;
NumUsr++) NumUsr++)
{ {
Gbl.Usrs.Other.UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].UsrCod; Gbl.Usrs.Other.UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod;
Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,Crs, Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,Crs,
Enr_REMOVE_WORKS,Cns_QUIET); Enr_REMOVE_WORKS,Cns_QUIET);
} }
/***** Free memory for students list *****/ /***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
return NumStdsInCrs; return NumStdsInCrs;
} }
@ -1835,15 +1835,15 @@ void Enr_ReqSignUpInCrs (void)
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
/***** Check if I already belong to course *****/ /***** Check if I already belong to course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_STUDENT) if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_STD)
{ {
sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y, sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y,
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex], Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName); Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt);
} }
else if (Gbl.Usrs.Me.LoggedRole == Rol__GUEST_ || else if (Gbl.Usrs.Me.LoggedRole == Rol_GST ||
Gbl.Usrs.Me.LoggedRole == Rol_VISITOR) Gbl.Usrs.Me.LoggedRole == Rol_USR)
/***** Show form to modify only the user's role or the user's data *****/ /***** Show form to modify only the user's role or the user's data *****/
Rec_ShowFormSignUpWithMySharedRecord (); Rec_ShowFormSignUpWithMySharedRecord ();
else else
@ -1866,7 +1866,7 @@ void Enr_SignUpInCrs (void)
long ReqCod = -1L; long ReqCod = -1L;
/***** Check if I already belong to course *****/ /***** Check if I already belong to course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_STUDENT) if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_STD)
{ {
sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y, sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y,
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex], Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
@ -1880,11 +1880,11 @@ void Enr_SignUpInCrs (void)
Par_GetParToUnsignedLong ("Role", Par_GetParToUnsignedLong ("Role",
0, 0,
Rol_NUM_ROLES - 1, Rol_NUM_ROLES - 1,
(unsigned long) Rol_UNKNOWN); (unsigned long) Rol_UNK);
/* Check if role is correct */ /* Check if role is correct */
if (!(RoleFromForm == Rol_STUDENT || if (!(RoleFromForm == Rol_STD ||
RoleFromForm == Rol_TEACHER)) RoleFromForm == Rol_TCH))
Lay_ShowErrorAndExit ("Wrong role."); Lay_ShowErrorAndExit ("Wrong role.");
/***** Try to get and old request of the same user in the same course from database *****/ /***** Try to get and old request of the same user in the same course from database *****/
@ -1933,7 +1933,7 @@ void Enr_SignUpInCrs (void)
/***** Notify teachers or admins by email about the new enrolment request *****/ /***** Notify teachers or admins by email about the new enrolment request *****/
// If this course has teachers ==> send notification to teachers // If this course has teachers ==> send notification to teachers
// If this course has no teachers and I want to be a teacher ==> send notification to administrators or superusers // If this course has no teachers and I want to be a teacher ==> send notification to administrators or superusers
if (Gbl.CurrentCrs.Crs.NumTchs || RoleFromForm == Rol_TEACHER) if (Gbl.CurrentCrs.Crs.NumTchs || RoleFromForm == Rol_TCH)
Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_ENROLMENT_REQUEST,ReqCod); Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_ENROLMENT_REQUEST,ReqCod);
} }
} }
@ -2032,8 +2032,8 @@ void Enr_AskIfRejectSignUp (void)
else // User does not belong to this course else // User does not belong to this course
{ {
Role = Rol_GetRequestedRole (Gbl.Usrs.Other.UsrDat.UsrCod); Role = Rol_GetRequestedRole (Gbl.Usrs.Other.UsrDat.UsrCod);
if (Role == Rol_STUDENT || if (Role == Rol_STD ||
Role == Rol_TEACHER) Role == Rol_TCH)
{ {
/***** Show question and button to reject user's enrolment request *****/ /***** Show question and button to reject user's enrolment request *****/
/* Start alert */ /* Start alert */
@ -2109,15 +2109,15 @@ void Enr_ShowEnrolmentRequests (void)
/***** Show enrolment request (default roles depend on my logged role) *****/ /***** Show enrolment request (default roles depend on my logged role) *****/
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
Enr_ShowEnrolmentRequestsGivenRoles ((1 << Rol_STUDENT) | Enr_ShowEnrolmentRequestsGivenRoles ((1 << Rol_STD) |
(1 << Rol_TEACHER)); (1 << Rol_TCH));
break; break;
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
case Rol_INS_ADM: case Rol_INS_ADM:
case Rol_SYS_ADM: case Rol_SYS_ADM:
Enr_ShowEnrolmentRequestsGivenRoles (1 << Rol_TEACHER); Enr_ShowEnrolmentRequestsGivenRoles (1 << Rol_TCH);
break; break;
default: default:
Lay_ShowErrorAndExit ("You don't have permission to list requesters."); Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
@ -2216,8 +2216,8 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
"</td>" "</td>"
"<td class=\"DAT LEFT_MIDDLE\">", "<td class=\"DAT LEFT_MIDDLE\">",
The_ClassForm[Gbl.Prefs.Theme],Txt_Users); The_ClassForm[Gbl.Prefs.Theme],Txt_Users);
Rol_WriteSelectorRoles (1 << Rol_STUDENT | Rol_WriteSelectorRoles (1 << Rol_STD |
1 << Rol_TEACHER, 1 << Rol_TCH,
RolesSelected, RolesSelected,
false,true); false,true);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -2233,7 +2233,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_SYS: // Show requesters for the whole platform case Sco_SCOPE_SYS: // Show requesters for the whole platform
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
// Requests in all courses in which I am teacher // Requests in all courses in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod," sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod," "crs_usr_requests.CrsCod,"
@ -2247,7 +2247,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0" " AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC", " ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
RolesSelected); RolesSelected);
break; break;
case Rol_DEG_ADM: case Rol_DEG_ADM:
@ -2321,7 +2321,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_CTY: // Show requesters for the current country case Sco_SCOPE_CTY: // Show requesters for the current country
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
// Requests in courses of this country in which I am teacher // Requests in courses of this country in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod," sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod," "crs_usr_requests.CrsCod,"
@ -2340,7 +2340,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0" " AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC", " ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.CurrentCty.Cty.CtyCod, Gbl.CurrentCty.Cty.CtyCod,
RolesSelected); RolesSelected);
break; break;
@ -2433,7 +2433,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_INS: // Show requesters for the current institution case Sco_SCOPE_INS: // Show requesters for the current institution
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
// Requests in courses of this institution in which I am teacher // Requests in courses of this institution in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod," sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod," "crs_usr_requests.CrsCod,"
@ -2451,7 +2451,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0" " AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC", " ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.InsCod,
RolesSelected); RolesSelected);
break; break;
@ -2521,7 +2521,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_CTR: // Show requesters for the current centre case Sco_SCOPE_CTR: // Show requesters for the current centre
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
// Requests in courses of this centre in which I am teacher // Requests in courses of this centre in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod," sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod," "crs_usr_requests.CrsCod,"
@ -2538,7 +2538,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0" " AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC", " ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
RolesSelected); RolesSelected);
break; break;
@ -2587,7 +2587,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_DEG: // Show requesters for the current degree case Sco_SCOPE_DEG: // Show requesters for the current degree
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
// Requests in courses of this degree in which I am teacher // Requests in courses of this degree in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod," sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod," "crs_usr_requests.CrsCod,"
@ -2603,7 +2603,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0" " AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC", " ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentDeg.Deg.DegCod,
RolesSelected); RolesSelected);
break; break;
@ -2633,7 +2633,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_CRS: // Show requesters for the current course case Sco_SCOPE_CRS: // Show requesters for the current course
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: // If I am logged as teacher of this course , I can view all the requesters from this course case Rol_TCH: // If I am logged as teacher of this course , I can view all the requesters from this course
case Rol_DEG_ADM: // If I am logged as admin of this degree , I can view all the requesters from this course case Rol_DEG_ADM: // If I am logged as admin of this degree , I can view all the requesters from this course
case Rol_CTR_ADM: // If I am logged as admin of this centre , I can view all the requesters from this course case Rol_CTR_ADM: // If I am logged as admin of this centre , I can view all the requesters from this course
case Rol_INS_ADM: // If I am logged as admin of this institution, I can view all the requesters from this course case Rol_INS_ADM: // If I am logged as admin of this institution, I can view all the requesters from this course
@ -2722,8 +2722,8 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
if (UsrExists && if (UsrExists &&
!UsrBelongsToCrs && !UsrBelongsToCrs &&
(DesiredRole == Rol_STUDENT || (DesiredRole == Rol_STD ||
DesiredRole == Rol_TEACHER)) DesiredRole == Rol_TCH))
{ {
/***** Number *****/ /***** Number *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -2780,7 +2780,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
/***** Button to confirm the request *****/ /***** Button to confirm the request *****/
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_TOP\">"); fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_TOP\">");
Act_FormStart (DesiredRole == Rol_STUDENT ? ActReqMdfStd : Act_FormStart (DesiredRole == Rol_STD ? ActReqMdfStd :
ActReqMdfTch); ActReqMdfTch);
Crs_PutParamCrsCod (Crs.CrsCod); Crs_PutParamCrsCod (Crs.CrsCod);
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
@ -2908,10 +2908,10 @@ void Enr_PutLinkToAdminSeveralUsrs (Rol_Role_t Role)
{ {
extern const char *Txt_Administer_multiple_students; extern const char *Txt_Administer_multiple_students;
extern const char *Txt_Administer_multiple_teachers; extern const char *Txt_Administer_multiple_teachers;
const char *TitleText = (Role == Rol_STUDENT) ? Txt_Administer_multiple_students : const char *TitleText = (Role == Rol_STD) ? Txt_Administer_multiple_students :
Txt_Administer_multiple_teachers; Txt_Administer_multiple_teachers;
Lay_PutContextualLink (Role == Rol_STUDENT ? ActReqEnrSevStd : Lay_PutContextualLink (Role == Rol_STD ? ActReqEnrSevStd :
ActReqEnrSevTch, ActReqEnrSevTch,
NULL,NULL, NULL,NULL,
"config64x64.gif", "config64x64.gif",
@ -2925,17 +2925,17 @@ void Enr_PutLinkToAdminSeveralUsrs (Rol_Role_t Role)
void Enr_ReqRegRemOth (void) void Enr_ReqRegRemOth (void)
{ {
Enr_ReqRegRemUsr (Rol__GUEST_); Enr_ReqRegRemUsr (Rol_GST);
} }
void Enr_ReqRegRemStd (void) void Enr_ReqRegRemStd (void)
{ {
Enr_ReqRegRemUsr (Rol_STUDENT); Enr_ReqRegRemUsr (Rol_STD);
} }
void Enr_ReqRegRemTch (void) void Enr_ReqRegRemTch (void)
{ {
Enr_ReqRegRemUsr (Rol_TEACHER); Enr_ReqRegRemUsr (Rol_TCH);
} }
static void Enr_ReqRegRemUsr (Rol_Role_t Role) static void Enr_ReqRegRemUsr (Rol_Role_t Role)
@ -2954,12 +2954,12 @@ static bool Enr_ICanAdminOtherUsrs (void)
{ {
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_UNKNOWN: case Rol_UNK:
case Rol__GUEST_: case Rol_GST:
case Rol_VISITOR: case Rol_USR:
case Rol_STUDENT: case Rol_STD:
return false; return false;
case Rol_TEACHER: case Rol_TCH:
// A teacher can be logged as teacher outside of his/her courses // A teacher can be logged as teacher outside of his/her courses
// TODO: Teachers/students should be teachers/students only inside their courses // TODO: Teachers/students should be teachers/students only inside their courses
return (Gbl.CurrentCrs.Crs.CrsCod > 0); return (Gbl.CurrentCrs.Crs.CrsCod > 0);
@ -2986,8 +2986,8 @@ static void Enr_ReqAnotherUsrIDToRegisterRemove (Rol_Role_t Role)
Hlp_USERS_Administration_administer_one_user); Hlp_USERS_Administration_administer_one_user);
/***** Write form to request another user's ID *****/ /***** Write form to request another user's ID *****/
Enr_WriteFormToReqAnotherUsrID ( Role == Rol_STUDENT ? ActReqMdfStd : Enr_WriteFormToReqAnotherUsrID ( Role == Rol_STD ? ActReqMdfStd :
(Role == Rol_TEACHER ? ActReqMdfTch : (Role == Rol_TCH ? ActReqMdfTch :
ActReqMdfOth)); ActReqMdfOth));
/***** End frame *****/ /***** End frame *****/
@ -3017,17 +3017,17 @@ static void Enr_AskIfRegRemMe (Rol_Role_t Role)
void Enr_AskIfRegRemAnotherOth (void) void Enr_AskIfRegRemAnotherOth (void)
{ {
Enr_AskIfRegRemAnotherUsr (Rol__GUEST_); Enr_AskIfRegRemAnotherUsr (Rol_GST);
} }
void Enr_AskIfRegRemAnotherStd (void) void Enr_AskIfRegRemAnotherStd (void)
{ {
Enr_AskIfRegRemAnotherUsr (Rol_STUDENT); Enr_AskIfRegRemAnotherUsr (Rol_STD);
} }
void Enr_AskIfRegRemAnotherTch (void) void Enr_AskIfRegRemAnotherTch (void)
{ {
Enr_AskIfRegRemAnotherUsr (Rol_TEACHER); Enr_AskIfRegRemAnotherUsr (Rol_TCH);
} }
static void Enr_AskIfRegRemAnotherUsr (Rol_Role_t Role) static void Enr_AskIfRegRemAnotherUsr (Rol_Role_t Role)
@ -3321,7 +3321,7 @@ static void Enr_ReqRemOrRemUsrFromCrs (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
// A teacher can remove a student or himself // A teacher can remove a student or himself
// An administrator can remove anyone // An administrator can remove anyone
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
ICanRemove = (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ? ItsMe : ICanRemove = (Gbl.Usrs.Me.LoggedRole == Rol_STD ? ItsMe :
(Gbl.Usrs.Me.LoggedRole >= Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB)); (Gbl.Usrs.Me.LoggedRole >= Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB));
if (ICanRemove) if (ICanRemove)
switch (ReqDelOrDelUsr) switch (ReqDelOrDelUsr)
@ -3613,8 +3613,8 @@ void Enr_CreateNewUsr1 (void)
} }
/***** Change current action *****/ /***** Change current action *****/
Gbl.Action.Act = (NewRole == Rol_STUDENT) ? ActCreStd : Gbl.Action.Act = (NewRole == Rol_STD) ? ActCreStd :
((NewRole == Rol_TEACHER) ? ActCreTch : ((NewRole == Rol_TCH) ? ActCreTch :
ActCreOth); ActCreOth);
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
} }
@ -3678,7 +3678,7 @@ void Enr_ModifyUsr1 (void)
switch (Gbl.Usrs.RegRemAction) switch (Gbl.Usrs.RegRemAction)
{ {
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS: case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_TCH)
{ {
/***** Get user's name from record form *****/ /***** Get user's name from record form *****/
if (Usr_ICanChangeOtherUsrData (&Gbl.Usrs.Other.UsrDat)) if (Usr_ICanChangeOtherUsrData (&Gbl.Usrs.Other.UsrDat))
@ -3724,8 +3724,8 @@ void Enr_ModifyUsr1 (void)
} }
/***** Change current action *****/ /***** Change current action *****/
Gbl.Action.Act = (NewRole == Rol_STUDENT) ? ActUpdStd : Gbl.Action.Act = (NewRole == Rol_STD) ? ActUpdStd :
((NewRole == Rol_TEACHER) ? ActUpdTch : ((NewRole == Rol_TCH) ? ActUpdTch :
ActUpdOth); ActUpdOth);
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
} }
@ -3746,11 +3746,11 @@ void Enr_ModifyUsr1 (void)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE: case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE:
if (ItsMe || Gbl.Usrs.Me.LoggedRole < Rol_TEACHER) if (ItsMe || Gbl.Usrs.Me.LoggedRole < Rol_TCH)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REMOVE_ONE_USR_FROM_CRS: case Enr_REMOVE_ONE_USR_FROM_CRS:
if (!ItsMe && Gbl.Usrs.Me.LoggedRole < Rol_TEACHER) if (!ItsMe && Gbl.Usrs.Me.LoggedRole < Rol_TCH)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REMOVE_ONE_DEGREE_ADMIN: case Enr_REMOVE_ONE_DEGREE_ADMIN:
@ -3884,7 +3884,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat,bool ItsMe)
Rec_ShowSharedRecordUnmodifiable (UsrDat); Rec_ShowSharedRecordUnmodifiable (UsrDat);
/* Show form to request confirmation */ /* Show form to request confirmation */
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActRemStdCrs : Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActRemStdCrs :
ActRemTchCrs); ActRemTchCrs);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Pwd_AskForConfirmationOnDangerousAction (); Pwd_AskForConfirmationOnDangerousAction ();

View File

@ -549,7 +549,7 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx
MYSQL_ROW row; MYSQL_ROW row;
unsigned long NumExaAnn; unsigned long NumExaAnn;
unsigned long NumExaAnns; unsigned long NumExaAnns;
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
/***** Build subquery about status depending on my role *****/ /***** Build subquery about status depending on my role *****/
@ -1536,7 +1536,7 @@ static void Exa_ShowExamAnnouncement (Exa_TypeViewExamAnnouncement_t TypeViewExa
static void Exa_PutIconsExamAnnouncement (void) static void Exa_PutIconsExamAnnouncement (void)
{ {
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || if (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
{ {
/***** Link to remove this exam announcement *****/ /***** Link to remove this exam announcement *****/

View File

@ -1111,15 +1111,15 @@ static const Act_Action_t Brw_ActRecDatFile[Brw_NUM_TYPES_FILE_BROWSER] =
const unsigned long long Brw_MAX_QUOTA_BRIEF[Rol_NUM_ROLES] = // MaxRole is used const unsigned long long Brw_MAX_QUOTA_BRIEF[Rol_NUM_ROLES] = // MaxRole is used
{ {
0, // Rol_ROLE_UNKNOWN 0, // Rol_UNK
0, // Rol_ROLE_GUEST__ 0, // Rol_GST
0, // Rol_ROLE_VISITOR 0, // Rol_USR
32ULL*Brw_GiB, // Rol_ROLE_STUDENT 32ULL*Brw_GiB, // Rol_STD
64ULL*Brw_GiB, // Rol_ROLE_TEACHER 64ULL*Brw_GiB, // Rol_TCH
0, // Rol_ROLE_DEG_ADM 0, // Rol_DEG_ADM
0, // Rol_ROLE_CTR_ADM 0, // Rol_CTR_ADM
0, // Rol_ROLE_INS_ADM 0, // Rol_INS_ADM
0, // Rol_ROLE_SYS_ADM 0, // Rol_SYS_ADM
}; };
#define Brw_MAX_FILES_BRIEF 5000 #define Brw_MAX_FILES_BRIEF 5000
#define Brw_MAX_FOLDS_BRIEF 1000 #define Brw_MAX_FOLDS_BRIEF 1000
@ -2081,7 +2081,7 @@ void Brw_GetParAndInitFileBrowser (void)
/***** Marks *****/ /***** Marks *****/
case ActSeeAdmMrk: // Access to a marks zone from menu case ActSeeAdmMrk: // Access to a marks zone from menu
/* Set file browser type acording to last group accessed */ /* Set file browser type acording to last group accessed */
Gbl.FileBrowser.Type = (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) ? Gbl.FileBrowser.Type = (Gbl.Usrs.Me.LoggedRole == Rol_STD) ?
(Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_SHOW_MARKS_GRP : (Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_SHOW_MARKS_GRP :
Brw_SHOW_MARKS_CRS) : Brw_SHOW_MARKS_CRS) :
(Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_ADMI_MARKS_GRP : (Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_ADMI_MARKS_GRP :
@ -3096,10 +3096,10 @@ void Brw_AskEditWorksCrs (void)
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order lists of users from this course *****/ /***** Get and order lists of users from this course *****/
Usr_GetListUsrs (Rol_TEACHER,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_TCH,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs + NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
/***** Draw class photos to select users *****/ /***** Draw class photos to select users *****/
Lay_StartRoundFrame (NULL,Txt_Users, Lay_StartRoundFrame (NULL,Txt_Users,
@ -3123,8 +3123,8 @@ void Brw_AskEditWorksCrs (void)
/* Put list of users to select some of them */ /* Put list of users to select some of them */
Lay_StartTableCenter (0); Lay_StartTableCenter (0);
Usr_ListUsersToSelect (Rol_TEACHER); Usr_ListUsersToSelect (Rol_TCH);
Usr_ListUsersToSelect (Rol_STUDENT); Usr_ListUsersToSelect (Rol_STD);
Lay_EndTable (); Lay_EndTable ();
/* Send button */ /* Send button */
@ -3135,14 +3135,14 @@ void Brw_AskEditWorksCrs (void)
} }
} }
else else
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN); Usr_ShowWarningNoUsersFound (Rol_UNK);
/***** End frame *****/ /***** End frame *****/
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
/***** Free memory for users' list *****/ /***** Free memory for users' list *****/
Usr_FreeUsrsList (Rol_TEACHER); Usr_FreeUsrsList (Rol_TCH);
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
/***** Free memory used by list of selected users' codes *****/ /***** Free memory used by list of selected users' codes *****/
Usr_FreeListsSelectedUsrsCods (); Usr_FreeListsSelectedUsrsCods ();
@ -3402,7 +3402,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
fprintf (Gbl.F.Out,"<div class=\"OWNER_WORKS_DATA AUTHOR_TXT\""); fprintf (Gbl.F.Out,"<div class=\"OWNER_WORKS_DATA AUTHOR_TXT\"");
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActSeeRecOneStd : Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActSeeRecOneStd :
ActSeeRecOneTch); ActSeeRecOneTch);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
@ -3513,7 +3513,7 @@ static void Brw_ShowFileBrowser (void)
const char *Brw_TitleOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER]; const char *Brw_TitleOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER];
const char *Brw_HelpOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER]; const char *Brw_HelpOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER];
struct Brw_NumObjects Removed; struct Brw_NumObjects Removed;
bool IAmTeacherOrSysAdm = Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || bool IAmTeacherOrSysAdm = Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM; Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
/***** Set title of file browser *****/ /***** Set title of file browser *****/
@ -3971,7 +3971,7 @@ static void Brw_WriteSubtitleOfFileBrowser (void)
break; break;
case Brw_SHOW_MARKS_CRS: case Brw_SHOW_MARKS_CRS:
case Brw_SHOW_MARKS_GRP: case Brw_SHOW_MARKS_GRP:
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
sprintf (Subtitle,"(%s)", sprintf (Subtitle,"(%s)",
Txt_accessible_only_for_reading_by_you_and_the_teachers_of_the_course); Txt_accessible_only_for_reading_by_you_and_the_teachers_of_the_course);
else else
@ -5305,7 +5305,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,Brw_ExpandTree_t ExpandTree,
{ {
/***** Put icon to download ZIP of folder *****/ /***** Put icon to download ZIP of folder *****/
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
if (Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT && // Only ZIP folders if I am student, teacher... if (Gbl.Usrs.Me.LoggedRole >= Rol_STD && // Only ZIP folders if I am student, teacher...
!SeeMarks && // Do not ZIP folders when seeing marks !SeeMarks && // Do not ZIP folders when seeing marks
!(SeeDocsZone && RowSetAsHidden)) // When seeing docs, if folder is not hidden (this could happen for Level == 0) !(SeeDocsZone && RowSetAsHidden)) // When seeing docs, if folder is not hidden (this could happen for Level == 0)
ZIP_PutButtonToDownloadZIPOfAFolder (PathInTree,FileName); ZIP_PutButtonToDownloadZIPOfAFolder (PathInTree,FileName);
@ -9022,7 +9022,7 @@ void Brw_ShowFileMetadata (void)
break; break;
case Brw_SHOW_DOCUM_CRS: case Brw_SHOW_DOCUM_CRS:
case Brw_SHOW_DOCUM_GRP: case Brw_SHOW_DOCUM_GRP:
if (Gbl.Usrs.Me.LoggedRole < Rol_TEACHER) if (Gbl.Usrs.Me.LoggedRole < Rol_TCH)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
default: default:
@ -9139,7 +9139,7 @@ void Brw_ShowFileMetadata (void)
} }
else else
/* Unknown publisher */ /* Unknown publisher */
fprintf (Gbl.F.Out,"%s",Txt_ROLES_SINGUL_Abc[Rol_UNKNOWN][Usr_SEX_UNKNOWN]); fprintf (Gbl.F.Out,"%s",Txt_ROLES_SINGUL_Abc[Rol_UNK][Usr_SEX_UNKNOWN]);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
@ -9411,7 +9411,7 @@ void Brw_DownloadFile (void)
break; break;
case Brw_SHOW_DOCUM_CRS: case Brw_SHOW_DOCUM_CRS:
case Brw_SHOW_DOCUM_GRP: case Brw_SHOW_DOCUM_GRP:
if (Gbl.Usrs.Me.LoggedRole < Rol_TEACHER) if (Gbl.Usrs.Me.LoggedRole < Rol_TCH)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
default: default:
@ -10852,18 +10852,18 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
return false; return false;
/***** I must be student, teacher, admin or superuser to edit *****/ /***** I must be student, teacher, admin or superuser to edit *****/
if (Gbl.Usrs.Me.MaxRole < Rol_STUDENT) if (Gbl.Usrs.Me.MaxRole < Rol_STD)
return false; return false;
/***** Set depending on browser, level, logged role... *****/ /***** Set depending on browser, level, logged role... *****/
switch (Gbl.FileBrowser.Type) switch (Gbl.FileBrowser.Type)
{ {
case Brw_ADMI_TEACH_CRS: case Brw_ADMI_TEACH_CRS:
return (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER); return (Gbl.Usrs.Me.LoggedRole >= Rol_TCH);
case Brw_ADMI_TEACH_GRP: case Brw_ADMI_TEACH_GRP:
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) if (Gbl.Usrs.Me.LoggedRole == Rol_TCH)
return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod); // A teacher can edit only if hr/she belongs to group return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod); // A teacher can edit only if hr/she belongs to group
return (Gbl.Usrs.Me.LoggedRole > Rol_TEACHER); return (Gbl.Usrs.Me.LoggedRole > Rol_TCH);
case Brw_ADMI_SHARE_CRS: case Brw_ADMI_SHARE_CRS:
case Brw_ADMI_SHARE_GRP: case Brw_ADMI_SHARE_GRP:
// Check if I am the publisher of the folder // Check if I am the publisher of the folder
@ -10883,9 +10883,9 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment
return false; // I can not edit this assignment return false; // I can not edit this assignment
return ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && // Students can edit return ((Gbl.Usrs.Me.LoggedRole == Rol_STD && // Students can edit
Gbl.FileBrowser.Asg.Open) || // inside open assignments Gbl.FileBrowser.Asg.Open) || // inside open assignments
Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER); // Teachers can edit Gbl.Usrs.Me.LoggedRole >= Rol_TCH); // Teachers can edit
// inside open or closed assignments // inside open or closed assignments
default: default:
return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type]; return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type];
@ -10903,7 +10903,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
return false; return false;
/***** I must be student, teacher, admin or superuser to edit *****/ /***** I must be student, teacher, admin or superuser to edit *****/
if (Gbl.Usrs.Me.MaxRole < Rol_STUDENT) if (Gbl.Usrs.Me.MaxRole < Rol_STD)
return false; return false;
/***** If maximum level is reached, I can not create/paste *****/ /***** If maximum level is reached, I can not create/paste *****/
@ -10928,9 +10928,9 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment
return false; // I can not create anything inside this assignment return false; // I can not create anything inside this assignment
return ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && // Students can create return ((Gbl.Usrs.Me.LoggedRole == Rol_STD && // Students can create
Gbl.FileBrowser.Asg.Open) || // inside open assignments Gbl.FileBrowser.Asg.Open) || // inside open assignments
Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER); // Teachers can create Gbl.Usrs.Me.LoggedRole >= Rol_TCH); // Teachers can create
// inside open or closed assignments // inside open or closed assignments
default: default:
return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type]; return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type];
@ -10956,7 +10956,7 @@ static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: // If I am a student, I can modify the file/folder if I am the publisher case Rol_STD: // If I am a student, I can modify the file/folder if I am the publisher
/***** Get all the distinct publishers of files starting by Gbl.FileBrowser.Priv.FullPathInTree from database *****/ /***** Get all the distinct publishers of files starting by Gbl.FileBrowser.Priv.FullPathInTree from database *****/
sprintf (Query,"SELECT DISTINCT(PublisherUsrCod) FROM files" sprintf (Query,"SELECT DISTINCT(PublisherUsrCod) FROM files"
" WHERE FileBrowser=%u AND Cod=%ld" " WHERE FileBrowser=%u AND Cod=%ld"
@ -10979,7 +10979,7 @@ static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
return (Gbl.Usrs.Me.UsrDat.UsrCod == PublisherUsrCod); // Am I the publisher of subtree? return (Gbl.Usrs.Me.UsrDat.UsrCod == PublisherUsrCod); // Am I the publisher of subtree?
case Rol_TEACHER: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
case Rol_INS_ADM: case Rol_INS_ADM:
@ -11172,7 +11172,7 @@ void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
Txt_Filename,FileMetadata.FilFolLnkName, Txt_Filename,FileMetadata.FilFolLnkName,
Txt_Folder,FileMetadata.PathInTreeUntilFilFolLnk, // TODO: Fix bug: do not write internal name (for example "comun") Txt_Folder,FileMetadata.PathInTreeUntilFilFolLnk, // TODO: Fix bug: do not write internal name (for example "comun")
Txt_Uploaded_by,FileHasPublisher ? PublisherUsrDat.FullName : Txt_Uploaded_by,FileHasPublisher ? PublisherUsrDat.FullName :
Txt_ROLES_SINGUL_Abc[Rol_UNKNOWN][Usr_SEX_UNKNOWN]); Txt_ROLES_SINGUL_Abc[Rol_UNK][Usr_SEX_UNKNOWN]);
/* Free memory used for publisher's data */ /* Free memory used for publisher's data */
if (FileMetadata.PublisherUsrCod > 0) if (FileMetadata.PublisherUsrCod > 0)

View File

@ -1044,7 +1044,7 @@ static void For_ShowPostsOfAThread (Ale_AlertType_t AlertType,const char *Messag
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM); ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM);
break; break;
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_USRS:
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER); ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_TCH);
break; break;
default: default:
ICanModerateForum = false; ICanModerateForum = false;
@ -1828,7 +1828,7 @@ static void For_WriteLinksToGblForums (bool IsLastItemInLevel[1 + For_FORUM_MAX_
/***** Link to forum of teachers global *****/ /***** Link to forum of teachers global *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
if (Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_TEACHER)) if (Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_TCH))
{ {
Forum.Type = For_FORUM_GLOBAL_TCHS; Forum.Type = For_FORUM_GLOBAL_TCHS;
Forum.Location = -1L; Forum.Location = -1L;
@ -1852,7 +1852,7 @@ static void For_WriteLinksToPlatformForums (bool IsLastForum,
/***** Can I see teachers's forums? *****/ /***** Can I see teachers's forums? *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_TEACHER)); Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_TCH));
/***** Link to forum of users about the platform *****/ /***** Link to forum of users about the platform *****/
Forum.Type = For_FORUM__SWAD__USRS; Forum.Type = For_FORUM__SWAD__USRS;
@ -1887,7 +1887,7 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,
if (InsCod > 0) if (InsCod > 0)
{ {
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInIns (InsCod) >= Rol_TEACHER); Rol_GetMyMaxRoleInIns (InsCod) >= Rol_TCH);
/***** Link to the forum of users from this institution *****/ /***** Link to the forum of users from this institution *****/
Forum.Type = For_FORUM_INSTIT_USRS; Forum.Type = For_FORUM_INSTIT_USRS;
@ -1926,7 +1926,7 @@ static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,
if (CtrCod > 0) if (CtrCod > 0)
{ {
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInCtr (CtrCod) >= Rol_TEACHER); Rol_GetMyMaxRoleInCtr (CtrCod) >= Rol_TCH);
/***** Link to the forum of users from this centre *****/ /***** Link to the forum of users from this centre *****/
Forum.Type = For_FORUM_CENTRE_USRS; Forum.Type = For_FORUM_CENTRE_USRS;
@ -1965,7 +1965,7 @@ static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,
if (DegCod > 0) if (DegCod > 0)
{ {
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInDeg (DegCod) >= Rol_TEACHER); Rol_GetMyMaxRoleInDeg (DegCod) >= Rol_TCH);
/***** Link to the forum of users from this degree *****/ /***** Link to the forum of users from this degree *****/
Forum.Type = For_FORUM_DEGREE_USRS; Forum.Type = For_FORUM_DEGREE_USRS;
@ -2004,7 +2004,7 @@ static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,
if (CrsCod > 0) if (CrsCod > 0)
{ {
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyRoleInCrs (CrsCod) >= Rol_TEACHER); Rol_GetMyRoleInCrs (CrsCod) >= Rol_TCH);
/***** Link to the forum of users from this course *****/ /***** Link to the forum of users from this course *****/
Forum.Type = For_FORUM_COURSE_USRS; Forum.Type = For_FORUM_COURSE_USRS;
@ -3749,39 +3749,39 @@ static void For_RestrictAccess (void)
case For_FORUM_GLOBAL_TCHS: case For_FORUM_GLOBAL_TCHS:
case For_FORUM__SWAD__TCHS: case For_FORUM__SWAD__TCHS:
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
ICanSeeForum = (Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_TEACHER)); ICanSeeForum = (Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_TCH));
break; break;
case For_FORUM_INSTIT_USRS: case For_FORUM_INSTIT_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location) >= Rol_STUDENT); Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location) >= Rol_STD);
break; break;
case For_FORUM_INSTIT_TCHS: case For_FORUM_INSTIT_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location) >= Rol_TEACHER); Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location) >= Rol_TCH);
break; break;
case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location) >= Rol_STUDENT); Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location) >= Rol_STD);
break; break;
case For_FORUM_CENTRE_TCHS: case For_FORUM_CENTRE_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location) >= Rol_TEACHER); Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location) >= Rol_TCH);
break; break;
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location) >= Rol_STUDENT); Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location) >= Rol_STD);
break; break;
case For_FORUM_DEGREE_TCHS: case For_FORUM_DEGREE_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location) >= Rol_TEACHER); Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location) >= Rol_TCH);
break; break;
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location) >= Rol_STUDENT); Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location) >= Rol_STD);
break; break;
case For_FORUM_COURSE_TCHS: case For_FORUM_COURSE_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location) >= Rol_TEACHER); Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location) >= Rol_TCH);
break; break;
default: default:
ICanSeeForum = false; ICanSeeForum = false;

View File

@ -159,7 +159,7 @@ void Gbl_InitializeGlobals (void)
Gbl.Usrs.Me.RoleFromSession = Gbl.Usrs.Me.RoleFromSession =
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.LoggedRole =
Gbl.Usrs.Me.LoggedRoleBeforeCloseSession = Gbl.Usrs.Me.LoggedRoleBeforeCloseSession =
Gbl.Usrs.Me.MaxRole = Rol_UNKNOWN; Gbl.Usrs.Me.MaxRole = Rol_UNK;
Gbl.Usrs.Me.RoleHasChanged = false; Gbl.Usrs.Me.RoleHasChanged = false;
Gbl.Usrs.Me.IBelongToCurrentIns = false; Gbl.Usrs.Me.IBelongToCurrentIns = false;
Gbl.Usrs.Me.IBelongToCurrentCtr = false; Gbl.Usrs.Me.IBelongToCurrentCtr = false;
@ -478,9 +478,9 @@ void Gbl_Cleanup (void)
Hld_FreeListHolidays (); Hld_FreeListHolidays ();
Lnk_FreeListLinks (); Lnk_FreeListLinks ();
Plg_FreeListPlugins (); Plg_FreeListPlugins ();
Usr_FreeUsrsList (Rol__GUEST_); Usr_FreeUsrsList (Rol_GST);
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
Usr_FreeUsrsList (Rol_TEACHER); Usr_FreeUsrsList (Rol_TCH);
Usr_FreeUsrsList (Rol_DEG_ADM); Usr_FreeUsrsList (Rol_DEG_ADM);
Usr_FreeListOtherRecipients (); Usr_FreeListOtherRecipients ();
Usr_FreeListsSelectedUsrsCods (); Usr_FreeListsSelectedUsrsCods ();

View File

@ -343,7 +343,7 @@ void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction)
if (Gbl.CurrentCrs.Grps.NumGrps) if (Gbl.CurrentCrs.Grps.NumGrps)
{ {
ICanEdit = !Gbl.Form.Inside && ICanEdit = !Gbl.Form.Inside &&
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
/***** Start frame *****/ /***** Start frame *****/
@ -594,7 +594,7 @@ void Grp_ChangeMyGrps (void)
// ...is a radio-based form and not a checkbox-based form... // ...is a radio-based form and not a checkbox-based form...
// ...this check is made only to avoid problems... // ...this check is made only to avoid problems...
// ...if the student manipulates the form // ...if the student manipulates the form
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && if (Gbl.Usrs.Me.LoggedRole == Rol_STD &&
LstGrpsIWant.NumGrps >= 2) LstGrpsIWant.NumGrps >= 2)
MySelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsIWant); MySelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsIWant);
@ -640,7 +640,7 @@ void Grp_ChangeOtherUsrGrps (void)
/***** A student can not be enroled in more than one group /***** A student can not be enroled in more than one group
if the type of group is of single enrolment *****/ if the type of group is of single enrolment *****/
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT && if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD &&
LstGrpsUsrWants.NumGrps >= 2) LstGrpsUsrWants.NumGrps >= 2)
SelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsUsrWants); SelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsUsrWants);
@ -697,7 +697,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,-1L, Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,-1L,
Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong); Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong);
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
{ {
/***** Go across the list of groups which I belong to and check if I try to leave a closed group *****/ /***** Go across the list of groups which I belong to and check if I try to leave a closed group *****/
for (NumGrpIBelong = 0; for (NumGrpIBelong = 0;
@ -831,7 +831,7 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
bool RegisterUsrInThisGrp; bool RegisterUsrInThisGrp;
bool ChangesMade = false; bool ChangesMade = false;
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT) if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD)
{ {
/***** Lock tables to make the inscription atomic *****/ /***** Lock tables to make the inscription atomic *****/
DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE," DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
@ -881,7 +881,7 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
Grp_FreeListCodGrp (&LstGrpsUsrBelongs); Grp_FreeListCodGrp (&LstGrpsUsrBelongs);
/***** Unlock tables after changes in my groups *****/ /***** Unlock tables after changes in my groups *****/
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT) if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD)
{ {
Gbl.DB.LockedTables = false; // Set to false before the following unlock... Gbl.DB.LockedTables = false; // Set to false before the following unlock...
// ...to not retry the unlock if error in unlocking // ...to not retry the unlock if error in unlocking
@ -1635,7 +1635,7 @@ void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrS
void Grp_ReqRegisterInGrps (void) void Grp_ReqRegisterInGrps (void)
{ {
/***** Show list of groups to register/remove me *****/ /***** Show list of groups to register/remove me *****/
Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)); Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STD));
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1654,7 +1654,7 @@ void Grp_ShowLstGrpsToChgMyGrps (bool ShowWarningsToStudents)
unsigned NumGrpsIBelong = 0; unsigned NumGrpsIBelong = 0;
bool PutFormToChangeGrps = !Gbl.Form.Inside; // Not inside another form (record card) bool PutFormToChangeGrps = !Gbl.Form.Inside; // Not inside another form (record card)
bool ICanEdit = !Gbl.Form.Inside && bool ICanEdit = !Gbl.Form.Inside &&
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups
@ -1810,7 +1810,7 @@ static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
// If user is a student and the enrolment is single // If user is a student and the enrolment is single
// and there are more than a group, put a radio item // and there are more than a group, put a radio item
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && if (Gbl.Usrs.Me.LoggedRole == Rol_STD &&
!GrpTyp->MultipleEnrolment && !GrpTyp->MultipleEnrolment &&
GrpTyp->NumGrps > 1) GrpTyp->NumGrps > 1)
{ {
@ -1830,7 +1830,7 @@ static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
if (IBelongToThisGroup) if (IBelongToThisGroup)
fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," checked=\"checked\"");
else if ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) && else if ((Gbl.Usrs.Me.LoggedRole == Rol_STD) &&
((!Grp->Open) || (Grp->NumStudents >= Grp->MaxStudents))) ((!Grp->Open) || (Grp->NumStudents >= Grp->MaxStudents)))
fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," /></td>"); fprintf (Gbl.F.Out," /></td>");
@ -2913,7 +2913,7 @@ unsigned Grp_CountNumStdsInGrp (long GrpCod)
" AND crs_grp_types.CrsCod=crs_usr.CrsCod" " AND crs_grp_types.CrsCod=crs_usr.CrsCod"
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod" " AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
" AND crs_usr.Role=%u", " AND crs_usr.Role=%u",
GrpCod,(unsigned) Rol_STUDENT); GrpCod,(unsigned) Rol_STD);
return (unsigned) DB_QueryCOUNT (Query, return (unsigned) DB_QueryCOUNT (Query,
"can not get number of students in a group"); "can not get number of students in a group");
} }
@ -2937,7 +2937,7 @@ static unsigned Grp_CountNumStdsInNoGrpsOfType (long GrpTypCod)
" FROM crs_grp,crs_grp_usr" " FROM crs_grp,crs_grp_usr"
" WHERE crs_grp.GrpTypCod=%ld" " WHERE crs_grp.GrpTypCod=%ld"
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod)", " AND crs_grp.GrpCod=crs_grp_usr.GrpCod)",
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Rol_STUDENT,GrpTypCod); Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Rol_STD,GrpTypCod);
DB_QuerySELECT (Query,&mysql_res,"can not get the number of students not belonging to groups of a type"); DB_QuerySELECT (Query,&mysql_res,"can not get the number of students not belonging to groups of a type");
/***** Get the number of students (row[0]) *****/ /***** Get the number of students (row[0]) *****/
@ -3042,7 +3042,7 @@ unsigned Grp_NumGrpTypesMandatIDontBelong (void)
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod" " AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
" AND crs_grp_usr.UsrCod=%ld)", " AND crs_grp_usr.UsrCod=%ld)",
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
(unsigned) Rol_STUDENT, (unsigned) Rol_STD,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
NumGrpTypes = DB_QueryCOUNT (Query,"can not get the number of types of group of mandatory registration to which you don't belong to"); NumGrpTypes = DB_QueryCOUNT (Query,"can not get the number of types of group of mandatory registration to which you don't belong to");
@ -3075,7 +3075,7 @@ static bool Grp_GetIfGrpIsAvailable (long GrpTypCod)
" AND crs_usr.Role=%u" " AND crs_usr.Role=%u"
" GROUP BY crs_grp.GrpCod" " GROUP BY crs_grp.GrpCod"
" HAVING NumStudents<MaxStudents) AS available_grp_types", " HAVING NumStudents<MaxStudents) AS available_grp_types",
GrpTypCod,(unsigned) Rol_STUDENT); GrpTypCod,(unsigned) Rol_STD);
NumGrpTypes = DB_QueryCOUNT (Query,"can not check if a type of group has available groups"); NumGrpTypes = DB_QueryCOUNT (Query,"can not check if a type of group has available groups");
return (NumGrpTypes != 0); return (NumGrpTypes != 0);

View File

@ -151,7 +151,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
{ {
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
!Gbl.CurrentCrs.Crs.NumStds && // Current course has no students !Gbl.CurrentCrs.Crs.NumStds && // Current course has no students
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER) // I am a teacher in current course Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_TCH) // I am a teacher in current course
{ {
/* Request students enrolment */ /* Request students enrolment */
sprintf (Gbl.Title,Txt_Register_students_in_the_course_X, sprintf (Gbl.Title,Txt_Register_students_in_the_course_X,

View File

@ -333,7 +333,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" AND usr_data.DptCod=%ld" " AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName", " ORDER BY degrees.FullName,courses.FullName",
Gbl.Stat.DegTypCod, Gbl.Stat.DegTypCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.Stat.DptCod); Gbl.Stat.DptCod);
else else
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
@ -344,7 +344,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" AND crs_usr.UsrCod=usr_data.UsrCod" " AND crs_usr.UsrCod=usr_data.UsrCod"
" AND usr_data.DptCod=%ld" " AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName", " ORDER BY degrees.FullName,courses.FullName",
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.Stat.DptCod); Gbl.Stat.DptCod);
} }
else else
@ -377,7 +377,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" AND usr_data.DptCod=%ld" " AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName", " ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentCty.Cty.CtyCod, Gbl.CurrentCty.Cty.CtyCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.Stat.DptCod); Gbl.Stat.DptCod);
else else
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
@ -402,7 +402,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" AND usr_data.DptCod=%ld" " AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName", " ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.InsCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.Stat.DptCod); Gbl.Stat.DptCod);
else else
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
@ -425,7 +425,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" AND usr_data.DptCod=%ld" " AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName", " ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.Stat.DptCod); Gbl.Stat.DptCod);
else else
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
@ -447,7 +447,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" AND usr_data.DptCod=%ld" " AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName", " ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentDeg.Deg.DegCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.Stat.DptCod); Gbl.Stat.DptCod);
else else
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
@ -471,7 +471,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" ORDER BY degrees.FullName,courses.FullName", " ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.Stat.DptCod); Gbl.Stat.DptCod);
else else
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
@ -1116,8 +1116,8 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat
break; break;
case Ind_INDICATORS_FULL: case Ind_INDICATORS_FULL:
/* Get number of users */ /* Get number of users */
NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,CrsCod); NumStds = Usr_GetNumUsrsInCrs (Rol_STD,CrsCod);
NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,CrsCod); NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,CrsCod);
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s LEFT_MIDDLE COLOR%u\">" "<td class=\"%s LEFT_MIDDLE COLOR%u\">"

View File

@ -340,7 +340,7 @@ void Inf_ShowInfo (void)
extern const char *Txt_No_information; extern const char *Txt_No_information;
Inf_InfoSrc_t InfoSrc; Inf_InfoSrc_t InfoSrc;
bool MustBeRead; bool MustBeRead;
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
bool ShowWarningNoInfo = false; bool ShowWarningNoInfo = false;
const char *Help[Inf_NUM_INFO_TYPES] = const char *Help[Inf_NUM_INFO_TYPES] =
@ -375,7 +375,7 @@ void Inf_ShowInfo (void)
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
/* Put checkbox to force students to read this couse info */ /* Put checkbox to force students to read this couse info */
if (MustBeRead) if (MustBeRead)
{ {
@ -384,7 +384,7 @@ void Inf_ShowInfo (void)
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
} }
break; break;
case Rol_TEACHER: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
/* Put checkbox to force students to read this couse info */ /* Put checkbox to force students to read this couse info */
if (InfoSrc != Inf_INFO_SRC_NONE) if (InfoSrc != Inf_INFO_SRC_NONE)
@ -1008,7 +1008,7 @@ static void Inf_ShowPage (const char *URL)
extern const char *The_ClassFormBold[The_NUM_THEMES]; extern const char *The_ClassFormBold[The_NUM_THEMES];
extern const char *Txt_View_in_a_new_window; extern const char *Txt_View_in_a_new_window;
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES]; extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
const char *Help[Inf_NUM_INFO_TYPES] = const char *Help[Inf_NUM_INFO_TYPES] =
{ {
@ -1757,7 +1757,7 @@ static bool Inf_CheckAndShowPlainTxt (void)
{ {
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES]; extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
char TxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1]; char TxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1];
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
const char *Help[Inf_NUM_INFO_TYPES] = const char *Help[Inf_NUM_INFO_TYPES] =
{ {
@ -1841,7 +1841,7 @@ static bool Inf_CheckAndShowRichTxt (void)
char MathJaxURL[PATH_MAX]; char MathJaxURL[PATH_MAX];
char Command[512 + PATH_MAX * 3]; // Command to call the program of preprocessing of photos char Command[512 + PATH_MAX * 3]; // Command to call the program of preprocessing of photos
int ReturnCode; int ReturnCode;
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
const char *Help[Inf_NUM_INFO_TYPES] = const char *Help[Inf_NUM_INFO_TYPES] =
{ {

View File

@ -583,8 +583,8 @@ static void Ins_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_TEACHER,Gbl.CurrentIns.Ins.InsCod)); Usr_GetNumUsrsInCrssOfIns (Rol_TCH,Gbl.CurrentIns.Ins.InsCod));
/***** Number of students in courses of this institution *****/ /***** Number of students in courses of this institution *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -596,8 +596,8 @@ static void Ins_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_STUDENT,Gbl.CurrentIns.Ins.InsCod)); Usr_GetNumUsrsInCrssOfIns (Rol_STD,Gbl.CurrentIns.Ins.InsCod));
/***** Number of users in courses of this institution *****/ /***** Number of users in courses of this institution *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -609,9 +609,9 @@ static void Ins_Configuration (bool PrintView)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_UNKNOWN,Gbl.CurrentIns.Ins.InsCod)); Usr_GetNumUsrsInCrssOfIns (Rol_UNK,Gbl.CurrentIns.Ins.InsCod));
} }
/***** End table *****/ /***** End table *****/
@ -715,7 +715,7 @@ static void Ins_ListInstitutions (void)
static bool Ins_CheckIfICanCreateInstitutions (void) static bool Ins_CheckIfICanCreateInstitutions (void)
{ {
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_); return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_GST);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1079,7 +1079,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
Ins->NumDpts = Dpt_GetNumberOfDepartmentsInInstitution (Ins->InsCod); Ins->NumDpts = Dpt_GetNumberOfDepartmentsInInstitution (Ins->InsCod);
/* Get number of users in courses */ /* Get number of users in courses */
Ins->NumUsrs = Usr_GetNumUsrsInCrssOfIns (Rol_UNKNOWN,Ins->InsCod); // Here Rol_UNKNOWN means "all users" Ins->NumUsrs = Usr_GetNumUsrsInCrssOfIns (Rol_UNK,Ins->InsCod); // Here Rol_UNK means "all users"
break; break;
} }
} }
@ -1181,7 +1181,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Instit *Ins,
Ins->NumDegs = Deg_GetNumDegsInIns (Ins->InsCod); Ins->NumDegs = Deg_GetNumDegsInIns (Ins->InsCod);
/* Get number of users in courses of this institution */ /* Get number of users in courses of this institution */
Ins->NumUsrs = Usr_GetNumUsrsInCrssOfIns (Rol_UNKNOWN,Ins->InsCod); // Here Rol_UNKNOWN means "all users" Ins->NumUsrs = Usr_GetNumUsrsInCrssOfIns (Rol_UNK,Ins->InsCod); // Here Rol_UNK means "all users"
} }
/* Set return value */ /* Set return value */
@ -2156,7 +2156,7 @@ static void Ins_PutFormToCreateInstitution (void)
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Act_FormStart (ActNewIns); Act_FormStart (ActNewIns);
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_) else if (Gbl.Usrs.Me.MaxRole >= Rol_GST)
Act_FormStart (ActReqIns); Act_FormStart (ActReqIns);
else else
Lay_ShowErrorAndExit ("You can not edit institutions."); Lay_ShowErrorAndExit ("You can not edit institutions.");

View File

@ -879,7 +879,7 @@ void Mai_ListEmails (void)
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order list of students in this course *****/ /***** Get and order list of students in this course *****/
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
/***** Start of the frame used to list the emails *****/ /***** Start of the frame used to list the emails *****/
Lay_StartRoundFrame (NULL, Lay_StartRoundFrame (NULL,
@ -889,9 +889,9 @@ void Mai_ListEmails (void)
/***** Form to select groups *****/ /***** Form to select groups *****/
Grp_ShowFormToSelectSeveralGroups (ActMaiStd); Grp_ShowFormToSelectSeveralGroups (ActMaiStd);
if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs) if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs)
{ {
if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs,NULL)) if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs,NULL))
{ {
/***** Initialize structure with user's data *****/ /***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat); Usr_UsrDataConstructor (&UsrDat);
@ -900,11 +900,11 @@ void Mai_ListEmails (void)
fprintf (Gbl.F.Out,"<div class=\"DAT_SMALL LEFT_MIDDLE\">"); fprintf (Gbl.F.Out,"<div class=\"DAT_SMALL LEFT_MIDDLE\">");
for (NumUsr = 0, NumStdsWithEmail = 0, NumAcceptedStdsWithEmail = 0, for (NumUsr = 0, NumStdsWithEmail = 0, NumAcceptedStdsWithEmail = 0,
StrAddresses[0] = '\0'; StrAddresses[0] = '\0';
NumUsr < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; NumUsr < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
NumUsr++) NumUsr++)
{ {
/* Copy user's basic data from list */ /* Copy user's basic data from list */
Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr]); Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr]);
/* Get user's email */ /* Get user's email */
Mai_GetEmailFromUsrCod (&UsrDat); Mai_GetEmailFromUsrCod (&UsrDat);
@ -945,8 +945,8 @@ void Mai_ListEmails (void)
fprintf (Gbl.F.Out,Txt_X_students_who_have_email, fprintf (Gbl.F.Out,Txt_X_students_who_have_email,
NumStdsWithEmail, NumStdsWithEmail,
((float) NumStdsWithEmail / ((float) NumStdsWithEmail /
(float) Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs) * 100.0, (float) Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs) * 100.0,
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs); Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs);
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
/***** Show a message with the number of students who have accepted and have email ****/ /***** Show a message with the number of students who have accepted and have email ****/
@ -954,8 +954,8 @@ void Mai_ListEmails (void)
fprintf (Gbl.F.Out,Txt_X_students_who_have_accepted_and_who_have_email, fprintf (Gbl.F.Out,Txt_X_students_who_have_accepted_and_who_have_email,
NumAcceptedStdsWithEmail, NumAcceptedStdsWithEmail,
((float) NumAcceptedStdsWithEmail / ((float) NumAcceptedStdsWithEmail /
(float) Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs) * 100.0, (float) Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs) * 100.0,
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs); Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs);
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
/***** Icon to open the client email program *****/ /***** Icon to open the client email program *****/
@ -976,13 +976,13 @@ void Mai_ListEmails (void)
} }
} }
else else
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
/***** End of the frame used to list the emails *****/ /***** End of the frame used to list the emails *****/
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
/***** Free memory for students list *****/ /***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
/***** Free memory for list of selected groups *****/ /***** Free memory for list of selected groups *****/
Grp_FreeListCodSelectedGrps (); Grp_FreeListCodSelectedGrps ();
@ -1135,8 +1135,8 @@ void Mai_PutLinkToChangeOtherUsrEmails (void)
Txt_Change_email,Txt_Change_email, Txt_Change_email,Txt_Change_email,
NULL); NULL);
else // Not me else // Not me
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActFrmMaiStd : Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActFrmMaiStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActFrmMaiTch : (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActFrmMaiTch :
ActFrmMaiOth), ActFrmMaiOth),
NULL,Usr_PutParamOtherUsrCodEncrypted, NULL,Usr_PutParamOtherUsrCodEncrypted,
"msg64x64.gif", "msg64x64.gif",
@ -1248,8 +1248,8 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActRemMaiMe); Act_FormStart (ActRemMaiMe);
else else
{ {
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActRemMaiStd : Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActRemMaiStd :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActRemMaiTch : (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActRemMaiTch :
ActRemMaiOth)); // Guest, visitor or admin ActRemMaiOth)); // Guest, visitor or admin
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
} }
@ -1284,8 +1284,8 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActNewMaiMe); Act_FormStart (ActNewMaiMe);
else else
{ {
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActNewMaiStd : Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActNewMaiStd :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActNewMaiTch : (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActNewMaiTch :
ActNewMaiOth)); // Guest, visitor or admin ActNewMaiOth)); // Guest, visitor or admin
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
} }
@ -1314,8 +1314,8 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActNewMaiMe); Act_FormStart (ActNewMaiMe);
else else
{ {
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActNewMaiStd : Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActNewMaiStd :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActNewMaiTch : (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActNewMaiTch :
ActNewMaiOth)); // Guest, visitor or admin ActNewMaiOth)); // Guest, visitor or admin
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
} }
@ -1835,16 +1835,16 @@ bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat)
/* Check if I have permission to see another user's email */ /* Check if I have permission to see another user's email */
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
/* If I am a student in the current course, /* If I am a student in the current course,
I can see the email of confirmed teachers */ I can see the email of confirmed teachers */
return (UsrDat->RoleInCurrentCrsDB == Rol_TEACHER && // A teacher return (UsrDat->RoleInCurrentCrsDB == Rol_TCH && // A teacher
UsrDat->Accepted); // who accepted registration UsrDat->Accepted); // who accepted registration
case Rol_TEACHER: case Rol_TCH:
/* If I am a teacher in the current course, /* If I am a teacher in the current course,
I can see the email of confirmed students and teachers */ I can see the email of confirmed students and teachers */
return (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT || // A student return (UsrDat->RoleInCurrentCrsDB == Rol_STD || // A student
UsrDat->RoleInCurrentCrsDB == Rol_TEACHER) && // or a teacher UsrDat->RoleInCurrentCrsDB == Rol_TCH) && // or a teacher
UsrDat->Accepted; // who accepted registration UsrDat->Accepted; // who accepted registration
case Rol_DEG_ADM: case Rol_DEG_ADM:
/* If I am an administrator of current degree, /* If I am an administrator of current degree,

View File

@ -622,7 +622,7 @@ void Mrk_ShowMyMarks (void)
Mrk_GetNumRowsHeaderAndFooter (&Marks); Mrk_GetNumRowsHeaderAndFooter (&Marks);
/***** Set the student whose marks will be shown *****/ /***** Set the student whose marks will be shown *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) // If I am logged as student... if (Gbl.Usrs.Me.LoggedRole == Rol_STD) // If I am logged as student...
UsrDat = &Gbl.Usrs.Me.UsrDat; // ...use my list of IDs UsrDat = &Gbl.Usrs.Me.UsrDat; // ...use my list of IDs
else // If I am logged as teacher, administrator, superuser... else // If I am logged as teacher, administrator, superuser...
{ {
@ -637,7 +637,7 @@ void Mrk_ShowMyMarks (void)
else else
{ {
UsrIsOK = false; UsrIsOK = false;
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
} }
} }
else // Course zone else // Course zone
@ -650,7 +650,7 @@ void Mrk_ShowMyMarks (void)
else else
{ {
UsrIsOK = false; UsrIsOK = false;
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
} }
} }
} }

View File

@ -181,8 +181,8 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
bool ShowUsrsInCrs = false; bool ShowUsrsInCrs = false;
bool GetUsrsInCrs; bool GetUsrsInCrs;
Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs = Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs =
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs = 0; Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs = 0;
/***** Get parameter that indicates if the message is a reply to another message *****/ /***** Get parameter that indicates if the message is a reply to another message *****/
if ((Gbl.Msg.Reply.IsReply = Par_GetParToBool ("IsReply"))) if ((Gbl.Msg.Reply.IsReply = Par_GetParToBool ("IsReply")))
@ -213,10 +213,10 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order lists of users from this course *****/ /***** Get and order lists of users from this course *****/
Usr_GetListUsrs (Rol_TEACHER,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_TCH,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumUsrsInCrs = Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs + NumUsrsInCrs = Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
} }
/***** Start frame *****/ /***** Start frame *****/
@ -287,8 +287,8 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
Lay_StartTableWide (0); Lay_StartTableWide (0);
if (ShowUsrsInCrs) if (ShowUsrsInCrs)
{ {
Usr_ListUsersToSelect (Rol_TEACHER); // All teachers in course Usr_ListUsersToSelect (Rol_TCH); // All teachers in course
Usr_ListUsersToSelect (Rol_STUDENT); // All students in selected groups Usr_ListUsersToSelect (Rol_STD); // All students in selected groups
} }
Msg_WriteFormUsrsIDsOrNicksOtherRecipients (); // Other users (nicknames) Msg_WriteFormUsrsIDsOrNicksOtherRecipients (); // Other users (nicknames)
Lay_EndTable (); Lay_EndTable ();
@ -324,8 +324,8 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
/***** Free memory used for by the lists of users *****/ /***** Free memory used for by the lists of users *****/
if (GetUsrsInCrs) if (GetUsrsInCrs)
{ {
Usr_FreeUsrsList (Rol_TEACHER); Usr_FreeUsrsList (Rol_TCH);
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
} }
/***** Free memory used by list of selected users' codes *****/ /***** Free memory used by list of selected users' codes *****/
@ -678,7 +678,7 @@ void Msg_RecMsgFromUsr (void)
/***** Check number of recipients *****/ /***** Check number of recipients *****/
if ((NumRecipients = Usr_CountNumUsrsInListOfSelectedUsrs ())) if ((NumRecipients = Usr_CountNumUsrsInListOfSelectedUsrs ()))
{ {
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && if (Gbl.Usrs.Me.LoggedRole == Rol_STD &&
NumRecipients > Cfg_MAX_RECIPIENTS) NumRecipients > Cfg_MAX_RECIPIENTS)
{ {
/* Write warning message */ /* Write warning message */
@ -2028,7 +2028,7 @@ unsigned Msg_GetNumMsgsSentByTchsCrs (long CrsCod)
sprintf (Query,"SELECT COUNT(*) FROM msg_snt,crs_usr" sprintf (Query,"SELECT COUNT(*) FROM msg_snt,crs_usr"
" WHERE msg_snt.CrsCod=%ld AND crs_usr.CrsCod=%ld AND crs_usr.Role=%u" " WHERE msg_snt.CrsCod=%ld AND crs_usr.CrsCod=%ld AND crs_usr.Role=%u"
" AND msg_snt.UsrCod=crs_usr.UsrCod", " AND msg_snt.UsrCod=crs_usr.UsrCod",
CrsCod,CrsCod,(unsigned) Rol_TEACHER); CrsCod,CrsCod,(unsigned) Rol_TCH);
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of messages sent by teachers"); return (unsigned) DB_QueryCOUNT (Query,"can not get the number of messages sent by teachers");
} }
@ -2932,7 +2932,7 @@ static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod)
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"LEFT_MIDDLE\">"); "<td class=\"LEFT_MIDDLE\">");
if (Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED && if (Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED &&
Gbl.Usrs.Me.LoggedRole >= Rol_VISITOR) Gbl.Usrs.Me.LoggedRole >= Rol_USR)
// Guests (users without courses) can read messages but not reply them // Guests (users without courses) can read messages but not reply them
Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat); Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -3316,7 +3316,7 @@ static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted)
} }
else else
fprintf (Gbl.F.Out,"[%s]", fprintf (Gbl.F.Out,"[%s]",
Txt_ROLES_SINGUL_abc[Rol_UNKNOWN][Usr_SEX_UNKNOWN]); // User not found, likely an old user who has been removed Txt_ROLES_SINGUL_abc[Rol_UNK][Usr_SEX_UNKNOWN]); // User not found, likely an old user who has been removed
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>" "</tr>"
"</table>"); "</table>");

View File

@ -450,7 +450,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
unsigned NumUsrs; unsigned NumUsrs;
/***** Get total number of users in platform *****/ /***** Get total number of users in platform *****/
NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNKNOWN); NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNK);
/***** Get number of users with a web / social network *****/ /***** Get number of users with a web / social network *****/
switch (Gbl.Scope.Current) switch (Gbl.Scope.Current)

View File

@ -481,7 +481,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
static bool Not_CheckIfICanEditNotices (void) static bool Not_CheckIfICanEditNotices (void)
{ {
return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
} }

View File

@ -1209,7 +1209,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
" AND Role=%u", // Notify teachers only " AND Role=%u", // Notify teachers only
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER); (unsigned) Rol_TCH);
break; break;
case Brw_ADMI_DOCUM_GRP: case Brw_ADMI_DOCUM_GRP:
case Brw_ADMI_SHARE_GRP: case Brw_ADMI_SHARE_GRP:
@ -1230,7 +1230,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
" AND crs_usr.Role=%u", // Notify teachers only " AND crs_usr.Role=%u", // Notify teachers only
Gbl.CurrentCrs.Grps.GrpCod, Gbl.CurrentCrs.Grps.GrpCod,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER); (unsigned) Rol_TCH);
break; break;
default: // This function should not be called in other cases default: // This function should not be called in other cases
return 0; return 0;
@ -1275,7 +1275,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
" AND Role=%u", // Notify teachers only " AND Role=%u", // Notify teachers only
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER); (unsigned) Rol_TCH);
else // Course without teachers else // Course without teachers
// If this course has no teachers // If this course has no teachers
// and I want to be a teacher (checked before calling this function // and I want to be a teacher (checked before calling this function
@ -1322,7 +1322,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
sprintf (Query,"SELECT UsrCod FROM crs_usr" sprintf (Query,"SELECT UsrCod FROM crs_usr"
" WHERE CrsCod=%ld AND Role=%u AND UsrCod<>%ld", " WHERE CrsCod=%ld AND Role=%u AND UsrCod<>%ld",
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
(unsigned) Rol_TEACHER, (unsigned) Rol_TCH,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
break; break;
default: default:

View File

@ -828,8 +828,8 @@ void Pwd_ShowFormOthPwd (void)
/***** Form to change password *****/ /***** Form to change password *****/
/* Start form */ /* Start form */
Act_FormStart ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActChgPwdStd : Act_FormStart ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActChgPwdStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActChgPwdTch : (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActChgPwdTch :
ActChgPwdOth)); ActChgPwdOth));
Usr_PutParamOtherUsrCodEncrypted (); Usr_PutParamOtherUsrCodEncrypted ();
@ -879,8 +879,8 @@ void Pwd_PutLinkToChangeOtherUsrPassword (void)
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
Pwd_PutLinkToChangeMyPassword (); Pwd_PutLinkToChangeMyPassword ();
else // Not me else // Not me
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActFrmPwdStd : Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActFrmPwdStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActFrmPwdTch : (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActFrmPwdTch :
ActFrmPwdOth), ActFrmPwdOth),
NULL,Usr_PutParamOtherUsrCodEncrypted, NULL,Usr_PutParamOtherUsrCodEncrypted,
"key64x64.gif", "key64x64.gif",

View File

@ -139,9 +139,9 @@ bool Pho_ICanChangeOtherUsrPhoto (const struct UsrData *UsrDat)
/* Check if I have permission to change user's photo */ /* Check if I have permission to change user's photo */
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
/* Check 1: I can change the photo of confirmed students */ /* Check 1: I can change the photo of confirmed students */
if (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT && // A student if (UsrDat->RoleInCurrentCrsDB == Rol_STD && // A student
UsrDat->Accepted) // who accepted registration UsrDat->Accepted) // who accepted registration
return true; return true;
@ -195,8 +195,8 @@ void Pho_PutLinkToChangeOtherUsrPhoto (void)
PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL); PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
TitleText = PhotoExists ? Txt_Change_photo : TitleText = PhotoExists ? Txt_Change_photo :
Txt_Upload_photo; Txt_Upload_photo;
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActReqStdPho : Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActReqStdPho :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActReqTchPho : (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActReqTchPho :
ActReqOthPho), // Guest, visitor or admin ActReqOthPho), // Guest, visitor or admin
NULL,Usr_PutParamOtherUsrCodEncrypted, NULL,Usr_PutParamOtherUsrCodEncrypted,
"photo64x64.gif", "photo64x64.gif",
@ -234,8 +234,8 @@ static void Pho_PutIconToRequestRemoveOtherUsrPhoto (void)
/***** Link to request the removal of another user's photo *****/ /***** Link to request the removal of another user's photo *****/
PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL); PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
if (PhotoExists) if (PhotoExists)
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActReqRemStdPho : Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActReqRemStdPho :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActReqRemTchPho : (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActReqRemTchPho :
ActReqRemOthPho), // Guest, visitor or admin ActReqRemOthPho), // Guest, visitor or admin
NULL,Usr_PutParamOtherUsrCodEncrypted, NULL,Usr_PutParamOtherUsrCodEncrypted,
"remove-on64x64.png", "remove-on64x64.png",
@ -307,8 +307,8 @@ static void Pho_ReqPhoto (const struct UsrData *UsrDat,const char *PhotoURL)
Act_FormStart (ActDetMyPho); Act_FormStart (ActDetMyPho);
else else
{ {
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActDetStdPho : Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActDetStdPho :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActDetTchPho : (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActDetTchPho :
ActDetOthPho)); // Guest, visitor or admin ActDetOthPho)); // Guest, visitor or admin
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
} }
@ -482,8 +482,8 @@ void Pho_ReqRemoveUsrPhoto (void)
"PHOTO186x248",Pho_NO_ZOOM,false); "PHOTO186x248",Pho_NO_ZOOM,false);
/* End alert */ /* End alert */
Ale_ShowAlertAndButton2 ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActRemStdPho : Ale_ShowAlertAndButton2 ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActRemStdPho :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActRemTchPho : (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActRemTchPho :
ActRemOthPho), // Guest, visitor or admin ActRemOthPho), // Guest, visitor or admin
NULL,Usr_PutParamOtherUsrCodEncrypted, NULL,Usr_PutParamOtherUsrCodEncrypted,
Lay_REMOVE_BUTTON,Txt_Remove_photo); Lay_REMOVE_BUTTON,Txt_Remove_photo);
@ -649,8 +649,8 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
{ {
NumFacesGreen++; NumFacesGreen++;
Act_FormStart (ItsMe ? ActUpdMyPho : Act_FormStart (ItsMe ? ActUpdMyPho :
(UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActUpdStdPho : (UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActUpdStdPho :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActUpdTchPho : (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActUpdTchPho :
ActUpdOthPho))); // Guest, visitor or admin ActUpdOthPho))); // Guest, visitor or admin
if (!ItsMe) if (!ItsMe)
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
@ -1286,7 +1286,7 @@ void Pho_CalcPhotoDegree (void)
TypeOfAverage++) TypeOfAverage++)
{ {
/***** Compute average photos of students belonging this degree *****/ /***** Compute average photos of students belonging this degree *****/
Pho_ComputeAveragePhoto (DegCod,Sex,Rol_STUDENT, Pho_ComputeAveragePhoto (DegCod,Sex,Rol_STD,
TypeOfAverage,DirAvgPhotosRelPath[TypeOfAverage], TypeOfAverage,DirAvgPhotosRelPath[TypeOfAverage],
&NumStds,&NumStdsWithPhoto,&PartialTimeToComputeAvgPhotoInMicroseconds); &NumStds,&NumStdsWithPhoto,&PartialTimeToComputeAvgPhotoInMicroseconds);
TotalTimeToComputeAvgPhotoInMicroseconds += PartialTimeToComputeAvgPhotoInMicroseconds; TotalTimeToComputeAvgPhotoInMicroseconds += PartialTimeToComputeAvgPhotoInMicroseconds;
@ -1297,7 +1297,7 @@ void Pho_CalcPhotoDegree (void)
} }
/***** Free memory for students list *****/ /***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
/***** Show photos *****/ /***** Show photos *****/
Pho_ShowOrPrintPhotoDegree (Pho_DEGREES_SEE); Pho_ShowOrPrintPhotoDegree (Pho_DEGREES_SEE);
@ -1330,7 +1330,7 @@ static long Pho_GetDegWithAvgPhotoLeastRecentlyUpdated (void)
" AND degrees.DegCod NOT IN" " AND degrees.DegCod NOT IN"
" (SELECT DISTINCT DegCod FROM sta_degrees)" " (SELECT DISTINCT DegCod FROM sta_degrees)"
" LIMIT 1", " LIMIT 1",
(unsigned) Rol_STUDENT); (unsigned) Rol_STD);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees"); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees");
/* If number of rows is 1, then get the degree code */ /* If number of rows is 1, then get the degree code */
@ -1359,7 +1359,7 @@ static long Pho_GetDegWithAvgPhotoLeastRecentlyUpdated (void)
" AND crs_usr.Role=%u" " AND crs_usr.Role=%u"
" ORDER BY sta_degrees.TimeAvgPhoto LIMIT 1", " ORDER BY sta_degrees.TimeAvgPhoto LIMIT 1",
Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO, Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO,
(unsigned) Rol_STUDENT); (unsigned) Rol_STD);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees"); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees");
/* If number of rows is 1, then get the degree code */ /* If number of rows is 1, then get the degree code */
@ -2067,7 +2067,7 @@ static void Pho_ShowOrPrintClassPhotoDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrin
} }
else // No degrees with students found else // No degrees with students found
/***** Show warning indicating no students found *****/ /***** Show warning indicating no students found *****/
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
@ -2181,7 +2181,7 @@ static void Pho_ShowOrPrintListDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrint)
} }
else // No degrees with students found! else // No degrees with students found!
/***** Show warning indicating no students found *****/ /***** Show warning indicating no students found *****/
Usr_ShowWarningNoUsersFound (Rol_STUDENT); Usr_ShowWarningNoUsersFound (Rol_STD);
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);

View File

@ -386,36 +386,36 @@ void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
"<ul class=\"PRF_FIG_UL DAT_NOBR_N\">"); "<ul class=\"PRF_FIG_UL DAT_NOBR_N\">");
/***** Number of courses in which the user is teacher *****/ /***** Number of courses in which the user is teacher *****/
NumCrssUsrIsTeacher = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_TEACHER); NumCrssUsrIsTeacher = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_TCH);
fprintf (Gbl.F.Out,"<li title=\"%s\" class=\"PRF_FIG_LI\"" fprintf (Gbl.F.Out,"<li title=\"%s\" class=\"PRF_FIG_LI\""
" style=\"background-image:url('%s/tch64x64.gif');\">" " style=\"background-image:url('%s/tch64x64.gif');\">"
"%u&nbsp;%s", "%u&nbsp;%s",
Txt_ROLES_SINGUL_Abc[Rol_TEACHER][UsrDat->Sex], Txt_ROLES_SINGUL_Abc[Rol_TCH][UsrDat->Sex],
Gbl.Prefs.IconsURL, Gbl.Prefs.IconsURL,
NumCrssUsrIsTeacher, NumCrssUsrIsTeacher,
Txt_courses_ABBREVIATION); Txt_courses_ABBREVIATION);
if (NumCrssUsrIsTeacher) if (NumCrssUsrIsTeacher)
fprintf (Gbl.F.Out,"&nbsp;(%u&nbsp;%s/%u&nbsp;%s)", fprintf (Gbl.F.Out,"&nbsp;(%u&nbsp;%s/%u&nbsp;%s)",
Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TEACHER,Rol_TEACHER), Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TCH,Rol_TCH),
Txt_teachers_ABBREVIATION, Txt_teachers_ABBREVIATION,
Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TEACHER,Rol_STUDENT), Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TCH,Rol_STD),
Txt_students_ABBREVIATION); Txt_students_ABBREVIATION);
fprintf (Gbl.F.Out,"</li>"); fprintf (Gbl.F.Out,"</li>");
/***** Number of courses in which the user is student *****/ /***** Number of courses in which the user is student *****/
NumCrssUsrIsStudent = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_STUDENT); NumCrssUsrIsStudent = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_STD);
fprintf (Gbl.F.Out,"<li title=\"%s\" class=\"PRF_FIG_LI\"" fprintf (Gbl.F.Out,"<li title=\"%s\" class=\"PRF_FIG_LI\""
" style=\"background-image:url('%s/std64x64.gif');\">" " style=\"background-image:url('%s/std64x64.gif');\">"
"%u&nbsp;%s", "%u&nbsp;%s",
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][UsrDat->Sex], Txt_ROLES_SINGUL_Abc[Rol_STD][UsrDat->Sex],
Gbl.Prefs.IconsURL, Gbl.Prefs.IconsURL,
NumCrssUsrIsStudent, NumCrssUsrIsStudent,
Txt_courses_ABBREVIATION); Txt_courses_ABBREVIATION);
if (NumCrssUsrIsStudent) if (NumCrssUsrIsStudent)
fprintf (Gbl.F.Out,"&nbsp;(%u&nbsp;%s/%u&nbsp;%s)", fprintf (Gbl.F.Out,"&nbsp;(%u&nbsp;%s/%u&nbsp;%s)",
Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STUDENT,Rol_TEACHER), Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STD,Rol_TCH),
Txt_teachers_ABBREVIATION, Txt_teachers_ABBREVIATION,
Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STUDENT,Rol_STUDENT), Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STD,Rol_STD),
Txt_students_ABBREVIATION); Txt_students_ABBREVIATION);
fprintf (Gbl.F.Out,"</li>"); fprintf (Gbl.F.Out,"</li>");

View File

@ -1110,7 +1110,7 @@ static void Rec_ShowRecordOneStdCrs (void)
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
/* Link to edit record fields */ /* Link to edit record fields */
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) if (Gbl.Usrs.Me.LoggedRole == Rol_TCH)
Rec_PutLinkToEditRecordFields (); Rec_PutLinkToEditRecordFields ();
/* Link to print view */ /* Link to print view */
@ -1135,14 +1135,14 @@ static void Rec_ShowRecordOneStdCrs (void)
/***** Record of the student in the course *****/ /***** Record of the student in the course *****/
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
{ {
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || if (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
{ {
fprintf (Gbl.F.Out,"<section class=\"REC_CRS\">"); fprintf (Gbl.F.Out,"<section class=\"REC_CRS\">");
Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL); Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL);
fprintf (Gbl.F.Out,"</section>"); fprintf (Gbl.F.Out,"</section>");
} }
else if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && else if (Gbl.Usrs.Me.LoggedRole == Rol_STD &&
Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me
{ {
fprintf (Gbl.F.Out,"<section class=\"REC_CRS\">"); fprintf (Gbl.F.Out,"<section class=\"REC_CRS\">");
@ -1211,7 +1211,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
/* Link to edit record fields */ /* Link to edit record fields */
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) if (Gbl.Usrs.Me.LoggedRole == Rol_TCH)
Rec_PutLinkToEditRecordFields (); Rec_PutLinkToEditRecordFields ();
/* Link to print view */ /* Link to print view */
@ -1264,9 +1264,9 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
/* Record of the student in the course */ /* Record of the student in the course */
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
if ( Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || if ( Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
(Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && // I am student in this course... (Gbl.Usrs.Me.LoggedRole == Rol_STD && // I am student in this course...
UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)) // ...and it's me UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)) // ...and it's me
{ {
fprintf (Gbl.F.Out,"<section class=\"REC_CRS\">"); fprintf (Gbl.F.Out,"<section class=\"REC_CRS\">");
@ -1714,7 +1714,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
bool ICanEditThisField; bool ICanEditThisField;
char Text[Cns_MAX_BYTES_TEXT + 1]; char Text[Cns_MAX_BYTES_TEXT + 1];
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) // I am a student if (Gbl.Usrs.Me.LoggedRole == Rol_STD) // I am a student
{ {
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me
if (ItsMe) // It's me if (ItsMe) // It's me
@ -1911,7 +1911,7 @@ void Rec_GetFieldsCrsRecordFromForm (void)
for (NumField = 0; for (NumField = 0;
NumField < Gbl.CurrentCrs.Records.LstFields.Num; NumField < Gbl.CurrentCrs.Records.LstFields.Num;
NumField++) NumField++)
if (Gbl.Usrs.Me.LoggedRole > Rol_STUDENT || if (Gbl.Usrs.Me.LoggedRole > Rol_STD ||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD) Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
{ {
/* Get text of the form */ /* Get text of the form */
@ -1934,7 +1934,7 @@ void Rec_UpdateCrsRecord (long UsrCod)
for (NumField = 0; for (NumField = 0;
NumField < Gbl.CurrentCrs.Records.LstFields.Num; NumField < Gbl.CurrentCrs.Records.LstFields.Num;
NumField++) NumField++)
if (Gbl.Usrs.Me.LoggedRole > Rol_STUDENT || if (Gbl.Usrs.Me.LoggedRole > Rol_STD ||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD) Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
{ {
/***** Check if already exists this field for this user in database *****/ /***** Check if already exists this field for this user in database *****/
@ -2047,7 +2047,7 @@ void Rec_AllocMemFieldsRecordsCrs (void)
for (NumField = 0; for (NumField = 0;
NumField < Gbl.CurrentCrs.Records.LstFields.Num; NumField < Gbl.CurrentCrs.Records.LstFields.Num;
NumField++) NumField++)
if (Gbl.Usrs.Me.LoggedRole > Rol_STUDENT || if (Gbl.Usrs.Me.LoggedRole > Rol_STD ||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD) Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
/* Allocate memory for the texts of the fields */ /* Allocate memory for the texts of the fields */
if ((Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text = malloc (Cns_MAX_BYTES_TEXT + 1)) == NULL) if ((Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text = malloc (Cns_MAX_BYTES_TEXT + 1)) == NULL)
@ -2065,7 +2065,7 @@ void Rec_FreeMemFieldsRecordsCrs (void)
for (NumField = 0; for (NumField = 0;
NumField < Gbl.CurrentCrs.Records.LstFields.Num; NumField < Gbl.CurrentCrs.Records.LstFields.Num;
NumField++) NumField++)
if (Gbl.Usrs.Me.LoggedRole > Rol_STUDENT || if (Gbl.Usrs.Me.LoggedRole > Rol_STD ||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD) Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
/* Free memory of the text of the field */ /* Free memory of the text of the field */
if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text) if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text)
@ -2133,7 +2133,7 @@ void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat,Rol_Role_t Default
is not the current role in current course. is not the current role in current course.
Instead it is initialized with the preferred role. */ Instead it is initialized with the preferred role. */
UsrDat->RoleInCurrentCrsDB = (Gbl.CurrentCrs.Crs.CrsCod > 0) ? DefaultRole : // Course selected UsrDat->RoleInCurrentCrsDB = (Gbl.CurrentCrs.Crs.CrsCod > 0) ? DefaultRole : // Course selected
Rol__GUEST_; // No course selected Rol_GST; // No course selected
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat,NULL); Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat,NULL);
} }
@ -2206,11 +2206,11 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
}; };
const char *Rec_RecordListHelp[Rol_NUM_ROLES] = const char *Rec_RecordListHelp[Rol_NUM_ROLES] =
{ {
NULL, // Rol_UNKNOWN NULL, // Rol_UNK
Hlp_USERS_Guests, // Rol__GUEST_ Hlp_USERS_Guests, // Rol_GST
NULL, // Rol_VISITOR NULL, // Rol_USR
Hlp_USERS_Students_shared_record_card, // Rol_STUDENT Hlp_USERS_Students_shared_record_card, // Rol_STD
Hlp_USERS_Teachers_shared_record_card, // Rol_TEACHER Hlp_USERS_Teachers_shared_record_card, // Rol_TCH
NULL, // Rol_DEG_ADM NULL, // Rol_DEG_ADM
NULL, // Rol_CTR_ADM NULL, // Rol_CTR_ADM
NULL, // Rol_INS_ADM NULL, // Rol_INS_ADM
@ -2232,7 +2232,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
/***** Initializations *****/ /***** Initializations *****/
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
IAmLoggedAsTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER); // My current role is teacher IAmLoggedAsTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_TCH); // My current role is teacher
IAmLoggedAsSysAdm = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // My current role is superuser IAmLoggedAsSysAdm = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // My current role is superuser
CountryForm = (TypeOfView == Rec_SHA_MY_RECORD_FORM); CountryForm = (TypeOfView == Rec_SHA_MY_RECORD_FORM);
ShowData = (ItsMe || ShowData = (ItsMe ||
@ -2244,14 +2244,14 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
((TypeOfView == Rec_SHA_RECORD_LIST || ((TypeOfView == Rec_SHA_RECORD_LIST ||
TypeOfView == Rec_SHA_RECORD_PRINT) && TypeOfView == Rec_SHA_RECORD_PRINT) &&
(IAmLoggedAsTeacher || IAmLoggedAsSysAdm) && (IAmLoggedAsTeacher || IAmLoggedAsSysAdm) &&
UsrDat->RoleInCurrentCrsDB == Rol_STUDENT)); UsrDat->RoleInCurrentCrsDB == Rol_STD));
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get user's roles if not got Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get user's roles if not got
ShowTeacherRows = (((TypeOfView == Rec_SHA_MY_RECORD_FORM || ShowTeacherRows = (((TypeOfView == Rec_SHA_MY_RECORD_FORM ||
TypeOfView == Rec_SHA_MY_RECORD_CHECK) && TypeOfView == Rec_SHA_MY_RECORD_CHECK) &&
(UsrDat->Roles & (1 << Rol_TEACHER))) || // He/she (me, really) is a teacher in any course (UsrDat->Roles & (1 << Rol_TCH))) || // He/she (me, really) is a teacher in any course
((TypeOfView == Rec_SHA_RECORD_LIST || ((TypeOfView == Rec_SHA_RECORD_LIST ||
TypeOfView == Rec_SHA_RECORD_PRINT) && TypeOfView == Rec_SHA_RECORD_PRINT) &&
UsrDat->RoleInCurrentCrsDB == Rol_TEACHER)); // He/she is a teacher in the current course UsrDat->RoleInCurrentCrsDB == Rol_TCH)); // He/she is a teacher in the current course
/* Data form = I can edit fields like surnames and name */ /* Data form = I can edit fields like surnames and name */
switch (TypeOfView) switch (TypeOfView)
@ -2361,8 +2361,8 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
ID_PutParamOtherUsrIDPlain (); // New user ID_PutParamOtherUsrIDPlain (); // New user
break; break;
case Rec_SHA_OTHER_EXISTING_USR_FORM: case Rec_SHA_OTHER_EXISTING_USR_FORM:
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActUpdStd : Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActUpdStd :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActUpdTch : (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActUpdTch :
ActUpdOth)); ActUpdOth));
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); // Existing user Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); // Existing user
break; break;
@ -2452,7 +2452,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
{ {
// Don't show groups if I don't belong to course // Don't show groups if I don't belong to course
if (Gbl.Usrs.Me.IBelongToCurrentCrs) if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)); Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STD));
} }
else else
Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod); Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod);
@ -2498,8 +2498,8 @@ static void Rec_PutIconsCommands (void)
extern const char *Txt_Following_unfollow; extern const char *Txt_Following_unfollow;
extern const char *Txt_Follow; extern const char *Txt_Follow;
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Record.UsrDat->UsrCod); bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Record.UsrDat->UsrCod);
bool IAmLoggedAsStudent = (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT); // My current role is student bool IAmLoggedAsStudent = (Gbl.Usrs.Me.LoggedRole == Rol_STD); // My current role is student
bool IAmLoggedAsTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER); // My current role is teacher bool IAmLoggedAsTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_TCH); // My current role is teacher
bool IAmLoggedAsSysAdm = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // My current role is superuser bool IAmLoggedAsSysAdm = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // My current role is superuser
bool ICanViewUsrProfile; bool ICanViewUsrProfile;
@ -2557,13 +2557,13 @@ static void Rec_PutIconsCommands (void)
/***** Button to admin user *****/ /***** Button to admin user *****/
if (ItsMe || if (ItsMe ||
(Gbl.CurrentCrs.Crs.CrsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) || (Gbl.CurrentCrs.Crs.CrsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_TCH) ||
(Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM) || (Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM) ||
(Gbl.CurrentCtr.Ctr.CtrCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_CTR_ADM) || (Gbl.CurrentCtr.Ctr.CtrCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_CTR_ADM) ||
(Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_INS_ADM) || (Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_INS_ADM) ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Lay_PutContextualLink ( Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActReqMdfStd : Lay_PutContextualLink ( Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActReqMdfStd :
(Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActReqMdfTch : (Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActReqMdfTch :
ActReqMdfOth), ActReqMdfOth),
NULL,Rec_PutParamUsrCodEncrypted, NULL,Rec_PutParamUsrCodEncrypted,
"config64x64.gif", "config64x64.gif",
@ -2571,7 +2571,7 @@ static void Rec_PutIconsCommands (void)
NULL); NULL);
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected
Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STUDENT && // He/she is a student in the current course Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STD && // He/she is a student in the current course
(ItsMe || IAmLoggedAsTeacher || IAmLoggedAsSysAdm)) // I can view (ItsMe || IAmLoggedAsTeacher || IAmLoggedAsSysAdm)) // I can view
{ {
/***** Button to view user's assignments and works *****/ /***** Button to view user's assignments and works *****/
@ -2616,7 +2616,7 @@ static void Rec_PutIconsCommands (void)
/***** Button to print QR code *****/ /***** Button to print QR code *****/
if (ItsMe || IAmLoggedAsSysAdm || if (ItsMe || IAmLoggedAsSysAdm ||
(Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected (Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected
Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STUDENT && // He/she is a student in the current course Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STD && // He/she is a student in the current course
IAmLoggedAsTeacher)) // I am a teacher in the current course IAmLoggedAsTeacher)) // I am a teacher in the current course
Lay_PutContextualLink (ActPrnUsrQR,NULL,Rec_PutParamUsrCodEncrypted, Lay_PutContextualLink (ActPrnUsrQR,NULL,Rec_PutParamUsrCodEncrypted,
"qr64x64.gif", "qr64x64.gif",
@ -2911,13 +2911,13 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
switch (TypeOfView) switch (TypeOfView)
{ {
case Rec_SHA_SIGN_UP_FORM: // I want to apply for enrolment case Rec_SHA_SIGN_UP_FORM: // I want to apply for enrolment
DefaultRoleInCurrentCrs = ((UsrDat->Roles & (1 << Rol_TEACHER)) || // I am teacher in other courses DefaultRoleInCurrentCrs = ((UsrDat->Roles & (1 << Rol_TCH)) || // I am teacher in other courses
UsrDat->UsrCod == Gbl.CurrentCrs.Crs.RequesterUsrCod) ? // I am the creator of the course UsrDat->UsrCod == Gbl.CurrentCrs.Crs.RequesterUsrCod) ? // I am the creator of the course
Rol_TEACHER : Rol_TCH :
Rol_STUDENT; Rol_STD;
fprintf (Gbl.F.Out,"<select id=\"Role\" name=\"Role\">"); fprintf (Gbl.F.Out,"<select id=\"Role\" name=\"Role\">");
for (Role = Rol_STUDENT; for (Role = Rol_STD;
Role <= Rol_TEACHER; Role <= Rol_TCH;
Role++) Role++)
{ {
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role); fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
@ -2932,21 +2932,21 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
fprintf (Gbl.F.Out,"<select id=\"Role\" name=\"Role\">"); fprintf (Gbl.F.Out,"<select id=\"Role\" name=\"Role\">");
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{ {
if (UsrDat->RoleInCurrentCrsDB < Rol_STUDENT) // The other user does not belong to current course if (UsrDat->RoleInCurrentCrsDB < Rol_STD) // The other user does not belong to current course
{ {
/* If there is a request of this user, default role is the requested role */ /* If there is a request of this user, default role is the requested role */
if ((DefaultRoleInCurrentCrs = Rol_GetRequestedRole (UsrDat->UsrCod)) == Rol_UNKNOWN) if ((DefaultRoleInCurrentCrs = Rol_GetRequestedRole (UsrDat->UsrCod)) == Rol_UNK)
DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TEACHER)) ? Rol_TEACHER : DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TCH)) ? Rol_TCH :
Rol_STUDENT; Rol_STD;
} }
else else
DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB; DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB;
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol__GUEST_: case Rol_GST:
case Rol_VISITOR: case Rol_USR:
case Rol_STUDENT: case Rol_STD:
fprintf (Gbl.F.Out,"<option value=\"%u\"" fprintf (Gbl.F.Out,"<option value=\"%u\""
" selected=\"selected\"" " selected=\"selected\""
" disabled=\"disabled\">" " disabled=\"disabled\">"
@ -2954,13 +2954,13 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
(unsigned) Gbl.Usrs.Me.LoggedRole, (unsigned) Gbl.Usrs.Me.LoggedRole,
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][UsrDat->Sex]); Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][UsrDat->Sex]);
break; break;
case Rol_TEACHER: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
case Rol_INS_ADM: case Rol_INS_ADM:
case Rol_SYS_ADM: case Rol_SYS_ADM:
for (Role = Rol_STUDENT; for (Role = Rol_STD;
Role <= Rol_TEACHER; Role <= Rol_TCH;
Role++) Role++)
{ {
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role); fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
@ -2977,9 +2977,9 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
} }
else // No course selected else // No course selected
{ {
DefaultRoleInCurrentCrs = (UsrDat->Roles & ((1 << Rol_STUDENT) | DefaultRoleInCurrentCrs = (UsrDat->Roles & ((1 << Rol_STD) |
(1 << Rol_TEACHER))) ? Rol_VISITOR : (1 << Rol_TCH))) ? Rol_USR :
Rol__GUEST_; Rol_GST;
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\"" fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\""
" disabled=\"disabled\">%s</option>", " disabled=\"disabled\">%s</option>",
(unsigned) DefaultRoleInCurrentCrs, (unsigned) DefaultRoleInCurrentCrs,
@ -2992,7 +2992,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
case Rol_INS_ADM: case Rol_INS_ADM:
@ -3001,8 +3001,8 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
is not the current role in current course. is not the current role in current course.
Instead it is initialized with the preferred role. */ Instead it is initialized with the preferred role. */
DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB; DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB;
for (Role = Rol_STUDENT; for (Role = Rol_STD;
Role <= Rol_TEACHER; Role <= Rol_TCH;
Role++) Role++)
{ {
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role); fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
@ -3021,7 +3021,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
case Rol_SYS_ADM: case Rol_SYS_ADM:
fprintf (Gbl.F.Out,"<option value=\"%u\"" fprintf (Gbl.F.Out,"<option value=\"%u\""
" selected=\"selected\">%s</option>", " selected=\"selected\">%s</option>",
(unsigned) Rol__GUEST_,Txt_ROLES_SINGUL_Abc[Rol__GUEST_][Usr_SEX_UNKNOWN]); (unsigned) Rol_GST,Txt_ROLES_SINGUL_Abc[Rol_GST][Usr_SEX_UNKNOWN]);
break; break;
default: // The rest of users can not register other users default: // The rest of users can not register other users
break; break;
@ -3676,43 +3676,43 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
Par_GetParToUnsignedLong ("Role", Par_GetParToUnsignedLong ("Role",
0, 0,
Rol_NUM_ROLES - 1, Rol_NUM_ROLES - 1,
(unsigned long) Rol_UNKNOWN); (unsigned long) Rol_UNK);
/***** Check if I can register a user /***** Check if I can register a user
with the received role in current course *****/ with the received role in current course *****/
/* Check for other possible errors */ /* Check for other possible errors */
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: // I am logged as student case Rol_STD: // I am logged as student
/* A student can only change his/her data, but not his/her role */ /* A student can only change his/her data, but not his/her role */
if (Role == Rol_STUDENT) if (Role == Rol_STD)
RoleOK = true; RoleOK = true;
break; break;
/* /*
case Rol_TEACHER: // I am logged as teacher case Rol_TCH: // I am logged as teacher
// A teacher can only register another user as teacher // A teacher can only register another user as teacher
// if the other is already teacher in any course. // if the other is already teacher in any course.
// That is, a teacher can not upgrade a student // That is, a teacher can not upgrade a student
// (in all other courses) to teacher // (in all other courses) to teacher
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Other.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Other.UsrDat);
if ( Role == Rol_STUDENT || if ( Role == Rol_STD ||
(Role == Rol_TEACHER && // He/she will be a teacher in current course (Role == Rol_TCH && // He/she will be a teacher in current course
(Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_TEACHER)))) // He/she was a teacher in some courses (Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_TCH)))) // He/she was a teacher in some courses
RoleOK = true; RoleOK = true;
break; break;
*/ */
case Rol_TEACHER: // I am logged as teacher case Rol_TCH: // I am logged as teacher
case Rol_DEG_ADM: // I am logged as degree admin case Rol_DEG_ADM: // I am logged as degree admin
case Rol_CTR_ADM: // I am logged as centre admin case Rol_CTR_ADM: // I am logged as centre admin
case Rol_INS_ADM: // I am logged as institution admin case Rol_INS_ADM: // I am logged as institution admin
if (Role == Rol_STUDENT || if (Role == Rol_STD ||
Role == Rol_TEACHER) Role == Rol_TCH)
RoleOK = true; RoleOK = true;
break; break;
case Rol_SYS_ADM: case Rol_SYS_ADM:
if ( Role == Rol_STUDENT || if ( Role == Rol_STD ||
Role == Rol_TEACHER || Role == Rol_TCH ||
(Role == Rol__GUEST_ && Gbl.CurrentCrs.Crs.CrsCod <= 0)) (Role == Rol_GST && Gbl.CurrentCrs.Crs.CrsCod <= 0))
RoleOK = true; RoleOK = true;
break; break;
default: default:
@ -3854,14 +3854,14 @@ void Rec_ShowFormMyInsCtrDpt (void)
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
/***** Check if I am a teacher *****/ /***** Check if I am a teacher *****/
IAmTeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TEACHER)); IAmTeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TCH));
/***** If there is no country, institution, centre or department *****/ /***** If there is no country, institution, centre or department *****/
if (Gbl.Usrs.Me.UsrDat.InsCtyCod < 0) if (Gbl.Usrs.Me.UsrDat.InsCtyCod < 0)
Ale_ShowAlert (Ale_WARNING,Txt_Please_select_the_country_of_your_institution); Ale_ShowAlert (Ale_WARNING,Txt_Please_select_the_country_of_your_institution);
else if (Gbl.Usrs.Me.UsrDat.InsCod < 0) else if (Gbl.Usrs.Me.UsrDat.InsCod < 0)
Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_institution); Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_institution);
else if ((Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TEACHER)) && else if ((Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TCH)) &&
(Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 || (Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 ||
Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0)) Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0))
Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_centre_and_department); Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_centre_and_department);

View File

@ -741,7 +741,7 @@ static void Rep_WriteSectionGlobalHits (struct Rep_Report *Report)
/***** Global (in any course) hits per year *****/ /***** Global (in any course) hits per year *****/
Report->MaxHitsPerYear = 0; // MaxHitsPerYear not passed as an argument but computed inside the function Report->MaxHitsPerYear = 0; // MaxHitsPerYear not passed as an argument but computed inside the function
Rep_ShowMyHitsPerYear (true,-1L, // Any course Rep_ShowMyHitsPerYear (true,-1L, // Any course
Rol_UNKNOWN, // Any role Rol_UNK, // Any role
Report); Report);
/***** End of section *****/ /***** End of section *****/
@ -857,8 +857,8 @@ static void Rep_WriteSectionCurrentCourses (struct Rep_Report *Report)
"<ul>"); "<ul>");
/***** Number of courses in which the user is student/teacher *****/ /***** Number of courses in which the user is student/teacher *****/
for (Role = Rol_STUDENT; for (Role = Rol_STD;
Role <= Rol_TEACHER; Role <= Rol_TCH;
Role++) Role++)
/* List my courses with this role */ /* List my courses with this role */
Rep_GetAndWriteMyCurrentCrss (Role,Report); Rep_GetAndWriteMyCurrentCrss (Role,Report);
@ -891,8 +891,8 @@ static void Rep_WriteSectionHistoricCourses (struct Rep_Report *Report)
Rep_GetAndWriteMyHistoricClicsWithoutCrs (Report); Rep_GetAndWriteMyHistoricClicsWithoutCrs (Report);
/***** Historic courses in which the user clicked as student/teacher *****/ /***** Historic courses in which the user clicked as student/teacher *****/
for (Role = Rol_STUDENT; for (Role = Rol_STD;
Role <= Rol_TEACHER; Role <= Rol_TCH;
Role++) Role++)
/* List my courses with this role */ /* List my courses with this role */
Rep_GetAndWriteMyHistoricCrss (Role,Report); Rep_GetAndWriteMyHistoricCrss (Role,Report);
@ -942,13 +942,13 @@ static void Rep_GetMaxHitsPerYear (struct Rep_Report *Report)
" GROUP BY CrsCod,Year,Role" " GROUP BY CrsCod,Year,Role"
// ---------------------------------------------------------- // ----------------------------------------------------------
") AS hits_per_crs_year", ") AS hits_per_crs_year",
(unsigned) Rol_UNKNOWN, (unsigned) Rol_UNK,
(long) Report->UsrFigures.FirstClickTimeUTC, (long) Report->UsrFigures.FirstClickTimeUTC,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(long) Report->UsrFigures.FirstClickTimeUTC, (long) Report->UsrFigures.FirstClickTimeUTC,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_STUDENT, (unsigned) Rol_STD,
(unsigned) Rol_TEACHER); (unsigned) Rol_TCH);
DB_QuerySELECT (Query,&mysql_res,"can not get last question index"); DB_QuerySELECT (Query,&mysql_res,"can not get last question index");
/***** Get number of users *****/ /***** Get number of users *****/
@ -992,9 +992,9 @@ static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role,
if (NumCrss) if (NumCrss)
{ {
fprintf (Gbl.F.Rep," (%u %s / %u %s):", fprintf (Gbl.F.Rep," (%u %s / %u %s):",
Usr_GetNumUsrsInCrssOfAUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Role,Rol_TEACHER), Usr_GetNumUsrsInCrssOfAUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Role,Rol_TCH),
Txt_teachers_ABBREVIATION, Txt_teachers_ABBREVIATION,
Usr_GetNumUsrsInCrssOfAUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Role,Rol_STUDENT), Usr_GetNumUsrsInCrssOfAUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Role,Rol_STD),
Txt_students_ABBREVIATION); Txt_students_ABBREVIATION);
/***** Get courses of a user from database *****/ /***** Get courses of a user from database *****/
@ -1057,7 +1057,7 @@ static void Rep_GetAndWriteMyHistoricClicsWithoutCrs (struct Rep_Report *Report)
/***** Historic clicks *****/ /***** Historic clicks *****/
Rep_WriteRowCrsData (-1L, Rep_WriteRowCrsData (-1L,
Rol_UNKNOWN, // Role does not matter Rol_UNK, // Role does not matter
Report, Report,
false); // Do not write number of users in course false); // Do not write number of users in course
@ -1171,8 +1171,8 @@ static void Rep_WriteRowCrsData (long CrsCod,Rol_Role_t Role,
/***** Write number of teachers / students in course *****/ /***** Write number of teachers / students in course *****/
if (WriteNumUsrs) if (WriteNumUsrs)
fprintf (Gbl.F.Rep," (%u %s / %u %s)", fprintf (Gbl.F.Rep," (%u %s / %u %s)",
Usr_GetNumUsrsInCrs (Rol_TEACHER,Crs.CrsCod),Txt_teachers_ABBREVIATION, Usr_GetNumUsrsInCrs (Rol_TCH,Crs.CrsCod),Txt_teachers_ABBREVIATION,
Usr_GetNumUsrsInCrs (Rol_STUDENT,Crs.CrsCod),Txt_students_ABBREVIATION); Usr_GetNumUsrsInCrs (Rol_STD,Crs.CrsCod),Txt_students_ABBREVIATION);
} }
else else
fprintf (Gbl.F.Rep,"(%s)",Txt_unknown_removed_course); fprintf (Gbl.F.Rep,"(%s)",Txt_unknown_removed_course);
@ -1211,7 +1211,7 @@ static void Rep_ShowMyHitsPerYear (bool AnyCourse,long CrsCod,Rol_Role_t Role,
else else
sprintf (SubQueryCrs," AND CrsCod=%ld",CrsCod); sprintf (SubQueryCrs," AND CrsCod=%ld",CrsCod);
if (Role == Rol_UNKNOWN) // Here Rol_UNKNOWN means any role if (Role == Rol_UNK) // Here Rol_UNK means any role
SubQueryRol[0] = '\0'; SubQueryRol[0] = '\0';
else else
sprintf (SubQueryRol," AND Role=%u",(unsigned) Role); sprintf (SubQueryRol," AND Role=%u",(unsigned) Role);

View File

@ -66,7 +66,7 @@ unsigned Rol_GetNumAvailableRoles (void)
Rol_Role_t Role; Rol_Role_t Role;
unsigned NumAvailableRoles = 0; unsigned NumAvailableRoles = 0;
for (Role = Rol__GUEST_; for (Role = Rol_GST;
Role < Rol_NUM_ROLES; Role < Rol_NUM_ROLES;
Role++) Role++)
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role)) if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
@ -81,11 +81,11 @@ unsigned Rol_GetNumAvailableRoles (void)
Rol_Role_t Rol_GetMaxRole (unsigned Roles) Rol_Role_t Rol_GetMaxRole (unsigned Roles)
{ {
if (Roles & (1 << Rol_TEACHER)) if (Roles & (1 << Rol_TCH))
return Rol_TEACHER; return Rol_TCH;
if (Roles & (1 << Rol_STUDENT)) if (Roles & (1 << Rol_STD))
return Rol_STUDENT; return Rol_STD;
return Rol__GUEST_; return Rol_GST;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -107,9 +107,9 @@ Rol_Role_t Rol_GetMyMaxRoleInIns (long InsCod)
NumMyIns++) NumMyIns++)
if (Gbl.Usrs.Me.MyInss.Inss[NumMyIns].InsCod == InsCod) if (Gbl.Usrs.Me.MyInss.Inss[NumMyIns].InsCod == InsCod)
return Gbl.Usrs.Me.MyInss.Inss[NumMyIns].MaxRole; return Gbl.Usrs.Me.MyInss.Inss[NumMyIns].MaxRole;
return Rol__GUEST_; return Rol_GST;
} }
return Rol_UNKNOWN; // No degree return Rol_UNK; // No degree
} }
/*****************************************************************************/ /*****************************************************************************/
@ -131,9 +131,9 @@ Rol_Role_t Rol_GetMyMaxRoleInCtr (long CtrCod)
NumMyCtr++) NumMyCtr++)
if (Gbl.Usrs.Me.MyCtrs.Ctrs[NumMyCtr].CtrCod == CtrCod) if (Gbl.Usrs.Me.MyCtrs.Ctrs[NumMyCtr].CtrCod == CtrCod)
return Gbl.Usrs.Me.MyCtrs.Ctrs[NumMyCtr].MaxRole; return Gbl.Usrs.Me.MyCtrs.Ctrs[NumMyCtr].MaxRole;
return Rol__GUEST_; return Rol_GST;
} }
return Rol_UNKNOWN; // No centre return Rol_UNK; // No centre
} }
/*****************************************************************************/ /*****************************************************************************/
@ -155,9 +155,9 @@ Rol_Role_t Rol_GetMyMaxRoleInDeg (long DegCod)
NumMyDeg++) NumMyDeg++)
if (Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod == DegCod) if (Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod == DegCod)
return Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].MaxRole; return Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].MaxRole;
return Rol__GUEST_; return Rol_GST;
} }
return Rol_UNKNOWN; // No degree return Rol_UNK; // No degree
} }
/*****************************************************************************/ /*****************************************************************************/
@ -179,9 +179,9 @@ Rol_Role_t Rol_GetMyRoleInCrs (long CrsCod)
NumMyCrs++) NumMyCrs++)
if (Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod == CrsCod) if (Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod == CrsCod)
return Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].Role; return Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].Role;
return Rol__GUEST_; return Rol_GST;
} }
return Rol_UNKNOWN; // No course return Rol_UNK; // No course
} }
/*****************************************************************************/ /*****************************************************************************/
@ -208,13 +208,13 @@ Rol_Role_t Rol_GetRoleInCrs (long CrsCod,long UsrCod)
Role = Rol_ConvertUnsignedStrToRole (row[0]); Role = Rol_ConvertUnsignedStrToRole (row[0]);
} }
else // User does not belong to the course else // User does not belong to the course
Role = Rol_UNKNOWN; Role = Rol_UNK;
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
else // No course else // No course
Role = Rol_UNKNOWN; Role = Rol_UNK;
return Role; return Role;
} }
@ -264,9 +264,9 @@ Rol_Role_t Rol_ConvertUnsignedStrToRole (const char *UnsignedStr)
unsigned UnsignedNum; unsigned UnsignedNum;
if (sscanf (UnsignedStr,"%u",&UnsignedNum) == 1) if (sscanf (UnsignedStr,"%u",&UnsignedNum) == 1)
return (UnsignedNum >= Rol_NUM_ROLES) ? Rol_UNKNOWN : return (UnsignedNum >= Rol_NUM_ROLES) ? Rol_UNK :
(Rol_Role_t) UnsignedNum; (Rol_Role_t) UnsignedNum;
return Rol_UNKNOWN; return Rol_UNK;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -295,7 +295,7 @@ void Rol_PutFormToChangeMyRole (void)
fprintf (Gbl.F.Out,"<select name=\"MyRole\" class=\"SEL_ROLE\"" fprintf (Gbl.F.Out,"<select name=\"MyRole\" class=\"SEL_ROLE\""
" onchange=\"document.getElementById('%s').submit();\">", " onchange=\"document.getElementById('%s').submit();\">",
Gbl.Form.Id); Gbl.Form.Id);
for (Role = Rol__GUEST_; for (Role = Rol_GST;
Role < Rol_NUM_ROLES; Role < Rol_NUM_ROLES;
Role++) Role++)
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role)) if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
@ -323,8 +323,8 @@ void Rol_ChangeMyRole (void)
Par_GetParToUnsignedLong ("MyRole", Par_GetParToUnsignedLong ("MyRole",
0, 0,
Rol_NUM_ROLES - 1, Rol_NUM_ROLES - 1,
(unsigned long) Rol_UNKNOWN); (unsigned long) Rol_UNK);
if (NewRole != Rol_UNKNOWN) if (NewRole != Rol_UNK)
{ {
/* Check if new role is allowed for me */ /* Check if new role is allowed for me */
if (!(Gbl.Usrs.Me.AvailableRoles & (1 << NewRole))) if (!(Gbl.Usrs.Me.AvailableRoles & (1 << NewRole)))
@ -357,7 +357,7 @@ void Rol_WriteSelectorRoles (unsigned RolesAllowed,unsigned RolesSelected,
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
Rol_Role_t Role; Rol_Role_t Role;
for (Role = Rol_UNKNOWN; for (Role = Rol_UNK;
Role <= Rol_SYS_ADM; Role <= Rol_SYS_ADM;
Role++) Role++)
if ((RolesAllowed & (1 << Role))) if ((RolesAllowed & (1 << Role)))
@ -420,7 +420,7 @@ unsigned Rol_GetSelectedRoles (void)
{ {
Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,10); Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,10);
Role = Rol_ConvertUnsignedStrToRole (UnsignedStr); Role = Rol_ConvertUnsignedStrToRole (UnsignedStr);
if (Role != Rol_UNKNOWN) if (Role != Rol_UNK)
Roles |= (1 << Role); Roles |= (1 << Role);
} }
@ -436,7 +436,7 @@ Rol_Role_t Rol_GetRequestedRole (long UsrCod)
char Query[256]; char Query[256];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
Rol_Role_t Role = Rol_UNKNOWN; Rol_Role_t Role = Rol_UNK;
/***** Get requested role from database *****/ /***** Get requested role from database *****/
sprintf (Query,"SELECT Role FROM crs_usr_requests" sprintf (Query,"SELECT Role FROM crs_usr_requests"

View File

@ -36,26 +36,24 @@
Don't change these numbers! Don't change these numbers!
They are used for users' permissions and for user's types in database They are used for users' permissions and for user's types in database
Only Rol_ROLE_STUDENT and Rol_ROLE_TEACHER are allowed Only Rol_STD and Rol_TCH are allowed
as user permanent roles in courses, as user permanent roles in courses,
but a user may be logged temporarily as other roles but a user may be logged temporarily as other roles
*/ */
// TODO: Teachers/students should be teachers/students only inside their courses
// A user with courses (but not logged as admin) should be Rol_VISITOR outside his/her courses
// (Rol_VISITOR should be labeled as "User" instead "Visitor")
#define Rol_NUM_ROLES 9 #define Rol_NUM_ROLES 9
typedef enum typedef enum
{ {
Rol_UNKNOWN = 0, // User not logged in Rol_UNK = 0, // User not logged in
Rol__GUEST_ = 1, // User not belonging to any course Rol_GST = 1, // User not belonging to any course
Rol_VISITOR = 2, // Student or teacher in other courses... Rol_USR = 2, // Student or teacher in some courses...
// ...but not belonging to the current course // ...but no course selected
Rol_STUDENT = 3, // Student in current course // ...or not belonging to the current course
Rol_TEACHER = 4, // Teacher in current course Rol_STD = 3, // Student in the current course
Rol_DEG_ADM = 5, // Degree administrator Rol_TCH = 4, // Teacher in the current course
Rol_CTR_ADM = 6, // Centre administrator Rol_DEG_ADM = 5, // Degree administrator
Rol_INS_ADM = 7, // Institution administrator Rol_CTR_ADM = 6, // Centre administrator
Rol_SYS_ADM = 8, // System administrator (superuser) Rol_INS_ADM = 7, // Institution administrator
Rol_SYS_ADM = 8, // System administrator (superuser)
} Rol_Role_t; } Rol_Role_t;
#endif #endif

View File

@ -273,8 +273,8 @@ void Sco_SetScopesForListingStudents (void)
Gbl.Scope.Default = Sco_SCOPE_CRS; Gbl.Scope.Default = Sco_SCOPE_CRS;
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
case Rol_TEACHER: case Rol_TCH:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CRS; Gbl.Scope.Allowed = 1 << Sco_SCOPE_CRS;
break; break;
case Rol_DEG_ADM: case Rol_DEG_ADM:

View File

@ -224,9 +224,9 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Sco
Txt_degrees, // Sch_SEARCH_DEGREES Txt_degrees, // Sch_SEARCH_DEGREES
Txt_courses, // Sch_SEARCH_COURSES Txt_courses, // Sch_SEARCH_COURSES
Txt_users[Usr_SEX_UNKNOWN], // Sch_SEARCH_USERS Txt_users[Usr_SEX_UNKNOWN], // Sch_SEARCH_USERS
Txt_ROLES_PLURAL_abc[Rol_TEACHER][Usr_SEX_UNKNOWN], // Sch_SEARCH_TEACHERS Txt_ROLES_PLURAL_abc[Rol_TCH][Usr_SEX_UNKNOWN], // Sch_SEARCH_TEACHERS
Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_UNKNOWN], // Sch_SEARCH_STUDENTS Txt_ROLES_PLURAL_abc[Rol_STD][Usr_SEX_UNKNOWN], // Sch_SEARCH_STUDENTS
Txt_ROLES_PLURAL_abc[Rol__GUEST_][Usr_SEX_UNKNOWN], // Sch_SEARCH_GUESTS Txt_ROLES_PLURAL_abc[Rol_GST][Usr_SEX_UNKNOWN], // Sch_SEARCH_GUESTS
Txt_open_documents, // Sch_SEARCH_OPEN_DOCUMENTS Txt_open_documents, // Sch_SEARCH_OPEN_DOCUMENTS
Txt_documents_in_my_courses, // Sch_SEARCH_DOCUM_IN_MY_COURSES Txt_documents_in_my_courses, // Sch_SEARCH_DOCUM_IN_MY_COURSES
Txt_my_documents, // Sch_SEARCH_MY_DOCUMENTS Txt_my_documents, // Sch_SEARCH_MY_DOCUMENTS
@ -595,9 +595,9 @@ static void Sch_SearchInDB (void)
NumResults += Sch_SearchCentresInDB (RangeQuery); NumResults += Sch_SearchCentresInDB (RangeQuery);
NumResults += Sch_SearchDegreesInDB (RangeQuery); NumResults += Sch_SearchDegreesInDB (RangeQuery);
NumResults += Sch_SearchCoursesInDB (RangeQuery); NumResults += Sch_SearchCoursesInDB (RangeQuery);
NumResults += Sch_SearchUsrsInDB (Rol_TEACHER); NumResults += Sch_SearchUsrsInDB (Rol_TCH);
NumResults += Sch_SearchUsrsInDB (Rol_STUDENT); NumResults += Sch_SearchUsrsInDB (Rol_STD);
NumResults += Sch_SearchUsrsInDB (Rol__GUEST_); NumResults += Sch_SearchUsrsInDB (Rol_GST);
NumResults += Sch_SearchOpenDocumentsInDB (RangeQuery); NumResults += Sch_SearchOpenDocumentsInDB (RangeQuery);
NumResults += Sch_SearchDocumentsInMyCoursesInDB (RangeQuery); NumResults += Sch_SearchDocumentsInMyCoursesInDB (RangeQuery);
NumResults += Sch_SearchMyDocumentsInDB (RangeQuery); NumResults += Sch_SearchMyDocumentsInDB (RangeQuery);
@ -618,16 +618,16 @@ static void Sch_SearchInDB (void)
NumResults = Sch_SearchCoursesInDB (RangeQuery); NumResults = Sch_SearchCoursesInDB (RangeQuery);
break; break;
case Sch_SEARCH_USERS: case Sch_SEARCH_USERS:
NumResults = Sch_SearchUsrsInDB (Rol_UNKNOWN); // Here Rol_UNKNOWN means any user NumResults = Sch_SearchUsrsInDB (Rol_UNK); // Here Rol_UNK means any user
break; break;
case Sch_SEARCH_TEACHERS: case Sch_SEARCH_TEACHERS:
NumResults = Sch_SearchUsrsInDB (Rol_TEACHER); NumResults = Sch_SearchUsrsInDB (Rol_TCH);
break; break;
case Sch_SEARCH_STUDENTS: case Sch_SEARCH_STUDENTS:
NumResults = Sch_SearchUsrsInDB (Rol_STUDENT); NumResults = Sch_SearchUsrsInDB (Rol_STD);
break; break;
case Sch_SEARCH_GUESTS: case Sch_SEARCH_GUESTS:
NumResults = Sch_SearchUsrsInDB (Rol__GUEST_); NumResults = Sch_SearchUsrsInDB (Rol_GST);
break; break;
case Sch_SEARCH_OPEN_DOCUMENTS: case Sch_SEARCH_OPEN_DOCUMENTS:
NumResults = Sch_SearchOpenDocumentsInDB (RangeQuery); NumResults = Sch_SearchOpenDocumentsInDB (RangeQuery);
@ -950,7 +950,7 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
RangeQuery); RangeQuery);
/***** Query database and list documents found *****/ /***** Query database and list documents found *****/
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) /* if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */ Lay_ShowAlert (Lay_INFO,Query); */
return Brw_ListDocsFound (Query, return Brw_ListDocsFound (Query,
Txt_open_document, Txt_open_document,
@ -1011,7 +1011,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
(unsigned) Brw_ADMI_TEACH_GRP, (unsigned) Brw_ADMI_TEACH_GRP,
(unsigned) Brw_ADMI_SHARE_GRP, (unsigned) Brw_ADMI_SHARE_GRP,
(unsigned) Brw_ADMI_MARKS_GRP); (unsigned) Brw_ADMI_MARKS_GRP);
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) /* if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */ Lay_ShowAlert (Lay_INFO,Query); */
if (mysql_query (&Gbl.mysql,Query)) if (mysql_query (&Gbl.mysql,Query))
DB_ExitOnMySQLError ("can not create temporary table"); DB_ExitOnMySQLError ("can not create temporary table");
@ -1071,7 +1071,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
RangeQuery); RangeQuery);
/***** Query database and list documents found *****/ /***** Query database and list documents found *****/
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) /* if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */ Lay_ShowAlert (Lay_INFO,Query); */
NumDocs = Brw_ListDocsFound (Query, NumDocs = Brw_ListDocsFound (Query,
Txt_document_in_my_courses, Txt_document_in_my_courses,
@ -1230,7 +1230,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
(unsigned) Brw_ADMI_BRIEF_USR); (unsigned) Brw_ADMI_BRIEF_USR);
/***** Query database and list documents found *****/ /***** Query database and list documents found *****/
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) /* if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */ Lay_ShowAlert (Lay_INFO,Query); */
return Brw_ListDocsFound (Query, return Brw_ListDocsFound (Query,
Txt_document_from_me, Txt_document_from_me,

View File

@ -141,7 +141,7 @@ void Ses_CloseSession (void)
Gbl.Usrs.Me.IBelongToCurrentCtr = false; Gbl.Usrs.Me.IBelongToCurrentCtr = false;
Gbl.Usrs.Me.IBelongToCurrentDeg = false; Gbl.Usrs.Me.IBelongToCurrentDeg = false;
Gbl.Usrs.Me.IBelongToCurrentCrs = false; Gbl.Usrs.Me.IBelongToCurrentCrs = false;
Gbl.Usrs.Me.LoggedRole = Rol_UNKNOWN; // Don't uncomment this line. Don't change the role to unknown. Keep user's role in order to log the access Gbl.Usrs.Me.LoggedRole = Rol_UNK; // Don't uncomment this line. Don't change the role to unknown. Keep user's role in order to log the access
Gbl.Usrs.Me.MyCrss.Filled = false; Gbl.Usrs.Me.MyCrss.Filled = false;
Gbl.Usrs.Me.MyCrss.Num = 0; Gbl.Usrs.Me.MyCrss.Num = 0;
@ -299,7 +299,7 @@ bool Ses_GetSessionData (void)
/***** Get logged user type (row[2]) *****/ /***** Get logged user type (row[2]) *****/
if (sscanf (row[2],"%u",&Gbl.Usrs.Me.RoleFromSession) != 1) if (sscanf (row[2],"%u",&Gbl.Usrs.Me.RoleFromSession) != 1)
Gbl.Usrs.Me.RoleFromSession = Rol_UNKNOWN; Gbl.Usrs.Me.RoleFromSession = Rol_UNK;
/***** Get country code (row[3]) *****/ /***** Get country code (row[3]) *****/
Gbl.CurrentCty.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[3]); Gbl.CurrentCty.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[3]);

View File

@ -463,10 +463,10 @@ void Sta_AskShowCrsHits (void)
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order the lists of users of this course *****/ /***** Get and order the lists of users of this course *****/
Usr_GetListUsrs (Rol_TEACHER,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_TCH,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs + NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
/***** Start frame *****/ /***** Start frame *****/
sprintf (Gbl.Title,Txt_Statistics_of_visits_to_the_course_X, sprintf (Gbl.Title,Txt_Statistics_of_visits_to_the_course_X,
@ -502,8 +502,8 @@ void Sta_AskShowCrsHits (void)
"<table>", "<table>",
The_ClassForm[Gbl.Prefs.Theme],Txt_Users, The_ClassForm[Gbl.Prefs.Theme],Txt_Users,
The_ClassForm[Gbl.Prefs.Theme]); The_ClassForm[Gbl.Prefs.Theme]);
Usr_ListUsersToSelect (Rol_TEACHER); Usr_ListUsersToSelect (Rol_TCH);
Usr_ListUsersToSelect (Rol_STUDENT); Usr_ListUsersToSelect (Rol_STD);
fprintf (Gbl.F.Out,"</table>" fprintf (Gbl.F.Out,"</table>"
"</td>" "</td>"
"</tr>"); "</tr>");
@ -607,8 +607,8 @@ void Sta_AskShowCrsHits (void)
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
/***** Free memory used by the lists *****/ /***** Free memory used by the lists *****/
Usr_FreeUsrsList (Rol_TEACHER); Usr_FreeUsrsList (Rol_TCH);
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
/***** Free memory for list of selected groups *****/ /***** Free memory for list of selected groups *****/
Grp_FreeListCodSelectedGrps (); Grp_FreeListCodSelectedGrps ();
@ -639,7 +639,7 @@ void Sta_AskShowGblHits (void)
/* Put form to go to test edition and configuration */ /* Put form to go to test edition and configuration */
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)) Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
Lay_PutContextualLink (ActReqAccCrs,NULL,NULL, Lay_PutContextualLink (ActReqAccCrs,NULL,NULL,
"stats64x64.gif", "stats64x64.gif",
@ -998,8 +998,8 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
/***** Check if range of dates is forbidden for me *****/ /***** Check if range of dates is forbidden for me *****/
NumDays = Dat_GetNumDaysBetweenDates (&Gbl.DateRange.DateIni.Date,&Gbl.DateRange.DateEnd.Date); NumDays = Dat_GetNumDaysBetweenDates (&Gbl.DateRange.DateIni.Date,&Gbl.DateRange.DateEnd.Date);
ICanQueryWholeRange = (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER && GlobalOrCourse == Sta_SHOW_COURSE_ACCESSES) || ICanQueryWholeRange = (Gbl.Usrs.Me.LoggedRole >= Rol_TCH && GlobalOrCourse == Sta_SHOW_COURSE_ACCESSES) ||
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER && Gbl.Scope.Current == Sco_SCOPE_CRS) || (Gbl.Usrs.Me.LoggedRole == Rol_TCH && Gbl.Scope.Current == Sco_SCOPE_CRS) ||
(Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM && (Gbl.Scope.Current == Sco_SCOPE_DEG || (Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM && (Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CRS)) || Gbl.Scope.Current == Sco_SCOPE_CRS)) ||
(Gbl.Usrs.Me.LoggedRole == Rol_CTR_ADM && (Gbl.Scope.Current == Sco_SCOPE_CTR || (Gbl.Usrs.Me.LoggedRole == Rol_CTR_ADM && (Gbl.Scope.Current == Sco_SCOPE_CTR ||
@ -1215,7 +1215,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
{ {
case Sta_IDENTIFIED_USRS: case Sta_IDENTIFIED_USRS:
sprintf (StrRole," AND %s.Role<>%u", sprintf (StrRole," AND %s.Role<>%u",
LogTable,(unsigned) Rol_UNKNOWN); LogTable,(unsigned) Rol_UNK);
break; break;
case Sta_ALL_USRS: case Sta_ALL_USRS:
switch (Gbl.Stat.CountType) switch (Gbl.Stat.CountType)
@ -1228,7 +1228,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
case Sta_DISTINCT_USRS: case Sta_DISTINCT_USRS:
case Sta_CLICKS_PER_USR: case Sta_CLICKS_PER_USR:
sprintf (StrRole," AND %s.Role<>%u", sprintf (StrRole," AND %s.Role<>%u",
LogTable,(unsigned) Rol_UNKNOWN); LogTable,(unsigned) Rol_UNK);
break; break;
} }
break; break;
@ -1246,23 +1246,23 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
break; break;
case Sta_TEACHERS: case Sta_TEACHERS:
sprintf (StrRole," AND %s.Role=%u", sprintf (StrRole," AND %s.Role=%u",
LogTable,(unsigned) Rol_TEACHER); LogTable,(unsigned) Rol_TCH);
break; break;
case Sta_STUDENTS: case Sta_STUDENTS:
sprintf (StrRole," AND %s.Role=%u", sprintf (StrRole," AND %s.Role=%u",
LogTable,(unsigned) Rol_STUDENT); LogTable,(unsigned) Rol_STD);
break; break;
case Sta_VISITORS: case Sta_VISITORS:
sprintf (StrRole," AND %s.Role=%u", sprintf (StrRole," AND %s.Role=%u",
LogTable,(unsigned) Rol_VISITOR); LogTable,(unsigned) Rol_USR);
break; break;
case Sta_GUESTS: case Sta_GUESTS:
sprintf (StrRole," AND %s.Role=%u", sprintf (StrRole," AND %s.Role=%u",
LogTable,(unsigned) Rol__GUEST_); LogTable,(unsigned) Rol_GST);
break; break;
case Sta_UNKNOWN_USRS: case Sta_UNKNOWN_USRS:
sprintf (StrRole," AND %s.Role=%u", sprintf (StrRole," AND %s.Role=%u",
LogTable,(unsigned) Rol_UNKNOWN); LogTable,(unsigned) Rol_UNK);
break; break;
case Sta_ME: case Sta_ME:
sprintf (StrRole," AND %s.UsrCod=%ld", sprintf (StrRole," AND %s.UsrCod=%ld",
@ -1949,7 +1949,7 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,
" style=\"width:%upx; height:18px;\" />" " style=\"width:%upx; height:18px;\" />"
"&nbsp;", "&nbsp;",
Gbl.Prefs.IconsURL, Gbl.Prefs.IconsURL,
UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? 'c' : UsrDat.RoleInCurrentCrsDB == Rol_STD ? 'c' :
'v', 'v',
BarWidth); BarWidth);
Str_WriteFloatNum (Gbl.F.Out,Hits.Num); Str_WriteFloatNum (Gbl.F.Out,Hits.Num);
@ -4069,13 +4069,13 @@ static void Sta_GetAndShowUsersStats (void)
Txt_No_of_users, Txt_No_of_users,
Txt_Average_number_of_courses_to_which_a_user_belongs, Txt_Average_number_of_courses_to_which_a_user_belongs,
Txt_Average_number_of_users_belonging_to_a_course); Txt_Average_number_of_users_belonging_to_a_course);
Usr_GetAndShowNumUsrsInPlatform (Rol_STUDENT); // Students Usr_GetAndShowNumUsrsInPlatform (Rol_STD); // Students
Usr_GetAndShowNumUsrsInPlatform (Rol_TEACHER); // Teachers Usr_GetAndShowNumUsrsInPlatform (Rol_TCH); // Teachers
Usr_GetAndShowNumUsrsInPlatform (Rol_UNKNOWN); // Students and teachers Usr_GetAndShowNumUsrsInPlatform (Rol_UNK); // Students and teachers
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<th colspan=\"4\" style=\"height:10px;\">" "<th colspan=\"4\" style=\"height:10px;\">"
"</tr>"); "</tr>");
Usr_GetAndShowNumUsrsInPlatform (Rol__GUEST_); // Users not beloging to any course Usr_GetAndShowNumUsrsInPlatform (Rol_GST); // Users not beloging to any course
Lay_EndRoundFrameTable (); Lay_EndRoundFrameTable ();
} }
@ -4246,8 +4246,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs (""); NumCtysWithCtrs = Cty_GetNumCtysWithCtrs ("");
NumCtysWithDegs = Cty_GetNumCtysWithDegs (""); NumCtysWithDegs = Cty_GetNumCtysWithDegs ("");
NumCtysWithCrss = Cty_GetNumCtysWithCrss (""); NumCtysWithCrss = Cty_GetNumCtysWithCrss ("");
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,""); NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TCH,"");
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,""); NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STD,"");
SubQuery[0] = '\0'; SubQuery[0] = '\0';
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
@ -4258,8 +4258,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs (SubQuery); NumCtysWithCtrs = Cty_GetNumCtysWithCtrs (SubQuery);
NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery); NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery);
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery); NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery); NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TCH,SubQuery);
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery); NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
NumCtysTotal = 1; NumCtysTotal = 1;
@ -4269,8 +4269,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs (SubQuery); NumCtysWithCtrs = Cty_GetNumCtysWithCtrs (SubQuery);
NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery); NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery);
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery); NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery); NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TCH,SubQuery);
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery); NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
NumCtysTotal = 1; NumCtysTotal = 1;
@ -4280,8 +4280,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
Gbl.CurrentCtr.Ctr.CtrCod); Gbl.CurrentCtr.Ctr.CtrCod);
NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery); NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery);
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery); NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery); NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TCH,SubQuery);
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery); NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
NumCtysTotal = 1; NumCtysTotal = 1;
@ -4291,8 +4291,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
sprintf (SubQuery,"courses.DegCod=%ld AND ", sprintf (SubQuery,"courses.DegCod=%ld AND ",
Gbl.CurrentDeg.Deg.DegCod); Gbl.CurrentDeg.Deg.DegCod);
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery); NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery); NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TCH,SubQuery);
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery); NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
NumCtysTotal = 1; NumCtysTotal = 1;
@ -4302,8 +4302,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
NumCtysWithCrss = 1; NumCtysWithCrss = 1;
sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ", sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ",
Gbl.CurrentCrs.Crs.CrsCod); Gbl.CurrentCrs.Crs.CrsCod);
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery); NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TCH,SubQuery);
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery); NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STD,SubQuery);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong scope."); Lay_ShowErrorAndExit ("Wrong scope.");
@ -4376,8 +4376,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
NumInssWithCtrs = Ins_GetNumInssWithCtrs (""); NumInssWithCtrs = Ins_GetNumInssWithCtrs ("");
NumInssWithDegs = Ins_GetNumInssWithDegs (""); NumInssWithDegs = Ins_GetNumInssWithDegs ("");
NumInssWithCrss = Ins_GetNumInssWithCrss (""); NumInssWithCrss = Ins_GetNumInssWithCrss ("");
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,""); NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TCH,"");
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,""); NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STD,"");
SubQuery[0] = '\0'; SubQuery[0] = '\0';
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
@ -4387,8 +4387,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
NumInssWithCtrs = Ins_GetNumInssWithCtrs (SubQuery); NumInssWithCtrs = Ins_GetNumInssWithCtrs (SubQuery);
NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery); NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery);
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery); NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery); NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TCH,SubQuery);
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery); NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
NumInssTotal = 1; NumInssTotal = 1;
@ -4397,8 +4397,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
NumInssWithCtrs = Ins_GetNumInssWithCtrs (SubQuery); NumInssWithCtrs = Ins_GetNumInssWithCtrs (SubQuery);
NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery); NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery);
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery); NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery); NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TCH,SubQuery);
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery); NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
NumInssTotal = 1; NumInssTotal = 1;
@ -4407,8 +4407,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
Gbl.CurrentCtr.Ctr.CtrCod); Gbl.CurrentCtr.Ctr.CtrCod);
NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery); NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery);
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery); NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery); NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TCH,SubQuery);
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery); NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
NumInssTotal = 1; NumInssTotal = 1;
@ -4417,8 +4417,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
sprintf (SubQuery,"courses.DegCod=%ld AND ", sprintf (SubQuery,"courses.DegCod=%ld AND ",
Gbl.CurrentDeg.Deg.DegCod); Gbl.CurrentDeg.Deg.DegCod);
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery); NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery); NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TCH,SubQuery);
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery); NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
NumInssTotal = 1; NumInssTotal = 1;
@ -4427,8 +4427,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
NumInssWithCrss = 1; NumInssWithCrss = 1;
sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ", sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ",
Gbl.CurrentCrs.Crs.CrsCod); Gbl.CurrentCrs.Crs.CrsCod);
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery); NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TCH,SubQuery);
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery); NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STD,SubQuery);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong scope."); Lay_ShowErrorAndExit ("Wrong scope.");
@ -4496,8 +4496,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
NumCtrsTotal = Ctr_GetNumCtrsTotal (); NumCtrsTotal = Ctr_GetNumCtrsTotal ();
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (""); NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs ("");
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (""); NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss ("");
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,""); NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TCH,"");
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,""); NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STD,"");
SubQuery[0] = '\0'; SubQuery[0] = '\0';
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
@ -4506,8 +4506,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
Gbl.CurrentCty.Cty.CtyCod); Gbl.CurrentCty.Cty.CtyCod);
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery); NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery);
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery); NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery); NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TCH,SubQuery);
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery); NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
NumCtrsTotal = Ctr_GetNumCtrsInIns (Gbl.CurrentIns.Ins.InsCod); NumCtrsTotal = Ctr_GetNumCtrsInIns (Gbl.CurrentIns.Ins.InsCod);
@ -4515,8 +4515,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
Gbl.CurrentIns.Ins.InsCod); Gbl.CurrentIns.Ins.InsCod);
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery); NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery);
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery); NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery); NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TCH,SubQuery);
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery); NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
NumCtrsTotal = 1; NumCtrsTotal = 1;
@ -4524,8 +4524,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
Gbl.CurrentCtr.Ctr.CtrCod); Gbl.CurrentCtr.Ctr.CtrCod);
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery); NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery);
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery); NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery); NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TCH,SubQuery);
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery); NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
NumCtrsTotal = 1; NumCtrsTotal = 1;
@ -4533,8 +4533,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
sprintf (SubQuery,"courses.DegCod=%ld AND ", sprintf (SubQuery,"courses.DegCod=%ld AND ",
Gbl.CurrentDeg.Deg.DegCod); Gbl.CurrentDeg.Deg.DegCod);
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery); NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery); NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TCH,SubQuery);
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery); NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
NumCtrsTotal = 1; NumCtrsTotal = 1;
@ -4542,8 +4542,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
NumCtrsWithCrss = 1; NumCtrsWithCrss = 1;
sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ", sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ",
Gbl.CurrentCrs.Crs.CrsCod); Gbl.CurrentCrs.Crs.CrsCod);
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery); NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TCH,SubQuery);
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery); NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STD,SubQuery);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong scope."); Lay_ShowErrorAndExit ("Wrong scope.");
@ -4606,8 +4606,8 @@ static void Sta_GetAndShowNumDegsInSWAD (void)
case Sco_SCOPE_SYS: case Sco_SCOPE_SYS:
NumDegsTotal = Deg_GetNumDegsTotal (); NumDegsTotal = Deg_GetNumDegsTotal ();
NumDegsWithCrss = Deg_GetNumDegsWithCrss (""); NumDegsWithCrss = Deg_GetNumDegsWithCrss ("");
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,""); NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TCH,"");
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,""); NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STD,"");
SubQuery[0] = '\0'; SubQuery[0] = '\0';
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
@ -4615,40 +4615,40 @@ static void Sta_GetAndShowNumDegsInSWAD (void)
sprintf (SubQuery,"institutions.CtyCod=%ld AND ", sprintf (SubQuery,"institutions.CtyCod=%ld AND ",
Gbl.CurrentCty.Cty.CtyCod); Gbl.CurrentCty.Cty.CtyCod);
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery); NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery); NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TCH,SubQuery);
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery); NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
NumDegsTotal = Deg_GetNumDegsInIns (Gbl.CurrentIns.Ins.InsCod); NumDegsTotal = Deg_GetNumDegsInIns (Gbl.CurrentIns.Ins.InsCod);
sprintf (SubQuery,"centres.InsCod=%ld AND ", sprintf (SubQuery,"centres.InsCod=%ld AND ",
Gbl.CurrentIns.Ins.InsCod); Gbl.CurrentIns.Ins.InsCod);
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery); NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery); NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TCH,SubQuery);
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery); NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
NumDegsTotal = Deg_GetNumDegsInCtr (Gbl.CurrentCtr.Ctr.CtrCod); NumDegsTotal = Deg_GetNumDegsInCtr (Gbl.CurrentCtr.Ctr.CtrCod);
sprintf (SubQuery,"degrees.CtrCod=%ld AND ", sprintf (SubQuery,"degrees.CtrCod=%ld AND ",
Gbl.CurrentCtr.Ctr.CtrCod); Gbl.CurrentCtr.Ctr.CtrCod);
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery); NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery); NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TCH,SubQuery);
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery); NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
NumDegsTotal = 1; NumDegsTotal = 1;
sprintf (SubQuery,"courses.DegCod=%ld AND ", sprintf (SubQuery,"courses.DegCod=%ld AND ",
Gbl.CurrentDeg.Deg.DegCod); Gbl.CurrentDeg.Deg.DegCod);
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery); NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery); NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TCH,SubQuery);
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery); NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
NumDegsTotal = 1; NumDegsTotal = 1;
NumDegsWithCrss = 1; NumDegsWithCrss = 1;
sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ", sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ",
Gbl.CurrentCrs.Crs.CrsCod); Gbl.CurrentCrs.Crs.CrsCod);
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery); NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TCH,SubQuery);
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery); NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STD,SubQuery);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong scope."); Lay_ShowErrorAndExit ("Wrong scope.");
@ -4706,44 +4706,44 @@ static void Sta_GetAndShowNumCrssInSWAD (void)
{ {
case Sco_SCOPE_SYS: case Sco_SCOPE_SYS:
NumCrssTotal = Crs_GetNumCrssTotal (); NumCrssTotal = Crs_GetNumCrssTotal ();
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,""); NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TCH,"");
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,""); NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STD,"");
SubQuery[0] = '\0'; SubQuery[0] = '\0';
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
NumCrssTotal = Crs_GetNumCrssInCty (Gbl.CurrentCty.Cty.CtyCod); NumCrssTotal = Crs_GetNumCrssInCty (Gbl.CurrentCty.Cty.CtyCod);
sprintf (SubQuery,"institutions.CtyCod=%ld AND ", sprintf (SubQuery,"institutions.CtyCod=%ld AND ",
Gbl.CurrentCty.Cty.CtyCod); Gbl.CurrentCty.Cty.CtyCod);
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery); NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TCH,SubQuery);
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery); NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
NumCrssTotal = Crs_GetNumCrssInIns (Gbl.CurrentIns.Ins.InsCod); NumCrssTotal = Crs_GetNumCrssInIns (Gbl.CurrentIns.Ins.InsCod);
sprintf (SubQuery,"centres.InsCod=%ld AND ", sprintf (SubQuery,"centres.InsCod=%ld AND ",
Gbl.CurrentIns.Ins.InsCod); Gbl.CurrentIns.Ins.InsCod);
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery); NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TCH,SubQuery);
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery); NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
NumCrssTotal = Crs_GetNumCrssInCtr (Gbl.CurrentCtr.Ctr.CtrCod); NumCrssTotal = Crs_GetNumCrssInCtr (Gbl.CurrentCtr.Ctr.CtrCod);
sprintf (SubQuery,"degrees.CtrCod=%ld AND ", sprintf (SubQuery,"degrees.CtrCod=%ld AND ",
Gbl.CurrentCtr.Ctr.CtrCod); Gbl.CurrentCtr.Ctr.CtrCod);
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery); NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TCH,SubQuery);
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery); NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
NumCrssTotal = Crs_GetNumCrssInDeg (Gbl.CurrentDeg.Deg.DegCod); NumCrssTotal = Crs_GetNumCrssInDeg (Gbl.CurrentDeg.Deg.DegCod);
sprintf (SubQuery,"courses.DegCod=%ld AND ", sprintf (SubQuery,"courses.DegCod=%ld AND ",
Gbl.CurrentDeg.Deg.DegCod); Gbl.CurrentDeg.Deg.DegCod);
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery); NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TCH,SubQuery);
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery); NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STD,SubQuery);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
NumCrssTotal = 1; NumCrssTotal = 1;
sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ", sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ",
Gbl.CurrentCrs.Crs.CrsCod); Gbl.CurrentCrs.Crs.CrsCod);
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery); NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TCH,SubQuery);
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery); NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STD,SubQuery);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong scope."); Lay_ShowErrorAndExit ("Wrong scope.");
@ -5271,7 +5271,7 @@ static unsigned Sta_GetTotalNumberOfUsersInPlatform (void)
/*****************************************************************************/ /*****************************************************************************/
/******************* Get total number of users in courses ********************/ /******************* Get total number of users in courses ********************/
/*****************************************************************************/ /*****************************************************************************/
// Here Rol_ROLE_UNKNOWN means "students or teachers" // Here Rol_UNK means "students or teachers"
unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role) unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role)
{ {
@ -5281,7 +5281,7 @@ unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role)
switch (Scope) switch (Scope)
{ {
case Sco_SCOPE_SYS: case Sco_SCOPE_SYS:
if (Role == Rol_UNKNOWN) // Any user if (Role == Rol_UNK) // Any user
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)" sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
" FROM crs_usr"); " FROM crs_usr");
else else
@ -5290,7 +5290,7 @@ unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role)
(unsigned) Role); (unsigned) Role);
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
if (Role == Rol_UNKNOWN) // Any user if (Role == Rol_UNK) // Any user
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)" sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM institutions,centres,degrees,courses,crs_usr" " FROM institutions,centres,degrees,courses,crs_usr"
" WHERE institutions.CtyCod=%ld" " WHERE institutions.CtyCod=%ld"
@ -5311,7 +5311,7 @@ unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role)
Gbl.CurrentCty.Cty.CtyCod,(unsigned) Role); Gbl.CurrentCty.Cty.CtyCod,(unsigned) Role);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
if (Role == Rol_UNKNOWN) // Any user if (Role == Rol_UNK) // Any user
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)" sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM centres,degrees,courses,crs_usr" " FROM centres,degrees,courses,crs_usr"
" WHERE centres.InsCod=%ld" " WHERE centres.InsCod=%ld"
@ -5330,7 +5330,7 @@ unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role)
Gbl.CurrentIns.Ins.InsCod,(unsigned) Role); Gbl.CurrentIns.Ins.InsCod,(unsigned) Role);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
if (Role == Rol_UNKNOWN) // Any user if (Role == Rol_UNK) // Any user
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)" sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM degrees,courses,crs_usr" " FROM degrees,courses,crs_usr"
" WHERE degrees.CtrCod=%ld" " WHERE degrees.CtrCod=%ld"
@ -5347,7 +5347,7 @@ unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role)
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Role); Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Role);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
if (Role == Rol_UNKNOWN) // Any user if (Role == Rol_UNK) // Any user
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)" sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM courses,crs_usr" " FROM courses,crs_usr"
" WHERE courses.DegCod=%ld" " WHERE courses.DegCod=%ld"
@ -5362,7 +5362,7 @@ unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role)
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Role); Gbl.CurrentDeg.Deg.DegCod,(unsigned) Role);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
if (Role == Rol_UNKNOWN) // Any user if (Role == Rol_UNK) // Any user
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod) FROM crs_usr" sprintf (Query,"SELECT COUNT(DISTINCT UsrCod) FROM crs_usr"
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.CurrentCrs.Crs.CrsCod); Gbl.CurrentCrs.Crs.CrsCod);
@ -6942,7 +6942,7 @@ static void Sta_GetAndShowSocialActivityStats (void)
/***** Get total number of users *****/ /***** Get total number of users *****/
NumUsrsTotal = (Gbl.Scope.Current == Sco_SCOPE_SYS) ? Sta_GetTotalNumberOfUsersInPlatform () : NumUsrsTotal = (Gbl.Scope.Current == Sco_SCOPE_SYS) ? Sta_GetTotalNumberOfUsersInPlatform () :
Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNKNOWN); Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNK);
/***** Get total number of following/followers from database *****/ /***** Get total number of following/followers from database *****/
for (NoteType = (Soc_NoteType_t) 0; for (NoteType = (Soc_NoteType_t) 0;
@ -7219,7 +7219,7 @@ static void Sta_GetAndShowFollowStats (void)
/***** Get total number of users *****/ /***** Get total number of users *****/
NumUsrsTotal = (Gbl.Scope.Current == Sco_SCOPE_SYS) ? Sta_GetTotalNumberOfUsersInPlatform () : NumUsrsTotal = (Gbl.Scope.Current == Sco_SCOPE_SYS) ? Sta_GetTotalNumberOfUsersInPlatform () :
Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNKNOWN); Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNK);
/***** Get total number of following/followers from database *****/ /***** Get total number of following/followers from database *****/
for (Fol = 0; for (Fol = 0;
@ -7842,7 +7842,7 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
/***** Get total number of users *****/ /***** Get total number of users *****/
NumUsrsTotal = (Gbl.Scope.Current == Sco_SCOPE_SYS) ? Sta_GetTotalNumberOfUsersInPlatform () : NumUsrsTotal = (Gbl.Scope.Current == Sco_SCOPE_SYS) ? Sta_GetTotalNumberOfUsersInPlatform () :
Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNKNOWN); Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNK);
/***** Get total number of users who want to be /***** Get total number of users who want to be
notified by email on some event, from database *****/ notified by email on some event, from database *****/

View File

@ -1033,7 +1033,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
char StrSpecialChar[Str_MAX_BYTES_SPECIAL_CHAR + 1]; char StrSpecialChar[Str_MAX_BYTES_SPECIAL_CHAR + 1];
/* /*
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
{ {
sprintf (Gbl.Alert.Txt,"Str_ChangeFormat (&quot;%s&quot;)",Str); sprintf (Gbl.Alert.Txt,"Str_ChangeFormat (&quot;%s&quot;)",Str);
Lay_ShowAlert (Lay_INFO,Gbl.Alert.Txt); Lay_ShowAlert (Lay_INFO,Gbl.Alert.Txt);

View File

@ -294,7 +294,7 @@ static bool Svy_CheckIfICanCreateSvy (void)
{ {
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: case Rol_TCH:
return (Gbl.CurrentCrs.Crs.CrsCod > 0); return (Gbl.CurrentCrs.Crs.CrsCod > 0);
case Rol_DEG_ADM: case Rol_DEG_ADM:
return (Gbl.CurrentDeg.Deg.DegCod > 0); // Always true return (Gbl.CurrentDeg.Deg.DegCod > 0); // Always true
@ -618,8 +618,8 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,
Svy.Status.Visible ? "ASG_GRP" : Svy.Status.Visible ? "ASG_GRP" :
"ASG_GRP_LIGHT", "ASG_GRP_LIGHT",
Txt_Users); Txt_Users);
Rol_WriteSelectorRoles (1 << Rol_STUDENT | Rol_WriteSelectorRoles (1 << Rol_STD |
1 << Rol_TEACHER, 1 << Rol_TCH,
Svy.Roles, Svy.Roles,
true,false); true,false);
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
@ -977,15 +977,15 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
{ {
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_UNKNOWN: // User not logged in ********************************* case Rol_UNK: // User not logged in *********************************
*ScopesAllowed = 0; *ScopesAllowed = 0;
*HiddenAllowed = 0; *HiddenAllowed = 0;
break; break;
case Rol__GUEST_: // User not belonging to any course ******************* case Rol_GST: // User not belonging to any course *******************
*ScopesAllowed = 1 << Sco_SCOPE_SYS; *ScopesAllowed = 1 << Sco_SCOPE_SYS;
*HiddenAllowed = 0; *HiddenAllowed = 0;
break; break;
case Rol_VISITOR: // Student or teacher in other courses... case Rol_USR: // Student or teacher in other courses...
// ...but not belonging to the current course ********* // ...but not belonging to the current course *********
*ScopesAllowed = 1 << Sco_SCOPE_SYS; *ScopesAllowed = 1 << Sco_SCOPE_SYS;
*HiddenAllowed = 0; *HiddenAllowed = 0;
@ -1004,7 +1004,7 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
} }
} }
break; break;
case Rol_STUDENT: // Student in current course ************************** case Rol_STD: // Student in current course **************************
*ScopesAllowed = 1 << Sco_SCOPE_SYS; *ScopesAllowed = 1 << Sco_SCOPE_SYS;
*HiddenAllowed = 0; *HiddenAllowed = 0;
if (Usr_CheckIfIBelongToCty (Gbl.CurrentCty.Cty.CtyCod)) if (Usr_CheckIfIBelongToCty (Gbl.CurrentCty.Cty.CtyCod))
@ -1026,7 +1026,7 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
} }
} }
break; break;
case Rol_TEACHER: // Teacher in current course ************************** case Rol_TCH: // Teacher in current course **************************
*ScopesAllowed = 1 << Sco_SCOPE_SYS; *ScopesAllowed = 1 << Sco_SCOPE_SYS;
*HiddenAllowed = 0; *HiddenAllowed = 0;
if (Usr_CheckIfIBelongToCty (Gbl.CurrentCty.Cty.CtyCod)) if (Usr_CheckIfIBelongToCty (Gbl.CurrentCty.Cty.CtyCod))
@ -1245,7 +1245,7 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
Can I edit survey? */ Can I edit survey? */
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
Svy->Status.ICanViewResults = (Svy->Scope == Sco_SCOPE_CRS || Svy->Status.ICanViewResults = (Svy->Scope == Sco_SCOPE_CRS ||
Svy->Scope == Sco_SCOPE_DEG || Svy->Scope == Sco_SCOPE_DEG ||
Svy->Scope == Sco_SCOPE_CTR || Svy->Scope == Sco_SCOPE_CTR ||
@ -1260,7 +1260,7 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
Svy->Status.IHaveAnswered; Svy->Status.IHaveAnswered;
Svy->Status.ICanEdit = false; Svy->Status.ICanEdit = false;
break; break;
case Rol_TEACHER: case Rol_TCH:
Svy->Status.ICanViewResults = (Svy->Scope == Sco_SCOPE_CRS || Svy->Status.ICanViewResults = (Svy->Scope == Sco_SCOPE_CRS ||
Svy->Scope == Sco_SCOPE_DEG || Svy->Scope == Sco_SCOPE_DEG ||
Svy->Scope == Sco_SCOPE_CTR || Svy->Scope == Sco_SCOPE_CTR ||
@ -1765,7 +1765,7 @@ void Svy_RequestCreatOrEditSvy (void)
/* Initialize to empty survey */ /* Initialize to empty survey */
Svy.SvyCod = -1L; Svy.SvyCod = -1L;
Svy.Scope = Sco_SCOPE_UNK; Svy.Scope = Sco_SCOPE_UNK;
Svy.Roles = (1 << Rol_STUDENT); Svy.Roles = (1 << Rol_STD);
Svy.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; Svy.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Svy.TimeUTC[Svy_START_TIME] = Gbl.StartExecutionTimeUTC; Svy.TimeUTC[Svy_START_TIME] = Gbl.StartExecutionTimeUTC;
Svy.TimeUTC[Svy_END_TIME ] = Gbl.StartExecutionTimeUTC + (24 * 60 * 60); // +24 hours Svy.TimeUTC[Svy_END_TIME ] = Gbl.StartExecutionTimeUTC + (24 * 60 * 60); // +24 hours
@ -1859,8 +1859,8 @@ void Svy_RequestCreatOrEditSvy (void)
"<td class=\"DAT LEFT_MIDDLE\">", "<td class=\"DAT LEFT_MIDDLE\">",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Users); Txt_Users);
Rol_WriteSelectorRoles (1 << Rol_STUDENT | Rol_WriteSelectorRoles (1 << Rol_STD |
1 << Rol_TEACHER, 1 << Rol_TCH,
Svy.Roles, Svy.Roles,
false,false); false,false);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -1897,7 +1897,7 @@ static void Svy_SetDefaultAndAllowedScope (struct Survey *Svy)
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_TEACHER: // Teachers only can edit course surveys case Rol_TCH: // Teachers only can edit course surveys
if (Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.CurrentCrs.Crs.CrsCod > 0)
{ {
if (Svy->Scope == Sco_SCOPE_UNK) // Scope not defined if (Svy->Scope == Sco_SCOPE_UNK) // Scope not defined
@ -2102,7 +2102,7 @@ void Svy_RecFormSurvey (void)
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
if (Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM && if (Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM &&
Gbl.Usrs.Me.LoggedRole != Rol_TEACHER) Gbl.Usrs.Me.LoggedRole != Rol_TCH)
Lay_ShowErrorAndExit ("Wrong survey scope."); Lay_ShowErrorAndExit ("Wrong survey scope.");
NewSvy.Scope = Sco_SCOPE_CRS; NewSvy.Scope = Sco_SCOPE_CRS;
NewSvy.Cod = Gbl.CurrentCrs.Crs.CrsCod; NewSvy.Cod = Gbl.CurrentCrs.Crs.CrsCod;

View File

@ -48,7 +48,7 @@ struct Survey
long SvyCod; long SvyCod;
Sco_Scope_t Scope; Sco_Scope_t Scope;
long Cod; // Country, institution, centre, degree or course code long Cod; // Country, institution, centre, degree or course code
unsigned Roles; // Example: if survey can be made by students and teachers, Roles == (1 << Rol_ROLE_STUDENT) | (1 << Rol_ROLE_TEACHER) unsigned Roles; // Example: if survey can be made by students and teachers, Roles == (1 << Rol_STD) | (1 << Rol_TCH)
long UsrCod; long UsrCod;
char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1]; char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1];
time_t TimeUTC[Svy_NUM_DATES]; time_t TimeUTC[Svy_NUM_DATES];

View File

@ -238,7 +238,7 @@ bool Syl_CheckAndEditSyllabus (void)
/***** Start frame *****/ /***** Start frame *****/
if (Gbl.Syllabus.EditionIsActive || LstItemsSyllabus.NumItems) if (Gbl.Syllabus.EditionIsActive || LstItemsSyllabus.NumItems)
{ {
ICanEdit = Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || ICanEdit = Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM; Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
PutIconToEdit = ICanEdit && !Gbl.Syllabus.EditionIsActive; PutIconToEdit = ICanEdit && !Gbl.Syllabus.EditionIsActive;
Lay_StartRoundFrameTable (NULL,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type], Lay_StartRoundFrameTable (NULL,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type],

View File

@ -188,7 +188,7 @@ static bool Tab_CheckIfICanViewTab (Tab_Tab_t Tab)
return (Gbl.CurrentCrs.Crs.CrsCod > 0); // Course selected return (Gbl.CurrentCrs.Crs.CrsCod > 0); // Course selected
case TabAss: case TabAss:
return (Gbl.CurrentCrs.Crs.CrsCod > 0 || // Course selected return (Gbl.CurrentCrs.Crs.CrsCod > 0 || // Course selected
Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT);// Surveys not available for unknown users and guests Gbl.Usrs.Me.LoggedRole >= Rol_STD);// Surveys not available for unknown users and guests
case TabFil: case TabFil:
return (Gbl.CurrentIns.Ins.InsCod > 0); // Institution selected return (Gbl.CurrentIns.Ins.InsCod > 0); // Institution selected
default: default:

View File

@ -302,10 +302,10 @@ void Tst_ShowFormAskTst (void)
/***** Put link to view tests results *****/ /***** Put link to view tests results *****/
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
Tst_PutFormToViewResultsOfUsersTests (ActReqSeeMyTstRes); Tst_PutFormToViewResultsOfUsersTests (ActReqSeeMyTstRes);
break; break;
case Rol_TEACHER: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
Tst_PutFormToViewResultsOfUsersTests (ActReqSeeUsrTstRes); Tst_PutFormToViewResultsOfUsersTests (ActReqSeeUsrTstRes);
break; break;
@ -475,7 +475,7 @@ void Tst_ShowNewTest (void)
Tst_SetTstStatus (NumAccessesTst,Tst_STATUS_SHOWN_BUT_NOT_ASSESSED); Tst_SetTstStatus (NumAccessesTst,Tst_STATUS_SHOWN_BUT_NOT_ASSESSED);
/***** Update date-time of my next allowed access to test *****/ /***** Update date-time of my next allowed access to test *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
Tst_UpdateLastAccTst (); Tst_UpdateLastAccTst ();
} }
@ -647,7 +647,7 @@ static bool Tst_CheckIfNextTstAllowed (void)
time_t TimeNextTestUTC = (time_t) 0; time_t TimeNextTestUTC = (time_t) 0;
/***** Teachers and superusers are allowed to do all tests they want *****/ /***** Teachers and superusers are allowed to do all tests they want *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || if (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
return true; return true;
@ -934,7 +934,7 @@ static void Tst_ShowTestResultAfterAssess (long TstCod,unsigned *NumQstsNotBlank
(*NumQstsNotBlank)++; (*NumQstsNotBlank)++;
/***** Update the number of accesses and the score of this question *****/ /***** Update the number of accesses and the score of this question *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
Tst_UpdateScoreQst (QstCod,ScoreThisQst,AnswerIsNotBlank); Tst_UpdateScoreQst (QstCod,ScoreThisQst,AnswerIsNotBlank);
} }
else else
@ -1321,7 +1321,7 @@ void Tst_ShowFormAskEditTsts (void)
static bool Tst_CheckIfICanEditTests (void) static bool Tst_CheckIfICanEditTests (void)
{ {
return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
} }
@ -6967,10 +6967,10 @@ void Tst_SelUsrsToSeeUsrsTestResults (void)
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order lists of users from this course *****/ /***** Get and order lists of users from this course *****/
Usr_GetListUsrs (Rol_TEACHER,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_TCH,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs + NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
/***** Start frame *****/ /***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_Test_results, Lay_StartRoundFrame (NULL,Txt_Test_results,
@ -7000,8 +7000,8 @@ void Tst_SelUsrsToSeeUsrsTestResults (void)
The_ClassForm[Gbl.Prefs.Theme],Txt_Users, The_ClassForm[Gbl.Prefs.Theme],Txt_Users,
The_ClassForm[Gbl.Prefs.Theme]); The_ClassForm[Gbl.Prefs.Theme]);
Lay_StartTable (2); Lay_StartTable (2);
Usr_ListUsersToSelect (Rol_TEACHER); Usr_ListUsersToSelect (Rol_TCH);
Usr_ListUsersToSelect (Rol_STUDENT); Usr_ListUsersToSelect (Rol_STD);
Lay_EndTable (); Lay_EndTable ();
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
@ -7019,14 +7019,14 @@ void Tst_SelUsrsToSeeUsrsTestResults (void)
} }
} }
else else
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN); Usr_ShowWarningNoUsersFound (Rol_UNK);
/***** End frame *****/ /***** End frame *****/
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
/***** Free memory for users' list *****/ /***** Free memory for users' list *****/
Usr_FreeUsrsList (Rol_TEACHER); Usr_FreeUsrsList (Rol_TCH);
Usr_FreeUsrsList (Rol_STUDENT); Usr_FreeUsrsList (Rol_STD);
/***** Free memory used by list of selected users' codes *****/ /***** Free memory used by list of selected users' codes *****/
Usr_FreeListsSelectedUsrsCods (); Usr_FreeListsSelectedUsrsCods ();
@ -7298,12 +7298,12 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat)
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
ICanViewTest = ItsMe; ICanViewTest = ItsMe;
ICanViewScore = ItsMe && ICanViewScore = ItsMe &&
Gbl.Test.Config.FeedbackType != Tst_FEEDBACK_NOTHING; Gbl.Test.Config.FeedbackType != Tst_FEEDBACK_NOTHING;
break; break;
case Rol_TEACHER: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
case Rol_INS_ADM: case Rol_INS_ADM:
@ -7422,11 +7422,11 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat)
/***** Write totals for this user *****/ /***** Write totals for this user *****/
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
ICanViewTotalScore = ItsMe && ICanViewTotalScore = ItsMe &&
Gbl.Test.Config.FeedbackType != Tst_FEEDBACK_NOTHING; Gbl.Test.Config.FeedbackType != Tst_FEEDBACK_NOTHING;
break; break;
case Rol_TEACHER: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
case Rol_INS_ADM: case Rol_INS_ADM:
@ -7543,7 +7543,7 @@ static void Tst_ShowDataUsr (struct UsrData *UsrDat,unsigned NumTestResults)
fprintf (Gbl.F.Out,"rowspan=\"%u\"",NumTestResults + 1); fprintf (Gbl.F.Out,"rowspan=\"%u\"",NumTestResults + 1);
fprintf (Gbl.F.Out," class=\"LEFT_TOP COLOR%u\">", fprintf (Gbl.F.Out," class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActSeeRecOneStd : Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActSeeRecOneStd :
ActSeeRecOneTch); ActSeeRecOneTch);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Act_LinkFormSubmit (UsrDat->FullName,"AUTHOR_TXT",NULL); Act_LinkFormSubmit (UsrDat->FullName,"AUTHOR_TXT",NULL);
@ -7620,7 +7620,7 @@ void Tst_ShowOneTestResult (void)
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: case Rol_STD:
ICanViewTest = ItsMe; ICanViewTest = ItsMe;
if (ItsMe) if (ItsMe)
{ {
@ -7630,7 +7630,7 @@ void Tst_ShowOneTestResult (void)
else else
ICanViewScore = false; ICanViewScore = false;
break; break;
case Rol_TEACHER: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
case Rol_INS_ADM: case Rol_INS_ADM:

File diff suppressed because it is too large Load Diff

View File

@ -340,10 +340,10 @@ void TT_ShowClassTimeTable (void)
Gbl.TimeTable.ContextualIcons.PutIconEditCrsTT = (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE && Gbl.TimeTable.ContextualIcons.PutIconEditCrsTT = (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE &&
!PrintView && !PrintView &&
Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER); Gbl.Usrs.Me.LoggedRole >= Rol_TCH);
Gbl.TimeTable.ContextualIcons.PutIconEditOfficeHours = (Gbl.TimeTable.Type == TT_MY_TIMETABLE && Gbl.TimeTable.ContextualIcons.PutIconEditOfficeHours = (Gbl.TimeTable.Type == TT_MY_TIMETABLE &&
!PrintView && !PrintView &&
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_TEACHER))); (Gbl.Usrs.Me.AvailableRoles & (1 << Rol_TCH)));
Gbl.TimeTable.ContextualIcons.PutIconPrint = !PrintView; Gbl.TimeTable.ContextualIcons.PutIconPrint = !PrintView;
/***** Get whether to show only my groups or all groups *****/ /***** Get whether to show only my groups or all groups *****/

File diff suppressed because it is too large Load Diff

View File

@ -172,20 +172,20 @@ typedef enum
/* Translation from service-web-role to swad-core-role */ /* Translation from service-web-role to swad-core-role */
Rol_Role_t Svc_SvcRole_to_RolRole[Svc_NUM_ROLES] = Rol_Role_t Svc_SvcRole_to_RolRole[Svc_NUM_ROLES] =
{ {
Rol_UNKNOWN, // Svc_ROLE_UNKNOWN Rol_UNK, // Svc_ROLE_UNKNOWN
Rol__GUEST_, // Svc_ROLE__GUEST_ Rol_GST, // Svc_ROLE__GUEST_
Rol_STUDENT, // Svc_ROLE_STUDENT Rol_STD, // Svc_ROLE_STUDENT
Rol_TEACHER, // Svc_ROLE_TEACHER Rol_TCH, // Svc_ROLE_TEACHER
}; };
/* Translation from swad-core-role to service-web-role */ /* Translation from swad-core-role to service-web-role */
Svc_Role_t Svc_RolRole_to_SvcRole[Rol_NUM_ROLES] = Svc_Role_t Svc_RolRole_to_SvcRole[Rol_NUM_ROLES] =
{ {
Svc_ROLE_UNKNOWN, // Rol_UNKNOWN Svc_ROLE_UNKNOWN, // Rol_UNK
Svc_ROLE__GUEST_, // Rol__GUEST_ Svc_ROLE__GUEST_, // Rol_GST
Svc_ROLE_UNKNOWN, // Rol_VISITOR Svc_ROLE_UNKNOWN, // Rol_USR
Svc_ROLE_STUDENT, // Rol_STUDENT Svc_ROLE_STUDENT, // Rol_STD
Svc_ROLE_TEACHER, // Rol_TEACHER Svc_ROLE_TEACHER, // Rol_TCH
Svc_ROLE_UNKNOWN, // Rol_DEG_ADM Svc_ROLE_UNKNOWN, // Rol_DEG_ADM
Svc_ROLE_UNKNOWN, // Rol_CTR_ADM Svc_ROLE_UNKNOWN, // Rol_CTR_ADM
Svc_ROLE_UNKNOWN, // Rol_INS_ADM Svc_ROLE_UNKNOWN, // Rol_INS_ADM
@ -592,13 +592,13 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
if (row[0]) if (row[0])
{ {
if (sscanf (row[0],"%u",&UsrDat->RoleInCurrentCrsDB) != 1) if (sscanf (row[0],"%u",&UsrDat->RoleInCurrentCrsDB) != 1)
UsrDat->RoleInCurrentCrsDB = Rol_UNKNOWN; UsrDat->RoleInCurrentCrsDB = Rol_UNK;
} }
else // Impossible else // Impossible
UsrDat->RoleInCurrentCrsDB = Rol_UNKNOWN; UsrDat->RoleInCurrentCrsDB = Rol_UNK;
} }
else // User does not belong to course else // User does not belong to course
UsrDat->RoleInCurrentCrsDB = Rol_VISITOR; UsrDat->RoleInCurrentCrsDB = Rol_USR;
} }
else else
{ {
@ -612,14 +612,14 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
if (row[0]) if (row[0])
{ {
if (sscanf (row[0],"%u",&UsrDat->RoleInCurrentCrsDB) != 1) if (sscanf (row[0],"%u",&UsrDat->RoleInCurrentCrsDB) != 1)
UsrDat->RoleInCurrentCrsDB = Rol_UNKNOWN; UsrDat->RoleInCurrentCrsDB = Rol_UNK;
} }
else else
// MAX(Role) == NULL if user does not belong to any course // MAX(Role) == NULL if user does not belong to any course
UsrDat->RoleInCurrentCrsDB = Rol__GUEST_; UsrDat->RoleInCurrentCrsDB = Rol_GST;
} }
else // Impossible else // Impossible
UsrDat->RoleInCurrentCrsDB = Rol__GUEST_; UsrDat->RoleInCurrentCrsDB = Rol_GST;
} }
/* Free structure that stores the query result */ /* Free structure that stores the query result */
@ -974,7 +974,7 @@ int swad__loginBySessionKey (struct soap *soap,
loginBySessionKeyOut->userSurname2[0] = '\0'; loginBySessionKeyOut->userSurname2[0] = '\0';
loginBySessionKeyOut->userPhoto[0] = '\0'; loginBySessionKeyOut->userPhoto[0] = '\0';
loginBySessionKeyOut->userBirthday[0] = '\0'; loginBySessionKeyOut->userBirthday[0] = '\0';
loginBySessionKeyOut->userRole = Rol_UNKNOWN; loginBySessionKeyOut->userRole = Rol_UNK;
loginBySessionKeyOut->degreeName[0] = '\0'; loginBySessionKeyOut->degreeName[0] = '\0';
loginBySessionKeyOut->courseName[0] = '\0'; loginBySessionKeyOut->courseName[0] = '\0';
@ -1235,7 +1235,7 @@ int swad__getCourses (struct soap *soap,
/* Get role (row[3]) */ /* Get role (row[3]) */
if (sscanf (row[3],"%u",&Role) != 1) // Role in this course if (sscanf (row[3],"%u",&Role) != 1) // Role in this course
Role = Rol_UNKNOWN; Role = Rol_UNK;
getCoursesOut->coursesArray.__ptr[NumRow].userRole = Svc_RolRole_to_SvcRole[Role]; getCoursesOut->coursesArray.__ptr[NumRow].userRole = Svc_RolRole_to_SvcRole[Role];
} }
} }
@ -1308,8 +1308,8 @@ int swad__getCourseInfo (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1412,8 +1412,8 @@ int swad__getUsers (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1491,8 +1491,8 @@ int swad__findUsers (struct soap *soap,
if (Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.CurrentCrs.Crs.CrsCod > 0)
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1651,8 +1651,8 @@ int swad__getGroupTypes (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1759,8 +1759,8 @@ int swad__getGroups (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1885,8 +1885,8 @@ int swad__sendMyGroups (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -2100,7 +2100,7 @@ int swad__getAttendanceEvents (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -2304,7 +2304,7 @@ int swad__sendAttendanceEvent (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -2425,7 +2425,7 @@ int swad__removeAttendanceEvent (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -2521,7 +2521,7 @@ int swad__getAttendanceUsers (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -2543,7 +2543,7 @@ int swad__getAttendanceUsers (struct soap *soap,
" AND crs_grp_usr.UsrCod NOT IN" " AND crs_grp_usr.UsrCod NOT IN"
" (SELECT UsrCod FROM att_usr WHERE AttCod=%ld)", " (SELECT UsrCod FROM att_usr WHERE AttCod=%ld)",
Att.AttCod, Att.AttCod,
(unsigned) Rol_STUDENT, (unsigned) Rol_STD,
Att.AttCod); Att.AttCod);
else else
// Event for the whole course // Event for the whole course
@ -2557,7 +2557,7 @@ int swad__getAttendanceUsers (struct soap *soap,
" AND crs_usr.UsrCod NOT IN" " AND crs_usr.UsrCod NOT IN"
" (SELECT UsrCod FROM att_usr WHERE AttCod=%ld)", " (SELECT UsrCod FROM att_usr WHERE AttCod=%ld)",
Att.AttCod, Att.AttCod,
(unsigned) Rol_STUDENT, (unsigned) Rol_STD,
Att.AttCod); Att.AttCod);
// Query: list of users in attendance list + rest of users (subquery) // Query: list of users in attendance list + rest of users (subquery)
sprintf (Query,"SELECT u.UsrCod,u.Present FROM " sprintf (Query,"SELECT u.UsrCod,u.Present FROM "
@ -2709,7 +2709,7 @@ int swad__sendAttendanceUsers (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -3449,7 +3449,7 @@ int swad__sendNotice (struct soap *soap,
return ReturnCode; return ReturnCode;
/***** Check if I am a teacher *****/ /***** Check if I am a teacher *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -3515,8 +3515,8 @@ int swad__getTestConfig (struct soap *soap,
"Course code must be a integer greater than 0"); "Course code must be a integer greater than 0");
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -3646,8 +3646,8 @@ int swad__getTests (struct soap *soap,
"Course code must be a integer greater than 0"); "Course code must be a integer greater than 0");
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -4278,8 +4278,8 @@ int swad__getDirectoryTree (struct soap *soap,
return ReturnCode; return ReturnCode;
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -4595,8 +4595,8 @@ int swad__getFile (struct soap *soap,
return ReturnCode; return ReturnCode;
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -4619,7 +4619,7 @@ int swad__getFile (struct soap *soap,
case Brw_ADMI_MARKS_CRS: case Brw_ADMI_MARKS_CRS:
case Brw_ADMI_MARKS_GRP: case Brw_ADMI_MARKS_GRP:
// Downloading a file of marks is only allowed for teachers // Downloading a file of marks is only allowed for teachers
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Wrong tree", "Wrong tree",
"Wrong file zone"); "Wrong file zone");
@ -4737,8 +4737,8 @@ int swad__getMarks (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB; Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/ /***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT && if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER) Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");