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 *****/
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 */
if (UsrDat->UsrCod <= 0) // User does not exist (when creating a new user)
return true;
/* 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
return true;
@ -450,8 +450,8 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID,
extern const char *Txt_Confirm_ID;
/***** Start form *****/
Act_FormStartAnchor ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActCnfID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActCnfID_Tch :
Act_FormStartAnchor ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActCnfID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActCnfID_Tch :
ActCnfID_Oth),
Anchor);
if (Gbl.Action.Original != ActUnk)
@ -498,8 +498,8 @@ void ID_PutLinkToChangeUsrIDs (void)
Txt_Change_IDs,Txt_Change_IDs,
NULL);
else // Not me
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActFrmIDsStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActFrmIDsTch :
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActFrmIDsStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActFrmIDsTch :
ActFrmIDsOth), // Guest, visitor or admin
NULL,Usr_PutParamOtherUsrCodEncrypted,
"arroba64x64.gif",
@ -587,8 +587,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActRemID_Me);
else
{
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActRemID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActRemID_Tch :
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActRemID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActRemID_Tch :
ActRemID_Oth)); // Guest, visitor or admin
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
}
@ -641,8 +641,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActNewIDMe);
else
{
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActNewID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActNewID_Tch :
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActNewID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActNewID_Tch :
ActNewID_Oth)); // Guest, visitor or admin
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\">",
Gbl.RowEvenOdd);
UsrDat->Sex = Usr_SEX_UNKNOWN;
Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_TEACHER);
Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_STUDENT);
Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_TCH);
Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_STD);
fprintf (Gbl.F.Out,"</td>"
"</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,
the only action possible is to show a form to change my common record *****/
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 ||
(IAmATeacher && (Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 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 *****/
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;
Tab_SetCurrentTab ();
return;
@ -5120,7 +5120,7 @@ void Act_AdjustCurrentAction (void)
/***** Depending on the role I am logged... *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_STD:
switch (Gbl.Action.Act)
{
case ActLogIn:
@ -5154,7 +5154,7 @@ void Act_AdjustCurrentAction (void)
/* If I have no photo, and current action is not available for unknown users,
then update number of clicks without photo */
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...
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
Gbl.CurrentCrs.Info.ShowMsgMustBeRead = Inf_GetIfIMustReadAnyCrsInfoInThisCrs ();
break;
case Rol_TEACHER:
case Rol_TCH:
if (Gbl.Action.Act == ActReqTst ||
Gbl.Action.Act == ActEdiTstQst)
/***** 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 "
" ORDER BY AnnCod DESC",
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,
(unsigned) (1 << Rol_UNKNOWN));
(unsigned) (1 << Rol_UNK));
NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements");
/***** Start frame *****/
@ -343,8 +343,8 @@ static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status,
/* Users' roles who can view this announcement */
fprintf (Gbl.F.Out,"<p class=\"%s\">%s:",
UsersClass[Status],Txt_Users);
for (Role = Rol_UNKNOWN, SomeRolesAreSelected = false;
Role <= Rol_TEACHER;
for (Role = Rol_UNK, SomeRolesAreSelected = false;
Role <= Rol_TCH;
Role++)
if (Roles & (1 << Role))
{
@ -425,14 +425,14 @@ void Ann_ShowFormAnnouncement (void)
"<td class=\"DAT LEFT_TOP\">",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Users);
Rol_WriteSelectorRoles (1 << Rol_UNKNOWN |
1 << Rol__GUEST_ |
1 << Rol_STUDENT |
1 << Rol_TEACHER,
1 << Rol_UNKNOWN |
1 << Rol__GUEST_ |
1 << Rol_STUDENT |
1 << Rol_TEACHER,
Rol_WriteSelectorRoles (1 << Rol_UNK |
1 << Rol_GST |
1 << Rol_STD |
1 << Rol_TCH,
1 << Rol_UNK |
1 << Rol_GST |
1 << Rol_STD |
1 << Rol_TCH,
false,false);
fprintf (Gbl.F.Out,"</td>"
"</tr>");

View File

@ -241,7 +241,7 @@ static void Asg_PutHeadForSeeing (bool PrintView)
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);
}
@ -508,7 +508,7 @@ static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView)
bool ICanSendFiles = !Asg->Hidden && // It's visible (not hidden)
Asg->Open && // It's open (inside dates)
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 *****/
if (!PrintView && // Not print view
@ -574,7 +574,7 @@ static void Asg_PutFormsToRemEditOneAsg (long AsgCod,bool Hidden)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
case Rol_SYS_ADM:
/***** Put form to remove assignment *****/
Lay_PutContextualIconToRemove (ActReqRemAsg,Asg_PutParams);
@ -588,7 +588,7 @@ static void Asg_PutFormsToRemEditOneAsg (long AsgCod,bool Hidden)
/***** Put form to edit assignment *****/
Lay_PutContextualIconToEdit (ActEdiOneAsg,Asg_PutParams);
// no break
case Rol_STUDENT:
case Rol_STD:
/***** Put form to print assignment *****/
Lay_PutContextualIconToPrint (ActPrnOneAsg,Asg_PutParams);
break;
@ -630,7 +630,7 @@ void Asg_GetListAssignments (void)
/***** Get list of assignments from database *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
case Rol_SYS_ADM:
HiddenSubQuery[0] = '\0';
break;
@ -1713,8 +1713,8 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod)
{
char Query[512];
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ||
Gbl.Usrs.Me.LoggedRole == Rol_TEACHER)
if (Gbl.Usrs.Me.LoggedRole == Rol_STD ||
Gbl.Usrs.Me.LoggedRole == Rol_TCH)
{
// Students and teachers can edit assignments depending on groups
/***** 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);
}
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)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_STD:
Att_PutFormToListMyAttendance ();
break;
case Rol_TEACHER:
case Rol_TCH:
case Rol_SYS_ADM:
Att_PutFormToListStdsAttendance ();
break;
@ -203,7 +203,7 @@ static void Att_ShowAllAttEvents (void)
Dat_StartEndTime_t Order;
struct Pagination Pagination;
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);
/***** Compute variables related to pagination *****/
@ -261,7 +261,7 @@ static void Att_ShowAllAttEvents (void)
"</th>"
"</tr>",
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 *****/
for (NumAttEvent = Pagination.FirstItemVisible, Gbl.RowEvenOdd = 0;
@ -372,7 +372,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
Gbl.RowEvenOdd);
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
case Rol_SYS_ADM:
Att_PutFormsToRemEditOneAttEvent (Att->AttCod,Att->Hidden);
break;
@ -597,7 +597,7 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order)
/***** Get list of attendance events from database *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
case Rol_SYS_ADM:
HiddenSubQuery[0] = '\0';
break;
@ -1819,10 +1819,10 @@ void Att_SeeOneAttEvent (void)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_STD:
Att_ListAttOnlyMeAsStudent (&Att);
break;
case Rol_TEACHER:
case Rol_TCH:
case Rol_SYS_ADM:
/***** Show list of students *****/
Att_ListAttStudents (&Att);
@ -1874,7 +1874,7 @@ static void Att_ListAttOnlyMeAsStudent (struct AttendanceEvent *Att)
"%s"
"</th>"
"</tr>",
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
Txt_ROLES_SINGUL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Txt_Student_comment,
Txt_Teachers_comment);
@ -1912,7 +1912,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** 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 *****/
Lay_StartRoundFrame (NULL,Txt_Attendance,NULL,Hlp_USERS_Attendance);
@ -1920,7 +1920,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
/***** Form to select groups *****/
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 *****/
Usr_GetMyPrefAboutListWithPhotosFromDB ();
@ -1952,17 +1952,17 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
"%s"
"</th>"
"</tr>",
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
Txt_ROLES_SINGUL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Txt_Student_comment,
Txt_Teachers_comment);
/* List of students */
for (NumStd = 0, Gbl.RowEvenOdd = 0;
NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumStd < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
NumStd++)
{
/* 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 */
ID_GetListIDsFromUsrCod (&UsrDat);
@ -1982,13 +1982,13 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
Usr_UsrDataDestructor (&UsrDat);
}
else
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
Usr_ShowWarningNoUsersFound (Rol_STD);
/***** End frame *****/
Lay_EndRoundFrame ();
/***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT);
Usr_FreeUsrsList (Rol_STD);
/***** Free memory for list of selected groups *****/
Grp_FreeListCodSelectedGrps ();
@ -2036,7 +2036,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
UsrDat->EncryptedUsrCod);
if (Present) // This student has attended to the event?
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," />"
"</td>");
@ -2084,7 +2084,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
/***** Student's comment: write form or text */
fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL LEFT_TOP COLOR%u\">",
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\""
" cols=\"40\" rows=\"3\">"
"%s"
@ -2101,7 +2101,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
/***** Teacher's comment: write form, text or nothing */
fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL LEFT_TOP COLOR%u\">",
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\""
" cols=\"40\" rows=\"3\">"
"%s"
@ -2219,12 +2219,12 @@ void Att_RegisterMeAsStdInAttEvent (void)
/***************** Save students who attended to an event ********************/
/*****************************************************************************/
/* 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
3. Get list of students marked as present by me: Gbl.Usrs.Select.Std
4. Loop over the list Gbl.Usrs.Select.Std,
that holds the list of the students marked as present,
marking the students in Gbl.Usrs.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
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 *****/
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 */
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 *****/
for (NumStd = 0;
NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumStd < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
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 *****/
Usr_GetListsSelectedUsrsCods ();
@ -2272,7 +2272,7 @@ void Att_RegisterStudentsInAttEvent (void)
/***** 4. Loop over the list Gbl.Usrs.Select.Std,
that holds the list of the students marked as present,
marking the students in Gbl.Usrs.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;
while (*Ptr)
{
@ -2282,11 +2282,11 @@ void Att_RegisterStudentsInAttEvent (void)
if (UsrData.UsrCod > 0) // Student exists in database
/***** Mark student to not be removed *****/
for (NumStd = 0;
NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumStd < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
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
}
}
@ -2301,25 +2301,25 @@ void Att_RegisterStudentsInAttEvent (void)
// 5. Delete from att_usr all the students marked as Remove=true
// 6. Replace (insert without duplicated) into att_usr all the students marked as Remove=false
for (NumStd = 0, NumStdsAbsent = NumStdsPresent = 0;
NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumStd < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
NumStd++)
{
/***** Get comments for this student *****/
Att_CheckIfUsrIsPresentInAttEventAndGetComments (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod,CommentStd,CommentTch);
sprintf (CommentParamName,"CommentTch%ld",Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd].UsrCod);
Att_CheckIfUsrIsPresentInAttEventAndGetComments (Att.AttCod,Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].UsrCod,CommentStd,CommentTch);
sprintf (CommentParamName,"CommentTch%ld",Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].UsrCod);
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 ||
CommentStd[0] ||
CommentTch[0])
/***** 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);
else
/***** 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)
NumStdsPresent++;
@ -2328,7 +2328,7 @@ void Att_RegisterStudentsInAttEvent (void)
}
/***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT);
Usr_FreeUsrsList (Rol_STD);
/***** Write final message *****/
sprintf (Format,"%s: %%u<br />%s: %%u",Txt_Presents,Txt_Absents);
@ -2336,9 +2336,9 @@ void Att_RegisterStudentsInAttEvent (void)
NumStdsPresent,NumStdsAbsent);
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 *****/
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
Usr_ShowWarningNoUsersFound (Rol_STD);
/***** Show the attendance event again *****/
Gbl.AttEvents.AttCod = Att.AttCod;
@ -2608,18 +2608,18 @@ void Usr_ReqListStdsAttendanceCrs (void)
Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** 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 *****/
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);
/***** Form to select groups *****/
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 *****/
Usr_GetListsSelectedUsrsCods ();
@ -2634,7 +2634,7 @@ void Usr_ReqListStdsAttendanceCrs (void)
/* Write list of students to select some of them */
Lay_StartTableCenter (0);
Usr_ListUsersToSelect (Rol_STUDENT);
Usr_ListUsersToSelect (Rol_STD);
Lay_EndTable ();
/* Send button */
@ -2648,13 +2648,13 @@ void Usr_ReqListStdsAttendanceCrs (void)
}
}
else
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
Usr_ShowWarningNoUsersFound (Rol_STD);
/***** End frame *****/
Lay_EndRoundFrame ();
/***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT);
Usr_FreeUsrsList (Rol_STD);
/***** Free memory for list of selected groups *****/
Grp_FreeListCodSelectedGrps ();
@ -3049,7 +3049,7 @@ static void Att_ListEventsToSelect (Att_TypeOfView_t TypeOfView)
"</th>"
"</tr>",
Txt_Event,
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]);
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN]);
/***** List the events *****/
for (NumAttEvent = 0, UniqueId = 1, Gbl.RowEvenOdd = 0;
@ -3232,7 +3232,7 @@ static void Att_WriteTableHeadSeveralAttEvents (void)
"</th>",
Gbl.Usrs.Listing.WithPhotos ? 4 :
3,
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]);
Txt_ROLES_SINGUL_Abc[Rol_STD][Usr_SEX_UNKNOWN]);
for (NumAttEvent = 0;
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);
ShowCommentStd = CommentStd[0];
ShowCommentTch = CommentTch[0] &&
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
(Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.AttEvents.Lst[NumAttEvent].CommentTchVisible);
/***** Write a row for this event *****/

