mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-05 00:05:23 +02:00
Version 14.110
This commit is contained in:
parent
0ed1c61c81
commit
c63beac1fd
|
@ -747,6 +747,15 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
.BLUE_FORM_BOLD {color:#4D88A1; font-size:11pt; font-weight:bold;}
|
.BLUE_FORM_BOLD {color:#4D88A1; font-size:11pt; font-weight:bold;}
|
||||||
.YELLOW_FORM_BOLD {color:#7C4D2A; font-size:11pt; font-weight:bold;}
|
.YELLOW_FORM_BOLD {color:#7C4D2A; font-size:11pt; font-weight:bold;}
|
||||||
|
|
||||||
|
/********************************* Course info *******************************/
|
||||||
|
#crs_info
|
||||||
|
{
|
||||||
|
margin:0;
|
||||||
|
padding:0 10px;
|
||||||
|
color:#404040;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
.FILENAME {color:#404040; font-size:14pt; font-weight:bold;}
|
.FILENAME {color:#404040; font-size:14pt; font-weight:bold;}
|
||||||
|
|
||||||
|
|
|
@ -558,6 +558,15 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
.BLUE_FORM_BOLD {color:#4D88A1; font-size:16pt; font-weight:bold;}
|
.BLUE_FORM_BOLD {color:#4D88A1; font-size:16pt; font-weight:bold;}
|
||||||
.YELLOW_FORM_BOLD {color:#FF4301; font-size:16pt; font-weight:bold;}
|
.YELLOW_FORM_BOLD {color:#FF4301; font-size:16pt; font-weight:bold;}
|
||||||
|
|
||||||
|
/********************************* Course info *******************************/
|
||||||
|
#crs_info
|
||||||
|
{
|
||||||
|
margin:0;
|
||||||
|
padding:0 10px;
|
||||||
|
color:#404040;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
.FILENAME {color:#404040; font-size:18pt; font-weight:bold;}
|
.FILENAME {color:#404040; font-size:18pt; font-weight:bold;}
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,8 @@ CREATE TABLE IF NOT EXISTS crs_info_src (
|
||||||
CREATE TABLE IF NOT EXISTS crs_info_txt (
|
CREATE TABLE IF NOT EXISTS crs_info_txt (
|
||||||
CrsCod INT NOT NULL DEFAULT -1,
|
CrsCod INT NOT NULL DEFAULT -1,
|
||||||
InfoType ENUM('intro','description','theory','practices','bibliography','FAQ','links','assessment') NOT NULL,
|
InfoType ENUM('intro','description','theory','practices','bibliography','FAQ','links','assessment') NOT NULL,
|
||||||
InfoTxt LONGTEXT NOT NULL,
|
InfoTxtHTML LONGTEXT NOT NULL,
|
||||||
|
InfoTxtMD LONGTEXT NOT NULL,
|
||||||
UNIQUE INDEX(CrsCod,InfoType));
|
UNIQUE INDEX(CrsCod,InfoType));
|
||||||
--
|
--
|
||||||
-- Table crs_last: stores last access to courses from students or teachers
|
-- Table crs_last: stores last access to courses from students or teachers
|
||||||
|
|
|
@ -825,8 +825,8 @@ void ID_ConfirmUsrID (long UsrCod,const char *UsrID)
|
||||||
|
|
||||||
bool ID_ICanSeeTeacherID (struct UsrData *UsrDat)
|
bool ID_ICanSeeTeacherID (struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM)
|
||||||
// If I am an administrator of current degree, I only can see the users' IDs from current degree
|
// If I am an administrator of current degree, I only can see the users' IDs from current degree
|
||||||
return Usr_CheckIfUsrBelongsToDeg (UsrDat->UsrCod,Gbl.CurrentDeg.Deg.DegCod);
|
return Usr_CheckIfUsrBelongsToDeg (UsrDat->UsrCod,Gbl.CurrentDeg.Deg.DegCod);
|
||||||
return (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
|
return (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
||||||
}
|
}
|
||||||
|
|
|
@ -606,10 +606,10 @@ bool Acc_CheckIfICanEliminateAccount (bool ItsMe)
|
||||||
// A user logged as superuser can eliminate any user except her/him
|
// A user logged as superuser can eliminate any user except her/him
|
||||||
// Other users only can eliminate themselves
|
// Other users only can eliminate themselves
|
||||||
return (( ItsMe && // It's me
|
return (( ItsMe && // It's me
|
||||||
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_ROLE_SYS_ADM)) == 0) // I can not be superuser
|
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_SYS_ADM)) == 0) // I can not be superuser
|
||||||
||
|
||
|
||||||
(!ItsMe && // It's not me
|
(!ItsMe && // It's not me
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)); // I am logged as superuser
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)); // I am logged as superuser
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -4370,7 +4370,7 @@ void Act_AdjustActionWhenNoUsrLogged (void)
|
||||||
|
|
||||||
void Act_AdjustCurrentAction (void)
|
void Act_AdjustCurrentAction (void)
|
||||||
{
|
{
|
||||||
bool IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_ROLE_TEACHER));
|
bool IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TEACHER));
|
||||||
|
|
||||||
/***** Don't adjust anything when current action is not a menu option *****/
|
/***** Don't adjust anything when current action is not a menu option *****/
|
||||||
if (Gbl.CurrentAct != Act_Actions[Gbl.CurrentAct].SuperAction) // It is not a menu option
|
if (Gbl.CurrentAct != Act_Actions[Gbl.CurrentAct].SuperAction) // It is not a menu option
|
||||||
|
@ -4473,7 +4473,7 @@ void Act_AdjustCurrentAction (void)
|
||||||
/***** Depending on the role I am logged... *****/
|
/***** Depending on the role I am logged... *****/
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
switch (Gbl.CurrentAct)
|
switch (Gbl.CurrentAct)
|
||||||
{
|
{
|
||||||
case ActAutUsrInt:
|
case ActAutUsrInt:
|
||||||
|
@ -4506,7 +4506,7 @@ void Act_AdjustCurrentAction (void)
|
||||||
/* If I have no photo, and current action is not available for unknown users,
|
/* If I have no photo, and current action is not available for unknown users,
|
||||||
then update number of clicks without photo */
|
then update number of clicks without photo */
|
||||||
if (!Gbl.Usrs.Me.MyPhotoExists)
|
if (!Gbl.Usrs.Me.MyPhotoExists)
|
||||||
if (!(Act_Actions[Gbl.CurrentAct].PermisIfIBelongToCrs & (1 << Rol_ROLE_UNKNOWN)) && // If current action is not available for unknown users...
|
if (!(Act_Actions[Gbl.CurrentAct].PermisIfIBelongToCrs & (1 << Rol_UNKNOWN)) && // If current action is not available for unknown users...
|
||||||
Gbl.CurrentAct != ActReqMyPho) // ...and current action is not ActReqMyPho...
|
Gbl.CurrentAct != ActReqMyPho) // ...and current action is not ActReqMyPho...
|
||||||
if ((Gbl.Usrs.Me.NumAccWithoutPhoto = Pho_UpdateMyClicksWithoutPhoto ()) > Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
if ((Gbl.Usrs.Me.NumAccWithoutPhoto = Pho_UpdateMyClicksWithoutPhoto ()) > Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
||||||
{
|
{
|
||||||
|
@ -4523,7 +4523,7 @@ void Act_AdjustCurrentAction (void)
|
||||||
if (Gbl.CurrentAct == ActMnu) // Do the following check sometimes, for example when the user changes the current tab
|
if (Gbl.CurrentAct == ActMnu) // Do the following check sometimes, for example when the user changes the current tab
|
||||||
Gbl.CurrentCrs.Info.ShowMsgMustBeRead = Inf_GetIfIMustReadAnyCrsInfoInThisCrs ();
|
Gbl.CurrentCrs.Info.ShowMsgMustBeRead = Inf_GetIfIMustReadAnyCrsInfoInThisCrs ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
if (Gbl.CurrentAct == ActReqTst ||
|
if (Gbl.CurrentAct == ActReqTst ||
|
||||||
Gbl.CurrentAct == ActEdiTstQst)
|
Gbl.CurrentAct == ActEdiTstQst)
|
||||||
/***** If current course has tests and pluggable is unknown,
|
/***** If current course has tests and pluggable is unknown,
|
||||||
|
|
|
@ -74,7 +74,7 @@ void Ann_ShowAllAnnouncements (void)
|
||||||
extern const char *Txt_New_announcement;
|
extern const char *Txt_New_announcement;
|
||||||
|
|
||||||
/***** Put link (form) to create a new announcement *****/
|
/***** Put link (form) to create a new announcement *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
Act_PutContextualLink (ActWriAnn,NULL,"new",Txt_New_announcement);
|
Act_PutContextualLink (ActWriAnn,NULL,"new",Txt_New_announcement);
|
||||||
|
@ -229,8 +229,8 @@ static void Ann_ShowAnnouncement (long AnnCod,const char *Subject,const char *Co
|
||||||
/* Users' roles who can view this announcement */
|
/* Users' roles who can view this announcement */
|
||||||
fprintf (Gbl.F.Out,"<p class=\"DAT\">%s:",
|
fprintf (Gbl.F.Out,"<p class=\"DAT\">%s:",
|
||||||
Txt_Users);
|
Txt_Users);
|
||||||
for (Role = Rol_ROLE_STUDENT, RolesSelected = false;
|
for (Role = Rol_STUDENT, RolesSelected = false;
|
||||||
Role <= Rol_ROLE_TEACHER;
|
Role <= Rol_TEACHER;
|
||||||
Role++)
|
Role++)
|
||||||
if (Roles & (1 << Role))
|
if (Roles & (1 << Role))
|
||||||
{
|
{
|
||||||
|
@ -353,8 +353,8 @@ void Ann_ShowFormAnnouncement (void)
|
||||||
"<td class=\"DAT\""
|
"<td class=\"DAT\""
|
||||||
" style=\"text-align:left; vertical-align:middle;\">",
|
" style=\"text-align:left; vertical-align:middle;\">",
|
||||||
Txt_Users);
|
Txt_Users);
|
||||||
Rol_WriteSelectorRoles (1 << Rol_ROLE_STUDENT |
|
Rol_WriteSelectorRoles (1 << Rol_STUDENT |
|
||||||
1 << Rol_ROLE_TEACHER);
|
1 << Rol_TEACHER);
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,8 @@ void Asg_SeeAssignments (void)
|
||||||
/***** Put link (form) to create a bew assignment *****/
|
/***** Put link (form) to create a bew assignment *****/
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Asg_PutFormToCreateNewAsg ();
|
Asg_PutFormToCreateNewAsg ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -319,8 +319,8 @@ static void Asg_ShowOneAssignment (long AsgCod)
|
||||||
/* Forms to remove/edit this assignment */
|
/* Forms to remove/edit this assignment */
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Asg_PutFormsToRemEditOneAsg (Asg.AsgCod,Asg.Hidden);
|
Asg_PutFormsToRemEditOneAsg (Asg.AsgCod,Asg.Hidden);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -554,8 +554,8 @@ void Asg_GetListAssignments (void)
|
||||||
/***** Get list of assignments from database *****/
|
/***** Get list of assignments from database *****/
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
HiddenSubQuery[0] = '\0';
|
HiddenSubQuery[0] = '\0';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1722,7 +1722,7 @@ static bool Asg_CheckIfICanDoThisAssignment (long AsgCod)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)
|
||||||
{
|
{
|
||||||
/***** Get if I can do an assignment from database *****/
|
/***** Get if I can do an assignment from database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM assignments"
|
sprintf (Query,"SELECT COUNT(*) FROM assignments"
|
||||||
|
|
|
@ -130,8 +130,8 @@ void Att_SeeAttEvents (void)
|
||||||
/* Put link (form) to create a bew attendance event */
|
/* Put link (form) to create a bew attendance event */
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Att_PutFormToCreateNewAttEvent ();
|
Att_PutFormToCreateNewAttEvent ();
|
||||||
Att_PutFormToListStds ();
|
Att_PutFormToListStds ();
|
||||||
break;
|
break;
|
||||||
|
@ -220,7 +220,7 @@ static void Att_ShowAllAttEvents (void)
|
||||||
"</th>"
|
"</th>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_Event,
|
Txt_Event,
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]);
|
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]);
|
||||||
|
|
||||||
/***** Write all the attendance events *****/
|
/***** Write all the attendance events *****/
|
||||||
for (NumAttEvent = Pagination.FirstItemVisible, Gbl.RowEvenOdd = 0;
|
for (NumAttEvent = Pagination.FirstItemVisible, Gbl.RowEvenOdd = 0;
|
||||||
|
@ -344,8 +344,8 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
|
||||||
/* Forms to remove/edit this attendance event */
|
/* Forms to remove/edit this attendance event */
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Att_PutFormsToRemEditOneAttEvent (Att->AttCod,Att->Hidden);
|
Att_PutFormsToRemEditOneAttEvent (Att->AttCod,Att->Hidden);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -549,8 +549,8 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order)
|
||||||
/***** Get list of attendance events from database *****/
|
/***** Get list of attendance events from database *****/
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
HiddenSubQuery[0] = '\0';
|
HiddenSubQuery[0] = '\0';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1858,11 +1858,11 @@ void Att_SeeOneAttEvent (void)
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
Att_ListAttOnlyMeAsStudent (&Att);
|
Att_ListAttOnlyMeAsStudent (&Att);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
/***** Show list of students *****/
|
/***** Show list of students *****/
|
||||||
Att_ListAttStudents (&Att);
|
Att_ListAttStudents (&Att);
|
||||||
break;
|
break;
|
||||||
|
@ -1913,7 +1913,7 @@ static void Att_ListAttOnlyMeAsStudent (struct AttendanceEvent *Att)
|
||||||
"%s"
|
"%s"
|
||||||
"</th>"
|
"</th>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_ROLES_SINGUL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],
|
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||||
Txt_Student_comment,
|
Txt_Student_comment,
|
||||||
Txt_Teachers_comment);
|
Txt_Teachers_comment);
|
||||||
|
|
||||||
|
@ -1949,7 +1949,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
|
||||||
Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt);
|
Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt);
|
||||||
|
|
||||||
/***** Get and order list of students in this course *****/
|
/***** Get and order list of students in this course *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstStds.NumUsrs)
|
if (Gbl.Usrs.LstStds.NumUsrs)
|
||||||
{
|
{
|
||||||
|
@ -1984,7 +1984,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
|
||||||
"%s"
|
"%s"
|
||||||
"</th>"
|
"</th>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_ROLES_SINGUL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],
|
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||||
Txt_Student_comment,
|
Txt_Student_comment,
|
||||||
Txt_Teachers_comment);
|
Txt_Teachers_comment);
|
||||||
|
|
||||||
|
@ -2013,7 +2013,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
|
||||||
Usr_UsrDataDestructor (&UsrDat);
|
Usr_UsrDataDestructor (&UsrDat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_STUDENT);
|
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
|
||||||
|
|
||||||
/***** Free memory for students list *****/
|
/***** Free memory for students list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
||||||
|
@ -2061,7 +2061,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
|
||||||
BgColor,UsrDat->EncryptedUsrCod);
|
BgColor,UsrDat->EncryptedUsrCod);
|
||||||
if (Present) // This student has attended to the event?
|
if (Present) // This student has attended to the event?
|
||||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT) // A student can not change his attendance
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) // A student can not change his attendance
|
||||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
fprintf (Gbl.F.Out," />"
|
fprintf (Gbl.F.Out," />"
|
||||||
"</td>");
|
"</td>");
|
||||||
|
@ -2114,7 +2114,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL\" style=\"text-align:left;"
|
fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL\" style=\"text-align:left;"
|
||||||
" vertical-align:top; background-color:%s;\">",
|
" vertical-align:top; background-color:%s;\">",
|
||||||
BgColor);
|
BgColor);
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT && Att->Open) // Show with form
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && Att->Open) // Show with form
|
||||||
fprintf (Gbl.F.Out,"<textarea name=\"CommentStd%ld\" cols=\"40\" rows=\"3\">%s</textarea>",
|
fprintf (Gbl.F.Out,"<textarea name=\"CommentStd%ld\" cols=\"40\" rows=\"3\">%s</textarea>",
|
||||||
UsrDat->UsrCod,CommentStd);
|
UsrDat->UsrCod,CommentStd);
|
||||||
else // Show without form
|
else // Show without form
|
||||||
|
@ -2129,7 +2129,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL\" style=\"text-align:left;"
|
fprintf (Gbl.F.Out,"<td class=\"DAT_SMALL\" style=\"text-align:left;"
|
||||||
" vertical-align:top; background-color:%s;\">",
|
" vertical-align:top; background-color:%s;\">",
|
||||||
BgColor);
|
BgColor);
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER) // Show with form
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) // Show with form
|
||||||
fprintf (Gbl.F.Out,"<textarea name=\"CommentTch%ld\" cols=\"40\" rows=\"3\">%s</textarea>",
|
fprintf (Gbl.F.Out,"<textarea name=\"CommentTch%ld\" cols=\"40\" rows=\"3\">%s</textarea>",
|
||||||
UsrDat->UsrCod,CommentTch);
|
UsrDat->UsrCod,CommentTch);
|
||||||
else if (Att->CommentTchVisible) // Show without form
|
else if (Att->CommentTchVisible) // Show without form
|
||||||
|
@ -2280,7 +2280,7 @@ void Att_RegisterStudentsInAttEvent (void)
|
||||||
|
|
||||||
/***** 1. Get list of students in the groups selected: Gbl.Usrs.LstStds *****/
|
/***** 1. Get list of students in the groups selected: Gbl.Usrs.LstStds *****/
|
||||||
/* Get list of students in the groups selected */
|
/* Get list of students in the groups selected */
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstStds.NumUsrs) // If there are students in the groups selected...
|
if (Gbl.Usrs.LstStds.NumUsrs) // If there are students in the groups selected...
|
||||||
{
|
{
|
||||||
|
@ -2362,7 +2362,7 @@ void Att_RegisterStudentsInAttEvent (void)
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||||
}
|
}
|
||||||
else // Gbl.Usrs.LstStds.NumUsrs == 0
|
else // Gbl.Usrs.LstStds.NumUsrs == 0
|
||||||
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_ROLE_STUDENT]);
|
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_STUDENT]);
|
||||||
|
|
||||||
/***** Show the attendance event again *****/
|
/***** Show the attendance event again *****/
|
||||||
Gbl.AttEvents.AttCod = Att.AttCod;
|
Gbl.AttEvents.AttCod = Att.AttCod;
|
||||||
|
@ -2623,7 +2623,7 @@ void Usr_ReqListAttendanceStdsCrs (void)
|
||||||
Usr_ShowFormsToSelectUsrListType (ActReqLstAttStd);
|
Usr_ShowFormsToSelectUsrListType (ActReqLstAttStd);
|
||||||
|
|
||||||
/***** Get and order lists of users from current course *****/
|
/***** Get and order lists of users from current course *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstStds.NumUsrs)
|
if (Gbl.Usrs.LstStds.NumUsrs)
|
||||||
{
|
{
|
||||||
|
@ -2640,7 +2640,7 @@ void Usr_ReqListAttendanceStdsCrs (void)
|
||||||
|
|
||||||
/* Write list of students to select some of them */
|
/* Write list of students to select some of them */
|
||||||
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
||||||
Usr_ListUsersToSelect (Rol_ROLE_STUDENT);
|
Usr_ListUsersToSelect (Rol_STUDENT);
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
|
|
||||||
/* Free list of attendance events */
|
/* Free list of attendance events */
|
||||||
|
@ -2656,7 +2656,7 @@ void Usr_ReqListAttendanceStdsCrs (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_STUDENT);
|
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
|
||||||
|
|
||||||
/***** Free memory for students list *****/
|
/***** Free memory for students list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
||||||
|
@ -2973,7 +2973,7 @@ static void Att_ListEventsToSelect (void)
|
||||||
"</th>"
|
"</th>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_Event,
|
Txt_Event,
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]);
|
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]);
|
||||||
|
|
||||||
/***** List the events *****/
|
/***** List the events *****/
|
||||||
for (NumAttEvent = 0, Gbl.RowEvenOdd = 0;
|
for (NumAttEvent = 0, Gbl.RowEvenOdd = 0;
|
||||||
|
@ -3137,7 +3137,7 @@ static void Att_WriteTableHeadSeveralAttEvents (void)
|
||||||
"</th>",
|
"</th>",
|
||||||
Gbl.Usrs.Listing.WithPhotos ? 4 :
|
Gbl.Usrs.Listing.WithPhotos ? 4 :
|
||||||
3,
|
3,
|
||||||
Txt_ROLES_SINGUL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]);
|
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]);
|
||||||
|
|
||||||
for (NumAttEvent = 0;
|
for (NumAttEvent = 0;
|
||||||
NumAttEvent < Gbl.AttEvents.Num;
|
NumAttEvent < Gbl.AttEvents.Num;
|
||||||
|
|
|
@ -86,7 +86,7 @@ void Ban_SeeBanners (void)
|
||||||
" ORDER BY ShortName");
|
" ORDER BY ShortName");
|
||||||
|
|
||||||
/***** Put banner (form) to edit banners *****/
|
/***** Put banner (form) to edit banners *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Ban_PutFormToEditBanners ();
|
Ban_PutFormToEditBanners ();
|
||||||
|
|
||||||
/***** Table head *****/
|
/***** Table head *****/
|
||||||
|
|
|
@ -113,7 +113,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
|
||||||
/***** Get centres with pending degrees *****/
|
/***** Get centres with pending degrees *****/
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_CTR_ADM:
|
case Rol_CTR_ADM:
|
||||||
sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)"
|
sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)"
|
||||||
" FROM degrees,ctr_admin,centres"
|
" FROM degrees,ctr_admin,centres"
|
||||||
" WHERE (degrees.Status & %u)<>0"
|
" WHERE (degrees.Status & %u)<>0"
|
||||||
|
@ -122,7 +122,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
|
||||||
" GROUP BY degrees.CtrCod ORDER BY centres.ShortName",
|
" GROUP BY degrees.CtrCod ORDER BY centres.ShortName",
|
||||||
(unsigned) Deg_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod);
|
(unsigned) Deg_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)"
|
sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)"
|
||||||
" FROM degrees,centres"
|
" FROM degrees,centres"
|
||||||
" WHERE (degrees.Status & %u)<>0"
|
" WHERE (degrees.Status & %u)<>0"
|
||||||
|
@ -275,7 +275,7 @@ static void Ctr_Configuration (bool PrintView)
|
||||||
Act_PutContextualLink (ActPrnCtrInf,NULL,"print",Txt_Print);
|
Act_PutContextualLink (ActPrnCtrInf,NULL,"print",Txt_Print);
|
||||||
|
|
||||||
/* Links to upload logo and photo */
|
/* Links to upload logo and photo */
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
{
|
{
|
||||||
Log_PutFormToChangeLogo (Sco_SCOPE_CTR);
|
Log_PutFormToChangeLogo (Sco_SCOPE_CTR);
|
||||||
Ctr_PutFormToChangeCtrPhoto (PhotoExists);
|
Ctr_PutFormToChangeCtrPhoto (PhotoExists);
|
||||||
|
@ -330,7 +330,7 @@ static void Ctr_Configuration (bool PrintView)
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
/* Photo attribution */
|
/* Photo attribution */
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM && !PrintView)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM && !PrintView)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td colspan=\"2\""
|
"<td colspan=\"2\""
|
||||||
|
@ -493,8 +493,8 @@ static void Ctr_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN],
|
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||||
Usr_GetNumUsrsInCrssOfCtr (Rol_ROLE_TEACHER,Gbl.CurrentCtr.Ctr.CtrCod));
|
Usr_GetNumUsrsInCrssOfCtr (Rol_TEACHER,Gbl.CurrentCtr.Ctr.CtrCod));
|
||||||
|
|
||||||
/***** Number of students *****/
|
/***** Number of students *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -508,8 +508,8 @@ static void Ctr_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],
|
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||||
Usr_GetNumUsrsInCrssOfCtr (Rol_ROLE_STUDENT,Gbl.CurrentCtr.Ctr.CtrCod));
|
Usr_GetNumUsrsInCrssOfCtr (Rol_STUDENT,Gbl.CurrentCtr.Ctr.CtrCod));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End frame *****/
|
/***** End frame *****/
|
||||||
|
@ -535,7 +535,7 @@ void Ctr_ShowCtrsOfCurrentIns (void)
|
||||||
Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActUnk,ActUnk);
|
Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActUnk,ActUnk);
|
||||||
|
|
||||||
/***** Put link (form) to edit centres in current institution *****/
|
/***** Put link (form) to edit centres in current institution *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_)
|
||||||
Lay_PutFormToEdit (ActEdiCtr);
|
Lay_PutFormToEdit (ActEdiCtr);
|
||||||
|
|
||||||
/***** List centres *****/
|
/***** List centres *****/
|
||||||
|
@ -790,9 +790,9 @@ void Ctr_GetListCentres (long InsCod)
|
||||||
" AND crs_usr.UsrCod=usr_data.UsrCod))"
|
" AND crs_usr.UsrCod=usr_data.UsrCod))"
|
||||||
" ORDER BY %s",
|
" ORDER BY %s",
|
||||||
InsCod,
|
InsCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
InsCod,InsCod,
|
InsCod,InsCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
OrderBySubQuery);
|
OrderBySubQuery);
|
||||||
else // InsCod <= 0 ==> all the centres
|
else // InsCod <= 0 ==> all the centres
|
||||||
sprintf (Query,"(SELECT centres.CtrCod,centres.InsCod,centres.PlcCod,"
|
sprintf (Query,"(SELECT centres.CtrCod,centres.InsCod,centres.PlcCod,"
|
||||||
|
@ -812,8 +812,8 @@ void Ctr_GetListCentres (long InsCod)
|
||||||
" WHERE crs_usr.Role='%u'"
|
" WHERE crs_usr.Role='%u'"
|
||||||
" AND crs_usr.UsrCod=usr_data.UsrCod))"
|
" AND crs_usr.UsrCod=usr_data.UsrCod))"
|
||||||
" ORDER BY %s",
|
" ORDER BY %s",
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
OrderBySubQuery);
|
OrderBySubQuery);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get centres");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get centres");
|
||||||
|
|
||||||
|
@ -917,9 +917,9 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
|
||||||
" WHERE crs_usr.Role='%u'"
|
" WHERE crs_usr.Role='%u'"
|
||||||
" AND crs_usr.UsrCod=usr_data.UsrCod))",
|
" AND crs_usr.UsrCod=usr_data.UsrCod))",
|
||||||
Ctr->CtrCod,
|
Ctr->CtrCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
Ctr->CtrCod,
|
Ctr->CtrCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER);
|
(unsigned) Rol_TEACHER);
|
||||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of a centre")) // Centre found...
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of a centre")) // Centre found...
|
||||||
{
|
{
|
||||||
/* Get row */
|
/* Get row */
|
||||||
|
@ -1206,7 +1206,7 @@ static void Ctr_ListCentresForEdition (void)
|
||||||
/* Institution */
|
/* Institution */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT\""
|
fprintf (Gbl.F.Out,"<td class=\"DAT\""
|
||||||
" style=\"text-align:left; vertical-align:middle;\">");
|
" style=\"text-align:left; vertical-align:middle;\">");
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) // I can select institution
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) // I can select institution
|
||||||
{
|
{
|
||||||
Act_FormStart (ActChgCtrIns);
|
Act_FormStart (ActChgCtrIns);
|
||||||
Ctr_PutParamOtherCtrCod (Ctr->CtrCod);
|
Ctr_PutParamOtherCtrCod (Ctr->CtrCod);
|
||||||
|
@ -1334,7 +1334,7 @@ static void Ctr_ListCentresForEdition (void)
|
||||||
/* Centre status */
|
/* Centre status */
|
||||||
StatusTxt = Ctr_GetStatusTxtFromStatusBits (Ctr->Status);
|
StatusTxt = Ctr_GetStatusTxtFromStatusBits (Ctr->Status);
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left; vertical-align:middle;\">");
|
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left; vertical-align:middle;\">");
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM &&
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM &&
|
||||||
StatusTxt == Ctr_STATUS_PENDING)
|
StatusTxt == Ctr_STATUS_PENDING)
|
||||||
{
|
{
|
||||||
Act_FormStart (ActChgCtrSta);
|
Act_FormStart (ActChgCtrSta);
|
||||||
|
@ -1382,7 +1382,7 @@ static void Ctr_ListCentresForEdition (void)
|
||||||
|
|
||||||
static bool Ctr_CheckIfICanEdit (struct Centre *Ctr)
|
static bool Ctr_CheckIfICanEdit (struct Centre *Ctr)
|
||||||
{
|
{
|
||||||
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM || // I am an institution administrator or higher
|
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM || // I am an institution administrator or higher
|
||||||
((Ctr->Status & Ctr_STATUS_BIT_PENDING) != 0 && // Centre is not yet activated
|
((Ctr->Status & Ctr_STATUS_BIT_PENDING) != 0 && // Centre is not yet activated
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod == Ctr->RequesterUsrCod)); // I am the requester
|
Gbl.Usrs.Me.UsrDat.UsrCod == Ctr->RequesterUsrCod)); // I am the requester
|
||||||
}
|
}
|
||||||
|
@ -1973,9 +1973,9 @@ static void Ctr_PutFormToCreateCentre (void)
|
||||||
Ctr = &Gbl.Ctrs.EditingCtr;
|
Ctr = &Gbl.Ctrs.EditingCtr;
|
||||||
|
|
||||||
/***** Start form *****/
|
/***** Start form *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
|
||||||
Act_FormStart (ActNewCtr);
|
Act_FormStart (ActNewCtr);
|
||||||
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__)
|
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_)
|
||||||
Act_FormStart (ActReqCtr);
|
Act_FormStart (ActReqCtr);
|
||||||
else
|
else
|
||||||
Lay_ShowErrorAndExit ("You can not edit centres.");
|
Lay_ShowErrorAndExit ("You can not edit centres.");
|
||||||
|
|
|
@ -103,11 +103,17 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 14.109.2 (2015/04/06)"
|
#define Log_PLATFORM_VERSION "SWAD 14.110 (2015/04/07)"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 14.110: Apr 07, 2015 Testing rich text editor using Markdown, suggested by Pedro A. García Sánchez. (184508 lines)
|
||||||
|
Fixed bug in file browser, reported by Eva Martínez Ortigosa.
|
||||||
|
2 changes necessary in database:
|
||||||
|
ALTER TABLE crs_info_txt CHANGE COLUMN InfoTxt InfoTxtHTML LONGTEXT NOT NULL;
|
||||||
|
ALTER TABLE crs_info_txt ADD COLUMN InfoTxtMD LONGTEXT NOT NULL AFTER InfoTxtHTML;
|
||||||
|
|
||||||
Version 14.109.2: Apr 06, 2015 Changed text in file browser. (184347 lines)
|
Version 14.109.2: Apr 06, 2015 Changed text in file browser. (184347 lines)
|
||||||
Version 14.109.1: Apr 06, 2015 Changed text of button in course info. (184325 lines)
|
Version 14.109.1: Apr 06, 2015 Changed text of button in course info. (184325 lines)
|
||||||
Version 14.109: Apr 06, 2015 Links in file browsers can be uploaded with a name. (184324 lines)
|
Version 14.109: Apr 06, 2015 Links in file browsers can be uploaded with a name. (184324 lines)
|
||||||
|
|
22
swad_chat.c
22
swad_chat.c
|
@ -81,7 +81,7 @@ void Cht_ShowChatRooms (void)
|
||||||
/***** List available chat rooms *****/
|
/***** List available chat rooms *****/
|
||||||
Cht_ShowListOfAvailableChatRooms ();
|
Cht_ShowListOfAvailableChatRooms ();
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Cht_ShowListOfChatRoomsWithUsrs ();
|
Cht_ShowListOfChatRoomsWithUsrs ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,8 +135,8 @@ void Cht_ShowListOfAvailableChatRooms (void)
|
||||||
Gbl.Prefs.IconsURL,Txt_Chat_rooms);
|
Gbl.Prefs.IconsURL,Txt_Chat_rooms);
|
||||||
|
|
||||||
/***** Link to chat available for all the users *****/
|
/***** Link to chat available for all the users *****/
|
||||||
IsLastItemInLevel[1] = (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_STUDENT &&
|
IsLastItemInLevel[1] = (Gbl.Usrs.Me.LoggedRole != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.LoggedRole != Rol_ROLE_TEACHER &&
|
Gbl.Usrs.Me.LoggedRole != Rol_TEACHER &&
|
||||||
!Gbl.Usrs.Me.MyDegrees.Num);
|
!Gbl.Usrs.Me.MyDegrees.Num);
|
||||||
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
|
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
|
||||||
Cht_WriteLinkToChat1 ("GBL_USR",Txt_SEX_PLURAL_Abc[Usr_SEX_ALL],ThisRoomFullName,1,IsLastItemInLevel);
|
Cht_WriteLinkToChat1 ("GBL_USR",Txt_SEX_PLURAL_Abc[Usr_SEX_ALL],ThisRoomFullName,1,IsLastItemInLevel);
|
||||||
|
@ -149,16 +149,16 @@ void Cht_ShowListOfAvailableChatRooms (void)
|
||||||
IsLastItemInLevel[1] = !Gbl.Usrs.Me.MyDegrees.Num;
|
IsLastItemInLevel[1] = !Gbl.Usrs.Me.MyDegrees.Num;
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_ROLE_STUDENT][Usr_SEX_ALL]);
|
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_ALL]);
|
||||||
Cht_WriteLinkToChat1 ("GBL_STD",Txt_Students_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel);
|
Cht_WriteLinkToChat1 ("GBL_STD",Txt_Students_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel);
|
||||||
fprintf (Gbl.F.Out,"<img src=\"%s/chat16x16.gif\""
|
fprintf (Gbl.F.Out,"<img src=\"%s/chat16x16.gif\""
|
||||||
" class=\"ICON16x16\" style=\"vertical-align:middle;\" />",
|
" class=\"ICON16x16\" style=\"vertical-align:middle;\" />",
|
||||||
Gbl.Prefs.IconsURL);
|
Gbl.Prefs.IconsURL);
|
||||||
Cht_WriteLinkToChat2 ("GBL_STD",ThisRoomFullName);
|
Cht_WriteLinkToChat2 ("GBL_STD",ThisRoomFullName);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_ROLE_TEACHER][Usr_SEX_ALL]);
|
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_TEACHER][Usr_SEX_ALL]);
|
||||||
Cht_WriteLinkToChat1 ("GBL_TCH",Txt_Teachers_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel);
|
Cht_WriteLinkToChat1 ("GBL_TCH",Txt_Teachers_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel);
|
||||||
fprintf (Gbl.F.Out,"<img src=\"%s/chat16x16.gif\""
|
fprintf (Gbl.F.Out,"<img src=\"%s/chat16x16.gif\""
|
||||||
" class=\"ICON16x16\" style=\"vertical-align:middle;\" />",
|
" class=\"ICON16x16\" style=\"vertical-align:middle;\" />",
|
||||||
|
@ -440,22 +440,22 @@ void Cht_OpenChatWindow (void)
|
||||||
sprintf (RoomFullName,"|%s (%s)",Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
|
sprintf (RoomFullName,"|%s (%s)",Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
|
||||||
strcat (ListRoomFullNames,RoomFullName);
|
strcat (ListRoomFullNames,RoomFullName);
|
||||||
}
|
}
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)
|
||||||
if (strcmp (RoomCode,"GBL_STD"))
|
if (strcmp (RoomCode,"GBL_STD"))
|
||||||
{
|
{
|
||||||
strcat (ListRoomCodes,"|#GBL_STD");
|
strcat (ListRoomCodes,"|#GBL_STD");
|
||||||
sprintf (RoomShortName,"|%s",Txt_Students_ABBREVIATION);
|
sprintf (RoomShortName,"|%s",Txt_Students_ABBREVIATION);
|
||||||
strcat (ListRoomShortNames,RoomShortName);
|
strcat (ListRoomShortNames,RoomShortName);
|
||||||
sprintf (RoomFullName,"|%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_ROLE_STUDENT][Usr_SEX_ALL]);
|
sprintf (RoomFullName,"|%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_ALL]);
|
||||||
strcat (ListRoomFullNames,RoomFullName);
|
strcat (ListRoomFullNames,RoomFullName);
|
||||||
}
|
}
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER)
|
||||||
if (strcmp (RoomCode,"GBL_TCH"))
|
if (strcmp (RoomCode,"GBL_TCH"))
|
||||||
{
|
{
|
||||||
strcat (ListRoomCodes,"|#GBL_TCH");
|
strcat (ListRoomCodes,"|#GBL_TCH");
|
||||||
sprintf (RoomShortName,"|%s",Txt_Teachers_ABBREVIATION);
|
sprintf (RoomShortName,"|%s",Txt_Teachers_ABBREVIATION);
|
||||||
strcat (ListRoomShortNames,RoomShortName);
|
strcat (ListRoomShortNames,RoomShortName);
|
||||||
sprintf (RoomFullName,"|%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_ROLE_TEACHER][Usr_SEX_ALL]);
|
sprintf (RoomFullName,"|%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_TEACHER][Usr_SEX_ALL]);
|
||||||
strcat (ListRoomFullNames,RoomFullName);
|
strcat (ListRoomFullNames,RoomFullName);
|
||||||
}
|
}
|
||||||
for (NumMyDeg = 0;
|
for (NumMyDeg = 0;
|
||||||
|
|
|
@ -95,7 +95,7 @@ void Con_ShowConnectedUsrs (void)
|
||||||
"<td style=\"padding-bottom:10px; text-align:center;\">");
|
"<td style=\"padding-bottom:10px; text-align:center;\">");
|
||||||
Act_FormStart (ActLstCon);
|
Act_FormStart (ActLstCon);
|
||||||
Gbl.Scope.Current = Sco_SCOPE_CRS;
|
Gbl.Scope.Current = Sco_SCOPE_CRS;
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"%s\">%s: ",
|
fprintf (Gbl.F.Out,"<div class=\"%s\">%s: ",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope);
|
The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope);
|
||||||
|
@ -317,8 +317,8 @@ void Con_ShowGlobalConnectedUsrs (void)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
StdsTotal,
|
StdsTotal,
|
||||||
(StdsTotal == 1) ? Txt_ROLES_SINGUL_abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN] :
|
(StdsTotal == 1) ? Txt_ROLES_SINGUL_abc[Rol_STUDENT][Usr_SEX_UNKNOWN] :
|
||||||
Txt_ROLES_PLURAL_abc [Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]);
|
Txt_ROLES_PLURAL_abc [Rol_STUDENT][Usr_SEX_UNKNOWN]);
|
||||||
|
|
||||||
/***** Write total number of teachers *****/
|
/***** Write total number of teachers *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -328,8 +328,8 @@ void Con_ShowGlobalConnectedUsrs (void)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
TchsTotal,
|
TchsTotal,
|
||||||
(TchsTotal == 1) ? Txt_ROLES_SINGUL_abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN] :
|
(TchsTotal == 1) ? Txt_ROLES_SINGUL_abc[Rol_TEACHER][Usr_SEX_UNKNOWN] :
|
||||||
Txt_ROLES_PLURAL_abc [Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN]);
|
Txt_ROLES_PLURAL_abc [Rol_TEACHER][Usr_SEX_UNKNOWN]);
|
||||||
|
|
||||||
/***** Write total number of users who do not belong to any course *****/
|
/***** Write total number of users who do not belong to any course *****/
|
||||||
if (WithoutCoursesTotal)
|
if (WithoutCoursesTotal)
|
||||||
|
@ -340,8 +340,8 @@ void Con_ShowGlobalConnectedUsrs (void)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
WithoutCoursesTotal,
|
WithoutCoursesTotal,
|
||||||
(WithoutCoursesTotal == 1) ? Txt_ROLES_SINGUL_abc[Rol_ROLE_GUEST__][Usr_SEX_UNKNOWN] :
|
(WithoutCoursesTotal == 1) ? Txt_ROLES_SINGUL_abc[Rol__GUEST_][Usr_SEX_UNKNOWN] :
|
||||||
Txt_ROLES_PLURAL_abc [Rol_ROLE_GUEST__][Usr_SEX_UNKNOWN]);
|
Txt_ROLES_PLURAL_abc [Rol__GUEST_][Usr_SEX_UNKNOWN]);
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
fprintf (Gbl.F.Out,"</table>"
|
fprintf (Gbl.F.Out,"</table>"
|
||||||
|
@ -358,10 +358,10 @@ void Con_ComputeConnectedUsrsBelongingToCurrentCrs (void)
|
||||||
Gbl.Usrs.Connected.NumUsrsToList = 0;
|
Gbl.Usrs.Connected.NumUsrsToList = 0;
|
||||||
|
|
||||||
/***** Number of teachers *****/
|
/***** Number of teachers *****/
|
||||||
Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_ROLE_TEACHER);
|
Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_TEACHER);
|
||||||
|
|
||||||
/***** Number of students *****/
|
/***** Number of students *****/
|
||||||
Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_ROLE_STUDENT);
|
Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_STUDENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -441,7 +441,7 @@ void Con_ShowConnectedUsrsBelongingToScope (void)
|
||||||
}
|
}
|
||||||
fprintf (Gbl.F.Out,"<span class=\"%s\">%u %s %s</span>",
|
fprintf (Gbl.F.Out,"<span class=\"%s\">%u %s %s</span>",
|
||||||
The_ClassConnected[Gbl.Prefs.Theme],
|
The_ClassConnected[Gbl.Prefs.Theme],
|
||||||
Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_ROLE_UNKNOWN,&UsrSex),
|
Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_UNKNOWN,&UsrSex),
|
||||||
Txt_from,
|
Txt_from,
|
||||||
LocationName);
|
LocationName);
|
||||||
|
|
||||||
|
@ -461,15 +461,15 @@ void Con_ShowConnectedUsrsBelongingToScope (void)
|
||||||
switch (Gbl.Usrs.Connected.WhereToShow)
|
switch (Gbl.Usrs.Connected.WhereToShow)
|
||||||
{
|
{
|
||||||
case Con_SHOW_ON_MAIN_ZONE:
|
case Con_SHOW_ON_MAIN_ZONE:
|
||||||
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_ROLE_TEACHER);
|
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_TEACHER);
|
||||||
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_ROLE_STUDENT);
|
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_STUDENT);
|
||||||
break;
|
break;
|
||||||
case Con_SHOW_ON_RIGHT_COLUMN:
|
case Con_SHOW_ON_RIGHT_COLUMN:
|
||||||
Gbl.Usrs.Connected.NumUsr = 0;
|
Gbl.Usrs.Connected.NumUsr = 0;
|
||||||
Gbl.Usrs.Connected.NumUsrs = 0;
|
Gbl.Usrs.Connected.NumUsrs = 0;
|
||||||
Gbl.Usrs.Connected.NumUsrsToList = 0;
|
Gbl.Usrs.Connected.NumUsrsToList = 0;
|
||||||
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColumn (Rol_ROLE_TEACHER);
|
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColumn (Rol_TEACHER);
|
||||||
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColumn (Rol_ROLE_STUDENT);
|
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColumn (Rol_STUDENT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,10 +489,10 @@ static void Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_Role_t Role
|
||||||
/***** Get number of connected users who belong to current course *****/
|
/***** Get number of connected users who belong to current course *****/
|
||||||
switch (Role)
|
switch (Role)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
Gbl.Usrs.Connected.NumTchs = Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Role,&Gbl.Usrs.Connected.SexTchs);
|
Gbl.Usrs.Connected.NumTchs = Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Role,&Gbl.Usrs.Connected.SexTchs);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
Gbl.Usrs.Connected.NumStds = Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Role,&Gbl.Usrs.Connected.SexStds);
|
Gbl.Usrs.Connected.NumStds = Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Role,&Gbl.Usrs.Connected.SexStds);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -501,7 +501,7 @@ static void Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_Role_t Role
|
||||||
|
|
||||||
/***** List connected users belonging to this course *****/
|
/***** List connected users belonging to this course *****/
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Role);
|
Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,27 +533,27 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS: // Show connected users in the whole platform
|
case Sco_SCOPE_SYS: // Show connected users in the whole platform
|
||||||
case Sco_SCOPE_CTY: // Show connected users in the current country
|
case Sco_SCOPE_CTY: // Show connected users in the current country
|
||||||
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM)
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS: // Show connected users in the current institution
|
case Sco_SCOPE_INS: // Show connected users in the current institution
|
||||||
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADM ||
|
if (!(Gbl.Usrs.Me.LoggedRole == Rol_INS_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR: // Show connected users in the current centre
|
case Sco_SCOPE_CTR: // Show connected users in the current centre
|
||||||
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADM ||
|
if (!(Gbl.Usrs.Me.LoggedRole == Rol_CTR_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG: // Show connected users in the current degree
|
case Sco_SCOPE_DEG: // Show connected users in the current degree
|
||||||
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
if (!(Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS: // Show connected users in the current course
|
case Sco_SCOPE_CRS: // Show connected users in the current course
|
||||||
if (!(Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
if (!(Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -581,11 +581,11 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColum
|
||||||
/***** Write number of connected users who belong to current course *****/
|
/***** Write number of connected users who belong to current course *****/
|
||||||
switch (Role)
|
switch (Role)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
NumUsrsThisRole = Gbl.Usrs.Connected.NumTchs;
|
NumUsrsThisRole = Gbl.Usrs.Connected.NumTchs;
|
||||||
UsrSex = Gbl.Usrs.Connected.SexTchs;
|
UsrSex = Gbl.Usrs.Connected.SexTchs;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
NumUsrsThisRole = Gbl.Usrs.Connected.NumStds;
|
NumUsrsThisRole = Gbl.Usrs.Connected.NumStds;
|
||||||
UsrSex = Gbl.Usrs.Connected.SexStds;
|
UsrSex = Gbl.Usrs.Connected.SexStds;
|
||||||
break;
|
break;
|
||||||
|
@ -633,7 +633,7 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColum
|
||||||
*/
|
*/
|
||||||
case Sco_SCOPE_CRS: // Show connected users in the current course
|
case Sco_SCOPE_CRS: // Show connected users in the current course
|
||||||
if (!(Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
if (!(Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -674,8 +674,8 @@ void Con_UpdateMeInConnectedList (void)
|
||||||
Rol_Role_t MyRoleInConnected;
|
Rol_Role_t MyRoleInConnected;
|
||||||
|
|
||||||
/***** Which role will be stored in connected table? *****/
|
/***** Which role will be stored in connected table? *****/
|
||||||
MyRoleInConnected = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT ||
|
MyRoleInConnected = (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER) ? Gbl.Usrs.Me.LoggedRole :
|
Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) ? Gbl.Usrs.Me.LoggedRole :
|
||||||
Gbl.Usrs.Me.MaxRole;
|
Gbl.Usrs.Me.MaxRole;
|
||||||
|
|
||||||
/***** Update my entry in connected list. The role which is stored is the role of the last click *****/
|
/***** Update my entry in connected list. The role which is stored is the role of the last click *****/
|
||||||
|
@ -713,7 +713,7 @@ static unsigned Con_GetConnectedGuestsTotal (void)
|
||||||
/***** Get number of connected users not belonging to any course *****/
|
/***** Get number of connected users not belonging to any course *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM connected"
|
sprintf (Query,"SELECT COUNT(*) FROM connected"
|
||||||
" WHERE RoleInLastCrs='%u'",
|
" WHERE RoleInLastCrs='%u'",
|
||||||
(unsigned) Rol_ROLE_GUEST__);
|
(unsigned) Rol__GUEST_);
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of connected users who not belong to any course");
|
return (unsigned) DB_QueryCOUNT (Query,"can not get number of connected users who not belong to any course");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ static unsigned Con_GetConnectedStdsTotal (void)
|
||||||
|
|
||||||
/***** Get number of connected students from database *****/
|
/***** Get number of connected students from database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM connected WHERE RoleInLastCrs='%u'",
|
sprintf (Query,"SELECT COUNT(*) FROM connected WHERE RoleInLastCrs='%u'",
|
||||||
(unsigned) Rol_ROLE_STUDENT);
|
(unsigned) Rol_STUDENT);
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of connected students");
|
return (unsigned) DB_QueryCOUNT (Query,"can not get number of connected students");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ static unsigned Con_GetConnectedTchsTotal (void)
|
||||||
|
|
||||||
/***** Get number of connected teachers from database *****/
|
/***** Get number of connected teachers from database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM connected WHERE RoleInLastCrs='%u'",
|
sprintf (Query,"SELECT COUNT(*) FROM connected WHERE RoleInLastCrs='%u'",
|
||||||
(unsigned) Rol_ROLE_TEACHER);
|
(unsigned) Rol_TEACHER);
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of connected teachers");
|
return (unsigned) DB_QueryCOUNT (Query,"can not get number of connected teachers");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,7 +770,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS: // Show connected users in the whole platform
|
case Sco_SCOPE_SYS: // Show connected users in the whole platform
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||||
" FROM connected,usr_data"
|
" FROM connected,usr_data"
|
||||||
" WHERE connected.UsrCod=usr_data.UsrCod");
|
" WHERE connected.UsrCod=usr_data.UsrCod");
|
||||||
|
@ -783,7 +783,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
|
||||||
(unsigned) Role);
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY: // Show connected users in the current country
|
case Sco_SCOPE_CTY: // Show connected users in the current country
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr,connected,usr_data"
|
" FROM institutions,centres,degrees,courses,crs_usr,connected,usr_data"
|
||||||
" WHERE institutions.CtyCod='%ld'"
|
" WHERE institutions.CtyCod='%ld'"
|
||||||
|
@ -809,7 +809,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
|
||||||
(unsigned) Role);
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS: // Show connected users in the current institution
|
case Sco_SCOPE_INS: // Show connected users in the current institution
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||||
" FROM centres,degrees,courses,crs_usr,connected,usr_data"
|
" FROM centres,degrees,courses,crs_usr,connected,usr_data"
|
||||||
" WHERE centres.InsCod='%ld'"
|
" WHERE centres.InsCod='%ld'"
|
||||||
|
@ -833,7 +833,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
|
||||||
(unsigned) Role);
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR: // Show connected users in the current centre
|
case Sco_SCOPE_CTR: // Show connected users in the current centre
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||||
" FROM degrees,courses,crs_usr,connected,usr_data"
|
" FROM degrees,courses,crs_usr,connected,usr_data"
|
||||||
" WHERE degrees.CtrCod='%ld'"
|
" WHERE degrees.CtrCod='%ld'"
|
||||||
|
@ -855,7 +855,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
|
||||||
(unsigned) Role);
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG: // Show connected users in the current degree
|
case Sco_SCOPE_DEG: // Show connected users in the current degree
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||||
" FROM courses,crs_usr,connected,usr_data"
|
" FROM courses,crs_usr,connected,usr_data"
|
||||||
" WHERE courses.DegCod='%ld'"
|
" WHERE courses.DegCod='%ld'"
|
||||||
|
@ -875,7 +875,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
|
||||||
(unsigned) Role);
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS: // Show connected users in the current course
|
case Sco_SCOPE_CRS: // Show connected users in the current course
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
|
||||||
" FROM crs_usr,connected,usr_data"
|
" FROM crs_usr,connected,usr_data"
|
||||||
" WHERE crs_usr.CrsCod='%ld'"
|
" WHERE crs_usr.CrsCod='%ld'"
|
||||||
|
@ -1036,7 +1036,7 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
|
||||||
" vertical-align:middle; background-color:%s;\">",
|
" vertical-align:middle; background-color:%s;\">",
|
||||||
Font,Color);
|
Font,Color);
|
||||||
sprintf (Gbl.FormId,"form_con_%d",++Gbl.NumFormConnectedUsrs);
|
sprintf (Gbl.FormId,"form_con_%d",++Gbl.NumFormConnectedUsrs);
|
||||||
Act_FormStartId ((Role == Rol_ROLE_STUDENT) ? ActSeeRecOneStd :
|
Act_FormStartId ((Role == Rol_STUDENT) ? ActSeeRecOneStd :
|
||||||
ActSeeRecOneTch,
|
ActSeeRecOneTch,
|
||||||
Gbl.FormId);
|
Gbl.FormId);
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
|
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
|
||||||
|
@ -1229,7 +1229,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
||||||
Font,Gbl.ColorRows[Gbl.RowEvenOdd]);
|
Font,Gbl.ColorRows[Gbl.RowEvenOdd]);
|
||||||
if (PutLinkToRecord)
|
if (PutLinkToRecord)
|
||||||
{
|
{
|
||||||
Act_FormStart ((Role == Rol_ROLE_STUDENT) ? ActSeeRecOneStd :
|
Act_FormStart ((Role == Rol_STUDENT) ? ActSeeRecOneStd :
|
||||||
ActSeeRecOneTch);
|
ActSeeRecOneTch);
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
|
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
|
||||||
Act_LinkFormSubmit (UsrDat.FullName,Font);
|
Act_LinkFormSubmit (UsrDat.FullName,Font);
|
||||||
|
|
|
@ -99,7 +99,7 @@ void Cty_SeeCtyWithPendingInss (void)
|
||||||
/***** Get countries with pending institutions *****/
|
/***** Get countries with pending institutions *****/
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
sprintf (Query,"SELECT institutions.CtyCod,COUNT(*)"
|
sprintf (Query,"SELECT institutions.CtyCod,COUNT(*)"
|
||||||
" FROM institutions,countries"
|
" FROM institutions,countries"
|
||||||
" WHERE (institutions.Status & %u)<>0"
|
" WHERE (institutions.Status & %u)<>0"
|
||||||
|
@ -283,7 +283,7 @@ static void Cty_Configuration (bool PrintView)
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
/* Map attribution */
|
/* Map attribution */
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM && !PrintView)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM && !PrintView)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td colspan=\"2\""
|
"<td colspan=\"2\""
|
||||||
|
@ -438,8 +438,8 @@ static void Cty_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN],
|
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||||
Usr_GetNumUsrsInCrssOfCty (Rol_ROLE_TEACHER,Gbl.CurrentCty.Cty.CtyCod));
|
Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,Gbl.CurrentCty.Cty.CtyCod));
|
||||||
|
|
||||||
/***** Number of students *****/
|
/***** Number of students *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -453,8 +453,8 @@ static void Cty_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],
|
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||||
Usr_GetNumUsrsInCrssOfCty (Rol_ROLE_STUDENT,Gbl.CurrentCty.Cty.CtyCod));
|
Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,Gbl.CurrentCty.Cty.CtyCod));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End frame *****/
|
/***** End frame *****/
|
||||||
|
@ -510,7 +510,7 @@ void Cty_ListCountries2 (void)
|
||||||
const char *BgColor;
|
const char *BgColor;
|
||||||
|
|
||||||
/***** Put link (form) to edit countries *****/
|
/***** Put link (form) to edit countries *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Lay_PutFormToEdit (ActEdiCty);
|
Lay_PutFormToEdit (ActEdiCty);
|
||||||
|
|
||||||
/***** Table head *****/
|
/***** Table head *****/
|
||||||
|
@ -592,8 +592,8 @@ void Cty_ListCountries2 (void)
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
/* Write stats of this country */
|
/* Write stats of this country */
|
||||||
NumStds = Usr_GetNumUsrsInCountry (Rol_ROLE_STUDENT,Gbl.Ctys.Lst[NumCty].CtyCod);
|
NumStds = Usr_GetNumUsrsInCountry (Rol_STUDENT,Gbl.Ctys.Lst[NumCty].CtyCod);
|
||||||
NumTchs = Usr_GetNumUsrsInCountry (Rol_ROLE_TEACHER,Gbl.Ctys.Lst[NumCty].CtyCod);
|
NumTchs = Usr_GetNumUsrsInCountry (Rol_TEACHER,Gbl.Ctys.Lst[NumCty].CtyCod);
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT\""
|
fprintf (Gbl.F.Out,"<td class=\"DAT\""
|
||||||
" style=\"text-align:right; background-color:%s;\">"
|
" style=\"text-align:right; background-color:%s;\">"
|
||||||
"%u"
|
"%u"
|
||||||
|
@ -632,9 +632,9 @@ void Cty_ListCountries2 (void)
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
/***** Write institutions and users with other country *****/
|
/***** Write institutions and users with other country *****/
|
||||||
NumUsrsInOtherCtys = Usr_GetNumUsrsInCountry (Rol_ROLE_UNKNOWN,0); // Here Rol_ROLE_UNKNOWN means "all users"
|
NumUsrsInOtherCtys = Usr_GetNumUsrsInCountry (Rol_UNKNOWN,0); // Here Rol_ROLE_UNKNOWN means "all users"
|
||||||
NumStds = Usr_GetNumUsrsInCountry (Rol_ROLE_STUDENT,0);
|
NumStds = Usr_GetNumUsrsInCountry (Rol_STUDENT,0);
|
||||||
NumTchs = Usr_GetNumUsrsInCountry (Rol_ROLE_TEACHER,0);
|
NumTchs = Usr_GetNumUsrsInCountry (Rol_TEACHER,0);
|
||||||
NumInssInOtherCtys = Ins_GetNumInssInCty (0);
|
NumInssInOtherCtys = Ins_GetNumInssInCty (0);
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td></td>"
|
"<td></td>"
|
||||||
|
@ -662,9 +662,9 @@ void Cty_ListCountries2 (void)
|
||||||
NumInssWithCountry += NumInssInOtherCtys;
|
NumInssWithCountry += NumInssInOtherCtys;
|
||||||
|
|
||||||
/***** Write institutions with no country *****/
|
/***** Write institutions with no country *****/
|
||||||
NumStds = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_ROLE_STUDENT);
|
NumStds = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_STUDENT);
|
||||||
NumTchs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_ROLE_TEACHER);
|
NumTchs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_TEACHER);
|
||||||
NumUsrs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_ROLE_UNKNOWN); // NumUsrs >= NumStds + NumTchs
|
NumUsrs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_UNKNOWN); // NumUsrs >= NumStds + NumTchs
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td></td>"
|
"<td></td>"
|
||||||
"<td class=\"DAT\" style=\"text-align:left;\">"
|
"<td class=\"DAT\" style=\"text-align:left;\">"
|
||||||
|
|
|
@ -161,7 +161,7 @@ static void Crs_Configuration (bool PrintView)
|
||||||
unsigned Year;
|
unsigned Year;
|
||||||
unsigned Semester;
|
unsigned Semester;
|
||||||
struct Ind_IndicatorsCrs Indicators;
|
struct Ind_IndicatorsCrs Indicators;
|
||||||
bool IsForm = (!PrintView && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER);
|
bool IsForm = (!PrintView && Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER);
|
||||||
bool PutLink = !PrintView && Gbl.CurrentDeg.Deg.WWW[0];
|
bool PutLink = !PrintView && Gbl.CurrentDeg.Deg.WWW[0];
|
||||||
|
|
||||||
/***** Messages and links above the frame *****/
|
/***** Messages and links above the frame *****/
|
||||||
|
@ -169,7 +169,7 @@ static void Crs_Configuration (bool PrintView)
|
||||||
{
|
{
|
||||||
/* Get indicators and show warning */
|
/* Get indicators and show warning */
|
||||||
Ind_GetIndicatorsCrs (Gbl.CurrentCrs.Crs.CrsCod,&Indicators);
|
Ind_GetIndicatorsCrs (Gbl.CurrentCrs.Crs.CrsCod,&Indicators);
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER &&
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER &&
|
||||||
Indicators.CountIndicators < Ind_NUM_INDICATORS)
|
Indicators.CountIndicators < Ind_NUM_INDICATORS)
|
||||||
{
|
{
|
||||||
/* Warning alert */
|
/* Warning alert */
|
||||||
|
@ -192,8 +192,8 @@ static void Crs_Configuration (bool PrintView)
|
||||||
Act_PutContextualLink (ActPrnCrsInf,NULL,"print",Txt_Print);
|
Act_PutContextualLink (ActPrnCrsInf,NULL,"print",Txt_Print);
|
||||||
|
|
||||||
/* Link to request enrollment in the current course */
|
/* Link to request enrollment in the current course */
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST__ ||
|
if (Gbl.Usrs.Me.LoggedRole == Rol__GUEST_ ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_VISITOR)
|
Gbl.Usrs.Me.LoggedRole == Rol_VISITOR)
|
||||||
Enr_PutLinkToRequestSignUp ();
|
Enr_PutLinkToRequestSignUp ();
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
@ -398,7 +398,7 @@ static void Crs_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumTchs);
|
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumTchs);
|
||||||
|
|
||||||
/***** Number of students *****/
|
/***** Number of students *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -412,7 +412,7 @@ static void Crs_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumStds);
|
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumStds);
|
||||||
|
|
||||||
/***** Indicators *****/
|
/***** Indicators *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -967,7 +967,7 @@ void Crs_ShowCrssOfCurrentDeg (void)
|
||||||
Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActSeeDeg,ActSeeCrs);
|
Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActSeeDeg,ActSeeCrs);
|
||||||
|
|
||||||
/***** Put link (form) to edit courses in current degree *****/
|
/***** Put link (form) to edit courses in current degree *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_)
|
||||||
Lay_PutFormToEdit (ActEdiCrs);
|
Lay_PutFormToEdit (ActEdiCrs);
|
||||||
|
|
||||||
/***** Show list of courses *****/
|
/***** Show list of courses *****/
|
||||||
|
@ -1425,7 +1425,7 @@ static void Crs_ListCoursesForEdition (void)
|
||||||
/* Degree */
|
/* Degree */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
||||||
" vertical-align:middle;\">");
|
" vertical-align:middle;\">");
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
{
|
{
|
||||||
Act_FormStart (ActChgCrsDeg);
|
Act_FormStart (ActChgCrsDeg);
|
||||||
Crs_PutParamOtherCrsCod (Crs->CrsCod);
|
Crs_PutParamOtherCrsCod (Crs->CrsCod);
|
||||||
|
@ -1551,7 +1551,7 @@ static void Crs_ListCoursesForEdition (void)
|
||||||
StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status);
|
StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status);
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
||||||
" vertical-align:middle;\">");
|
" vertical-align:middle;\">");
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM &&
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM &&
|
||||||
StatusTxt == Crs_STATUS_PENDING)
|
StatusTxt == Crs_STATUS_PENDING)
|
||||||
{
|
{
|
||||||
Act_FormStart (ActChgCrsSta);
|
Act_FormStart (ActChgCrsSta);
|
||||||
|
@ -1600,7 +1600,7 @@ static void Crs_ListCoursesForEdition (void)
|
||||||
|
|
||||||
static bool Crs_CheckIfICanEdit (struct Course *Crs)
|
static bool Crs_CheckIfICanEdit (struct Course *Crs)
|
||||||
{
|
{
|
||||||
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM || // I am a degree administrator or higher
|
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM || // I am a degree administrator or higher
|
||||||
((Crs->Status & Crs_STATUS_BIT_PENDING) != 0 && // Course is not yet activated
|
((Crs->Status & Crs_STATUS_BIT_PENDING) != 0 && // Course is not yet activated
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod == Crs->RequesterUsrCod)); // I am the requester
|
Gbl.Usrs.Me.UsrDat.UsrCod == Crs->RequesterUsrCod)); // I am the requester
|
||||||
}
|
}
|
||||||
|
@ -1663,9 +1663,9 @@ static void Crs_PutFormToCreateCourse (void)
|
||||||
unsigned Semester;
|
unsigned Semester;
|
||||||
|
|
||||||
/***** Start form *****/
|
/***** Start form *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
Act_FormStart (ActNewCrs);
|
Act_FormStart (ActNewCrs);
|
||||||
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__)
|
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_)
|
||||||
Act_FormStart (ActReqCrs);
|
Act_FormStart (ActReqCrs);
|
||||||
else
|
else
|
||||||
Lay_ShowErrorAndExit ("You can not edit courses.");
|
Lay_ShowErrorAndExit ("You can not edit courses.");
|
||||||
|
@ -2211,10 +2211,10 @@ static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row)
|
||||||
Crs->FullName[Crs_MAX_LENGTH_COURSE_FULL_NAME] = '\0';
|
Crs->FullName[Crs_MAX_LENGTH_COURSE_FULL_NAME] = '\0';
|
||||||
|
|
||||||
/***** Get number of students *****/
|
/***** Get number of students *****/
|
||||||
Crs->NumStds = Usr_GetNumUsrsInCrs (Rol_ROLE_STUDENT,Crs->CrsCod);
|
Crs->NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,Crs->CrsCod);
|
||||||
|
|
||||||
/***** Get number of teachers *****/
|
/***** Get number of teachers *****/
|
||||||
Crs->NumTchs = Usr_GetNumUsrsInCrs (Rol_ROLE_TEACHER,Crs->CrsCod);
|
Crs->NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,Crs->CrsCod);
|
||||||
|
|
||||||
Crs->NumUsrs = Crs->NumStds + Crs->NumTchs;
|
Crs->NumUsrs = Crs->NumStds + Crs->NumTchs;
|
||||||
}
|
}
|
||||||
|
@ -2531,9 +2531,9 @@ void Crs_ChangeCrsDegree (void)
|
||||||
Lay_ShowErrorAndExit ("Code of degree is missing.");
|
Lay_ShowErrorAndExit ("Code of degree is missing.");
|
||||||
|
|
||||||
/* Check if I have permission to change course to this degree */
|
/* Check if I have permission to change course to this degree */
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
ICanChangeCrsToNewDeg = true;
|
ICanChangeCrsToNewDeg = true;
|
||||||
else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM)
|
else if (Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM)
|
||||||
ICanChangeCrsToNewDeg = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
ICanChangeCrsToNewDeg = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Sco_SCOPE_DEG,
|
Sco_SCOPE_DEG,
|
||||||
NewDeg.DegCod);
|
NewDeg.DegCod);
|
||||||
|
@ -3280,8 +3280,8 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
|
||||||
Lay_ShowErrorAndExit ("Wrong code of course.");
|
Lay_ShowErrorAndExit ("Wrong code of course.");
|
||||||
|
|
||||||
/***** Get number of students and teachers in this course *****/
|
/***** Get number of students and teachers in this course *****/
|
||||||
NumStds = Usr_GetNumUsrsInCrs (Rol_ROLE_STUDENT,CrsCod);
|
NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,CrsCod);
|
||||||
NumTchs = Usr_GetNumUsrsInCrs (Rol_ROLE_TEACHER,CrsCod);
|
NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,CrsCod);
|
||||||
if (NumStds + NumTchs)
|
if (NumStds + NumTchs)
|
||||||
{
|
{
|
||||||
Style = "DAT_N";
|
Style = "DAT_N";
|
||||||
|
@ -3390,7 +3390,7 @@ void Crs_UpdateCrsLast (void)
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_STUDENT)
|
Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT)
|
||||||
{
|
{
|
||||||
/***** Update my last access to current course *****/
|
/***** Update my last access to current course *****/
|
||||||
sprintf (Query,"REPLACE INTO crs_last (CrsCod,LastTime)"
|
sprintf (Query,"REPLACE INTO crs_last (CrsCod,LastTime)"
|
||||||
|
|
|
@ -692,19 +692,21 @@ mysql> DESCRIBE crs_info_src;
|
||||||
/***** Table crs_info_txt *****/
|
/***** Table crs_info_txt *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE crs_info_txt;
|
mysql> DESCRIBE crs_info_txt;
|
||||||
+----------+--------------------------------------------------------------------------------------------+------+-----+---------+-------+
|
+-------------+--------------------------------------------------------------------------------------------+------+-----+---------+-------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+----------+--------------------------------------------------------------------------------------------+------+-----+---------+-------+
|
+-------------+--------------------------------------------------------------------------------------------+------+-----+---------+-------+
|
||||||
| CrsCod | int(11) | NO | PRI | -1 | |
|
| CrsCod | int(11) | NO | PRI | -1 | |
|
||||||
| InfoType | enum('intro','description','theory','practices','bibliography','FAQ','links','assessment') | NO | PRI | NULL | |
|
| InfoType | enum('intro','description','theory','practices','bibliography','FAQ','links','assessment') | NO | PRI | NULL | |
|
||||||
| InfoTxt | longtext | NO | | NULL | |
|
| InfoTxtHTML | longtext | NO | | NULL | |
|
||||||
+----------+--------------------------------------------------------------------------------------------+------+-----+---------+-------+
|
| InfoTxtMD | longtext | NO | | NULL | |
|
||||||
3 rows in set (0.00 sec)
|
+-------------+--------------------------------------------------------------------------------------------+------+-----+---------+-------+
|
||||||
|
4 rows in set (0.01 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS crs_info_txt ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS crs_info_txt ("
|
||||||
"CrsCod INT NOT NULL DEFAULT -1,"
|
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||||
"InfoType ENUM('intro','description','theory','practices','bibliography','FAQ','links','assessment') NOT NULL,"
|
"InfoType ENUM('intro','description','theory','practices','bibliography','FAQ','links','assessment') NOT NULL,"
|
||||||
"InfoTxt LONGTEXT NOT NULL,"
|
"InfoTxtHTML LONGTEXT NOT NULL,"
|
||||||
|
"InfoTxtMD LONGTEXT NOT NULL,"
|
||||||
"UNIQUE INDEX(CrsCod,InfoType))");
|
"UNIQUE INDEX(CrsCod,InfoType))");
|
||||||
|
|
||||||
/***** Table crs_last *****/
|
/***** Table crs_last *****/
|
||||||
|
|
|
@ -162,7 +162,7 @@ void Deg_SeeDegWithPendingCrss (void)
|
||||||
/***** Get degrees with pending courses *****/
|
/***** Get degrees with pending courses *****/
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
sprintf (Query,"SELECT courses.DegCod,COUNT(*)"
|
sprintf (Query,"SELECT courses.DegCod,COUNT(*)"
|
||||||
" FROM admin,courses,degrees"
|
" FROM admin,courses,degrees"
|
||||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
||||||
|
@ -172,7 +172,7 @@ void Deg_SeeDegWithPendingCrss (void)
|
||||||
" GROUP BY courses.DegCod ORDER BY degrees.ShortName",
|
" GROUP BY courses.DegCod ORDER BY degrees.ShortName",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Crs_STATUS_BIT_PENDING);
|
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Crs_STATUS_BIT_PENDING);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
sprintf (Query,"SELECT courses.DegCod,COUNT(*)"
|
sprintf (Query,"SELECT courses.DegCod,COUNT(*)"
|
||||||
" FROM courses,degrees"
|
" FROM courses,degrees"
|
||||||
" WHERE (courses.Status & %u)<>0"
|
" WHERE (courses.Status & %u)<>0"
|
||||||
|
@ -313,7 +313,7 @@ static void Deg_Configuration (bool PrintView)
|
||||||
Act_PutContextualLink (ActPrnDegInf,NULL,"print",Txt_Print);
|
Act_PutContextualLink (ActPrnDegInf,NULL,"print",Txt_Print);
|
||||||
|
|
||||||
/* Link to upload logo */
|
/* Link to upload logo */
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
Log_PutFormToChangeLogo (Sco_SCOPE_DEG);
|
Log_PutFormToChangeLogo (Sco_SCOPE_DEG);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
@ -462,8 +462,8 @@ static void Deg_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN],
|
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||||
Usr_GetNumUsrsInCrssOfDeg (Rol_ROLE_TEACHER,Gbl.CurrentDeg.Deg.DegCod));
|
Usr_GetNumUsrsInCrssOfDeg (Rol_TEACHER,Gbl.CurrentDeg.Deg.DegCod));
|
||||||
|
|
||||||
/***** Number of students *****/
|
/***** Number of students *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -477,8 +477,8 @@ static void Deg_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],
|
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||||
Usr_GetNumUsrsInCrssOfDeg (Rol_ROLE_STUDENT,Gbl.CurrentDeg.Deg.DegCod));
|
Usr_GetNumUsrsInCrssOfDeg (Rol_STUDENT,Gbl.CurrentDeg.Deg.DegCod));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End frame *****/
|
/***** End frame *****/
|
||||||
|
@ -970,7 +970,7 @@ void Deg_WriteSelectorDegTypes (void)
|
||||||
void Deg_SeeDegTypes (void)
|
void Deg_SeeDegTypes (void)
|
||||||
{
|
{
|
||||||
/***** Put link (form) to edit degree types *****/
|
/***** Put link (form) to edit degree types *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Lay_PutFormToEdit (ActEdiDegTyp);
|
Lay_PutFormToEdit (ActEdiDegTyp);
|
||||||
|
|
||||||
/***** Get list of degree types *****/
|
/***** Get list of degree types *****/
|
||||||
|
@ -1015,7 +1015,7 @@ void Deg_ShowDegsOfCurrentCtr (void)
|
||||||
Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActSeeDeg,ActUnk);
|
Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActSeeDeg,ActUnk);
|
||||||
|
|
||||||
/***** Put link (form) to edit degrees of the current centre *****/
|
/***** Put link (form) to edit degrees of the current centre *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_)
|
||||||
Lay_PutFormToEdit (ActEdiDeg);
|
Lay_PutFormToEdit (ActEdiDeg);
|
||||||
|
|
||||||
/***** Show list of degrees *****/
|
/***** Show list of degrees *****/
|
||||||
|
@ -1450,7 +1450,7 @@ static void Deg_ListDegreesForEdition (void)
|
||||||
/* Centre */
|
/* Centre */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT\""
|
fprintf (Gbl.F.Out,"<td class=\"DAT\""
|
||||||
" style=\"text-align:left; vertical-align:middle;\">");
|
" style=\"text-align:left; vertical-align:middle;\">");
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) // I can select centre
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) // I can select centre
|
||||||
{
|
{
|
||||||
Act_FormStart (ActChgDegCtr);
|
Act_FormStart (ActChgDegCtr);
|
||||||
Deg_PutParamOtherDegCod (Deg->DegCod);
|
Deg_PutParamOtherDegCod (Deg->DegCod);
|
||||||
|
@ -1647,7 +1647,7 @@ static void Deg_ListDegreesForEdition (void)
|
||||||
StatusTxt = Deg_GetStatusTxtFromStatusBits (Deg->Status);
|
StatusTxt = Deg_GetStatusTxtFromStatusBits (Deg->Status);
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
||||||
" vertical-align:middle;\">");
|
" vertical-align:middle;\">");
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM &&
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM &&
|
||||||
StatusTxt == Deg_STATUS_PENDING)
|
StatusTxt == Deg_STATUS_PENDING)
|
||||||
{
|
{
|
||||||
Act_FormStart (ActChgDegSta);
|
Act_FormStart (ActChgDegSta);
|
||||||
|
@ -1695,7 +1695,7 @@ static void Deg_ListDegreesForEdition (void)
|
||||||
|
|
||||||
static bool Deg_CheckIfICanEdit (struct Degree *Deg)
|
static bool Deg_CheckIfICanEdit (struct Degree *Deg)
|
||||||
{
|
{
|
||||||
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM || // I am a centre administrator or higher
|
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM || // I am a centre administrator or higher
|
||||||
((Deg->Status & Deg_STATUS_BIT_PENDING) != 0 && // Degree is not yet activated
|
((Deg->Status & Deg_STATUS_BIT_PENDING) != 0 && // Degree is not yet activated
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod == Deg->RequesterUsrCod)); // I am the requester
|
Gbl.Usrs.Me.UsrDat.UsrCod == Deg->RequesterUsrCod)); // I am the requester
|
||||||
}
|
}
|
||||||
|
@ -1817,9 +1817,9 @@ static void Deg_PutFormToCreateDegree (void)
|
||||||
unsigned Year;
|
unsigned Year;
|
||||||
|
|
||||||
/***** Start form *****/
|
/***** Start form *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
Act_FormStart (ActNewDeg);
|
Act_FormStart (ActNewDeg);
|
||||||
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__)
|
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_)
|
||||||
Act_FormStart (ActReqDeg);
|
Act_FormStart (ActReqDeg);
|
||||||
else
|
else
|
||||||
Lay_ShowErrorAndExit ("You can not edit degrees.");
|
Lay_ShowErrorAndExit ("You can not edit degrees.");
|
||||||
|
@ -2515,7 +2515,7 @@ void Deg_GetListDegsAdminByMe (void)
|
||||||
unsigned NumDeg;
|
unsigned NumDeg;
|
||||||
|
|
||||||
/***** Get degrees admin by me from database *****/
|
/***** Get degrees admin by me from database *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod,"
|
sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod,"
|
||||||
"ShortName,FullName,FirstYear,LastYear,OptYear,WWW"
|
"ShortName,FullName,FirstYear,LastYear,OptYear,WWW"
|
||||||
" FROM degrees"
|
" FROM degrees"
|
||||||
|
|
|
@ -96,7 +96,7 @@ void Dpt_SeeDepts (void)
|
||||||
Dpt_GetListDepartments (Gbl.CurrentIns.Ins.InsCod);
|
Dpt_GetListDepartments (Gbl.CurrentIns.Ins.InsCod);
|
||||||
|
|
||||||
/***** Put link (form) to edit departments *****/
|
/***** Put link (form) to edit departments *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Dpt_PutFormToEditDpts ();
|
Dpt_PutFormToEditDpts ();
|
||||||
|
|
||||||
/***** Table head *****/
|
/***** Table head *****/
|
||||||
|
@ -179,7 +179,7 @@ void Dpt_SeeDepts (void)
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_Department_unspecified,
|
Txt_Department_unspecified,
|
||||||
Sta_GetTotalNumberOfUsers (Sco_SCOPE_INS,
|
Sta_GetTotalNumberOfUsers (Sco_SCOPE_INS,
|
||||||
Rol_ROLE_TEACHER) - NumTchsInsWithDpt);
|
Rol_TEACHER) - NumTchsInsWithDpt);
|
||||||
|
|
||||||
/***** Table end *****/
|
/***** Table end *****/
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
|
@ -303,8 +303,8 @@ void Dpt_GetListDepartments (long InsCod)
|
||||||
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
|
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
|
||||||
" WHERE crs_usr.Role='%u' AND crs_usr.UsrCod=usr_data.UsrCod))"
|
" WHERE crs_usr.Role='%u' AND crs_usr.UsrCod=usr_data.UsrCod))"
|
||||||
" ORDER BY %s",
|
" ORDER BY %s",
|
||||||
InsCod,(unsigned) Rol_ROLE_TEACHER,
|
InsCod,(unsigned) Rol_TEACHER,
|
||||||
InsCod,(unsigned) Rol_ROLE_TEACHER,
|
InsCod,(unsigned) Rol_TEACHER,
|
||||||
OrderBySubQuery);
|
OrderBySubQuery);
|
||||||
else // All the departments
|
else // All the departments
|
||||||
sprintf (Query,"(SELECT departments.DptCod,departments.InsCod,"
|
sprintf (Query,"(SELECT departments.DptCod,departments.InsCod,"
|
||||||
|
@ -322,8 +322,8 @@ void Dpt_GetListDepartments (long InsCod)
|
||||||
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
|
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
|
||||||
" WHERE crs_usr.Role='%u' AND crs_usr.UsrCod=usr_data.UsrCod))"
|
" WHERE crs_usr.Role='%u' AND crs_usr.UsrCod=usr_data.UsrCod))"
|
||||||
" ORDER BY %s",
|
" ORDER BY %s",
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
OrderBySubQuery);
|
OrderBySubQuery);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get departments");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get departments");
|
||||||
|
|
||||||
|
@ -415,8 +415,8 @@ void Dpt_GetDataOfDepartmentByCod (struct Department *Dpt)
|
||||||
" WHERE DptCod='%ld' AND DptCod NOT IN"
|
" WHERE DptCod='%ld' AND DptCod NOT IN"
|
||||||
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
|
" (SELECT DISTINCT usr_data.DptCod FROM usr_data,crs_usr"
|
||||||
" WHERE crs_usr.Role='%u' AND crs_usr.UsrCod=usr_data.UsrCod))",
|
" WHERE crs_usr.Role='%u' AND crs_usr.UsrCod=usr_data.UsrCod))",
|
||||||
Dpt->DptCod,(unsigned) Rol_ROLE_TEACHER,
|
Dpt->DptCod,(unsigned) Rol_TEACHER,
|
||||||
Dpt->DptCod,(unsigned) Rol_ROLE_TEACHER);
|
Dpt->DptCod,(unsigned) Rol_TEACHER);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a department");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a department");
|
||||||
|
|
||||||
if (NumRows) // Department found...
|
if (NumRows) // Department found...
|
||||||
|
|
|
@ -154,8 +154,8 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,
|
||||||
if (NewRole != OldRole) // The role must be updated
|
if (NewRole != OldRole) // The role must be updated
|
||||||
{
|
{
|
||||||
/***** Check if user's role is allowed *****/
|
/***** Check if user's role is allowed *****/
|
||||||
if (!(NewRole == Rol_ROLE_STUDENT ||
|
if (!(NewRole == Rol_STUDENT ||
|
||||||
NewRole == Rol_ROLE_TEACHER))
|
NewRole == Rol_TEACHER))
|
||||||
Lay_ShowErrorAndExit ("Wrong role.");
|
Lay_ShowErrorAndExit ("Wrong role.");
|
||||||
|
|
||||||
/***** Update the role of a user in a course *****/
|
/***** Update the role of a user in a course *****/
|
||||||
|
@ -196,8 +196,8 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
|
||||||
bool NotifyByEmail;
|
bool NotifyByEmail;
|
||||||
|
|
||||||
/***** Check if user's role is allowed *****/
|
/***** Check if user's role is allowed *****/
|
||||||
if (!(NewRole == Rol_ROLE_STUDENT ||
|
if (!(NewRole == Rol_STUDENT ||
|
||||||
NewRole == Rol_ROLE_TEACHER))
|
NewRole == Rol_TEACHER))
|
||||||
Lay_ShowErrorAndExit ("Wrong role.");
|
Lay_ShowErrorAndExit ("Wrong role.");
|
||||||
|
|
||||||
/***** Register user in current course in database *****/
|
/***** Register user in current course in database *****/
|
||||||
|
@ -446,36 +446,36 @@ void Enr_ReqAdminUsrs (void)
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_GUEST__:
|
case Rol__GUEST_:
|
||||||
case Rol_ROLE_VISITOR:
|
case Rol_VISITOR:
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||||
Enr_ShowFormRegRemSeveralUsrs ();
|
Enr_ShowFormRegRemSeveralUsrs ();
|
||||||
else
|
else
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
||||||
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
||||||
else
|
else
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_CTR_ADM:
|
case Rol_CTR_ADM:
|
||||||
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
|
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
|
||||||
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
||||||
else
|
else
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_INS_ADM:
|
case Rol_INS_ADM:
|
||||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||||
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
||||||
else
|
else
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||||
Enr_ShowFormRegRemSeveralUsrs ();
|
Enr_ShowFormRegRemSeveralUsrs ();
|
||||||
else
|
else
|
||||||
|
@ -520,7 +520,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (void)
|
||||||
Enr_PutLinkToRemAllStdsThisCrs ();
|
Enr_PutLinkToRemAllStdsThisCrs ();
|
||||||
|
|
||||||
/* Put link to remove old users */
|
/* Put link to remove old users */
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Enr_PutLinkToRemOldUsrs ();
|
Enr_PutLinkToRemOldUsrs ();
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
@ -847,7 +847,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
||||||
|
|
||||||
/***** Register user in course / Modify user's data *****/
|
/***** Register user in course / Modify user's data *****/
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,UsrBelongsToCrs ? (ItsMe ? Txt_Modify_me_in_the_course_X :
|
sprintf (Gbl.Message,UsrBelongsToCrs ? (ItsMe ? Txt_Modify_me_in_the_course_X :
|
||||||
Txt_Modify_user_in_the_course_X) :
|
Txt_Modify_user_in_the_course_X) :
|
||||||
|
@ -874,7 +874,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
||||||
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
||||||
/***** Register user as administrator of degree *****/
|
/***** Register user as administrator of degree *****/
|
||||||
if (!UsrIsDegAdmin &&
|
if (!UsrIsDegAdmin &&
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
|
Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_degree_X,
|
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_degree_X,
|
||||||
Gbl.CurrentDeg.Deg.ShortName);
|
Gbl.CurrentDeg.Deg.ShortName);
|
||||||
|
@ -893,7 +893,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
||||||
|
|
||||||
/***** Register user as administrator of centre *****/
|
/***** Register user as administrator of centre *****/
|
||||||
if (!UsrIsCtrAdmin &&
|
if (!UsrIsCtrAdmin &&
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
|
Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_centre_X,
|
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_centre_X,
|
||||||
Gbl.CurrentCtr.Ctr.ShortName);
|
Gbl.CurrentCtr.Ctr.ShortName);
|
||||||
|
@ -913,7 +913,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
||||||
|
|
||||||
/***** Register user as administrator of institution *****/
|
/***** Register user as administrator of institution *****/
|
||||||
if (!UsrIsInsAdmin &&
|
if (!UsrIsInsAdmin &&
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_institution_X,
|
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_institution_X,
|
||||||
Gbl.CurrentIns.Ins.ShortName);
|
Gbl.CurrentIns.Ins.ShortName);
|
||||||
|
@ -958,7 +958,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
||||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||||
/***** Remove user as an administrator of the degree *****/
|
/***** Remove user as an administrator of the degree *****/
|
||||||
if (UsrIsDegAdmin &&
|
if (UsrIsDegAdmin &&
|
||||||
(ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM))
|
(ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM))
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,
|
sprintf (Gbl.Message,
|
||||||
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_degree_X :
|
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_degree_X :
|
||||||
|
@ -979,7 +979,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
||||||
|
|
||||||
/***** Remove user as an administrator of the centre *****/
|
/***** Remove user as an administrator of the centre *****/
|
||||||
if (UsrIsCtrAdmin &&
|
if (UsrIsCtrAdmin &&
|
||||||
(ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM))
|
(ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM))
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,
|
sprintf (Gbl.Message,
|
||||||
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_centre_X :
|
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_centre_X :
|
||||||
|
@ -1001,7 +1001,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
||||||
|
|
||||||
/***** Remove user as an administrator of the institution *****/
|
/***** Remove user as an administrator of the institution *****/
|
||||||
if (UsrIsInsAdmin &&
|
if (UsrIsInsAdmin &&
|
||||||
(ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
|
(ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,
|
sprintf (Gbl.Message,
|
||||||
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_institution_X :
|
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_institution_X :
|
||||||
|
@ -1087,7 +1087,7 @@ static void Enr_PutActionsRegRemSeveralUsrs (void)
|
||||||
Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated);
|
Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated);
|
||||||
|
|
||||||
/***** Only for superusers *****/
|
/***** Only for superusers *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
fprintf (Gbl.F.Out,"<li>"
|
fprintf (Gbl.F.Out,"<li>"
|
||||||
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\" />"
|
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\" />"
|
||||||
"%s</li>",
|
"%s</li>",
|
||||||
|
@ -1122,7 +1122,7 @@ void Enr_ReceiveFormUsrsCrs (void)
|
||||||
char UnsignedStr[10+1];
|
char UnsignedStr[10+1];
|
||||||
unsigned UnsignedNum;
|
unsigned UnsignedNum;
|
||||||
long LongNum;
|
long LongNum;
|
||||||
Rol_Role_t RegRemRole = Rol_ROLE_STUDENT;
|
Rol_Role_t RegRemRole = Rol_STUDENT;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool RemoveUsrs;
|
bool RemoveUsrs;
|
||||||
|
@ -1155,13 +1155,13 @@ void Enr_ReceiveFormUsrsCrs (void)
|
||||||
if (UnsignedStr[0])
|
if (UnsignedStr[0])
|
||||||
switch ((RegRemRole = Rol_ConvertUnsignedStrToRole (UnsignedStr)))
|
switch ((RegRemRole = Rol_ConvertUnsignedStrToRole (UnsignedStr)))
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
switch (Gbl.Usrs.Me.LoggedRole) // Can I register/remove teachers?
|
switch (Gbl.Usrs.Me.LoggedRole) // Can I register/remove teachers?
|
||||||
{
|
{
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
case Rol_ROLE_SYS_ADM: // Yes, I can
|
case Rol_SYS_ADM: // Yes, I can
|
||||||
break;
|
break;
|
||||||
default: // No, I can not (TODO: teachers should be able to register/remove existing teachers)
|
default: // No, I can not (TODO: teachers should be able to register/remove existing teachers)
|
||||||
Lay_ShowErrorAndExit ("You are not allowed to perform this action."); // If user manipulated the form
|
Lay_ShowErrorAndExit ("You are not allowed to perform this action."); // If user manipulated the form
|
||||||
|
@ -1209,7 +1209,7 @@ void Enr_ReceiveFormUsrsCrs (void)
|
||||||
WhatToDo.RegisterUsrs = true;
|
WhatToDo.RegisterUsrs = true;
|
||||||
break;
|
break;
|
||||||
case Enr_ELIMINATE_USRS_FROM_PLATFORM:
|
case Enr_ELIMINATE_USRS_FROM_PLATFORM:
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
WhatToDo.RemoveUsrs = true;
|
WhatToDo.RemoveUsrs = true;
|
||||||
WhatToDo.RemoveSpecifiedUsrs = true;
|
WhatToDo.RemoveSpecifiedUsrs = true;
|
||||||
|
@ -1251,7 +1251,7 @@ void Enr_ReceiveFormUsrsCrs (void)
|
||||||
|
|
||||||
/***** A student can't belong to more than one group when the type of group only allows to register in one group *****/
|
/***** A student can't belong to more than one group when the type of group only allows to register in one group *****/
|
||||||
if (WhatToDo.RegisterUsrs &&
|
if (WhatToDo.RegisterUsrs &&
|
||||||
RegRemRole == Rol_ROLE_STUDENT &&
|
RegRemRole == Rol_STUDENT &&
|
||||||
LstGrps.NumGrps >= 2)
|
LstGrps.NumGrps >= 2)
|
||||||
/* Check if I have selected more than one group of single enrollment */
|
/* Check if I have selected more than one group of single enrollment */
|
||||||
if (!Grp_CheckIfSelectionGrpsIsValid (&LstGrps))
|
if (!Grp_CheckIfSelectionGrpsIsValid (&LstGrps))
|
||||||
|
@ -1280,12 +1280,12 @@ void Enr_ReceiveFormUsrsCrs (void)
|
||||||
/***** Get list of users in current course *****/
|
/***** Get list of users in current course *****/
|
||||||
switch (RegRemRole)
|
switch (RegRemRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
LstCurrentUsrs = &Gbl.Usrs.LstStds;
|
LstCurrentUsrs = &Gbl.Usrs.LstStds;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
||||||
LstCurrentUsrs = &Gbl.Usrs.LstTchs;
|
LstCurrentUsrs = &Gbl.Usrs.LstTchs;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1304,7 +1304,7 @@ void Enr_ReceiveFormUsrsCrs (void)
|
||||||
|
|
||||||
/***** Loop 1: go through form list setting if a student must be removed *****/
|
/***** Loop 1: go through form list setting if a student must be removed *****/
|
||||||
/* Step a: Get students from a list of official groups */
|
/* Step a: Get students from a list of official groups */
|
||||||
if (RegRemRole == Rol_ROLE_STUDENT)
|
if (RegRemRole == Rol_STUDENT)
|
||||||
{
|
{
|
||||||
Ptr = ListExternalGrpCods;
|
Ptr = ListExternalGrpCods;
|
||||||
while (*Ptr)
|
while (*Ptr)
|
||||||
|
@ -1442,7 +1442,7 @@ void Enr_ReceiveFormUsrsCrs (void)
|
||||||
if (WhatToDo.RegisterUsrs) // TODO: !!!!! NO CAMBIAR EL ROL DE LOS USUARIOS QUE YA ESTÉN EN LA ASIGNATURA SI HAY MÁS DE UN USUARIO ENCONTRADO PARA EL MISMO DNI !!!!!!
|
if (WhatToDo.RegisterUsrs) // TODO: !!!!! NO CAMBIAR EL ROL DE LOS USUARIOS QUE YA ESTÉN EN LA ASIGNATURA SI HAY MÁS DE UN USUARIO ENCONTRADO PARA EL MISMO DNI !!!!!!
|
||||||
{
|
{
|
||||||
/***** Step a: Get users from a list of official groups *****/
|
/***** Step a: Get users from a list of official groups *****/
|
||||||
if (RegRemRole == Rol_ROLE_STUDENT)
|
if (RegRemRole == Rol_STUDENT)
|
||||||
{
|
{
|
||||||
Ptr = ListExternalGrpCods;
|
Ptr = ListExternalGrpCods;
|
||||||
while (*Ptr)
|
while (*Ptr)
|
||||||
|
@ -1606,8 +1606,8 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
|
||||||
struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered)
|
struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered)
|
||||||
{
|
{
|
||||||
/***** Check if I can register this user *****/
|
/***** Check if I can register this user *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER &&
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER &&
|
||||||
RegRemRole != Rol_ROLE_STUDENT)
|
RegRemRole != Rol_STUDENT)
|
||||||
Lay_ShowErrorAndExit ("A teacher only can register new users if they are students.");
|
Lay_ShowErrorAndExit ("A teacher only can register new users if they are students.");
|
||||||
|
|
||||||
/***** Check if the record of the user exists and get the type of user *****/
|
/***** Check if the record of the user exists and get the type of user *****/
|
||||||
|
@ -1723,7 +1723,7 @@ void Enr_AskRemAllStdsThisCrs (void)
|
||||||
extern const char *Txt_No_users_found[Rol_NUM_ROLES];
|
extern const char *Txt_No_users_found[Rol_NUM_ROLES];
|
||||||
unsigned NumStds;
|
unsigned NumStds;
|
||||||
|
|
||||||
if ((NumStds = Usr_GetNumUsrsInCrs (Rol_ROLE_STUDENT,Gbl.CurrentCrs.Crs.CrsCod)))
|
if ((NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,Gbl.CurrentCrs.Crs.CrsCod)))
|
||||||
{
|
{
|
||||||
/***** Write message to confirm the removing *****/
|
/***** Write message to confirm the removing *****/
|
||||||
sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_the_X_students_from_the_course_Y_,
|
sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_the_X_students_from_the_course_Y_,
|
||||||
|
@ -1739,7 +1739,7 @@ void Enr_AskRemAllStdsThisCrs (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,Txt_No_users_found[Rol_ROLE_STUDENT],
|
sprintf (Gbl.Message,Txt_No_users_found[Rol_STUDENT],
|
||||||
Gbl.CurrentCrs.Crs.FullName);
|
Gbl.CurrentCrs.Crs.FullName);
|
||||||
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
||||||
}
|
}
|
||||||
|
@ -1765,7 +1765,7 @@ void Enr_RemAllStdsThisCrs (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,Txt_No_users_found[Rol_ROLE_STUDENT],
|
sprintf (Gbl.Message,Txt_No_users_found[Rol_STUDENT],
|
||||||
Gbl.CurrentCrs.Crs.FullName);
|
Gbl.CurrentCrs.Crs.FullName);
|
||||||
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
||||||
}
|
}
|
||||||
|
@ -1784,7 +1784,7 @@ unsigned Enr_RemAllStdsInCrs (struct Course *Crs)
|
||||||
|
|
||||||
/***** Get list of students in current course *****/
|
/***** Get list of students in current course *****/
|
||||||
Gbl.Usrs.ClassPhoto.AllGroups = true; // Get all the students of the current course
|
Gbl.Usrs.ClassPhoto.AllGroups = true; // Get all the students of the current course
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
NumStdsInCrs = Gbl.Usrs.LstStds.NumUsrs;
|
NumStdsInCrs = Gbl.Usrs.LstStds.NumUsrs;
|
||||||
|
|
||||||
/***** Remove all the students *****/
|
/***** Remove all the students *****/
|
||||||
|
@ -1813,15 +1813,15 @@ void Enr_ReqSignUpInCrs (void)
|
||||||
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
|
|
||||||
/***** Check if I already belong to course *****/
|
/***** Check if I already belong to course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_STUDENT)
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,Txt_You_were_already_enrolled_as_X_in_the_course_Y,
|
sprintf (Gbl.Message,Txt_You_were_already_enrolled_as_X_in_the_course_Y,
|
||||||
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
|
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
|
||||||
Gbl.CurrentCrs.Crs.FullName);
|
Gbl.CurrentCrs.Crs.FullName);
|
||||||
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
||||||
}
|
}
|
||||||
else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST__ ||
|
else if (Gbl.Usrs.Me.LoggedRole == Rol__GUEST_ ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_VISITOR)
|
Gbl.Usrs.Me.LoggedRole == Rol_VISITOR)
|
||||||
/***** Show form to modify only the user's role or the user's data *****/
|
/***** Show form to modify only the user's role or the user's data *****/
|
||||||
Rec_ShowFormSignUpWithMyCommonRecord ();
|
Rec_ShowFormSignUpWithMyCommonRecord ();
|
||||||
else
|
else
|
||||||
|
@ -1846,7 +1846,7 @@ void Enr_SignUpInCrs (void)
|
||||||
unsigned NumUsrsToBeNotifiedByEMail;
|
unsigned NumUsrsToBeNotifiedByEMail;
|
||||||
|
|
||||||
/***** Check if I already belong to course *****/
|
/***** Check if I already belong to course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_STUDENT)
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,Txt_You_were_already_enrolled_as_X_in_the_course_Y,
|
sprintf (Gbl.Message,Txt_You_were_already_enrolled_as_X_in_the_course_Y,
|
||||||
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
|
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
|
||||||
|
@ -1860,8 +1860,8 @@ void Enr_SignUpInCrs (void)
|
||||||
RoleFromForm = Rol_ConvertUnsignedStrToRole (UnsignedStr);
|
RoleFromForm = Rol_ConvertUnsignedStrToRole (UnsignedStr);
|
||||||
|
|
||||||
/* Check if role is correct */
|
/* Check if role is correct */
|
||||||
if (!(RoleFromForm == Rol_ROLE_STUDENT ||
|
if (!(RoleFromForm == Rol_STUDENT ||
|
||||||
RoleFromForm == Rol_ROLE_TEACHER))
|
RoleFromForm == Rol_TEACHER))
|
||||||
Lay_ShowErrorAndExit ("Wrong role.");
|
Lay_ShowErrorAndExit ("Wrong role.");
|
||||||
|
|
||||||
/***** Try to get and old request of the same user in the same course from database *****/
|
/***** Try to get and old request of the same user in the same course from database *****/
|
||||||
|
@ -1908,7 +1908,7 @@ void Enr_SignUpInCrs (void)
|
||||||
/***** Notify teachers or admins by e-mail about the new enrollment request *****/
|
/***** Notify teachers or admins by e-mail about the new enrollment request *****/
|
||||||
// If this course has teachers ==> send notification to teachers
|
// If this course has teachers ==> send notification to teachers
|
||||||
// If this course has no teachers and I want to be a teacher ==> send notification to administrators or superusers
|
// If this course has no teachers and I want to be a teacher ==> send notification to administrators or superusers
|
||||||
if (Gbl.CurrentCrs.Crs.NumTchs || RoleFromForm == Rol_ROLE_TEACHER)
|
if (Gbl.CurrentCrs.Crs.NumTchs || RoleFromForm == Rol_TEACHER)
|
||||||
{
|
{
|
||||||
NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_ENROLLMENT_REQUEST,ReqCod);
|
NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_ENROLLMENT_REQUEST,ReqCod);
|
||||||
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
|
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
|
||||||
|
@ -2013,8 +2013,8 @@ void Enr_AskIfRejectSignUp (void)
|
||||||
else // User does not belong to this course
|
else // User does not belong to this course
|
||||||
{
|
{
|
||||||
Role = Rol_GetRequestedRole (Gbl.Usrs.Other.UsrDat.UsrCod);
|
Role = Rol_GetRequestedRole (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
if (Role == Rol_ROLE_STUDENT ||
|
if (Role == Rol_STUDENT ||
|
||||||
Role == Rol_ROLE_TEACHER)
|
Role == Rol_TEACHER)
|
||||||
{
|
{
|
||||||
/* Ask if reject */
|
/* Ask if reject */
|
||||||
sprintf (Gbl.Message,Txt_Do_you_really_want_to_reject_the_enrollment_request_,
|
sprintf (Gbl.Message,Txt_Do_you_really_want_to_reject_the_enrollment_request_,
|
||||||
|
@ -2154,12 +2154,12 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
/* Set default roles */
|
/* Set default roles */
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
Roles = (1 << Rol_ROLE_STUDENT) | (1 << Rol_ROLE_TEACHER);
|
Roles = (1 << Rol_STUDENT) | (1 << Rol_TEACHER);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Roles = (1 << Rol_ROLE_TEACHER);
|
Roles = (1 << Rol_TEACHER);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
|
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
|
||||||
|
@ -2183,7 +2183,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
case Sco_SCOPE_SYS: // Show requesters for the whole platform
|
case Sco_SCOPE_SYS: // Show requesters for the whole platform
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM crs_usr,crs_usr_requests"
|
" FROM crs_usr,crs_usr_requests"
|
||||||
" WHERE crs_usr.UsrCod='%ld'"
|
" WHERE crs_usr.UsrCod='%ld'"
|
||||||
|
@ -2193,7 +2193,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Roles);
|
Roles);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM admin,courses,crs_usr_requests"
|
" FROM admin,courses,crs_usr_requests"
|
||||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
||||||
|
@ -2204,7 +2204,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Roles);
|
Roles);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM crs_usr_requests WHERE ((1<<Role)&%u)<>0"
|
" FROM crs_usr_requests WHERE ((1<<Role)&%u)<>0"
|
||||||
" ORDER BY RequestTime DESC",
|
" ORDER BY RequestTime DESC",
|
||||||
|
@ -2218,7 +2218,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
case Sco_SCOPE_INS: // Show requesters for the current institution
|
case Sco_SCOPE_INS: // Show requesters for the current institution
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM crs_usr,centres,degrees,courses,crs_usr_requests"
|
" FROM crs_usr,centres,degrees,courses,crs_usr_requests"
|
||||||
" WHERE crs_usr.UsrCod='%ld'"
|
" WHERE crs_usr.UsrCod='%ld'"
|
||||||
|
@ -2233,7 +2233,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
Gbl.CurrentIns.Ins.InsCod,
|
||||||
Roles);
|
Roles);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM admin,centres,degrees,courses,crs_usr_requests"
|
" FROM admin,centres,degrees,courses,crs_usr_requests"
|
||||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
||||||
|
@ -2248,7 +2248,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
Gbl.CurrentIns.Ins.InsCod,
|
||||||
Roles);
|
Roles);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM centres,degrees,courses,crs_usr_requests"
|
" FROM centres,degrees,courses,crs_usr_requests"
|
||||||
" WHERE centres.InsCod='%ld'"
|
" WHERE centres.InsCod='%ld'"
|
||||||
|
@ -2268,7 +2268,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
case Sco_SCOPE_CTR: // Show requesters for the current centre
|
case Sco_SCOPE_CTR: // Show requesters for the current centre
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM crs_usr,degrees,courses,crs_usr_requests"
|
" FROM crs_usr,degrees,courses,crs_usr_requests"
|
||||||
" WHERE crs_usr.UsrCod='%ld'"
|
" WHERE crs_usr.UsrCod='%ld'"
|
||||||
|
@ -2282,7 +2282,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||||
Roles);
|
Roles);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM admin,degrees,courses,crs_usr_requests"
|
" FROM admin,degrees,courses,crs_usr_requests"
|
||||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
||||||
|
@ -2296,7 +2296,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||||
Roles);
|
Roles);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM degrees,courses,crs_usr_requests"
|
" FROM degrees,courses,crs_usr_requests"
|
||||||
" WHERE degrees.CtrCod='%ld'"
|
" WHERE degrees.CtrCod='%ld'"
|
||||||
|
@ -2315,7 +2315,7 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
case Sco_SCOPE_DEG: // Show requesters for the current degree
|
case Sco_SCOPE_DEG: // Show requesters for the current degree
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM crs_usr,courses,crs_usr_requests"
|
" FROM crs_usr,courses,crs_usr_requests"
|
||||||
" WHERE crs_usr.UsrCod='%ld'"
|
" WHERE crs_usr.UsrCod='%ld'"
|
||||||
|
@ -2328,8 +2328,8 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
Gbl.CurrentDeg.Deg.DegCod,
|
||||||
Roles);
|
Roles);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM courses,crs_usr_requests"
|
" FROM courses,crs_usr_requests"
|
||||||
" WHERE courses.DegCod='%ld'"
|
" WHERE courses.DegCod='%ld'"
|
||||||
|
@ -2347,9 +2347,9 @@ void Enr_ShowEnrollmentRequests (void)
|
||||||
case Sco_SCOPE_CRS: // Show requesters for the current course
|
case Sco_SCOPE_CRS: // Show requesters for the current course
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||||
" FROM crs_usr_requests"
|
" FROM crs_usr_requests"
|
||||||
" WHERE CrsCod='%ld'"
|
" WHERE CrsCod='%ld'"
|
||||||
|
@ -2599,36 +2599,36 @@ void Enr_ReqRegRemUsr (void)
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_GUEST__:
|
case Rol__GUEST_:
|
||||||
case Rol_ROLE_VISITOR:
|
case Rol_VISITOR:
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||||
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
||||||
else
|
else
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
||||||
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
||||||
else
|
else
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_CTR_ADM:
|
case Rol_CTR_ADM:
|
||||||
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
|
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
|
||||||
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
||||||
else
|
else
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_INS_ADM:
|
case Rol_INS_ADM:
|
||||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||||
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
||||||
else
|
else
|
||||||
Enr_AskIfRegRemMe ();
|
Enr_AskIfRegRemMe ();
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
Enr_ReqAnotherUsrIDToRegisterRemove ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2647,14 +2647,14 @@ static void Enr_ReqAnotherUsrIDToRegisterRemove (void)
|
||||||
|
|
||||||
/***** Put contextual links *****/
|
/***** Put contextual links *****/
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0 ||
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0 ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
|
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||||
/* Put link to go to admin several users */
|
/* Put link to go to admin several users */
|
||||||
Enr_PutLinkToAdminSeveralUsrs ();
|
Enr_PutLinkToAdminSeveralUsrs ();
|
||||||
else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
else if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
/* Put link to remove old users */
|
/* Put link to remove old users */
|
||||||
Enr_PutLinkToRemOldUsrs ();
|
Enr_PutLinkToRemOldUsrs ();
|
||||||
|
|
||||||
|
@ -2803,7 +2803,7 @@ static void Enr_AskIfRegRemUsr (struct ListUsrCods *ListUsrCods)
|
||||||
if (NewUsrIDValid)
|
if (NewUsrIDValid)
|
||||||
{
|
{
|
||||||
/* Initialize some data of this new user */
|
/* Initialize some data of this new user */
|
||||||
Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = Rol_ROLE_STUDENT;
|
Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = Rol_STUDENT;
|
||||||
Gbl.Usrs.Other.UsrDat.Roles = (1 << Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB);
|
Gbl.Usrs.Other.UsrDat.Roles = (1 << Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB);
|
||||||
|
|
||||||
/***** Show form to enter the data of a new user *****/
|
/***** Show form to enter the data of a new user *****/
|
||||||
|
@ -2885,9 +2885,9 @@ static void Enr_AddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
{
|
{
|
||||||
/* Check if I am allowed to register user as administrator in institution/centre/degree */
|
/* Check if I am allowed to register user as administrator in institution/centre/degree */
|
||||||
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) ||
|
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM) ||
|
||||||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) ||
|
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) ||
|
||||||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
|
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
|
||||||
if (ICanRegister)
|
if (ICanRegister)
|
||||||
{
|
{
|
||||||
/***** Register administrator in current institution/centre/degree in database *****/
|
/***** Register administrator in current institution/centre/degree in database *****/
|
||||||
|
@ -2979,7 +2979,7 @@ static void Enr_ReqRemOrRemUsrFromCrs (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
|
||||||
// A teacher can remove a student or himself
|
// A teacher can remove a student or himself
|
||||||
// An administrator can remove anyone
|
// An administrator can remove anyone
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
ICanRemove = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT ? ItsMe :
|
ICanRemove = (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ? ItsMe :
|
||||||
(Gbl.Usrs.Me.LoggedRole >= Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB));
|
(Gbl.Usrs.Me.LoggedRole >= Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB));
|
||||||
if (ICanRemove)
|
if (ICanRemove)
|
||||||
switch (ReqDelOrDelUsr)
|
switch (ReqDelOrDelUsr)
|
||||||
|
@ -3079,9 +3079,9 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t
|
||||||
/* Check if it's forbidden to remove an administrator */
|
/* Check if it's forbidden to remove an administrator */
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
ICanRemove = (ItsMe ||
|
ICanRemove = (ItsMe ||
|
||||||
(Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) ||
|
(Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM) ||
|
||||||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) ||
|
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) ||
|
||||||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
|
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
|
||||||
if (ICanRemove)
|
if (ICanRemove)
|
||||||
{
|
{
|
||||||
/* Check if the other user is an admin of the current institution/centre/degree */
|
/* Check if the other user is an admin of the current institution/centre/degree */
|
||||||
|
@ -3141,9 +3141,9 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
{
|
{
|
||||||
/* Check if I am allowed to register user as administrator in institution/centre/degree */
|
/* Check if I am allowed to register user as administrator in institution/centre/degree */
|
||||||
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) ||
|
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM) ||
|
||||||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) ||
|
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) ||
|
||||||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
|
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
|
||||||
if (ICanRegister)
|
if (ICanRegister)
|
||||||
{
|
{
|
||||||
if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is yet an administrator of current institution/centre/degree
|
if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is yet an administrator of current institution/centre/degree
|
||||||
|
@ -3209,8 +3209,8 @@ void Enr_CreatAndShowNewUsrRecordAndRegInCrs (void)
|
||||||
|
|
||||||
/***** Get new role *****/
|
/***** Get new role *****/
|
||||||
NewRole = Rec_GetRoleFromRecordForm ();
|
NewRole = Rec_GetRoleFromRecordForm ();
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER &&
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER &&
|
||||||
NewRole != Rol_ROLE_STUDENT)
|
NewRole != Rol_STUDENT)
|
||||||
Lay_ShowErrorAndExit ("A teacher only can create new users as students.");
|
Lay_ShowErrorAndExit ("A teacher only can create new users as students.");
|
||||||
|
|
||||||
/***** Get user's name from form *****/
|
/***** Get user's name from form *****/
|
||||||
|
@ -3275,10 +3275,10 @@ void Enr_ModifAndShowUsrCardAndRegInCrsAndGrps (void)
|
||||||
switch ((RegRemAction = (Enr_RegRemOneUsrAction_t) UnsignedNum))
|
switch ((RegRemAction = (Enr_RegRemOneUsrAction_t) UnsignedNum))
|
||||||
{
|
{
|
||||||
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
|
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
|
||||||
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER)
|
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)
|
||||||
{
|
{
|
||||||
IAmTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER); // I am logged as teacher
|
IAmTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER); // I am logged as teacher
|
||||||
HeIsTeacher = (Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_ROLE_TEACHER)); // He/she is already a teacher in any course
|
HeIsTeacher = (Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_TEACHER)); // He/she is already a teacher in any course
|
||||||
ICanChangeUsrName = ItsMe ||
|
ICanChangeUsrName = ItsMe ||
|
||||||
!(IAmTeacher && HeIsTeacher); // A teacher can not change another teacher's name
|
!(IAmTeacher && HeIsTeacher); // A teacher can not change another teacher's name
|
||||||
|
|
||||||
|
@ -3318,46 +3318,46 @@ void Enr_ModifAndShowUsrCardAndRegInCrsAndGrps (void)
|
||||||
Error = true;
|
Error = true;
|
||||||
break;
|
break;
|
||||||
case Enr_REGISTER_ONE_DEGREE_ADMIN:
|
case Enr_REGISTER_ONE_DEGREE_ADMIN:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
Enr_ReqAddAdm (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod,
|
Enr_ReqAddAdm (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod,
|
||||||
Gbl.CurrentDeg.Deg.FullName);
|
Gbl.CurrentDeg.Deg.FullName);
|
||||||
else
|
else
|
||||||
Error = true;
|
Error = true;
|
||||||
break;
|
break;
|
||||||
case Enr_REGISTER_ONE_CENTRE_ADMIN:
|
case Enr_REGISTER_ONE_CENTRE_ADMIN:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
|
||||||
Enr_ReqAddAdm (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod,
|
Enr_ReqAddAdm (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod,
|
||||||
Gbl.CurrentCtr.Ctr.FullName);
|
Gbl.CurrentCtr.Ctr.FullName);
|
||||||
else
|
else
|
||||||
Error = true;
|
Error = true;
|
||||||
break;
|
break;
|
||||||
case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
|
case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Enr_ReqAddAdm (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod,
|
Enr_ReqAddAdm (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod,
|
||||||
Gbl.CurrentIns.Ins.FullName);
|
Gbl.CurrentIns.Ins.FullName);
|
||||||
else
|
else
|
||||||
Error = true;
|
Error = true;
|
||||||
break;
|
break;
|
||||||
case Enr_REMOVE_ONE_USR_FROM_CRS:
|
case Enr_REMOVE_ONE_USR_FROM_CRS:
|
||||||
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER)
|
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)
|
||||||
Enr_ReqRemUsrFromCrs ();
|
Enr_ReqRemUsrFromCrs ();
|
||||||
else
|
else
|
||||||
Error = true;
|
Error = true;
|
||||||
break;
|
break;
|
||||||
case Enr_REMOVE_ONE_DEGREE_ADMIN:
|
case Enr_REMOVE_ONE_DEGREE_ADMIN:
|
||||||
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
|
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
Enr_ReqRemAdmOfDeg ();
|
Enr_ReqRemAdmOfDeg ();
|
||||||
else
|
else
|
||||||
Error = true;
|
Error = true;
|
||||||
break;
|
break;
|
||||||
case Enr_REMOVE_ONE_CENTRE_ADMIN:
|
case Enr_REMOVE_ONE_CENTRE_ADMIN:
|
||||||
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
|
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
|
||||||
Enr_ReqRemAdmOfCtr ();
|
Enr_ReqRemAdmOfCtr ();
|
||||||
else
|
else
|
||||||
Error = true;
|
Error = true;
|
||||||
break;
|
break;
|
||||||
case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
|
case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
|
||||||
if (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Enr_ReqRemAdmOfIns ();
|
Enr_ReqRemAdmOfIns ();
|
||||||
else
|
else
|
||||||
Error = true;
|
Error = true;
|
||||||
|
|
|
@ -440,8 +440,8 @@ static void Exa_ListExamAnnouncements (Exa_tTypeViewExamAnnouncement_t TypeViewE
|
||||||
/***** Create link for creation of a new exam announcement *****/
|
/***** Create link for creation of a new exam announcement *****/
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
Act_PutContextualLink (ActEdiExaAnn,NULL,
|
Act_PutContextualLink (ActEdiExaAnn,NULL,
|
||||||
"new",Txt_New_announcement_OF_EXAM);
|
"new",Txt_New_announcement_OF_EXAM);
|
||||||
|
@ -769,8 +769,8 @@ static void Exa_ShowExamAnnouncement (long ExaCod,Exa_tTypeViewExamAnnouncement_
|
||||||
fprintf (Gbl.F.Out,"<tr>" \
|
fprintf (Gbl.F.Out,"<tr>" \
|
||||||
"<td style=\"text-align:left;\">");
|
"<td style=\"text-align:left;\">");
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
/***** Link to remove this exam announcement *****/
|
/***** Link to remove this exam announcement *****/
|
||||||
Act_FormStart (ActRemExaAnn);
|
Act_FormStart (ActRemExaAnn);
|
||||||
|
|
|
@ -1466,7 +1466,7 @@ void Brw_GetParAndInitFileBrowser (void)
|
||||||
{
|
{
|
||||||
/***** Documents of institution *****/
|
/***** Documents of institution *****/
|
||||||
case ActSeeAdmDocIns: // Access to a documents zone from menu
|
case ActSeeAdmDocIns: // Access to a documents zone from menu
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
|
||||||
/* These roles can edit documents of institution */
|
/* These roles can edit documents of institution */
|
||||||
Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_INS;
|
Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_INS;
|
||||||
else
|
else
|
||||||
|
@ -1532,7 +1532,7 @@ void Brw_GetParAndInitFileBrowser (void)
|
||||||
|
|
||||||
/***** Documents of centre *****/
|
/***** Documents of centre *****/
|
||||||
case ActSeeAdmDocCtr: // Access to a documents zone from menu
|
case ActSeeAdmDocCtr: // Access to a documents zone from menu
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
/* These roles can edit documents of centre */
|
/* These roles can edit documents of centre */
|
||||||
Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_CTR;
|
Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_CTR;
|
||||||
else
|
else
|
||||||
|
@ -1598,7 +1598,7 @@ void Brw_GetParAndInitFileBrowser (void)
|
||||||
|
|
||||||
/***** Documents of degree *****/
|
/***** Documents of degree *****/
|
||||||
case ActSeeAdmDocDeg: // Access to a documents zone from menu
|
case ActSeeAdmDocDeg: // Access to a documents zone from menu
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
/* These roles can edit documents of degree */
|
/* These roles can edit documents of degree */
|
||||||
Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_DEG;
|
Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_DEG;
|
||||||
else
|
else
|
||||||
|
@ -1667,8 +1667,8 @@ void Brw_GetParAndInitFileBrowser (void)
|
||||||
/* Set file browser type acording to last group accessed */
|
/* Set file browser type acording to last group accessed */
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
/* These roles can edit documents of course/groups */
|
/* These roles can edit documents of course/groups */
|
||||||
Gbl.FileBrowser.Type = (Gbl.CurrentCrs.Grps.GrpCod > 0) ? Brw_ADMI_DOCUM_GRP :
|
Gbl.FileBrowser.Type = (Gbl.CurrentCrs.Grps.GrpCod > 0) ? Brw_ADMI_DOCUM_GRP :
|
||||||
Brw_ADMI_DOCUM_CRS;
|
Brw_ADMI_DOCUM_CRS;
|
||||||
|
@ -1897,7 +1897,7 @@ void Brw_GetParAndInitFileBrowser (void)
|
||||||
/***** Marks *****/
|
/***** Marks *****/
|
||||||
case ActSeeAdmMrk: // Access to a marks zone from menu
|
case ActSeeAdmMrk: // Access to a marks zone from menu
|
||||||
/* Set file browser type acording to last group accessed */
|
/* Set file browser type acording to last group accessed */
|
||||||
Gbl.FileBrowser.Type = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT) ?
|
Gbl.FileBrowser.Type = (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) ?
|
||||||
(Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_SHOW_MARKS_GRP :
|
(Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_SHOW_MARKS_GRP :
|
||||||
Brw_SHOW_MARKS_CRS) :
|
Brw_SHOW_MARKS_CRS) :
|
||||||
(Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_ADMI_MARKS_GRP :
|
(Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_ADMI_MARKS_GRP :
|
||||||
|
@ -2078,7 +2078,7 @@ void Brw_GetParAndInitFileBrowser (void)
|
||||||
// If I belong to the current course or I am superuser, or file browser is briefcase ==> get whether show full tree from form
|
// If I belong to the current course or I am superuser, or file browser is briefcase ==> get whether show full tree from form
|
||||||
// Else ==> show full tree (only public files)
|
// Else ==> show full tree (only public files)
|
||||||
Gbl.FileBrowser.ShowOnlyPublicFiles = false;
|
Gbl.FileBrowser.ShowOnlyPublicFiles = false;
|
||||||
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM)
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
{
|
{
|
||||||
case Brw_SHOW_DOCUM_INS:
|
case Brw_SHOW_DOCUM_INS:
|
||||||
|
@ -2850,8 +2850,8 @@ void Brw_AskEditWorksCrs (void)
|
||||||
Usr_ShowFormsToSelectUsrListType (ActReqAsgWrkCrs);
|
Usr_ShowFormsToSelectUsrListType (ActReqAsgWrkCrs);
|
||||||
|
|
||||||
/***** Get and order lists of users from this course *****/
|
/***** Get and order lists of users from this course *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstTchs.NumUsrs ||
|
if (Gbl.Usrs.LstTchs.NumUsrs ||
|
||||||
Gbl.Usrs.LstStds.NumUsrs)
|
Gbl.Usrs.LstStds.NumUsrs)
|
||||||
|
@ -2868,8 +2868,8 @@ void Brw_AskEditWorksCrs (void)
|
||||||
|
|
||||||
/* Put list of users to select some of them */
|
/* Put list of users to select some of them */
|
||||||
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
||||||
Usr_ListUsersToSelect (Rol_ROLE_TEACHER);
|
Usr_ListUsersToSelect (Rol_TEACHER);
|
||||||
Usr_ListUsersToSelect (Rol_ROLE_STUDENT);
|
Usr_ListUsersToSelect (Rol_STUDENT);
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
|
|
||||||
/* Button to send the form */
|
/* Button to send the form */
|
||||||
|
@ -2879,7 +2879,7 @@ void Brw_AskEditWorksCrs (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_UNKNOWN);
|
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN);
|
||||||
|
|
||||||
/***** Free memory for users' list *****/
|
/***** Free memory for users' list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
||||||
|
@ -3156,14 +3156,14 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
|
||||||
/***** Start form to send a message to this user *****/
|
/***** Start form to send a message to this user *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"MSG_AUT\" style=\"width:160px;"
|
fprintf (Gbl.F.Out,"<td class=\"MSG_AUT\" style=\"width:160px;"
|
||||||
" text-align:left; vertical-align:top;\">");
|
" text-align:left; vertical-align:top;\">");
|
||||||
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_ROLE_STUDENT ? ActSeeRecOneStd :
|
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActSeeRecOneStd :
|
||||||
ActSeeRecOneTch);
|
ActSeeRecOneTch);
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||||
|
|
||||||
/***** Show user's ID *****/
|
/***** Show user's ID *****/
|
||||||
ID_WriteUsrIDs (UsrDat,
|
ID_WriteUsrIDs (UsrDat,
|
||||||
UsrDat->RoleInCurrentCrsDB == Rol_ROLE_TEACHER ? ID_ICanSeeTeacherID (UsrDat) :
|
UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ID_ICanSeeTeacherID (UsrDat) :
|
||||||
(Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER));
|
(Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER));
|
||||||
|
|
||||||
/***** Show user's name *****/
|
/***** Show user's name *****/
|
||||||
fprintf (Gbl.F.Out,"<br />");
|
fprintf (Gbl.F.Out,"<br />");
|
||||||
|
@ -3332,8 +3332,8 @@ static void Brw_ShowFileBrowser (void)
|
||||||
|
|
||||||
static void Brw_WriteTopBeforeShowingFileBrowser (void)
|
static void Brw_WriteTopBeforeShowingFileBrowser (void)
|
||||||
{
|
{
|
||||||
bool IAmTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER );
|
bool IAmTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER );
|
||||||
bool IAmSuperuser = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
|
bool IAmSuperuser = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
||||||
|
|
||||||
/***** Update last access to this file browser *****/
|
/***** Update last access to this file browser *****/
|
||||||
Brw_UpdateLastAccess ();
|
Brw_UpdateLastAccess ();
|
||||||
|
@ -3342,27 +3342,27 @@ static void Brw_WriteTopBeforeShowingFileBrowser (void)
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
{
|
{
|
||||||
case Brw_SHOW_DOCUM_INS:
|
case Brw_SHOW_DOCUM_INS:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
|
||||||
Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocIns);
|
Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocIns);
|
||||||
break;
|
break;
|
||||||
case Brw_ADMI_DOCUM_INS:
|
case Brw_ADMI_DOCUM_INS:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
|
||||||
Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocIns);
|
Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocIns);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_DOCUM_CTR:
|
case Brw_SHOW_DOCUM_CTR:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocCtr);
|
Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocCtr);
|
||||||
break;
|
break;
|
||||||
case Brw_ADMI_DOCUM_CTR:
|
case Brw_ADMI_DOCUM_CTR:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocCtr);
|
Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocCtr);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_DOCUM_DEG:
|
case Brw_SHOW_DOCUM_DEG:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocDeg);
|
Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocDeg);
|
||||||
break;
|
break;
|
||||||
case Brw_ADMI_DOCUM_DEG:
|
case Brw_ADMI_DOCUM_DEG:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocDeg);
|
Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocDeg);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_DOCUM_CRS:
|
case Brw_SHOW_DOCUM_CRS:
|
||||||
|
@ -3607,7 +3607,7 @@ static void Brw_WriteSubtitleOfFileBrowser (void)
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_MARKS_CRS:
|
case Brw_SHOW_MARKS_CRS:
|
||||||
case Brw_SHOW_MARKS_GRP:
|
case Brw_SHOW_MARKS_GRP:
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)
|
||||||
sprintf (Subtitle,"(%s)",
|
sprintf (Subtitle,"(%s)",
|
||||||
Txt_accessible_only_for_reading_by_you_and_the_teachers_of_the_course);
|
Txt_accessible_only_for_reading_by_you_and_the_teachers_of_the_course);
|
||||||
else
|
else
|
||||||
|
@ -4865,7 +4865,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,
|
||||||
"</td>");
|
"</td>");
|
||||||
|
|
||||||
/***** Put icon to download ZIP of folder *****/
|
/***** Put icon to download ZIP of folder *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_STUDENT && // Only ZIP folders if I am student, teacher...
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT && // Only ZIP folders if I am student, teacher...
|
||||||
!SeeMarks) // Do not ZIP folders when seeing marks
|
!SeeMarks) // Do not ZIP folders when seeing marks
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<td class=\"BM%d\">",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out,"<td class=\"BM%d\">",Gbl.RowEvenOdd);
|
||||||
|
@ -7649,7 +7649,7 @@ static void Brw_PutFormToCreateAFolder (const char *FileNameToShow)
|
||||||
|
|
||||||
/* Folder */
|
/* Folder */
|
||||||
fprintf (Gbl.F.Out,"<label class=\"%s\">%s:</label>"
|
fprintf (Gbl.F.Out,"<label class=\"%s\">%s:</label>"
|
||||||
"<input type=\"text\" name=\"NewLink\""
|
"<input type=\"text\" name=\"NewFolderName\""
|
||||||
" size=\"32\" maxlength=\"40\" value=\"\" />",
|
" size=\"32\" maxlength=\"40\" value=\"\" />",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],Txt_Folder);
|
The_ClassFormul[Gbl.Prefs.Theme],Txt_Folder);
|
||||||
|
|
||||||
|
@ -8767,20 +8767,20 @@ void Brw_ShowFileMetadata (void)
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
{
|
{
|
||||||
case Brw_SHOW_DOCUM_INS:
|
case Brw_SHOW_DOCUM_INS:
|
||||||
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole < Rol_INS_ADM)
|
||||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_DOCUM_CTR:
|
case Brw_SHOW_DOCUM_CTR:
|
||||||
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADM)
|
if (Gbl.Usrs.Me.LoggedRole < Rol_CTR_ADM)
|
||||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_DOCUM_DEG:
|
case Brw_SHOW_DOCUM_DEG:
|
||||||
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole < Rol_DEG_ADM)
|
||||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_DOCUM_CRS:
|
case Brw_SHOW_DOCUM_CRS:
|
||||||
case Brw_SHOW_DOCUM_GRP:
|
case Brw_SHOW_DOCUM_GRP:
|
||||||
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.LoggedRole < Rol_TEACHER)
|
||||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -8928,7 +8928,7 @@ void Brw_ShowFileMetadata (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* Unknown publisher */
|
/* Unknown publisher */
|
||||||
fprintf (Gbl.F.Out,"%s",Txt_ROLES_SINGUL_Abc[Rol_ROLE_UNKNOWN][Usr_SEX_UNKNOWN]);
|
fprintf (Gbl.F.Out,"%s",Txt_ROLES_SINGUL_Abc[Rol_UNKNOWN][Usr_SEX_UNKNOWN]);
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
|
@ -9187,20 +9187,20 @@ void Brw_DownloadFile (void)
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
{
|
{
|
||||||
case Brw_SHOW_DOCUM_INS:
|
case Brw_SHOW_DOCUM_INS:
|
||||||
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole < Rol_INS_ADM)
|
||||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_DOCUM_CTR:
|
case Brw_SHOW_DOCUM_CTR:
|
||||||
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADM)
|
if (Gbl.Usrs.Me.LoggedRole < Rol_CTR_ADM)
|
||||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_DOCUM_DEG:
|
case Brw_SHOW_DOCUM_DEG:
|
||||||
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole < Rol_DEG_ADM)
|
||||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_DOCUM_CRS:
|
case Brw_SHOW_DOCUM_CRS:
|
||||||
case Brw_SHOW_DOCUM_GRP:
|
case Brw_SHOW_DOCUM_GRP:
|
||||||
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.LoggedRole < Rol_TEACHER)
|
||||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -9342,7 +9342,7 @@ static bool Brw_CheckIfICanEditFileMetadata (long PublisherUsrCod)
|
||||||
else // The file has no publisher
|
else // The file has no publisher
|
||||||
{
|
{
|
||||||
ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||||
if ((ZoneUsrCod <= 0 && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) || // It's a zone without owner and I am a superuser (I may be the future owner)
|
if ((ZoneUsrCod <= 0 && Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) || // It's a zone without owner and I am a superuser (I may be the future owner)
|
||||||
ZoneUsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the owner
|
ZoneUsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the owner
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -10530,7 +10530,7 @@ static void Brw_RenameChildrenFilesOrFoldersInDB (const char *OldPath,const char
|
||||||
static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
|
static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
|
||||||
{
|
{
|
||||||
/***** I must be student, teacher, admin or superuser to edit *****/
|
/***** I must be student, teacher, admin or superuser to edit *****/
|
||||||
if (Gbl.Usrs.Me.MaxRole < Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.MaxRole < Rol_STUDENT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** Set depending on browser, level, logged role... *****/
|
/***** Set depending on browser, level, logged role... *****/
|
||||||
|
@ -10551,7 +10551,7 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
|
||||||
(Level > 1 &&
|
(Level > 1 &&
|
||||||
!Gbl.FileBrowser.Asg.Hidden && // If assignment is visible (not hidden)
|
!Gbl.FileBrowser.Asg.Hidden && // If assignment is visible (not hidden)
|
||||||
Gbl.FileBrowser.Asg.ICanDo && // If I can do this assignment
|
Gbl.FileBrowser.Asg.ICanDo && // If I can do this assignment
|
||||||
(Gbl.FileBrowser.Asg.Open || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER))));
|
(Gbl.FileBrowser.Asg.Open || Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER))));
|
||||||
default:
|
default:
|
||||||
return (Level != 0 &&
|
return (Level != 0 &&
|
||||||
Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type]);
|
Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type]);
|
||||||
|
@ -10565,7 +10565,7 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
|
||||||
static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
|
static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
|
||||||
{
|
{
|
||||||
/***** I must be student, teacher, admin or superuser to edit *****/
|
/***** I must be student, teacher, admin or superuser to edit *****/
|
||||||
if (Gbl.Usrs.Me.MaxRole < Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.MaxRole < Rol_STUDENT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** Have I premission to create/paste a new file or folder into the folder? *****/
|
/***** Have I premission to create/paste a new file or folder into the folder? *****/
|
||||||
|
@ -10578,7 +10578,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
|
||||||
(!Gbl.FileBrowser.Asg.Hidden && // If assignment is visible (not hidden)
|
(!Gbl.FileBrowser.Asg.Hidden && // If assignment is visible (not hidden)
|
||||||
Gbl.FileBrowser.Asg.ICanDo && // If I can do this assignment
|
Gbl.FileBrowser.Asg.ICanDo && // If I can do this assignment
|
||||||
(Gbl.FileBrowser.Asg.Open ||
|
(Gbl.FileBrowser.Asg.Open ||
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER))));
|
Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER))));
|
||||||
default:
|
default:
|
||||||
return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type];
|
return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type];
|
||||||
}
|
}
|
||||||
|
@ -10603,7 +10603,7 @@ static bool Brw_CheckIfIHavePermissionFileOrFolderCommon (void)
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT: // If I am a student, I can modify the file/folder if I am the publisher
|
case Rol_STUDENT: // If I am a student, I can modify the file/folder if I am the publisher
|
||||||
/***** Get all the distinct publishers of files starting by Gbl.FileBrowser.Priv.FullPathInTree from database *****/
|
/***** Get all the distinct publishers of files starting by Gbl.FileBrowser.Priv.FullPathInTree from database *****/
|
||||||
sprintf (Query,"SELECT DISTINCT(PublisherUsrCod) FROM files"
|
sprintf (Query,"SELECT DISTINCT(PublisherUsrCod) FROM files"
|
||||||
" WHERE FileBrowser='%u' AND Cod='%ld'"
|
" WHERE FileBrowser='%u' AND Cod='%ld'"
|
||||||
|
@ -10626,9 +10626,9 @@ static bool Brw_CheckIfIHavePermissionFileOrFolderCommon (void)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
return (Gbl.Usrs.Me.UsrDat.UsrCod == PublisherUsrCod); // Am I the publisher of subtree?
|
return (Gbl.Usrs.Me.UsrDat.UsrCod == PublisherUsrCod); // Am I the publisher of subtree?
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
86
swad_forum.c
86
swad_forum.c
|
@ -876,7 +876,7 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
|
||||||
long PstCod;
|
long PstCod;
|
||||||
bool NewPst = false;
|
bool NewPst = false;
|
||||||
bool ICanModerateForum = false;
|
bool ICanModerateForum = false;
|
||||||
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads...
|
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // If I have permission to move threads...
|
||||||
|
|
||||||
/***** Get data of the thread *****/
|
/***** Get data of the thread *****/
|
||||||
Thr.ThrCod = ThrCod;
|
Thr.ThrCod = ThrCod;
|
||||||
|
@ -954,20 +954,20 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
|
||||||
case For_FORUM_SWAD_USRS: case For_FORUM_SWAD_TCHS:
|
case For_FORUM_SWAD_USRS: case For_FORUM_SWAD_TCHS:
|
||||||
case For_FORUM_GLOBAL_USRS: case For_FORUM_GLOBAL_TCHS:
|
case For_FORUM_GLOBAL_USRS: case For_FORUM_GLOBAL_TCHS:
|
||||||
case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_TCHS:
|
case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_TCHS:
|
||||||
ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
|
ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
|
||||||
break;
|
break;
|
||||||
case For_FORUM_INSTITUTION_USRS: case For_FORUM_INSTITUTION_TCHS:
|
case For_FORUM_INSTITUTION_USRS: case For_FORUM_INSTITUTION_TCHS:
|
||||||
ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
|
ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
|
||||||
break;
|
break;
|
||||||
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_TCHS:
|
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_TCHS:
|
||||||
case For_FORUM_COURSE_TCHS:
|
case For_FORUM_COURSE_TCHS:
|
||||||
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_COURSE_USRS:
|
case For_FORUM_COURSE_USRS:
|
||||||
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
|
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1536,36 +1536,36 @@ void For_SetForumTypeAndRestrictAccess (void)
|
||||||
switch (Gbl.Forum.ForumType)
|
switch (Gbl.Forum.ForumType)
|
||||||
{
|
{
|
||||||
case For_FORUM_COURSE_USRS:
|
case For_FORUM_COURSE_USRS:
|
||||||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyRoleInCrs (Gbl.Forum.Crs.CrsCod) >= Rol_ROLE_STUDENT);
|
Rol_GetMyRoleInCrs (Gbl.Forum.Crs.CrsCod) >= Rol_STUDENT);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_COURSE_TCHS:
|
case For_FORUM_COURSE_TCHS:
|
||||||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyRoleInCrs (Gbl.Forum.Crs.CrsCod) >= Rol_ROLE_TEACHER);
|
Rol_GetMyRoleInCrs (Gbl.Forum.Crs.CrsCod) >= Rol_TEACHER);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_DEGREE_USRS:
|
case For_FORUM_DEGREE_USRS:
|
||||||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyMaxRoleInDeg (Gbl.Forum.Deg.DegCod) >= Rol_ROLE_STUDENT);
|
Rol_GetMyMaxRoleInDeg (Gbl.Forum.Deg.DegCod) >= Rol_STUDENT);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_DEGREE_TCHS:
|
case For_FORUM_DEGREE_TCHS:
|
||||||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyMaxRoleInDeg (Gbl.Forum.Deg.DegCod) >= Rol_ROLE_TEACHER);
|
Rol_GetMyMaxRoleInDeg (Gbl.Forum.Deg.DegCod) >= Rol_TEACHER);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_CENTRE_USRS:
|
case For_FORUM_CENTRE_USRS:
|
||||||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyMaxRoleInCtr (Gbl.Forum.Ctr.CtrCod) >= Rol_ROLE_STUDENT);
|
Rol_GetMyMaxRoleInCtr (Gbl.Forum.Ctr.CtrCod) >= Rol_STUDENT);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_CENTRE_TCHS:
|
case For_FORUM_CENTRE_TCHS:
|
||||||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyMaxRoleInCtr (Gbl.Forum.Ctr.CtrCod) >= Rol_ROLE_TEACHER);
|
Rol_GetMyMaxRoleInCtr (Gbl.Forum.Ctr.CtrCod) >= Rol_TEACHER);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_INSTITUTION_USRS:
|
case For_FORUM_INSTITUTION_USRS:
|
||||||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyMaxRoleInIns (Gbl.Forum.Ins.InsCod) >= Rol_ROLE_STUDENT);
|
Rol_GetMyMaxRoleInIns (Gbl.Forum.Ins.InsCod) >= Rol_STUDENT);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_INSTITUTION_TCHS:
|
case For_FORUM_INSTITUTION_TCHS:
|
||||||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyMaxRoleInIns (Gbl.Forum.Ins.InsCod) >= Rol_ROLE_TEACHER);
|
Rol_GetMyMaxRoleInIns (Gbl.Forum.Ins.InsCod) >= Rol_TEACHER);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_GLOBAL_USRS:
|
case For_FORUM_GLOBAL_USRS:
|
||||||
case For_FORUM_SWAD_USRS:
|
case For_FORUM_SWAD_USRS:
|
||||||
|
@ -1573,7 +1573,7 @@ void For_SetForumTypeAndRestrictAccess (void)
|
||||||
break;
|
break;
|
||||||
case For_FORUM_GLOBAL_TCHS:
|
case For_FORUM_GLOBAL_TCHS:
|
||||||
case For_FORUM_SWAD_TCHS:
|
case For_FORUM_SWAD_TCHS:
|
||||||
ICanSeeForum = (Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_ROLE_TEACHER));
|
ICanSeeForum = (Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_TEACHER));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!ICanSeeForum)
|
if (!ICanSeeForum)
|
||||||
|
@ -1588,7 +1588,7 @@ void For_ShowForumList (void)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassFormul[The_NUM_THEMES];
|
extern const char *The_ClassFormul[The_NUM_THEMES];
|
||||||
extern const char *Txt_Forums;
|
extern const char *Txt_Forums;
|
||||||
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads...
|
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // If I have permission to move threads...
|
||||||
bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS];
|
bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS];
|
||||||
unsigned NumMyIns;
|
unsigned NumMyIns;
|
||||||
MYSQL_RES *mysql_resCtr;
|
MYSQL_RES *mysql_resCtr;
|
||||||
|
@ -1633,7 +1633,7 @@ void For_ShowForumList (void)
|
||||||
switch (Gbl.Forum.WhichForums)
|
switch (Gbl.Forum.WhichForums)
|
||||||
{
|
{
|
||||||
case For_ONLY_CURRENT_FORUMS:
|
case For_ONLY_CURRENT_FORUMS:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
ICanSeeInsForum = true;
|
ICanSeeInsForum = true;
|
||||||
else
|
else
|
||||||
ICanSeeInsForum = Usr_CheckIfIBelongToIns (Gbl.CurrentIns.Ins.InsCod);
|
ICanSeeInsForum = Usr_CheckIfIBelongToIns (Gbl.CurrentIns.Ins.InsCod);
|
||||||
|
@ -1643,7 +1643,7 @@ void For_ShowForumList (void)
|
||||||
|
|
||||||
if (ICanSeeInsForum)
|
if (ICanSeeInsForum)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
ICanSeeCtrForum = true;
|
ICanSeeCtrForum = true;
|
||||||
else
|
else
|
||||||
ICanSeeCtrForum = Usr_CheckIfIBelongToCtr (Gbl.CurrentCtr.Ctr.CtrCod);
|
ICanSeeCtrForum = Usr_CheckIfIBelongToCtr (Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
|
@ -1652,7 +1652,7 @@ void For_ShowForumList (void)
|
||||||
if (For_WriteLinksToInsForums (Gbl.CurrentIns.Ins.InsCod,true,IsLastItemInLevel) > 0)
|
if (For_WriteLinksToInsForums (Gbl.CurrentIns.Ins.InsCod,true,IsLastItemInLevel) > 0)
|
||||||
if (ICanSeeCtrForum)
|
if (ICanSeeCtrForum)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
ICanSeeDegForum = true;
|
ICanSeeDegForum = true;
|
||||||
else
|
else
|
||||||
ICanSeeDegForum = Usr_CheckIfIBelongToDeg (Gbl.CurrentDeg.Deg.DegCod);
|
ICanSeeDegForum = Usr_CheckIfIBelongToDeg (Gbl.CurrentDeg.Deg.DegCod);
|
||||||
|
@ -1663,7 +1663,7 @@ void For_ShowForumList (void)
|
||||||
/***** Links to forums of current degree *****/
|
/***** Links to forums of current degree *****/
|
||||||
if (For_WriteLinksToDegForums (Gbl.CurrentDeg.Deg.DegCod,true,IsLastItemInLevel) > 0)
|
if (For_WriteLinksToDegForums (Gbl.CurrentDeg.Deg.DegCod,true,IsLastItemInLevel) > 0)
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
/***** Links to forums of current degree *****/
|
/***** Links to forums of current degree *****/
|
||||||
For_WriteLinksToCrsForums (Gbl.CurrentCrs.Crs.CrsCod,true,IsLastItemInLevel);
|
For_WriteLinksToCrsForums (Gbl.CurrentCrs.Crs.CrsCod,true,IsLastItemInLevel);
|
||||||
}
|
}
|
||||||
|
@ -1821,7 +1821,7 @@ static void For_WriteLinksToGblForums (bool IsLastItemInLevel[1+For_FORUM_MAX_LE
|
||||||
For_WriteLinkToAForum (For_FORUM_GLOBAL_USRS,false,1,IsLastItemInLevel);
|
For_WriteLinkToAForum (For_FORUM_GLOBAL_USRS,false,1,IsLastItemInLevel);
|
||||||
|
|
||||||
/***** Link to forum of teachers global *****/
|
/***** Link to forum of teachers global *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_ROLE_TEACHER))
|
if (Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_TEACHER))
|
||||||
{
|
{
|
||||||
IsLastItemInLevel[1] = false;
|
IsLastItemInLevel[1] = false;
|
||||||
For_WriteLinkToAForum (For_FORUM_GLOBAL_TCHS,false,1,IsLastItemInLevel);
|
For_WriteLinkToAForum (For_FORUM_GLOBAL_TCHS,false,1,IsLastItemInLevel);
|
||||||
|
@ -1834,8 +1834,8 @@ static void For_WriteLinksToGblForums (bool IsLastItemInLevel[1+For_FORUM_MAX_LE
|
||||||
|
|
||||||
static void For_WriteLinksToPlatformForums (bool IsLastForum,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS])
|
static void For_WriteLinksToPlatformForums (bool IsLastForum,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS])
|
||||||
{
|
{
|
||||||
bool ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
bool ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_ROLE_TEACHER));
|
Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_TEACHER));
|
||||||
|
|
||||||
/***** Link to forum of users about the platform *****/
|
/***** Link to forum of users about the platform *****/
|
||||||
IsLastItemInLevel[1] = (IsLastForum && !ICanSeeTeacherForum);
|
IsLastItemInLevel[1] = (IsLastForum && !ICanSeeTeacherForum);
|
||||||
|
@ -1860,8 +1860,8 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,bool IsLastIte
|
||||||
|
|
||||||
if (InsCod > 0)
|
if (InsCod > 0)
|
||||||
{
|
{
|
||||||
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyMaxRoleInIns (InsCod) >= Rol_ROLE_TEACHER);
|
Rol_GetMyMaxRoleInIns (InsCod) >= Rol_TEACHER);
|
||||||
|
|
||||||
/***** Get data of this institution *****/
|
/***** Get data of this institution *****/
|
||||||
Gbl.Forum.Ins.InsCod = InsCod;
|
Gbl.Forum.Ins.InsCod = InsCod;
|
||||||
|
@ -1893,8 +1893,8 @@ static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,bool IsLastIte
|
||||||
|
|
||||||
if (CtrCod > 0)
|
if (CtrCod > 0)
|
||||||
{
|
{
|
||||||
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyMaxRoleInCtr (CtrCod) >= Rol_ROLE_TEACHER);
|
Rol_GetMyMaxRoleInCtr (CtrCod) >= Rol_TEACHER);
|
||||||
|
|
||||||
/***** Get data of this centre *****/
|
/***** Get data of this centre *****/
|
||||||
Gbl.Forum.Ctr.CtrCod = CtrCod;
|
Gbl.Forum.Ctr.CtrCod = CtrCod;
|
||||||
|
@ -1926,8 +1926,8 @@ static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,bool IsLastIte
|
||||||
|
|
||||||
if (DegCod > 0)
|
if (DegCod > 0)
|
||||||
{
|
{
|
||||||
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyMaxRoleInDeg (DegCod) >= Rol_ROLE_TEACHER);
|
Rol_GetMyMaxRoleInDeg (DegCod) >= Rol_TEACHER);
|
||||||
|
|
||||||
/***** Get data of this degree *****/
|
/***** Get data of this degree *****/
|
||||||
Gbl.Forum.Deg.DegCod = DegCod;
|
Gbl.Forum.Deg.DegCod = DegCod;
|
||||||
|
@ -1959,8 +1959,8 @@ static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,bool IsLastIte
|
||||||
|
|
||||||
if (CrsCod > 0)
|
if (CrsCod > 0)
|
||||||
{
|
{
|
||||||
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
Rol_GetMyRoleInCrs (CrsCod) >= Rol_ROLE_TEACHER);
|
Rol_GetMyRoleInCrs (CrsCod) >= Rol_TEACHER);
|
||||||
|
|
||||||
/***** Get data of this course *****/
|
/***** Get data of this course *****/
|
||||||
Gbl.Forum.Crs.CrsCod = CrsCod;
|
Gbl.Forum.Crs.CrsCod = CrsCod;
|
||||||
|
@ -2377,7 +2377,7 @@ void For_ShowForumThrs (void)
|
||||||
For_ForumOrderType_t Order;
|
For_ForumOrderType_t Order;
|
||||||
long ThrCods[Pag_ITEMS_PER_PAGE];
|
long ThrCods[Pag_ITEMS_PER_PAGE];
|
||||||
struct Pagination PaginationThrs;
|
struct Pagination PaginationThrs;
|
||||||
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads...
|
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // If I have permission to move threads...
|
||||||
|
|
||||||
/***** Get if there is a thread ready to be moved *****/
|
/***** Get if there is a thread ready to be moved *****/
|
||||||
if (ICanMoveThreads)
|
if (ICanMoveThreads)
|
||||||
|
@ -3233,7 +3233,7 @@ void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],struct Pagination *Pagi
|
||||||
const char *DateTime;
|
const char *DateTime;
|
||||||
struct Pagination PaginationPsts;
|
struct Pagination PaginationPsts;
|
||||||
const char *Style;
|
const char *Style;
|
||||||
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads...
|
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // If I have permission to move threads...
|
||||||
long ThreadInMyClipboard = -1L;
|
long ThreadInMyClipboard = -1L;
|
||||||
bool ThisThreadIsInMyClipboard;
|
bool ThisThreadIsInMyClipboard;
|
||||||
unsigned Column;
|
unsigned Column;
|
||||||
|
|
|
@ -159,7 +159,7 @@ void Gbl_InitializeGlobals (void)
|
||||||
Gbl.Usrs.Me.RoleFromSession =
|
Gbl.Usrs.Me.RoleFromSession =
|
||||||
Gbl.Usrs.Me.LoggedRole =
|
Gbl.Usrs.Me.LoggedRole =
|
||||||
Gbl.Usrs.Me.LoggedRoleBeforeCloseSession =
|
Gbl.Usrs.Me.LoggedRoleBeforeCloseSession =
|
||||||
Gbl.Usrs.Me.MaxRole = Rol_ROLE_UNKNOWN;
|
Gbl.Usrs.Me.MaxRole = Rol_UNKNOWN;
|
||||||
Gbl.Usrs.Me.IBelongToCurrentIns = false;
|
Gbl.Usrs.Me.IBelongToCurrentIns = false;
|
||||||
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
|
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
|
||||||
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
|
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
|
||||||
|
@ -439,7 +439,7 @@ void Gbl_InitializeGlobals (void)
|
||||||
/* Related to imported data from external site */
|
/* Related to imported data from external site */
|
||||||
Gbl.Imported.ExternalUsrId[0] = '\0';
|
Gbl.Imported.ExternalUsrId[0] = '\0';
|
||||||
Gbl.Imported.ExternalSesId[0] = '\0';
|
Gbl.Imported.ExternalSesId[0] = '\0';
|
||||||
Gbl.Imported.ExternalRole = Rol_ROLE_UNKNOWN;
|
Gbl.Imported.ExternalRole = Rol_UNKNOWN;
|
||||||
|
|
||||||
Gbl.WebService.Function = Svc_unknown;
|
Gbl.WebService.Function = Svc_unknown;
|
||||||
}
|
}
|
||||||
|
|
32
swad_group.c
32
swad_group.c
|
@ -535,7 +535,7 @@ void Grp_ChangeMyGrps (void)
|
||||||
// ...is a radio-based form and not a checkbox-based form...
|
// ...is a radio-based form and not a checkbox-based form...
|
||||||
// ...this check is made only to avoid problems...
|
// ...this check is made only to avoid problems...
|
||||||
// ...if the student manipulates the form
|
// ...if the student manipulates the form
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT &&
|
||||||
LstGrpsIWant.NumGrps >= 2)
|
LstGrpsIWant.NumGrps >= 2)
|
||||||
MySelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsIWant);
|
MySelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsIWant);
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ void Grp_ChangeOtherUsrGrps (void)
|
||||||
|
|
||||||
/***** A student can not be enrolled in more than one group
|
/***** A student can not be enrolled in more than one group
|
||||||
if the type of group is of single enrollment *****/
|
if the type of group is of single enrollment *****/
|
||||||
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT &&
|
||||||
LstGrpsUsrWants.NumGrps >= 2)
|
LstGrpsUsrWants.NumGrps >= 2)
|
||||||
SelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsUsrWants);
|
SelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsUsrWants);
|
||||||
|
|
||||||
|
@ -636,7 +636,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
|
||||||
Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,-1L,
|
Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,-1L,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong);
|
Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong);
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)
|
||||||
{
|
{
|
||||||
/***** Go across the list of groups which I belong to and check if I try to leave a closed group *****/
|
/***** Go across the list of groups which I belong to and check if I try to leave a closed group *****/
|
||||||
for (NumGrpIBelong = 0;
|
for (NumGrpIBelong = 0;
|
||||||
|
@ -770,7 +770,7 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
||||||
bool RegisterUsrInThisGrp;
|
bool RegisterUsrInThisGrp;
|
||||||
bool ChangesMade = false;
|
bool ChangesMade = false;
|
||||||
|
|
||||||
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT)
|
||||||
{
|
{
|
||||||
/***** Lock tables to make the inscription atomic *****/
|
/***** Lock tables to make the inscription atomic *****/
|
||||||
DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
|
DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
|
||||||
|
@ -820,7 +820,7 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
||||||
Grp_FreeListCodGrp (&LstGrpsUsrBelongs);
|
Grp_FreeListCodGrp (&LstGrpsUsrBelongs);
|
||||||
|
|
||||||
/***** Unlock tables after changes in my groups *****/
|
/***** Unlock tables after changes in my groups *****/
|
||||||
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT)
|
||||||
{
|
{
|
||||||
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
||||||
// ...to not retry the unlock if error in unlocking
|
// ...to not retry the unlock if error in unlocking
|
||||||
|
@ -1520,7 +1520,7 @@ void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrS
|
||||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||||
}
|
}
|
||||||
if (!(IBelongToThisGroup ||
|
if (!(IBelongToThisGroup ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
|
||||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
fprintf (Gbl.F.Out," onclick=\"uncheckParent(this,'WholeCrs')\" /></td>");
|
fprintf (Gbl.F.Out," onclick=\"uncheckParent(this,'WholeCrs')\" /></td>");
|
||||||
|
|
||||||
|
@ -1545,8 +1545,8 @@ void Grp_ReqRegisterInGrps (void)
|
||||||
unsigned NumGrpsIBelong;
|
unsigned NumGrpsIBelong;
|
||||||
|
|
||||||
/***** Put link (form) to edit groups *****/
|
/***** Put link (form) to edit groups *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Lay_PutFormToEdit (ActReqEdiGrp);
|
Lay_PutFormToEdit (ActReqEdiGrp);
|
||||||
|
|
||||||
/***** Check if this course has groups *****/
|
/***** Check if this course has groups *****/
|
||||||
|
@ -1556,7 +1556,7 @@ void Grp_ReqRegisterInGrps (void)
|
||||||
Act_FormStart (ActChgGrp);
|
Act_FormStart (ActChgGrp);
|
||||||
|
|
||||||
/***** Show list of groups to register/remove me *****/
|
/***** Show list of groups to register/remove me *****/
|
||||||
NumGrpsIBelong = Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT));
|
NumGrpsIBelong = Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT));
|
||||||
|
|
||||||
/***** End form *****/
|
/***** End form *****/
|
||||||
Lay_PutConfirmButton (NumGrpsIBelong ? Txt_Change_my_groups :
|
Lay_PutConfirmButton (NumGrpsIBelong ? Txt_Change_my_groups :
|
||||||
|
@ -1690,7 +1690,7 @@ static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
|
||||||
|
|
||||||
// If user is a student and the enrollment is single
|
// If user is a student and the enrollment is single
|
||||||
// and there are more than a group, put a radio item
|
// and there are more than a group, put a radio item
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT &&
|
||||||
!GrpTyp->MultipleEnrollment &&
|
!GrpTyp->MultipleEnrollment &&
|
||||||
GrpTyp->NumGrps > 1)
|
GrpTyp->NumGrps > 1)
|
||||||
{
|
{
|
||||||
|
@ -1706,7 +1706,7 @@ static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
|
||||||
|
|
||||||
if (IBelongToThisGroup)
|
if (IBelongToThisGroup)
|
||||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||||
else if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT) &&
|
else if ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) &&
|
||||||
((!Grp->Open) || (Grp->NumStudents >= Grp->MaxStudents)))
|
((!Grp->Open) || (Grp->NumStudents >= Grp->MaxStudents)))
|
||||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
fprintf (Gbl.F.Out," /></td>");
|
fprintf (Gbl.F.Out," /></td>");
|
||||||
|
@ -1801,7 +1801,7 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod)
|
||||||
if (UsrBelongsToThisGroup)
|
if (UsrBelongsToThisGroup)
|
||||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||||
if (!(IBelongToThisGroup ||
|
if (!(IBelongToThisGroup ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
|
||||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
fprintf (Gbl.F.Out," /></td>");
|
fprintf (Gbl.F.Out," /></td>");
|
||||||
|
|
||||||
|
@ -2750,7 +2750,7 @@ unsigned Grp_CountNumStdsInGrp (long GrpCod)
|
||||||
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||||
" AND crs_usr.Role='%u'",
|
" AND crs_usr.Role='%u'",
|
||||||
GrpCod,(unsigned) Rol_ROLE_STUDENT);
|
GrpCod,(unsigned) Rol_STUDENT);
|
||||||
return (unsigned) DB_QueryCOUNT (Query,
|
return (unsigned) DB_QueryCOUNT (Query,
|
||||||
"can not get number of students in a group");
|
"can not get number of students in a group");
|
||||||
}
|
}
|
||||||
|
@ -2771,7 +2771,7 @@ static unsigned Grp_CountNumStdsInNoGrpsOfType (long GrpTypCod)
|
||||||
" WHERE CrsCod='%ld' AND Role='%u' AND UsrCod NOT IN"
|
" WHERE CrsCod='%ld' AND Role='%u' AND UsrCod NOT IN"
|
||||||
" (SELECT DISTINCT crs_grp_usr.UsrCod FROM crs_grp,crs_grp_usr"
|
" (SELECT DISTINCT crs_grp_usr.UsrCod FROM crs_grp,crs_grp_usr"
|
||||||
" WHERE crs_grp.GrpTypCod='%ld' AND crs_grp.GrpCod=crs_grp_usr.GrpCod)",
|
" WHERE crs_grp.GrpTypCod='%ld' AND crs_grp.GrpCod=crs_grp_usr.GrpCod)",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Rol_ROLE_STUDENT,GrpTypCod);
|
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Rol_STUDENT,GrpTypCod);
|
||||||
DB_QuerySELECT (Query,&mysql_res,"can not get the number of students not belonging to groups of a type");
|
DB_QuerySELECT (Query,&mysql_res,"can not get the number of students not belonging to groups of a type");
|
||||||
|
|
||||||
/***** Get the number of students (row[0]) *****/
|
/***** Get the number of students (row[0]) *****/
|
||||||
|
@ -2863,7 +2863,7 @@ unsigned Grp_NumGrpTypesMandatIDontBelong (void)
|
||||||
" WHERE crs_grp_types.CrsCod='%ld' AND crs_grp_types.Mandatory='Y' AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
" WHERE crs_grp_types.CrsCod='%ld' AND crs_grp_types.Mandatory='Y' AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod AND crs_grp_usr.UsrCod='%ld')",
|
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod AND crs_grp_usr.UsrCod='%ld')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
(unsigned) Rol_ROLE_STUDENT,
|
(unsigned) Rol_STUDENT,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
NumGrpTypes = DB_QueryCOUNT (Query,"can not get the number of types of group of mandatory registration to which you don't belong to");
|
NumGrpTypes = DB_QueryCOUNT (Query,"can not get the number of types of group of mandatory registration to which you don't belong to");
|
||||||
|
@ -2889,7 +2889,7 @@ static bool Grp_GetIfGrpIsAvailable (long GrpTypCod)
|
||||||
" AND crs_grp.Open='Y' AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
" AND crs_grp.Open='Y' AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod AND crs_grp_usr.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'"
|
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod AND crs_grp_usr.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'"
|
||||||
" GROUP BY crs_grp.GrpCod HAVING NumStudents<MaxStudents) AS available_grp_types",
|
" GROUP BY crs_grp.GrpCod HAVING NumStudents<MaxStudents) AS available_grp_types",
|
||||||
GrpTypCod,(unsigned) Rol_ROLE_STUDENT);
|
GrpTypCod,(unsigned) Rol_STUDENT);
|
||||||
NumGrpTypes = DB_QueryCOUNT (Query,"can not check if a type of group has available groups");
|
NumGrpTypes = DB_QueryCOUNT (Query,"can not check if a type of group has available groups");
|
||||||
|
|
||||||
return (NumGrpTypes != 0);
|
return (NumGrpTypes != 0);
|
||||||
|
|
|
@ -92,7 +92,7 @@ void Hld_SeeHolidays (void)
|
||||||
Hld_GetListHolidays ();
|
Hld_GetListHolidays ();
|
||||||
|
|
||||||
/***** Put link (form) to edit holidays *****/
|
/***** Put link (form) to edit holidays *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Hld_PutFormToEditHlds ();
|
Hld_PutFormToEditHlds ();
|
||||||
|
|
||||||
/***** Table head *****/
|
/***** Table head *****/
|
||||||
|
|
|
@ -188,7 +188,7 @@ void Imp_ImportStdsFromAnImpGrp (long ImpGrpCod,struct ListCodGrps *LstGrps,unsi
|
||||||
UsrDat.UsrCod = ListUsrCodsForThisID.Lst[NumUsrFoundForThisID];
|
UsrDat.UsrCod = ListUsrCodsForThisID.Lst[NumUsrFoundForThisID];
|
||||||
Usr_GetUsrDataFromUsrCod (&UsrDat); // Get data of the first user in list
|
Usr_GetUsrDataFromUsrCod (&UsrDat); // Get data of the first user in list
|
||||||
|
|
||||||
if (UsrDat.RoleInCurrentCrsDB <= Rol_ROLE_STUDENT)
|
if (UsrDat.RoleInCurrentCrsDB <= Rol_STUDENT)
|
||||||
{
|
{
|
||||||
/* Update user's data if only one user with this ID */
|
/* Update user's data if only one user with this ID */
|
||||||
if (ListUsrCodsForThisID.NumUsrs == 1) // Only one user with this ID
|
if (ListUsrCodsForThisID.NumUsrs == 1) // Only one user with this ID
|
||||||
|
@ -215,11 +215,11 @@ void Imp_ImportStdsFromAnImpGrp (long ImpGrpCod,struct ListCodGrps *LstGrps,unsi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsrDat.RoleInCurrentCrsDB == Rol_ROLE_STUDENT) // He/she was already a student in current course
|
if (UsrDat.RoleInCurrentCrsDB == Rol_STUDENT) // He/she was already a student in current course
|
||||||
Enr_AcceptUsrInCrs (UsrDat.UsrCod);
|
Enr_AcceptUsrInCrs (UsrDat.UsrCod);
|
||||||
else // He/she not belonged to the current course
|
else // He/she not belonged to the current course
|
||||||
/* Register user as student in the current course */
|
/* Register user as student in the current course */
|
||||||
Enr_RegisterUsrInCurrentCrs (&UsrDat,Rol_ROLE_STUDENT,
|
Enr_RegisterUsrInCurrentCrs (&UsrDat,Rol_STUDENT,
|
||||||
Cns_QUIET,Enr_SET_ACCEPTED_TO_TRUE);
|
Cns_QUIET,Enr_SET_ACCEPTED_TO_TRUE);
|
||||||
|
|
||||||
/* Register user in the selected groups */
|
/* Register user in the selected groups */
|
||||||
|
@ -254,7 +254,7 @@ void Imp_ImportStdsFromAnImpGrp (long ImpGrpCod,struct ListCodGrps *LstGrps,unsi
|
||||||
UsrDat.Email[0] = '\0';
|
UsrDat.Email[0] = '\0';
|
||||||
|
|
||||||
/* Register user as student in the current course */
|
/* Register user as student in the current course */
|
||||||
Enr_RegisterUsrInCurrentCrs (&UsrDat,Rol_ROLE_STUDENT,
|
Enr_RegisterUsrInCurrentCrs (&UsrDat,Rol_STUDENT,
|
||||||
Cns_QUIET,Enr_SET_ACCEPTED_TO_TRUE);
|
Cns_QUIET,Enr_SET_ACCEPTED_TO_TRUE);
|
||||||
|
|
||||||
/* Register user in the selected groups */
|
/* Register user in the selected groups */
|
||||||
|
@ -329,7 +329,7 @@ bool Imp_GetImpSessionData (void)
|
||||||
|
|
||||||
/***** Get imported user's (external) role (row[2]) *****/
|
/***** Get imported user's (external) role (row[2]) *****/
|
||||||
if (sscanf (row[2],"%u",&Gbl.Imported.ExternalRole) != 1)
|
if (sscanf (row[2],"%u",&Gbl.Imported.ExternalRole) != 1)
|
||||||
Gbl.Imported.ExternalRole = Rol_ROLE_UNKNOWN;
|
Gbl.Imported.ExternalRole = Rol_UNKNOWN;
|
||||||
|
|
||||||
Result = true;
|
Result = true;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ static void Imp_ListMyImpGrpsAndStds (bool ItsAFormToRegRemStds)
|
||||||
|
|
||||||
if (Gbl.Imported.ExternalUsrId[0] &&
|
if (Gbl.Imported.ExternalUsrId[0] &&
|
||||||
Gbl.Imported.ExternalSesId[0] &&
|
Gbl.Imported.ExternalSesId[0] &&
|
||||||
Gbl.Imported.ExternalRole == Rol_ROLE_TEACHER)
|
Gbl.Imported.ExternalRole == Rol_TEACHER)
|
||||||
{
|
{
|
||||||
/***** Parameters to command used to import data are passed through a temporary file *****/
|
/***** Parameters to command used to import data are passed through a temporary file *****/
|
||||||
/* If the private directory does not exist, create it */
|
/* If the private directory does not exist, create it */
|
||||||
|
@ -564,7 +564,7 @@ static unsigned Imp_GetAndListImpGrpsAndStdsFromDB (bool ItsAFormToRegRemStds)
|
||||||
"</td>" \
|
"</td>" \
|
||||||
"<td class=\"DAT\""
|
"<td class=\"DAT\""
|
||||||
" style=\"text-align:left; vertical-align:top;\">",
|
" style=\"text-align:left; vertical-align:top;\">",
|
||||||
NumStds,Txt_ROLES_PLURAL_abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],
|
NumStds,Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||||
NumStds ? ":" :
|
NumStds ? ":" :
|
||||||
"");
|
"");
|
||||||
if (NumStds)
|
if (NumStds)
|
||||||
|
|
|
@ -294,7 +294,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
||||||
" AND usr_data.DptCod='%ld'"
|
" AND usr_data.DptCod='%ld'"
|
||||||
" ORDER BY degrees.FullName,courses.FullName",
|
" ORDER BY degrees.FullName,courses.FullName",
|
||||||
Gbl.Stat.DegTypCod,
|
Gbl.Stat.DegTypCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
Gbl.Stat.DptCod);
|
Gbl.Stat.DptCod);
|
||||||
else
|
else
|
||||||
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||||
|
@ -305,7 +305,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
||||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||||
" AND usr_data.DptCod='%ld'"
|
" AND usr_data.DptCod='%ld'"
|
||||||
" ORDER BY degrees.FullName,courses.FullName",
|
" ORDER BY degrees.FullName,courses.FullName",
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
Gbl.Stat.DptCod);
|
Gbl.Stat.DptCod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -338,7 +338,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
||||||
" AND usr_data.DptCod='%ld'"
|
" AND usr_data.DptCod='%ld'"
|
||||||
" ORDER BY degrees.FullName,courses.FullName",
|
" ORDER BY degrees.FullName,courses.FullName",
|
||||||
Gbl.CurrentCty.Cty.CtyCod,
|
Gbl.CurrentCty.Cty.CtyCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
Gbl.Stat.DptCod);
|
Gbl.Stat.DptCod);
|
||||||
else
|
else
|
||||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||||
|
@ -363,7 +363,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
||||||
" AND usr_data.DptCod='%ld'"
|
" AND usr_data.DptCod='%ld'"
|
||||||
" ORDER BY degrees.FullName,courses.FullName",
|
" ORDER BY degrees.FullName,courses.FullName",
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
Gbl.CurrentIns.Ins.InsCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
Gbl.Stat.DptCod);
|
Gbl.Stat.DptCod);
|
||||||
else
|
else
|
||||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||||
|
@ -386,7 +386,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
||||||
" AND usr_data.DptCod='%ld'"
|
" AND usr_data.DptCod='%ld'"
|
||||||
" ORDER BY degrees.FullName,courses.FullName",
|
" ORDER BY degrees.FullName,courses.FullName",
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
Gbl.Stat.DptCod);
|
Gbl.Stat.DptCod);
|
||||||
else
|
else
|
||||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||||
|
@ -408,7 +408,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
||||||
" AND usr_data.DptCod='%ld'"
|
" AND usr_data.DptCod='%ld'"
|
||||||
" ORDER BY degrees.FullName,courses.FullName",
|
" ORDER BY degrees.FullName,courses.FullName",
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
Gbl.CurrentDeg.Deg.DegCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
Gbl.Stat.DptCod);
|
Gbl.Stat.DptCod);
|
||||||
else
|
else
|
||||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||||
|
@ -432,7 +432,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
|
||||||
" ORDER BY degrees.FullName,courses.FullName",
|
" ORDER BY degrees.FullName,courses.FullName",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
Gbl.Stat.DptCod);
|
Gbl.Stat.DptCod);
|
||||||
else
|
else
|
||||||
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
sprintf (Query,"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
|
||||||
|
@ -1050,8 +1050,8 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat
|
||||||
break;
|
break;
|
||||||
case Ind_INDICATORS_FULL:
|
case Ind_INDICATORS_FULL:
|
||||||
/* Get number of users */
|
/* Get number of users */
|
||||||
NumStds = Usr_GetNumUsrsInCrs (Rol_ROLE_STUDENT,CrsCod);
|
NumStds = Usr_GetNumUsrsInCrs (Rol_STUDENT,CrsCod);
|
||||||
NumTchs = Usr_GetNumUsrsInCrs (Rol_ROLE_TEACHER,CrsCod);
|
NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,CrsCod);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"%s\" style=\"text-align:left;"
|
"<td class=\"%s\" style=\"text-align:left;"
|
||||||
|
|
240
swad_info.c
240
swad_info.c
|
@ -291,7 +291,8 @@ static void Inf_SetIHaveReadIntoDB (Inf_InfoType_t InfoType,bool IHaveRead);
|
||||||
static void Inf_CheckAndShowPage (Inf_InfoType_t InfoType);
|
static void Inf_CheckAndShowPage (Inf_InfoType_t InfoType);
|
||||||
static void Inf_CheckAndShowURL (Inf_InfoType_t InfoType);
|
static void Inf_CheckAndShowURL (Inf_InfoType_t InfoType);
|
||||||
static void Inf_ShowPage (Inf_InfoType_t InfoType,const char *URL);
|
static void Inf_ShowPage (Inf_InfoType_t InfoType,const char *URL);
|
||||||
static void Inf_ShowTxtInfo (Inf_InfoType_t InfoType);
|
static void Inf_ShowPlainTxtInfo (Inf_InfoType_t InfoType);
|
||||||
|
static void Inf_ShowRichTxtInfo (Inf_InfoType_t InfoType);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******** Show course info (theory, practices, bibliography, etc.) ***********/
|
/******** Show course info (theory, practices, bibliography, etc.) ***********/
|
||||||
|
@ -319,13 +320,13 @@ void Inf_ShowInfo (void)
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
/* Put checkbox to force students to read this couse info */
|
/* Put checkbox to force students to read this couse info */
|
||||||
if (MustBeRead)
|
if (MustBeRead)
|
||||||
Inf_PutFormToConfirmIHaveReadInfo (InfoType);
|
Inf_PutFormToConfirmIHaveReadInfo (InfoType);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
/* Put link (form) to edit this course info */
|
/* Put link (form) to edit this course info */
|
||||||
Inf_PutFormToEditInfo (InfoType);
|
Inf_PutFormToEditInfo (InfoType);
|
||||||
|
|
||||||
|
@ -375,8 +376,10 @@ void Inf_ShowInfo (void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Inf_INFO_SRC_PLAIN_TEXT:
|
case Inf_INFO_SRC_PLAIN_TEXT:
|
||||||
|
Inf_ShowPlainTxtInfo (InfoType);
|
||||||
|
break;
|
||||||
case Inf_INFO_SRC_RICH_TEXT:
|
case Inf_INFO_SRC_RICH_TEXT:
|
||||||
Inf_ShowTxtInfo (InfoType);
|
Inf_ShowRichTxtInfo (InfoType);
|
||||||
break;
|
break;
|
||||||
case Inf_INFO_SRC_PAGE:
|
case Inf_INFO_SRC_PAGE:
|
||||||
// TODO: Remove the following lines, here only for debug purposes
|
// TODO: Remove the following lines, here only for debug purposes
|
||||||
|
@ -1469,14 +1472,16 @@ Inf_InfoSrc_t Inf_ConvertFromStrDBToInfoSrc (const char *StrInfoSrcDB)
|
||||||
/********** Set info text for a type of course info from database ************/
|
/********** Set info text for a type of course info from database ************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Inf_SetInfoTxtIntoDB (long CrsCod,Inf_InfoType_t InfoType,const char *InfoTxt)
|
void Inf_SetInfoTxtIntoDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||||
|
const char *InfoTxtHTML,const char *InfoTxtMD)
|
||||||
{
|
{
|
||||||
char Query[256+Cns_MAX_BYTES_LONG_TEXT];
|
char Query[256+Cns_MAX_BYTES_LONG_TEXT];
|
||||||
|
|
||||||
/***** Insert or replace info source for a specific type of course information *****/
|
/***** Insert or replace info source for a specific type of course information *****/
|
||||||
sprintf (Query,"REPLACE INTO crs_info_txt (CrsCod,InfoType,InfoTxt)"
|
sprintf (Query,"REPLACE INTO crs_info_txt"
|
||||||
" VALUES ('%ld','%s','%s')",
|
" (CrsCod,InfoType,InfoTxtHTML,InfoTxtMD)"
|
||||||
CrsCod,Inf_NamesInDBForInfoType[InfoType],InfoTxt);
|
" VALUES ('%ld','%s','%s','%s')",
|
||||||
|
CrsCod,Inf_NamesInDBForInfoType[InfoType],InfoTxtHTML,InfoTxtMD);
|
||||||
DB_QueryREPLACE (Query,"can not update info text");
|
DB_QueryREPLACE (Query,"can not update info text");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1484,7 +1489,8 @@ void Inf_SetInfoTxtIntoDB (long CrsCod,Inf_InfoType_t InfoType,const char *InfoT
|
||||||
/********** Get info text for a type of course info from database ************/
|
/********** Get info text for a type of course info from database ************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Inf_GetInfoTxtFromDB (Inf_InfoType_t InfoType,char *InfoTxt,size_t MaxLength)
|
void Inf_GetInfoTxtFromDB (Inf_InfoType_t InfoType,
|
||||||
|
char *InfoTxtHTML,char *InfoTxtMD,size_t MaxLength)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
@ -1493,7 +1499,7 @@ void Inf_GetInfoTxtFromDB (Inf_InfoType_t InfoType,char *InfoTxt,size_t MaxLengt
|
||||||
|
|
||||||
/***** Get info source for a specific type of course information
|
/***** Get info source for a specific type of course information
|
||||||
(bibliography, FAQ, links or evaluation) from database *****/
|
(bibliography, FAQ, links or evaluation) from database *****/
|
||||||
sprintf (Query,"SELECT InfoTxt FROM crs_info_txt"
|
sprintf (Query,"SELECT InfoTxtHTML,InfoTxtMD FROM crs_info_txt"
|
||||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
Gbl.CurrentCrs.Crs.CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get info text");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get info text");
|
||||||
|
@ -1503,11 +1509,28 @@ void Inf_GetInfoTxtFromDB (Inf_InfoType_t InfoType,char *InfoTxt,size_t MaxLengt
|
||||||
{
|
{
|
||||||
/* Get info text */
|
/* Get info text */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
strncpy (InfoTxt,row[0],MaxLength);
|
|
||||||
InfoTxt[MaxLength] = '\0';
|
/* Get text in HTML format (not rigorous) */
|
||||||
|
if (InfoTxtHTML)
|
||||||
|
{
|
||||||
|
strncpy (InfoTxtHTML,row[0],MaxLength);
|
||||||
|
InfoTxtHTML[MaxLength] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get text in Markdown format */
|
||||||
|
if (InfoTxtMD)
|
||||||
|
{
|
||||||
|
strncpy (InfoTxtMD,row[1],MaxLength);
|
||||||
|
InfoTxtMD[MaxLength] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
InfoTxt[0] = '\0';
|
{
|
||||||
|
if (InfoTxtHTML)
|
||||||
|
InfoTxtHTML[0] = '\0';
|
||||||
|
if (InfoTxtMD)
|
||||||
|
InfoTxtMD[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
@ -1530,7 +1553,7 @@ bool Inf_CheckIfInfoTxtIsNotEmpty (long CrsCod,Inf_InfoType_t InfoType)
|
||||||
|
|
||||||
/***** Get info source for a specific type of course information
|
/***** Get info source for a specific type of course information
|
||||||
(bibliography, FAQ, links or evaluation) from database *****/
|
(bibliography, FAQ, links or evaluation) from database *****/
|
||||||
sprintf (Query,"SELECT InfoTxt FROM crs_info_txt"
|
sprintf (Query,"SELECT InfoTxtHTML FROM crs_info_txt"
|
||||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||||
CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get info text");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get info text");
|
||||||
|
@ -1555,16 +1578,16 @@ bool Inf_CheckIfInfoTxtIsNotEmpty (long CrsCod,Inf_InfoType_t InfoType)
|
||||||
/********************* Show information about the course *********************/
|
/********************* Show information about the course *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Inf_ShowTxtInfo (Inf_InfoType_t InfoType)
|
static void Inf_ShowPlainTxtInfo (Inf_InfoType_t InfoType)
|
||||||
{
|
{
|
||||||
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
|
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
|
||||||
extern const char *Txt_No_information_available;
|
extern const char *Txt_No_information_available;
|
||||||
char Txt[Cns_MAX_BYTES_LONG_TEXT+1];
|
char TxtHTML[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
|
||||||
/***** Get info text from database *****/
|
/***** Get info text from database *****/
|
||||||
Inf_GetInfoTxtFromDB (InfoType,Txt,Cns_MAX_BYTES_LONG_TEXT);
|
Inf_GetInfoTxtFromDB (InfoType,TxtHTML,NULL,Cns_MAX_BYTES_LONG_TEXT);
|
||||||
|
|
||||||
if (Txt[0])
|
if (TxtHTML[0])
|
||||||
{
|
{
|
||||||
/***** Start table *****/
|
/***** Start table *****/
|
||||||
Lay_StartRoundFrameTable10 (NULL,0,Txt_INFO_TITLE[InfoType]);
|
Lay_StartRoundFrameTable10 (NULL,0,Txt_INFO_TITLE[InfoType]);
|
||||||
|
@ -1572,17 +1595,18 @@ static void Inf_ShowTxtInfo (Inf_InfoType_t InfoType)
|
||||||
if (InfoType == Inf_INTRODUCTION ||
|
if (InfoType == Inf_INTRODUCTION ||
|
||||||
InfoType == Inf_TEACHING_GUIDE)
|
InfoType == Inf_TEACHING_GUIDE)
|
||||||
Lay_WriteHeaderClassPhoto (3,false,false,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentCrs.Crs.CrsCod);
|
Lay_WriteHeaderClassPhoto (3,false,false,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td style=\"text-align:left;\">"
|
"<td style=\"text-align:left;\">"
|
||||||
"<p class=\"DAT\" style=\"text-align:justify;\">");
|
"<p class=\"DAT\" style=\"text-align:justify;\">");
|
||||||
|
|
||||||
/***** Convert to respectful HTML and insert links *****/
|
/***** Convert to respectful HTML and insert links *****/
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Txt,Cns_MAX_BYTES_LONG_TEXT,false); // Convert from HTML to recpectful HTML
|
TxtHTML,Cns_MAX_BYTES_LONG_TEXT,false); // Convert from HTML to recpectful HTML
|
||||||
Str_InsertLinkInURLs (Txt,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
Str_InsertLinkInURLs (TxtHTML,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
||||||
|
|
||||||
/***** Write text *****/
|
/***** Write text *****/
|
||||||
fprintf (Gbl.F.Out,"%s",Txt);
|
fprintf (Gbl.F.Out,"%s",TxtHTML);
|
||||||
|
|
||||||
/***** Finish table *****/
|
/***** Finish table *****/
|
||||||
fprintf (Gbl.F.Out,"</p>"
|
fprintf (Gbl.F.Out,"</p>"
|
||||||
|
@ -1594,6 +1618,95 @@ static void Inf_ShowTxtInfo (Inf_InfoType_t InfoType)
|
||||||
Lay_ShowAlert (Lay_WARNING,Txt_No_information_available);
|
Lay_ShowAlert (Lay_WARNING,Txt_No_information_available);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************* Show information about the course *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Inf_ShowRichTxtInfo (Inf_InfoType_t InfoType)
|
||||||
|
{
|
||||||
|
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
|
||||||
|
extern const char *Txt_No_information_available;
|
||||||
|
char TxtHTML[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
char TxtMD[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
char PathFileMD[PATH_MAX+1];
|
||||||
|
char PathFileHTML[PATH_MAX+1];
|
||||||
|
FILE *FileMD; // Temporary Markdown file
|
||||||
|
FILE *FileHTML; // Temporary HTML file
|
||||||
|
char Command[512+PATH_MAX*2]; // Command to call the program of preprocessing of photos
|
||||||
|
int ReturnCode;
|
||||||
|
|
||||||
|
/***** Get info text from database *****/
|
||||||
|
Inf_GetInfoTxtFromDB (InfoType,TxtHTML,TxtMD,Cns_MAX_BYTES_LONG_TEXT);
|
||||||
|
|
||||||
|
// Lay_ShowAlert (Lay_INFO,TxtHTML);
|
||||||
|
// Lay_ShowAlert (Lay_INFO,TxtMD);
|
||||||
|
|
||||||
|
if (TxtMD[0])
|
||||||
|
{
|
||||||
|
/***** Start table *****/
|
||||||
|
Lay_StartRoundFrameTable10 (NULL,0,Txt_INFO_TITLE[InfoType]);
|
||||||
|
|
||||||
|
if (InfoType == Inf_INTRODUCTION ||
|
||||||
|
InfoType == Inf_TEACHING_GUIDE)
|
||||||
|
Lay_WriteHeaderClassPhoto (3,false,false,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
|
||||||
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
"<td style=\"text-align:left;\">"
|
||||||
|
"<div id=\"crs_info\">");
|
||||||
|
|
||||||
|
/***** Store text into a temporary .md file in HTML output directory *****/
|
||||||
|
// TODO: change to another directory?
|
||||||
|
/* Create a unique name for the .md file */
|
||||||
|
sprintf (PathFileMD,"%s/%s/%s.md",
|
||||||
|
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||||
|
sprintf (PathFileHTML,"%s/%s/%s.md.html", // Do not use only .html because that is the output temporary file
|
||||||
|
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||||
|
|
||||||
|
/* Open Markdown file for writing */
|
||||||
|
if ((FileMD = fopen (PathFileMD,"wb")) == NULL)
|
||||||
|
Lay_ShowErrorAndExit ("Can not create temporary Markdown file.");
|
||||||
|
|
||||||
|
/* Write text into Markdown file */
|
||||||
|
fprintf (FileMD,"%s",TxtMD);
|
||||||
|
|
||||||
|
/* Close Markdown file */
|
||||||
|
fclose (FileMD);
|
||||||
|
|
||||||
|
/***** Convert from Markdown to HTML *****/
|
||||||
|
sprintf (Command,"iconv -f ISO-8859-1 -t UTF-8 %s"
|
||||||
|
" | pandoc --mathjax -f markdown -t html"
|
||||||
|
" | iconv -f UTF-8 -t ISO-8859-1 -o %s",
|
||||||
|
PathFileMD,
|
||||||
|
PathFileHTML);
|
||||||
|
ReturnCode = system (Command);
|
||||||
|
if (ReturnCode == -1)
|
||||||
|
Lay_ShowErrorAndExit ("Error when running command to convert from Markdown to HTML.");
|
||||||
|
|
||||||
|
/***** Remove Markdown file *****/
|
||||||
|
unlink (PathFileMD);
|
||||||
|
|
||||||
|
/***** Copy HTML file just created to HTML output *****/
|
||||||
|
/* Open temporary HTML file for reading */
|
||||||
|
if ((FileHTML = fopen (PathFileHTML,"rb")) == NULL)
|
||||||
|
Lay_ShowErrorAndExit ("Can not open temporary Markdown file.");
|
||||||
|
|
||||||
|
/* Copy from temporary HTML file to output file */
|
||||||
|
Fil_FastCopyOfOpenFiles (FileHTML,Gbl.F.Out);
|
||||||
|
|
||||||
|
/* Close and remove temporary HTML file */
|
||||||
|
fclose (FileHTML);
|
||||||
|
unlink (PathFileHTML);
|
||||||
|
|
||||||
|
/***** Finish table *****/
|
||||||
|
fprintf (Gbl.F.Out,"</div>"
|
||||||
|
"</td>"
|
||||||
|
"</tr>");
|
||||||
|
Lay_EndRoundFrameTable10 ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Lay_ShowAlert (Lay_WARNING,Txt_No_information_available);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************* Check if exists and write page into HTML buffer ***************/
|
/************* Check if exists and write page into HTML buffer ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1603,7 +1716,7 @@ int Inf_WritePlainTextIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer)
|
||||||
{
|
{
|
||||||
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
||||||
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
|
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
|
||||||
char Txt[Cns_MAX_BYTES_LONG_TEXT+1];
|
char TxtHTML[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
char FileNameHTMLTmp[PATH_MAX+1];
|
char FileNameHTMLTmp[PATH_MAX+1];
|
||||||
FILE *FileHTMLTmp;
|
FILE *FileHTMLTmp;
|
||||||
size_t Length;
|
size_t Length;
|
||||||
|
@ -1612,9 +1725,9 @@ int Inf_WritePlainTextIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer)
|
||||||
*HTMLBuffer = NULL;
|
*HTMLBuffer = NULL;
|
||||||
|
|
||||||
/***** Get info text from database *****/
|
/***** Get info text from database *****/
|
||||||
Inf_GetInfoTxtFromDB (InfoType,Txt,Cns_MAX_BYTES_LONG_TEXT);
|
Inf_GetInfoTxtFromDB (InfoType,TxtHTML,NULL,Cns_MAX_BYTES_LONG_TEXT);
|
||||||
|
|
||||||
if (Txt[0])
|
if (TxtHTML[0])
|
||||||
{
|
{
|
||||||
/***** Create a unique name for the file *****/
|
/***** Create a unique name for the file *****/
|
||||||
sprintf (FileNameHTMLTmp,"%s/%s/%s_info.html",
|
sprintf (FileNameHTMLTmp,"%s/%s/%s_info.html",
|
||||||
|
@ -1644,11 +1757,11 @@ int Inf_WritePlainTextIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer)
|
||||||
|
|
||||||
/* Convert to respectful HTML and insert links */
|
/* Convert to respectful HTML and insert links */
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Txt,Cns_MAX_BYTES_LONG_TEXT,false); // Convert from HTML to recpectful HTML
|
TxtHTML,Cns_MAX_BYTES_LONG_TEXT,false); // Convert from HTML to recpectful HTML
|
||||||
Str_InsertLinkInURLs (Txt,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
Str_InsertLinkInURLs (TxtHTML,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
||||||
|
|
||||||
/* Write text */
|
/* Write text */
|
||||||
fprintf (FileHTMLTmp,"%s",Txt);
|
fprintf (FileHTMLTmp,"%s",TxtHTML);
|
||||||
|
|
||||||
/***** Write end of page into file *****/
|
/***** Write end of page into file *****/
|
||||||
fprintf (FileHTMLTmp,"</p>\n"
|
fprintf (FileHTMLTmp,"</p>\n"
|
||||||
|
@ -1697,7 +1810,7 @@ void Inf_EditPlainTxtInfo (void)
|
||||||
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
|
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
|
||||||
extern const char *Txt_Save;
|
extern const char *Txt_Save;
|
||||||
Inf_InfoType_t InfoType = Inf_AsignInfoType ();
|
Inf_InfoType_t InfoType = Inf_AsignInfoType ();
|
||||||
char Txt[Cns_MAX_BYTES_LONG_TEXT+1];
|
char TxtHTML[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
|
||||||
/***** Start table *****/
|
/***** Start table *****/
|
||||||
Act_FormStart (Inf_ActionsRcvPlaTxtInfo[InfoType]);
|
Act_FormStart (Inf_ActionsRcvPlaTxtInfo[InfoType]);
|
||||||
|
@ -1708,7 +1821,7 @@ void Inf_EditPlainTxtInfo (void)
|
||||||
Lay_WriteHeaderClassPhoto (1,false,false,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentCrs.Crs.CrsCod);
|
Lay_WriteHeaderClassPhoto (1,false,false,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
|
||||||
/***** Get info text from database *****/
|
/***** Get info text from database *****/
|
||||||
Inf_GetInfoTxtFromDB (InfoType,Txt,Cns_MAX_BYTES_LONG_TEXT);
|
Inf_GetInfoTxtFromDB (InfoType,TxtHTML,NULL,Cns_MAX_BYTES_LONG_TEXT);
|
||||||
|
|
||||||
/***** Edition area *****/
|
/***** Edition area *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -1718,11 +1831,10 @@ void Inf_EditPlainTxtInfo (void)
|
||||||
"</textarea>"
|
"</textarea>"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt);
|
TxtHTML);
|
||||||
|
|
||||||
/***** End of table *****/
|
/***** End of table *****/
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
// fprintf (Gbl.F.Out,"<br />");
|
|
||||||
|
|
||||||
/***** Send and undo buttons *****/
|
/***** Send and undo buttons *****/
|
||||||
Lay_PutConfirmButton (Txt_Save);
|
Lay_PutConfirmButton (Txt_Save);
|
||||||
|
@ -1736,21 +1848,12 @@ void Inf_EditPlainTxtInfo (void)
|
||||||
void Inf_EditRichTxtInfo (void)
|
void Inf_EditRichTxtInfo (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_rich_text_editor_is_not_yet_available;
|
extern const char *Txt_The_rich_text_editor_is_not_yet_available;
|
||||||
extern const char *Txt_Send;
|
extern const char *Txt_Save;
|
||||||
Inf_InfoType_t InfoType = Inf_AsignInfoType ();
|
Inf_InfoType_t InfoType = Inf_AsignInfoType ();
|
||||||
char Txt[Cns_MAX_BYTES_LONG_TEXT+1];
|
char TxtHTML[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
|
||||||
/***** Under test... *****/
|
/***** Under test... *****/
|
||||||
/*
|
if (Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM) // TODO: Remove this when rich text editor is available
|
||||||
+--------+----------+---------------------+
|
|
||||||
| UsrCod | UsrID | CreatTime |
|
|
||||||
+--------+----------+---------------------+
|
|
||||||
| 1346 | 24243619 | 2013-11-25 00:29:13 |
|
|
||||||
| 24383 | 53590723 | 2013-11-25 00:29:13 |
|
|
||||||
+--------+----------+---------------------+
|
|
||||||
*/
|
|
||||||
if (Gbl.Usrs.Me.UsrDat.UsrCod != 1346 &&
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod != 24383) // TODO: Remove this when rich text editor is available
|
|
||||||
{
|
{
|
||||||
Lay_ShowAlert (Lay_WARNING,Txt_The_rich_text_editor_is_not_yet_available);
|
Lay_ShowAlert (Lay_WARNING,Txt_The_rich_text_editor_is_not_yet_available);
|
||||||
|
|
||||||
|
@ -1768,7 +1871,7 @@ void Inf_EditRichTxtInfo (void)
|
||||||
Lay_WriteHeaderClassPhoto (1,false,false,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentCrs.Crs.CrsCod);
|
Lay_WriteHeaderClassPhoto (1,false,false,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
|
||||||
/***** Get info text from database *****/
|
/***** Get info text from database *****/
|
||||||
Inf_GetInfoTxtFromDB (InfoType,Txt,Cns_MAX_BYTES_LONG_TEXT);
|
Inf_GetInfoTxtFromDB (InfoType,TxtHTML,NULL,Cns_MAX_BYTES_LONG_TEXT);
|
||||||
|
|
||||||
/***** Edition area *****/
|
/***** Edition area *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -1778,14 +1881,13 @@ void Inf_EditRichTxtInfo (void)
|
||||||
"</textarea>"
|
"</textarea>"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt);
|
TxtHTML);
|
||||||
|
|
||||||
/***** End of table *****/
|
/***** End of table *****/
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
// fprintf (Gbl.F.Out,"<br />");
|
|
||||||
|
|
||||||
/***** Send and undo buttons *****/
|
/***** Send and undo buttons *****/
|
||||||
Lay_PutCreateButton (Txt_Send);
|
Lay_PutConfirmButton (Txt_Save);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1796,19 +1898,26 @@ void Inf_EditRichTxtInfo (void)
|
||||||
void Inf_RecAndChangePlainTxtInfo (void)
|
void Inf_RecAndChangePlainTxtInfo (void)
|
||||||
{
|
{
|
||||||
Inf_InfoType_t InfoType = Inf_AsignInfoType ();
|
Inf_InfoType_t InfoType = Inf_AsignInfoType ();
|
||||||
char Txt[Cns_MAX_BYTES_LONG_TEXT+1];
|
char Txt_HTMLFormat[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
char Txt_MarkdownFormat[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
|
||||||
/***** Get text with course information from form *****/
|
/***** Get text with course information from form *****/
|
||||||
Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_LONG_TEXT); // Store in HTML format (not rigorous)
|
Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT);
|
||||||
|
strcpy (Txt_MarkdownFormat,Txt_HTMLFormat);
|
||||||
|
Str_ChangeFormat (Str_FROM_FORM,Str_TO_HTML,
|
||||||
|
Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT,true); // Store in HTML format (not rigorous)
|
||||||
|
Str_ChangeFormat (Str_FROM_FORM,Str_TO_MARKDOWN,
|
||||||
|
Txt_MarkdownFormat,Cns_MAX_BYTES_LONG_TEXT,true); // Store a copy in Markdown format
|
||||||
|
|
||||||
/***** Update text of course info in database *****/
|
/***** Update text of course info in database *****/
|
||||||
Inf_SetInfoTxtIntoDB (Gbl.CurrentCrs.Crs.CrsCod,InfoType,Txt);
|
Inf_SetInfoTxtIntoDB (Gbl.CurrentCrs.Crs.CrsCod,InfoType,
|
||||||
|
Txt_HTMLFormat,Txt_MarkdownFormat);
|
||||||
|
|
||||||
/***** Change info source to text in database *****/
|
/***** Change info source to "plain text" in database *****/
|
||||||
Inf_SetInfoSrcIntoDB (Gbl.CurrentCrs.Crs.CrsCod,InfoType,
|
Inf_SetInfoSrcIntoDB (Gbl.CurrentCrs.Crs.CrsCod,InfoType,
|
||||||
Txt[0] ? Inf_INFO_SRC_PLAIN_TEXT :
|
Txt_HTMLFormat[0] ? Inf_INFO_SRC_PLAIN_TEXT :
|
||||||
Inf_INFO_SRC_NONE);
|
Inf_INFO_SRC_NONE);
|
||||||
if (Txt[0])
|
if (Txt_HTMLFormat[0])
|
||||||
/***** Show the updated info *****/
|
/***** Show the updated info *****/
|
||||||
Inf_ShowInfo ();
|
Inf_ShowInfo ();
|
||||||
else
|
else
|
||||||
|
@ -1823,19 +1932,26 @@ void Inf_RecAndChangePlainTxtInfo (void)
|
||||||
void Inf_RecAndChangeRichTxtInfo (void)
|
void Inf_RecAndChangeRichTxtInfo (void)
|
||||||
{
|
{
|
||||||
Inf_InfoType_t InfoType = Inf_AsignInfoType ();
|
Inf_InfoType_t InfoType = Inf_AsignInfoType ();
|
||||||
char Txt[Cns_MAX_BYTES_LONG_TEXT+1];
|
char Txt_HTMLFormat[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
char Txt_MarkdownFormat[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
|
||||||
/***** Get text with course information from form *****/
|
/***** Get text with course information from form *****/
|
||||||
Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_LONG_TEXT); // Store in HTML format (not rigorous)
|
Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT);
|
||||||
|
strcpy (Txt_MarkdownFormat,Txt_HTMLFormat);
|
||||||
|
Str_ChangeFormat (Str_FROM_FORM,Str_TO_HTML,
|
||||||
|
Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT,true); // Store in HTML format (not rigorous)
|
||||||
|
Str_ChangeFormat (Str_FROM_FORM,Str_TO_MARKDOWN,
|
||||||
|
Txt_MarkdownFormat,Cns_MAX_BYTES_LONG_TEXT,true); // Store a copy in Markdown format
|
||||||
|
|
||||||
/***** Update text of course info in database *****/
|
/***** Update text of course info in database *****/
|
||||||
Inf_SetInfoTxtIntoDB (Gbl.CurrentCrs.Crs.CrsCod,InfoType,Txt);
|
Inf_SetInfoTxtIntoDB (Gbl.CurrentCrs.Crs.CrsCod,InfoType,
|
||||||
|
Txt_HTMLFormat,Txt_MarkdownFormat);
|
||||||
|
|
||||||
/***** Change info source to text in database *****/
|
/***** Change info source to "rich text" in database *****/
|
||||||
Inf_SetInfoSrcIntoDB (Gbl.CurrentCrs.Crs.CrsCod,InfoType,
|
Inf_SetInfoSrcIntoDB (Gbl.CurrentCrs.Crs.CrsCod,InfoType,
|
||||||
Txt[0] ? Inf_INFO_SRC_RICH_TEXT :
|
Txt_HTMLFormat[0] ? Inf_INFO_SRC_RICH_TEXT :
|
||||||
Inf_INFO_SRC_NONE);
|
Inf_INFO_SRC_NONE);
|
||||||
if (Txt[0])
|
if (Txt_HTMLFormat[0])
|
||||||
/***** Show the updated info *****/
|
/***** Show the updated info *****/
|
||||||
Inf_ShowInfo ();
|
Inf_ShowInfo ();
|
||||||
else
|
else
|
||||||
|
|
|
@ -88,8 +88,10 @@ void Inf_SetInfoSrcIntoDB (long CrsCod,Inf_InfoType_t InfoType,Inf_InfoSrc_t Inf
|
||||||
void Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType,Inf_InfoSrc_t *InfoSrc,bool *MustBeRead);
|
void Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType,Inf_InfoSrc_t *InfoSrc,bool *MustBeRead);
|
||||||
Inf_InfoType_t Inf_ConvertFromStrDBToInfoType (const char *StrInfoTypeDB);
|
Inf_InfoType_t Inf_ConvertFromStrDBToInfoType (const char *StrInfoTypeDB);
|
||||||
Inf_InfoSrc_t Inf_ConvertFromStrDBToInfoSrc (const char *StrInfoSrcDB);
|
Inf_InfoSrc_t Inf_ConvertFromStrDBToInfoSrc (const char *StrInfoSrcDB);
|
||||||
void Inf_SetInfoTxtIntoDB (long CrsCod,Inf_InfoType_t InfoType,const char *InfoTxt);
|
void Inf_SetInfoTxtIntoDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||||
void Inf_GetInfoTxtFromDB (Inf_InfoType_t InfoType,char *InfoTxt,size_t MaxLength);
|
const char *InfoTxtHTML,const char *InfoTxtMD);
|
||||||
|
void Inf_GetInfoTxtFromDB (Inf_InfoType_t InfoType,
|
||||||
|
char *InfoTxtHTML,char *InfoTxtMD,size_t MaxLength);
|
||||||
bool Inf_CheckIfInfoTxtIsNotEmpty (long CrsCod,Inf_InfoType_t InfoType);
|
bool Inf_CheckIfInfoTxtIsNotEmpty (long CrsCod,Inf_InfoType_t InfoType);
|
||||||
int Inf_WritePlainTextIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer);
|
int Inf_WritePlainTextIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer);
|
||||||
void Inf_EditPlainTxtInfo (void);
|
void Inf_EditPlainTxtInfo (void);
|
||||||
|
|
|
@ -103,7 +103,7 @@ void Ins_SeeInsWithPendingCtrs (void)
|
||||||
/***** Get institutions with pending centres *****/
|
/***** Get institutions with pending centres *****/
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_INS_ADM:
|
case Rol_INS_ADM:
|
||||||
sprintf (Query,"SELECT centres.InsCod,COUNT(*)"
|
sprintf (Query,"SELECT centres.InsCod,COUNT(*)"
|
||||||
" FROM centres,ins_admin,institutions"
|
" FROM centres,ins_admin,institutions"
|
||||||
" WHERE (centres.Status & %u)<>0"
|
" WHERE (centres.Status & %u)<>0"
|
||||||
|
@ -112,7 +112,7 @@ void Ins_SeeInsWithPendingCtrs (void)
|
||||||
" GROUP BY centres.InsCod ORDER BY institutions.ShortName",
|
" GROUP BY centres.InsCod ORDER BY institutions.ShortName",
|
||||||
(unsigned) Ctr_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod);
|
(unsigned) Ctr_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
sprintf (Query,"SELECT centres.InsCod,COUNT(*)"
|
sprintf (Query,"SELECT centres.InsCod,COUNT(*)"
|
||||||
" FROM centres,institutions"
|
" FROM centres,institutions"
|
||||||
" WHERE (centres.Status & %u)<>0"
|
" WHERE (centres.Status & %u)<>0"
|
||||||
|
@ -254,7 +254,7 @@ static void Ins_Configuration (bool PrintView)
|
||||||
Act_PutContextualLink (ActPrnInsInf,NULL,"print",Txt_Print);
|
Act_PutContextualLink (ActPrnInsInf,NULL,"print",Txt_Print);
|
||||||
|
|
||||||
/* Link to upload logo */
|
/* Link to upload logo */
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
|
||||||
Log_PutFormToChangeLogo (Sco_SCOPE_INS);
|
Log_PutFormToChangeLogo (Sco_SCOPE_INS);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
@ -447,8 +447,8 @@ static void Ins_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN],
|
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||||
Usr_GetNumUsrsInCrssOfIns (Rol_ROLE_TEACHER,Gbl.CurrentIns.Ins.InsCod));
|
Usr_GetNumUsrsInCrssOfIns (Rol_TEACHER,Gbl.CurrentIns.Ins.InsCod));
|
||||||
|
|
||||||
/***** Number of students *****/
|
/***** Number of students *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -462,8 +462,8 @@ static void Ins_Configuration (bool PrintView)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme],
|
The_ClassFormul[Gbl.Prefs.Theme],
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],
|
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||||
Usr_GetNumUsrsInCrssOfIns (Rol_ROLE_STUDENT,Gbl.CurrentIns.Ins.InsCod));
|
Usr_GetNumUsrsInCrssOfIns (Rol_STUDENT,Gbl.CurrentIns.Ins.InsCod));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End of the frame *****/
|
/***** End of the frame *****/
|
||||||
|
@ -489,7 +489,7 @@ void Ins_ShowInssOfCurrentCty (void)
|
||||||
Deg_WriteMenuAllCourses (ActSeeIns,ActUnk,ActUnk,ActUnk);
|
Deg_WriteMenuAllCourses (ActSeeIns,ActUnk,ActUnk,ActUnk);
|
||||||
|
|
||||||
/***** Put link (form) to edit institutions *****/
|
/***** Put link (form) to edit institutions *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_)
|
||||||
Lay_PutFormToEdit (ActEdiIns);
|
Lay_PutFormToEdit (ActEdiIns);
|
||||||
|
|
||||||
/***** List institutions *****/
|
/***** List institutions *****/
|
||||||
|
@ -862,8 +862,8 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
||||||
{
|
{
|
||||||
if (Ins->NumUsrs)
|
if (Ins->NumUsrs)
|
||||||
{
|
{
|
||||||
Ins->NumStds = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_ROLE_STUDENT); // Slow query
|
Ins->NumStds = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_STUDENT); // Slow query
|
||||||
Ins->NumTchs = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_ROLE_TEACHER); // Slow query
|
Ins->NumTchs = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_TEACHER); // Slow query
|
||||||
Ins->NumUsrs = Ins->NumStds + Ins->NumTchs;
|
Ins->NumUsrs = Ins->NumStds + Ins->NumTchs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -953,8 +953,8 @@ bool Ins_GetDataOfInstitutionByCod (struct Institution *Ins,
|
||||||
if (GetExtraData == Ins_GET_EXTRA_DATA)
|
if (GetExtraData == Ins_GET_EXTRA_DATA)
|
||||||
{
|
{
|
||||||
/* Get number of users in this institution */
|
/* Get number of users in this institution */
|
||||||
Ins->NumStds = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_ROLE_STUDENT); // Slow query
|
Ins->NumStds = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_STUDENT); // Slow query
|
||||||
Ins->NumTchs = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_ROLE_TEACHER); // Slow query
|
Ins->NumTchs = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_TEACHER); // Slow query
|
||||||
Ins->NumUsrs = Ins->NumStds + Ins->NumTchs;
|
Ins->NumUsrs = Ins->NumStds + Ins->NumTchs;
|
||||||
|
|
||||||
/* Get number of centres in this institution */
|
/* Get number of centres in this institution */
|
||||||
|
@ -1152,7 +1152,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
||||||
/* Country */
|
/* Country */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
||||||
" vertical-align:middle;\">");
|
" vertical-align:middle;\">");
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
Act_FormStart (ActChgInsCty);
|
Act_FormStart (ActChgInsCty);
|
||||||
Ins_PutParamOtherInsCod (Ins->InsCod);
|
Ins_PutParamOtherInsCod (Ins->InsCod);
|
||||||
|
@ -1256,7 +1256,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
||||||
StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status);
|
StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status);
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
||||||
" vertical-align:middle;\">");
|
" vertical-align:middle;\">");
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM &&
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM &&
|
||||||
StatusTxt == Ins_STATUS_PENDING)
|
StatusTxt == Ins_STATUS_PENDING)
|
||||||
{
|
{
|
||||||
Act_FormStart (ActChgInsSta);
|
Act_FormStart (ActChgInsSta);
|
||||||
|
@ -1306,7 +1306,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
||||||
|
|
||||||
static bool Ins_CheckIfICanEdit (struct Institution *Ins)
|
static bool Ins_CheckIfICanEdit (struct Institution *Ins)
|
||||||
{
|
{
|
||||||
return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || // I am a superuser
|
return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || // I am a superuser
|
||||||
((Ins->Status & Ins_STATUS_BIT_PENDING) != 0 && // Institution is not yet activated
|
((Ins->Status & Ins_STATUS_BIT_PENDING) != 0 && // Institution is not yet activated
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod == Ins->RequesterUsrCod)); // I am the requester
|
Gbl.Usrs.Me.UsrDat.UsrCod == Ins->RequesterUsrCod)); // I am the requester
|
||||||
}
|
}
|
||||||
|
@ -1758,9 +1758,9 @@ static void Ins_PutFormToCreateInstitution (void)
|
||||||
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES);
|
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES);
|
||||||
|
|
||||||
/***** Start form *****/
|
/***** Start form *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Act_FormStart (ActNewIns);
|
Act_FormStart (ActNewIns);
|
||||||
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__)
|
else if (Gbl.Usrs.Me.MaxRole >= Rol__GUEST_)
|
||||||
Act_FormStart (ActReqIns);
|
Act_FormStart (ActReqIns);
|
||||||
else
|
else
|
||||||
Lay_ShowErrorAndExit ("You can not edit institutions.");
|
Lay_ShowErrorAndExit ("You can not edit institutions.");
|
||||||
|
|
|
@ -444,6 +444,12 @@ static void Lay_WriteScripts (void)
|
||||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\" src=\"%s/swad.js\">"
|
fprintf (Gbl.F.Out,"<script type=\"text/javascript\" src=\"%s/swad.js\">"
|
||||||
"</script>\n",
|
"</script>\n",
|
||||||
Cfg_HTTPS_URL_SWAD_PUBLIC);
|
Cfg_HTTPS_URL_SWAD_PUBLIC);
|
||||||
|
|
||||||
|
/***** Script for MathJax *****/
|
||||||
|
fprintf (Gbl.F.Out,"<script type=\"text/javascript\""
|
||||||
|
" src=\"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML\">"
|
||||||
|
"</script>\n");
|
||||||
|
|
||||||
if (Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW)
|
if (Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW)
|
||||||
{
|
{
|
||||||
Lay_WriteScriptInit ();
|
Lay_WriteScriptInit ();
|
||||||
|
|
|
@ -80,7 +80,7 @@ void Lnk_SeeLinks (void)
|
||||||
Lnk_GetListLinks ();
|
Lnk_GetListLinks ();
|
||||||
|
|
||||||
/***** Put link (form) to edit links *****/
|
/***** Put link (form) to edit links *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Lnk_PutFormToEditLinks ();
|
Lnk_PutFormToEditLinks ();
|
||||||
|
|
||||||
/***** Table head *****/
|
/***** Table head *****/
|
||||||
|
|
|
@ -97,7 +97,7 @@ void Mai_SeeMailDomains (void)
|
||||||
Mai_GetListMailDomainsAllowedForNotif ();
|
Mai_GetListMailDomainsAllowedForNotif ();
|
||||||
|
|
||||||
/***** Put link (form) to edit mail domains *****/
|
/***** Put link (form) to edit mail domains *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Mai_PutFormToEditMailDomains ();
|
Mai_PutFormToEditMailDomains ();
|
||||||
|
|
||||||
/***** Table head *****/
|
/***** Table head *****/
|
||||||
|
|
|
@ -620,7 +620,7 @@ void Mrk_ShowMyMarks (void)
|
||||||
|
|
||||||
|
|
||||||
/***** Set the student whose marks will be shown *****/
|
/***** Set the student whose marks will be shown *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT) // If I am logged as student...
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) // If I am logged as student...
|
||||||
UsrDat = &Gbl.Usrs.Me.UsrDat; // ...use my list of IDs
|
UsrDat = &Gbl.Usrs.Me.UsrDat; // ...use my list of IDs
|
||||||
else // If I am logged as teacher, administrator, superuser...
|
else // If I am logged as teacher, administrator, superuser...
|
||||||
{
|
{
|
||||||
|
@ -635,7 +635,7 @@ void Mrk_ShowMyMarks (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UsrIsOK = false;
|
UsrIsOK = false;
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_STUDENT);
|
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Course zone
|
else // Course zone
|
||||||
|
@ -648,7 +648,7 @@ void Mrk_ShowMyMarks (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UsrIsOK = false;
|
UsrIsOK = false;
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_STUDENT);
|
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ void Msg_ListEMails (void)
|
||||||
Grp_ShowFormToSelectSeveralGroups (ActMaiStd);
|
Grp_ShowFormToSelectSeveralGroups (ActMaiStd);
|
||||||
|
|
||||||
/***** Get and order list of students in this course *****/
|
/***** Get and order list of students in this course *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstStds.NumUsrs)
|
if (Gbl.Usrs.LstStds.NumUsrs)
|
||||||
{
|
{
|
||||||
|
@ -228,7 +228,7 @@ void Msg_ListEMails (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_STUDENT);
|
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
|
||||||
|
|
||||||
/***** Free memory for students list *****/
|
/***** Free memory for students list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
||||||
|
@ -277,7 +277,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
|
||||||
|
|
||||||
/***** Get list of users belonging to the current course *****/
|
/***** Get list of users belonging to the current course *****/
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
/***** Get and update type of list, number of columns in class photo
|
/***** Get and update type of list, number of columns in class photo
|
||||||
and preference about view photos *****/
|
and preference about view photos *****/
|
||||||
|
@ -290,8 +290,8 @@ static void Msg_PutFormMsgUsrs (const char *Content)
|
||||||
Usr_ShowFormsToSelectUsrListType (ActReqMsgUsr);
|
Usr_ShowFormsToSelectUsrListType (ActReqMsgUsr);
|
||||||
|
|
||||||
/***** Get and order lists of users from this course *****/
|
/***** Get and order lists of users from this course *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstTchs.NumUsrs ||
|
if (Gbl.Usrs.LstTchs.NumUsrs ||
|
||||||
Gbl.Usrs.LstStds.NumUsrs)
|
Gbl.Usrs.LstStds.NumUsrs)
|
||||||
|
@ -323,8 +323,8 @@ static void Msg_PutFormMsgUsrs (const char *Content)
|
||||||
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
||||||
|
|
||||||
/* Draw two lists of users with the recipients: one with the teachers of the course and another one with the students */
|
/* Draw two lists of users with the recipients: one with the teachers of the course and another one with the students */
|
||||||
Usr_ListUsersToSelect (Rol_ROLE_TEACHER);
|
Usr_ListUsersToSelect (Rol_TEACHER);
|
||||||
Usr_ListUsersToSelect (Rol_ROLE_STUDENT);
|
Usr_ListUsersToSelect (Rol_STUDENT);
|
||||||
|
|
||||||
/* Other users (nicknames) */
|
/* Other users (nicknames) */
|
||||||
Msg_WriteFormUsrsIDsOrNicksOtherRecipients (Gbl.Msg.IsReply);
|
Msg_WriteFormUsrsIDsOrNicksOtherRecipients (Gbl.Msg.IsReply);
|
||||||
|
@ -376,7 +376,7 @@ void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (bool IsReply)
|
||||||
" background-color:%s;\"",
|
" background-color:%s;\"",
|
||||||
VERY_LIGHT_BLUE);
|
VERY_LIGHT_BLUE);
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
fprintf (Gbl.F.Out," colspan=\"%u\">%s:",
|
fprintf (Gbl.F.Out," colspan=\"%u\">%s:",
|
||||||
Colspan,Txt_Other_recipients);
|
Colspan,Txt_Other_recipients);
|
||||||
else
|
else
|
||||||
|
@ -389,7 +389,7 @@ void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (bool IsReply)
|
||||||
"<td",
|
"<td",
|
||||||
Txt_nicks_emails_or_IDs_separated_by_commas);
|
Txt_nicks_emails_or_IDs_separated_by_commas);
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
fprintf (Gbl.F.Out," colspan=\"%u\"",Colspan);
|
fprintf (Gbl.F.Out," colspan=\"%u\"",Colspan);
|
||||||
fprintf (Gbl.F.Out," style=\"text-align:left;\">"
|
fprintf (Gbl.F.Out," style=\"text-align:left;\">"
|
||||||
"<textarea name=\"OtherRecipients\" cols=\"72\" rows=\"2\">");
|
"<textarea name=\"OtherRecipients\" cols=\"72\" rows=\"2\">");
|
||||||
|
@ -583,7 +583,7 @@ void Msg_RecMsgFromUsr (void)
|
||||||
/***** If there are no recipients... *****/
|
/***** If there are no recipients... *****/
|
||||||
if ((NumRecipients = Usr_CountNumUsrsInEncryptedList ()))
|
if ((NumRecipients = Usr_CountNumUsrsInEncryptedList ()))
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT &&
|
||||||
NumRecipients > Cfg_MAX_RECIPIENTS)
|
NumRecipients > Cfg_MAX_RECIPIENTS)
|
||||||
{
|
{
|
||||||
/* Write warning message */
|
/* Write warning message */
|
||||||
|
@ -1792,7 +1792,7 @@ unsigned Msg_GetNumMsgsSentByTchsCrs (long CrsCod)
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM msg_snt,crs_usr"
|
sprintf (Query,"SELECT COUNT(*) FROM msg_snt,crs_usr"
|
||||||
" WHERE msg_snt.CrsCod='%ld' AND crs_usr.CrsCod='%ld' AND crs_usr.Role='%u'"
|
" WHERE msg_snt.CrsCod='%ld' AND crs_usr.CrsCod='%ld' AND crs_usr.Role='%u'"
|
||||||
" AND msg_snt.UsrCod=crs_usr.UsrCod",
|
" AND msg_snt.UsrCod=crs_usr.UsrCod",
|
||||||
CrsCod,CrsCod,(unsigned) Rol_ROLE_TEACHER);
|
CrsCod,CrsCod,(unsigned) Rol_TEACHER);
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of messages sent by teachers");
|
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of messages sent by teachers");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2662,7 +2662,7 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td style=\"text-align:left;\">");
|
"<td style=\"text-align:left;\">");
|
||||||
if (TypeOfMessages == Msg_MESSAGES_RECEIVED &&
|
if (TypeOfMessages == Msg_MESSAGES_RECEIVED &&
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_VISITOR)
|
Gbl.Usrs.Me.LoggedRole >= Rol_VISITOR)
|
||||||
// Guests (users without courses) can read messages but not reply them
|
// Guests (users without courses) can read messages but not reply them
|
||||||
Msg_WriteFormToReply (MsgCod,CrsCod,Subject,FromThisCrs,Replied,
|
Msg_WriteFormToReply (MsgCod,CrsCod,Subject,FromThisCrs,Replied,
|
||||||
UsrDat.EncryptedUsrCod);
|
UsrDat.EncryptedUsrCod);
|
||||||
|
@ -3030,7 +3030,7 @@ static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf (Gbl.F.Out,"[%s]",
|
fprintf (Gbl.F.Out,"[%s]",
|
||||||
Txt_ROLES_SINGUL_abc[Rol_ROLE_UNKNOWN][Usr_SEX_UNKNOWN]); // User not found, likely an old user who has been removed
|
Txt_ROLES_SINGUL_abc[Rol_UNKNOWN][Usr_SEX_UNKNOWN]); // User not found, likely an old user who has been removed
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>"
|
"</tr>"
|
||||||
"</table>");
|
"</table>");
|
||||||
|
|
|
@ -359,7 +359,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
|
|
||||||
/***** Get total number of users in platform *****/
|
/***** Get total number of users in platform *****/
|
||||||
NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsers (Gbl.Scope.Current,Rol_ROLE_UNKNOWN);
|
NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsers (Gbl.Scope.Current,Rol_UNKNOWN);
|
||||||
|
|
||||||
/***** Get number of users with a web / social network *****/
|
/***** Get number of users with a web / social network *****/
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
|
|
|
@ -312,8 +312,8 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
|
||||||
{
|
{
|
||||||
ICanEditNotices = (
|
ICanEditNotices = (
|
||||||
TypeNoticesListing == Not_LIST_FULL_NOTICES &&
|
TypeNoticesListing == Not_LIST_FULL_NOTICES &&
|
||||||
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
|
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1082,7 +1082,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||||
" AND Role='%u'", // Notify teachers only
|
" AND Role='%u'", // Notify teachers only
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER);
|
(unsigned) Rol_TEACHER);
|
||||||
else // Course without teachers
|
else // Course without teachers
|
||||||
// If this course has no teachers
|
// If this course has no teachers
|
||||||
// and I want to be a teacher (checked before calling this function
|
// and I want to be a teacher (checked before calling this function
|
||||||
|
@ -1113,7 +1113,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||||
" WHERE CrsCod='%ld' AND Role='%u' AND UsrCod<>'%ld'",
|
" WHERE CrsCod='%ld' AND Role='%u' AND UsrCod<>'%ld'",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
(unsigned) Rol_ROLE_TEACHER,
|
(unsigned) Rol_TEACHER,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -48,12 +48,6 @@ extern struct Globals Gbl;
|
||||||
/*********************** Private types and constants *************************/
|
/*********************** Private types and constants *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
Par_PARAM_SINGLE,
|
|
||||||
Par_PARAM_MULTIPLE,
|
|
||||||
} tParamType; // Parameter is present only one time / multiple times
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Private variables ****************************/
|
/****************************** Private variables ****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -62,9 +56,6 @@ typedef enum
|
||||||
/***************************** Private prototypes ****************************/
|
/***************************** Private prototypes ****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
|
|
||||||
char *ParamValue,size_t MaxBytes);
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Read all parameters passed to this CGI and store for later processing ***/
|
/*** Read all parameters passed to this CGI and store for later processing ***/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -419,8 +410,8 @@ unsigned Par_GetParAndChangeFormat (const char *ParamName,char *ParamValue,size_
|
||||||
#define Par_LENGTH_OF_STR_BEFORE_PARAM 38 // Length of "CONTENT-DISPOSITION: FORM-DATA; NAME=\""
|
#define Par_LENGTH_OF_STR_BEFORE_PARAM 38 // Length of "CONTENT-DISPOSITION: FORM-DATA; NAME=\""
|
||||||
#define Par_MAX_BYTES_STR_AUX 1024
|
#define Par_MAX_BYTES_STR_AUX 1024
|
||||||
|
|
||||||
static unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
|
unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
|
||||||
char *ParamValue,size_t MaxBytes)
|
char *ParamValue,size_t MaxBytes)
|
||||||
{
|
{
|
||||||
static const char *StringBeforeParam = "CONTENT-DISPOSITION: FORM-DATA; NAME=\"";
|
static const char *StringBeforeParam = "CONTENT-DISPOSITION: FORM-DATA; NAME=\"";
|
||||||
size_t BytesToCopy;
|
size_t BytesToCopy;
|
||||||
|
|
|
@ -35,6 +35,12 @@
|
||||||
/************************** Public types and constants ***********************/
|
/************************** Public types and constants ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
Par_PARAM_SINGLE,
|
||||||
|
Par_PARAM_MULTIPLE,
|
||||||
|
} tParamType; // Parameter is present only one time / multiple times
|
||||||
|
|
||||||
#define Par_SEPARATOR_PARAM_MULTIPLE 10 // Must be 1 <= character <= 31
|
#define Par_SEPARATOR_PARAM_MULTIPLE 10 // Must be 1 <= character <= 31
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -49,6 +55,8 @@ unsigned Par_GetParToHTML (const char *ParamName,char *ParamValue,size_t MaxByte
|
||||||
unsigned Par_GetParMultiToText (const char *ParamName,char *ParamValue,size_t MaxBytes);
|
unsigned Par_GetParMultiToText (const char *ParamName,char *ParamValue,size_t MaxBytes);
|
||||||
unsigned Par_GetParAndChangeFormat (const char *ParamName,char *ParamValue,size_t MaxBytes,
|
unsigned Par_GetParAndChangeFormat (const char *ParamName,char *ParamValue,size_t MaxBytes,
|
||||||
Str_ChangeTo_t ChangeTo,bool RemoveLeadingAndTrailingSpaces);
|
Str_ChangeTo_t ChangeTo,bool RemoveLeadingAndTrailingSpaces);
|
||||||
|
unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
|
||||||
|
char *ParamValue,size_t MaxBytes);
|
||||||
|
|
||||||
bool Par_GetNextStrUntilSeparParamMult (const char **StrSrc,char *StrDst,size_t LongMax);
|
bool Par_GetNextStrUntilSeparParamMult (const char **StrSrc,char *StrDst,size_t LongMax);
|
||||||
void Par_ReplaceSeparatorMultipleByComma (const char *StrSrc,char *StrDst);
|
void Par_ReplaceSeparatorMultipleByComma (const char *StrSrc,char *StrDst);
|
||||||
|
|
|
@ -845,11 +845,11 @@ bool Pwd_CheckIfICanChangeOtherUsrPassword (long UsrCod)
|
||||||
/* Check if I have permission to change user's password */
|
/* Check if I have permission to change user's password */
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
/* If I am an administrator of current degree,
|
/* If I am an administrator of current degree,
|
||||||
I only can change the password of users from current degree */
|
I only can change the password of users from current degree */
|
||||||
return Usr_CheckIfUsrBelongsToDeg (UsrCod,Gbl.CurrentDeg.Deg.DegCod);
|
return Usr_CheckIfUsrBelongsToDeg (UsrCod,Gbl.CurrentDeg.Deg.DegCod);
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -131,13 +131,13 @@ bool Pho_CheckIfICanChangeOtherUsrPhoto (long UsrCod)
|
||||||
/* Check if I have permission to change user's photo */
|
/* Check if I have permission to change user's photo */
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
return Usr_CheckIfUsrBelongsToCrs (UsrCod,Gbl.CurrentCrs.Crs.CrsCod);
|
return Usr_CheckIfUsrBelongsToCrs (UsrCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
/* If I am an administrator of current degree,
|
/* If I am an administrator of current degree,
|
||||||
I only can change the photo of users from current degree */
|
I only can change the photo of users from current degree */
|
||||||
return Usr_CheckIfUsrBelongsToDeg (UsrCod,Gbl.CurrentDeg.Deg.DegCod);
|
return Usr_CheckIfUsrBelongsToDeg (UsrCod,Gbl.CurrentDeg.Deg.DegCod);
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -93,7 +93,7 @@ void Plc_SeePlaces (void)
|
||||||
Plc_GetListPlaces ();
|
Plc_GetListPlaces ();
|
||||||
|
|
||||||
/***** Put link (form) to edit places *****/
|
/***** Put link (form) to edit places *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Plc_PutFormToEditPlcs ();
|
Plc_PutFormToEditPlcs ();
|
||||||
|
|
||||||
/***** Table head *****/
|
/***** Table head *****/
|
||||||
|
|
|
@ -81,7 +81,7 @@ void Plg_ListPlugins (void)
|
||||||
struct Plugin *Plg;
|
struct Plugin *Plg;
|
||||||
char URL[Cns_MAX_LENGTH_WWW+Ses_LENGTH_SESSION_ID+1];
|
char URL[Cns_MAX_LENGTH_WWW+Ses_LENGTH_SESSION_ID+1];
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
Lay_ShowAlert (Lay_WARNING,Txt_Option_under_development);
|
Lay_ShowAlert (Lay_WARNING,Txt_Option_under_development);
|
||||||
return;
|
return;
|
||||||
|
@ -91,7 +91,7 @@ void Plg_ListPlugins (void)
|
||||||
Plg_GetListPlugins ();
|
Plg_GetListPlugins ();
|
||||||
|
|
||||||
/***** Put link (form) to edit plugins *****/
|
/***** Put link (form) to edit plugins *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Plg_PutFormToEditPlugins ();
|
Plg_PutFormToEditPlugins ();
|
||||||
|
|
||||||
/***** Table start *****/
|
/***** Table start *****/
|
||||||
|
|
|
@ -342,10 +342,10 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
/***** Number of courses in which the user is teacher or student *****/
|
/***** Number of courses in which the user is teacher or student *****/
|
||||||
if ((NumCrssUsrIsTeacher = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_ROLE_TEACHER)))
|
if ((NumCrssUsrIsTeacher = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_TEACHER)))
|
||||||
{
|
{
|
||||||
NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_TEACHER,Rol_ROLE_TEACHER);
|
NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TEACHER,Rol_TEACHER);
|
||||||
NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_TEACHER,Rol_ROLE_STUDENT);
|
NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TEACHER,Rol_STUDENT);
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"PRF_ICON_CONTAINER\">"
|
"<td class=\"PRF_ICON_CONTAINER\">"
|
||||||
"<img src=\"%s/tch64x64.gif\" title=\"%s\""
|
"<img src=\"%s/tch64x64.gif\" title=\"%s\""
|
||||||
|
@ -357,7 +357,7 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Gbl.Prefs.IconsURL,
|
Gbl.Prefs.IconsURL,
|
||||||
Txt_ROLES_SINGUL_Abc[Rol_ROLE_TEACHER][UsrDat->Sex],
|
Txt_ROLES_SINGUL_Abc[Rol_TEACHER][UsrDat->Sex],
|
||||||
NumCrssUsrIsTeacher,
|
NumCrssUsrIsTeacher,
|
||||||
(NumCrssUsrIsTeacher == 1) ? Txt_course :
|
(NumCrssUsrIsTeacher == 1) ? Txt_course :
|
||||||
Txt_courses,
|
Txt_courses,
|
||||||
|
@ -366,10 +366,10 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
|
||||||
NumStds,
|
NumStds,
|
||||||
Txt_students_ABBREVIATION);
|
Txt_students_ABBREVIATION);
|
||||||
}
|
}
|
||||||
if ((NumCrssUsrIsStudent = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_ROLE_STUDENT)))
|
if ((NumCrssUsrIsStudent = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_STUDENT)))
|
||||||
{
|
{
|
||||||
NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_STUDENT,Rol_ROLE_TEACHER);
|
NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STUDENT,Rol_TEACHER);
|
||||||
NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_STUDENT,Rol_ROLE_STUDENT);
|
NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STUDENT,Rol_STUDENT);
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"PRF_ICON_CONTAINER\">"
|
"<td class=\"PRF_ICON_CONTAINER\">"
|
||||||
"<img src=\"%s/std64x64.gif\" title=\"%s\""
|
"<img src=\"%s/std64x64.gif\" title=\"%s\""
|
||||||
|
@ -381,7 +381,7 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Gbl.Prefs.IconsURL,
|
Gbl.Prefs.IconsURL,
|
||||||
Txt_ROLES_SINGUL_Abc[Rol_ROLE_STUDENT][UsrDat->Sex],
|
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][UsrDat->Sex],
|
||||||
NumCrssUsrIsStudent,
|
NumCrssUsrIsStudent,
|
||||||
(NumCrssUsrIsStudent == 1) ? Txt_course :
|
(NumCrssUsrIsStudent == 1) ? Txt_course :
|
||||||
Txt_courses,
|
Txt_courses,
|
||||||
|
|
134
swad_record.c
134
swad_record.c
|
@ -970,7 +970,7 @@ void Rec_GetUsrAndShowRecordOneStdCrs (void)
|
||||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the student
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the student
|
||||||
if ((Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB =
|
if ((Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB =
|
||||||
Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
|
Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod)) == Rol_ROLE_STUDENT)
|
Gbl.Usrs.Other.UsrDat.UsrCod)) == Rol_STUDENT)
|
||||||
Rec_ShowRecordOneStdCrs ();
|
Rec_ShowRecordOneStdCrs ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,7 +989,7 @@ static void Rec_ShowRecordOneStdCrs (void)
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
|
|
||||||
/***** Link to edit record fields *****/
|
/***** Link to edit record fields *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER)
|
||||||
Rec_PutLinkToEditRecordFields ();
|
Rec_PutLinkToEditRecordFields ();
|
||||||
|
|
||||||
/***** Link to print view *****/
|
/***** Link to print view *****/
|
||||||
|
@ -1009,10 +1009,10 @@ static void Rec_ShowRecordOneStdCrs (void)
|
||||||
|
|
||||||
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
|
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
Rec_ShowCrsRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat);
|
Rec_ShowCrsRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat);
|
||||||
else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT &&
|
else if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me
|
Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me
|
||||||
Rec_ShowCrsRecord (Rec_FORM_MY_COURSE_RECORD,&Gbl.Usrs.Other.UsrDat);
|
Rec_ShowCrsRecord (Rec_FORM_MY_COURSE_RECORD,&Gbl.Usrs.Other.UsrDat);
|
||||||
}
|
}
|
||||||
|
@ -1060,7 +1060,7 @@ void Rec_ListRecordsStdsCrs (void)
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
|
|
||||||
/* Link to edit record fields */
|
/* Link to edit record fields */
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER)
|
||||||
Rec_PutLinkToEditRecordFields ();
|
Rec_PutLinkToEditRecordFields ();
|
||||||
|
|
||||||
/* Link to print view */
|
/* Link to print view */
|
||||||
|
@ -1098,7 +1098,7 @@ void Rec_ListRecordsStdsCrs (void)
|
||||||
|
|
||||||
/* Record of the student in the course */
|
/* Record of the student in the course */
|
||||||
if (Gbl.CurrentCrs.Records.LstFields.Num && // There are fields in the record
|
if (Gbl.CurrentCrs.Records.LstFields.Num && // There are fields in the record
|
||||||
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER || // I am teacher in this course
|
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || // I am teacher in this course
|
||||||
UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)) // I am student in this course and it's me
|
UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)) // I am student in this course and it's me
|
||||||
Rec_ShowCrsRecord (TypeOfView,&UsrDat);
|
Rec_ShowCrsRecord (TypeOfView,&UsrDat);
|
||||||
|
|
||||||
|
@ -1131,7 +1131,7 @@ void Rec_GetUsrAndShowRecordOneTchCrs (void)
|
||||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the teacher
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the teacher
|
||||||
if ((Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB =
|
if ((Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB =
|
||||||
Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
|
Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod)) == Rol_ROLE_TEACHER)
|
Gbl.Usrs.Other.UsrDat.UsrCod)) == Rol_TEACHER)
|
||||||
Rec_ShowRecordOneTchCrs ();
|
Rec_ShowRecordOneTchCrs ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1652,7 +1652,7 @@ void Rec_GetFieldsCrsRecordFromForm (void)
|
||||||
for (NumField = 0;
|
for (NumField = 0;
|
||||||
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
||||||
NumField++)
|
NumField++)
|
||||||
if (Gbl.Usrs.Me.LoggedRole > Rol_ROLE_STUDENT ||
|
if (Gbl.Usrs.Me.LoggedRole > Rol_STUDENT ||
|
||||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
||||||
{
|
{
|
||||||
/* Get text of the form */
|
/* Get text of the form */
|
||||||
|
@ -1675,7 +1675,7 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
||||||
for (NumField = 0;
|
for (NumField = 0;
|
||||||
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
||||||
NumField++)
|
NumField++)
|
||||||
if (Gbl.Usrs.Me.LoggedRole > Rol_ROLE_STUDENT ||
|
if (Gbl.Usrs.Me.LoggedRole > Rol_STUDENT ||
|
||||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
||||||
{
|
{
|
||||||
/***** Check if already exists this field for this user in database *****/
|
/***** Check if already exists this field for this user in database *****/
|
||||||
|
@ -1802,7 +1802,7 @@ void Rec_AllocMemFieldsRecordsCrs (void)
|
||||||
for (NumField = 0;
|
for (NumField = 0;
|
||||||
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
||||||
NumField++)
|
NumField++)
|
||||||
if (Gbl.Usrs.Me.LoggedRole > Rol_ROLE_STUDENT ||
|
if (Gbl.Usrs.Me.LoggedRole > Rol_STUDENT ||
|
||||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
||||||
/* Allocate memory for the texts of the fields */
|
/* Allocate memory for the texts of the fields */
|
||||||
if ((Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text = malloc (Cns_MAX_BYTES_TEXT+1)) == NULL)
|
if ((Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text = malloc (Cns_MAX_BYTES_TEXT+1)) == NULL)
|
||||||
|
@ -1820,7 +1820,7 @@ void Rec_FreeMemFieldsRecordsCrs (void)
|
||||||
for (NumField = 0;
|
for (NumField = 0;
|
||||||
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
||||||
NumField++)
|
NumField++)
|
||||||
if (Gbl.Usrs.Me.LoggedRole > Rol_ROLE_STUDENT ||
|
if (Gbl.Usrs.Me.LoggedRole > Rol_STUDENT ||
|
||||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
||||||
/* Free memory of the text of the field */
|
/* Free memory of the text of the field */
|
||||||
if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text)
|
if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text)
|
||||||
|
@ -1976,12 +1976,12 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
const char *ClassData;
|
const char *ClassData;
|
||||||
char PhotoURL[PATH_MAX+1];
|
char PhotoURL[PATH_MAX+1];
|
||||||
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
||||||
bool IAmLoggedAsStudent = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT); // My current role is student
|
bool IAmLoggedAsStudent = (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT); // My current role is student
|
||||||
bool IAmLoggedAsTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER); // My current role is teacher
|
bool IAmLoggedAsTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER); // My current role is teacher
|
||||||
bool IAmLoggedAsSysAdm = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // My current role is superuser
|
bool IAmLoggedAsSysAdm = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // My current role is superuser
|
||||||
bool HeIsTeacherInAnyCourse = (UsrDat->Roles & (1 << Rol_ROLE_TEACHER)); // He/she already is a teacher in any course
|
bool HeIsTeacherInAnyCourse = (UsrDat->Roles & (1 << Rol_TEACHER)); // He/she already is a teacher in any course
|
||||||
bool HeBelongsToCurrentCrs = (UsrDat->RoleInCurrentCrsDB == Rol_ROLE_STUDENT ||
|
bool HeBelongsToCurrentCrs = (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ||
|
||||||
UsrDat->RoleInCurrentCrsDB == Rol_ROLE_TEACHER);
|
UsrDat->RoleInCurrentCrsDB == Rol_TEACHER);
|
||||||
bool CountryForm = (TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
bool CountryForm = (TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
||||||
TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR);
|
TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR);
|
||||||
bool RoleForm = (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
bool RoleForm = (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
||||||
|
@ -1992,10 +1992,10 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
bool DataForm = (TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
bool DataForm = (TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
||||||
TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR ||
|
TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR ||
|
||||||
(TypeOfView == Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR &&
|
(TypeOfView == Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR &&
|
||||||
Gbl.Usrs.Me.LoggedRole > Rol_ROLE_TEACHER));
|
Gbl.Usrs.Me.LoggedRole > Rol_TEACHER));
|
||||||
bool PutFormLinks; // Put links (forms) inside record card
|
bool PutFormLinks; // Put links (forms) inside record card
|
||||||
bool ShowEmail = (ItsMe ||
|
bool ShowEmail = (ItsMe ||
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM ||
|
||||||
DataForm ||
|
DataForm ||
|
||||||
TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
||||||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
|
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
|
||||||
|
@ -2007,7 +2007,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
TypeOfView == Rec_RECORD_PRINT) &&
|
TypeOfView == Rec_RECORD_PRINT) &&
|
||||||
(IAmLoggedAsTeacher || Gbl.Usrs.Listing.RecsUsrs == Rec_RECORD_USERS_TEACHERS)))));
|
(IAmLoggedAsTeacher || Gbl.Usrs.Listing.RecsUsrs == Rec_RECORD_USERS_TEACHERS)))));
|
||||||
bool ShowID = (ItsMe ||
|
bool ShowID = (ItsMe ||
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM ||
|
||||||
DataForm ||
|
DataForm ||
|
||||||
TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
||||||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
|
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
|
||||||
|
@ -2020,7 +2020,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
TypeOfView == Rec_RECORD_PRINT) &&
|
TypeOfView == Rec_RECORD_PRINT) &&
|
||||||
IAmLoggedAsTeacher && Gbl.Usrs.Listing.RecsUsrs == Rec_RECORD_USERS_STUDENTS))));
|
IAmLoggedAsTeacher && Gbl.Usrs.Listing.RecsUsrs == Rec_RECORD_USERS_STUDENTS))));
|
||||||
bool ShowData = ItsMe ||
|
bool ShowData = ItsMe ||
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM ||
|
||||||
UsrDat->Accepted;
|
UsrDat->Accepted;
|
||||||
bool ShowIDRows = (TypeOfView != Rec_RECORD_PUBLIC);
|
bool ShowIDRows = (TypeOfView != Rec_RECORD_PUBLIC);
|
||||||
bool ShowAddressRows = (TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
bool ShowAddressRows = (TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
||||||
|
@ -2030,15 +2030,15 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
((TypeOfView == Rec_RECORD_LIST ||
|
((TypeOfView == Rec_RECORD_LIST ||
|
||||||
TypeOfView == Rec_RECORD_PRINT) &&
|
TypeOfView == Rec_RECORD_PRINT) &&
|
||||||
(IAmLoggedAsTeacher || IAmLoggedAsSysAdm) &&
|
(IAmLoggedAsTeacher || IAmLoggedAsSysAdm) &&
|
||||||
UsrDat->RoleInCurrentCrsDB == Rol_ROLE_STUDENT));
|
UsrDat->RoleInCurrentCrsDB == Rol_STUDENT));
|
||||||
bool ShowTeacherRows = (((TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
bool ShowTeacherRows = (((TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
|
||||||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
|
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
|
||||||
TypeOfView == Rec_FORM_MY_COURSE_RECORD ||
|
TypeOfView == Rec_FORM_MY_COURSE_RECORD ||
|
||||||
TypeOfView == Rec_MY_COURSE_RECORD_CHECK) &&
|
TypeOfView == Rec_MY_COURSE_RECORD_CHECK) &&
|
||||||
(UsrDat->Roles & (1 << Rol_ROLE_TEACHER))) || // He/she (me, really) is a teacher in any course
|
(UsrDat->Roles & (1 << Rol_TEACHER))) || // He/she (me, really) is a teacher in any course
|
||||||
((TypeOfView == Rec_RECORD_LIST ||
|
((TypeOfView == Rec_RECORD_LIST ||
|
||||||
TypeOfView == Rec_RECORD_PRINT) &&
|
TypeOfView == Rec_RECORD_PRINT) &&
|
||||||
UsrDat->RoleInCurrentCrsDB == Rol_ROLE_TEACHER)); // He/she is a teacher in the current course
|
UsrDat->RoleInCurrentCrsDB == Rol_TEACHER)); // He/she is a teacher in the current course
|
||||||
Usr_Sex_t Sex;
|
Usr_Sex_t Sex;
|
||||||
Rol_Role_t Role;
|
Rol_Role_t Role;
|
||||||
Rol_Role_t DefaultRoleInCurrentCrs;
|
Rol_Role_t DefaultRoleInCurrentCrs;
|
||||||
|
@ -2191,7 +2191,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
IAmLoggedAsTeacher ||
|
IAmLoggedAsTeacher ||
|
||||||
IAmLoggedAsSysAdm))
|
IAmLoggedAsSysAdm))
|
||||||
{
|
{
|
||||||
Act_FormStart ((UsrDat->RoleInCurrentCrsDB == Rol_ROLE_STUDENT) ? ActSeeRecOneStd :
|
Act_FormStart ((UsrDat->RoleInCurrentCrsDB == Rol_STUDENT) ? ActSeeRecOneStd :
|
||||||
ActSeeRecOneTch);
|
ActSeeRecOneTch);
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||||
Act_LinkFormSubmit (Txt_View_record_for_this_course,NULL);
|
Act_LinkFormSubmit (Txt_View_record_for_this_course,NULL);
|
||||||
|
@ -2207,11 +2207,11 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
|
|
||||||
/***** Button to admin user *****/
|
/***** Button to admin user *****/
|
||||||
if (ItsMe ||
|
if (ItsMe ||
|
||||||
(Gbl.CurrentCrs.Crs.CrsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER) ||
|
(Gbl.CurrentCrs.Crs.CrsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) ||
|
||||||
(Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM) ||
|
(Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM) ||
|
||||||
(Gbl.CurrentCtr.Ctr.CtrCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADM) ||
|
(Gbl.CurrentCtr.Ctr.CtrCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_CTR_ADM) ||
|
||||||
(Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADM) ||
|
(Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_INS_ADM) ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
Act_FormStart (ActReqMdfUsr);
|
Act_FormStart (ActReqMdfUsr);
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||||
|
@ -2227,7 +2227,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected
|
||||||
UsrDat->RoleInCurrentCrsDB == Rol_ROLE_STUDENT && // He/she is a student in the current course
|
UsrDat->RoleInCurrentCrsDB == Rol_STUDENT && // He/she is a student in the current course
|
||||||
(ItsMe || IAmLoggedAsTeacher || IAmLoggedAsSysAdm)) // I can view
|
(ItsMe || IAmLoggedAsTeacher || IAmLoggedAsSysAdm)) // I can view
|
||||||
{
|
{
|
||||||
/***** Button to view user's assignments and works *****/
|
/***** Button to view user's assignments and works *****/
|
||||||
|
@ -2486,11 +2486,11 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
switch (TypeOfView)
|
switch (TypeOfView)
|
||||||
{
|
{
|
||||||
case Rec_FORM_SIGN_UP: // I want to apply for enrollment
|
case Rec_FORM_SIGN_UP: // I want to apply for enrollment
|
||||||
DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_ROLE_TEACHER)) ? Rol_ROLE_TEACHER :
|
DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TEACHER)) ? Rol_TEACHER :
|
||||||
Rol_ROLE_STUDENT;
|
Rol_STUDENT;
|
||||||
fprintf (Gbl.F.Out,"<select name=\"Role\">");
|
fprintf (Gbl.F.Out,"<select name=\"Role\">");
|
||||||
for (Role = Rol_ROLE_STUDENT;
|
for (Role = Rol_STUDENT;
|
||||||
Role <= Rol_ROLE_TEACHER;
|
Role <= Rol_TEACHER;
|
||||||
Role++)
|
Role++)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
|
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
|
||||||
|
@ -2502,12 +2502,12 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
fprintf (Gbl.F.Out,"</select>");
|
fprintf (Gbl.F.Out,"</select>");
|
||||||
break;
|
break;
|
||||||
case Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR: // The other user already exists in the platform
|
case Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR: // The other user already exists in the platform
|
||||||
if (UsrDat->RoleInCurrentCrsDB < Rol_ROLE_STUDENT) // The other user does not belong to current course
|
if (UsrDat->RoleInCurrentCrsDB < Rol_STUDENT) // The other user does not belong to current course
|
||||||
{
|
{
|
||||||
/* If there is a request of this user, default role is the requested role */
|
/* If there is a request of this user, default role is the requested role */
|
||||||
if ((DefaultRoleInCurrentCrs = Rol_GetRequestedRole (UsrDat->UsrCod)) == Rol_ROLE_UNKNOWN)
|
if ((DefaultRoleInCurrentCrs = Rol_GetRequestedRole (UsrDat->UsrCod)) == Rol_UNKNOWN)
|
||||||
DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_ROLE_TEACHER)) ? Rol_ROLE_TEACHER :
|
DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TEACHER)) ? Rol_TEACHER :
|
||||||
Rol_ROLE_STUDENT;
|
Rol_STUDENT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB;
|
DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB;
|
||||||
|
@ -2515,18 +2515,18 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
fprintf (Gbl.F.Out,"<select name=\"Role\">");
|
fprintf (Gbl.F.Out,"<select name=\"Role\">");
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_GUEST__:
|
case Rol__GUEST_:
|
||||||
case Rol_ROLE_VISITOR:
|
case Rol_VISITOR:
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\" disabled=\"disabled\">%s</option>",
|
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\" disabled=\"disabled\">%s</option>",
|
||||||
(unsigned) Gbl.Usrs.Me.LoggedRole,
|
(unsigned) Gbl.Usrs.Me.LoggedRole,
|
||||||
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][UsrDat->Sex]);
|
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][UsrDat->Sex]);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
for (Role = Rol_ROLE_STUDENT;
|
for (Role = Rol_STUDENT;
|
||||||
Role <= Rol_ROLE_TEACHER;
|
Role <= Rol_TEACHER;
|
||||||
Role++)
|
Role++)
|
||||||
if (Role == Rol_ROLE_STUDENT ||
|
if (Role == Rol_STUDENT ||
|
||||||
(UsrDat->Roles & (1 << Role))) // A teacher can not upgrade a student (in all other courses) to teacher
|
(UsrDat->Roles & (1 << Role))) // A teacher can not upgrade a student (in all other courses) to teacher
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
|
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
|
||||||
|
@ -2536,10 +2536,10 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
|
Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
for (Role = Rol_ROLE_STUDENT;
|
for (Role = Rol_STUDENT;
|
||||||
Role <= Rol_ROLE_TEACHER;
|
Role <= Rol_TEACHER;
|
||||||
Role++)
|
Role++)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
|
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
|
||||||
|
@ -2558,16 +2558,16 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
fprintf (Gbl.F.Out,"<select name=\"Role\">");
|
fprintf (Gbl.F.Out,"<select name=\"Role\">");
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER: // A teacher only can create students
|
case Rol_TEACHER: // A teacher only can create students
|
||||||
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>",
|
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>",
|
||||||
(unsigned) Rol_ROLE_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]);
|
(unsigned) Rol_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]);
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM: // An administrator or a superuser can create students and teachers
|
case Rol_DEG_ADM: // An administrator or a superuser can create students and teachers
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>"
|
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>"
|
||||||
"<option value=\"%u\">%s</option>",
|
"<option value=\"%u\">%s</option>",
|
||||||
(unsigned) Rol_ROLE_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],
|
(unsigned) Rol_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||||
(unsigned) Rol_ROLE_TEACHER,Txt_ROLES_SINGUL_Abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN]);
|
(unsigned) Rol_TEACHER,Txt_ROLES_SINGUL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN]);
|
||||||
break;
|
break;
|
||||||
default: // The rest of users can not register other users
|
default: // The rest of users can not register other users
|
||||||
break;
|
break;
|
||||||
|
@ -3054,7 +3054,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
||||||
{
|
{
|
||||||
// Don't show groups if I don't belong to course
|
// Don't show groups if I don't belong to course
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||||
Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT));
|
Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod);
|
Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod);
|
||||||
|
@ -3125,25 +3125,25 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
|
||||||
/***** Check if I can register a user
|
/***** Check if I can register a user
|
||||||
with the received role in current course *****/
|
with the received role in current course *****/
|
||||||
/* Received role must be student or teacher */
|
/* Received role must be student or teacher */
|
||||||
if (!(Role == Rol_ROLE_STUDENT ||
|
if (!(Role == Rol_STUDENT ||
|
||||||
Role == Rol_ROLE_TEACHER))
|
Role == Rol_TEACHER))
|
||||||
Lay_ShowErrorAndExit ("Wrong user's role.");
|
Lay_ShowErrorAndExit ("Wrong user's role.");
|
||||||
|
|
||||||
/* Check for other possible errors */
|
/* Check for other possible errors */
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT: // I am logged as student
|
case Rol_STUDENT: // I am logged as student
|
||||||
/* A student can only change his/her data, but not his/her role */
|
/* A student can only change his/her data, but not his/her role */
|
||||||
if (Role != Rol_ROLE_STUDENT)
|
if (Role != Rol_STUDENT)
|
||||||
Lay_ShowErrorAndExit ("Wrong user's role.");
|
Lay_ShowErrorAndExit ("Wrong user's role.");
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER: // I am logged as teacher
|
case Rol_TEACHER: // I am logged as teacher
|
||||||
/* A teacher can only register another user as teacher
|
/* A teacher can only register another user as teacher
|
||||||
if the other is already teacher in any course.
|
if the other is already teacher in any course.
|
||||||
That is, a teacher can not upgrade a student
|
That is, a teacher can not upgrade a student
|
||||||
(in all other courses) to teacher */
|
(in all other courses) to teacher */
|
||||||
if (Role == Rol_ROLE_TEACHER && // He/she will be a teacher in current course
|
if (Role == Rol_TEACHER && // He/she will be a teacher in current course
|
||||||
!(Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_ROLE_TEACHER))) // He/she was not a teacher in any course
|
!(Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_TEACHER))) // He/she was not a teacher in any course
|
||||||
Lay_ShowErrorAndExit ("Wrong user's role.");
|
Lay_ShowErrorAndExit ("Wrong user's role.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -3271,13 +3271,13 @@ void Rec_ShowFormMyInsCtrDpt (void)
|
||||||
unsigned NumIns;
|
unsigned NumIns;
|
||||||
unsigned NumCtr;
|
unsigned NumCtr;
|
||||||
unsigned NumDpt;
|
unsigned NumDpt;
|
||||||
bool IAmTeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_ROLE_TEACHER));
|
bool IAmTeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TEACHER));
|
||||||
|
|
||||||
/***** If there is no institution, centre or department *****/
|
/***** If there is no institution, centre or department *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.InsCtyCod < 0 ||
|
if (Gbl.Usrs.Me.UsrDat.InsCtyCod < 0 ||
|
||||||
Gbl.Usrs.Me.UsrDat.InsCod < 0)
|
Gbl.Usrs.Me.UsrDat.InsCod < 0)
|
||||||
Lay_ShowAlert (Lay_WARNING,Txt_Please_fill_in_your_institution);
|
Lay_ShowAlert (Lay_WARNING,Txt_Please_fill_in_your_institution);
|
||||||
else if ((Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_ROLE_TEACHER)) &&
|
else if ((Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TEACHER)) &&
|
||||||
(Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 ||
|
(Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 ||
|
||||||
Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0))
|
Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0))
|
||||||
Lay_ShowAlert (Lay_WARNING,Txt_Please_fill_in_your_centre_and_department);
|
Lay_ShowAlert (Lay_WARNING,Txt_Please_fill_in_your_centre_and_department);
|
||||||
|
|
54
swad_role.c
54
swad_role.c
|
@ -67,7 +67,7 @@ unsigned Rol_GetNumAvailableRoles (void)
|
||||||
Rol_Role_t Role;
|
Rol_Role_t Role;
|
||||||
unsigned NumAvailableRoles = 0;
|
unsigned NumAvailableRoles = 0;
|
||||||
|
|
||||||
for (Role = Rol_ROLE_GUEST__;
|
for (Role = Rol__GUEST_;
|
||||||
Role < Rol_NUM_ROLES;
|
Role < Rol_NUM_ROLES;
|
||||||
Role++)
|
Role++)
|
||||||
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
|
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
|
||||||
|
@ -82,11 +82,11 @@ unsigned Rol_GetNumAvailableRoles (void)
|
||||||
|
|
||||||
Rol_Role_t Rol_GetMaxRole (unsigned Roles)
|
Rol_Role_t Rol_GetMaxRole (unsigned Roles)
|
||||||
{
|
{
|
||||||
if (Roles & (1 << Rol_ROLE_TEACHER))
|
if (Roles & (1 << Rol_TEACHER))
|
||||||
return Rol_ROLE_TEACHER;
|
return Rol_TEACHER;
|
||||||
if (Roles & (1 << Rol_ROLE_STUDENT))
|
if (Roles & (1 << Rol_STUDENT))
|
||||||
return Rol_ROLE_STUDENT;
|
return Rol_STUDENT;
|
||||||
return Rol_ROLE_GUEST__;
|
return Rol__GUEST_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -108,9 +108,9 @@ Rol_Role_t Rol_GetMyMaxRoleInIns (long InsCod)
|
||||||
NumMyIns++)
|
NumMyIns++)
|
||||||
if (Gbl.Usrs.Me.MyInstitutions.Inss[NumMyIns].InsCod == InsCod)
|
if (Gbl.Usrs.Me.MyInstitutions.Inss[NumMyIns].InsCod == InsCod)
|
||||||
return Gbl.Usrs.Me.MyInstitutions.Inss[NumMyIns].MaxRole;
|
return Gbl.Usrs.Me.MyInstitutions.Inss[NumMyIns].MaxRole;
|
||||||
return Rol_ROLE_GUEST__;
|
return Rol__GUEST_;
|
||||||
}
|
}
|
||||||
return Rol_ROLE_UNKNOWN; // No degree
|
return Rol_UNKNOWN; // No degree
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -132,9 +132,9 @@ Rol_Role_t Rol_GetMyMaxRoleInCtr (long CtrCod)
|
||||||
NumMyCtr++)
|
NumMyCtr++)
|
||||||
if (Gbl.Usrs.Me.MyCentres.Ctrs[NumMyCtr].CtrCod == CtrCod)
|
if (Gbl.Usrs.Me.MyCentres.Ctrs[NumMyCtr].CtrCod == CtrCod)
|
||||||
return Gbl.Usrs.Me.MyCentres.Ctrs[NumMyCtr].MaxRole;
|
return Gbl.Usrs.Me.MyCentres.Ctrs[NumMyCtr].MaxRole;
|
||||||
return Rol_ROLE_GUEST__;
|
return Rol__GUEST_;
|
||||||
}
|
}
|
||||||
return Rol_ROLE_UNKNOWN; // No centre
|
return Rol_UNKNOWN; // No centre
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -156,9 +156,9 @@ Rol_Role_t Rol_GetMyMaxRoleInDeg (long DegCod)
|
||||||
NumMyDeg++)
|
NumMyDeg++)
|
||||||
if (Gbl.Usrs.Me.MyDegrees.Degs[NumMyDeg].DegCod == DegCod)
|
if (Gbl.Usrs.Me.MyDegrees.Degs[NumMyDeg].DegCod == DegCod)
|
||||||
return Gbl.Usrs.Me.MyDegrees.Degs[NumMyDeg].MaxRole;
|
return Gbl.Usrs.Me.MyDegrees.Degs[NumMyDeg].MaxRole;
|
||||||
return Rol_ROLE_GUEST__;
|
return Rol__GUEST_;
|
||||||
}
|
}
|
||||||
return Rol_ROLE_UNKNOWN; // No degree
|
return Rol_UNKNOWN; // No degree
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -180,9 +180,9 @@ Rol_Role_t Rol_GetMyRoleInCrs (long CrsCod)
|
||||||
NumMyCrs++)
|
NumMyCrs++)
|
||||||
if (Gbl.Usrs.Me.MyCourses.Crss[NumMyCrs].CrsCod == CrsCod)
|
if (Gbl.Usrs.Me.MyCourses.Crss[NumMyCrs].CrsCod == CrsCod)
|
||||||
return Gbl.Usrs.Me.MyCourses.Crss[NumMyCrs].Role;
|
return Gbl.Usrs.Me.MyCourses.Crss[NumMyCrs].Role;
|
||||||
return Rol_ROLE_GUEST__;
|
return Rol__GUEST_;
|
||||||
}
|
}
|
||||||
return Rol_ROLE_UNKNOWN; // No course
|
return Rol_UNKNOWN; // No course
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -209,13 +209,13 @@ Rol_Role_t Rol_GetRoleInCrs (long CrsCod,long UsrCod)
|
||||||
Role = Rol_ConvertUnsignedStrToRole (row[0]);
|
Role = Rol_ConvertUnsignedStrToRole (row[0]);
|
||||||
}
|
}
|
||||||
else // User does not belong to the course
|
else // User does not belong to the course
|
||||||
Role = Rol_ROLE_UNKNOWN;
|
Role = Rol_UNKNOWN;
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
else // No course
|
else // No course
|
||||||
Role = Rol_ROLE_UNKNOWN;
|
Role = Rol_UNKNOWN;
|
||||||
|
|
||||||
return Role;
|
return Role;
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ unsigned Rol_GetRolesInAllCrss (long UsrCod)
|
||||||
NumRole++)
|
NumRole++)
|
||||||
{
|
{
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Role = Rol_ConvertUnsignedStrToRole (row[0])) != Rol_ROLE_UNKNOWN)
|
if ((Role = Rol_ConvertUnsignedStrToRole (row[0])) != Rol_UNKNOWN)
|
||||||
Roles |= (1 << Role);
|
Roles |= (1 << Role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,9 +263,9 @@ Rol_Role_t Rol_ConvertUnsignedStrToRole (const char *UnsignedStr)
|
||||||
unsigned UnsignedNum;
|
unsigned UnsignedNum;
|
||||||
|
|
||||||
if (sscanf (UnsignedStr,"%u",&UnsignedNum) == 1)
|
if (sscanf (UnsignedStr,"%u",&UnsignedNum) == 1)
|
||||||
return (UnsignedNum >= Rol_NUM_ROLES) ? Rol_ROLE_UNKNOWN :
|
return (UnsignedNum >= Rol_NUM_ROLES) ? Rol_UNKNOWN :
|
||||||
(Rol_Role_t) UnsignedNum;
|
(Rol_Role_t) UnsignedNum;
|
||||||
return Rol_ROLE_UNKNOWN;
|
return Rol_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -301,7 +301,7 @@ void Rol_PutFormToChangeMyRole (bool FormInHead)
|
||||||
fprintf (Gbl.F.Out," style=\"width:%upx;\"",SelectorWidth[Gbl.Prefs.Layout]);
|
fprintf (Gbl.F.Out," style=\"width:%upx;\"",SelectorWidth[Gbl.Prefs.Layout]);
|
||||||
fprintf (Gbl.F.Out," onchange=\"javascript:document.getElementById('%s').submit();\">",
|
fprintf (Gbl.F.Out," onchange=\"javascript:document.getElementById('%s').submit();\">",
|
||||||
Gbl.FormId);
|
Gbl.FormId);
|
||||||
for (Role = Rol_ROLE_GUEST__;
|
for (Role = Rol__GUEST_;
|
||||||
Role < Rol_NUM_ROLES;
|
Role < Rol_NUM_ROLES;
|
||||||
Role++)
|
Role++)
|
||||||
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
|
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
|
||||||
|
@ -354,8 +354,8 @@ void Rol_WriteSelectorRoles (unsigned Roles)
|
||||||
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
Rol_Role_t Role;
|
Rol_Role_t Role;
|
||||||
|
|
||||||
for (Role = Rol_ROLE_STUDENT;
|
for (Role = Rol_STUDENT;
|
||||||
Role <= Rol_ROLE_TEACHER;
|
Role <= Rol_TEACHER;
|
||||||
Role++)
|
Role++)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Roles\" value=\"%u\"",
|
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Roles\" value=\"%u\"",
|
||||||
|
@ -402,8 +402,8 @@ void Rol_PutAllRolesRegRemUsrsCrs (void)
|
||||||
fprintf (Gbl.F.Out,"<div style=\"display:inline-block; margin:0 auto;\">"
|
fprintf (Gbl.F.Out,"<div style=\"display:inline-block; margin:0 auto;\">"
|
||||||
"<ul style=\"list-style-type:none; text-align:left;\" class=\"%s\">",
|
"<ul style=\"list-style-type:none; text-align:left;\" class=\"%s\">",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme]);
|
The_ClassFormul[Gbl.Prefs.Theme]);
|
||||||
Rol_PutOneRoleRegRemUsrsCrs (Rol_ROLE_STUDENT,true);
|
Rol_PutOneRoleRegRemUsrsCrs (Rol_STUDENT,true);
|
||||||
Rol_PutOneRoleRegRemUsrsCrs (Rol_ROLE_TEACHER,false);
|
Rol_PutOneRoleRegRemUsrsCrs (Rol_TEACHER,false);
|
||||||
fprintf (Gbl.F.Out,"</ul>"
|
fprintf (Gbl.F.Out,"</ul>"
|
||||||
"</div>");
|
"</div>");
|
||||||
}
|
}
|
||||||
|
@ -423,8 +423,8 @@ static void Rol_PutOneRoleRegRemUsrsCrs (Rol_Role_t Role,bool Checked)
|
||||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||||
switch (Gbl.Usrs.Me.LoggedRole) // Can I select type of user?
|
switch (Gbl.Usrs.Me.LoggedRole) // Can I select type of user?
|
||||||
{
|
{
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
case Rol_ROLE_SYS_ADM: // Yes, I can
|
case Rol_SYS_ADM: // Yes, I can
|
||||||
break;
|
break;
|
||||||
default: // No, I can not
|
default: // No, I can not
|
||||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
|
@ -443,7 +443,7 @@ Rol_Role_t Rol_GetRequestedRole (long UsrCod)
|
||||||
char Query[256];
|
char Query[256];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
Rol_Role_t Role = Rol_ROLE_UNKNOWN;
|
Rol_Role_t Role = Rol_UNKNOWN;
|
||||||
|
|
||||||
/***** Get requested role from database *****/
|
/***** Get requested role from database *****/
|
||||||
sprintf (Query,"SELECT Role FROM crs_usr_requests"
|
sprintf (Query,"SELECT Role FROM crs_usr_requests"
|
||||||
|
|
20
swad_role.h
20
swad_role.h
|
@ -47,16 +47,16 @@
|
||||||
#define Rol_NUM_ROLES 9
|
#define Rol_NUM_ROLES 9
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Rol_ROLE_UNKNOWN = 0, // User not logged in
|
Rol_UNKNOWN = 0, // User not logged in
|
||||||
Rol_ROLE_GUEST__ = 1, // User not belonging to any course
|
Rol__GUEST_ = 1, // User not belonging to any course
|
||||||
Rol_ROLE_VISITOR = 2, // Student or teacher in other courses...
|
Rol_VISITOR = 2, // Student or teacher in other courses...
|
||||||
// ...but not belonging to the current course
|
// ...but not belonging to the current course
|
||||||
Rol_ROLE_STUDENT = 3, // Student in current course
|
Rol_STUDENT = 3, // Student in current course
|
||||||
Rol_ROLE_TEACHER = 4, // Teacher in current course
|
Rol_TEACHER = 4, // Teacher in current course
|
||||||
Rol_ROLE_DEG_ADM = 5, // Degree administrator
|
Rol_DEG_ADM = 5, // Degree administrator
|
||||||
Rol_ROLE_CTR_ADM = 6, // Centre administrator
|
Rol_CTR_ADM = 6, // Centre administrator
|
||||||
Rol_ROLE_INS_ADM = 7, // Institution administrator
|
Rol_INS_ADM = 7, // Institution administrator
|
||||||
Rol_ROLE_SYS_ADM = 8, // System administrator (superuser)
|
Rol_SYS_ADM = 8, // System administrator (superuser)
|
||||||
} Rol_Role_t;
|
} Rol_Role_t;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
14
swad_scope.c
14
swad_scope.c
|
@ -229,16 +229,16 @@ void Sco_SetScopesForListingGuests (void)
|
||||||
{
|
{
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_CTR_ADM:
|
case Rol_CTR_ADM:
|
||||||
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CTR;
|
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CTR;
|
||||||
Gbl.Scope.Default = Sco_SCOPE_CTR;
|
Gbl.Scope.Default = Sco_SCOPE_CTR;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_INS_ADM:
|
case Rol_INS_ADM:
|
||||||
Gbl.Scope.Allowed = 1 << Sco_SCOPE_INS |
|
Gbl.Scope.Allowed = 1 << Sco_SCOPE_INS |
|
||||||
1 << Sco_SCOPE_CTR;
|
1 << Sco_SCOPE_CTR;
|
||||||
Gbl.Scope.Default = Sco_SCOPE_INS;
|
Gbl.Scope.Default = Sco_SCOPE_INS;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
|
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
|
||||||
1 << Sco_SCOPE_CTY |
|
1 << Sco_SCOPE_CTY |
|
||||||
1 << Sco_SCOPE_INS |
|
1 << Sco_SCOPE_INS |
|
||||||
|
@ -260,16 +260,16 @@ void Sco_SetScopesForListingStudents (void)
|
||||||
{
|
{
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CRS;
|
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CRS;
|
||||||
Gbl.Scope.Default = Sco_SCOPE_CRS;
|
Gbl.Scope.Default = Sco_SCOPE_CRS;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
Gbl.Scope.Allowed = 1 << Sco_SCOPE_DEG;
|
Gbl.Scope.Allowed = 1 << Sco_SCOPE_DEG;
|
||||||
Gbl.Scope.Default = Sco_SCOPE_DEG;
|
Gbl.Scope.Default = Sco_SCOPE_DEG;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
|
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
|
||||||
1 << Sco_SCOPE_CTY |
|
1 << Sco_SCOPE_CTY |
|
||||||
1 << Sco_SCOPE_INS |
|
1 << Sco_SCOPE_INS |
|
||||||
|
|
|
@ -220,9 +220,9 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Sco
|
||||||
Txt_Centres, // Sch_SEARCH_CENTRES
|
Txt_Centres, // Sch_SEARCH_CENTRES
|
||||||
Txt_Degrees, // Sch_SEARCH_DEGREES
|
Txt_Degrees, // Sch_SEARCH_DEGREES
|
||||||
Txt_Courses, // Sch_SEARCH_COURSES
|
Txt_Courses, // Sch_SEARCH_COURSES
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN],// Sch_SEARCH_TEACHERS
|
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],// Sch_SEARCH_TEACHERS
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],// Sch_SEARCH_STUDENTS
|
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],// Sch_SEARCH_STUDENTS
|
||||||
Txt_ROLES_PLURAL_Abc[Rol_ROLE_GUEST__ ][Usr_SEX_UNKNOWN],// Sch_SEARCH_GUESTS
|
Txt_ROLES_PLURAL_Abc[Rol__GUEST_ ][Usr_SEX_UNKNOWN],// Sch_SEARCH_GUESTS
|
||||||
Txt_Open_documents, // Sch_SEARCH_OPEN_DOCUMENTS
|
Txt_Open_documents, // Sch_SEARCH_OPEN_DOCUMENTS
|
||||||
Txt_DOCUM_in_my_courses, // Sch_SEARCH_DOCUM_IN_MY_COURSES
|
Txt_DOCUM_in_my_courses, // Sch_SEARCH_DOCUM_IN_MY_COURSES
|
||||||
Txt_My_documents, // Sch_SEARCH_MY_DOCUMENTS
|
Txt_My_documents, // Sch_SEARCH_MY_DOCUMENTS
|
||||||
|
@ -539,9 +539,9 @@ static void Sch_SearchInDB (void)
|
||||||
NumResults += Sch_SearchCentresInDB (RangeQuery);
|
NumResults += Sch_SearchCentresInDB (RangeQuery);
|
||||||
NumResults += Sch_SearchDegreesInDB (RangeQuery);
|
NumResults += Sch_SearchDegreesInDB (RangeQuery);
|
||||||
NumResults += Sch_SearchCoursesInDB (RangeQuery);
|
NumResults += Sch_SearchCoursesInDB (RangeQuery);
|
||||||
NumResults += Sch_SearchUsrsInDB (Rol_ROLE_TEACHER);
|
NumResults += Sch_SearchUsrsInDB (Rol_TEACHER);
|
||||||
NumResults += Sch_SearchUsrsInDB (Rol_ROLE_STUDENT);
|
NumResults += Sch_SearchUsrsInDB (Rol_STUDENT);
|
||||||
NumResults += Sch_SearchUsrsInDB (Rol_ROLE_GUEST__);
|
NumResults += Sch_SearchUsrsInDB (Rol__GUEST_);
|
||||||
NumResults += Sch_SearchOpenDocumentsInDB (RangeQuery);
|
NumResults += Sch_SearchOpenDocumentsInDB (RangeQuery);
|
||||||
NumResults += Sch_SearchDocumentsInMyCoursesInDB (RangeQuery);
|
NumResults += Sch_SearchDocumentsInMyCoursesInDB (RangeQuery);
|
||||||
NumResults += Sch_SearchMyDocumentsInDB (RangeQuery);
|
NumResults += Sch_SearchMyDocumentsInDB (RangeQuery);
|
||||||
|
@ -559,13 +559,13 @@ static void Sch_SearchInDB (void)
|
||||||
NumResults = Sch_SearchCoursesInDB (RangeQuery);
|
NumResults = Sch_SearchCoursesInDB (RangeQuery);
|
||||||
break;
|
break;
|
||||||
case Sch_SEARCH_TEACHERS:
|
case Sch_SEARCH_TEACHERS:
|
||||||
NumResults = Sch_SearchUsrsInDB (Rol_ROLE_TEACHER);
|
NumResults = Sch_SearchUsrsInDB (Rol_TEACHER);
|
||||||
break;
|
break;
|
||||||
case Sch_SEARCH_STUDENTS:
|
case Sch_SEARCH_STUDENTS:
|
||||||
NumResults = Sch_SearchUsrsInDB (Rol_ROLE_STUDENT);
|
NumResults = Sch_SearchUsrsInDB (Rol_STUDENT);
|
||||||
break;
|
break;
|
||||||
case Sch_SEARCH_GUESTS:
|
case Sch_SEARCH_GUESTS:
|
||||||
NumResults = Sch_SearchUsrsInDB (Rol_ROLE_GUEST__);
|
NumResults = Sch_SearchUsrsInDB (Rol__GUEST_);
|
||||||
break;
|
break;
|
||||||
case Sch_SEARCH_OPEN_DOCUMENTS:
|
case Sch_SEARCH_OPEN_DOCUMENTS:
|
||||||
NumResults = Sch_SearchOpenDocumentsInDB (RangeQuery);
|
NumResults = Sch_SearchOpenDocumentsInDB (RangeQuery);
|
||||||
|
@ -726,8 +726,8 @@ static unsigned Sch_SearchUsrsInDB (Rol_Role_t Role)
|
||||||
char SearchQuery[Sch_MAX_LENGTH_SEARCH_QUERY+1];
|
char SearchQuery[Sch_MAX_LENGTH_SEARCH_QUERY+1];
|
||||||
|
|
||||||
/***** Check user's permission *****/
|
/***** Check user's permission *****/
|
||||||
if (Sch_CheckIfIHavePermissionToSearch ( Role == Rol_ROLE_TEACHER ? Sch_SEARCH_TEACHERS :
|
if (Sch_CheckIfIHavePermissionToSearch ( Role == Rol_TEACHER ? Sch_SEARCH_TEACHERS :
|
||||||
(Role == Rol_ROLE_STUDENT ? Sch_SEARCH_STUDENTS :
|
(Role == Rol_STUDENT ? Sch_SEARCH_STUDENTS :
|
||||||
Sch_SEARCH_GUESTS)))
|
Sch_SEARCH_GUESTS)))
|
||||||
/***** Split user string into words *****/
|
/***** Split user string into words *****/
|
||||||
if (Sch_BuildSearchQuery (SearchQuery,
|
if (Sch_BuildSearchQuery (SearchQuery,
|
||||||
|
|
|
@ -135,7 +135,7 @@ void Ses_CloseSession (void)
|
||||||
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
|
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
|
||||||
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
|
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
|
||||||
Gbl.Usrs.Me.IBelongToCurrentCrs = false;
|
Gbl.Usrs.Me.IBelongToCurrentCrs = false;
|
||||||
Gbl.Usrs.Me.LoggedRole = Rol_ROLE_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_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.MyCourses.Filled = false;
|
Gbl.Usrs.Me.MyCourses.Filled = false;
|
||||||
Gbl.Usrs.Me.MyCourses.Num = 0;
|
Gbl.Usrs.Me.MyCourses.Num = 0;
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ bool Ses_GetSessionData (void)
|
||||||
|
|
||||||
/***** Get logged user type (row[2]) *****/
|
/***** Get logged user type (row[2]) *****/
|
||||||
if (sscanf (row[2],"%u",&Gbl.Usrs.Me.RoleFromSession) != 1)
|
if (sscanf (row[2],"%u",&Gbl.Usrs.Me.RoleFromSession) != 1)
|
||||||
Gbl.Usrs.Me.RoleFromSession = Rol_ROLE_UNKNOWN;
|
Gbl.Usrs.Me.RoleFromSession = Rol_UNKNOWN;
|
||||||
|
|
||||||
/***** Get country code (row[3]) *****/
|
/***** Get country code (row[3]) *****/
|
||||||
Gbl.CurrentCty.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[3]);
|
Gbl.CurrentCty.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||||
|
|
182
swad_statistic.c
182
swad_statistic.c
|
@ -415,8 +415,8 @@ void Sta_AskSeeCrsAccesses (void)
|
||||||
Usr_ShowFormsToSelectUsrListType (ActReqAccCrs);
|
Usr_ShowFormsToSelectUsrListType (ActReqAccCrs);
|
||||||
|
|
||||||
/***** Get and order the lists of users of this course *****/
|
/***** Get and order the lists of users of this course *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstTchs.NumUsrs ||
|
if (Gbl.Usrs.LstTchs.NumUsrs ||
|
||||||
Gbl.Usrs.LstStds.NumUsrs)
|
Gbl.Usrs.LstStds.NumUsrs)
|
||||||
|
@ -440,8 +440,8 @@ void Sta_AskSeeCrsAccesses (void)
|
||||||
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
||||||
|
|
||||||
/* Put list of users to select some users */
|
/* Put list of users to select some users */
|
||||||
Usr_ListUsersToSelect (Rol_ROLE_TEACHER);
|
Usr_ListUsersToSelect (Rol_TEACHER);
|
||||||
Usr_ListUsersToSelect (Rol_ROLE_STUDENT);
|
Usr_ListUsersToSelect (Rol_STUDENT);
|
||||||
|
|
||||||
/* End the table */
|
/* End the table */
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
|
@ -555,8 +555,8 @@ void Sta_AskSeeGblAccesses (void)
|
||||||
|
|
||||||
/***** Put form to go to test edition and configuration *****/
|
/***** Put form to go to test edition and configuration *****/
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
|
||||||
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
|
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div style=\"padding-bottom:10px; text-align:center;\">");
|
fprintf (Gbl.F.Out,"<div style=\"padding-bottom:10px; text-align:center;\">");
|
||||||
Sta_PutFormToRequestAccessesCrs ();
|
Sta_PutFormToRequestAccessesCrs ();
|
||||||
|
@ -942,8 +942,8 @@ static bool Sta_SeeAccesses (void)
|
||||||
|
|
||||||
/***** Check if range of dates is forbidden for me *****/
|
/***** Check if range of dates is forbidden for me *****/
|
||||||
NumDays = Dat_GetNumDaysBetweenDates (&Gbl.DateRange.DateIni,&Gbl.DateRange.DateEnd);
|
NumDays = Dat_GetNumDaysBetweenDates (&Gbl.DateRange.DateIni,&Gbl.DateRange.DateEnd);
|
||||||
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
|
if (!(Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
|
||||||
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER && StatsGlobalOrCourse == STAT_COURSE)))
|
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER && StatsGlobalOrCourse == STAT_COURSE)))
|
||||||
if (NumDays > Cfg_DAYS_IN_RECENT_LOG)
|
if (NumDays > Cfg_DAYS_IN_RECENT_LOG)
|
||||||
{
|
{
|
||||||
sprintf (Gbl.Message,Txt_The_date_range_must_be_less_than_or_equal_to_X_days,
|
sprintf (Gbl.Message,Txt_The_date_range_must_be_less_than_or_equal_to_X_days,
|
||||||
|
@ -1099,7 +1099,7 @@ static bool Sta_SeeAccesses (void)
|
||||||
{
|
{
|
||||||
case Sta_IDENTIFIED_USRS:
|
case Sta_IDENTIFIED_USRS:
|
||||||
sprintf (StrRole," AND %s.Role<>'%u'",
|
sprintf (StrRole," AND %s.Role<>'%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_UNKNOWN);
|
LogTable,(unsigned) Rol_UNKNOWN);
|
||||||
break;
|
break;
|
||||||
case Sta_ALL_USRS:
|
case Sta_ALL_USRS:
|
||||||
switch (Gbl.Stat.CountType)
|
switch (Gbl.Stat.CountType)
|
||||||
|
@ -1112,41 +1112,41 @@ static bool Sta_SeeAccesses (void)
|
||||||
case Sta_DISTINCT_USRS:
|
case Sta_DISTINCT_USRS:
|
||||||
case Sta_CLICKS_PER_USR:
|
case Sta_CLICKS_PER_USR:
|
||||||
sprintf (StrRole," AND %s.Role<>'%u'",
|
sprintf (StrRole," AND %s.Role<>'%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_UNKNOWN);
|
LogTable,(unsigned) Rol_UNKNOWN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Sta_INS_ADMINS:
|
case Sta_INS_ADMINS:
|
||||||
sprintf (StrRole," AND %s.Role='%u'",
|
sprintf (StrRole," AND %s.Role='%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_INS_ADM);
|
LogTable,(unsigned) Rol_INS_ADM);
|
||||||
break;
|
break;
|
||||||
case Sta_CTR_ADMINS:
|
case Sta_CTR_ADMINS:
|
||||||
sprintf (StrRole," AND %s.Role='%u'",
|
sprintf (StrRole," AND %s.Role='%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_CTR_ADM);
|
LogTable,(unsigned) Rol_CTR_ADM);
|
||||||
break;
|
break;
|
||||||
case Sta_DEG_ADMINS:
|
case Sta_DEG_ADMINS:
|
||||||
sprintf (StrRole," AND %s.Role='%u'",
|
sprintf (StrRole," AND %s.Role='%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_DEG_ADM);
|
LogTable,(unsigned) Rol_DEG_ADM);
|
||||||
break;
|
break;
|
||||||
case Sta_TEACHERS:
|
case Sta_TEACHERS:
|
||||||
sprintf (StrRole," AND %s.Role='%u'",
|
sprintf (StrRole," AND %s.Role='%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_TEACHER);
|
LogTable,(unsigned) Rol_TEACHER);
|
||||||
break;
|
break;
|
||||||
case Sta_STUDENTS:
|
case Sta_STUDENTS:
|
||||||
sprintf (StrRole," AND %s.Role='%u'",
|
sprintf (StrRole," AND %s.Role='%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_STUDENT);
|
LogTable,(unsigned) Rol_STUDENT);
|
||||||
break;
|
break;
|
||||||
case Sta_VISITORS:
|
case Sta_VISITORS:
|
||||||
sprintf (StrRole," AND %s.Role='%u'",
|
sprintf (StrRole," AND %s.Role='%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_VISITOR);
|
LogTable,(unsigned) Rol_VISITOR);
|
||||||
break;
|
break;
|
||||||
case Sta_GUESTS:
|
case Sta_GUESTS:
|
||||||
sprintf (StrRole," AND %s.Role='%u'",
|
sprintf (StrRole," AND %s.Role='%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_GUEST__);
|
LogTable,(unsigned) Rol__GUEST_);
|
||||||
break;
|
break;
|
||||||
case Sta_UNKNOWN_USRS:
|
case Sta_UNKNOWN_USRS:
|
||||||
sprintf (StrRole," AND %s.Role='%u'",
|
sprintf (StrRole," AND %s.Role='%u'",
|
||||||
LogTable,(unsigned) Rol_ROLE_UNKNOWN);
|
LogTable,(unsigned) Rol_UNKNOWN);
|
||||||
break;
|
break;
|
||||||
case Sta_ME:
|
case Sta_ME:
|
||||||
sprintf (StrRole," AND %s.UsrCod='%ld'",
|
sprintf (StrRole," AND %s.UsrCod='%ld'",
|
||||||
|
@ -1638,7 +1638,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql
|
||||||
fprintf (Gbl.F.Out,"<td class=\"LOG\" style=\"text-align:center;"
|
fprintf (Gbl.F.Out,"<td class=\"LOG\" style=\"text-align:center;"
|
||||||
" vertical-align:top; background-color:%s;\">",
|
" vertical-align:top; background-color:%s;\">",
|
||||||
Gbl.ColorRows[Gbl.RowEvenOdd]);
|
Gbl.ColorRows[Gbl.RowEvenOdd]);
|
||||||
ID_WriteUsrIDs (&UsrDat,(RoleFromLog == Rol_ROLE_STUDENT));
|
ID_WriteUsrIDs (&UsrDat,(RoleFromLog == Rol_STUDENT));
|
||||||
fprintf (Gbl.F.Out," </td>");
|
fprintf (Gbl.F.Out," </td>");
|
||||||
|
|
||||||
/* Write the first name and the surnames */
|
/* Write the first name and the surnames */
|
||||||
|
@ -1811,7 +1811,7 @@ static void Sta_ShowNumAccessesPerUsr (unsigned long NumRows,MYSQL_RES *mysql_re
|
||||||
fprintf (Gbl.F.Out,"<td class=\"LOG\" style=\"text-align:center;"
|
fprintf (Gbl.F.Out,"<td class=\"LOG\" style=\"text-align:center;"
|
||||||
" vertical-align:top; background-color:%s;\">",
|
" vertical-align:top; background-color:%s;\">",
|
||||||
Gbl.ColorRows[Gbl.RowEvenOdd]);
|
Gbl.ColorRows[Gbl.RowEvenOdd]);
|
||||||
ID_WriteUsrIDs (&UsrDat,(UsrDat.RoleInCurrentCrsDB == Rol_ROLE_STUDENT));
|
ID_WriteUsrIDs (&UsrDat,(UsrDat.RoleInCurrentCrsDB == Rol_STUDENT));
|
||||||
fprintf (Gbl.F.Out," </td>");
|
fprintf (Gbl.F.Out," </td>");
|
||||||
|
|
||||||
/* Write the name and the surnames */
|
/* Write the name and the surnames */
|
||||||
|
@ -1850,7 +1850,7 @@ static void Sta_ShowNumAccessesPerUsr (unsigned long NumRows,MYSQL_RES *mysql_re
|
||||||
" vertical-align:top;\" />"
|
" vertical-align:top;\" />"
|
||||||
" ",
|
" ",
|
||||||
Gbl.Prefs.IconsURL,
|
Gbl.Prefs.IconsURL,
|
||||||
UsrDat.RoleInCurrentCrsDB == Rol_ROLE_STUDENT ? 'c' :
|
UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? 'c' :
|
||||||
'v',
|
'v',
|
||||||
BarWidth);
|
BarWidth);
|
||||||
Str_WriteFloatNum (NumPagesGenerated);
|
Str_WriteFloatNum (NumPagesGenerated);
|
||||||
|
@ -3789,9 +3789,9 @@ static void Sta_GetAndShowUsersStats (void)
|
||||||
Txt_No_of_users,
|
Txt_No_of_users,
|
||||||
Txt_Average_number_of_courses_to_which_a_user_belongs,
|
Txt_Average_number_of_courses_to_which_a_user_belongs,
|
||||||
Txt_Average_number_of_users_belonging_to_a_course);
|
Txt_Average_number_of_users_belonging_to_a_course);
|
||||||
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_STUDENT);
|
Usr_GetAndShowNumUsrsInPlatform (Rol_STUDENT);
|
||||||
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_TEACHER);
|
Usr_GetAndShowNumUsrsInPlatform (Rol_TEACHER);
|
||||||
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_GUEST__); // Users not beloging to any course
|
Usr_GetAndShowNumUsrsInPlatform (Rol__GUEST_); // Users not beloging to any course
|
||||||
|
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
}
|
}
|
||||||
|
@ -3962,8 +3962,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
|
||||||
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs ("");
|
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs ("");
|
||||||
NumCtysWithDegs = Cty_GetNumCtysWithDegs ("");
|
NumCtysWithDegs = Cty_GetNumCtysWithDegs ("");
|
||||||
NumCtysWithCrss = Cty_GetNumCtysWithCrss ("");
|
NumCtysWithCrss = Cty_GetNumCtysWithCrss ("");
|
||||||
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_ROLE_TEACHER,"");
|
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,"");
|
||||||
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,"");
|
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,"");
|
||||||
SubQuery[0] = '\0';
|
SubQuery[0] = '\0';
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
|
@ -3974,8 +3974,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
|
||||||
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs (SubQuery);
|
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs (SubQuery);
|
||||||
NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery);
|
NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery);
|
||||||
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
|
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
|
||||||
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
NumCtysTotal = 1;
|
NumCtysTotal = 1;
|
||||||
|
@ -3985,8 +3985,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
|
||||||
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs (SubQuery);
|
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs (SubQuery);
|
||||||
NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery);
|
NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery);
|
||||||
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
|
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
|
||||||
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
NumCtysTotal = 1;
|
NumCtysTotal = 1;
|
||||||
|
@ -3996,8 +3996,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery);
|
NumCtysWithDegs = Cty_GetNumCtysWithDegs (SubQuery);
|
||||||
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
|
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
|
||||||
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
NumCtysTotal = 1;
|
NumCtysTotal = 1;
|
||||||
|
@ -4007,8 +4007,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
|
||||||
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
||||||
Gbl.CurrentDeg.Deg.DegCod);
|
Gbl.CurrentDeg.Deg.DegCod);
|
||||||
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
|
NumCtysWithCrss = Cty_GetNumCtysWithCrss (SubQuery);
|
||||||
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
NumCtysTotal = 1;
|
NumCtysTotal = 1;
|
||||||
|
@ -4018,8 +4018,8 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
|
||||||
NumCtysWithCrss = 1;
|
NumCtysWithCrss = 1;
|
||||||
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||||
|
@ -4090,8 +4090,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
|
||||||
NumInssWithCtrs = Ins_GetNumInssWithCtrs ("");
|
NumInssWithCtrs = Ins_GetNumInssWithCtrs ("");
|
||||||
NumInssWithDegs = Ins_GetNumInssWithDegs ("");
|
NumInssWithDegs = Ins_GetNumInssWithDegs ("");
|
||||||
NumInssWithCrss = Ins_GetNumInssWithCrss ("");
|
NumInssWithCrss = Ins_GetNumInssWithCrss ("");
|
||||||
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_ROLE_TEACHER,"");
|
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,"");
|
||||||
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,"");
|
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,"");
|
||||||
SubQuery[0] = '\0';
|
SubQuery[0] = '\0';
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
|
@ -4101,8 +4101,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
|
||||||
NumInssWithCtrs = Ins_GetNumInssWithCtrs (SubQuery);
|
NumInssWithCtrs = Ins_GetNumInssWithCtrs (SubQuery);
|
||||||
NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery);
|
NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery);
|
||||||
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
|
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
|
||||||
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
NumInssTotal = 1;
|
NumInssTotal = 1;
|
||||||
|
@ -4111,8 +4111,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
|
||||||
NumInssWithCtrs = Ins_GetNumInssWithCtrs (SubQuery);
|
NumInssWithCtrs = Ins_GetNumInssWithCtrs (SubQuery);
|
||||||
NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery);
|
NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery);
|
||||||
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
|
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
|
||||||
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
NumInssTotal = 1;
|
NumInssTotal = 1;
|
||||||
|
@ -4121,8 +4121,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery);
|
NumInssWithDegs = Ins_GetNumInssWithDegs (SubQuery);
|
||||||
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
|
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
|
||||||
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
NumInssTotal = 1;
|
NumInssTotal = 1;
|
||||||
|
@ -4131,8 +4131,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
|
||||||
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
||||||
Gbl.CurrentDeg.Deg.DegCod);
|
Gbl.CurrentDeg.Deg.DegCod);
|
||||||
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
|
NumInssWithCrss = Ins_GetNumInssWithCrss (SubQuery);
|
||||||
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
NumInssTotal = 1;
|
NumInssTotal = 1;
|
||||||
|
@ -4141,8 +4141,8 @@ static void Sta_GetAndShowNumInssInSWAD (void)
|
||||||
NumInssWithCrss = 1;
|
NumInssWithCrss = 1;
|
||||||
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||||
|
@ -4208,8 +4208,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
|
||||||
NumCtrsTotal = Ctr_GetNumCtrsTotal ();
|
NumCtrsTotal = Ctr_GetNumCtrsTotal ();
|
||||||
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs ("");
|
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs ("");
|
||||||
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss ("");
|
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss ("");
|
||||||
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_TEACHER,"");
|
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,"");
|
||||||
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,"");
|
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,"");
|
||||||
SubQuery[0] = '\0';
|
SubQuery[0] = '\0';
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
|
@ -4218,8 +4218,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
|
||||||
Gbl.CurrentCty.Cty.CtyCod);
|
Gbl.CurrentCty.Cty.CtyCod);
|
||||||
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery);
|
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery);
|
||||||
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
|
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
|
||||||
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
NumCtrsTotal = Ctr_GetNumCtrsInIns (Gbl.CurrentIns.Ins.InsCod);
|
NumCtrsTotal = Ctr_GetNumCtrsInIns (Gbl.CurrentIns.Ins.InsCod);
|
||||||
|
@ -4227,8 +4227,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
|
||||||
Gbl.CurrentIns.Ins.InsCod);
|
Gbl.CurrentIns.Ins.InsCod);
|
||||||
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery);
|
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery);
|
||||||
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
|
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
|
||||||
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
NumCtrsTotal = 1;
|
NumCtrsTotal = 1;
|
||||||
|
@ -4236,8 +4236,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery);
|
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs (SubQuery);
|
||||||
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
|
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
|
||||||
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
NumCtrsTotal = 1;
|
NumCtrsTotal = 1;
|
||||||
|
@ -4245,8 +4245,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
|
||||||
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
||||||
Gbl.CurrentDeg.Deg.DegCod);
|
Gbl.CurrentDeg.Deg.DegCod);
|
||||||
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
|
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss (SubQuery);
|
||||||
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
NumCtrsTotal = 1;
|
NumCtrsTotal = 1;
|
||||||
|
@ -4254,8 +4254,8 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
|
||||||
NumCtrsWithCrss = 1;
|
NumCtrsWithCrss = 1;
|
||||||
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||||
|
@ -4316,8 +4316,8 @@ static void Sta_GetAndShowNumDegsInSWAD (void)
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
NumDegsTotal = Deg_GetNumDegsTotal ();
|
NumDegsTotal = Deg_GetNumDegsTotal ();
|
||||||
NumDegsWithCrss = Deg_GetNumDegsWithCrss ("");
|
NumDegsWithCrss = Deg_GetNumDegsWithCrss ("");
|
||||||
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,"");
|
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,"");
|
||||||
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,"");
|
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,"");
|
||||||
SubQuery[0] = '\0';
|
SubQuery[0] = '\0';
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
|
@ -4325,40 +4325,40 @@ static void Sta_GetAndShowNumDegsInSWAD (void)
|
||||||
sprintf (SubQuery,"institutions.CtyCod='%ld' AND ",
|
sprintf (SubQuery,"institutions.CtyCod='%ld' AND ",
|
||||||
Gbl.CurrentCty.Cty.CtyCod);
|
Gbl.CurrentCty.Cty.CtyCod);
|
||||||
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
|
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
|
||||||
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
NumDegsTotal = Deg_GetNumDegsInIns (Gbl.CurrentIns.Ins.InsCod);
|
NumDegsTotal = Deg_GetNumDegsInIns (Gbl.CurrentIns.Ins.InsCod);
|
||||||
sprintf (SubQuery,"centres.InsCod='%ld' AND ",
|
sprintf (SubQuery,"centres.InsCod='%ld' AND ",
|
||||||
Gbl.CurrentIns.Ins.InsCod);
|
Gbl.CurrentIns.Ins.InsCod);
|
||||||
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
|
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
|
||||||
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
NumDegsTotal = Deg_GetNumDegsInCtr (Gbl.CurrentCtr.Ctr.CtrCod);
|
NumDegsTotal = Deg_GetNumDegsInCtr (Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
sprintf (SubQuery,"degrees.CtrCod='%ld' AND ",
|
sprintf (SubQuery,"degrees.CtrCod='%ld' AND ",
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
|
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
|
||||||
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
NumDegsTotal = 1;
|
NumDegsTotal = 1;
|
||||||
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
||||||
Gbl.CurrentDeg.Deg.DegCod);
|
Gbl.CurrentDeg.Deg.DegCod);
|
||||||
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
|
NumDegsWithCrss = Deg_GetNumDegsWithCrss (SubQuery);
|
||||||
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
NumDegsTotal = 1;
|
NumDegsTotal = 1;
|
||||||
NumDegsWithCrss = 1;
|
NumDegsWithCrss = 1;
|
||||||
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||||
|
@ -4414,44 +4414,44 @@ static void Sta_GetAndShowNumCrssInSWAD (void)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
NumCrssTotal = Crs_GetNumCrssTotal ();
|
NumCrssTotal = Crs_GetNumCrssTotal ();
|
||||||
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,"");
|
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,"");
|
||||||
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,"");
|
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,"");
|
||||||
SubQuery[0] = '\0';
|
SubQuery[0] = '\0';
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
NumCrssTotal = Crs_GetNumCrssInCty (Gbl.CurrentCty.Cty.CtyCod);
|
NumCrssTotal = Crs_GetNumCrssInCty (Gbl.CurrentCty.Cty.CtyCod);
|
||||||
sprintf (SubQuery,"institutions.CtyCod='%ld' AND ",
|
sprintf (SubQuery,"institutions.CtyCod='%ld' AND ",
|
||||||
Gbl.CurrentCty.Cty.CtyCod);
|
Gbl.CurrentCty.Cty.CtyCod);
|
||||||
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
NumCrssTotal = Crs_GetNumCrssInIns (Gbl.CurrentIns.Ins.InsCod);
|
NumCrssTotal = Crs_GetNumCrssInIns (Gbl.CurrentIns.Ins.InsCod);
|
||||||
sprintf (SubQuery,"centres.InsCod='%ld' AND ",
|
sprintf (SubQuery,"centres.InsCod='%ld' AND ",
|
||||||
Gbl.CurrentIns.Ins.InsCod);
|
Gbl.CurrentIns.Ins.InsCod);
|
||||||
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
NumCrssTotal = Crs_GetNumCrssInCtr (Gbl.CurrentCtr.Ctr.CtrCod);
|
NumCrssTotal = Crs_GetNumCrssInCtr (Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
sprintf (SubQuery,"degrees.CtrCod='%ld' AND ",
|
sprintf (SubQuery,"degrees.CtrCod='%ld' AND ",
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
NumCrssTotal = Crs_GetNumCrssInDeg (Gbl.CurrentDeg.Deg.DegCod);
|
NumCrssTotal = Crs_GetNumCrssInDeg (Gbl.CurrentDeg.Deg.DegCod);
|
||||||
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
sprintf (SubQuery,"courses.DegCod='%ld' AND ",
|
||||||
Gbl.CurrentDeg.Deg.DegCod);
|
Gbl.CurrentDeg.Deg.DegCod);
|
||||||
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
NumCrssTotal = 1;
|
NumCrssTotal = 1;
|
||||||
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
sprintf (SubQuery,"crs_usr.CrsCod='%ld' AND ",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
|
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_TEACHER,SubQuery);
|
||||||
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
|
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_STUDENT,SubQuery);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||||
|
@ -4888,7 +4888,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
switch (Scope)
|
switch (Scope)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data");
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data");
|
||||||
else
|
else
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
||||||
|
@ -4896,7 +4896,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
(unsigned) Role);
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||||
" WHERE institutions.CtyCod='%ld'"
|
" WHERE institutions.CtyCod='%ld'"
|
||||||
|
@ -4917,7 +4917,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
Gbl.CurrentCty.Cty.CtyCod,(unsigned) Role);
|
Gbl.CurrentCty.Cty.CtyCod,(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" FROM centres,degrees,courses,crs_usr"
|
" FROM centres,degrees,courses,crs_usr"
|
||||||
" WHERE centres.InsCod='%ld'"
|
" WHERE centres.InsCod='%ld'"
|
||||||
|
@ -4936,7 +4936,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
Gbl.CurrentIns.Ins.InsCod,(unsigned) Role);
|
Gbl.CurrentIns.Ins.InsCod,(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" FROM degrees,courses,crs_usr"
|
" FROM degrees,courses,crs_usr"
|
||||||
" WHERE degrees.CtrCod='%ld'"
|
" WHERE degrees.CtrCod='%ld'"
|
||||||
|
@ -4953,7 +4953,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Role);
|
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" FROM courses,crs_usr"
|
" FROM courses,crs_usr"
|
||||||
" WHERE courses.DegCod='%ld'"
|
" WHERE courses.DegCod='%ld'"
|
||||||
|
@ -4968,7 +4968,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Role);
|
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod) FROM crs_usr"
|
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod) FROM crs_usr"
|
||||||
" WHERE CrsCod='%ld'",
|
" WHERE CrsCod='%ld'",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
@ -6304,7 +6304,7 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
|
||||||
Txt_Number_of_BR_e_mails);
|
Txt_Number_of_BR_e_mails);
|
||||||
|
|
||||||
/***** Get total number of users in platform *****/
|
/***** Get total number of users in platform *****/
|
||||||
NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsers (Gbl.Scope.Current,Rol_ROLE_UNKNOWN);
|
NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsers (Gbl.Scope.Current,Rol_UNKNOWN);
|
||||||
|
|
||||||
/***** Get total number of users who want to be notified by e-mail on some event, from database *****/
|
/***** Get total number of users who want to be notified by e-mail on some event, from database *****/
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
|
|
|
@ -713,6 +713,7 @@ Str_FROM_HTML
|
||||||
ChangeTo can be:
|
ChangeTo can be:
|
||||||
Str_DONT_CHANGE
|
Str_DONT_CHANGE
|
||||||
Str_TO_TEXT
|
Str_TO_TEXT
|
||||||
|
Str_TO_MARKDOWN
|
||||||
Str_TO_HTML
|
Str_TO_HTML
|
||||||
Str_TO_RIGOROUS_HTML
|
Str_TO_RIGOROUS_HTML
|
||||||
For example the string "Nueva++de+San+Ant%F3n"
|
For example the string "Nueva++de+San+Ant%F3n"
|
||||||
|
@ -768,25 +769,19 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
||||||
break;
|
break;
|
||||||
case '%': /***** Change "%XX" --> "&#decimal_number;" *****/
|
case '%': /***** Change "%XX" --> "&#decimal_number;" *****/
|
||||||
IsSpecialChar = true;
|
IsSpecialChar = true;
|
||||||
/* Get the value of the special char */
|
|
||||||
/* if (sscanf (PtrSrc+1,"%4X",&SpecialChar) == 1)
|
|
||||||
LengthSpecStrSrc = 5;
|
|
||||||
else if (sscanf (PtrSrc+1,"%3X",&SpecialChar) == 1)
|
|
||||||
LengthSpecStrSrc = 4;
|
|
||||||
else if (sscanf (PtrSrc+1,"%2X",&SpecialChar) == 1)
|
|
||||||
LengthSpecStrSrc = 3;
|
|
||||||
else if (sscanf (PtrSrc+1,"%1X",&SpecialChar) == 1)
|
|
||||||
LengthSpecStrSrc = 2; */ // TODO: BUG -> Fix it!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
sscanf (PtrSrc+1,"%2X",&SpecialChar);
|
sscanf (PtrSrc+1,"%2X",&SpecialChar);
|
||||||
LengthSpecStrSrc = 3;
|
LengthSpecStrSrc = 3;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case '\'': /***** Change "'" --> "'" to avoid SQL code injection *****/
|
case '\'': /***** Change "'" --> "'" to avoid SQL code injection *****/
|
||||||
IsSpecialChar = true;
|
IsSpecialChar = true;
|
||||||
LengthSpecStrSrc = 1;
|
LengthSpecStrSrc = 1;
|
||||||
SpecialChar = 0x27;
|
SpecialChar = 0x27;
|
||||||
break;
|
break;
|
||||||
|
case '\\':
|
||||||
|
IsSpecialChar = true;
|
||||||
|
LengthSpecStrSrc = 1;
|
||||||
|
SpecialChar = 0x5C;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
IsSpecialChar = false;
|
IsSpecialChar = false;
|
||||||
NumPrintableCharsFromReturn++;
|
NumPrintableCharsFromReturn++;
|
||||||
|
@ -808,6 +803,11 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
||||||
LengthSpecStrSrc = 1;
|
LengthSpecStrSrc = 1;
|
||||||
SpecialChar = 0x27;
|
SpecialChar = 0x27;
|
||||||
break;
|
break;
|
||||||
|
case '\\':
|
||||||
|
IsSpecialChar = true;
|
||||||
|
LengthSpecStrSrc = 1;
|
||||||
|
SpecialChar = 0x5C;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if ((unsigned char) *PtrSrc < 0x20)
|
if ((unsigned char) *PtrSrc < 0x20)
|
||||||
{
|
{
|
||||||
|
@ -873,7 +873,14 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
||||||
ThereIsSpaceChar = true;
|
ThereIsSpaceChar = true;
|
||||||
break;
|
break;
|
||||||
case 0x22: /* "%22" --> """ (double comilla) */
|
case 0x22: /* "%22" --> """ (double comilla) */
|
||||||
sprintf (StrSpecialChar,"""); // Double comilla is always stored as HTML code to avoid problems when displaying it
|
if (ChangeTo == Str_TO_MARKDOWN)
|
||||||
|
{ // Escape sequence for database, two characters
|
||||||
|
StrSpecialChar[0] = '\\'; // 1. An inverted bar
|
||||||
|
StrSpecialChar[1] = '\"'; // 2. A double comilla
|
||||||
|
StrSpecialChar[2] = '\0'; // End of string
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sprintf (StrSpecialChar,"""); // Double comilla is stored as HTML code to avoid problems when displaying it
|
||||||
NumPrintableCharsFromReturn++;
|
NumPrintableCharsFromReturn++;
|
||||||
ThereIsSpaceChar = false;
|
ThereIsSpaceChar = false;
|
||||||
break;
|
break;
|
||||||
|
@ -883,13 +890,19 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
||||||
ThereIsSpaceChar = false;
|
ThereIsSpaceChar = false;
|
||||||
break;
|
break;
|
||||||
case 0x26: /* "%26" --> "&" (&) */
|
case 0x26: /* "%26" --> "&" (&) */
|
||||||
// sprintf (StrSpecialChar,"&"); // Ampersand is always stored as HTML code to avoid problems when displaying it
|
|
||||||
strcpy (StrSpecialChar,"&");
|
strcpy (StrSpecialChar,"&");
|
||||||
NumPrintableCharsFromReturn++;
|
NumPrintableCharsFromReturn++;
|
||||||
ThereIsSpaceChar = false;
|
ThereIsSpaceChar = false;
|
||||||
break;
|
break;
|
||||||
case 0x27: /* "%27" --> "'" (single comilla) */
|
case 0x27: /* "%27" --> "'" (single comilla) */
|
||||||
sprintf (StrSpecialChar,"'"); // Comilla is always stored as HTML code to avoid problem when querying database (SQL code injection)
|
if (ChangeTo == Str_TO_MARKDOWN)
|
||||||
|
{ // Escape sequence for database, two characters
|
||||||
|
StrSpecialChar[0] = '\\'; // 1. An inverted bar
|
||||||
|
StrSpecialChar[1] = '\''; // 2. A single comilla
|
||||||
|
StrSpecialChar[2] = '\0'; // End of string
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sprintf (StrSpecialChar,"'"); // Single comilla is stored as HTML code to avoid problem when querying database (SQL code injection)
|
||||||
NumPrintableCharsFromReturn++;
|
NumPrintableCharsFromReturn++;
|
||||||
ThereIsSpaceChar = false;
|
ThereIsSpaceChar = false;
|
||||||
break;
|
break;
|
||||||
|
@ -914,12 +927,18 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
||||||
ThereIsSpaceChar = false;
|
ThereIsSpaceChar = false;
|
||||||
break;
|
break;
|
||||||
case 0x3C: /* "%3C" --> "<" (<) */
|
case 0x3C: /* "%3C" --> "<" (<) */
|
||||||
strcpy (StrSpecialChar,"<"); // "<" is always stored as HTML code to avoid problems when displaying it
|
if (ChangeTo == Str_TO_MARKDOWN)
|
||||||
|
strcpy (StrSpecialChar,"<");
|
||||||
|
else
|
||||||
|
strcpy (StrSpecialChar,"<"); // "<" is stored as HTML code to avoid problems when displaying it
|
||||||
NumPrintableCharsFromReturn++;
|
NumPrintableCharsFromReturn++;
|
||||||
ThereIsSpaceChar = false;
|
ThereIsSpaceChar = false;
|
||||||
break;
|
break;
|
||||||
case 0x3E: /* "%3E" --> ">" (>) */
|
case 0x3E: /* "%3E" --> ">" (>) */
|
||||||
strcpy (StrSpecialChar,">"); // ">" is always stored as HTML code to avoid problems when displaying it
|
if (ChangeTo == Str_TO_MARKDOWN)
|
||||||
|
strcpy (StrSpecialChar,">");
|
||||||
|
else
|
||||||
|
strcpy (StrSpecialChar,">"); // ">" is stored as HTML code to avoid problems when displaying it
|
||||||
NumPrintableCharsFromReturn++;
|
NumPrintableCharsFromReturn++;
|
||||||
ThereIsSpaceChar = false;
|
ThereIsSpaceChar = false;
|
||||||
break;
|
break;
|
||||||
|
@ -928,6 +947,18 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
||||||
NumPrintableCharsFromReturn++;
|
NumPrintableCharsFromReturn++;
|
||||||
ThereIsSpaceChar = false;
|
ThereIsSpaceChar = false;
|
||||||
break;
|
break;
|
||||||
|
case 0x5C: /* "%5C" --> "\" (\) */
|
||||||
|
if (ChangeTo == Str_TO_MARKDOWN)
|
||||||
|
{ // Escape sequence for database, two characters
|
||||||
|
StrSpecialChar[0] = '\\'; // 1. An inverted bar
|
||||||
|
StrSpecialChar[1] = '\\'; // 2. An inverted bar
|
||||||
|
StrSpecialChar[2] = '\0'; // End of string
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strcpy (StrSpecialChar,"\"); // "\" is stored as HTML code to avoid problems when displaying it
|
||||||
|
NumPrintableCharsFromReturn++;
|
||||||
|
ThereIsSpaceChar = false;
|
||||||
|
break;
|
||||||
case 0xC1: /* "%C1" --> "Á" */
|
case 0xC1: /* "%C1" --> "Á" */
|
||||||
strcpy (StrSpecialChar,"Á");
|
strcpy (StrSpecialChar,"Á");
|
||||||
NumPrintableCharsFromReturn++;
|
NumPrintableCharsFromReturn++;
|
||||||
|
@ -1000,8 +1031,9 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
||||||
break;
|
break;
|
||||||
default: /* The rest of special chars are stored as special code */
|
default: /* The rest of special chars are stored as special code */
|
||||||
sprintf (StrSpecialChar,
|
sprintf (StrSpecialChar,
|
||||||
ChangeTo == Str_TO_TEXT ? "%c" :
|
(ChangeTo == Str_TO_TEXT ||
|
||||||
"&#%u;",
|
ChangeTo == Str_TO_MARKDOWN) ? "%c" :
|
||||||
|
"&#%u;",
|
||||||
SpecialChar);
|
SpecialChar);
|
||||||
NumPrintableCharsFromReturn++;
|
NumPrintableCharsFromReturn++;
|
||||||
ThereIsSpaceChar = false;
|
ThereIsSpaceChar = false;
|
||||||
|
|
|
@ -59,6 +59,7 @@ typedef enum
|
||||||
Str_TO_RIGOROUS_HTML,
|
Str_TO_RIGOROUS_HTML,
|
||||||
Str_TO_HTML,
|
Str_TO_HTML,
|
||||||
Str_TO_TEXT,
|
Str_TO_TEXT,
|
||||||
|
Str_TO_MARKDOWN,
|
||||||
} Str_ChangeTo_t;
|
} Str_ChangeTo_t;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -266,11 +266,11 @@ static bool Svy_CheckIfICanCreateSvy (void)
|
||||||
{
|
{
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
return (Gbl.CurrentCrs.Crs.CrsCod > 0);
|
return (Gbl.CurrentCrs.Crs.CrsCod > 0);
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
return (Gbl.CurrentDeg.Deg.DegCod > 0);
|
return (Gbl.CurrentDeg.Deg.DegCod > 0);
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -490,8 +490,8 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,bool Sh
|
||||||
Svy.Status.Visible ? "ASG_GRP" :
|
Svy.Status.Visible ? "ASG_GRP" :
|
||||||
"ASG_GRP_LIGHT",
|
"ASG_GRP_LIGHT",
|
||||||
Txt_Users);
|
Txt_Users);
|
||||||
for (Role = Rol_ROLE_STUDENT, RolesSelected = false;
|
for (Role = Rol_STUDENT, RolesSelected = false;
|
||||||
Role <= Rol_ROLE_TEACHER;
|
Role <= Rol_TEACHER;
|
||||||
Role++)
|
Role++)
|
||||||
{
|
{
|
||||||
if (RolesSelected)
|
if (RolesSelected)
|
||||||
|
@ -797,7 +797,7 @@ void Svy_GetListSurveys (void)
|
||||||
{
|
{
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
HiddenSubQuery[0] = '\0'; // Show all surveys, visible or hidden
|
HiddenSubQuery[0] = '\0'; // Show all surveys, visible or hidden
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -812,12 +812,12 @@ void Svy_GetListSurveys (void)
|
||||||
OrderBySubQuery);
|
OrderBySubQuery);
|
||||||
}
|
}
|
||||||
else if ((Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.CurrentCrs.Crs.CrsCod < 0) || // If degree selected, but no course selected
|
else if ((Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.CurrentCrs.Crs.CrsCod < 0) || // If degree selected, but no course selected
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM) // or if I am a degree administrator
|
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM) // or if I am a degree administrator
|
||||||
{
|
{
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
HiddenSubQuery[0] = '\0'; // Show all surveys, visible or hidden
|
HiddenSubQuery[0] = '\0'; // Show all surveys, visible or hidden
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -834,12 +834,12 @@ void Svy_GetListSurveys (void)
|
||||||
OrderBySubQuery);
|
OrderBySubQuery);
|
||||||
}
|
}
|
||||||
else if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
else if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
||||||
Gbl.Usrs.Me.LoggedRole != Rol_ROLE_DEG_ADM)
|
Gbl.Usrs.Me.LoggedRole != Rol_DEG_ADM)
|
||||||
{
|
{
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
HiddenSubQuery[0] = '\0'; // Show all surveys, visible or hidden
|
HiddenSubQuery[0] = '\0'; // Show all surveys, visible or hidden
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1005,7 +1005,7 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
|
||||||
Can I edit survey? */
|
Can I edit survey? */
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
Svy->Status.ICanViewResults = (Svy->NumQsts != 0) &&
|
Svy->Status.ICanViewResults = (Svy->NumQsts != 0) &&
|
||||||
Svy->Status.Visible &&
|
Svy->Status.Visible &&
|
||||||
Svy->Status.Open &&
|
Svy->Status.Open &&
|
||||||
|
@ -1014,19 +1014,19 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
|
||||||
Svy->Status.IHaveAnswered;
|
Svy->Status.IHaveAnswered;
|
||||||
Svy->Status.ICanEdit = false;
|
Svy->Status.ICanEdit = false;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
Svy->Status.ICanViewResults = (Svy->NumQsts != 0) &&
|
Svy->Status.ICanViewResults = (Svy->NumQsts != 0) &&
|
||||||
!Svy->Status.ICanAnswer;
|
!Svy->Status.ICanAnswer;
|
||||||
Svy->Status.ICanEdit = Svy->CrsCod > 0 &&
|
Svy->Status.ICanEdit = Svy->CrsCod > 0 &&
|
||||||
Svy->Status.IBelongToDegCrsGrps;
|
Svy->Status.IBelongToDegCrsGrps;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
Svy->Status.ICanViewResults = false;
|
Svy->Status.ICanViewResults = false;
|
||||||
Svy->Status.ICanEdit = Svy->DegCod > 0 &&
|
Svy->Status.ICanEdit = Svy->DegCod > 0 &&
|
||||||
Svy->CrsCod < 0 &&
|
Svy->CrsCod < 0 &&
|
||||||
Svy->Status.IBelongToDegCrsGrps;
|
Svy->Status.IBelongToDegCrsGrps;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Svy->Status.ICanViewResults = (Svy->NumQsts != 0);
|
Svy->Status.ICanViewResults = (Svy->NumQsts != 0);
|
||||||
Svy->Status.ICanEdit = true;
|
Svy->Status.ICanEdit = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1531,7 +1531,7 @@ void Svy_RequestCreatOrEditSvy (void)
|
||||||
Svy.DateTimes[Svy_END_TIME ].Time.Minute = 59;
|
Svy.DateTimes[Svy_END_TIME ].Time.Minute = 59;
|
||||||
Svy.DateTimes[Svy_END_TIME ].Time.Second = 59;
|
Svy.DateTimes[Svy_END_TIME ].Time.Second = 59;
|
||||||
Svy.Title[0] = '\0';
|
Svy.Title[0] = '\0';
|
||||||
Svy.Roles = (1 << Rol_ROLE_STUDENT);
|
Svy.Roles = (1 << Rol_STUDENT);
|
||||||
Svy.NumQsts = 0;
|
Svy.NumQsts = 0;
|
||||||
Svy.NumUsrs = 0;
|
Svy.NumUsrs = 0;
|
||||||
Svy.Status.Visible = true;
|
Svy.Status.Visible = true;
|
||||||
|
@ -1697,7 +1697,7 @@ static bool Svy_SetDefaultAndAllowedForEdition (void)
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||||
{
|
{
|
||||||
Gbl.Scope.Default = Sco_SCOPE_CRS;
|
Gbl.Scope.Default = Sco_SCOPE_CRS;
|
||||||
|
@ -1705,7 +1705,7 @@ static bool Svy_SetDefaultAndAllowedForEdition (void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
||||||
{
|
{
|
||||||
Gbl.Scope.Default = Sco_SCOPE_DEG;
|
Gbl.Scope.Default = Sco_SCOPE_DEG;
|
||||||
|
@ -1713,7 +1713,7 @@ static bool Svy_SetDefaultAndAllowedForEdition (void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Gbl.Scope.Default = Sco_SCOPE_SYS;
|
Gbl.Scope.Default = Sco_SCOPE_SYS;
|
||||||
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
|
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
|
||||||
// 1 << Sco_SCOPE_CTY | // TODO: Add this scope
|
// 1 << Sco_SCOPE_CTY | // TODO: Add this scope
|
||||||
|
|
34
swad_test.c
34
swad_test.c
|
@ -252,9 +252,9 @@ void Tst_ShowFormAskTst (void)
|
||||||
Tst_GetConfigTstFromDB ();
|
Tst_GetConfigTstFromDB ();
|
||||||
|
|
||||||
/***** Put form to go to test edition and configuration *****/
|
/***** Put form to go to test edition and configuration *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT ||
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
|
Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
Tst_PutFormToSeeResultsOfUsersTests ();
|
Tst_PutFormToSeeResultsOfUsersTests ();
|
||||||
|
@ -314,7 +314,7 @@ static void Tst_PutFormToSeeResultsOfUsersTests (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Results_tests;
|
extern const char *Txt_Results_tests;
|
||||||
|
|
||||||
Act_PutContextualLink (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT ? ActReqSeeMyTstExa :
|
Act_PutContextualLink (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ? ActReqSeeMyTstExa :
|
||||||
ActReqSeeUsrTstExa,
|
ActReqSeeUsrTstExa,
|
||||||
NULL,"file",Txt_Results_tests);
|
NULL,"file",Txt_Results_tests);
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ void Tst_ShowNewTestExam (void)
|
||||||
Tst_SetTstStatus (NumAccessesTst,Tst_STATUS_SHOWN_BUT_NOT_ASSESSED);
|
Tst_SetTstStatus (NumAccessesTst,Tst_STATUS_SHOWN_BUT_NOT_ASSESSED);
|
||||||
|
|
||||||
/***** Update date-time of my next allowed access to test *****/
|
/***** Update date-time of my next allowed access to test *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)
|
||||||
Tst_UpdateLastAccTst ();
|
Tst_UpdateLastAccTst ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ static bool Tst_CheckIfNextTstAllowed (void)
|
||||||
unsigned Year,Month,Day,Hour,Minute,Second;
|
unsigned Year,Month,Day,Hour,Minute,Second;
|
||||||
|
|
||||||
/***** Superusers are allowed to do all test they want *****/
|
/***** Superusers are allowed to do all test they want *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/***** Get date of next allowed access to test from database *****/
|
/***** Get date of next allowed access to test from database *****/
|
||||||
|
@ -889,7 +889,7 @@ static void Tst_ShowTstResultAfterAssess (long TstCod,unsigned *NumQstsNotBlank,
|
||||||
(*NumQstsNotBlank)++;
|
(*NumQstsNotBlank)++;
|
||||||
|
|
||||||
/***** Update the number of accesses and the score of this question *****/
|
/***** Update the number of accesses and the score of this question *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)
|
||||||
Tst_UpdateScoreQst (QstCod,ScoreThisQst,AnswerIsNotBlank);
|
Tst_UpdateScoreQst (QstCod,ScoreThisQst,AnswerIsNotBlank);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -5951,8 +5951,8 @@ void Tst_SelUsrsToSeeUsrsTstExams (void)
|
||||||
Usr_ShowFormsToSelectUsrListType (ActReqSeeUsrTstExa);
|
Usr_ShowFormsToSelectUsrListType (ActReqSeeUsrTstExa);
|
||||||
|
|
||||||
/***** Get and order lists of users from this course *****/
|
/***** Get and order lists of users from this course *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_TEACHER,Sco_SCOPE_CRS,NULL,false);
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstTchs.NumUsrs ||
|
if (Gbl.Usrs.LstTchs.NumUsrs ||
|
||||||
Gbl.Usrs.LstStds.NumUsrs)
|
Gbl.Usrs.LstStds.NumUsrs)
|
||||||
|
@ -5970,8 +5970,8 @@ void Tst_SelUsrsToSeeUsrsTstExams (void)
|
||||||
|
|
||||||
/***** Put list of users to select some of them *****/
|
/***** Put list of users to select some of them *****/
|
||||||
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
Lay_StartRoundFrameTable10 (NULL,0,NULL);
|
||||||
Usr_ListUsersToSelect (Rol_ROLE_TEACHER);
|
Usr_ListUsersToSelect (Rol_TEACHER);
|
||||||
Usr_ListUsersToSelect (Rol_ROLE_STUDENT);
|
Usr_ListUsersToSelect (Rol_STUDENT);
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
@ -5987,7 +5987,7 @@ void Tst_SelUsrsToSeeUsrsTstExams (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_UNKNOWN);
|
Usr_ShowWarningNoUsersFound (Rol_UNKNOWN);
|
||||||
|
|
||||||
/***** Free memory for users' list *****/
|
/***** Free memory for users' list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
||||||
|
@ -6206,7 +6206,7 @@ static void Tst_ShowResultsOfTestExams (struct UsrData *UsrDat)
|
||||||
double TotalScoreOfAllExams = 0.0;
|
double TotalScoreOfAllExams = 0.0;
|
||||||
unsigned NumExamsVisibleByTchs = 0;
|
unsigned NumExamsVisibleByTchs = 0;
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
bool IAmATeacher = (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER);
|
bool IAmATeacher = (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER);
|
||||||
bool ICanViewExam;
|
bool ICanViewExam;
|
||||||
bool ICanViewScore;
|
bool ICanViewScore;
|
||||||
char *ClassDat;
|
char *ClassDat;
|
||||||
|
@ -6489,15 +6489,15 @@ static void Tst_ShowDataUsr (struct UsrData *UsrDat,unsigned NumExams)
|
||||||
fprintf (Gbl.F.Out," style=\"text-align:left; vertical-align:top;"
|
fprintf (Gbl.F.Out," style=\"text-align:left; vertical-align:top;"
|
||||||
" background-color:%s;\">",
|
" background-color:%s;\">",
|
||||||
Gbl.ColorRows[Gbl.RowEvenOdd]);
|
Gbl.ColorRows[Gbl.RowEvenOdd]);
|
||||||
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_ROLE_STUDENT ? ActSeeRecOneStd :
|
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActSeeRecOneStd :
|
||||||
ActSeeRecOneTch);
|
ActSeeRecOneTch);
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||||
Act_LinkFormSubmit (UsrDat->FullName,"MSG_AUT");
|
Act_LinkFormSubmit (UsrDat->FullName,"MSG_AUT");
|
||||||
|
|
||||||
/***** Show user's ID *****/
|
/***** Show user's ID *****/
|
||||||
ID_WriteUsrIDs (UsrDat,
|
ID_WriteUsrIDs (UsrDat,
|
||||||
(UsrDat->RoleInCurrentCrsDB == Rol_ROLE_TEACHER ? ID_ICanSeeTeacherID (UsrDat) :
|
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ID_ICanSeeTeacherID (UsrDat) :
|
||||||
(Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER)));
|
(Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)));
|
||||||
|
|
||||||
/***** Show user's name *****/
|
/***** Show user's name *****/
|
||||||
fprintf (Gbl.F.Out,"<br />%s",UsrDat->Surname1);
|
fprintf (Gbl.F.Out,"<br />%s",UsrDat->Surname1);
|
||||||
|
@ -6567,7 +6567,7 @@ void Tst_ShowOneTestExam (void)
|
||||||
case ActSeeOneTstExaMe:
|
case ActSeeOneTstExaMe:
|
||||||
if (Gbl.Usrs.Other.UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // The exam is not mine
|
if (Gbl.Usrs.Other.UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // The exam is not mine
|
||||||
Lay_ShowErrorAndExit ("You can not view this test exam.");
|
Lay_ShowErrorAndExit ("You can not view this test exam.");
|
||||||
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.LoggedRole < Rol_TEACHER)
|
||||||
{
|
{
|
||||||
// Students only can view score if feedback type allows it
|
// Students only can view score if feedback type allows it
|
||||||
Tst_GetConfigTstFromDB (); // To get feedback type
|
Tst_GetConfigTstFromDB (); // To get feedback type
|
||||||
|
|
|
@ -224,9 +224,9 @@ void TT_ShowClassTimeTable (void)
|
||||||
extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES];
|
extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES];
|
||||||
TT_TimeTableType_t TimeTableType = TT_COURSE_TIMETABLE;
|
TT_TimeTableType_t TimeTableType = TT_COURSE_TIMETABLE;
|
||||||
bool PutEditButton = (Gbl.CurrentAct == ActSeeCrsTimTbl &&
|
bool PutEditButton = (Gbl.CurrentAct == ActSeeCrsTimTbl &&
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER);
|
Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER);
|
||||||
bool PutEditOfficeHours = (Gbl.CurrentAct == ActSeeMyTimTbl &&
|
bool PutEditOfficeHours = (Gbl.CurrentAct == ActSeeMyTimTbl &&
|
||||||
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_ROLE_TEACHER)));
|
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_TEACHER)));
|
||||||
bool PrintView = (Gbl.CurrentAct == ActPrnCrsTimTbl ||
|
bool PrintView = (Gbl.CurrentAct == ActPrnCrsTimTbl ||
|
||||||
Gbl.CurrentAct == ActPrnMyTimTbl);
|
Gbl.CurrentAct == ActPrnMyTimTbl);
|
||||||
|
|
||||||
|
|
222
swad_user.c
222
swad_user.c
|
@ -229,7 +229,7 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
|
||||||
UsrDat->EncryptedUsrCod[0] = '\0';
|
UsrDat->EncryptedUsrCod[0] = '\0';
|
||||||
UsrDat->Nickname[0] = '\0';
|
UsrDat->Nickname[0] = '\0';
|
||||||
UsrDat->Password[0] = '\0';
|
UsrDat->Password[0] = '\0';
|
||||||
UsrDat->RoleInCurrentCrsDB = Rol_ROLE_UNKNOWN;
|
UsrDat->RoleInCurrentCrsDB = Rol_UNKNOWN;
|
||||||
UsrDat->Roles = 0;
|
UsrDat->Roles = 0;
|
||||||
UsrDat->Accepted = true;
|
UsrDat->Accepted = true;
|
||||||
|
|
||||||
|
@ -420,10 +420,10 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
||||||
/* Get roles */
|
/* Get roles */
|
||||||
UsrDat->RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
|
UsrDat->RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
|
||||||
UsrDat->Roles = Rol_GetRolesInAllCrss (UsrDat->UsrCod);
|
UsrDat->Roles = Rol_GetRolesInAllCrss (UsrDat->UsrCod);
|
||||||
if (UsrDat->RoleInCurrentCrsDB == Rol_ROLE_UNKNOWN)
|
if (UsrDat->RoleInCurrentCrsDB == Rol_UNKNOWN)
|
||||||
UsrDat->RoleInCurrentCrsDB = (UsrDat->Roles < (1 << Rol_ROLE_STUDENT)) ?
|
UsrDat->RoleInCurrentCrsDB = (UsrDat->Roles < (1 << Rol_STUDENT)) ?
|
||||||
Rol_ROLE_GUEST__ : // User does not belong to any course
|
Rol__GUEST_ : // User does not belong to any course
|
||||||
Rol_ROLE_VISITOR; // User belongs to some courses
|
Rol_VISITOR; // User belongs to some courses
|
||||||
|
|
||||||
/* Get name */
|
/* Get name */
|
||||||
strncpy (UsrDat->Surname1 ,row[2],sizeof (UsrDat->Surname1 )-1);
|
strncpy (UsrDat->Surname1 ,row[2],sizeof (UsrDat->Surname1 )-1);
|
||||||
|
@ -2185,8 +2185,8 @@ static bool Usr_ChkUsrAndGetUsrDataFromExternalLogin (void)
|
||||||
ReturnCode = WEXITSTATUS(ReturnCode);
|
ReturnCode = WEXITSTATUS(ReturnCode);
|
||||||
switch (ReturnCode)
|
switch (ReturnCode)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT: // Student
|
case Rol_STUDENT: // Student
|
||||||
case Rol_ROLE_TEACHER: // Teacher
|
case Rol_TEACHER: // Teacher
|
||||||
Gbl.Imported.ExternalRole = (Rol_Role_t) ReturnCode;
|
Gbl.Imported.ExternalRole = (Rol_Role_t) ReturnCode;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2299,7 +2299,7 @@ static void Usr_SetUsrRoleAndPrefs (void)
|
||||||
|
|
||||||
/***** Set the user's role I am logged *****/
|
/***** Set the user's role I am logged *****/
|
||||||
Gbl.Usrs.Me.MaxRole = Rol_GetMaxRole (Gbl.Usrs.Me.UsrDat.Roles);
|
Gbl.Usrs.Me.MaxRole = Rol_GetMaxRole (Gbl.Usrs.Me.UsrDat.Roles);
|
||||||
Gbl.Usrs.Me.LoggedRole = (Gbl.Usrs.Me.RoleFromSession == Rol_ROLE_UNKNOWN) ? // If no logged role retrieved from session...
|
Gbl.Usrs.Me.LoggedRole = (Gbl.Usrs.Me.RoleFromSession == Rol_UNKNOWN) ? // If no logged role retrieved from session...
|
||||||
Gbl.Usrs.Me.MaxRole : // ...set current logged role to maximum role in database
|
Gbl.Usrs.Me.MaxRole : // ...set current logged role to maximum role in database
|
||||||
Gbl.Usrs.Me.RoleFromSession; // Get logged role from session
|
Gbl.Usrs.Me.RoleFromSession; // Get logged role from session
|
||||||
|
|
||||||
|
@ -2377,34 +2377,34 @@ static void Usr_SetUsrRoleAndPrefs (void)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||||
{
|
{
|
||||||
if (Gbl.Imported.ExternalRole == Rol_ROLE_UNKNOWN && // I logged in directly, not from external service...
|
if (Gbl.Imported.ExternalRole == Rol_UNKNOWN && // I logged in directly, not from external service...
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_ROLE_STUDENT && // ...and I am a student in the current course...
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT && // ...and I am a student in the current course...
|
||||||
!Gbl.CurrentDegTyp.DegTyp.AllowDirectLogIn && // ...but the current degree type...
|
!Gbl.CurrentDegTyp.DegTyp.AllowDirectLogIn && // ...but the current degree type...
|
||||||
!Gbl.CurrentCrs.Crs.AllowDirectLogIn) // ...and the current course do not allow to log in directly
|
!Gbl.CurrentCrs.Crs.AllowDirectLogIn) // ...and the current course do not allow to log in directly
|
||||||
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_ROLE_VISITOR); // In this case, my role will be visitor, and an alert will be shown
|
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_VISITOR); // In this case, my role will be visitor, and an alert will be shown
|
||||||
else
|
else
|
||||||
Gbl.Usrs.Me.AvailableRoles = (1 << Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB);
|
Gbl.Usrs.Me.AvailableRoles = (1 << Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB);
|
||||||
}
|
}
|
||||||
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_STUDENT)
|
else if (Gbl.Usrs.Me.MaxRole >= Rol_STUDENT)
|
||||||
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_ROLE_VISITOR);
|
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_VISITOR);
|
||||||
else
|
else
|
||||||
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_ROLE_GUEST__);
|
Gbl.Usrs.Me.AvailableRoles = (1 << Rol__GUEST_);
|
||||||
}
|
}
|
||||||
else // No course selected
|
else // No course selected
|
||||||
Gbl.Usrs.Me.AvailableRoles = (1 << Gbl.Usrs.Me.MaxRole);
|
Gbl.Usrs.Me.AvailableRoles = (1 << Gbl.Usrs.Me.MaxRole);
|
||||||
if (ICanBeInsAdm)
|
if (ICanBeInsAdm)
|
||||||
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_INS_ADM);
|
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_INS_ADM);
|
||||||
if (ICanBeCtrAdm)
|
if (ICanBeCtrAdm)
|
||||||
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_CTR_ADM);
|
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_CTR_ADM);
|
||||||
if (ICanBeDegAdm)
|
if (ICanBeDegAdm)
|
||||||
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_DEG_ADM);
|
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_DEG_ADM);
|
||||||
if (Usr_CheckIfUsrIsSuperuser (Gbl.Usrs.Me.UsrDat.UsrCod))
|
if (Usr_CheckIfUsrIsSuperuser (Gbl.Usrs.Me.UsrDat.UsrCod))
|
||||||
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_SYS_ADM);
|
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_SYS_ADM);
|
||||||
|
|
||||||
/***** Check if the role I am logged is now available for me *****/
|
/***** Check if the role I am logged is now available for me *****/
|
||||||
if (!(Gbl.Usrs.Me.AvailableRoles & (1 << Gbl.Usrs.Me.LoggedRole))) // Current type I am logged is not available for me
|
if (!(Gbl.Usrs.Me.AvailableRoles & (1 << Gbl.Usrs.Me.LoggedRole))) // Current type I am logged is not available for me
|
||||||
/* Set the lowest role available for me */
|
/* Set the lowest role available for me */
|
||||||
for (Gbl.Usrs.Me.LoggedRole = Rol_ROLE_UNKNOWN;
|
for (Gbl.Usrs.Me.LoggedRole = Rol_UNKNOWN;
|
||||||
Gbl.Usrs.Me.LoggedRole < Rol_NUM_ROLES;
|
Gbl.Usrs.Me.LoggedRole < Rol_NUM_ROLES;
|
||||||
Gbl.Usrs.Me.LoggedRole++)
|
Gbl.Usrs.Me.LoggedRole++)
|
||||||
if (Gbl.Usrs.Me.AvailableRoles & (1 << Gbl.Usrs.Me.LoggedRole))
|
if (Gbl.Usrs.Me.AvailableRoles & (1 << Gbl.Usrs.Me.LoggedRole))
|
||||||
|
@ -2430,8 +2430,8 @@ void Usr_WarningWhenDegreeTypeDoesntAllowDirectLogin (void)
|
||||||
if (Cfg_EXTERNAL_LOGIN_URL[0] && Cfg_EXTERNAL_LOGIN_SERVICE_SHORT_NAME[0])
|
if (Cfg_EXTERNAL_LOGIN_URL[0] && Cfg_EXTERNAL_LOGIN_SERVICE_SHORT_NAME[0])
|
||||||
/* If I belong to current course but my role in current course is visitor, show alert */
|
/* If I belong to current course but my role in current course is visitor, show alert */
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs &&
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs &&
|
||||||
Gbl.Imported.ExternalRole == Rol_ROLE_UNKNOWN && // I logged in directly, not from external service...
|
Gbl.Imported.ExternalRole == Rol_UNKNOWN && // I logged in directly, not from external service...
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_ROLE_STUDENT && // ...and I am a student in the current course...
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT && // ...and I am a student in the current course...
|
||||||
!Gbl.CurrentDegTyp.DegTyp.AllowDirectLogIn && // ...but the current degree type...
|
!Gbl.CurrentDegTyp.DegTyp.AllowDirectLogIn && // ...but the current degree type...
|
||||||
!Gbl.CurrentCrs.Crs.AllowDirectLogIn && // ...and the current course do not allow to log in directly
|
!Gbl.CurrentCrs.Crs.AllowDirectLogIn && // ...and the current course do not allow to log in directly
|
||||||
(Gbl.CurrentAct == ActSeeCrsInf ||
|
(Gbl.CurrentAct == ActSeeCrsInf ||
|
||||||
|
@ -2597,7 +2597,7 @@ static void Usr_WriteRowGstMainData (unsigned NumUsr,struct UsrData *UsrDat)
|
||||||
fprintf (Gbl.F.Out,"<td style=\"text-align:center; vertical-align:middle;"
|
fprintf (Gbl.F.Out,"<td style=\"text-align:center; vertical-align:middle;"
|
||||||
" background-color:%s;\">",
|
" background-color:%s;\">",
|
||||||
BgColor);
|
BgColor);
|
||||||
Usr_PutCheckboxToSelectUser (Rol_ROLE_GUEST__,UsrDat->EncryptedUsrCod,false);
|
Usr_PutCheckboxToSelectUser (Rol__GUEST_,UsrDat->EncryptedUsrCod,false);
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
/***** Student has accepted enrollment in current course? *****/
|
/***** Student has accepted enrollment in current course? *****/
|
||||||
|
@ -2636,7 +2636,7 @@ static void Usr_WriteRowGstMainData (unsigned NumUsr,struct UsrData *UsrDat)
|
||||||
UsrDat->Accepted ? "DAT_SMALL_N" :
|
UsrDat->Accepted ? "DAT_SMALL_N" :
|
||||||
"DAT_SMALL",
|
"DAT_SMALL",
|
||||||
BgColor);
|
BgColor);
|
||||||
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER));
|
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER));
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
/***** Write rest of main student's data *****/
|
/***** Write rest of main student's data *****/
|
||||||
|
@ -2669,9 +2669,9 @@ void Usr_WriteRowStdMainData (unsigned NumUsr,struct UsrData *UsrDat,bool PutChe
|
||||||
bool UsrIsTheMsgSender = false;
|
bool UsrIsTheMsgSender = false;
|
||||||
char MailLink[7+Cns_MAX_BYTES_STRING+1]; // mailto:mail_address
|
char MailLink[7+Cns_MAX_BYTES_STRING+1]; // mailto:mail_address
|
||||||
struct Institution Ins;
|
struct Institution Ins;
|
||||||
bool ShowEmail = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER && UsrDat->Accepted) ||
|
bool ShowEmail = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER && UsrDat->Accepted) ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
|
||||||
|
|
||||||
/***** Start row *****/
|
/***** Start row *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>");
|
fprintf (Gbl.F.Out,"<tr>");
|
||||||
|
@ -2687,7 +2687,7 @@ void Usr_WriteRowStdMainData (unsigned NumUsr,struct UsrData *UsrDat,bool PutChe
|
||||||
fprintf (Gbl.F.Out,"<td style=\"text-align:center; vertical-align:middle;"
|
fprintf (Gbl.F.Out,"<td style=\"text-align:center; vertical-align:middle;"
|
||||||
" background-color:%s;\">",
|
" background-color:%s;\">",
|
||||||
BgColor);
|
BgColor);
|
||||||
Usr_PutCheckboxToSelectUser (Rol_ROLE_STUDENT,UsrDat->EncryptedUsrCod,UsrIsTheMsgSender);
|
Usr_PutCheckboxToSelectUser (Rol_STUDENT,UsrDat->EncryptedUsrCod,UsrIsTheMsgSender);
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2738,7 +2738,7 @@ void Usr_WriteRowStdMainData (unsigned NumUsr,struct UsrData *UsrDat,bool PutChe
|
||||||
UsrDat->Accepted ? "DAT_SMALL_N" :
|
UsrDat->Accepted ? "DAT_SMALL_N" :
|
||||||
"DAT_SMALL",
|
"DAT_SMALL",
|
||||||
BgColor);
|
BgColor);
|
||||||
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER));
|
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER));
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
/***** Write rest of main student's data *****/
|
/***** Write rest of main student's data *****/
|
||||||
|
@ -2870,9 +2870,9 @@ void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
char Text[Cns_MAX_BYTES_TEXT+1];
|
char Text[Cns_MAX_BYTES_TEXT+1];
|
||||||
struct Institution Ins;
|
struct Institution Ins;
|
||||||
bool ShowData = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER && UsrDat->Accepted) ||
|
bool ShowData = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER && UsrDat->Accepted) ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
|
||||||
|
|
||||||
/***** Start row *****/
|
/***** Start row *****/
|
||||||
BgColor = Gbl.ColorRows[Gbl.RowEvenOdd]; // Two colors are used alternatively to better distinguish the rows
|
BgColor = Gbl.ColorRows[Gbl.RowEvenOdd]; // Two colors are used alternatively to better distinguish the rows
|
||||||
|
@ -2896,7 +2896,7 @@ void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
|
||||||
UsrDat->Accepted ? "DAT_SMALL_N" :
|
UsrDat->Accepted ? "DAT_SMALL_N" :
|
||||||
"DAT_SMALL",
|
"DAT_SMALL",
|
||||||
BgColor);
|
BgColor);
|
||||||
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER));
|
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER));
|
||||||
fprintf (Gbl.F.Out," </td>");
|
fprintf (Gbl.F.Out," </td>");
|
||||||
|
|
||||||
/***** Write rest of main student's data *****/
|
/***** Write rest of main student's data *****/
|
||||||
|
@ -2991,8 +2991,8 @@ static void Usr_WriteRowTchMainData (unsigned NumUsr,struct UsrData *UsrDat,bool
|
||||||
char MailLink[7+Cns_MAX_BYTES_STRING+1]; // mailto:mail_address
|
char MailLink[7+Cns_MAX_BYTES_STRING+1]; // mailto:mail_address
|
||||||
struct Institution Ins;
|
struct Institution Ins;
|
||||||
bool ShowEmail = UsrDat->Accepted ||
|
bool ShowEmail = UsrDat->Accepted ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
|
||||||
|
|
||||||
/***** Start row *****/
|
/***** Start row *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>");
|
fprintf (Gbl.F.Out,"<tr>");
|
||||||
|
@ -3007,7 +3007,7 @@ static void Usr_WriteRowTchMainData (unsigned NumUsr,struct UsrData *UsrDat,bool
|
||||||
fprintf (Gbl.F.Out,"<td style=\"text-align:center; vertical-align:middle;"
|
fprintf (Gbl.F.Out,"<td style=\"text-align:center; vertical-align:middle;"
|
||||||
" background-color:%s;\">",
|
" background-color:%s;\">",
|
||||||
BgColor);
|
BgColor);
|
||||||
Usr_PutCheckboxToSelectUser (Rol_ROLE_TEACHER,UsrDat->EncryptedUsrCod,UsrIsTheMsgSender);
|
Usr_PutCheckboxToSelectUser (Rol_TEACHER,UsrDat->EncryptedUsrCod,UsrIsTheMsgSender);
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3085,8 +3085,8 @@ void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
|
||||||
struct Institution Ins;
|
struct Institution Ins;
|
||||||
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
||||||
bool ShowData = (ItsMe || UsrDat->Accepted ||
|
bool ShowData = (ItsMe || UsrDat->Accepted ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
||||||
struct Centre Ctr;
|
struct Centre Ctr;
|
||||||
struct Department Dpt;
|
struct Department Dpt;
|
||||||
|
|
||||||
|
@ -3196,7 +3196,7 @@ void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
|
||||||
UsrDat->Accepted ? "DAT_SMALL_N" :
|
UsrDat->Accepted ? "DAT_SMALL_N" :
|
||||||
"DAT_SMALL",
|
"DAT_SMALL",
|
||||||
BgColor);
|
BgColor);
|
||||||
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
|
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
|
||||||
fprintf (Gbl.F.Out," </td>");
|
fprintf (Gbl.F.Out," </td>");
|
||||||
|
|
||||||
/***** Write rest of main administrator's data *****/
|
/***** Write rest of main administrator's data *****/
|
||||||
|
@ -3392,7 +3392,7 @@ unsigned Usr_GetNumUsrsInCountry (Rol_Role_t Role,long CtyCod)
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
/***** Get the number of users (with a role) in a country from database ******/
|
/***** Get the number of users (with a role) in a country from database ******/
|
||||||
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||||
" WHERE CtyCod='%ld'",CtyCod);
|
" WHERE CtyCod='%ld'",CtyCod);
|
||||||
else
|
else
|
||||||
|
@ -3420,7 +3420,7 @@ long Usr_GetRamdomStdFromCrs (long CrsCod)
|
||||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||||
" WHERE CrsCod='%ld' AND Role='%u'"
|
" WHERE CrsCod='%ld' AND Role='%u'"
|
||||||
" ORDER BY RAND(NOW()) LIMIT 1",
|
" ORDER BY RAND(NOW()) LIMIT 1",
|
||||||
CrsCod,(unsigned) Rol_ROLE_STUDENT);
|
CrsCod,(unsigned) Rol_STUDENT);
|
||||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get a random student from the current course"))
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get a random student from the current course"))
|
||||||
{
|
{
|
||||||
/***** Get user code *****/
|
/***** Get user code *****/
|
||||||
|
@ -3450,7 +3450,7 @@ long Usr_GetRamdomStdFromGrp (long GrpCod)
|
||||||
sprintf (Query,"SELECT crs_grp_usr.UsrCod FROM crs_grp_usr,crs_usr"
|
sprintf (Query,"SELECT crs_grp_usr.UsrCod FROM crs_grp_usr,crs_usr"
|
||||||
" WHERE crs_grp_usr.GrpCod='%ld' AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
" WHERE crs_grp_usr.GrpCod='%ld' AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||||
" AND crs_usr.Role='%u' ORDER BY RAND(NOW()) LIMIT 1",
|
" AND crs_usr.Role='%u' ORDER BY RAND(NOW()) LIMIT 1",
|
||||||
GrpCod,(unsigned) Rol_ROLE_STUDENT);
|
GrpCod,(unsigned) Rol_STUDENT);
|
||||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get a random student from a group"))
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get a random student from a group"))
|
||||||
{
|
{
|
||||||
/***** Get user code *****/
|
/***** Get user code *****/
|
||||||
|
@ -3478,7 +3478,7 @@ unsigned Usr_GetNumTchsCurrentInsInDepartment (long DptCod)
|
||||||
" FROM usr_data,crs_usr"
|
" FROM usr_data,crs_usr"
|
||||||
" WHERE usr_data.InsCod='%ld' AND usr_data.DptCod='%ld'"
|
" WHERE usr_data.InsCod='%ld' AND usr_data.DptCod='%ld'"
|
||||||
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'",
|
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'",
|
||||||
Gbl.CurrentIns.Ins.InsCod,DptCod,(unsigned) Rol_ROLE_TEACHER);
|
Gbl.CurrentIns.Ins.InsCod,DptCod,(unsigned) Rol_TEACHER);
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of teachers in a department");
|
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of teachers in a department");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3513,7 +3513,7 @@ unsigned Usr_GetNumberOfTeachersInCentre (long CtrCod)
|
||||||
" FROM usr_data,crs_usr"
|
" FROM usr_data,crs_usr"
|
||||||
" WHERE usr_data.CtrCod='%ld'"
|
" WHERE usr_data.CtrCod='%ld'"
|
||||||
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'",
|
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'",
|
||||||
CtrCod,(unsigned) Rol_ROLE_TEACHER);
|
CtrCod,(unsigned) Rol_TEACHER);
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of teachers in a centre");
|
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of teachers in a centre");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3532,7 +3532,7 @@ static void Usr_BuildQueryToGetUsrsLstCrs (Rol_Role_t Role,const char *UsrQuery,
|
||||||
bool *AddStdsWithoutGroupOf;
|
bool *AddStdsWithoutGroupOf;
|
||||||
|
|
||||||
/***** If there are no groups selected, don't do anything *****/
|
/***** If there are no groups selected, don't do anything *****/
|
||||||
if (Role == Rol_ROLE_STUDENT &&
|
if (Role == Rol_STUDENT &&
|
||||||
(!Gbl.Usrs.ClassPhoto.AllGroups &&
|
(!Gbl.Usrs.ClassPhoto.AllGroups &&
|
||||||
!Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps))
|
!Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps))
|
||||||
{
|
{
|
||||||
|
@ -3569,7 +3569,7 @@ static void Usr_BuildQueryToGetUsrsLstCrs (Rol_Role_t Role,const char *UsrQuery,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Role);
|
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Role);
|
||||||
|
|
||||||
/***** Select users in selected groups (only for students) *****/
|
/***** Select users in selected groups (only for students) *****/
|
||||||
if (Role == Rol_ROLE_STUDENT && !Gbl.Usrs.ClassPhoto.AllGroups)
|
if (Role == Rol_STUDENT && !Gbl.Usrs.ClassPhoto.AllGroups)
|
||||||
{
|
{
|
||||||
/***** Get list of groups types in current course *****/
|
/***** Get list of groups types in current course *****/
|
||||||
Grp_GetListGrpTypesInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
|
Grp_GetListGrpTypesInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
|
||||||
|
@ -3671,7 +3671,7 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
|
||||||
char Query[Usr_MAX_LENGTH_QUERY_LIST_USERS+1];
|
char Query[Usr_MAX_LENGTH_QUERY_LIST_USERS+1];
|
||||||
|
|
||||||
/***** Build query *****/
|
/***** Build query *****/
|
||||||
if (Search && Role == Rol_ROLE_GUEST__) // Special case
|
if (Search && Role == Rol__GUEST_) // Special case
|
||||||
{
|
{
|
||||||
/* Select users with no courses */
|
/* Select users with no courses */
|
||||||
sprintf (Query,"SELECT UsrCod,'N',Sex"
|
sprintf (Query,"SELECT UsrCod,'N',Sex"
|
||||||
|
@ -4028,8 +4028,8 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
|
||||||
*/
|
*/
|
||||||
/***** Get list of users from database *****/
|
/***** Get list of users from database *****/
|
||||||
Usr_GetListUsrs (Query,
|
Usr_GetListUsrs (Query,
|
||||||
( Role == Rol_ROLE_TEACHER ? &Gbl.Usrs.LstTchs :
|
( Role == Rol_TEACHER ? &Gbl.Usrs.LstTchs :
|
||||||
(Role == Rol_ROLE_STUDENT ? &Gbl.Usrs.LstStds :
|
(Role == Rol_STUDENT ? &Gbl.Usrs.LstStds :
|
||||||
&Gbl.Usrs.LstGsts)));
|
&Gbl.Usrs.LstGsts)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4156,14 +4156,14 @@ void Usr_GetUnorderedStdsCodesInDeg (long DegCod)
|
||||||
|
|
||||||
Gbl.Usrs.LstStds.NumUsrs = 0;
|
Gbl.Usrs.LstStds.NumUsrs = 0;
|
||||||
|
|
||||||
if (Usr_GetNumUsrsInCrssOfDeg (Rol_ROLE_STUDENT,DegCod))
|
if (Usr_GetNumUsrsInCrssOfDeg (Rol_STUDENT,DegCod))
|
||||||
{
|
{
|
||||||
/***** Get the students in a degree from database *****/
|
/***** Get the students in a degree from database *****/
|
||||||
sprintf (Query,"SELECT DISTINCT crs_usr.UsrCod,'N',usr_data.Sex"
|
sprintf (Query,"SELECT DISTINCT crs_usr.UsrCod,'N',usr_data.Sex"
|
||||||
" FROM courses,crs_usr,usr_data"
|
" FROM courses,crs_usr,usr_data"
|
||||||
" WHERE courses.DegCod='%ld' AND courses.CrsCod=crs_usr.CrsCod AND crs_usr.Role='%u'"
|
" WHERE courses.DegCod='%ld' AND courses.CrsCod=crs_usr.CrsCod AND crs_usr.Role='%u'"
|
||||||
" AND crs_usr.UsrCod=usr_data.UsrCod",
|
" AND crs_usr.UsrCod=usr_data.UsrCod",
|
||||||
DegCod,(unsigned) Rol_ROLE_STUDENT);
|
DegCod,(unsigned) Rol_STUDENT);
|
||||||
|
|
||||||
/***** Get list of students from database *****/
|
/***** Get list of students from database *****/
|
||||||
Usr_GetListUsrs (Query,&Gbl.Usrs.LstStds);
|
Usr_GetListUsrs (Query,&Gbl.Usrs.LstStds);
|
||||||
|
@ -4832,11 +4832,11 @@ void Usr_ListUsersToSelect (Rol_Role_t Role)
|
||||||
/***** If there are no users, don't list anything *****/
|
/***** If there are no users, don't list anything *****/
|
||||||
switch (Role)
|
switch (Role)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
if (!Gbl.Usrs.LstStds.NumUsrs)
|
if (!Gbl.Usrs.LstStds.NumUsrs)
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
if (!Gbl.Usrs.LstTchs.NumUsrs)
|
if (!Gbl.Usrs.LstTchs.NumUsrs)
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
@ -4874,7 +4874,7 @@ void Usr_PutCheckboxToSelectAllTheUsers (Rol_Role_t Role)
|
||||||
"<td colspan=\"%u\" class=\"TIT_TBL\""
|
"<td colspan=\"%u\" class=\"TIT_TBL\""
|
||||||
" style=\"text-align:left; background-color:%s;\">",
|
" style=\"text-align:left; background-color:%s;\">",
|
||||||
Usr_GetColumnsForSelectUsrs (),VERY_LIGHT_BLUE);
|
Usr_GetColumnsForSelectUsrs (),VERY_LIGHT_BLUE);
|
||||||
if (Role == Rol_ROLE_STUDENT)
|
if (Role == Rol_STUDENT)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"SEL_UNSEL_STDS\" value=\"\" onclick=\"togglecheckChildren(this,'UsrCodStd')\" />");
|
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"SEL_UNSEL_STDS\" value=\"\" onclick=\"togglecheckChildren(this,'UsrCodStd')\" />");
|
||||||
LstUsrs = &Gbl.Usrs.LstStds;
|
LstUsrs = &Gbl.Usrs.LstStds;
|
||||||
|
@ -4935,7 +4935,7 @@ unsigned Usr_GetColumnsForSelectUsrs (void)
|
||||||
void Usr_PutCheckboxToSelectUser (Rol_Role_t Role,const char *EncryptedUsrCod,bool UsrIsTheMsgSender)
|
void Usr_PutCheckboxToSelectUser (Rol_Role_t Role,const char *EncryptedUsrCod,bool UsrIsTheMsgSender)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"");
|
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"");
|
||||||
if (Role == Rol_ROLE_STUDENT)
|
if (Role == Rol_STUDENT)
|
||||||
fprintf (Gbl.F.Out,"UsrCodStd\" value=\"%s\" onclick=\"checkParent(this,'SEL_UNSEL_STDS')\"",EncryptedUsrCod);
|
fprintf (Gbl.F.Out,"UsrCodStd\" value=\"%s\" onclick=\"checkParent(this,'SEL_UNSEL_STDS')\"",EncryptedUsrCod);
|
||||||
else
|
else
|
||||||
fprintf (Gbl.F.Out,"UsrCodTch\" value=\"%s\" onclick=\"checkParent(this,'SEL_UNSEL_TCHS')\"",EncryptedUsrCod);
|
fprintf (Gbl.F.Out,"UsrCodTch\" value=\"%s\" onclick=\"checkParent(this,'SEL_UNSEL_TCHS')\"",EncryptedUsrCod);
|
||||||
|
@ -5055,7 +5055,7 @@ static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr)
|
||||||
Usr_UsrDataDestructor (&UsrDat);
|
Usr_UsrDataDestructor (&UsrDat);
|
||||||
}
|
}
|
||||||
else // Gbl.Usrs.LstGsts.NumUsrs == 0
|
else // Gbl.Usrs.LstGsts.NumUsrs == 0
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST__);
|
Usr_ShowWarningNoUsersFound (Rol__GUEST_);
|
||||||
|
|
||||||
/***** Free memory for students list *****/
|
/***** Free memory for students list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
|
||||||
|
@ -5144,7 +5144,7 @@ static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr)
|
||||||
free ((void *) GroupNames);
|
free ((void *) GroupNames);
|
||||||
}
|
}
|
||||||
else // Gbl.Usrs.LstStds.NumUsrs == 0
|
else // Gbl.Usrs.LstStds.NumUsrs == 0
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_STUDENT);
|
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
|
||||||
|
|
||||||
/***** Free memory for students list *****/
|
/***** Free memory for students list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
||||||
|
@ -5216,7 +5216,7 @@ static void Usr_ListMainDataTchs (bool PutCheckBoxToSelectUsr)
|
||||||
Usr_UsrDataDestructor (&UsrDat);
|
Usr_UsrDataDestructor (&UsrDat);
|
||||||
}
|
}
|
||||||
else // Gbl.Usrs.LstTchs.NumUsrs == 0
|
else // Gbl.Usrs.LstTchs.NumUsrs == 0
|
||||||
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_ROLE_TEACHER]);
|
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_TEACHER]);
|
||||||
|
|
||||||
/***** Free memory for teachers list *****/
|
/***** Free memory for teachers list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
||||||
|
@ -5329,7 +5329,7 @@ void Usr_ListAllDataGsts (void)
|
||||||
fprintf (Gbl.F.Out,"</table>");
|
fprintf (Gbl.F.Out,"</table>");
|
||||||
}
|
}
|
||||||
else // Gbl.Usrs.LstGsts.NumUsrs == 0
|
else // Gbl.Usrs.LstGsts.NumUsrs == 0
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST__);
|
Usr_ShowWarningNoUsersFound (Rol__GUEST_);
|
||||||
|
|
||||||
/***** Free memory for guests' list *****/
|
/***** Free memory for guests' list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
|
||||||
|
@ -5398,7 +5398,7 @@ void Usr_ListAllDataStds (void)
|
||||||
Sco_GetScope ();
|
Sco_GetScope ();
|
||||||
|
|
||||||
/****** Get and order list of students in current course ******/
|
/****** Get and order list of students in current course ******/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Gbl.Scope.Current,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Gbl.Scope.Current,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstStds.NumUsrs)
|
if (Gbl.Usrs.LstStds.NumUsrs)
|
||||||
{
|
{
|
||||||
|
@ -5528,7 +5528,7 @@ void Usr_ListAllDataStds (void)
|
||||||
free ((void *) GroupNames);
|
free ((void *) GroupNames);
|
||||||
}
|
}
|
||||||
else // Gbl.Usrs.LstStds.NumUsrs == 0
|
else // Gbl.Usrs.LstStds.NumUsrs == 0
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_STUDENT);
|
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
|
||||||
|
|
||||||
/***** Free memory for list of selected groups *****/
|
/***** Free memory for list of selected groups *****/
|
||||||
Grp_FreeListCodSelectedGrps ();
|
Grp_FreeListCodSelectedGrps ();
|
||||||
|
@ -5580,7 +5580,7 @@ void Usr_ListUsrsForSelection (Rol_Role_t Role)
|
||||||
/***** List users' data *****/
|
/***** List users' data *****/
|
||||||
switch (Role)
|
switch (Role)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
for (NumUsr = 0;
|
for (NumUsr = 0;
|
||||||
NumUsr < Gbl.Usrs.LstStds.NumUsrs; )
|
NumUsr < Gbl.Usrs.LstStds.NumUsrs; )
|
||||||
{
|
{
|
||||||
|
@ -5592,7 +5592,7 @@ void Usr_ListUsrsForSelection (Rol_Role_t Role)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
for (NumUsr = 0;
|
for (NumUsr = 0;
|
||||||
NumUsr < Gbl.Usrs.LstTchs.NumUsrs; )
|
NumUsr < Gbl.Usrs.LstTchs.NumUsrs; )
|
||||||
{
|
{
|
||||||
|
@ -5665,7 +5665,7 @@ void Usr_ListAllDataTchs (void)
|
||||||
Sco_GetScope ();
|
Sco_GetScope ();
|
||||||
|
|
||||||
/***** Get and order list of teachers *****/
|
/***** Get and order list of teachers *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Gbl.Scope.Current,NULL,false);
|
Usr_GetUsrsLst (Rol_TEACHER,Gbl.Scope.Current,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstTchs.NumUsrs)
|
if (Gbl.Usrs.LstTchs.NumUsrs)
|
||||||
{
|
{
|
||||||
|
@ -5712,7 +5712,7 @@ void Usr_ListAllDataTchs (void)
|
||||||
fprintf (Gbl.F.Out,"</table>");
|
fprintf (Gbl.F.Out,"</table>");
|
||||||
}
|
}
|
||||||
else // Gbl.Usrs.LstTchs.NumUsrs == 0
|
else // Gbl.Usrs.LstTchs.NumUsrs == 0
|
||||||
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_ROLE_TEACHER]);
|
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_TEACHER]);
|
||||||
|
|
||||||
/***** Free memory for teachers list *****/
|
/***** Free memory for teachers list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
||||||
|
@ -5736,8 +5736,8 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery)
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
|
|
||||||
/***** Set list *****/
|
/***** Set list *****/
|
||||||
LstUsrs = ( Role == Rol_ROLE_TEACHER ? &Gbl.Usrs.LstTchs :
|
LstUsrs = ( Role == Rol_TEACHER ? &Gbl.Usrs.LstTchs :
|
||||||
(Role == Rol_ROLE_STUDENT ? &Gbl.Usrs.LstStds :
|
(Role == Rol_STUDENT ? &Gbl.Usrs.LstStds :
|
||||||
&Gbl.Usrs.LstGsts));
|
&Gbl.Usrs.LstGsts));
|
||||||
|
|
||||||
/***** Initialize field names *****/
|
/***** Initialize field names *****/
|
||||||
|
@ -5795,13 +5795,13 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery)
|
||||||
UsrDat.Accepted = LstUsrs->Lst[NumUsr].Accepted;
|
UsrDat.Accepted = LstUsrs->Lst[NumUsr].Accepted;
|
||||||
|
|
||||||
/* Write data of this user */
|
/* Write data of this user */
|
||||||
if (Role == Rol_ROLE_STUDENT)
|
if (Role == Rol_STUDENT)
|
||||||
Usr_WriteRowStdMainData (NumUsr + 1,&UsrDat,false);
|
Usr_WriteRowStdMainData (NumUsr + 1,&UsrDat,false);
|
||||||
else // Role == Rol_ROLE_TEACHER
|
else // Role == Rol_ROLE_TEACHER
|
||||||
Usr_WriteRowTchMainData (NumUsr + 1,&UsrDat,false);
|
Usr_WriteRowTchMainData (NumUsr + 1,&UsrDat,false);
|
||||||
|
|
||||||
/* Write all the courses this user belongs to */
|
/* Write all the courses this user belongs to */
|
||||||
if (Role != Rol_ROLE_GUEST__)
|
if (Role != Rol__GUEST_)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td colspan=\"3\"></td>"
|
"<td colspan=\"3\"></td>"
|
||||||
|
@ -5943,7 +5943,7 @@ void Usr_ListDataAdms (void)
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
}
|
}
|
||||||
else // Gbl.Usrs.LstAdms.NumUsrs == 0
|
else // Gbl.Usrs.LstAdms.NumUsrs == 0
|
||||||
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_ROLE_DEG_ADM]);
|
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_DEG_ADM]);
|
||||||
|
|
||||||
/***** Free memory for teachers list *****/
|
/***** Free memory for teachers list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstAdms);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstAdms);
|
||||||
|
@ -6302,9 +6302,9 @@ void Usr_SeeGuests (void)
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_CTR_ADM:
|
case Rol_CTR_ADM:
|
||||||
case Rol_ROLE_INS_ADM:
|
case Rol_INS_ADM:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
/***** Form to select range of guests *****/
|
/***** Form to select range of guests *****/
|
||||||
fprintf (Gbl.F.Out,"<div class=\"%s\" style=\"text-align:center;\">",
|
fprintf (Gbl.F.Out,"<div class=\"%s\" style=\"text-align:center;\">",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme]);
|
The_ClassFormul[Gbl.Prefs.Theme]);
|
||||||
|
@ -6369,14 +6369,14 @@ void Usr_SeeGuests (void)
|
||||||
-1L);
|
-1L);
|
||||||
|
|
||||||
/* Put a row to select all users */
|
/* Put a row to select all users */
|
||||||
Usr_PutCheckboxToSelectAllTheUsers (Rol_ROLE_GUEST__);
|
Usr_PutCheckboxToSelectAllTheUsers (Rol__GUEST_);
|
||||||
|
|
||||||
/* Draw the classphoto/list */
|
/* Draw the classphoto/list */
|
||||||
switch (Gbl.Usrs.Me.ListType)
|
switch (Gbl.Usrs.Me.ListType)
|
||||||
{
|
{
|
||||||
case Usr_CLASS_PHOTO:
|
case Usr_CLASS_PHOTO:
|
||||||
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
|
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
|
||||||
Rol_ROLE_GUEST__);
|
Rol__GUEST_);
|
||||||
break;
|
break;
|
||||||
case Usr_LIST:
|
case Usr_LIST:
|
||||||
Usr_ListMainDataGsts (true);
|
Usr_ListMainDataGsts (true);
|
||||||
|
@ -6392,7 +6392,7 @@ void Usr_SeeGuests (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST__);
|
Usr_ShowWarningNoUsersFound (Rol__GUEST_);
|
||||||
|
|
||||||
/***** Free memory for students list *****/
|
/***** Free memory for students list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
|
||||||
|
@ -6432,8 +6432,8 @@ void Usr_SeeStudents (void)
|
||||||
bool ICanViewRecords;
|
bool ICanViewRecords;
|
||||||
|
|
||||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
|
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
|
||||||
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER || // My role in current course is teacher...
|
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || // My role in current course is teacher...
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) // ...or superuser
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)) // ...or superuser
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
|
|
||||||
|
@ -6455,15 +6455,15 @@ void Usr_SeeStudents (void)
|
||||||
Sco_SetScopesForListingStudents ();
|
Sco_SetScopesForListingStudents ();
|
||||||
Sco_GetScope ();
|
Sco_GetScope ();
|
||||||
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS &&
|
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS &&
|
||||||
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT ||
|
(Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
|
Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
case Rol_ROLE_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
/***** Form to select range of students *****/
|
/***** Form to select range of students *****/
|
||||||
fprintf (Gbl.F.Out,"<div class=\"%s\" style=\"text-align:center;\">",
|
fprintf (Gbl.F.Out,"<div class=\"%s\" style=\"text-align:center;\">",
|
||||||
The_ClassFormul[Gbl.Prefs.Theme]);
|
The_ClassFormul[Gbl.Prefs.Theme]);
|
||||||
|
@ -6488,7 +6488,7 @@ void Usr_SeeStudents (void)
|
||||||
Usr_ShowFormsToSelectUsrListType (ActLstStd);
|
Usr_ShowFormsToSelectUsrListType (ActLstStd);
|
||||||
|
|
||||||
/***** Get and order list of students *****/
|
/***** Get and order list of students *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Gbl.Scope.Current,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Gbl.Scope.Current,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstStds.NumUsrs)
|
if (Gbl.Usrs.LstStds.NumUsrs)
|
||||||
{
|
{
|
||||||
|
@ -6507,7 +6507,7 @@ void Usr_SeeStudents (void)
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
break;
|
break;
|
||||||
case Usr_LIST:
|
case Usr_LIST:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)
|
||||||
{
|
{
|
||||||
/****** Link to show all the data ******/
|
/****** Link to show all the data ******/
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
|
@ -6546,7 +6546,7 @@ void Usr_SeeStudents (void)
|
||||||
|
|
||||||
/* Put a row to select all users */
|
/* Put a row to select all users */
|
||||||
if (ICanViewRecords)
|
if (ICanViewRecords)
|
||||||
Usr_PutCheckboxToSelectAllTheUsers (Rol_ROLE_STUDENT);
|
Usr_PutCheckboxToSelectAllTheUsers (Rol_STUDENT);
|
||||||
|
|
||||||
/* Draw the classphoto/list */
|
/* Draw the classphoto/list */
|
||||||
switch (Gbl.Usrs.Me.ListType)
|
switch (Gbl.Usrs.Me.ListType)
|
||||||
|
@ -6554,7 +6554,7 @@ void Usr_SeeStudents (void)
|
||||||
case Usr_CLASS_PHOTO:
|
case Usr_CLASS_PHOTO:
|
||||||
Usr_DrawClassPhoto (ICanViewRecords ? Usr_CLASS_PHOTO_SEL_SEE :
|
Usr_DrawClassPhoto (ICanViewRecords ? Usr_CLASS_PHOTO_SEL_SEE :
|
||||||
Usr_CLASS_PHOTO_SEE,
|
Usr_CLASS_PHOTO_SEE,
|
||||||
Rol_ROLE_STUDENT);
|
Rol_STUDENT);
|
||||||
break;
|
break;
|
||||||
case Usr_LIST:
|
case Usr_LIST:
|
||||||
Usr_ListMainDataStds (ICanViewRecords);
|
Usr_ListMainDataStds (ICanViewRecords);
|
||||||
|
@ -6574,7 +6574,7 @@ void Usr_SeeStudents (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_STUDENT);
|
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
|
||||||
|
|
||||||
/***** Free memory for students list *****/
|
/***** Free memory for students list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
||||||
|
@ -6629,7 +6629,7 @@ void Usr_SeeTeachers (void)
|
||||||
Usr_ShowFormsToSelectUsrListType (ActLstTch);
|
Usr_ShowFormsToSelectUsrListType (ActLstTch);
|
||||||
|
|
||||||
/***** Get and order list of teachers *****/
|
/***** Get and order list of teachers *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Gbl.Scope.Current,NULL,false);
|
Usr_GetUsrsLst (Rol_TEACHER,Gbl.Scope.Current,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstTchs.NumUsrs)
|
if (Gbl.Usrs.LstTchs.NumUsrs)
|
||||||
{
|
{
|
||||||
|
@ -6645,7 +6645,7 @@ void Usr_SeeTeachers (void)
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
break;
|
break;
|
||||||
case Usr_LIST:
|
case Usr_LIST:
|
||||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
|
||||||
{
|
{
|
||||||
/****** Link to show all the data ******/
|
/****** Link to show all the data ******/
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
|
@ -6681,7 +6681,7 @@ void Usr_SeeTeachers (void)
|
||||||
|
|
||||||
/* Put a row to select all users */
|
/* Put a row to select all users */
|
||||||
if (ICanViewRecords)
|
if (ICanViewRecords)
|
||||||
Usr_PutCheckboxToSelectAllTheUsers (Rol_ROLE_TEACHER);
|
Usr_PutCheckboxToSelectAllTheUsers (Rol_TEACHER);
|
||||||
|
|
||||||
/***** Draw the classphoto/list *****/
|
/***** Draw the classphoto/list *****/
|
||||||
switch (Gbl.Usrs.Me.ListType)
|
switch (Gbl.Usrs.Me.ListType)
|
||||||
|
@ -6689,7 +6689,7 @@ void Usr_SeeTeachers (void)
|
||||||
case Usr_CLASS_PHOTO:
|
case Usr_CLASS_PHOTO:
|
||||||
Usr_DrawClassPhoto (ICanViewRecords ? Usr_CLASS_PHOTO_SEL_SEE :
|
Usr_DrawClassPhoto (ICanViewRecords ? Usr_CLASS_PHOTO_SEL_SEE :
|
||||||
Usr_CLASS_PHOTO_SEE,
|
Usr_CLASS_PHOTO_SEE,
|
||||||
Rol_ROLE_TEACHER);
|
Rol_TEACHER);
|
||||||
break;
|
break;
|
||||||
case Usr_LIST:
|
case Usr_LIST:
|
||||||
Usr_ListMainDataTchs (ICanViewRecords);
|
Usr_ListMainDataTchs (ICanViewRecords);
|
||||||
|
@ -6709,7 +6709,7 @@ void Usr_SeeTeachers (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_ROLE_TEACHER]);
|
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_TEACHER]);
|
||||||
|
|
||||||
/***** Free memory for teachers list *****/
|
/***** Free memory for teachers list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
||||||
|
@ -6727,7 +6727,7 @@ static void Usr_PutLinkToListOfficialStudents (void)
|
||||||
if (ExternalUsrsServiceAvailable && // There is an external service for authentication and official lists
|
if (ExternalUsrsServiceAvailable && // There is an external service for authentication and official lists
|
||||||
Gbl.Imported.ExternalUsrId[0] && // I was authenticated from external service...
|
Gbl.Imported.ExternalUsrId[0] && // I was authenticated from external service...
|
||||||
Gbl.Imported.ExternalSesId[0] &&
|
Gbl.Imported.ExternalSesId[0] &&
|
||||||
Gbl.Imported.ExternalRole == Rol_ROLE_TEACHER) // ...as a teacher
|
Gbl.Imported.ExternalRole == Rol_TEACHER) // ...as a teacher
|
||||||
/***** Link to list official students *****/
|
/***** Link to list official students *****/
|
||||||
Act_PutContextualLink (ActGetExtLstStd,NULL,
|
Act_PutContextualLink (ActGetExtLstStd,NULL,
|
||||||
"list",Txt_Official_students);
|
"list",Txt_Official_students);
|
||||||
|
@ -6760,11 +6760,11 @@ void Usr_SeeGstClassPhotoPrn (void)
|
||||||
Gbl.Scope.Current == Sco_SCOPE_INS) ? Gbl.CurrentIns.Ins.InsCod :
|
Gbl.Scope.Current == Sco_SCOPE_INS) ? Gbl.CurrentIns.Ins.InsCod :
|
||||||
-1L,
|
-1L,
|
||||||
-1L,-1L);
|
-1L,-1L);
|
||||||
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol_ROLE_GUEST__);
|
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol__GUEST_);
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST__);
|
Usr_ShowWarningNoUsersFound (Rol__GUEST_);
|
||||||
|
|
||||||
/***** Free memory for students list *****/
|
/***** Free memory for students list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
|
||||||
|
@ -6789,7 +6789,7 @@ void Usr_SeeStdClassPhotoPrn (void)
|
||||||
Grp_GetParCodsSeveralGrpsToShowUsrs ();
|
Grp_GetParCodsSeveralGrpsToShowUsrs ();
|
||||||
|
|
||||||
/***** Get and order list of students *****/
|
/***** Get and order list of students *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Gbl.Scope.Current,NULL,false);
|
Usr_GetUsrsLst (Rol_STUDENT,Gbl.Scope.Current,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstStds.NumUsrs)
|
if (Gbl.Usrs.LstStds.NumUsrs)
|
||||||
{
|
{
|
||||||
|
@ -6806,11 +6806,11 @@ void Usr_SeeStdClassPhotoPrn (void)
|
||||||
-1L,
|
-1L,
|
||||||
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
|
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
|
||||||
-1L);
|
-1L);
|
||||||
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol_ROLE_STUDENT);
|
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol_STUDENT);
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Usr_ShowWarningNoUsersFound (Rol_ROLE_STUDENT);
|
Usr_ShowWarningNoUsersFound (Rol_STUDENT);
|
||||||
|
|
||||||
/***** Free memory for students list *****/
|
/***** Free memory for students list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstStds);
|
||||||
|
@ -6843,7 +6843,7 @@ void Usr_SeeTchClassPhotoPrn (void)
|
||||||
Sco_GetScope ();
|
Sco_GetScope ();
|
||||||
|
|
||||||
/***** Get and order list of teachers *****/
|
/***** Get and order list of teachers *****/
|
||||||
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Gbl.Scope.Current,NULL,false);
|
Usr_GetUsrsLst (Rol_TEACHER,Gbl.Scope.Current,NULL,false);
|
||||||
|
|
||||||
if (Gbl.Usrs.LstTchs.NumUsrs)
|
if (Gbl.Usrs.LstTchs.NumUsrs)
|
||||||
{
|
{
|
||||||
|
@ -6860,11 +6860,11 @@ void Usr_SeeTchClassPhotoPrn (void)
|
||||||
-1L,
|
-1L,
|
||||||
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
|
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
|
||||||
-1L);
|
-1L);
|
||||||
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol_ROLE_TEACHER);
|
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol_TEACHER);
|
||||||
Lay_EndRoundFrameTable10 ();
|
Lay_EndRoundFrameTable10 ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_ROLE_TEACHER]);
|
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_TEACHER]);
|
||||||
|
|
||||||
/***** Free memory for teachers list *****/
|
/***** Free memory for teachers list *****/
|
||||||
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
Usr_FreeUsrsList (&Gbl.Usrs.LstTchs);
|
||||||
|
@ -6882,7 +6882,7 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
|
||||||
bool TRIsOpen = false;
|
bool TRIsOpen = false;
|
||||||
bool PutCheckBoxToSelectUsr = (ClassPhotoType == Usr_CLASS_PHOTO_SEL ||
|
bool PutCheckBoxToSelectUsr = (ClassPhotoType == Usr_CLASS_PHOTO_SEL ||
|
||||||
ClassPhotoType == Usr_CLASS_PHOTO_SEL_SEE);
|
ClassPhotoType == Usr_CLASS_PHOTO_SEL_SEE);
|
||||||
bool PutOriginPlace = (RoleInClassPhoto == Rol_ROLE_STUDENT &&
|
bool PutOriginPlace = (RoleInClassPhoto == Rol_STUDENT &&
|
||||||
(ClassPhotoType == Usr_CLASS_PHOTO_SEL_SEE ||
|
(ClassPhotoType == Usr_CLASS_PHOTO_SEL_SEE ||
|
||||||
ClassPhotoType == Usr_CLASS_PHOTO_SEE ||
|
ClassPhotoType == Usr_CLASS_PHOTO_SEE ||
|
||||||
ClassPhotoType == Usr_CLASS_PHOTO_PRN));
|
ClassPhotoType == Usr_CLASS_PHOTO_PRN));
|
||||||
|
@ -6898,10 +6898,10 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
|
||||||
/***** Show guests, students or teachers? *****/
|
/***** Show guests, students or teachers? *****/
|
||||||
switch (RoleInClassPhoto)
|
switch (RoleInClassPhoto)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
LstUsrs = &Gbl.Usrs.LstStds;
|
LstUsrs = &Gbl.Usrs.LstStds;
|
||||||
break;
|
break;
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
LstUsrs = &Gbl.Usrs.LstTchs;
|
LstUsrs = &Gbl.Usrs.LstTchs;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -6947,8 +6947,8 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
|
||||||
|
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat.UsrCod);
|
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat.UsrCod);
|
||||||
ShowData = (ItsMe || UsrDat.Accepted ||
|
ShowData = (ItsMe || UsrDat.Accepted ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
||||||
|
|
||||||
/***** Begin user's cell *****/
|
/***** Begin user's cell *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"CLASSPHOTO\""
|
fprintf (Gbl.F.Out,"<td class=\"CLASSPHOTO\""
|
||||||
|
@ -7133,17 +7133,17 @@ void Usr_GetAndShowNumUsrsInPlatform (Rol_Role_t Role)
|
||||||
float NumUsrsPerCrs;
|
float NumUsrsPerCrs;
|
||||||
|
|
||||||
/***** Get the number of users belonging to any course *****/
|
/***** Get the number of users belonging to any course *****/
|
||||||
if (Role == Rol_ROLE_GUEST__) // Users not beloging to any course
|
if (Role == Rol__GUEST_) // Users not beloging to any course
|
||||||
NumUsrs = Usr_GetNumUsrsNotBelongingToAnyCrs ();
|
NumUsrs = Usr_GetNumUsrsNotBelongingToAnyCrs ();
|
||||||
else
|
else
|
||||||
NumUsrs = Usr_GetNumUsrsBelongingToAnyCrs (Role);
|
NumUsrs = Usr_GetNumUsrsBelongingToAnyCrs (Role);
|
||||||
|
|
||||||
/***** Get average number of courses per user *****/
|
/***** Get average number of courses per user *****/
|
||||||
NumCrssPerUsr = (Role == Rol_ROLE_GUEST__) ? 0 :
|
NumCrssPerUsr = (Role == Rol__GUEST_) ? 0 :
|
||||||
Usr_GetNumCrssPerUsr (Role);
|
Usr_GetNumCrssPerUsr (Role);
|
||||||
|
|
||||||
/***** Query the number of users per course *****/
|
/***** Query the number of users per course *****/
|
||||||
NumUsrsPerCrs = (Role == Rol_ROLE_GUEST__) ? 0 :
|
NumUsrsPerCrs = (Role == Rol__GUEST_) ? 0 :
|
||||||
Usr_GetNumUsrsPerCrs (Role);
|
Usr_GetNumUsrsPerCrs (Role);
|
||||||
|
|
||||||
/***** Write the total number of users *****/
|
/***** Write the total number of users *****/
|
||||||
|
@ -7421,7 +7421,7 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
||||||
(unsigned) Role);
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
return (float) ((Role == Rol_ROLE_TEACHER) ? Gbl.CurrentCrs.Crs.NumTchs :
|
return (float) ((Role == Rol_TEACHER) ? Gbl.CurrentCrs.Crs.NumTchs :
|
||||||
Gbl.CurrentCrs.Crs.NumStds);
|
Gbl.CurrentCrs.Crs.NumStds);
|
||||||
default:
|
default:
|
||||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||||
|
|
|
@ -571,10 +571,10 @@ static int Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
||||||
/* Read the maximum role */
|
/* Read the maximum role */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if (sscanf (row[0],"%u",&UsrDat->RoleInCurrentCrsDB) != 1)
|
if (sscanf (row[0],"%u",&UsrDat->RoleInCurrentCrsDB) != 1)
|
||||||
UsrDat->RoleInCurrentCrsDB = Rol_ROLE_UNKNOWN;
|
UsrDat->RoleInCurrentCrsDB = Rol_UNKNOWN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UsrDat->RoleInCurrentCrsDB = Rol_ROLE_GUEST__;
|
UsrDat->RoleInCurrentCrsDB = Rol__GUEST_;
|
||||||
|
|
||||||
/* Free structure that stores the query result */
|
/* Free structure that stores the query result */
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
@ -590,12 +590,12 @@ static int Svc_GetRoleFromInternalRole (Rol_Role_t Role)
|
||||||
{
|
{
|
||||||
switch (Role)
|
switch (Role)
|
||||||
{
|
{
|
||||||
case Rol_ROLE_GUEST__:
|
case Rol__GUEST_:
|
||||||
case Rol_ROLE_VISITOR:
|
case Rol_VISITOR:
|
||||||
return 1; // guest or visitor
|
return 1; // guest or visitor
|
||||||
case Rol_ROLE_STUDENT:
|
case Rol_STUDENT:
|
||||||
return 2; // student
|
return 2; // student
|
||||||
case Rol_ROLE_TEACHER:
|
case Rol_TEACHER:
|
||||||
return 3; // teacher
|
return 3; // teacher
|
||||||
default:
|
default:
|
||||||
return 0; // unknown
|
return 0; // unknown
|
||||||
|
@ -1112,7 +1112,7 @@ int swad__getCourses (struct soap *soap,
|
||||||
|
|
||||||
/* Get role (row[3]) */
|
/* Get role (row[3]) */
|
||||||
if (sscanf (row[3],"%u",&Role) != 1) // Role in this course
|
if (sscanf (row[3],"%u",&Role) != 1) // Role in this course
|
||||||
Role = Rol_ROLE_UNKNOWN;
|
Role = Rol_UNKNOWN;
|
||||||
getCoursesOut->coursesArray.__ptr[NumRow].userRole = Svc_GetRoleFromInternalRole (Role);
|
getCoursesOut->coursesArray.__ptr[NumRow].userRole = Svc_GetRoleFromInternalRole (Role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1181,8 +1181,8 @@ int swad__getCourseInfo (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
@ -1284,8 +1284,8 @@ int swad__getUsers (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
@ -1313,16 +1313,16 @@ int swad__getUsers (struct soap *soap,
|
||||||
" WHERE crs_usr.CrsCod='%ld' AND crs_usr.UsrCod=usr_data.UsrCod AND crs_usr.Role='%d'"
|
" WHERE crs_usr.CrsCod='%ld' AND crs_usr.UsrCod=usr_data.UsrCod AND crs_usr.Role='%d'"
|
||||||
" ORDER BY usr_data.Surname1,usr_data.Surname2,usr_data.FirstName,usr_data.UsrCod",
|
" ORDER BY usr_data.Surname1,usr_data.Surname2,usr_data.FirstName,usr_data.UsrCod",
|
||||||
(long) courseCode,
|
(long) courseCode,
|
||||||
userRole == 2 ? (unsigned) Rol_ROLE_STUDENT :
|
userRole == 2 ? (unsigned) Rol_STUDENT :
|
||||||
(unsigned) Rol_ROLE_TEACHER);
|
(unsigned) Rol_TEACHER);
|
||||||
else // Users belonging to the group
|
else // Users belonging to the group
|
||||||
sprintf (Query,"SELECT usr_data.UsrCod"
|
sprintf (Query,"SELECT usr_data.UsrCod"
|
||||||
" FROM crs_grp_usr,crs_usr,usr_data"
|
" FROM crs_grp_usr,crs_usr,usr_data"
|
||||||
" WHERE crs_grp_usr.GrpCod='%ld' AND crs_grp_usr.UsrCod=crs_usr.UsrCod AND crs_grp_usr.UsrCod=usr_data.UsrCod AND crs_usr.Role='%d'"
|
" WHERE crs_grp_usr.GrpCod='%ld' AND crs_grp_usr.UsrCod=crs_usr.UsrCod AND crs_grp_usr.UsrCod=usr_data.UsrCod AND crs_usr.Role='%d'"
|
||||||
" ORDER BY usr_data.Surname1,usr_data.Surname2,usr_data.FirstName,usr_data.UsrCod",
|
" ORDER BY usr_data.Surname1,usr_data.Surname2,usr_data.FirstName,usr_data.UsrCod",
|
||||||
(long) groupCode,
|
(long) groupCode,
|
||||||
userRole == 2 ? (unsigned) Rol_ROLE_STUDENT :
|
userRole == 2 ? (unsigned) Rol_STUDENT :
|
||||||
(unsigned) Rol_ROLE_TEACHER);
|
(unsigned) Rol_TEACHER);
|
||||||
NumRows = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get users");
|
NumRows = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get users");
|
||||||
|
|
||||||
getUsersOut->numUsers = (int) NumRows;
|
getUsersOut->numUsers = (int) NumRows;
|
||||||
|
@ -1335,7 +1335,7 @@ int swad__getUsers (struct soap *soap,
|
||||||
getUsersOut->usersArray.__ptr = soap_malloc (Gbl.soap,(getUsersOut->usersArray.__size) * sizeof (*(getUsersOut->usersArray.__ptr)));
|
getUsersOut->usersArray.__ptr = soap_malloc (Gbl.soap,(getUsersOut->usersArray.__size) * sizeof (*(getUsersOut->usersArray.__ptr)));
|
||||||
|
|
||||||
/***** Users' IDs are visible? *****/
|
/***** Users' IDs are visible? *****/
|
||||||
UsrIDIsVisible = (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_ROLE_STUDENT &&
|
UsrIDIsVisible = (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT &&
|
||||||
userRole == 2); // get students in the course
|
userRole == 2); // get students in the course
|
||||||
for (NumRow = 0;
|
for (NumRow = 0;
|
||||||
NumRow < NumRows;
|
NumRow < NumRows;
|
||||||
|
@ -1403,8 +1403,8 @@ int swad__getGroupTypes (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
@ -1508,8 +1508,8 @@ int swad__getGroups (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
@ -1631,8 +1631,8 @@ int swad__sendMyGroups (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
@ -1836,7 +1836,7 @@ int swad__getAttendanceEvents (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a teacher in the course *****/
|
/***** Check if I am a teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must be a teacher");
|
"Requester must be a teacher");
|
||||||
|
@ -2028,7 +2028,7 @@ int swad__sendAttendanceEvent (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a teacher in the course *****/
|
/***** Check if I am a teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must be a teacher");
|
"Requester must be a teacher");
|
||||||
|
@ -2171,7 +2171,7 @@ int swad__getAttendanceUsers (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a teacher in the course *****/
|
/***** Check if I am a teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must be a teacher");
|
"Requester must be a teacher");
|
||||||
|
@ -2193,7 +2193,7 @@ int swad__getAttendanceUsers (struct soap *soap,
|
||||||
" AND crs_grp_usr.UsrCod NOT IN"
|
" AND crs_grp_usr.UsrCod NOT IN"
|
||||||
" (SELECT UsrCod FROM att_usr WHERE AttCod='%ld')",
|
" (SELECT UsrCod FROM att_usr WHERE AttCod='%ld')",
|
||||||
Att.AttCod,
|
Att.AttCod,
|
||||||
(unsigned) Rol_ROLE_STUDENT,
|
(unsigned) Rol_STUDENT,
|
||||||
Att.AttCod);
|
Att.AttCod);
|
||||||
else
|
else
|
||||||
// Event for the whole course
|
// Event for the whole course
|
||||||
|
@ -2207,7 +2207,7 @@ int swad__getAttendanceUsers (struct soap *soap,
|
||||||
" AND crs_usr.UsrCod NOT IN"
|
" AND crs_usr.UsrCod NOT IN"
|
||||||
" (SELECT UsrCod FROM att_usr WHERE AttCod='%ld')",
|
" (SELECT UsrCod FROM att_usr WHERE AttCod='%ld')",
|
||||||
Att.AttCod,
|
Att.AttCod,
|
||||||
(unsigned) Rol_ROLE_STUDENT,
|
(unsigned) Rol_STUDENT,
|
||||||
Att.AttCod);
|
Att.AttCod);
|
||||||
// Query: list of users in attendance list + rest of users (subquery)
|
// Query: list of users in attendance list + rest of users (subquery)
|
||||||
sprintf (Query,"SELECT u.UsrCod,u.Present FROM "
|
sprintf (Query,"SELECT u.UsrCod,u.Present FROM "
|
||||||
|
@ -2335,7 +2335,7 @@ int swad__sendAttendanceUsers (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a teacher in the course *****/
|
/***** Check if I am a teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must be a teacher");
|
"Requester must be a teacher");
|
||||||
|
@ -3023,7 +3023,7 @@ int swad__sendNotice (struct soap *soap,
|
||||||
return ReturnCode;
|
return ReturnCode;
|
||||||
|
|
||||||
/***** Check if I am a teacher *****/
|
/***** Check if I am a teacher *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must be a teacher");
|
"Requester must be a teacher");
|
||||||
|
@ -3084,8 +3084,8 @@ int swad__getTestConfig (struct soap *soap,
|
||||||
"Course code must be a integer greater than 0");
|
"Course code must be a integer greater than 0");
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
@ -3213,8 +3213,8 @@ int swad__getTests (struct soap *soap,
|
||||||
"Course code must be a integer greater than 0");
|
"Course code must be a integer greater than 0");
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
@ -3575,8 +3575,8 @@ int swad__getDirectoryTree (struct soap *soap,
|
||||||
return ReturnCode;
|
return ReturnCode;
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
@ -3882,8 +3882,8 @@ int swad__getFile (struct soap *soap,
|
||||||
return ReturnCode;
|
return ReturnCode;
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
@ -3908,7 +3908,7 @@ int swad__getFile (struct soap *soap,
|
||||||
case Brw_ADMI_MARKS_CRS:
|
case Brw_ADMI_MARKS_CRS:
|
||||||
case Brw_ADMI_MARKS_GRP:
|
case Brw_ADMI_MARKS_GRP:
|
||||||
// Downloading a file of marks is only allowed for teachers
|
// Downloading a file of marks is only allowed for teachers
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Wrong tree",
|
"Wrong tree",
|
||||||
"Wrong file zone");
|
"Wrong file zone");
|
||||||
|
@ -4019,8 +4019,8 @@ int swad__getMarks (struct soap *soap,
|
||||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||||
|
|
||||||
/***** Check if I am a student or teacher in the course *****/
|
/***** Check if I am a student or teacher in the course *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_STUDENT &&
|
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_STUDENT &&
|
||||||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_ROLE_TEACHER)
|
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||||
return soap_receiver_fault (Gbl.soap,
|
return soap_receiver_fault (Gbl.soap,
|
||||||
"Request forbidden",
|
"Request forbidden",
|
||||||
"Requester must belong to course");
|
"Requester must belong to course");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user