mirror of https://github.com/acanas/swad-core.git
Version 14.132.7
This commit is contained in:
parent
722267bc1a
commit
d87e4a0615
|
@ -3040,7 +3040,9 @@ static void Att_ListStdsAttendanceTable (unsigned NumStdsInList,long *LstSelecte
|
|||
UsrDat.UsrCod = LstSelectedUsrCods[NumStd];
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
{
|
||||
UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (UsrDat.UsrCod);
|
||||
UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
Att_WriteRowStdSeveralAttEvents (NumStd,&UsrDat);
|
||||
}
|
||||
}
|
||||
|
@ -3247,7 +3249,9 @@ static void Att_ListStdsWithAttEventsDetails (unsigned NumStdsInList,long *LstSe
|
|||
UsrDat.UsrCod = LstSelectedUsrCods[NumStd];
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
{
|
||||
UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (UsrDat.UsrCod);
|
||||
UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
Att_ListAttEventsForAStd (NumStd,&UsrDat);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,11 +98,12 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.132.6 (2015/09/17)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.132.7 (2015/09/17)"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 14.132.7: Sep 17, 2015 Changes in users' IDs. (184706 lines)
|
||||
Version 14.132.6: Sep 17, 2015 Changes in users' IDs. (184640 lines)
|
||||
12 changes necessary in database:
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1239';
|
||||
|
|
|
@ -797,7 +797,9 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
|||
|
||||
/***** Check if the other user belongs to the current course *****/
|
||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||
UsrBelongsToCrs = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false);
|
||||
UsrBelongsToCrs = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false);
|
||||
|
||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||
{
|
||||
|
@ -1609,7 +1611,9 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
|
|||
/***** Register user in current course in database *****/
|
||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
|
||||
{
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false)) // User does belong to current course, modify his/her role
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false)) // User does belong to current course, modify his/her role
|
||||
Enr_ModifyRoleInCurrentCrs (UsrDat,RegRemRole,Cns_QUIET);
|
||||
else
|
||||
Enr_RegisterUsrInCurrentCrs (UsrDat,RegRemRole,Cns_QUIET,
|
||||
|
@ -1982,7 +1986,9 @@ void Enr_AskIfRejectSignUp (void)
|
|||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // If user's data exist...
|
||||
{
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
{
|
||||
/* User already belongs to this course */
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_is_already_enrolled_in_the_course_Y,
|
||||
|
@ -2037,7 +2043,9 @@ void Enr_RejectSignUp (void)
|
|||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // If user's data exist...
|
||||
{
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
{
|
||||
/* User already belongs to this course */
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_is_already_enrolled_in_the_course_Y,
|
||||
|
@ -2406,7 +2414,9 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
DesiredRole = Rol_ConvertUnsignedStrToRole (row[3]);
|
||||
|
||||
if (UsrExists)
|
||||
UsrBelongsToCrs = Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,Crs.CrsCod,false);
|
||||
UsrBelongsToCrs = Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Crs.CrsCod,
|
||||
false);
|
||||
else
|
||||
UsrBelongsToCrs = false;
|
||||
|
||||
|
@ -2751,9 +2761,13 @@ static void Enr_AskIfRegRemUsr (struct ListUsrCods *ListUsrCods,Rol_Role_t Role)
|
|||
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
|
||||
{
|
||||
/* Check if this user belongs to the current course */
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
{
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
if (Gbl.Usrs.Other.UsrDat.Accepted)
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_is_already_enrolled_in_the_course_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName);
|
||||
|
@ -3218,7 +3232,9 @@ void Enr_CreateNewUsr (void)
|
|||
/***** Register user in current course in database *****/
|
||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
|
||||
{
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false)) // User does belong to current course, modify his/her role
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false)) // User does belong to current course, modify his/her role
|
||||
Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole,Cns_VERBOSE);
|
||||
else
|
||||
Enr_RegisterUsrInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole,Cns_VERBOSE,
|
||||
|
@ -3282,7 +3298,9 @@ void Enr_ModifyUsr (void)
|
|||
NewRole = Rec_GetRoleFromRecordForm ();
|
||||
|
||||
/***** Register user in current course in database *****/
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false)) // User does belong to current course, modify his/her role
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false)) // User does belong to current course, modify his/her role
|
||||
Enr_ModifyRoleInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole,Cns_VERBOSE);
|
||||
else
|
||||
Enr_RegisterUsrInCurrentCrs (&Gbl.Usrs.Other.UsrDat,NewRole,Cns_VERBOSE,
|
||||
|
@ -3398,7 +3416,9 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat,bool ItsMe)
|
|||
extern const char *Txt_Remove_user_from_this_course;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
{
|
||||
sprintf (Gbl.Message,
|
||||
ItsMe ? Txt_Do_you_really_want_to_be_removed_from_the_course_X :
|
||||
|
@ -3432,7 +3452,9 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
|
|||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
char Query[1024];
|
||||
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,Crs->CrsCod,false)) // User belongs to the course
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,
|
||||
Crs->CrsCod,
|
||||
false)) // User belongs to the course
|
||||
{
|
||||
/***** Remove user from all the attendance events in course *****/
|
||||
Att_RemoveUsrFromCrsAttEvents (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
|
|
@ -2938,7 +2938,9 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void)
|
|||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get user's data from database
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
ZIP_CreateDirCompressionUsr (&UsrDat);
|
||||
}
|
||||
|
||||
|
@ -2967,7 +2969,9 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void)
|
|||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get of the database the data of the user
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
{
|
||||
/***** Show a row with the data of the owner of the works *****/
|
||||
fprintf (Gbl.F.Out,"<tr>");
|
||||
|
|
20
swad_photo.c
20
swad_photo.c
|
@ -135,19 +135,27 @@ bool Pho_CheckIfICanChangeOtherUsrPhoto (const struct UsrData *UsrDat)
|
|||
case Rol_TEACHER:
|
||||
/* If I am a teacher in current course,
|
||||
I only can change the photo of users from current course */
|
||||
return UsrDat->Accepted;
|
||||
return Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
case Rol_DEG_ADM:
|
||||
/* If I am an administrator of current degree,
|
||||
I only can change the photo of users from current degree */
|
||||
return Usr_CheckIfUsrBelongsToDeg (UsrDat->UsrCod,Gbl.CurrentDeg.Deg.DegCod,true);
|
||||
return Usr_CheckIfUsrBelongsToDeg (UsrDat->UsrCod,
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
true);
|
||||
case Rol_CTR_ADM:
|
||||
/* If I am an administrator of current centre,
|
||||
I only can change the photo of users from current centre */
|
||||
return Usr_CheckIfUsrBelongsToCtr (UsrDat->UsrCod,Gbl.CurrentCtr.Ctr.CtrCod,true);
|
||||
return Usr_CheckIfUsrBelongsToCtr (UsrDat->UsrCod,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
true);
|
||||
case Rol_INS_ADM:
|
||||
/* If I am an administrator of current institution,
|
||||
I only can change the photo of users from current institution */
|
||||
return Usr_CheckIfUsrBelongsToIns (UsrDat->UsrCod,Gbl.CurrentIns.Ins.InsCod,true);
|
||||
return Usr_CheckIfUsrBelongsToIns (UsrDat->UsrCod,
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
true);
|
||||
case Rol_SYS_ADM:
|
||||
return true;
|
||||
default:
|
||||
|
@ -337,7 +345,9 @@ void Pho_SendPhotoUsr (void)
|
|||
{
|
||||
if (Pho_CheckIfICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat)) // If I have permission to change user's photo...
|
||||
{
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
Pho_ReqUsrPhoto (&Gbl.Usrs.Other.UsrDat); // Request user's photograph
|
||||
}
|
||||
else
|
||||
|
|
|
@ -222,7 +222,9 @@ bool Prf_ShowUserProfile (void)
|
|||
Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/* Get if user has accepted enrollment in current course */
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
}
|
||||
|
||||
fprintf (Gbl.F.Out,"<table style=\"margin:0 auto;\">"
|
||||
|
|
|
@ -966,7 +966,9 @@ static void Rec_ShowRecordOneStdCrs (void)
|
|||
bool ItsMe;
|
||||
|
||||
/***** Get if student has accepted enrollment in current course *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
|
||||
/***** Asign users listing type depending on current action *****/
|
||||
Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_STUDENTS;
|
||||
|
@ -1071,9 +1073,13 @@ void Rec_ListRecordsStdsCrs (void)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
{
|
||||
UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (UsrDat.UsrCod);
|
||||
UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
|
||||
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\""
|
||||
" style=\"margin-bottom:10px;");
|
||||
|
@ -1101,6 +1107,7 @@ void Rec_ListRecordsStdsCrs (void)
|
|||
NumUsrs++;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Free memory used for user's data *****/
|
||||
Usr_UsrDataDestructor (&UsrDat);
|
||||
|
||||
|
@ -1138,7 +1145,9 @@ static void Rec_ShowRecordOneTchCrs (void)
|
|||
extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES];
|
||||
|
||||
/***** Get if teacher has accepted enrollment in current course *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
|
||||
/***** Asign users listing type depending on current action *****/
|
||||
Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_TEACHERS;
|
||||
|
@ -1240,9 +1249,13 @@ void Rec_ListRecordsTchsCrs (void)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
{
|
||||
UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (UsrDat.UsrCod);
|
||||
UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
|
||||
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\""
|
||||
" style=\"margin-bottom:10px;");
|
||||
|
@ -1919,7 +1932,9 @@ void Rec_ShowCommonRecordUnmodifiable (struct UsrData *UsrDat)
|
|||
{
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat);
|
||||
UsrDat->Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (UsrDat->UsrCod);
|
||||
UsrDat->Accepted = Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
|
||||
/***** Show user's record *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
|
||||
|
@ -2224,9 +2239,8 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
|||
(Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_INS_ADM) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||
{
|
||||
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActReqMdfStd :
|
||||
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActReqMdfTch :
|
||||
ActReqMdfGst));
|
||||
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActReqMdfTch :
|
||||
ActReqMdfStd);
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||
Act_LinkFormSubmit (Txt_Admin_user,NULL);
|
||||
fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\""
|
||||
|
|
|
@ -6041,7 +6041,9 @@ void Tst_ShowUsrsTestResults (void)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get of the database the data of the user
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
/***** Show the result of test exams *****/
|
||||
Tst_ShowResultsOfTestExams (&Gbl.Usrs.Other.UsrDat);
|
||||
}
|
||||
|
|
71
swad_user.c
71
swad_user.c
|
@ -423,7 +423,7 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
if (UsrDat->RoleInCurrentCrsDB == Rol_UNKNOWN)
|
||||
UsrDat->RoleInCurrentCrsDB = (UsrDat->Roles < (1 << Rol_STUDENT)) ?
|
||||
Rol__GUEST_ : // User does not belong to any course
|
||||
Rol_VISITOR; // User belongs to some courses
|
||||
Rol_VISITOR; // User belongs to some courses
|
||||
|
||||
/* Get name */
|
||||
strncpy (UsrDat->Surname1 ,row[2],sizeof (UsrDat->Surname1 ) - 1);
|
||||
|
@ -1013,11 +1013,18 @@ void Usr_GetMyCourses (void)
|
|||
/**************** Check if a user belongs to an institution ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Usr_CheckIfUsrBelongsToIns (long UsrCod,long InsCod,bool CountOnlyAcceptedCourses)
|
||||
bool Usr_CheckIfUsrBelongsToIns (long UsrCod,
|
||||
long InsCod,
|
||||
bool CountOnlyAcceptedCourses)
|
||||
{
|
||||
char Query[512];
|
||||
const char *SubQuery;
|
||||
|
||||
/***** Trivial case *****/
|
||||
if (UsrCod <= 0 ||
|
||||
InsCod <= 0)
|
||||
return false;
|
||||
|
||||
/***** Get is a user belongs to an institution from database *****/
|
||||
SubQuery = (CountOnlyAcceptedCourses ? " AND crs_usr.Accepted='Y'" :
|
||||
"");
|
||||
|
@ -1036,11 +1043,18 @@ bool Usr_CheckIfUsrBelongsToIns (long UsrCod,long InsCod,bool CountOnlyAcceptedC
|
|||
/******************* Check if a user belongs to a centre *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Usr_CheckIfUsrBelongsToCtr (long UsrCod,long CtrCod,bool CountOnlyAcceptedCourses)
|
||||
bool Usr_CheckIfUsrBelongsToCtr (long UsrCod,
|
||||
long CtrCod,
|
||||
bool CountOnlyAcceptedCourses)
|
||||
{
|
||||
char Query[512];
|
||||
const char *SubQuery;
|
||||
|
||||
/***** Trivial case *****/
|
||||
if (UsrCod <= 0 ||
|
||||
CtrCod <= 0)
|
||||
return false;
|
||||
|
||||
/***** Get is a user belongs to a centre from database *****/
|
||||
SubQuery = (CountOnlyAcceptedCourses ? " AND crs_usr.Accepted='Y'" :
|
||||
"");
|
||||
|
@ -1058,11 +1072,18 @@ bool Usr_CheckIfUsrBelongsToCtr (long UsrCod,long CtrCod,bool CountOnlyAcceptedC
|
|||
/******************* Check if a user belongs to a degree *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Usr_CheckIfUsrBelongsToDeg (long UsrCod,long DegCod,bool CountOnlyAcceptedCourses)
|
||||
bool Usr_CheckIfUsrBelongsToDeg (long UsrCod,
|
||||
long DegCod,
|
||||
bool CountOnlyAcceptedCourses)
|
||||
{
|
||||
char Query[512];
|
||||
const char *SubQuery;
|
||||
|
||||
/***** Trivial case *****/
|
||||
if (UsrCod <= 0 ||
|
||||
DegCod <= 0)
|
||||
return false;
|
||||
|
||||
/***** Get is a user belongs to a degree from database *****/
|
||||
SubQuery = (CountOnlyAcceptedCourses ? " AND crs_usr.Accepted='Y'" :
|
||||
"");
|
||||
|
@ -1079,12 +1100,14 @@ bool Usr_CheckIfUsrBelongsToDeg (long UsrCod,long DegCod,bool CountOnlyAcceptedC
|
|||
/******************** Check if a user belongs to a course ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Usr_CheckIfUsrBelongsToCrs (long UsrCod,long CrsCod,bool CountOnlyAcceptedCourses)
|
||||
bool Usr_CheckIfUsrBelongsToCrs (long UsrCod,
|
||||
long CrsCod,
|
||||
bool CountOnlyAcceptedCourses)
|
||||
{
|
||||
char Query[512];
|
||||
const char *SubQuery;
|
||||
|
||||
/***** If user code or course code not valid... *****/
|
||||
/***** Trivial case *****/
|
||||
if (UsrCod <= 0 ||
|
||||
CrsCod <= 0)
|
||||
return false;
|
||||
|
@ -2394,7 +2417,11 @@ static void Usr_SetUsrRoleAndPrefs (void)
|
|||
else
|
||||
Gbl.Usrs.Me.IBelongToCurrentCrs = false;
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
Gbl.Usrs.Me.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
Gbl.Usrs.Me.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
true);
|
||||
else
|
||||
Gbl.Usrs.Me.UsrDat.Accepted = false;
|
||||
|
||||
/***** Check if I belong to current degree *****/
|
||||
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
||||
|
@ -2560,36 +2587,6 @@ bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
return false;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Get if a user has accepted to belong to current course ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (long UsrCod)
|
||||
{
|
||||
char Query[128];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
bool Accepted = false;
|
||||
|
||||
/***** Get if a user has accepted belonging to current course *****/
|
||||
sprintf (Query,"SELECT Accepted FROM crs_usr"
|
||||
" WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,UsrCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,
|
||||
"can not check if a user has accepted"
|
||||
" the enrollment in the current course") == 1)
|
||||
{
|
||||
/* Get if accepted */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Accepted = (Str_ConvertToUpperLetter (row[0][0]) == 'Y');
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return Accepted;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Update my last accessed course, tab and time in database **********/
|
||||
/*****************************************************************************/
|
||||
|
|
17
swad_user.h
17
swad_user.h
|
@ -220,10 +220,18 @@ void Usr_GetMyInstitutions (void);
|
|||
void Usr_GetMyCentres (void);
|
||||
void Usr_GetMyDegrees (void);
|
||||
void Usr_GetMyCourses (void);
|
||||
bool Usr_CheckIfUsrBelongsToIns (long UsrCod,long InsCod,bool CountOnlyAcceptedCourses);
|
||||
bool Usr_CheckIfUsrBelongsToCtr (long UsrCod,long CtrCod,bool CountOnlyAcceptedCourses);
|
||||
bool Usr_CheckIfUsrBelongsToDeg (long UsrCod,long DegCod,bool CountOnlyAcceptedCourses);
|
||||
bool Usr_CheckIfUsrBelongsToCrs (long UsrCod,long CrsCod,bool CountOnlyAcceptedCourses);
|
||||
bool Usr_CheckIfUsrBelongsToIns (long UsrCod,
|
||||
long InsCod,
|
||||
bool CountOnlyAcceptedCourses);
|
||||
bool Usr_CheckIfUsrBelongsToCtr (long UsrCod,
|
||||
long CtrCod,
|
||||
bool CountOnlyAcceptedCourses);
|
||||
bool Usr_CheckIfUsrBelongsToDeg (long UsrCod,
|
||||
long DegCod,
|
||||
bool CountOnlyAcceptedCourses);
|
||||
bool Usr_CheckIfUsrBelongsToCrs (long UsrCod,
|
||||
long CrsCod,
|
||||
bool CountOnlyAcceptedCourses);
|
||||
bool Usr_CheckIfIBelongToIns (long InsCod);
|
||||
bool Usr_CheckIfIBelongToCtr (long CtrCod);
|
||||
bool Usr_CheckIfIBelongToDeg (long DegCod);
|
||||
|
@ -257,7 +265,6 @@ void Usr_WarningWhenDegreeTypeDoesntAllowDirectLogin (void);
|
|||
void Usr_ShowFormsLogoutAndRole (void);
|
||||
|
||||
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat);
|
||||
bool Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (long UsrCod);
|
||||
void Usr_UpdateMyLastData (void);
|
||||
void Usr_InsertMyLastCrsTabAndTime (void);
|
||||
|
||||
|
|
|
@ -2459,7 +2459,9 @@ int swad__sendAttendanceUsers (struct soap *soap,
|
|||
if (Usr_ChkIfUsrCodExists (UsrCod))
|
||||
// The user must belong to course,
|
||||
// but it's not necessary he/she belongs to groups associated to the event
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrCod,Gbl.CurrentCrs.Crs.CrsCod,false))
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
false))
|
||||
{
|
||||
/* Mark user as present */
|
||||
Att_RegUsrInAttEventNotChangingComments (Att.AttCod,UsrCod);
|
||||
|
|
Loading…
Reference in New Issue