View File

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

View File

@ -233,13 +233,14 @@
/****************************** 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 JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
Version 16.216: May 18, 2017 Role visitor is renamed as role user. (218867 lines)
Version 16.215.4: May 18, 2017 Changed layout of assignments.
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)

View File

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

View File

@ -354,7 +354,7 @@ void Con_ShowGlobalConnectedUsrs (void)
unsigned NumUsrsTotal;
/***** Get number of connected users *****/
for (Role = Rol__GUEST_, NumUsrsTotal = 0;
for (Role = Rol_GST, NumUsrsTotal = 0;
Role <= Rol_SYS_ADM;
Role++)
{
@ -392,7 +392,7 @@ void Con_ShowGlobalConnectedUsrs (void)
Txt_users[Usr_SEX_UNKNOWN]);
/***** 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++)
Con_ShowGlobalConnectedUsrsRole (Role,NumUsrs[Role]);
@ -433,10 +433,10 @@ void Con_ComputeConnectedUsrsBelongingToCurrentCrs (void)
Gbl.Scope.Current = Sco_SCOPE_CRS;
/***** Number of teachers *****/
Con_ComputeConnectedUsrsWithARoleBelongingToCurrentCrs (Rol_TEACHER);
Con_ComputeConnectedUsrsWithARoleBelongingToCurrentCrs (Rol_TCH);
/***** 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;\">");
/***** 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 ",
Usrs.NumUsrs,
Txt_from);
@ -481,10 +481,10 @@ static void Con_ShowConnectedUsrsBelongingToLocation (void)
/***** Number of teachers and students *****/
fprintf (Gbl.F.Out,"<table class=\"CONNECTED_LIST\">");
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_TEACHER);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_STUDENT);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_TCH);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_STD);
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol__GUEST_);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_GST);
fprintf (Gbl.F.Out,"</table>");
/***** End container *****/
@ -516,7 +516,7 @@ void Con_ShowConnectedUsrsBelongingToCurrentCrs (void)
Act_LinkFormSubmitUnique (Txt_Connected_users,"CONNECTED_TXT");
Str_Copy (CourseName,Gbl.CurrentCrs.Crs.ShrtName,
Hie_MAX_BYTES_SHRT_NAME);
Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_UNKNOWN,&Usrs);
Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_UNK,&Usrs);
fprintf (Gbl.F.Out,"%u %s %s"
"</a>",
Usrs.NumUsrs,Txt_from,CourseName);
@ -527,8 +527,8 @@ void Con_ShowConnectedUsrsBelongingToCurrentCrs (void)
Gbl.Usrs.Connected.NumUsr = 0;
Gbl.Usrs.Connected.NumUsrs = 0;
Gbl.Usrs.Connected.NumUsrsToList = 0;
Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Rol_TEACHER);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Rol_STUDENT);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Rol_TCH);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Rol_STD);
fprintf (Gbl.F.Out,"</table>");
/***** 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 *****/
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)
{
case Sco_SCOPE_SYS: // Show connected users in the whole platform
@ -754,15 +754,15 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
break;
}
break;
case Rol__GUEST_:
case Rol_GST:
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),"
"COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
" FROM connected,usr_data"
" WHERE connected.UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" AND connected.UsrCod=usr_data.UsrCod");
break;
case Rol_STUDENT:
case Rol_TEACHER:
case Rol_STD:
case Rol_TCH:
switch (Gbl.Scope.Current)
{
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 *****/
fprintf (Gbl.F.Out,"<td class=\"CON_USR_NARROW %s COLOR%u\">",
Font,Gbl.RowEvenOdd);
Act_FormStartUnique ((Role == Rol_STUDENT) ? ActSeeRecOneStd :
Act_FormStartUnique ((Role == Rol_STD) ? ActSeeRecOneStd :
ActSeeRecOneTch); // Must be unique because
// the list of connected users
// 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 *****/
switch (Role)
{
case Rol__GUEST_:
case Rol_GST:
sprintf (Query,"SELECT UsrCod,LastCrsCod,"
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(LastTime) AS Dif"
" FROM connected"
" WHERE UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" ORDER BY Dif");
break;
case Rol_STUDENT:
case Rol_TEACHER:
case Rol_STD:
case Rol_TCH:
switch (Gbl.Scope.Current)
{
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);
if (PutLinkToRecord)
{
Act_FormStart ((Role == Rol_STUDENT) ? ActSeeRecOneStd :
Act_FormStart ((Role == Rol_STD) ? ActSeeRecOneStd :
ActSeeRecOneTch);
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
}

View File

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

View File

@ -177,15 +177,15 @@ static void Crs_Configuration (bool PrintView)
unsigned Year;
int NumIndicatorsFromDB;
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];
/***** Messages and links above the frame *****/
if (!PrintView)
{
/* Link to request enrolment in the current course */
if (Gbl.Usrs.Me.LoggedRole == Rol__GUEST_ ||
Gbl.Usrs.Me.LoggedRole == Rol_VISITOR)
if (Gbl.Usrs.Me.LoggedRole == Rol_GST ||
Gbl.Usrs.Me.LoggedRole == Rol_USR)
{
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Enr_PutLinkToRequestSignUp ();
@ -437,7 +437,7 @@ static void Crs_Configuration (bool PrintView)
"</td>"
"</tr>",
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 *****/
fprintf (Gbl.F.Out,"<tr>"
@ -449,7 +449,7 @@ static void Crs_Configuration (bool PrintView)
"</td>"
"</tr>",
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 *****/
NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (Gbl.CurrentCrs.Crs.CrsCod);
@ -1167,7 +1167,7 @@ static void Crs_ListCourses (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 *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
Act_FormStart (ActNewCrs);
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_)
else if (Gbl.Usrs.Me.MaxRole >= Rol_GST)
Act_FormStart (ActReqCrs);
else
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);
/***** Get number of teachers *****/
Crs->NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,Crs->CrsCod);
Crs->NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,Crs->CrsCod);
/***** 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->NumTchs;
@ -2770,16 +2770,16 @@ void Crs_ContEditAfterChgCrs (void)
PutButtonToRequestRegistration = false;
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;
break;
case Rol_VISITOR:
case Rol_USR:
PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Degs.EditingCrs.CrsCod,
false);
break;
case Rol_STUDENT:
case Rol_TEACHER:
case Rol_STD:
case Rol_TCH:
if (Gbl.Degs.EditingCrs.CrsCod != Gbl.CurrentCrs.Crs.CrsCod)
PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Degs.EditingCrs.CrsCod,
@ -2960,8 +2960,8 @@ void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role)
unsigned NumCrs;
/***** Get courses of a user from database *****/
if (Role == Rol_UNKNOWN)
SubQuery[0] = '\0'; // Role == Rol_UNKNOWN ==> any role
if (Role == Rol_UNK)
SubQuery[0] = '\0'; // Role == Rol_UNK ==> any role
else
sprintf (SubQuery," AND crs_usr.Role=%u",(unsigned) Role);
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 */
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]);
fprintf (Gbl.F.Out,"<tr>"
"<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.");
/***** Get number of teachers and students in this course *****/
NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,CrsCod);
NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,CrsCod);
NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,CrsCod);
NumStds = Usr_GetNumUsrsInCrs (Rol_STD,CrsCod);
if (NumTchs + NumStds)
{
Style = "DAT_N";
@ -3254,7 +3254,7 @@ void Crs_UpdateCrsLast (void)
char Query[256];
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 *****/
sprintf (Query,"REPLACE INTO crs_last"

View File

@ -524,8 +524,8 @@ static void Deg_Configuration (bool PrintView)
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfDeg (Rol_TEACHER,Gbl.CurrentDeg.Deg.DegCod));
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfDeg (Rol_TCH,Gbl.CurrentDeg.Deg.DegCod));
/***** Number of students *****/
fprintf (Gbl.F.Out,"<tr>"
@ -537,8 +537,8 @@ static void Deg_Configuration (bool PrintView)
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfDeg (Rol_STUDENT,Gbl.CurrentDeg.Deg.DegCod));
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfDeg (Rol_STD,Gbl.CurrentDeg.Deg.DegCod));
}
/***** End table *****/
@ -927,7 +927,7 @@ static void Deg_PutFormToCreateDegree (void)
/***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
Act_FormStart (ActNewDeg);
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_)
else if (Gbl.Usrs.Me.MaxRole >= Rol_GST)
Act_FormStart (ActReqDeg);
else
Lay_ShowErrorAndExit ("You can not edit degrees.");
@ -1205,7 +1205,7 @@ static void Deg_ListDegrees (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 crs_usr.Role=%u"
" 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");
if (Degs->Num) // Degrees found...

View File

@ -180,7 +180,7 @@ void Dpt_SeeDepts (void)
"</tr>",
Txt_Department_unspecified,
Sta_GetTotalNumberOfUsersInCourses (Sco_SCOPE_INS,
Rol_TEACHER) - NumTchsInsWithDpt);
Rol_TCH) - NumTchsInsWithDpt);
/***** End table *****/
Lay_EndRoundFrameTable ();
@ -288,8 +288,8 @@ void Dpt_GetListDepartments (long InsCod)
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
" WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))"
" ORDER BY %s",
InsCod,(unsigned) Rol_TEACHER,
InsCod,(unsigned) Rol_TEACHER,
InsCod,(unsigned) Rol_TCH,
InsCod,(unsigned) Rol_TCH,
OrderBySubQuery);
else // All the departments
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"
" WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))"
" ORDER BY %s",
(unsigned) Rol_TEACHER,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
(unsigned) Rol_TCH,
OrderBySubQuery);
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"
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
" WHERE crs_usr.Role=%u AND crs_usr.UsrCod=usr_data.UsrCod))",
Dpt->DptCod,(unsigned) Rol_TEACHER,
Dpt->DptCod,(unsigned) Rol_TEACHER);
Dpt->DptCod,(unsigned) Rol_TCH,
Dpt->DptCod,(unsigned) Rol_TCH);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a department");
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 */
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 *****/
sprintf (Query,"REPLACE INTO usr_duplicated"
@ -225,7 +225,7 @@ void Dup_ListDuplicateUsrs (void)
}
else // There are no users
/***** Show warning indicating no users found *****/
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN);
Usr_ShowWarningNoUsersFound (Rol_UNK);
/***** End frame *****/
Lay_EndRoundFrame ();
@ -328,8 +328,8 @@ static void Dup_ListSimilarUsrs (void)
Prf_ShowDetailsUserProfile (&UsrDat);
/* Write all the courses this user belongs to */
Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_TEACHER);
Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_STUDENT);
Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_TCH);
Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_STD);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
@ -365,7 +365,7 @@ static void Dup_ListSimilarUsrs (void)
}
else // There are no users
/***** Show warning indicating no users found *****/
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN);
Usr_ShowWarningNoUsersFound (Rol_UNK);
/***** End frame *****/
Lay_EndRoundFrame ();

View File

@ -145,7 +145,7 @@ void Enr_PutButtonToEnrolStudents (void)
/***** Form to enrol several students *****/
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);
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 *****/
switch (NewRole)
{
case Rol_STUDENT:
case Rol_TEACHER:
case Rol_STD:
case Rol_TCH:
break;
default:
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 *****/
switch (NewRole)
{
case Rol_STUDENT:
case Rol_TEACHER:
case Rol_STD:
case Rol_TCH:
break;
default:
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 *****/
switch (NewRole)
{
case Rol_STUDENT:
case Rol_STD:
NotifyEvent = Ntf_EVENT_ENROLMENT_STUDENT;
break;
case Rol_TEACHER:
case Rol_TCH:
NotifyEvent = Ntf_EVENT_ENROLMENT_TEACHER;
break;
default:
@ -365,13 +365,13 @@ void Enr_ReqAcceptRegisterInCrs (void)
Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt);
/***** 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);
Lay_PutCreateButtonInline (Txt_Confirm_my_enrolment);
Act_FormEnd ();
/***** 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);
Lay_PutRemoveButtonInline (Txt_Remove_me_from_this_course);
Act_FormEnd ();
@ -380,7 +380,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
Lay_EndRoundFrame ();
/***** 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,
-1L,Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
@ -520,12 +520,12 @@ void Enr_UpdateInstitutionCentreDepartment (void)
void Enr_ReqAdminStds (void)
{
Enr_ReqAdminUsrs (Rol_STUDENT);
Enr_ReqAdminUsrs (Rol_STD);
}
void Enr_ReqAdminTchs (void)
{
Enr_ReqAdminUsrs (Rol_TEACHER);
Enr_ReqAdminUsrs (Rol_TCH);
}
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)
{
case Rol__GUEST_:
Enr_AskIfRegRemMe (Rol__GUEST_);
case Rol_GST:
Enr_AskIfRegRemMe (Rol_GST);
break;
case Rol_STUDENT:
Enr_AskIfRegRemMe (Rol_STUDENT);
case Rol_STD:
Enr_AskIfRegRemMe (Rol_STD);
break;
case Rol_TEACHER:
case Rol_TCH:
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Role == Rol_STUDENT)
Enr_ShowFormRegRemSeveralUsrs (Rol_STUDENT);
Role == Rol_STD)
Enr_ShowFormRegRemSeveralUsrs (Rol_STD);
else
Enr_AskIfRegRemMe (Rol_TEACHER);
Enr_AskIfRegRemMe (Rol_TCH);
break;
case Rol_DEG_ADM:
case Rol_CTR_ADM:
@ -582,7 +582,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
extern const char *Txt_Confirm;
/***** 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.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 *****/
Act_FormStart (Role == Rol_STUDENT ? ActRcvFrmEnrSevStd :
Act_FormStart (Role == Rol_STD ? ActRcvFrmEnrSevStd :
ActRcvFrmEnrSevTch);
/***** Start frame *****/
Lay_StartRoundFrame (NULL,
Role == Rol_STUDENT ? Txt_Administer_multiple_students :
Role == Rol_STD ? Txt_Administer_multiple_students :
Txt_Administer_multiple_teachers,
NULL,
Hlp_USERS_Administration_administer_multiple_users);
@ -893,7 +893,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user in course / Modify user's data *****/
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 :
Txt_Modify_user_in_the_course_X) :
@ -1002,7 +1002,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
}
/***** 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>"
"<label>"
@ -1242,12 +1242,12 @@ static void Enr_PutActionsRegRemSeveralUsrs (void)
void Enr_ReceiveFormAdminStds (void)
{
Enr_ReceiveFormUsrsCrs (Rol_STUDENT);
Enr_ReceiveFormUsrsCrs (Rol_STD);
}
void Enr_ReceiveFormAdminTchs (void)
{
Enr_ReceiveFormUsrsCrs (Rol_TEACHER);
Enr_ReceiveFormUsrsCrs (Rol_TCH);
}
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 *****/
switch (Role)
{
case Rol_STUDENT:
case Rol_STD:
break;
case Rol_TEACHER:
case Rol_TCH:
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)
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 *****/
if (WhatToDo.RegisterUsrs &&
Role == Rol_STUDENT &&
Role == Rol_STD &&
LstGrps.NumGrps >= 2)
/* Check if I have selected more than one group of single enrolment */
if (!Grp_CheckIfSelectionGrpsIsValid (&LstGrps))
@ -1395,7 +1395,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
if (WhatToDo.RemoveUsrs)
{
/***** 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)
{
@ -1673,8 +1673,8 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered)
{
/***** Check if I can register this user *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER &&
RegRemRole != Rol_STUDENT)
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH &&
RegRemRole != Rol_STD)
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 *****/
@ -1745,7 +1745,7 @@ void Enr_AskRemAllStdsThisCrs (void)
Lay_StartRoundFrame (NULL,Txt_Remove_all_students,NULL,
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 *****/
/* Start alert */
@ -1765,7 +1765,7 @@ void Enr_AskRemAllStdsThisCrs (void)
}
else
/***** Show warning indicating no students found *****/
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
Usr_ShowWarningNoUsersFound (Rol_STD);
/***** End frame *****/
Lay_EndRoundFrame ();
@ -1790,7 +1790,7 @@ void Enr_RemAllStdsThisCrs (void)
}
else
/***** 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 *****/
Gbl.Usrs.ClassPhoto.AllGroups = true; // Get all the students of the current course
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
NumStdsInCrs = Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumStdsInCrs = Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
/***** Remove all the students *****/
for (NumUsr = 0;
NumUsr < NumStdsInCrs;
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_REMOVE_WORKS,Cns_QUIET);
}
/***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT);
Usr_FreeUsrsList (Rol_STD);
return NumStdsInCrs;
}
@ -1835,15 +1835,15 @@ void Enr_ReqSignUpInCrs (void)
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
/***** 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,
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt);
}
else if (Gbl.Usrs.Me.LoggedRole == Rol__GUEST_ ||
Gbl.Usrs.Me.LoggedRole == Rol_VISITOR)
else if (Gbl.Usrs.Me.LoggedRole == Rol_GST ||
Gbl.Usrs.Me.LoggedRole == Rol_USR)
/***** Show form to modify only the user's role or the user's data *****/
Rec_ShowFormSignUpWithMySharedRecord ();
else
@ -1866,7 +1866,7 @@ void Enr_SignUpInCrs (void)
long ReqCod = -1L;
/***** 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,
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",
0,
Rol_NUM_ROLES - 1,
(unsigned long) Rol_UNKNOWN);
(unsigned long) Rol_UNK);
/* Check if role is correct */
if (!(RoleFromForm == Rol_STUDENT ||
RoleFromForm == Rol_TEACHER))
if (!(RoleFromForm == Rol_STD ||
RoleFromForm == Rol_TCH))
Lay_ShowErrorAndExit ("Wrong role.");
/***** 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 *****/
// 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 (Gbl.CurrentCrs.Crs.NumTchs || RoleFromForm == Rol_TEACHER)
if (Gbl.CurrentCrs.Crs.NumTchs || RoleFromForm == Rol_TCH)
Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_ENROLMENT_REQUEST,ReqCod);
}
}
@ -2032,8 +2032,8 @@ void Enr_AskIfRejectSignUp (void)
else // User does not belong to this course
{
Role = Rol_GetRequestedRole (Gbl.Usrs.Other.UsrDat.UsrCod);
if (Role == Rol_STUDENT ||
Role == Rol_TEACHER)
if (Role == Rol_STD ||
Role == Rol_TCH)
{
/***** Show question and button to reject user's enrolment request *****/
/* Start alert */
@ -2109,15 +2109,15 @@ void Enr_ShowEnrolmentRequests (void)
/***** Show enrolment request (default roles depend on my logged role) *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
Enr_ShowEnrolmentRequestsGivenRoles ((1 << Rol_STUDENT) |
(1 << Rol_TEACHER));
case Rol_TCH:
Enr_ShowEnrolmentRequestsGivenRoles ((1 << Rol_STD) |
(1 << Rol_TCH));
break;
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
case Rol_SYS_ADM:
Enr_ShowEnrolmentRequestsGivenRoles (1 << Rol_TEACHER);
Enr_ShowEnrolmentRequestsGivenRoles (1 << Rol_TCH);
break;
default:
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
@ -2216,8 +2216,8 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">",
The_ClassForm[Gbl.Prefs.Theme],Txt_Users);
Rol_WriteSelectorRoles (1 << Rol_STUDENT |
1 << Rol_TEACHER,
Rol_WriteSelectorRoles (1 << Rol_STD |
1 << Rol_TCH,
RolesSelected,
false,true);
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
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
// Requests in all courses in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod,"
@ -2247,7 +2247,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
RolesSelected);
break;
case Rol_DEG_ADM:
@ -2321,7 +2321,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_CTY: // Show requesters for the current country
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
// Requests in courses of this country in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod,"
@ -2340,7 +2340,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.CurrentCty.Cty.CtyCod,
RolesSelected);
break;
@ -2433,7 +2433,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_INS: // Show requesters for the current institution
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
// Requests in courses of this institution in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod,"
@ -2451,7 +2451,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.CurrentIns.Ins.InsCod,
RolesSelected);
break;
@ -2521,7 +2521,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_CTR: // Show requesters for the current centre
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
// Requests in courses of this centre in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod,"
@ -2538,7 +2538,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.CurrentCtr.Ctr.CtrCod,
RolesSelected);
break;
@ -2587,7 +2587,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_DEG: // Show requesters for the current degree
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
// Requests in courses of this degree in which I am teacher
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
"crs_usr_requests.CrsCod,"
@ -2603,7 +2603,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
" ORDER BY crs_usr_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.CurrentDeg.Deg.DegCod,
RolesSelected);
break;
@ -2633,7 +2633,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
case Sco_SCOPE_CRS: // Show requesters for the current course
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_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
@ -2722,8 +2722,8 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
if (UsrExists &&
!UsrBelongsToCrs &&
(DesiredRole == Rol_STUDENT ||
DesiredRole == Rol_TEACHER))
(DesiredRole == Rol_STD ||
DesiredRole == Rol_TCH))
{
/***** Number *****/
fprintf (Gbl.F.Out,"<tr>"
@ -2780,7 +2780,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
/***** Button to confirm the request *****/
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_TOP\">");
Act_FormStart (DesiredRole == Rol_STUDENT ? ActReqMdfStd :
Act_FormStart (DesiredRole == Rol_STD ? ActReqMdfStd :
ActReqMdfTch);
Crs_PutParamCrsCod (Crs.CrsCod);
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_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;
Lay_PutContextualLink (Role == Rol_STUDENT ? ActReqEnrSevStd :
Lay_PutContextualLink (Role == Rol_STD ? ActReqEnrSevStd :
ActReqEnrSevTch,
NULL,NULL,
"config64x64.gif",
@ -2925,17 +2925,17 @@ void Enr_PutLinkToAdminSeveralUsrs (Rol_Role_t Role)
void Enr_ReqRegRemOth (void)
{
Enr_ReqRegRemUsr (Rol__GUEST_);
Enr_ReqRegRemUsr (Rol_GST);
}
void Enr_ReqRegRemStd (void)
{
Enr_ReqRegRemUsr (Rol_STUDENT);
Enr_ReqRegRemUsr (Rol_STD);
}
void Enr_ReqRegRemTch (void)
{
Enr_ReqRegRemUsr (Rol_TEACHER);
Enr_ReqRegRemUsr (Rol_TCH);
}
static void Enr_ReqRegRemUsr (Rol_Role_t Role)
@ -2954,12 +2954,12 @@ static bool Enr_ICanAdminOtherUsrs (void)
{
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_UNKNOWN:
case Rol__GUEST_:
case Rol_VISITOR:
case Rol_STUDENT:
case Rol_UNK:
case Rol_GST:
case Rol_USR:
case Rol_STD:
return false;
case Rol_TEACHER:
case Rol_TCH:
// A teacher can be logged as teacher outside of his/her courses
// TODO: Teachers/students should be teachers/students only inside their courses
return (Gbl.CurrentCrs.Crs.CrsCod > 0);
@ -2986,8 +2986,8 @@ static void Enr_ReqAnotherUsrIDToRegisterRemove (Rol_Role_t Role)
Hlp_USERS_Administration_administer_one_user);
/***** Write form to request another user's ID *****/
Enr_WriteFormToReqAnotherUsrID ( Role == Rol_STUDENT ? ActReqMdfStd :
(Role == Rol_TEACHER ? ActReqMdfTch :
Enr_WriteFormToReqAnotherUsrID ( Role == Rol_STD ? ActReqMdfStd :
(Role == Rol_TCH ? ActReqMdfTch :
ActReqMdfOth));
/***** End frame *****/
@ -3017,17 +3017,17 @@ static void Enr_AskIfRegRemMe (Rol_Role_t Role)
void Enr_AskIfRegRemAnotherOth (void)
{
Enr_AskIfRegRemAnotherUsr (Rol__GUEST_);
Enr_AskIfRegRemAnotherUsr (Rol_GST);
}
void Enr_AskIfRegRemAnotherStd (void)
{
Enr_AskIfRegRemAnotherUsr (Rol_STUDENT);
Enr_AskIfRegRemAnotherUsr (Rol_STD);
}
void Enr_AskIfRegRemAnotherTch (void)
{
Enr_AskIfRegRemAnotherUsr (Rol_TEACHER);
Enr_AskIfRegRemAnotherUsr (Rol_TCH);
}
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
// An administrator can remove anyone
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));
if (ICanRemove)
switch (ReqDelOrDelUsr)
@ -3613,8 +3613,8 @@ void Enr_CreateNewUsr1 (void)
}
/***** Change current action *****/
Gbl.Action.Act = (NewRole == Rol_STUDENT) ? ActCreStd :
((NewRole == Rol_TEACHER) ? ActCreTch :
Gbl.Action.Act = (NewRole == Rol_STD) ? ActCreStd :
((NewRole == Rol_TCH) ? ActCreTch :
ActCreOth);
Tab_SetCurrentTab ();
}
@ -3678,7 +3678,7 @@ void Enr_ModifyUsr1 (void)
switch (Gbl.Usrs.RegRemAction)
{
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 *****/
if (Usr_ICanChangeOtherUsrData (&Gbl.Usrs.Other.UsrDat))
@ -3724,8 +3724,8 @@ void Enr_ModifyUsr1 (void)
}
/***** Change current action *****/
Gbl.Action.Act = (NewRole == Rol_STUDENT) ? ActUpdStd :
((NewRole == Rol_TEACHER) ? ActUpdTch :
Gbl.Action.Act = (NewRole == Rol_STD) ? ActUpdStd :
((NewRole == Rol_TCH) ? ActUpdTch :
ActUpdOth);
Tab_SetCurrentTab ();
}
@ -3746,11 +3746,11 @@ void Enr_ModifyUsr1 (void)
Gbl.Alert.Type = Ale_WARNING;
break;
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;
break;
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;
break;
case Enr_REMOVE_ONE_DEGREE_ADMIN:
@ -3884,7 +3884,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat,bool ItsMe)
Rec_ShowSharedRecordUnmodifiable (UsrDat);
/* Show form to request confirmation */
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActRemStdCrs :
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActRemStdCrs :
ActRemTchCrs);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Pwd_AskForConfirmationOnDangerousAction ();

View File

@ -549,7 +549,7 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx
MYSQL_ROW row;
unsigned long NumExaAnn;
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);
/***** 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)
{
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
{
/***** 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
{
0, // Rol_ROLE_UNKNOWN
0, // Rol_ROLE_GUEST__
0, // Rol_ROLE_VISITOR
32ULL*Brw_GiB, // Rol_ROLE_STUDENT
64ULL*Brw_GiB, // Rol_ROLE_TEACHER
0, // Rol_ROLE_DEG_ADM
0, // Rol_ROLE_CTR_ADM
0, // Rol_ROLE_INS_ADM
0, // Rol_ROLE_SYS_ADM
0, // Rol_UNK
0, // Rol_GST
0, // Rol_USR
32ULL*Brw_GiB, // Rol_STD
64ULL*Brw_GiB, // Rol_TCH
0, // Rol_DEG_ADM
0, // Rol_CTR_ADM
0, // Rol_INS_ADM
0, // Rol_SYS_ADM
};
#define Brw_MAX_FILES_BRIEF 5000
#define Brw_MAX_FOLDS_BRIEF 1000
@ -2081,7 +2081,7 @@ void Brw_GetParAndInitFileBrowser (void)
/***** Marks *****/
case ActSeeAdmMrk: // Access to a marks zone from menu
/* 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 :
Brw_SHOW_MARKS_CRS) :
(Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_ADMI_MARKS_GRP :
@ -3096,10 +3096,10 @@ void Brw_AskEditWorksCrs (void)
Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order lists of users from this course *****/
Usr_GetListUsrs (Rol_TEACHER,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
Usr_GetListUsrs (Rol_TCH,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
/***** Draw class photos to select users *****/
Lay_StartRoundFrame (NULL,Txt_Users,
@ -3123,8 +3123,8 @@ void Brw_AskEditWorksCrs (void)
/* Put list of users to select some of them */
Lay_StartTableCenter (0);
Usr_ListUsersToSelect (Rol_TEACHER);
Usr_ListUsersToSelect (Rol_STUDENT);
Usr_ListUsersToSelect (Rol_TCH);
Usr_ListUsersToSelect (Rol_STD);
Lay_EndTable ();
/* Send button */
@ -3135,14 +3135,14 @@ void Brw_AskEditWorksCrs (void)
}
}
else
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN);
Usr_ShowWarningNoUsersFound (Rol_UNK);
/***** End frame *****/
Lay_EndRoundFrame ();
/***** Free memory for users' list *****/
Usr_FreeUsrsList (Rol_TEACHER);
Usr_FreeUsrsList (Rol_STUDENT);
Usr_FreeUsrsList (Rol_TCH);
Usr_FreeUsrsList (Rol_STD);
/***** Free memory used by list of selected users' codes *****/
Usr_FreeListsSelectedUsrsCods ();
@ -3402,7 +3402,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
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);
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_HelpOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER];
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;
/***** Set title of file browser *****/
@ -3971,7 +3971,7 @@ static void Brw_WriteSubtitleOfFileBrowser (void)
break;
case Brw_SHOW_MARKS_CRS:
case Brw_SHOW_MARKS_GRP:
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)
if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
sprintf (Subtitle,"(%s)",
Txt_accessible_only_for_reading_by_you_and_the_teachers_of_the_course);
else
@ -5305,7 +5305,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,Brw_ExpandTree_t ExpandTree,
{
/***** Put icon to download ZIP of folder *****/
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
!(SeeDocsZone && RowSetAsHidden)) // When seeing docs, if folder is not hidden (this could happen for Level == 0)
ZIP_PutButtonToDownloadZIPOfAFolder (PathInTree,FileName);
@ -9022,7 +9022,7 @@ void Brw_ShowFileMetadata (void)
break;
case Brw_SHOW_DOCUM_CRS:
case Brw_SHOW_DOCUM_GRP:
if (Gbl.Usrs.Me.LoggedRole < Rol_TEACHER)
if (Gbl.Usrs.Me.LoggedRole < Rol_TCH)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
default:
@ -9139,7 +9139,7 @@ void Brw_ShowFileMetadata (void)
}
else
/* 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>"
"</tr>");
@ -9411,7 +9411,7 @@ void Brw_DownloadFile (void)
break;
case Brw_SHOW_DOCUM_CRS:
case Brw_SHOW_DOCUM_GRP:
if (Gbl.Usrs.Me.LoggedRole < Rol_TEACHER)
if (Gbl.Usrs.Me.LoggedRole < Rol_TCH)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
default:
@ -10852,18 +10852,18 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
return false;
/***** 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;
/***** Set depending on browser, level, logged role... *****/
switch (Gbl.FileBrowser.Type)
{
case Brw_ADMI_TEACH_CRS:
return (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER);
return (Gbl.Usrs.Me.LoggedRole >= Rol_TCH);
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 (Gbl.Usrs.Me.LoggedRole > Rol_TEACHER);
return (Gbl.Usrs.Me.LoggedRole > Rol_TCH);
case Brw_ADMI_SHARE_CRS:
case Brw_ADMI_SHARE_GRP:
// 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
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.Usrs.Me.LoggedRole >= Rol_TEACHER); // Teachers can edit
Gbl.Usrs.Me.LoggedRole >= Rol_TCH); // Teachers can edit
// inside open or closed assignments
default:
return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type];
@ -10903,7 +10903,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
return false;
/***** 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;
/***** 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
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.Usrs.Me.LoggedRole >= Rol_TEACHER); // Teachers can create
Gbl.Usrs.Me.LoggedRole >= Rol_TCH); // Teachers can create
// inside open or closed assignments
default:
return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type];
@ -10956,7 +10956,7 @@ static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
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 *****/
sprintf (Query,"SELECT DISTINCT(PublisherUsrCod) FROM files"
" WHERE FileBrowser=%u AND Cod=%ld"
@ -10979,7 +10979,7 @@ static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
DB_FreeMySQLResult (&mysql_res);
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_CTR_ADM:
case Rol_INS_ADM:
@ -11172,7 +11172,7 @@ void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
Txt_Filename,FileMetadata.FilFolLnkName,
Txt_Folder,FileMetadata.PathInTreeUntilFilFolLnk, // TODO: Fix bug: do not write internal name (for example "comun")
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 */
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);
break;
case For_FORUM_COURSE_USRS:
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER);
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_TCH);
break;
default:
ICanModerateForum = false;
@ -1828,7 +1828,7 @@ static void For_WriteLinksToGblForums (bool IsLastItemInLevel[1 + For_FORUM_MAX_
/***** Link to forum of teachers global *****/
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.Location = -1L;
@ -1852,7 +1852,7 @@ static void For_WriteLinksToPlatformForums (bool IsLastForum,
/***** Can I see teachers's forums? *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
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 *****/
Forum.Type = For_FORUM__SWAD__USRS;
@ -1887,7 +1887,7 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,
if (InsCod > 0)
{
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 *****/
Forum.Type = For_FORUM_INSTIT_USRS;
@ -1926,7 +1926,7 @@ static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,
if (CtrCod > 0)
{
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 *****/
Forum.Type = For_FORUM_CENTRE_USRS;
@ -1965,7 +1965,7 @@ static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,
if (DegCod > 0)
{
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 *****/
Forum.Type = For_FORUM_DEGREE_USRS;
@ -2004,7 +2004,7 @@ static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,
if (CrsCod > 0)
{
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 *****/
Forum.Type = For_FORUM_COURSE_USRS;
@ -3749,39 +3749,39 @@ static void For_RestrictAccess (void)
case For_FORUM_GLOBAL_TCHS:
case For_FORUM__SWAD__TCHS:
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;
case For_FORUM_INSTIT_USRS:
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;
case For_FORUM_INSTIT_TCHS:
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;
case For_FORUM_CENTRE_USRS:
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;
case For_FORUM_CENTRE_TCHS:
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;
case For_FORUM_DEGREE_USRS:
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;
case For_FORUM_DEGREE_TCHS:
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;
case For_FORUM_COURSE_USRS:
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;
case For_FORUM_COURSE_TCHS:
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;
default:
ICanSeeForum = false;

View File

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

View File

@ -343,7 +343,7 @@ void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction)
if (Gbl.CurrentCrs.Grps.NumGrps)
{
ICanEdit = !Gbl.Form.Inside &&
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
(Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
/***** Start frame *****/
@ -594,7 +594,7 @@ void Grp_ChangeMyGrps (void)
// ...is a radio-based form and not a checkbox-based form...
// ...this check is made only to avoid problems...
// ...if the student manipulates the form
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT &&
if (Gbl.Usrs.Me.LoggedRole == Rol_STD &&
LstGrpsIWant.NumGrps >= 2)
MySelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsIWant);
@ -640,7 +640,7 @@ void Grp_ChangeOtherUsrGrps (void)
/***** A student can not be enroled in more than one group
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)
SelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsUsrWants);
@ -697,7 +697,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,-1L,
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 *****/
for (NumGrpIBelong = 0;
@ -831,7 +831,7 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
bool RegisterUsrInThisGrp;
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 *****/
DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
@ -881,7 +881,7 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
Grp_FreeListCodGrp (&LstGrpsUsrBelongs);
/***** 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...
// ...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)
{
/***** 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;
bool PutFormToChangeGrps = !Gbl.Form.Inside; // Not inside another form (record card)
bool ICanEdit = !Gbl.Form.Inside &&
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
(Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
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
// 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->NumGrps > 1)
{
@ -1830,7 +1830,7 @@ static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
if (IBelongToThisGroup)
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)))
fprintf (Gbl.F.Out," disabled=\"disabled\"");
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_usr.UsrCod=crs_usr.UsrCod"
" AND crs_usr.Role=%u",
GrpCod,(unsigned) Rol_STUDENT);
GrpCod,(unsigned) Rol_STD);
return (unsigned) DB_QueryCOUNT (Query,
"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"
" WHERE crs_grp.GrpTypCod=%ld"
" 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");
/***** 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_usr.UsrCod=%ld)",
Gbl.CurrentCrs.Crs.CrsCod,
(unsigned) Rol_STUDENT,
(unsigned) Rol_STD,
Gbl.CurrentCrs.Crs.CrsCod,
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");
@ -3075,7 +3075,7 @@ static bool Grp_GetIfGrpIsAvailable (long GrpTypCod)
" AND crs_usr.Role=%u"
" GROUP BY crs_grp.GrpCod"
" 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");
return (NumGrpTypes != 0);

View File

@ -151,7 +151,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
{
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
!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 */
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"
" ORDER BY degrees.FullName,courses.FullName",
Gbl.Stat.DegTypCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
else
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 usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName",
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
}
else
@ -377,7 +377,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentCty.Cty.CtyCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
else
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"
" ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentIns.Ins.InsCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
else
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"
" ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentCtr.Ctr.CtrCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
else
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"
" ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentDeg.Deg.DegCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
else
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",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.CurrentCrs.Crs.CrsCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
else
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
@ -1116,8 +1116,8 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat
break;
case Ind_INDICATORS_FULL:
/* Get number of users */
NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,CrsCod);
NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,CrsCod);
NumStds = Usr_GetNumUsrsInCrs (Rol_STD,CrsCod);
NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,CrsCod);
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s LEFT_MIDDLE COLOR%u\">"

View File

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

View File

@ -583,8 +583,8 @@ static void Ins_Configuration (bool PrintView)
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_TEACHER,Gbl.CurrentIns.Ins.InsCod));
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_TCH,Gbl.CurrentIns.Ins.InsCod));
/***** Number of students in courses of this institution *****/
fprintf (Gbl.F.Out,"<tr>"
@ -596,8 +596,8 @@ static void Ins_Configuration (bool PrintView)
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_STUDENT,Gbl.CurrentIns.Ins.InsCod));
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_STD,Gbl.CurrentIns.Ins.InsCod));
/***** Number of users in courses of this institution *****/
fprintf (Gbl.F.Out,"<tr>"
@ -609,9 +609,9 @@ static void Ins_Configuration (bool PrintView)
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_UNKNOWN,Gbl.CurrentIns.Ins.InsCod));
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_UNK,Gbl.CurrentIns.Ins.InsCod));
}
/***** End table *****/
@ -715,7 +715,7 @@ static void Ins_ListInstitutions (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);
/* 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;
}
}
@ -1181,7 +1181,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Instit *Ins,
Ins->NumDegs = Deg_GetNumDegsInIns (Ins->InsCod);
/* 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 */
@ -2156,7 +2156,7 @@ static void Ins_PutFormToCreateInstitution (void)
/***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Act_FormStart (ActNewIns);
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_)
else if (Gbl.Usrs.Me.MaxRole >= Rol_GST)
Act_FormStart (ActReqIns);
else
Lay_ShowErrorAndExit ("You can not edit institutions.");

View File

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

View File

@ -622,7 +622,7 @@ void Mrk_ShowMyMarks (void)
Mrk_GetNumRowsHeaderAndFooter (&Marks);
/***** 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
else // If I am logged as teacher, administrator, superuser...
{
@ -637,7 +637,7 @@ void Mrk_ShowMyMarks (void)
else
{
UsrIsOK = false;
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
Usr_ShowWarningNoUsersFound (Rol_STD);
}
}
else // Course zone
@ -650,7 +650,7 @@ void Mrk_ShowMyMarks (void)
else
{
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 GetUsrsInCrs;
Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs =
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs = 0;
Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs =
Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs = 0;
/***** Get parameter that indicates if the message is a reply to another message *****/
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 ();
/***** Get and order lists of users from this course *****/
Usr_GetListUsrs (Rol_TEACHER,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
NumUsrsInCrs = Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
Usr_GetListUsrs (Rol_TCH,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumUsrsInCrs = Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
}
/***** Start frame *****/
@ -287,8 +287,8 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
Lay_StartTableWide (0);
if (ShowUsrsInCrs)
{
Usr_ListUsersToSelect (Rol_TEACHER); // All teachers in course
Usr_ListUsersToSelect (Rol_STUDENT); // All students in selected groups
Usr_ListUsersToSelect (Rol_TCH); // All teachers in course
Usr_ListUsersToSelect (Rol_STD); // All students in selected groups
}
Msg_WriteFormUsrsIDsOrNicksOtherRecipients (); // Other users (nicknames)
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 *****/
if (GetUsrsInCrs)
{
Usr_FreeUsrsList (Rol_TEACHER);
Usr_FreeUsrsList (Rol_STUDENT);
Usr_FreeUsrsList (Rol_TCH);
Usr_FreeUsrsList (Rol_STD);
}
/***** Free memory used by list of selected users' codes *****/
@ -678,7 +678,7 @@ void Msg_RecMsgFromUsr (void)
/***** Check number of recipients *****/
if ((NumRecipients = Usr_CountNumUsrsInListOfSelectedUsrs ()))
{
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT &&
if (Gbl.Usrs.Me.LoggedRole == Rol_STD &&
NumRecipients > Cfg_MAX_RECIPIENTS)
{
/* Write warning message */
@ -2028,7 +2028,7 @@ unsigned Msg_GetNumMsgsSentByTchsCrs (long CrsCod)
sprintf (Query,"SELECT COUNT(*) FROM msg_snt,crs_usr"
" WHERE msg_snt.CrsCod=%ld AND crs_usr.CrsCod=%ld AND crs_usr.Role=%u"
" 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");
}
@ -2932,7 +2932,7 @@ static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod)
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"LEFT_MIDDLE\">");
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
Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat);
fprintf (Gbl.F.Out,"</td>"
@ -3316,7 +3316,7 @@ static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted)
}
else
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>"
"</tr>"
"</table>");

View File

@ -450,7 +450,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
unsigned NumUsrs;
/***** 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 *****/
switch (Gbl.Scope.Current)

View File

@ -481,7 +481,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
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);
}

View File

@ -1209,7 +1209,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
" AND Role=%u", // Notify teachers only
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER);
(unsigned) Rol_TCH);
break;
case Brw_ADMI_DOCUM_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
Gbl.CurrentCrs.Grps.GrpCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER);
(unsigned) Rol_TCH);
break;
default: // This function should not be called in other cases
return 0;
@ -1275,7 +1275,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
" AND Role=%u", // Notify teachers only
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_TEACHER);
(unsigned) Rol_TCH);
else // Course without teachers
// If this course has no teachers
// 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"
" WHERE CrsCod=%ld AND Role=%u AND UsrCod<>%ld",
Gbl.CurrentCrs.Crs.CrsCod,
(unsigned) Rol_TEACHER,
(unsigned) Rol_TCH,
Gbl.Usrs.Me.UsrDat.UsrCod);
break;
default:

View File

@ -828,8 +828,8 @@ void Pwd_ShowFormOthPwd (void)
/***** Form to change password *****/
/* Start form */
Act_FormStart ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActChgPwdStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActChgPwdTch :
Act_FormStart ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActChgPwdStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActChgPwdTch :
ActChgPwdOth));
Usr_PutParamOtherUsrCodEncrypted ();
@ -879,8 +879,8 @@ void Pwd_PutLinkToChangeOtherUsrPassword (void)
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
Pwd_PutLinkToChangeMyPassword ();
else // Not me
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActFrmPwdStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActFrmPwdTch :
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActFrmPwdStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActFrmPwdTch :
ActFrmPwdOth),
NULL,Usr_PutParamOtherUsrCodEncrypted,
"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 */
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
/* 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
return true;
@ -195,8 +195,8 @@ void Pho_PutLinkToChangeOtherUsrPhoto (void)
PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
TitleText = PhotoExists ? Txt_Change_photo :
Txt_Upload_photo;
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActReqStdPho :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActReqTchPho :
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActReqStdPho :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActReqTchPho :
ActReqOthPho), // Guest, visitor or admin
NULL,Usr_PutParamOtherUsrCodEncrypted,
"photo64x64.gif",
@ -234,8 +234,8 @@ static void Pho_PutIconToRequestRemoveOtherUsrPhoto (void)
/***** Link to request the removal of another user's photo *****/
PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
if (PhotoExists)
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActReqRemStdPho :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActReqRemTchPho :
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActReqRemStdPho :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActReqRemTchPho :
ActReqRemOthPho), // Guest, visitor or admin
NULL,Usr_PutParamOtherUsrCodEncrypted,
"remove-on64x64.png",
@ -307,8 +307,8 @@ static void Pho_ReqPhoto (const struct UsrData *UsrDat,const char *PhotoURL)
Act_FormStart (ActDetMyPho);
else
{
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActDetStdPho :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActDetTchPho :
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActDetStdPho :
(UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActDetTchPho :
ActDetOthPho)); // Guest, visitor or admin
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
}
@ -482,8 +482,8 @@ void Pho_ReqRemoveUsrPhoto (void)
"PHOTO186x248",Pho_NO_ZOOM,false);
/* End alert */
Ale_ShowAlertAndButton2 ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActRemStdPho :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActRemTchPho :
Ale_ShowAlertAndButton2 ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActRemStdPho :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActRemTchPho :
ActRemOthPho), // Guest, visitor or admin
NULL,Usr_PutParamOtherUsrCodEncrypted,
Lay_REMOVE_BUTTON,Txt_Remove_photo);
@ -649,8 +649,8 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
{
NumFacesGreen++;
Act_FormStart (ItsMe ? ActUpdMyPho :
(UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActUpdStdPho :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActUpdTchPho :
(UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActUpdStdPho :
(UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActUpdTchPho :
ActUpdOthPho))); // Guest, visitor or admin
if (!ItsMe)
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
@ -1286,7 +1286,7 @@ void Pho_CalcPhotoDegree (void)
TypeOfAverage++)
{
/***** Compute average photos of students belonging this degree *****/
Pho_ComputeAveragePhoto (DegCod,Sex,Rol_STUDENT,
Pho_ComputeAveragePhoto (DegCod,Sex,Rol_STD,
TypeOfAverage,DirAvgPhotosRelPath[TypeOfAverage],
&NumStds,&NumStdsWithPhoto,&PartialTimeToComputeAvgPhotoInMicroseconds);
TotalTimeToComputeAvgPhotoInMicroseconds += PartialTimeToComputeAvgPhotoInMicroseconds;
@ -1297,7 +1297,7 @@ void Pho_CalcPhotoDegree (void)
}
/***** Free memory for students list *****/
Usr_FreeUsrsList (Rol_STUDENT);
Usr_FreeUsrsList (Rol_STD);
/***** Show photos *****/
Pho_ShowOrPrintPhotoDegree (Pho_DEGREES_SEE);
@ -1330,7 +1330,7 @@ static long Pho_GetDegWithAvgPhotoLeastRecentlyUpdated (void)
" AND degrees.DegCod NOT IN"
" (SELECT DISTINCT DegCod FROM sta_degrees)"
" LIMIT 1",
(unsigned) Rol_STUDENT);
(unsigned) Rol_STD);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees");
/* 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"
" ORDER BY sta_degrees.TimeAvgPhoto LIMIT 1",
Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO,
(unsigned) Rol_STUDENT);
(unsigned) Rol_STD);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees");
/* 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
/***** Show warning indicating no students found *****/
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
Usr_ShowWarningNoUsersFound (Rol_STD);
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
@ -2181,7 +2181,7 @@ static void Pho_ShowOrPrintListDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrint)
}
else // No degrees with students found!
/***** Show warning indicating no students found *****/
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
Usr_ShowWarningNoUsersFound (Rol_STD);
/***** Free structure that stores the query result *****/
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\">");
/***** 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\""
" style=\"background-image:url('%s/tch64x64.gif');\">"
"%u&nbsp;%s",
Txt_ROLES_SINGUL_Abc[Rol_TEACHER][UsrDat->Sex],
Txt_ROLES_SINGUL_Abc[Rol_TCH][UsrDat->Sex],
Gbl.Prefs.IconsURL,
NumCrssUsrIsTeacher,
Txt_courses_ABBREVIATION);
if (NumCrssUsrIsTeacher)
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,
Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TEACHER,Rol_STUDENT),
Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TCH,Rol_STD),
Txt_students_ABBREVIATION);
fprintf (Gbl.F.Out,"</li>");
/***** 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\""
" style=\"background-image:url('%s/std64x64.gif');\">"
"%u&nbsp;%s",
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][UsrDat->Sex],
Txt_ROLES_SINGUL_Abc[Rol_STD][UsrDat->Sex],
Gbl.Prefs.IconsURL,
NumCrssUsrIsStudent,
Txt_courses_ABBREVIATION);
if (NumCrssUsrIsStudent)
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,
Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STUDENT,Rol_STUDENT),
Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STD,Rol_STD),
Txt_students_ABBREVIATION);
fprintf (Gbl.F.Out,"</li>");

View File

@ -1110,7 +1110,7 @@ static void Rec_ShowRecordOneStdCrs (void)
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
/* Link to edit record fields */
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER)
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH)
Rec_PutLinkToEditRecordFields ();
/* Link to print view */
@ -1135,14 +1135,14 @@ static void Rec_ShowRecordOneStdCrs (void)
/***** Record of the student in the course *****/
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)
{
fprintf (Gbl.F.Out,"<section class=\"REC_CRS\">");
Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL);
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
{
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\">");
/* Link to edit record fields */
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER)
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH)
Rec_PutLinkToEditRecordFields ();
/* Link to print view */
@ -1264,9 +1264,9 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
/* Record of the student in the course */
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_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
{
fprintf (Gbl.F.Out,"<section class=\"REC_CRS\">");
@ -1714,7 +1714,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
bool ICanEditThisField;
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
if (ItsMe) // It's me
@ -1911,7 +1911,7 @@ void Rec_GetFieldsCrsRecordFromForm (void)
for (NumField = 0;
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
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)
{
/* Get text of the form */
@ -1934,7 +1934,7 @@ void Rec_UpdateCrsRecord (long UsrCod)
for (NumField = 0;
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
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)
{
/***** Check if already exists this field for this user in database *****/
@ -2047,7 +2047,7 @@ void Rec_AllocMemFieldsRecordsCrs (void)
for (NumField = 0;
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
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)
/* Allocate memory for the texts of the fields */
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;
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
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)
/* Free memory of the text of the field */
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.
Instead it is initialized with the preferred role. */
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);
}
@ -2206,11 +2206,11 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
};
const char *Rec_RecordListHelp[Rol_NUM_ROLES] =
{
NULL, // Rol_UNKNOWN
Hlp_USERS_Guests, // Rol__GUEST_
NULL, // Rol_VISITOR
Hlp_USERS_Students_shared_record_card, // Rol_STUDENT
Hlp_USERS_Teachers_shared_record_card, // Rol_TEACHER
NULL, // Rol_UNK
Hlp_USERS_Guests, // Rol_GST
NULL, // Rol_USR
Hlp_USERS_Students_shared_record_card, // Rol_STD
Hlp_USERS_Teachers_shared_record_card, // Rol_TCH
NULL, // Rol_DEG_ADM
NULL, // Rol_CTR_ADM
NULL, // Rol_INS_ADM
@ -2232,7 +2232,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
/***** Initializations *****/
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
CountryForm = (TypeOfView == Rec_SHA_MY_RECORD_FORM);
ShowData = (ItsMe ||
@ -2244,14 +2244,14 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
((TypeOfView == Rec_SHA_RECORD_LIST ||
TypeOfView == Rec_SHA_RECORD_PRINT) &&
(IAmLoggedAsTeacher || IAmLoggedAsSysAdm) &&
UsrDat->RoleInCurrentCrsDB == Rol_STUDENT));
UsrDat->RoleInCurrentCrsDB == Rol_STD));
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get user's roles if not got
ShowTeacherRows = (((TypeOfView == Rec_SHA_MY_RECORD_FORM ||
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_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 */
switch (TypeOfView)
@ -2361,8 +2361,8 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
ID_PutParamOtherUsrIDPlain (); // New user
break;
case Rec_SHA_OTHER_EXISTING_USR_FORM:
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActUpdStd :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActUpdTch :
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActUpdStd :
(UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActUpdTch :
ActUpdOth));
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); // Existing user
break;
@ -2452,7 +2452,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
{
// Don't show groups if I don't belong to course
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT));
Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STD));
}
else
Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod);
@ -2498,8 +2498,8 @@ static void Rec_PutIconsCommands (void)
extern const char *Txt_Following_unfollow;
extern const char *Txt_Follow;
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 IAmLoggedAsTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER); // My current role is teacher
bool IAmLoggedAsStudent = (Gbl.Usrs.Me.LoggedRole == Rol_STD); // My current role is student
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 ICanViewUsrProfile;
@ -2557,13 +2557,13 @@ static void Rec_PutIconsCommands (void)
/***** Button to admin user *****/
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.CurrentCtr.Ctr.CtrCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_CTR_ADM) ||
(Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_INS_ADM) ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Lay_PutContextualLink ( Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActReqMdfStd :
(Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActReqMdfTch :
Lay_PutContextualLink ( Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActReqMdfStd :
(Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActReqMdfTch :
ActReqMdfOth),
NULL,Rec_PutParamUsrCodEncrypted,
"config64x64.gif",
@ -2571,7 +2571,7 @@ static void Rec_PutIconsCommands (void)
NULL);
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
{
/***** Button to view user's assignments and works *****/
@ -2616,7 +2616,7 @@ static void Rec_PutIconsCommands (void)
/***** Button to print QR code *****/
if (ItsMe || IAmLoggedAsSysAdm ||
(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
Lay_PutContextualLink (ActPrnUsrQR,NULL,Rec_PutParamUsrCodEncrypted,
"qr64x64.gif",
@ -2911,13 +2911,13 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
switch (TypeOfView)
{
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
Rol_TEACHER :
Rol_STUDENT;
Rol_TCH :
Rol_STD;
fprintf (Gbl.F.Out,"<select id=\"Role\" name=\"Role\">");
for (Role = Rol_STUDENT;
Role <= Rol_TEACHER;
for (Role = Rol_STD;
Role <= Rol_TCH;
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\">");
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 ((DefaultRoleInCurrentCrs = Rol_GetRequestedRole (UsrDat->UsrCod)) == Rol_UNKNOWN)
DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TEACHER)) ? Rol_TEACHER :
Rol_STUDENT;
if ((DefaultRoleInCurrentCrs = Rol_GetRequestedRole (UsrDat->UsrCod)) == Rol_UNK)
DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TCH)) ? Rol_TCH :
Rol_STD;
}
else
DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB;
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol__GUEST_:
case Rol_VISITOR:
case Rol_STUDENT:
case Rol_GST:
case Rol_USR:
case Rol_STD:
fprintf (Gbl.F.Out,"<option value=\"%u\""
" selected=\"selected\""
" disabled=\"disabled\">"
@ -2954,13 +2954,13 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
(unsigned) Gbl.Usrs.Me.LoggedRole,
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][UsrDat->Sex]);
break;
case Rol_TEACHER:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
case Rol_SYS_ADM:
for (Role = Rol_STUDENT;
Role <= Rol_TEACHER;
for (Role = Rol_STD;
Role <= Rol_TCH;
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
{
DefaultRoleInCurrentCrs = (UsrDat->Roles & ((1 << Rol_STUDENT) |
(1 << Rol_TEACHER))) ? Rol_VISITOR :
Rol__GUEST_;
DefaultRoleInCurrentCrs = (UsrDat->Roles & ((1 << Rol_STD) |
(1 << Rol_TCH))) ? Rol_USR :
Rol_GST;
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\""
" disabled=\"disabled\">%s</option>",
(unsigned) DefaultRoleInCurrentCrs,
@ -2992,7 +2992,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
@ -3001,8 +3001,8 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
is not the current role in current course.
Instead it is initialized with the preferred role. */
DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB;
for (Role = Rol_STUDENT;
Role <= Rol_TEACHER;
for (Role = Rol_STD;
Role <= Rol_TCH;
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:
fprintf (Gbl.F.Out,"<option value=\"%u\""
" 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;
default: // The rest of users can not register other users
break;
@ -3676,43 +3676,43 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
Par_GetParToUnsignedLong ("Role",
0,
Rol_NUM_ROLES - 1,
(unsigned long) Rol_UNKNOWN);
(unsigned long) Rol_UNK);
/***** Check if I can register a user
with the received role in current course *****/
/* Check for other possible errors */
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 */
if (Role == Rol_STUDENT)
if (Role == Rol_STD)
RoleOK = true;
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
// if the other is already teacher in any course.
// That is, a teacher can not upgrade a student
// (in all other courses) to teacher
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Other.UsrDat);
if ( Role == Rol_STUDENT ||
(Role == Rol_TEACHER && // 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
if ( Role == Rol_STD ||
(Role == Rol_TCH && // He/she will be a teacher in current course
(Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_TCH)))) // He/she was a teacher in some courses
RoleOK = true;
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_CTR_ADM: // I am logged as centre admin
case Rol_INS_ADM: // I am logged as institution admin
if (Role == Rol_STUDENT ||
Role == Rol_TEACHER)
if (Role == Rol_STD ||
Role == Rol_TCH)
RoleOK = true;
break;
case Rol_SYS_ADM:
if ( Role == Rol_STUDENT ||
Role == Rol_TEACHER ||
(Role == Rol__GUEST_ && Gbl.CurrentCrs.Crs.CrsCod <= 0))
if ( Role == Rol_STD ||
Role == Rol_TCH ||
(Role == Rol_GST && Gbl.CurrentCrs.Crs.CrsCod <= 0))
RoleOK = true;
break;
default:
@ -3854,14 +3854,14 @@ void Rec_ShowFormMyInsCtrDpt (void)
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
/***** 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 (Gbl.Usrs.Me.UsrDat.InsCtyCod < 0)
Ale_ShowAlert (Ale_WARNING,Txt_Please_select_the_country_of_your_institution);
else if (Gbl.Usrs.Me.UsrDat.InsCod < 0)
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.DptCod < 0))
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 *****/
Report->MaxHitsPerYear = 0; // MaxHitsPerYear not passed as an argument but computed inside the function
Rep_ShowMyHitsPerYear (true,-1L, // Any course
Rol_UNKNOWN, // Any role
Rol_UNK, // Any role
Report);
/***** End of section *****/
@ -857,8 +857,8 @@ static void Rep_WriteSectionCurrentCourses (struct Rep_Report *Report)
"<ul>");
/***** Number of courses in which the user is student/teacher *****/
for (Role = Rol_STUDENT;
Role <= Rol_TEACHER;
for (Role = Rol_STD;
Role <= Rol_TCH;
Role++)
/* List my courses with this role */
Rep_GetAndWriteMyCurrentCrss (Role,Report);
@ -891,8 +891,8 @@ static void Rep_WriteSectionHistoricCourses (struct Rep_Report *Report)
Rep_GetAndWriteMyHistoricClicsWithoutCrs (Report);
/***** Historic courses in which the user clicked as student/teacher *****/
for (Role = Rol_STUDENT;
Role <= Rol_TEACHER;
for (Role = Rol_STD;
Role <= Rol_TCH;
Role++)
/* List my courses with this role */
Rep_GetAndWriteMyHistoricCrss (Role,Report);
@ -942,13 +942,13 @@ static void Rep_GetMaxHitsPerYear (struct Rep_Report *Report)
" GROUP BY CrsCod,Year,Role"
// ----------------------------------------------------------
") AS hits_per_crs_year",
(unsigned) Rol_UNKNOWN,
(unsigned) Rol_UNK,
(long) Report->UsrFigures.FirstClickTimeUTC,
Gbl.Usrs.Me.UsrDat.UsrCod,
(long) Report->UsrFigures.FirstClickTimeUTC,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_STUDENT,
(unsigned) Rol_TEACHER);
(unsigned) Rol_STD,
(unsigned) Rol_TCH);
DB_QuerySELECT (Query,&mysql_res,"can not get last question index");
/***** Get number of users *****/
@ -992,9 +992,9 @@ static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role,
if (NumCrss)
{
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,
Usr_GetNumUsrsInCrssOfAUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Role,Rol_STUDENT),
Usr_GetNumUsrsInCrssOfAUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Role,Rol_STD),
Txt_students_ABBREVIATION);
/***** Get courses of a user from database *****/
@ -1057,7 +1057,7 @@ static void Rep_GetAndWriteMyHistoricClicsWithoutCrs (struct Rep_Report *Report)
/***** Historic clicks *****/
Rep_WriteRowCrsData (-1L,
Rol_UNKNOWN, // Role does not matter
Rol_UNK, // Role does not matter
Report,
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 *****/
if (WriteNumUsrs)
fprintf (Gbl.F.Rep," (%u %s / %u %s)",
Usr_GetNumUsrsInCrs (Rol_TEACHER,Crs.CrsCod),Txt_teachers_ABBREVIATION,
Usr_GetNumUsrsInCrs (Rol_STUDENT,Crs.CrsCod),Txt_students_ABBREVIATION);
Usr_GetNumUsrsInCrs (Rol_TCH,Crs.CrsCod),Txt_teachers_ABBREVIATION,
Usr_GetNumUsrsInCrs (Rol_STD,Crs.CrsCod),Txt_students_ABBREVIATION);
}
else
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
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';
else
sprintf (SubQueryRol," AND Role=%u",(unsigned) Role);

View File

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

View File

@ -36,26 +36,24 @@
Don't change these numbers!
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,
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
typedef enum
{
Rol_UNKNOWN = 0, // User not logged in
Rol__GUEST_ = 1, // User not belonging to any course
Rol_VISITOR = 2, // Student or teacher in other courses...
// ...but not belonging to the current course
Rol_STUDENT = 3, // Student in current course
Rol_TEACHER = 4, // Teacher in current course
Rol_DEG_ADM = 5, // Degree administrator
Rol_CTR_ADM = 6, // Centre administrator
Rol_INS_ADM = 7, // Institution administrator
Rol_SYS_ADM = 8, // System administrator (superuser)
Rol_UNK = 0, // User not logged in
Rol_GST = 1, // User not belonging to any course
Rol_USR = 2, // Student or teacher in some courses...
// ...but no course selected
// ...or not belonging to the current course
Rol_STD = 3, // Student in the current course
Rol_TCH = 4, // Teacher in the current course
Rol_DEG_ADM = 5, // Degree administrator
Rol_CTR_ADM = 6, // Centre administrator
Rol_INS_ADM = 7, // Institution administrator
Rol_SYS_ADM = 8, // System administrator (superuser)
} Rol_Role_t;
#endif

View File

@ -273,8 +273,8 @@ void Sco_SetScopesForListingStudents (void)
Gbl.Scope.Default = Sco_SCOPE_CRS;
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_TEACHER:
case Rol_STD:
case Rol_TCH:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CRS;
break;
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_courses, // Sch_SEARCH_COURSES
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_STUDENT][Usr_SEX_UNKNOWN], // Sch_SEARCH_STUDENTS
Txt_ROLES_PLURAL_abc[Rol__GUEST_][Usr_SEX_UNKNOWN], // Sch_SEARCH_GUESTS
Txt_ROLES_PLURAL_abc[Rol_TCH][Usr_SEX_UNKNOWN], // Sch_SEARCH_TEACHERS
Txt_ROLES_PLURAL_abc[Rol_STD][Usr_SEX_UNKNOWN], // Sch_SEARCH_STUDENTS
Txt_ROLES_PLURAL_abc[Rol_GST][Usr_SEX_UNKNOWN], // Sch_SEARCH_GUESTS
Txt_open_documents, // Sch_SEARCH_OPEN_DOCUMENTS
Txt_documents_in_my_courses, // Sch_SEARCH_DOCUM_IN_MY_COURSES
Txt_my_documents, // Sch_SEARCH_MY_DOCUMENTS
@ -595,9 +595,9 @@ static void Sch_SearchInDB (void)
NumResults += Sch_SearchCentresInDB (RangeQuery);
NumResults += Sch_SearchDegreesInDB (RangeQuery);
NumResults += Sch_SearchCoursesInDB (RangeQuery);
NumResults += Sch_SearchUsrsInDB (Rol_TEACHER);
NumResults += Sch_SearchUsrsInDB (Rol_STUDENT);
NumResults += Sch_SearchUsrsInDB (Rol__GUEST_);
NumResults += Sch_SearchUsrsInDB (Rol_TCH);
NumResults += Sch_SearchUsrsInDB (Rol_STD);
NumResults += Sch_SearchUsrsInDB (Rol_GST);
NumResults += Sch_SearchOpenDocumentsInDB (RangeQuery);
NumResults += Sch_SearchDocumentsInMyCoursesInDB (RangeQuery);
NumResults += Sch_SearchMyDocumentsInDB (RangeQuery);
@ -618,16 +618,16 @@ static void Sch_SearchInDB (void)
NumResults = Sch_SearchCoursesInDB (RangeQuery);
break;
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;
case Sch_SEARCH_TEACHERS:
NumResults = Sch_SearchUsrsInDB (Rol_TEACHER);
NumResults = Sch_SearchUsrsInDB (Rol_TCH);
break;
case Sch_SEARCH_STUDENTS:
NumResults = Sch_SearchUsrsInDB (Rol_STUDENT);
NumResults = Sch_SearchUsrsInDB (Rol_STD);
break;
case Sch_SEARCH_GUESTS:
NumResults = Sch_SearchUsrsInDB (Rol__GUEST_);
NumResults = Sch_SearchUsrsInDB (Rol_GST);
break;
case Sch_SEARCH_OPEN_DOCUMENTS:
NumResults = Sch_SearchOpenDocumentsInDB (RangeQuery);
@ -950,7 +950,7 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
RangeQuery);
/***** 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); */
return Brw_ListDocsFound (Query,
Txt_open_document,
@ -1011,7 +1011,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
(unsigned) Brw_ADMI_TEACH_GRP,
(unsigned) Brw_ADMI_SHARE_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); */
if (mysql_query (&Gbl.mysql,Query))
DB_ExitOnMySQLError ("can not create temporary table");
@ -1071,7 +1071,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
RangeQuery);
/***** 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); */
NumDocs = Brw_ListDocsFound (Query,
Txt_document_in_my_courses,
@ -1230,7 +1230,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
(unsigned) Brw_ADMI_BRIEF_USR);
/***** 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); */
return Brw_ListDocsFound (Query,
Txt_document_from_me,

View File

@ -141,7 +141,7 @@ void Ses_CloseSession (void)
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
Gbl.Usrs.Me.IBelongToCurrentDeg = 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.Num = 0;
@ -299,7 +299,7 @@ bool Ses_GetSessionData (void)
/***** Get logged user type (row[2]) *****/
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]) *****/
Gbl.CurrentCty.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[3]);

View File

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

View File

@ -294,7 +294,7 @@ static bool Svy_CheckIfICanCreateSvy (void)
{
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
case Rol_TCH:
return (Gbl.CurrentCrs.Crs.CrsCod > 0);
case Rol_DEG_ADM:
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" :
"ASG_GRP_LIGHT",
Txt_Users);
Rol_WriteSelectorRoles (1 << Rol_STUDENT |
1 << Rol_TEACHER,
Rol_WriteSelectorRoles (1 << Rol_STD |
1 << Rol_TCH,
Svy.Roles,
true,false);
fprintf (Gbl.F.Out,"</div>");
@ -977,15 +977,15 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
{
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_UNKNOWN: // User not logged in *********************************
case Rol_UNK: // User not logged in *********************************
*ScopesAllowed = 0;
*HiddenAllowed = 0;
break;
case Rol__GUEST_: // User not belonging to any course *******************
case Rol_GST: // User not belonging to any course *******************
*ScopesAllowed = 1 << Sco_SCOPE_SYS;
*HiddenAllowed = 0;
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 *********
*ScopesAllowed = 1 << Sco_SCOPE_SYS;
*HiddenAllowed = 0;
@ -1004,7 +1004,7 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
}
}
break;
case Rol_STUDENT: // Student in current course **************************
case Rol_STD: // Student in current course **************************
*ScopesAllowed = 1 << Sco_SCOPE_SYS;
*HiddenAllowed = 0;
if (Usr_CheckIfIBelongToCty (Gbl.CurrentCty.Cty.CtyCod))
@ -1026,7 +1026,7 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
}
}
break;
case Rol_TEACHER: // Teacher in current course **************************
case Rol_TCH: // Teacher in current course **************************
*ScopesAllowed = 1 << Sco_SCOPE_SYS;
*HiddenAllowed = 0;
if (Usr_CheckIfIBelongToCty (Gbl.CurrentCty.Cty.CtyCod))
@ -1245,7 +1245,7 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
Can I edit survey? */
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_STD:
Svy->Status.ICanViewResults = (Svy->Scope == Sco_SCOPE_CRS ||
Svy->Scope == Sco_SCOPE_DEG ||
Svy->Scope == Sco_SCOPE_CTR ||
@ -1260,7 +1260,7 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
Svy->Status.IHaveAnswered;
Svy->Status.ICanEdit = false;
break;
case Rol_TEACHER:
case Rol_TCH:
Svy->Status.ICanViewResults = (Svy->Scope == Sco_SCOPE_CRS ||
Svy->Scope == Sco_SCOPE_DEG ||
Svy->Scope == Sco_SCOPE_CTR ||
@ -1765,7 +1765,7 @@ void Svy_RequestCreatOrEditSvy (void)
/* Initialize to empty survey */
Svy.SvyCod = -1L;
Svy.Scope = Sco_SCOPE_UNK;
Svy.Roles = (1 << Rol_STUDENT);
Svy.Roles = (1 << Rol_STD);
Svy.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Svy.TimeUTC[Svy_START_TIME] = Gbl.StartExecutionTimeUTC;
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\">",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Users);
Rol_WriteSelectorRoles (1 << Rol_STUDENT |
1 << Rol_TEACHER,
Rol_WriteSelectorRoles (1 << Rol_STD |
1 << Rol_TCH,
Svy.Roles,
false,false);
fprintf (Gbl.F.Out,"</td>"
@ -1897,7 +1897,7 @@ static void Svy_SetDefaultAndAllowedScope (struct Survey *Svy)
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 (Svy->Scope == Sco_SCOPE_UNK) // Scope not defined
@ -2102,7 +2102,7 @@ void Svy_RecFormSurvey (void)
break;
case Sco_SCOPE_CRS:
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.");
NewSvy.Scope = Sco_SCOPE_CRS;
NewSvy.Cod = Gbl.CurrentCrs.Crs.CrsCod;

View File

@ -48,7 +48,7 @@ struct Survey
long SvyCod;
Sco_Scope_t Scope;
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;
char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1];
time_t TimeUTC[Svy_NUM_DATES];

View File

@ -238,7 +238,7 @@ bool Syl_CheckAndEditSyllabus (void)
/***** Start frame *****/
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;
PutIconToEdit = ICanEdit && !Gbl.Syllabus.EditionIsActive;
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
case TabAss:
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:
return (Gbl.CurrentIns.Ins.InsCod > 0); // Institution selected
default:

View File

@ -302,10 +302,10 @@ void Tst_ShowFormAskTst (void)
/***** Put link to view tests results *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_STD:
Tst_PutFormToViewResultsOfUsersTests (ActReqSeeMyTstRes);
break;
case Rol_TEACHER:
case Rol_TCH:
case Rol_SYS_ADM:
Tst_PutFormToViewResultsOfUsersTests (ActReqSeeUsrTstRes);
break;
@ -475,7 +475,7 @@ void Tst_ShowNewTest (void)
Tst_SetTstStatus (NumAccessesTst,Tst_STATUS_SHOWN_BUT_NOT_ASSESSED);
/***** 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 ();
}
@ -647,7 +647,7 @@ static bool Tst_CheckIfNextTstAllowed (void)
time_t TimeNextTestUTC = (time_t) 0;
/***** 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)
return true;
@ -934,7 +934,7 @@ static void Tst_ShowTestResultAfterAssess (long TstCod,unsigned *NumQstsNotBlank
(*NumQstsNotBlank)++;
/***** 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);
}
else
@ -1321,7 +1321,7 @@ void Tst_ShowFormAskEditTsts (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);
}
@ -6967,10 +6967,10 @@ void Tst_SelUsrsToSeeUsrsTestResults (void)
Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order lists of users from this course *****/
Usr_GetListUsrs (Rol_TEACHER,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS);
NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TEACHER].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
Usr_GetListUsrs (Rol_TCH,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
/***** Start frame *****/
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]);
Lay_StartTable (2);
Usr_ListUsersToSelect (Rol_TEACHER);
Usr_ListUsersToSelect (Rol_STUDENT);
Usr_ListUsersToSelect (Rol_TCH);
Usr_ListUsersToSelect (Rol_STD);
Lay_EndTable ();
fprintf (Gbl.F.Out,"</td>"
"</tr>");
@ -7019,14 +7019,14 @@ void Tst_SelUsrsToSeeUsrsTestResults (void)
}
}
else
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN);
Usr_ShowWarningNoUsersFound (Rol_UNK);
/***** End frame *****/
Lay_EndRoundFrame ();
/***** Free memory for users' list *****/
Usr_FreeUsrsList (Rol_TEACHER);
Usr_FreeUsrsList (Rol_STUDENT);
Usr_FreeUsrsList (Rol_TCH);
Usr_FreeUsrsList (Rol_STD);
/***** Free memory used by list of selected users' codes *****/
Usr_FreeListsSelectedUsrsCods ();
@ -7298,12 +7298,12 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_STD:
ICanViewTest = ItsMe;
ICanViewScore = ItsMe &&
Gbl.Test.Config.FeedbackType != Tst_FEEDBACK_NOTHING;
break;
case Rol_TEACHER:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
@ -7422,11 +7422,11 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat)
/***** Write totals for this user *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_STD:
ICanViewTotalScore = ItsMe &&
Gbl.Test.Config.FeedbackType != Tst_FEEDBACK_NOTHING;
break;
case Rol_TEACHER:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_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," class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd);
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActSeeRecOneStd :
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActSeeRecOneStd :
ActSeeRecOneTch);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
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);
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_STD:
ICanViewTest = ItsMe;
if (ItsMe)
{
@ -7630,7 +7630,7 @@ void Tst_ShowOneTestResult (void)
else
ICanViewScore = false;
break;
case Rol_TEACHER:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_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 &&
!PrintView &&
Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER);
Gbl.Usrs.Me.LoggedRole >= Rol_TCH);
Gbl.TimeTable.ContextualIcons.PutIconEditOfficeHours = (Gbl.TimeTable.Type == TT_MY_TIMETABLE &&
!PrintView &&
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_TEACHER)));
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_TCH)));
Gbl.TimeTable.ContextualIcons.PutIconPrint = !PrintView;
/***** 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 */
Rol_Role_t Svc_SvcRole_to_RolRole[Svc_NUM_ROLES] =
{
Rol_UNKNOWN, // Svc_ROLE_UNKNOWN
Rol__GUEST_, // Svc_ROLE__GUEST_
Rol_STUDENT, // Svc_ROLE_STUDENT
Rol_TEACHER, // Svc_ROLE_TEACHER
Rol_UNK, // Svc_ROLE_UNKNOWN
Rol_GST, // Svc_ROLE__GUEST_
Rol_STD, // Svc_ROLE_STUDENT
Rol_TCH, // Svc_ROLE_TEACHER
};
/* Translation from swad-core-role to service-web-role */
Svc_Role_t Svc_RolRole_to_SvcRole[Rol_NUM_ROLES] =
{
Svc_ROLE_UNKNOWN, // Rol_UNKNOWN
Svc_ROLE__GUEST_, // Rol__GUEST_
Svc_ROLE_UNKNOWN, // Rol_VISITOR
Svc_ROLE_STUDENT, // Rol_STUDENT
Svc_ROLE_TEACHER, // Rol_TEACHER
Svc_ROLE_UNKNOWN, // Rol_UNK
Svc_ROLE__GUEST_, // Rol_GST
Svc_ROLE_UNKNOWN, // Rol_USR
Svc_ROLE_STUDENT, // Rol_STD
Svc_ROLE_TEACHER, // Rol_TCH
Svc_ROLE_UNKNOWN, // Rol_DEG_ADM
Svc_ROLE_UNKNOWN, // Rol_CTR_ADM
Svc_ROLE_UNKNOWN, // Rol_INS_ADM
@ -592,13 +592,13 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
if (row[0])
{
if (sscanf (row[0],"%u",&UsrDat->RoleInCurrentCrsDB) != 1)
UsrDat->RoleInCurrentCrsDB = Rol_UNKNOWN;
UsrDat->RoleInCurrentCrsDB = Rol_UNK;
}
else // Impossible
UsrDat->RoleInCurrentCrsDB = Rol_UNKNOWN;
UsrDat->RoleInCurrentCrsDB = Rol_UNK;
}
else // User does not belong to course
UsrDat->RoleInCurrentCrsDB = Rol_VISITOR;
UsrDat->RoleInCurrentCrsDB = Rol_USR;
}
else
{
@ -612,14 +612,14 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
if (row[0])
{
if (sscanf (row[0],"%u",&UsrDat->RoleInCurrentCrsDB) != 1)
UsrDat->RoleInCurrentCrsDB = Rol_UNKNOWN;
UsrDat->RoleInCurrentCrsDB = Rol_UNK;
}
else
// MAX(Role) == NULL if user does not belong to any course
UsrDat->RoleInCurrentCrsDB = Rol__GUEST_;
UsrDat->RoleInCurrentCrsDB = Rol_GST;
}
else // Impossible
UsrDat->RoleInCurrentCrsDB = Rol__GUEST_;
UsrDat->RoleInCurrentCrsDB = Rol_GST;
}
/* Free structure that stores the query result */
@ -974,7 +974,7 @@ int swad__loginBySessionKey (struct soap *soap,
loginBySessionKeyOut->userSurname2[0] = '\0';
loginBySessionKeyOut->userPhoto[0] = '\0';
loginBySessionKeyOut->userBirthday[0] = '\0';
loginBySessionKeyOut->userRole = Rol_UNKNOWN;
loginBySessionKeyOut->userRole = Rol_UNK;
loginBySessionKeyOut->degreeName[0] = '\0';
loginBySessionKeyOut->courseName[0] = '\0';
@ -1235,7 +1235,7 @@ int swad__getCourses (struct soap *soap,
/* Get role (row[3]) */
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];
}
}
@ -1308,8 +1308,8 @@ int swad__getCourseInfo (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -1412,8 +1412,8 @@ int swad__getUsers (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -1491,8 +1491,8 @@ int swad__findUsers (struct soap *soap,
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -1651,8 +1651,8 @@ int swad__getGroupTypes (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -1759,8 +1759,8 @@ int swad__getGroups (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -1885,8 +1885,8 @@ int swad__sendMyGroups (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -2100,7 +2100,7 @@ int swad__getAttendanceEvents (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** 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,
"Request forbidden",
"Requester must be a teacher");
@ -2304,7 +2304,7 @@ int swad__sendAttendanceEvent (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** 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,
"Request forbidden",
"Requester must be a teacher");
@ -2425,7 +2425,7 @@ int swad__removeAttendanceEvent (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** 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,
"Request forbidden",
"Requester must be a teacher");
@ -2521,7 +2521,7 @@ int swad__getAttendanceUsers (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** 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,
"Request forbidden",
"Requester must be a teacher");
@ -2543,7 +2543,7 @@ int swad__getAttendanceUsers (struct soap *soap,
" AND crs_grp_usr.UsrCod NOT IN"
" (SELECT UsrCod FROM att_usr WHERE AttCod=%ld)",
Att.AttCod,
(unsigned) Rol_STUDENT,
(unsigned) Rol_STD,
Att.AttCod);
else
// Event for the whole course
@ -2557,7 +2557,7 @@ int swad__getAttendanceUsers (struct soap *soap,
" AND crs_usr.UsrCod NOT IN"
" (SELECT UsrCod FROM att_usr WHERE AttCod=%ld)",
Att.AttCod,
(unsigned) Rol_STUDENT,
(unsigned) Rol_STD,
Att.AttCod);
// Query: list of users in attendance list + rest of users (subquery)
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;
/***** 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,
"Request forbidden",
"Requester must be a teacher");
@ -3449,7 +3449,7 @@ int swad__sendNotice (struct soap *soap,
return ReturnCode;
/***** 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,
"Request forbidden",
"Requester must be a teacher");
@ -3515,8 +3515,8 @@ int swad__getTestConfig (struct soap *soap,
"Course code must be a integer greater than 0");
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -3646,8 +3646,8 @@ int swad__getTests (struct soap *soap,
"Course code must be a integer greater than 0");
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -4278,8 +4278,8 @@ int swad__getDirectoryTree (struct soap *soap,
return ReturnCode;
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -4595,8 +4595,8 @@ int swad__getFile (struct soap *soap,
return ReturnCode;
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");
@ -4619,7 +4619,7 @@ int swad__getFile (struct soap *soap,
case Brw_ADMI_MARKS_CRS:
case Brw_ADMI_MARKS_GRP:
// 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,
"Wrong tree",
"Wrong file zone");
@ -4737,8 +4737,8 @@ int swad__getMarks (struct soap *soap,
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
/***** Check if I am a student or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STD &&
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TCH)
return soap_receiver_fault (Gbl.soap,
"Request forbidden",
"Requester must belong to course");