diff --git a/swad_API.c b/swad_API.c
index 58927218..789aa480 100644
--- a/swad_API.c
+++ b/swad_API.c
@@ -3145,7 +3145,7 @@ int swad__sendAttendanceUsers (struct soap *soap,
/* Find next string in text until comma (leading and trailing spaces are removed) */
Str_GetNextStringUntilComma (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
if ((UsrDat.UsrCod = Str_ConvertStrCodToLongCod (LongStr)) > 0)
- if (Usr_ChkIfUsrCodExists (UsrDat.UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (UsrDat.UsrCod))
// The user must belong to course,
// but it's not necessary he/she belongs to groups associated to the event
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
diff --git a/swad_account.c b/swad_account.c
index 33c426f9..e986ccab 100644
--- a/swad_account.c
+++ b/swad_account.c
@@ -142,9 +142,9 @@ void Acc_ShowFormMyAccount (void)
{
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- Usr_PutLinkToLogin ();
- Pwd_PutLinkToSendNewPasswd ();
- Lan_PutLinkToChangeLanguage ();
+ Usr_PutLinkToLogin ();
+ Pwd_PutLinkToSendNewPasswd ();
+ Lan_PutLinkToChangeLanguage ();
Mnu_ContextMenuEnd ();
/**** Show form to check if I have an account *****/
@@ -786,7 +786,7 @@ static void Acc_CreateNewEncryptedUsrCod (struct UsrData *UsrDat)
{
Str_CreateRandomAlphanumStr (RandomStr,LENGTH_RANDOM_STR);
Cry_EncryptSHA256Base64 (RandomStr,UsrDat->EnUsrCod);
- if (!Usr_ChkIfEncryptedUsrCodExists (UsrDat->EnUsrCod))
+ if (!Usr_DB_ChkIfEncryptedUsrCodExists (UsrDat->EnUsrCod))
break;
}
if (NumTry == MAX_TRY)
@@ -923,7 +923,7 @@ static void Acc_AskIfRemoveOtherUsrAccount (void)
extern const char *Txt_Do_you_really_want_to_completely_eliminate_the_following_user;
extern const char *Txt_Eliminate_user_account;
- if (Usr_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod))
{
/***** Show question and button to remove user account *****/
/* Begin alert */
diff --git a/swad_admin.c b/swad_admin.c
index 339f55f4..e921cbf3 100644
--- a/swad_admin.c
+++ b/swad_admin.c
@@ -149,7 +149,7 @@ static void Adm_ReqAddAdm (HieLvl_Level_t Scope,long Cod,
(Scope == HieLvl_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
if (ICanRegister)
{
- if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is already an administrator of current institution/center/degree
+ if (Usr_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is already an administrator of current institution/center/degree
{
Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_is_already_an_administrator_of_Y,
Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName);
@@ -253,7 +253,7 @@ static void Adm_RegisterAdmin (struct UsrData *UsrDat,
extern const char *Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y;
/***** Check if user was and administrator of current institution/center/degree *****/
- if (Usr_CheckIfUsrIsAdm (UsrDat->UsrCod,Scope,Cod))
+ if (Usr_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Scope,Cod))
Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_is_already_an_administrator_of_Y,
UsrDat->FullName,InsCtrDegName);
else // User was not administrator of current institution/center/degree
@@ -352,7 +352,7 @@ static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,
if (ICanRemove)
{
/* Check if the other user is an admin of the current institution/center/degree */
- if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod))
+ if (Usr_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod))
{ // The other user is an administrator of current institution/center/degree ==> ask for removing or remove her/him
switch (ReqDelOrDelUsr)
{
@@ -399,7 +399,7 @@ static void Adm_AskIfRemAdm (bool ItsMe,HieLvl_Level_t Scope,
[HieLvl_CRS] = ActUnk,
};
- if (Usr_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod))
{
/***** Show question and button to remove user as administrator *****/
/* Begin alert */
@@ -432,7 +432,7 @@ static void Adm_EffectivelyRemAdm (struct UsrData *UsrDat,
extern const char *Txt_THE_USER_X_has_been_removed_as_administrator_of_Y;
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_Y;
- if (Usr_CheckIfUsrIsAdm (UsrDat->UsrCod,Scope,Cod)) // User is administrator of current institution/center/degree
+ if (Usr_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Scope,Cod)) // User is administrator of current institution/center/degree
{
/***** Remove user as administrator of institution, center or degree *****/
Adm_DB_RemAdmin (UsrDat->UsrCod,Scope,Cod);
diff --git a/swad_browser.c b/swad_browser.c
index a268f967..a97f0dbf 100644
--- a/swad_browser.c
+++ b/swad_browser.c
@@ -6407,7 +6407,7 @@ static void Brw_PasteClipboard (void)
if (Crs_GetDataOfCourseByCod (&Hie.Crs))
{
Usr_UsrDataConstructor (&UsrDat);
- if (Usr_ChkIfUsrCodExists (Gbl.FileBrowser.Clipboard.WorksUsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (Gbl.FileBrowser.Clipboard.WorksUsrCod))
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
diff --git a/swad_changelog.h b/swad_changelog.h
index 0d3410b7..ff33fb15 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
*/
-#define Log_PLATFORM_VERSION "SWAD 21.47.1 (2021-10-28)"
+#define Log_PLATFORM_VERSION "SWAD 21.47.2 (2021-10-29)"
#define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.69.1.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
+ Version 21.47.2: Oct 29, 2021 Queries moved to module swad_questions_database. (321259 lines)
Version 21.47.1: Oct 28, 2021 Queries moved to module swad_questions_database. (321231 lines)
Version 21.47: Oct 27, 2021 New module swad_questions_database for database queries related to test/exam/game questions. (321236 lines)
Version 21.46.5: Oct 27, 2021 Queries moved to module swad_test_database. (321140 lines)
diff --git a/swad_connected.c b/swad_connected.c
index 6d47130a..250f18f5 100644
--- a/swad_connected.c
+++ b/swad_connected.c
@@ -95,7 +95,7 @@ void Con_ShowConnectedUsrs (void)
if (Gbl.Usrs.Me.Logged)
{
Mnu_ContextMenuBegin ();
- Log_PutLinkToLastClicks (); // Show last clicks in real time
+ Log_PutLinkToLastClicks (); // Show last clicks in real time
Mnu_ContextMenuEnd ();
}
diff --git a/swad_course.c b/swad_course.c
index e36ffe40..921b3230 100644
--- a/swad_course.c
+++ b/swad_course.c
@@ -213,7 +213,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
HTM_LI_End ();
/***** Get my countries *****/
- NumCtys = Usr_GetCtysFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,&mysql_resCty);
+ NumCtys = Usr_DB_GetCtysFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,&mysql_resCty);
for (NumCty = 0;
NumCty < NumCtys;
NumCty++)
diff --git a/swad_course_config.c b/swad_course_config.c
index a4457819..477d93ce 100644
--- a/swad_course_config.c
+++ b/swad_course_config.c
@@ -109,7 +109,7 @@ void CrsCfg_Configuration (bool PrintView)
Gbl.Usrs.Me.Role.Logged == Rol_USR)
{
Mnu_ContextMenuBegin ();
- Enr_PutLinkToRequestSignUp (); // Request enrolment in the current course
+ Enr_PutLinkToRequestSignUp (); // Request enrolment in the current course
Mnu_ContextMenuEnd ();
}
diff --git a/swad_department.c b/swad_department.c
index df3af967..c4107331 100644
--- a/swad_department.c
+++ b/swad_department.c
@@ -196,7 +196,7 @@ void Dpt_SeeDepts (void)
HTM_TR_End ();
/***** Write teachers of this institution with other department *****/
- NumTchsInsInOtherDpts = Usr_GetNumTchsCurrentInsInDepartment (0);
+ NumTchsInsInOtherDpts = Usr_DB_GetNumTchsCurrentInsInDepartment (0);
HTM_TR_Begin (NULL);
@@ -211,7 +211,7 @@ void Dpt_SeeDepts (void)
HTM_TR_End ();
/***** Write teachers with no department *****/
- NumTchsInsWithNoDpt = Usr_GetNumTchsCurrentInsInDepartment (-1L);
+ NumTchsInsWithNoDpt = Usr_DB_GetNumTchsCurrentInsInDepartment (-1L);
HTM_TR_Begin (NULL);
diff --git a/swad_duplicate.c b/swad_duplicate.c
index fdb71b81..ce531496 100644
--- a/swad_duplicate.c
+++ b/swad_duplicate.c
@@ -166,8 +166,8 @@ void Dup_ListDuplicateUsrs (void)
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
{
/* Get if user has accepted all his/her courses */
- if (Usr_GetNumCrssOfUsr (UsrDat.UsrCod) != 0)
- UsrDat.Accepted = (Usr_GetNumCrssOfUsrNotAccepted (UsrDat.UsrCod) == 0);
+ if (Usr_DB_GetNumCrssOfUsr (UsrDat.UsrCod) != 0)
+ UsrDat.Accepted = (Usr_DB_GetNumCrssOfUsrNotAccepted (UsrDat.UsrCod) == 0);
else
UsrDat.Accepted = false;
@@ -283,8 +283,8 @@ static void Dup_ListSimilarUsrs (void)
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
{
/* Get if user has accepted all his/her courses */
- if (Usr_GetNumCrssOfUsr (UsrDat.UsrCod) != 0)
- UsrDat.Accepted = (Usr_GetNumCrssOfUsrNotAccepted (UsrDat.UsrCod) == 0);
+ if (Usr_DB_GetNumCrssOfUsr (UsrDat.UsrCod) != 0)
+ UsrDat.Accepted = (Usr_DB_GetNumCrssOfUsrNotAccepted (UsrDat.UsrCod) == 0);
else
UsrDat.Accepted = false;
diff --git a/swad_enrolment.c b/swad_enrolment.c
index cbd8e507..a0d3a704 100644
--- a/swad_enrolment.c
+++ b/swad_enrolment.c
@@ -580,31 +580,31 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
{
Mnu_ContextMenuBegin ();
- switch (Role)
- {
- case Rol_STD:
- /* Put link to go to admin student */
- Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd);
+ switch (Role)
+ {
+ case Rol_STD:
+ /* Put link to go to admin student */
+ Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd);
- /* Put link to remove all the students in the current course */
- if (Usr_GetNumUsrsInCrss (HieLvl_CRS,Gbl.Hierarchy.Crs.CrsCod,
- 1 << Rol_STD)) // This course has students
- Enr_PutLinkToRemAllStdsThisCrs ();
- break;
- case Rol_NET:
- /* Put link to go to admin teacher */
- Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch);
- break;
- case Rol_TCH:
- /* Put link to go to admin teacher */
- Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch);
- break;
- default:
- NextAction = ActUnk;
- Title = NULL;
- Err_WrongRoleExit ();
- break;
- }
+ /* Put link to remove all the students in the current course */
+ if (Usr_GetNumUsrsInCrss (HieLvl_CRS,Gbl.Hierarchy.Crs.CrsCod,
+ 1 << Rol_STD)) // This course has students
+ Enr_PutLinkToRemAllStdsThisCrs ();
+ break;
+ case Rol_NET:
+ /* Put link to go to admin teacher */
+ Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch);
+ break;
+ case Rol_TCH:
+ /* Put link to go to admin teacher */
+ Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch);
+ break;
+ default:
+ NextAction = ActUnk;
+ Title = NULL;
+ Err_WrongRoleExit ();
+ break;
+ }
Mnu_ContextMenuEnd ();
}
@@ -1368,20 +1368,20 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
if (Gbl.Hierarchy.Ins.InsCod > 0)
{
/***** Check if the other user is administrator of the current institution *****/
- UsrIsInsAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
+ UsrIsInsAdmin = Usr_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
HieLvl_INS,
Gbl.Hierarchy.Ins.InsCod);
if (Gbl.Hierarchy.Ctr.CtrCod > 0)
{
/***** Check if the other user is administrator of the current center *****/
- UsrIsCtrAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
+ UsrIsCtrAdmin = Usr_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
HieLvl_CTR,
Gbl.Hierarchy.Ctr.CtrCod);
if (Gbl.Hierarchy.Deg.DegCod > 0)
/***** Check if the other user is administrator of the current degree *****/
- UsrIsDegAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
+ UsrIsDegAdmin = Usr_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
HieLvl_DEG,
Gbl.Hierarchy.Deg.DegCod);
}
@@ -2651,7 +2651,7 @@ static void Enr_ShowFormToEditOtherUsr (void)
extern const char *Txt_THE_USER_X_already_exists_in_Y;
/***** If user exists... *****/
- if (Usr_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod))
{
/***** Show form to edit user *****/
if (Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
diff --git a/swad_follow.c b/swad_follow.c
index b2cb64c6..11e79486 100644
--- a/swad_follow.c
+++ b/swad_follow.c
@@ -133,8 +133,8 @@ void Fol_SuggestUsrsToFollowMainZone (void)
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- Prf_PutLinkMyPublicProfile (); // My public profile
- Prf_PutLinkRequestAnotherUserProfile (); // Request another user's profile
+ Prf_PutLinkMyPublicProfile (); // My public profile
+ Prf_PutLinkRequestAnotherUserProfile (); // Request another user's profile
Mnu_ContextMenuEnd ();
/***** Get users *****/
diff --git a/swad_mail.c b/swad_mail.c
index 4867e693..02f5006b 100644
--- a/swad_mail.c
+++ b/swad_mail.c
@@ -886,18 +886,18 @@ static void Mai_ListEmails (__attribute__((unused)) void *Args)
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- /* Open the client email program */
- HTM_A_Begin ("href=\"mailto:%s?subject=%s&cc=%s&bcc=%s\""
- " title=\"%s\" class=\"%s\"",
- Gbl.Usrs.Me.UsrDat.Email,
- Gbl.Hierarchy.Crs.FullName,
- Gbl.Usrs.Me.UsrDat.Email,
- StrAddresses,
- Txt_Create_email_message,
- The_ClassFormOutBoxBold[Gbl.Prefs.Theme]);
- Ico_PutIconTextLink ("marker.svg",
- Txt_Create_email_message);
- HTM_A_End ();
+ /* Open the client email program */
+ HTM_A_Begin ("href=\"mailto:%s?subject=%s&cc=%s&bcc=%s\""
+ " title=\"%s\" class=\"%s\"",
+ Gbl.Usrs.Me.UsrDat.Email,
+ Gbl.Hierarchy.Crs.FullName,
+ Gbl.Usrs.Me.UsrDat.Email,
+ StrAddresses,
+ Txt_Create_email_message,
+ The_ClassFormOutBoxBold[Gbl.Prefs.Theme]);
+ Ico_PutIconTextLink ("marker.svg",
+ Txt_Create_email_message);
+ HTM_A_End ();
Mnu_ContextMenuEnd ();
diff --git a/swad_mark.c b/swad_mark.c
index 41ccad5d..0157f2df 100644
--- a/swad_mark.c
+++ b/swad_mark.c
@@ -561,7 +561,7 @@ void Mrk_ShowMyMarks (void)
{
if (Grp_DB_CountNumUsrsInGrp (Rol_STD,Gbl.Crs.Grps.GrpCod)) // If there are students in this group
{
- Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromGrp (Gbl.Crs.Grps.GrpCod);
+ Gbl.Usrs.Other.UsrDat.UsrCod = Usr_DB_GetRamdomStdFromGrp (Gbl.Crs.Grps.GrpCod);
UsrDat = &Gbl.Usrs.Other.UsrDat;
}
else
@@ -572,7 +572,7 @@ void Mrk_ShowMyMarks (void)
if (Usr_GetNumUsrsInCrss (HieLvl_CRS,Gbl.Hierarchy.Crs.CrsCod,
1 << Rol_STD)) // If there are students in this course
{
- Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromCrs (Gbl.Hierarchy.Crs.CrsCod);
+ Gbl.Usrs.Other.UsrDat.UsrCod = Usr_DB_GetRamdomStdFromCrs (Gbl.Hierarchy.Crs.CrsCod);
UsrDat = &Gbl.Usrs.Other.UsrDat;
}
else
diff --git a/swad_message.c b/swad_message.c
index e8029ccc..e2214e53 100644
--- a/swad_message.c
+++ b/swad_message.c
@@ -413,11 +413,11 @@ static void Msg_PutLinkToShowMorePotentialRecipients (const struct Msg_Messages
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- Lay_PutContextualLinkIconTextOnSubmit (ActReqMsgUsr,NULL,
- Msg_PutParamsShowMorePotentialRecipients,Messages,
- "users.svg",
- Txt_Show_more_recipients,
- "CopyMessageToHiddenFields();"); // Shor more potential recipients
+ Lay_PutContextualLinkIconTextOnSubmit (ActReqMsgUsr,NULL,
+ Msg_PutParamsShowMorePotentialRecipients,Messages,
+ "users.svg",
+ Txt_Show_more_recipients,
+ "CopyMessageToHiddenFields();"); // Shor more potential recipients
Mnu_ContextMenuEnd ();
}
diff --git a/swad_photo.c b/swad_photo.c
index b5998c00..2b44f32f 100644
--- a/swad_photo.c
+++ b/swad_photo.c
@@ -1914,51 +1914,51 @@ static void Pho_PutLinkToCalculateDegreeStats (const struct Pho_DegPhotos *DegPh
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- /* Begin form */
- Frm_BeginForm (ActCalPhoDeg);
- Pho_PutHiddenParamTypeOfAvg (DegPhotos->TypeOfAverage);
- Pho_PutHiddenParamPhotoSize (DegPhotos->HowComputePhotoSize);
- Pho_PutHiddenParamOrderDegrees (DegPhotos->HowOrderDegrees);
- Usr_PutParamsPrefsAboutUsrList ();
+ /* Begin form */
+ Frm_BeginForm (ActCalPhoDeg);
+ Pho_PutHiddenParamTypeOfAvg (DegPhotos->TypeOfAverage);
+ Pho_PutHiddenParamPhotoSize (DegPhotos->HowComputePhotoSize);
+ Pho_PutHiddenParamOrderDegrees (DegPhotos->HowOrderDegrees);
+ Usr_PutParamsPrefsAboutUsrList ();
- HTM_BUTTON_Animated_Begin (Txt_Calculate_average_photo_of_THE_DEGREE_X,
- The_ClassFormLinkInBoxBold[Gbl.Prefs.Theme],
- NULL);
- Ico_PutCalculateIconWithText (Txt_Calculate_average_photo_of_THE_DEGREE_X);
- HTM_BUTTON_End ();
+ HTM_BUTTON_Animated_Begin (Txt_Calculate_average_photo_of_THE_DEGREE_X,
+ The_ClassFormLinkInBoxBold[Gbl.Prefs.Theme],
+ NULL);
+ Ico_PutCalculateIconWithText (Txt_Calculate_average_photo_of_THE_DEGREE_X);
+ HTM_BUTTON_End ();
- /* Selector with all the degrees with students */
- HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
- "name=\"OthDegCod\"");
- for (NumDeg = 0;
- NumDeg < Degs.Num;
- NumDeg++)
- {
- /* Get time to compute average photo of this degree */
- EstimatedTimeToComputeAvgPhotoInMicroseconds = Pho_GetTimeToComputeAvgPhoto (Degs.Lst[NumDeg].DegCod);
- if (EstimatedTimeToComputeAvgPhotoInMicroseconds == -1L)
- Str_Copy (StrEstimatedTimeToComputeAvgPhoto,Txt_unknown_TIME,
- sizeof (StrEstimatedTimeToComputeAvgPhoto) - 1);
- else
- Sta_WriteTime (StrEstimatedTimeToComputeAvgPhoto,
- EstimatedTimeToComputeAvgPhotoInMicroseconds);
+ /* Selector with all the degrees with students */
+ HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
+ "name=\"OthDegCod\"");
+ for (NumDeg = 0;
+ NumDeg < Degs.Num;
+ NumDeg++)
+ {
+ /* Get time to compute average photo of this degree */
+ EstimatedTimeToComputeAvgPhotoInMicroseconds = Pho_GetTimeToComputeAvgPhoto (Degs.Lst[NumDeg].DegCod);
+ if (EstimatedTimeToComputeAvgPhotoInMicroseconds == -1L)
+ Str_Copy (StrEstimatedTimeToComputeAvgPhoto,Txt_unknown_TIME,
+ sizeof (StrEstimatedTimeToComputeAvgPhoto) - 1);
+ else
+ Sta_WriteTime (StrEstimatedTimeToComputeAvgPhoto,
+ EstimatedTimeToComputeAvgPhotoInMicroseconds);
- Selected = (Degs.Lst[NumDeg].DegCod == Deg.DegCod);
- if (Selected)
- Disabled = false;
- else
- // Too recently computed ?
- Disabled = Pho_GetTimeAvgPhotoWasComputed (Degs.Lst[NumDeg].DegCod) >=
- Gbl.StartExecutionTimeUTC - Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO;
- HTM_OPTION (HTM_Type_LONG,&Degs.Lst[NumDeg].DegCod,Selected,Disabled,
- "%s (%s: %s)",
- Degs.Lst[NumDeg].ShrtName,
- Txt_time,StrEstimatedTimeToComputeAvgPhoto);
- }
- HTM_SELECT_End ();
+ Selected = (Degs.Lst[NumDeg].DegCod == Deg.DegCod);
+ if (Selected)
+ Disabled = false;
+ else
+ // Too recently computed ?
+ Disabled = Pho_GetTimeAvgPhotoWasComputed (Degs.Lst[NumDeg].DegCod) >=
+ Gbl.StartExecutionTimeUTC - Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO;
+ HTM_OPTION (HTM_Type_LONG,&Degs.Lst[NumDeg].DegCod,Selected,Disabled,
+ "%s (%s: %s)",
+ Degs.Lst[NumDeg].ShrtName,
+ Txt_time,StrEstimatedTimeToComputeAvgPhoto);
+ }
+ HTM_SELECT_End ();
- /* End form and contextual menu */
- Frm_EndForm ();
+ /* End form and contextual menu */
+ Frm_EndForm ();
Mnu_ContextMenuEnd ();
/***** Free list of all the degrees with students *****/
diff --git a/swad_profile.c b/swad_profile.c
index e352f95b..3182cefc 100644
--- a/swad_profile.c
+++ b/swad_profile.c
@@ -526,7 +526,7 @@ static void Prf_ShowNumCrssWithRole (const struct UsrData *UsrDat,
unsigned NumCrss;
/***** Number of courses in which the user has a given role *****/
- NumCrss = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Role);
+ NumCrss = Usr_DB_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Role);
Prf_BeginListItem (Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex],Rol_Icons[Role]);
@@ -955,7 +955,7 @@ static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
MYSQL_ROW row;
struct Prf_UsrFigures UsrFigures;
- if (Usr_ChkIfUsrCodExists (UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (UsrCod))
{
/***** Reset user's figures *****/
Prf_ResetUsrFigures (&UsrFigures);
@@ -989,7 +989,7 @@ static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod)
{
struct Prf_UsrFigures UsrFigures;
- if (Usr_ChkIfUsrCodExists (UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (UsrCod))
{
/***** Reset user's figures *****/
Prf_ResetUsrFigures (&UsrFigures);
@@ -1013,7 +1013,7 @@ static void Prf_GetNumTimelinePubsAndStoreAsUsrFigure (long UsrCod)
{
struct Prf_UsrFigures UsrFigures;
- if (Usr_ChkIfUsrCodExists (UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (UsrCod))
{
/***** Reset user's figures *****/
Prf_ResetUsrFigures (&UsrFigures);
@@ -1037,7 +1037,7 @@ static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
{
struct Prf_UsrFigures UsrFigures;
- if (Usr_ChkIfUsrCodExists (UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (UsrCod))
{
/***** Reset user's figures *****/
Prf_ResetUsrFigures (&UsrFigures);
@@ -1061,7 +1061,7 @@ static void Prf_GetNumForumPostsAndStoreAsUsrFigure (long UsrCod)
{
struct Prf_UsrFigures UsrFigures;
- if (Usr_ChkIfUsrCodExists (UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (UsrCod))
{
/***** Reset user's figures *****/
Prf_ResetUsrFigures (&UsrFigures);
@@ -1085,7 +1085,7 @@ static void Prf_GetNumMessagesSentAndStoreAsUsrFigure (long UsrCod)
{
struct Prf_UsrFigures UsrFigures;
- if (Usr_ChkIfUsrCodExists (UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (UsrCod))
{
/***** Reset user's figures *****/
Prf_ResetUsrFigures (&UsrFigures);
diff --git a/swad_question.c b/swad_question.c
index b776c790..2155c6b7 100644
--- a/swad_question.c
+++ b/swad_question.c
@@ -753,14 +753,13 @@ void Qst_ListQuestionsToEdit (void)
if (Tst_GetParamsTst (&Questions,Tst_EDIT_QUESTIONS)) // Get parameters from the form
{
/***** Get question codes from database *****/
- Qst_GetQuestions (&Questions,&mysql_res); // Query database
- if (Questions.NumQsts)
+ if ((Questions.NumQsts = Qst_DB_GetQsts (&mysql_res,&Questions)))
{
/* Contextual menu */
if (QstImp_GetCreateXMLParamFromForm ())
{
Mnu_ContextMenuBegin ();
- QstImp_CreateXML (Questions.NumQsts,mysql_res); // Create XML file with exported questions...
+ QstImp_CreateXML (Questions.NumQsts,mysql_res); // Create XML file with exported questions...
// ...and put a link to download it
Mnu_ContextMenuEnd ();
}
@@ -795,8 +794,7 @@ void Qst_ListQuestionsToSelectForExamSet (struct Exa_Exams *Exams)
/***** Get parameters, query the database and list the questions *****/
if (Tst_GetParamsTst (&Questions,Tst_SELECT_QUESTIONS_FOR_EXAM)) // Get parameters from the form
{
- Qst_GetQuestions (&Questions,&mysql_res); // Query database
- if (Questions.NumQsts)
+ if ((Questions.NumQsts = Qst_DB_GetQsts (&mysql_res,&Questions)))
/* Show the table with the questions */
Qst_ListOneOrMoreQstsForSelectionForExamSet (Exams,Questions.NumQsts,mysql_res);
@@ -826,8 +824,7 @@ void Qst_ListQuestionsToSelectForGame (struct Gam_Games *Games)
/***** Get parameters, query the database and list the questions *****/
if (Tst_GetParamsTst (&Questions,Tst_SELECT_QUESTIONS_FOR_GAME)) // Get parameters from the form
{
- Qst_GetQuestions (&Questions,&mysql_res); // Query database
- if (Questions.NumQsts)
+ if ((Questions.NumQsts = Qst_DB_GetQsts (&mysql_res,&Questions)))
/* Show the table with the questions */
Qst_ListOneOrMoreQstsForSelectionForGame (Games,Questions.NumQsts,mysql_res);
@@ -1720,149 +1717,6 @@ void Qst_CheckIfNumberOfAnswersIsOne (const struct Qst_Question *Question)
Err_WrongAnswerExit ();
}
-/*****************************************************************************/
-/********** Get from the database several test questions for listing *********/
-/*****************************************************************************/
-
-#define Qst_MAX_BYTES_QUERY_QUESTIONS (16 * 1024 - 1)
-
-void Qst_GetQuestions (struct Qst_Questions *Questions,MYSQL_RES **mysql_res)
- {
- extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES];
- extern const char *Txt_No_questions_found_matching_your_search_criteria;
- char *Query = NULL;
- long LengthQuery;
- unsigned NumItemInList;
- const char *Ptr;
- char TagText[Tag_MAX_BYTES_TAG + 1];
- char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
- char UnsignedStr[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
- Qst_AnswerType_t AnsType;
- char CrsCodStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
-
- /***** Allocate space for query *****/
- if ((Query = malloc (Qst_MAX_BYTES_QUERY_QUESTIONS + 1)) == NULL)
- Err_NotEnoughMemoryExit ();
-
- /***** Select questions *****/
- /* Begin query */
- Str_Copy (Query,"SELECT tst_questions.QstCod" // row[0]
- " FROM tst_questions",Qst_MAX_BYTES_QUERY_QUESTIONS);
- if (!Questions->Tags.All)
- Str_Concat (Query,","
- "tst_question_tags,"
- "tst_tags",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
-
- Str_Concat (Query," WHERE tst_questions.CrsCod='",Qst_MAX_BYTES_QUERY_QUESTIONS);
- snprintf (CrsCodStr,sizeof (CrsCodStr),"%ld",Gbl.Hierarchy.Crs.CrsCod);
- Str_Concat (Query,CrsCodStr,Qst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,"' AND tst_questions.EditTime>=FROM_UNIXTIME('",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- snprintf (LongStr,sizeof (LongStr),"%ld",
- (long) Gbl.DateRange.TimeUTC[Dat_STR_TIME]);
- Str_Concat (Query,LongStr,Qst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,"') AND tst_questions.EditTime<=FROM_UNIXTIME('",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- snprintf (LongStr,sizeof (LongStr),"%ld",
- (long) Gbl.DateRange.TimeUTC[Dat_END_TIME]);
- Str_Concat (Query,LongStr,Qst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,"')",Qst_MAX_BYTES_QUERY_QUESTIONS);
-
- /* Add the tags selected */
- if (!Questions->Tags.All)
- {
- Str_Concat (Query," AND tst_questions.QstCod=tst_question_tags.QstCod"
- " AND tst_question_tags.TagCod=tst_tags.TagCod"
- " AND tst_tags.CrsCod='",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,CrsCodStr,Qst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,"'",Qst_MAX_BYTES_QUERY_QUESTIONS);
- LengthQuery = strlen (Query);
- NumItemInList = 0;
- Ptr = Questions->Tags.List;
- while (*Ptr)
- {
- Par_GetNextStrUntilSeparParamMult (&Ptr,TagText,Tag_MAX_BYTES_TAG);
- LengthQuery = LengthQuery + 35 + strlen (TagText) + 1;
- if (LengthQuery > Qst_MAX_BYTES_QUERY_QUESTIONS - 256)
- Err_QuerySizeExceededExit ();
- Str_Concat (Query,
- NumItemInList ? " OR tst_tags.TagTxt='" :
- " AND (tst_tags.TagTxt='",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,TagText,Qst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,"'",Qst_MAX_BYTES_QUERY_QUESTIONS);
- NumItemInList++;
- }
- Str_Concat (Query,")",Qst_MAX_BYTES_QUERY_QUESTIONS);
- }
-
- /* Add the types of answer selected */
- if (!Questions->AnswerTypes.All)
- {
- LengthQuery = strlen (Query);
- NumItemInList = 0;
- Ptr = Questions->AnswerTypes.List;
- while (*Ptr)
- {
- Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,Tag_MAX_BYTES_TAG);
- AnsType = Qst_ConvertFromUnsignedStrToAnsTyp (UnsignedStr);
- LengthQuery = LengthQuery + 35 + strlen (Qst_DB_StrAnswerTypes[AnsType]) + 1;
- if (LengthQuery > Qst_MAX_BYTES_QUERY_QUESTIONS - 256)
- Err_QuerySizeExceededExit ();
- Str_Concat (Query,
- NumItemInList ? " OR tst_questions.AnsType='" :
- " AND (tst_questions.AnsType='",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,Qst_DB_StrAnswerTypes[AnsType],Qst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,"'",Qst_MAX_BYTES_QUERY_QUESTIONS);
- NumItemInList++;
- }
- Str_Concat (Query,")",Qst_MAX_BYTES_QUERY_QUESTIONS);
- }
-
- /* End the query */
- Str_Concat (Query," GROUP BY tst_questions.QstCod",Qst_MAX_BYTES_QUERY_QUESTIONS);
-
- switch (Questions->SelectedOrder)
- {
- case Qst_ORDER_STEM:
- Str_Concat (Query," ORDER BY tst_questions.Stem",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- break;
- case Qst_ORDER_NUM_HITS:
- Str_Concat (Query," ORDER BY tst_questions.NumHits DESC,"
- "tst_questions.Stem",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- break;
- case Qst_ORDER_AVERAGE_SCORE:
- Str_Concat (Query," ORDER BY tst_questions.Score/tst_questions.NumHits DESC,"
- "tst_questions.NumHits DESC,"
- "tst_questions.Stem",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- break;
- case Qst_ORDER_NUM_HITS_NOT_BLANK:
- Str_Concat (Query," ORDER BY tst_questions.NumHitsNotBlank DESC,"
- "tst_questions.Stem",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- break;
- case Qst_ORDER_AVERAGE_SCORE_NOT_BLANK:
- Str_Concat (Query," ORDER BY tst_questions.Score/tst_questions.NumHitsNotBlank DESC,"
- "tst_questions.NumHitsNotBlank DESC,"
- "tst_questions.Stem",
- Qst_MAX_BYTES_QUERY_QUESTIONS);
- break;
- }
-
- /* Make the query */
- Questions->NumQsts = (unsigned) DB_QuerySELECT (mysql_res,"can not get questions",
- "%s",
- Query);
- if (Questions->NumQsts == 0)
- Ale_ShowAlert (Ale_INFO,Txt_No_questions_found_matching_your_search_criteria);
- }
-
/*****************************************************************************/
/***************** Change format of answers text / feedback ******************/
/*****************************************************************************/
@@ -2590,24 +2444,6 @@ void Qst_FreeMediaOfQuestion (struct Qst_Question *Question)
Med_MediaDestructor (&Question->Answer.Options[NumOpt].Media);
}
-/*****************************************************************************/
-/*************** Get answer type of a question from database *****************/
-/*****************************************************************************/
-
-Qst_AnswerType_t Qst_GetQstAnswerTypeFromDB (long QstCod)
- {
- char StrAnsTypeDB[256];
-
- /***** Get type of answer from database *****/
- DB_QuerySELECTString (StrAnsTypeDB,sizeof (StrAnsTypeDB) - 1,
- "can not get the type of a question",
- "SELECT AnsType"
- " FROM tst_questions"
- " WHERE QstCod=%ld",
- QstCod);
- return Qst_ConvertFromStrAnsTypDBToAnsTyp (StrAnsTypeDB);
- }
-
/*****************************************************************************/
/****************** Get data of a question from database *********************/
/*****************************************************************************/
@@ -2622,23 +2458,7 @@ bool Qst_GetQstDataFromDB (struct Qst_Question *Question)
unsigned NumOpt;
/***** Get question data from database *****/
- QuestionExists = (DB_QuerySELECT (&mysql_res,"can not get a question",
- "SELECT UNIX_TIMESTAMP(EditTime)," // row[0]
- "AnsType," // row[1]
- "Shuffle," // row[2]
- "Stem," // row[3]
- "Feedback," // row[4]
- "MedCod," // row[5]
- "NumHits," // row[6]
- "NumHitsNotBlank," // row[7]
- "Score" // row[8]
- " FROM tst_questions"
- " WHERE QstCod=%ld"
- " AND CrsCod=%ld", // Extra check
- Question->QstCod,
- Gbl.Hierarchy.Crs.CrsCod) != 0);
-
- if (QuestionExists)
+ if ((QuestionExists = (Qst_DB_GetQstData (&mysql_res,Question->QstCod) != 0)))
{
row = mysql_fetch_row (mysql_res);
@@ -2653,10 +2473,10 @@ bool Qst_GetQstDataFromDB (struct Qst_Question *Question)
/* Get the stem (row[3]) and the feedback (row[4]) */
Question->Stem [0] = '\0';
+ Question->Feedback[0] = '\0';
if (row[3])
if (row[3][0])
Str_Copy (Question->Stem ,row[3],Cns_MAX_BYTES_TEXT);
- Question->Feedback[0] = '\0';
if (row[4])
if (row[4][0])
Str_Copy (Question->Feedback,row[4],Cns_MAX_BYTES_TEXT);
@@ -2667,13 +2487,12 @@ bool Qst_GetQstDataFromDB (struct Qst_Question *Question)
/* Get number of hits
(number of times that the question has been answered,
- including blank answers) (row[6]) */
- if (sscanf (row[6],"%lu",&Question->NumHits) != 1)
- Question->NumHits = 0;
-
- /* Get number of hits not blank
+ including blank answers) (row[6])
+ and number of hits not blank
(number of times that the question has been answered
with a not blank answer) (row[7]) */
+ if (sscanf (row[6],"%lu",&Question->NumHits ) != 1)
+ Question->NumHits = 0;
if (sscanf (row[7],"%lu",&Question->NumHitsNotBlank) != 1)
Question->NumHitsNotBlank = 0;
@@ -2788,20 +2607,10 @@ long Qst_GetMedCodFromDB (long CrsCod,long QstCod,int NumOpt)
/***** Query depending on NumOpt *****/
if (NumOpt < 0)
// Get media associated to stem
- return DB_QuerySELECTCode ("can not get media",
- "SELECT MedCod"
- " FROM tst_questions"
- " WHERE QstCod=%ld"
- " AND CrsCod=%ld",
- QstCod,CrsCod);
+ return Qst_DB_GetQstMedCod (CrsCod,QstCod);
else
// Get media associated to answer
- return DB_QuerySELECTCode ("can not get media",
- "SELECT MedCod"
- " FROM tst_answers"
- " WHERE QstCod=%ld"
- " AND AnsInd=%u",
- QstCod,(unsigned) NumOpt);
+ return Qst_DB_GetAnswerMedCod (QstCod,(unsigned) NumOpt);
}
/*****************************************************************************/
@@ -3254,8 +3063,7 @@ bool Qst_CheckIfQuestionExistsInDB (struct Qst_Question *Question)
/***** Check if stem exists *****/
NumQstsWithThisStem =
- (unsigned) DB_QuerySELECT (&mysql_res_qst,"can not check"
- " if a question exists",
+ (unsigned) DB_QuerySELECT (&mysql_res_qst,"can not check if a question exists",
"SELECT QstCod"
" FROM tst_questions"
" WHERE CrsCod=%ld"
@@ -3278,14 +3086,7 @@ bool Qst_CheckIfQuestionExistsInDB (struct Qst_Question *Question)
Err_WrongQuestionExit ();
/* Get answers from this question */
- NumOptsExistingQstInDB =
- (unsigned) DB_QuerySELECT (&mysql_res_ans,"can not get the answer"
- " of a question",
- "SELECT Answer" // row[0]
- " FROM tst_answers"
- " WHERE QstCod=%ld"
- " ORDER BY AnsInd",
- Question->QstCod);
+ NumOptsExistingQstInDB = Qst_DB_GetTextOfAnswers (&mysql_res_ans,Question->QstCod);
switch (Question->Answer.Type)
{
@@ -3354,7 +3155,7 @@ void Qst_MoveMediaToDefinitiveDirectories (struct Qst_Question *Question)
/***** Media associated to question stem *****/
CurrentMedCodInDB = Qst_GetMedCodFromDB (Gbl.Hierarchy.Crs.CrsCod,Question->QstCod,
- -1L); // Get current media code associated to stem
+ -1); // Get current media code associated to stem
Med_RemoveKeepOrStoreMedia (CurrentMedCodInDB,&Question->Media);
/****** Move media associated to answers *****/
@@ -3367,7 +3168,7 @@ void Qst_MoveMediaToDefinitiveDirectories (struct Qst_Question *Question)
NumOpt++)
{
CurrentMedCodInDB = Qst_GetMedCodFromDB (Gbl.Hierarchy.Crs.CrsCod,Question->QstCod,
- NumOpt); // Get current media code associated to this option
+ (int) NumOpt); // Get current media code associated to this option
Med_RemoveKeepOrStoreMedia (CurrentMedCodInDB,&Question->Answer.Options[NumOpt].Media);
}
break;
@@ -3449,7 +3250,7 @@ void Qst_RemoveSelectedQsts (void)
if (Tst_GetParamsTst (&Questions,Tst_EDIT_QUESTIONS)) // Get parameters
{
/***** Get question codes *****/
- Qst_GetQuestions (&Questions,&mysql_res); // Query database
+ Questions.NumQsts = Qst_DB_GetQsts (&mysql_res,&Questions);
/***** Remove questions one by one *****/
for (NumQst = 0;
@@ -3599,12 +3400,7 @@ void Qst_RemoveOneQstFromDB (long CrsCod,long QstCod)
Tag_DB_RemoveUnusedTagsFromCrs (CrsCod);
/* Remove the question itself */
- DB_QueryDELETE ("can not remove a question",
- "DELETE FROM tst_questions"
- " WHERE QstCod=%ld"
- " AND CrsCod=%ld",
- QstCod,
- CrsCod);
+ Qst_DB_RemoveQst (CrsCod,QstCod);
}
/*****************************************************************************/
@@ -3939,19 +3735,6 @@ void Qst_RemoveCrsQsts (long CrsCod)
CrsCod);
}
-/*****************************************************************************/
-/******************** Remove answers from a test question ********************/
-/*****************************************************************************/
-
-void Qst_DB_RemAnsFromQst (long QstCod)
- {
- /***** Remove answers *****/
- DB_QueryDELETE ("can not remove the answers of a question",
- "DELETE FROM tst_answers"
- " WHERE QstCod=%ld",
- QstCod);
- }
-
/*****************************************************************************/
/************ Remove media associated to stem of a test question *************/
/*****************************************************************************/
@@ -4058,24 +3841,6 @@ void Qst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod)
DB_FreeMySQLResult (&mysql_res);
}
-/*****************************************************************************/
-/*********** Get suffled/not-shuffled answers indexes of question ************/
-/*****************************************************************************/
-
-unsigned Qst_DB_GetShuffledAnswersIndexes (MYSQL_RES **mysql_res,
- const struct Qst_Question *Question)
- {
- return (unsigned)
- DB_QuerySELECT (mysql_res,"can not get questions of a game",
- "SELECT AnsInd" // row[0]
- " FROM tst_answers"
- " WHERE QstCod=%ld"
- " ORDER BY %s",
- Question->QstCod,
- Question->Answer.Shuffle ? "RAND()" : // Use RAND() because is really random; RAND(NOW()) repeats order
- "AnsInd");
- }
-
/*****************************************************************************/
/*********************** Get number of test questions ************************/
/*****************************************************************************/
diff --git a/swad_question.h b/swad_question.h
index f9f50ffc..0a8a0ad1 100644
--- a/swad_question.h
+++ b/swad_question.h
@@ -213,8 +213,6 @@ void Qst_WriteParamQstCod (unsigned NumQst,long QstCod);
void Qst_CheckIfNumberOfAnswersIsOne (const struct Qst_Question *Question);
-void Qst_GetQuestions (struct Qst_Questions *Questions,MYSQL_RES **mysql_res);
-
void Qst_ChangeFormatAnswersText (struct Qst_Question *Question);
void Qst_ChangeFormatAnswersFeedback (struct Qst_Question *Question);
@@ -239,7 +237,6 @@ void Qst_FreeTextChoiceAnswer (struct Qst_Question *Question,unsigned NumOpt);
void Qst_ResetMediaOfQuestion (struct Qst_Question *Question);
void Qst_FreeMediaOfQuestion (struct Qst_Question *Question);
-Qst_AnswerType_t Qst_GetQstAnswerTypeFromDB (long QstCod);
bool Qst_GetQstDataFromDB (struct Qst_Question *Question);
long Qst_GetMedCodFromDB (long CrsCod,long QstCod,int NumOpt);
void Qst_GetMediaFromDB (long CrsCod,long QstCod,int NumOpt,
@@ -275,15 +272,11 @@ unsigned Qst_CountNumAnswerTypesInList (const struct Qst_AnswerTypes *AnswerType
unsigned Qst_CountNumQuestionsInList (const char *ListQuestions);
void Qst_RemoveCrsQsts (long CrsCod);
-void Qst_DB_RemAnsFromQst (long QstCod);
void Qst_RemoveMediaFromStemOfQst (long CrsCod,long QstCod);
void Qst_RemoveMediaFromAllAnsOfQst (long CrsCod,long QstCod);
void Qst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod);
void Qst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod);
-unsigned Qst_DB_GetShuffledAnswersIndexes (MYSQL_RES **mysql_res,
- const struct Qst_Question *Question);
-
unsigned Qst_GetNumQuestions (HieLvl_Level_t Scope,Qst_AnswerType_t AnsType,
struct Qst_Stats *Stats);
diff --git a/swad_question_database.c b/swad_question_database.c
index 35029038..d059719e 100644
--- a/swad_question_database.c
+++ b/swad_question_database.c
@@ -59,6 +59,8 @@ const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES] =
/**************************** Private constants ******************************/
/*****************************************************************************/
+#define Qst_MAX_BYTES_QUERY_QUESTIONS (16 * 1024 - 1)
+
/*****************************************************************************/
/******************************* Private types *******************************/
/*****************************************************************************/
@@ -103,14 +105,158 @@ void Qst_DB_UpdateQstScore (long QstCod,bool AnswerIsNotBlank,double Score)
Str_SetDecimalPointToLocal (); // Return to local system
}
+/*****************************************************************************/
+/***************** Get several test questions from database ******************/
+/*****************************************************************************/
+
+unsigned Qst_DB_GetQsts (MYSQL_RES **mysql_res,
+ const struct Qst_Questions *Questions)
+ {
+ extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES];
+ extern const char *Txt_No_questions_found_matching_your_search_criteria;
+ char *Query = NULL;
+ long LengthQuery;
+ unsigned NumItemInList;
+ const char *Ptr;
+ char TagText[Tag_MAX_BYTES_TAG + 1];
+ char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
+ char UnsignedStr[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
+ Qst_AnswerType_t AnsType;
+ char CrsCodStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
+ unsigned NumQsts;
+
+ /***** Allocate space for query *****/
+ if ((Query = malloc (Qst_MAX_BYTES_QUERY_QUESTIONS + 1)) == NULL)
+ Err_NotEnoughMemoryExit ();
+
+ /***** Select questions *****/
+ /* Begin query */
+ Str_Copy (Query,"SELECT tst_questions.QstCod" // row[0]
+ " FROM tst_questions",Qst_MAX_BYTES_QUERY_QUESTIONS);
+ if (!Questions->Tags.All)
+ Str_Concat (Query,","
+ "tst_question_tags,"
+ "tst_tags",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+
+ Str_Concat (Query," WHERE tst_questions.CrsCod='",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ snprintf (CrsCodStr,sizeof (CrsCodStr),"%ld",Gbl.Hierarchy.Crs.CrsCod);
+ Str_Concat (Query,CrsCodStr,Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,"' AND tst_questions.EditTime>=FROM_UNIXTIME('",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ snprintf (LongStr,sizeof (LongStr),"%ld",
+ (long) Gbl.DateRange.TimeUTC[Dat_STR_TIME]);
+ Str_Concat (Query,LongStr,Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,"') AND tst_questions.EditTime<=FROM_UNIXTIME('",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ snprintf (LongStr,sizeof (LongStr),"%ld",
+ (long) Gbl.DateRange.TimeUTC[Dat_END_TIME]);
+ Str_Concat (Query,LongStr,Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,"')",Qst_MAX_BYTES_QUERY_QUESTIONS);
+
+ /* Add the tags selected */
+ if (!Questions->Tags.All)
+ {
+ Str_Concat (Query," AND tst_questions.QstCod=tst_question_tags.QstCod"
+ " AND tst_question_tags.TagCod=tst_tags.TagCod"
+ " AND tst_tags.CrsCod='",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,CrsCodStr,Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,"'",Qst_MAX_BYTES_QUERY_QUESTIONS);
+ LengthQuery = strlen (Query);
+ NumItemInList = 0;
+ Ptr = Questions->Tags.List;
+ while (*Ptr)
+ {
+ Par_GetNextStrUntilSeparParamMult (&Ptr,TagText,Tag_MAX_BYTES_TAG);
+ LengthQuery = LengthQuery + 35 + strlen (TagText) + 1;
+ if (LengthQuery > Qst_MAX_BYTES_QUERY_QUESTIONS - 256)
+ Err_QuerySizeExceededExit ();
+ Str_Concat (Query,
+ NumItemInList ? " OR tst_tags.TagTxt='" :
+ " AND (tst_tags.TagTxt='",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,TagText,Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,"'",Qst_MAX_BYTES_QUERY_QUESTIONS);
+ NumItemInList++;
+ }
+ Str_Concat (Query,")",Qst_MAX_BYTES_QUERY_QUESTIONS);
+ }
+
+ /* Add the types of answer selected */
+ if (!Questions->AnswerTypes.All)
+ {
+ LengthQuery = strlen (Query);
+ NumItemInList = 0;
+ Ptr = Questions->AnswerTypes.List;
+ while (*Ptr)
+ {
+ Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,Tag_MAX_BYTES_TAG);
+ AnsType = Qst_ConvertFromUnsignedStrToAnsTyp (UnsignedStr);
+ LengthQuery = LengthQuery + 35 + strlen (Qst_DB_StrAnswerTypes[AnsType]) + 1;
+ if (LengthQuery > Qst_MAX_BYTES_QUERY_QUESTIONS - 256)
+ Err_QuerySizeExceededExit ();
+ Str_Concat (Query,
+ NumItemInList ? " OR tst_questions.AnsType='" :
+ " AND (tst_questions.AnsType='",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,Qst_DB_StrAnswerTypes[AnsType],Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,"'",Qst_MAX_BYTES_QUERY_QUESTIONS);
+ NumItemInList++;
+ }
+ Str_Concat (Query,")",Qst_MAX_BYTES_QUERY_QUESTIONS);
+ }
+
+ /* End the query */
+ Str_Concat (Query," GROUP BY tst_questions.QstCod",Qst_MAX_BYTES_QUERY_QUESTIONS);
+
+ switch (Questions->SelectedOrder)
+ {
+ case Qst_ORDER_STEM:
+ Str_Concat (Query," ORDER BY tst_questions.Stem",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ break;
+ case Qst_ORDER_NUM_HITS:
+ Str_Concat (Query," ORDER BY tst_questions.NumHits DESC,"
+ "tst_questions.Stem",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ break;
+ case Qst_ORDER_AVERAGE_SCORE:
+ Str_Concat (Query," ORDER BY tst_questions.Score/tst_questions.NumHits DESC,"
+ "tst_questions.NumHits DESC,"
+ "tst_questions.Stem",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ break;
+ case Qst_ORDER_NUM_HITS_NOT_BLANK:
+ Str_Concat (Query," ORDER BY tst_questions.NumHitsNotBlank DESC,"
+ "tst_questions.Stem",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ break;
+ case Qst_ORDER_AVERAGE_SCORE_NOT_BLANK:
+ Str_Concat (Query," ORDER BY tst_questions.Score/tst_questions.NumHitsNotBlank DESC,"
+ "tst_questions.NumHitsNotBlank DESC,"
+ "tst_questions.Stem",
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ break;
+ }
+
+ /* Make the query */
+ if ((NumQsts = (unsigned)
+ DB_QuerySELECT (mysql_res,"can not get questions",
+ "%s",
+ Query)) == 0)
+ Ale_ShowAlert (Ale_INFO,Txt_No_questions_found_matching_your_search_criteria);
+
+ return NumQsts;
+ }
+
/*****************************************************************************/
/******************* Get questions for a new test print **********************/
/*****************************************************************************/
-#define Tst_MAX_BYTES_QUERY_QUESTIONS (16 * 1024 - 1)
-
-unsigned Qst_DB_GetQuestionsForNewTestPrint (MYSQL_RES **mysql_res,
- const struct Qst_Questions *Questions)
+unsigned Qst_DB_GetQstsForNewTestPrint (MYSQL_RES **mysql_res,
+ const struct Qst_Questions *Questions)
{
extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES];
char *Query = NULL;
@@ -123,7 +269,7 @@ unsigned Qst_DB_GetQuestionsForNewTestPrint (MYSQL_RES **mysql_res,
char StrNumQsts[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
/***** Allocate space for query *****/
- if ((Query = malloc (Tst_MAX_BYTES_QUERY_QUESTIONS + 1)) == NULL)
+ if ((Query = malloc (Qst_MAX_BYTES_QUERY_QUESTIONS + 1)) == NULL)
Err_NotEnoughMemoryExit ();
/***** Select questions without hidden tags *****/
@@ -131,7 +277,7 @@ unsigned Qst_DB_GetQuestionsForNewTestPrint (MYSQL_RES **mysql_res,
// Reject questions with any tag hidden
// Select only questions with tags
// DISTINCTROW is necessary to not repeat questions
- snprintf (Query,Tst_MAX_BYTES_QUERY_QUESTIONS + 1,
+ snprintf (Query,Qst_MAX_BYTES_QUERY_QUESTIONS + 1,
"SELECT DISTINCTROW tst_questions.QstCod," // row[0]
"tst_questions.AnsType," // row[1]
"tst_questions.Shuffle" // row[2]
@@ -160,17 +306,17 @@ unsigned Qst_DB_GetQuestionsForNewTestPrint (MYSQL_RES **mysql_res,
{
Par_GetNextStrUntilSeparParamMult (&Ptr,TagText,Tag_MAX_BYTES_TAG);
LengthQuery = LengthQuery + 35 + strlen (TagText) + 1;
- if (LengthQuery > Tst_MAX_BYTES_QUERY_QUESTIONS - 128)
+ if (LengthQuery > Qst_MAX_BYTES_QUERY_QUESTIONS - 128)
Err_QuerySizeExceededExit ();
Str_Concat (Query,
NumItemInList ? " OR tst_tags.TagTxt='" :
" AND (tst_tags.TagTxt='",
- Tst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,TagText,Tst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,"'",Tst_MAX_BYTES_QUERY_QUESTIONS);
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,TagText,Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,"'",Qst_MAX_BYTES_QUERY_QUESTIONS);
NumItemInList++;
}
- Str_Concat (Query,")",Tst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,")",Qst_MAX_BYTES_QUERY_QUESTIONS);
}
/* Add answer types selected */
@@ -184,23 +330,23 @@ unsigned Qst_DB_GetQuestionsForNewTestPrint (MYSQL_RES **mysql_res,
Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,Tag_MAX_BYTES_TAG);
AnswerType = Qst_ConvertFromUnsignedStrToAnsTyp (UnsignedStr);
LengthQuery = LengthQuery + 35 + strlen (Qst_DB_StrAnswerTypes[AnswerType]) + 1;
- if (LengthQuery > Tst_MAX_BYTES_QUERY_QUESTIONS - 128)
+ if (LengthQuery > Qst_MAX_BYTES_QUERY_QUESTIONS - 128)
Err_QuerySizeExceededExit ();
Str_Concat (Query,
NumItemInList ? " OR tst_questions.AnsType='" :
" AND (tst_questions.AnsType='",
- Tst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,Qst_DB_StrAnswerTypes[AnswerType],Tst_MAX_BYTES_QUERY_QUESTIONS);
- Str_Concat (Query,"'",Tst_MAX_BYTES_QUERY_QUESTIONS);
+ Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,Qst_DB_StrAnswerTypes[AnswerType],Qst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,"'",Qst_MAX_BYTES_QUERY_QUESTIONS);
NumItemInList++;
}
- Str_Concat (Query,")",Tst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,")",Qst_MAX_BYTES_QUERY_QUESTIONS);
}
/* End query */
- Str_Concat (Query," ORDER BY RAND() LIMIT ",Tst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query," ORDER BY RAND() LIMIT ",Qst_MAX_BYTES_QUERY_QUESTIONS);
snprintf (StrNumQsts,sizeof (StrNumQsts),"%u",Questions->NumQsts);
- Str_Concat (Query,StrNumQsts,Tst_MAX_BYTES_QUERY_QUESTIONS);
+ Str_Concat (Query,StrNumQsts,Qst_MAX_BYTES_QUERY_QUESTIONS);
/*
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query);
@@ -756,6 +902,63 @@ unsigned Qst_DB_GetNumCrssWithPluggableQsts (HieLvl_Level_t Scope,
}
}
+/*****************************************************************************/
+/****************** Get data of a question from database *********************/
+/*****************************************************************************/
+
+unsigned Qst_DB_GetQstData (MYSQL_RES **mysql_res,long QstCod)
+ {
+ return (unsigned)
+ DB_QuerySELECT (mysql_res,"can not get a question",
+ "SELECT UNIX_TIMESTAMP(EditTime)," // row[0]
+ "AnsType," // row[1]
+ "Shuffle," // row[2]
+ "Stem," // row[3]
+ "Feedback," // row[4]
+ "MedCod," // row[5]
+ "NumHits," // row[6]
+ "NumHitsNotBlank," // row[7]
+ "Score" // row[8]
+ " FROM tst_questions"
+ " WHERE QstCod=%ld"
+ " AND CrsCod=%ld", // Extra check
+ QstCod,
+ Gbl.Hierarchy.Crs.CrsCod);
+ }
+
+/*****************************************************************************/
+/*************** Get answer type of a question from database *****************/
+/*****************************************************************************/
+
+Qst_AnswerType_t Qst_DB_GetQstAnswerType (long QstCod)
+ {
+ char StrAnsTypeDB[256];
+
+ /***** Get type of answer from database *****/
+ DB_QuerySELECTString (StrAnsTypeDB,sizeof (StrAnsTypeDB) - 1,
+ "can not get the type of a question",
+ "SELECT AnsType"
+ " FROM tst_questions"
+ " WHERE QstCod=%ld",
+ QstCod);
+ return Qst_ConvertFromStrAnsTypDBToAnsTyp (StrAnsTypeDB);
+ }
+
+/*****************************************************************************/
+/******** Get media code associated with the stem of a test question *********/
+/*****************************************************************************/
+
+long Qst_DB_GetQstMedCod (long CrsCod,long QstCod)
+ {
+ return DB_QuerySELECTCode ("can not get media",
+ "SELECT MedCod"
+ " FROM tst_questions"
+ " WHERE QstCod=%ld"
+ " AND CrsCod=%ld", // Extra check
+ QstCod,
+ CrsCod);
+ }
+
/*****************************************************************************/
/************ Get number of answers of a question from database **************/
/*****************************************************************************/
@@ -815,3 +1018,63 @@ unsigned Qst_DB_GetTextOfAnswers (MYSQL_RES **mysql_res,long QstCod)
return NumOptions;
}
+
+/*****************************************************************************/
+/*********** Get suffled/not-shuffled answers indexes of question ************/
+/*****************************************************************************/
+
+unsigned Qst_DB_GetShuffledAnswersIndexes (MYSQL_RES **mysql_res,
+ const struct Qst_Question *Question)
+ {
+ return (unsigned)
+ DB_QuerySELECT (mysql_res,"can not get questions of a game",
+ "SELECT AnsInd" // row[0]
+ " FROM tst_answers"
+ " WHERE QstCod=%ld"
+ " ORDER BY %s",
+ Question->QstCod,
+ Question->Answer.Shuffle ? "RAND()" : // Use RAND() because is really random; RAND(NOW()) repeats order
+ "AnsInd");
+ }
+
+/*****************************************************************************/
+/********* Get media code associated to an answer of a test question *********/
+/*****************************************************************************/
+
+long Qst_DB_GetAnswerMedCod (long QstCod,unsigned AnsInd)
+ {
+ return DB_QuerySELECTCode ("can not get media",
+ "SELECT MedCod"
+ " FROM tst_answers"
+ " WHERE QstCod=%ld"
+ " AND AnsInd=%u",
+ QstCod,
+ AnsInd);
+ }
+
+/*****************************************************************************/
+/********************** Remove a question from database **********************/
+/*****************************************************************************/
+
+void Qst_DB_RemoveQst (long CrsCod,long QstCod)
+ {
+ DB_QueryDELETE ("can not remove a question",
+ "DELETE FROM tst_questions"
+ " WHERE QstCod=%ld"
+ " AND CrsCod=%ld",
+ QstCod,
+ CrsCod);
+ }
+
+/*****************************************************************************/
+/******************** Remove answers from a test question ********************/
+/*****************************************************************************/
+
+void Qst_DB_RemAnsFromQst (long QstCod)
+ {
+ /***** Remove answers *****/
+ DB_QueryDELETE ("can not remove the answers of a question",
+ "DELETE FROM tst_answers"
+ " WHERE QstCod=%ld",
+ QstCod);
+ }
diff --git a/swad_question_database.h b/swad_question_database.h
index 870018f4..4bd84b49 100644
--- a/swad_question_database.h
+++ b/swad_question_database.h
@@ -51,7 +51,9 @@
void Qst_DB_UpdateQstScore (long QstCod,bool AnswerIsNotBlank,double Score);
-unsigned Qst_DB_GetQuestionsForNewTestPrint (MYSQL_RES **mysql_res,
+unsigned Qst_DB_GetQsts (MYSQL_RES **mysql_res,
+ const struct Qst_Questions *Questions);
+unsigned Qst_DB_GetQstsForNewTestPrint (MYSQL_RES **mysql_res,
const struct Qst_Questions *Questions);
unsigned Qst_DB_GetNumQsts (MYSQL_RES **mysql_res,
HieLvl_Level_t Scope,Qst_AnswerType_t AnsType);
@@ -60,8 +62,18 @@ unsigned Qst_DB_GetNumCrssWithQsts (HieLvl_Level_t Scope,
unsigned Qst_DB_GetNumCrssWithPluggableQsts (HieLvl_Level_t Scope,
Qst_AnswerType_t AnsType);
+unsigned Qst_DB_GetQstData (MYSQL_RES **mysql_res,long QstCod);
+Qst_AnswerType_t Qst_DB_GetQstAnswerType (long QstCod);
+long Qst_DB_GetQstMedCod (long CrsCod,long QstCod);
+
unsigned Qst_DB_GetNumAnswersQst (long QstCod);
unsigned Qst_DB_GetDataOfAnswers (MYSQL_RES **mysql_res,long QstCod,bool Shuffle);
unsigned Qst_DB_GetTextOfAnswers (MYSQL_RES **mysql_res,long QstCod);
+unsigned Qst_DB_GetShuffledAnswersIndexes (MYSQL_RES **mysql_res,
+ const struct Qst_Question *Question);
+long Qst_DB_GetAnswerMedCod (long QstCod,unsigned AnsInd);
+
+void Qst_DB_RemoveQst (long CrsCod,long QstCod);
+void Qst_DB_RemAnsFromQst (long QstCod);
#endif
diff --git a/swad_record.c b/swad_record.c
index 27ecfcdf..00ee82db 100644
--- a/swad_record.c
+++ b/swad_record.c
@@ -981,17 +981,17 @@ static void Rec_ShowRecordOneStdCrs (void)
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- /* Edit record fields */
- if (Gbl.Usrs.Me.Role.Logged == Rol_TCH)
- Rec_PutLinkToEditRecordFields ();
+ /* Edit record fields */
+ if (Gbl.Usrs.Me.Role.Logged == Rol_TCH)
+ Rec_PutLinkToEditRecordFields ();
- /* Print view */
- Frm_BeginForm (ActPrnRecSevStd);
- Usr_CreateListSelectedUsrsCodsAndFillWithOtherUsr (&Gbl.Usrs.Selected);
- Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
- Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
- Rec_ShowLinkToPrintPreviewOfRecords ();
- Frm_EndForm ();
+ /* Print view */
+ Frm_BeginForm (ActPrnRecSevStd);
+ Usr_CreateListSelectedUsrsCodsAndFillWithOtherUsr (&Gbl.Usrs.Selected);
+ Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
+ Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
+ Rec_ShowLinkToPrintPreviewOfRecords ();
+ Frm_EndForm ();
Mnu_ContextMenuEnd ();
diff --git a/swad_report.c b/swad_report.c
index fe784dec..85995622 100644
--- a/swad_report.c
+++ b/swad_report.c
@@ -896,7 +896,7 @@ static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role,
unsigned NumCrs;
long CrsCod;
- NumCrss = Usr_GetNumCrssOfUsrWithARole (Gbl.Usrs.Me.UsrDat.UsrCod,Role);
+ NumCrss = Usr_DB_GetNumCrssOfUsrWithARole (Gbl.Usrs.Me.UsrDat.UsrCod,Role);
fprintf (Gbl.F.Rep,"
");
fprintf (Gbl.F.Rep,Txt_USER_in_COURSE,
Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
diff --git a/swad_role.c b/swad_role.c
index d7b1387d..5173ddbf 100644
--- a/swad_role.c
+++ b/swad_role.c
@@ -119,18 +119,18 @@ void Rol_SetMyRoles (void)
if (Gbl.Hierarchy.Ins.InsCod > 0)
{
/* Check if I am and administrator of current institution */
- ICanBeInsAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
+ ICanBeInsAdm = Usr_DB_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
HieLvl_INS,
Gbl.Hierarchy.Ins.InsCod);
if (Gbl.Hierarchy.Ctr.CtrCod > 0)
{
/* Check if I am and administrator of current center */
- ICanBeCtrAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
+ ICanBeCtrAdm = Usr_DB_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
HieLvl_CTR,
Gbl.Hierarchy.Ctr.CtrCod);
if (Gbl.Hierarchy.Deg.DegCod > 0)
/* Check if I am and administrator of current degree */
- ICanBeDegAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
+ ICanBeDegAdm = Usr_DB_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
HieLvl_DEG,
Gbl.Hierarchy.Deg.DegCod);
}
diff --git a/swad_statistic.c b/swad_statistic.c
index 11b2e539..988df72d 100644
--- a/swad_statistic.c
+++ b/swad_statistic.c
@@ -492,8 +492,8 @@ static void Sta_PutFormGblHits (struct Sta_Stats *Stats)
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- Sta_PutLinkToCourseHits (); // Course hits
- Log_PutLinkToLastClicks (); // Last clicks in real time
+ Sta_PutLinkToCourseHits (); // Course hits
+ Log_PutLinkToLastClicks (); // Last clicks in real time
Mnu_ContextMenuEnd ();
/***** Begin form *****/
diff --git a/swad_test.c b/swad_test.c
index 190c5737..27c7abc8 100644
--- a/swad_test.c
+++ b/swad_test.c
@@ -491,7 +491,7 @@ void Tst_PutIconsTests (__attribute__((unused)) void *Args)
/************** Get questions for a new test from the database ***************/
/*****************************************************************************/
-#define Tst_MAX_BYTES_QUERY_QUESTIONS (16 * 1024 - 1)
+#define Qst_MAX_BYTES_QUERY_QUESTIONS (16 * 1024 - 1)
static void Tst_GetQuestionsForNewTest (struct Qst_Questions *Questions,
struct TstPrn_Print *Print)
@@ -509,7 +509,7 @@ static void Tst_GetQuestionsForNewTest (struct Qst_Questions *Questions,
/***** Get questions and answers from database *****/
Print->NumQsts.All =
- Questions->NumQsts = Qst_DB_GetQuestionsForNewTestPrint (&mysql_res,Questions);
+ Questions->NumQsts = Qst_DB_GetQstsForNewTestPrint (&mysql_res,Questions);
for (QstInd = 0;
QstInd < Print->NumQsts.All;
diff --git a/swad_test_print.c b/swad_test_print.c
index 9cd7ecfc..efe26f97 100644
--- a/swad_test_print.c
+++ b/swad_test_print.c
@@ -746,7 +746,7 @@ void TstPrn_ComputeScoresAndStoreQuestionsOfPrint (struct TstPrn_Print *Print,
/* Compute question score */
Qst_QstConstructor (&Question);
Question.QstCod = Print->PrintedQuestions[QstInd].QstCod;
- Question.Answer.Type = Qst_GetQstAnswerTypeFromDB (Question.QstCod);
+ Question.Answer.Type = Qst_DB_GetQstAnswerType (Question.QstCod);
TstPrn_ComputeAnswerScore (&Print->PrintedQuestions[QstInd],&Question);
Qst_QstDestructor (&Question);
diff --git a/swad_user.c b/swad_user.c
index a3273258..9af110ab 100644
--- a/swad_user.c
+++ b/swad_user.c
@@ -166,7 +166,7 @@ static void Usr_GetMyLastData (void);
static void Usr_GetUsrCommentsFromString (char *Str,struct UsrData *UsrDat);
static Usr_Sex_t Usr_GetSexFromStr (const char *Str);
-static bool Usr_CheckIfMyBirthdayHasNotBeenCongratulated (void);
+static bool Usr_DB_CheckIfMyBirthdayHasNotBeenCongratulated (void);
static void Usr_InsertMyBirthday (void);
static void Usr_RemoveTemporaryTableMyCourses (void);
@@ -182,7 +182,7 @@ static void Usr_SetMyPrefsAndRoles (void);
static void Usr_PutLinkToLogOut (__attribute__((unused)) void *Args);
-static void Usr_InsertMyLastData (void);
+static void Usr_DB_InsertMyLastData (void);
static void Usr_WriteRowGstAllData (struct UsrData *UsrDat);
static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames);
@@ -238,15 +238,15 @@ static void Usr_ListRowsAllDataTchs (Rol_Role_t Role,
static void Usr_GetAndUpdateUsrListType (void);
static void Usr_GetUsrListTypeFromForm (void);
static void Usr_GetMyUsrListTypeFromDB (void);
-static void Usr_UpdateMyUsrListTypeInDB (void);
+static void Usr_DB_UpdateMyUsrListType (void);
static void Usr_GetParamColsClassPhotoFromForm (void);
static void Usr_GetMyColsClassPhotoFromDB (void);
-static void Usr_UpdateMyColsClassPhotoInDB (void);
+static void Usr_DB_UpdateMyColsClassPhoto (void);
static void Usr_GetAndUpdatePrefAboutListWithPhotos (void);
static bool Usr_GetParamListWithPhotosFromForm (void);
-static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void);
+static void Usr_DB_UpdateMyPrefAboutListWithPhotosPhoto (void);
static void Usr_PutLinkToSeeAdmins (void);
static void Usr_PutLinkToSeeGuests (void);
@@ -783,7 +783,7 @@ static void Usr_GetMyLastData (void)
/***** Create entry for me in table of user's last data *****/
Usr_ResetMyLastData ();
- Usr_InsertMyLastData ();
+ Usr_DB_InsertMyLastData ();
}
else if (NumRows == 1)
{
@@ -922,7 +922,7 @@ void Usr_FlushCachesUsr (void)
/***** Check if a user is an administrator of a degree/center/institution ****/
/*****************************************************************************/
-bool Usr_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Scope,long Cod)
+bool Usr_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Scope,long Cod)
{
/***** Get if a user is administrator of a degree from database *****/
return (DB_QueryCOUNT ("can not check if a user is administrator",
@@ -1051,7 +1051,7 @@ bool Usr_ICanEditOtherUsr (const struct UsrData *UsrDat)
/********************* Get number of courses of a user ***********************/
/*****************************************************************************/
-unsigned Usr_GetNumCrssOfUsr (long UsrCod)
+unsigned Usr_DB_GetNumCrssOfUsr (long UsrCod)
{
/***** Get the number of courses of a user from database ******/
return (unsigned)
@@ -1066,7 +1066,7 @@ unsigned Usr_GetNumCrssOfUsr (long UsrCod)
/*************** Get number of courses of a user not accepted ****************/
/*****************************************************************************/
-unsigned Usr_GetNumCrssOfUsrNotAccepted (long UsrCod)
+unsigned Usr_DB_GetNumCrssOfUsrNotAccepted (long UsrCod)
{
/***** Get the number of courses of a user not accepted from database ******/
return (unsigned)
@@ -1082,7 +1082,7 @@ unsigned Usr_GetNumCrssOfUsrNotAccepted (long UsrCod)
/********* Get number of courses in with a user have a given role ************/
/*****************************************************************************/
-unsigned Usr_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role)
+unsigned Usr_DB_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role)
{
/***** Get the number of courses of a user with a role from database ******/
return (unsigned)
@@ -1099,7 +1099,7 @@ unsigned Usr_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role)
/********* Get number of courses in with a user have a given role ************/
/*****************************************************************************/
-unsigned Usr_GetNumCrssOfUsrWithARoleNotAccepted (long UsrCod,Rol_Role_t Role)
+unsigned Usr_DB_GetNumCrssOfUsrWithARoleNotAccepted (long UsrCod,Rol_Role_t Role)
{
/***** Get the number of courses of a user with a role from database ******/
return (unsigned)
@@ -1568,7 +1568,7 @@ void Usr_GetMyCountrs (void)
Gbl.Usrs.Me.MyCtys.Num = 0;
/***** Get my institutions from database *****/
- NumCtys = Usr_GetCtysFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,&mysql_res);
+ NumCtys = Usr_DB_GetCtysFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,&mysql_res);
for (NumCty = 0;
NumCty < NumCtys;
NumCty++)
@@ -2247,7 +2247,7 @@ bool Usr_CheckIfIBelongToCrs (long CrsCod)
/*****************************************************************************/
// Returns the number of rows of the result
-unsigned Usr_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res)
+unsigned Usr_DB_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res)
{
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
@@ -2500,7 +2500,7 @@ void Usr_GetMainDeg (long UsrCod,
/******** Check if a user exists with a given encrypted user's code **********/
/*****************************************************************************/
-bool Usr_ChkIfEncryptedUsrCodExists (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64])
+bool Usr_DB_ChkIfEncryptedUsrCodExists (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64])
{
/***** Get if an encrypted user's code already existed in database *****/
return (DB_QueryCOUNT ("can not check if an encrypted user's code"
@@ -2584,49 +2584,49 @@ void Usr_WriteFormLogin (Act_Action_t NextAction,void (*FuncParams) (void))
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- Acc_PutLinkToCreateAccount (); // Create account
- Pwd_PutLinkToSendNewPasswd (); // Send new password
- Lan_PutLinkToChangeLanguage (); // Change language
+ Acc_PutLinkToCreateAccount (); // Create account
+ Pwd_PutLinkToSendNewPasswd (); // Send new password
+ Lan_PutLinkToChangeLanguage (); // Change language
Mnu_ContextMenuEnd ();
HTM_DIV_Begin ("class=\"CM\"");
- /***** Begin form *****/
- Frm_BeginForm (NextAction);
- if (FuncParams)
- FuncParams ();
+ /***** Begin form *****/
+ Frm_BeginForm (NextAction);
+ if (FuncParams)
+ FuncParams ();
- /***** Begin box and table *****/
- Box_BoxTableBegin (NULL,Txt_Log_in,
- NULL,NULL,
- Hlp_PROFILE_LogIn,Box_NOT_CLOSABLE,2);
+ /***** Begin box and table *****/
+ Box_BoxTableBegin (NULL,Txt_Log_in,
+ NULL,NULL,
+ Hlp_PROFILE_LogIn,Box_NOT_CLOSABLE,2);
- /***** User's ID/nickname *****/
- HTM_DIV_Begin ("class=\"LM\"");
- HTM_LABEL_Begin ("for=\"UsrId\"");
- Ico_PutIcon ("user.svg",Txt_User[Usr_SEX_UNKNOWN],"CONTEXT_ICO_16x16");
- HTM_LABEL_End ();
- HTM_INPUT_TEXT ("UsrId",Cns_MAX_CHARS_EMAIL_ADDRESS,Gbl.Usrs.Me.UsrIdLogin,
- HTM_DONT_SUBMIT_ON_CHANGE,
- "id=\"UsrId\" size=\"18\" placeholder=\"%s\""
- " autofocus=\"autofocus\" required=\"required\"",
- Txt_nick_email_or_ID);
- HTM_DIV_End ();
+ /***** User's ID/nickname *****/
+ HTM_DIV_Begin ("class=\"LM\"");
+ HTM_LABEL_Begin ("for=\"UsrId\"");
+ Ico_PutIcon ("user.svg",Txt_User[Usr_SEX_UNKNOWN],"CONTEXT_ICO_16x16");
+ HTM_LABEL_End ();
+ HTM_INPUT_TEXT ("UsrId",Cns_MAX_CHARS_EMAIL_ADDRESS,Gbl.Usrs.Me.UsrIdLogin,
+ HTM_DONT_SUBMIT_ON_CHANGE,
+ "id=\"UsrId\" size=\"18\" placeholder=\"%s\""
+ " autofocus=\"autofocus\" required=\"required\"",
+ Txt_nick_email_or_ID);
+ HTM_DIV_End ();
- /***** User's password *****/
- HTM_DIV_Begin ("class=\"LM\"");
- HTM_LABEL_Begin ("for=\"UsrPwd\"");
- Ico_PutIcon ("key.svg",Txt_Password,"CONTEXT_ICO_16x16");
- HTM_LABEL_End ();
- HTM_INPUT_PASSWORD ("UsrPwd",Txt_password,NULL,false,
- "id=\"UsrPwd\"");
- HTM_DIV_End ();
+ /***** User's password *****/
+ HTM_DIV_Begin ("class=\"LM\"");
+ HTM_LABEL_Begin ("for=\"UsrPwd\"");
+ Ico_PutIcon ("key.svg",Txt_Password,"CONTEXT_ICO_16x16");
+ HTM_LABEL_End ();
+ HTM_INPUT_PASSWORD ("UsrPwd",Txt_password,NULL,false,
+ "id=\"UsrPwd\"");
+ HTM_DIV_End ();
- /***** End table, send button and end box *****/
- Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Log_in);
+ /***** End table, send button and end box *****/
+ Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Log_in);
- /***** End form *****/
- Frm_EndForm ();
+ /***** End form *****/
+ Frm_EndForm ();
HTM_DIV_End ();
}
@@ -2659,7 +2659,7 @@ void Usr_WelcomeUsr (void)
/***** Birthday congratulation *****/
if (Gbl.Usrs.Me.UsrDat.Birthday.Day == Gbl.Now.Date.Day &&
Gbl.Usrs.Me.UsrDat.Birthday.Month == Gbl.Now.Date.Month)
- if (Usr_CheckIfMyBirthdayHasNotBeenCongratulated ())
+ if (Usr_DB_CheckIfMyBirthdayHasNotBeenCongratulated ())
{
/* Mark my birthday as already congratulated */
Usr_InsertMyBirthday ();
@@ -2753,7 +2753,7 @@ void Usr_CreateBirthdayStrDB (const struct UsrData *UsrDat,
/*************** Check if my birthday is already congratulated ***************/
/*****************************************************************************/
-static bool Usr_CheckIfMyBirthdayHasNotBeenCongratulated (void)
+static bool Usr_DB_CheckIfMyBirthdayHasNotBeenCongratulated (void)
{
/***** Delete old birthdays *****/
return (DB_QueryCOUNT ("can not check if my birthday has been congratulated",
@@ -2807,7 +2807,7 @@ void Usr_PutFormLogIn (void)
/***** Link to log in form *****/
Frm_BeginForm (ActFrmLogIn);
- Ico_PutIconLink ("sign-in-alt-white.svg",Txt_Log_in);
+ Ico_PutIconLink ("sign-in-alt-white.svg",Txt_Log_in);
Frm_EndForm ();
}
@@ -2824,31 +2824,31 @@ void Usr_WriteLoggedUsrHead (void)
HTM_DIV_Begin ("class=\"HEAD_USR %s\"",The_ClassUsr[Gbl.Prefs.Theme]);
- /***** User's role *****/
- if (NumAvailableRoles == 1)
- {
- Frm_BeginForm (ActFrmRolSes);
- HTM_BUTTON_SUBMIT_Begin (Txt_Role,
- Str_BuildStringStr ("BT_LINK %s",
- The_ClassUsr[Gbl.Prefs.Theme]),
- NULL);
- Str_FreeString ();
- HTM_Txt (Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]);
- HTM_BUTTON_End ();
- Frm_EndForm ();
+ /***** User's role *****/
+ if (NumAvailableRoles == 1)
+ {
+ Frm_BeginForm (ActFrmRolSes);
+ HTM_BUTTON_SUBMIT_Begin (Txt_Role,
+ Str_BuildStringStr ("BT_LINK %s",
+ The_ClassUsr[Gbl.Prefs.Theme]),
+ NULL);
+ Str_FreeString ();
+ HTM_Txt (Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]);
+ HTM_BUTTON_End ();
+ Frm_EndForm ();
- HTM_Colon ();
- }
- else
- Rol_PutFormToChangeMyRole ("SEL_ROLE");
- HTM_NBSP ();
+ HTM_Colon ();
+ }
+ else
+ Rol_PutFormToChangeMyRole ("SEL_ROLE");
+ HTM_NBSP ();
- /***** Show my photo *****/
- Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Me.UsrDat,"PHOTO18x24",Pho_ZOOM,false);
+ /***** Show my photo *****/
+ Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Me.UsrDat,"PHOTO18x24",Pho_ZOOM,false);
- /***** User's name *****/
- if (Gbl.Usrs.Me.UsrDat.FrstName[0])
- HTM_TxtF (" %s",Gbl.Usrs.Me.UsrDat.FrstName);
+ /***** User's name *****/
+ if (Gbl.Usrs.Me.UsrDat.FrstName[0])
+ HTM_TxtF (" %s",Gbl.Usrs.Me.UsrDat.FrstName);
HTM_DIV_End ();
}
@@ -2863,7 +2863,7 @@ void Usr_PutFormLogOut (void)
/***** Link to log out form *****/
Frm_BeginForm (ActLogOut);
- Ico_PutIconLink ("sign-out-alt-white.svg",Txt_Log_out);
+ Ico_PutIconLink ("sign-out-alt-white.svg",Txt_Log_out);
Frm_EndForm ();
}
@@ -3524,24 +3524,24 @@ void Usr_ShowFormsLogoutAndRole (void)
Usr_PutLinkToLogOut,NULL,
Hlp_PROFILE_Session_role,Box_NOT_CLOSABLE);
- /***** Put a form to change my role *****/
- if (Rol_GetNumAvailableRoles () == 1)
- {
- HTM_SPAN_Begin ("class=\"DAT\"");
- HTM_TxtColonNBSP (Txt_Role);
- HTM_SPAN_End ();
+ /***** Put a form to change my role *****/
+ if (Rol_GetNumAvailableRoles () == 1)
+ {
+ HTM_SPAN_Begin ("class=\"DAT\"");
+ HTM_TxtColonNBSP (Txt_Role);
+ HTM_SPAN_End ();
- HTM_SPAN_Begin ("class=\"DAT_N_BOLD\"");
- HTM_Txt (Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]);
- HTM_SPAN_End ();
- }
- else
- {
- HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
- HTM_TxtColonNBSP (Txt_Role);
- Rol_PutFormToChangeMyRole (NULL);
- HTM_LABEL_End ();
- }
+ HTM_SPAN_Begin ("class=\"DAT_N_BOLD\"");
+ HTM_Txt (Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]);
+ HTM_SPAN_End ();
+ }
+ else
+ {
+ HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
+ HTM_TxtColonNBSP (Txt_Role);
+ Rol_PutFormToChangeMyRole (NULL);
+ HTM_LABEL_End ();
+ }
/***** End box *****/
Box_BoxEnd ();
@@ -3574,7 +3574,7 @@ bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat,
Usr_GetRoleInCurrentCrs_t GetRoleInCurrentCrs)
{
/***** Check if a user exists having this user's code *****/
- if (Usr_ChkIfUsrCodExists (UsrDat->UsrCod))
+ if (Usr_DB_ChkIfUsrCodExists (UsrDat->UsrCod))
{
/* Get user's data */
Usr_GetAllUsrDataFromUsrCod (UsrDat,GetPrefs,GetRoleInCurrentCrs);
@@ -3615,7 +3615,7 @@ void Usr_UpdateMyLastData (void)
(unsigned) Gbl.Usrs.Me.Role.Logged,
Gbl.Usrs.Me.UsrDat.UsrCod);
else
- Usr_InsertMyLastData ();
+ Usr_DB_InsertMyLastData ();
}
/*****************************************************************************/
@@ -3638,7 +3638,7 @@ void Usr_DB_UpdateMyLastWhatToSearch (void)
/*************** Create new entry for my last data in database ***************/
/*****************************************************************************/
-static void Usr_InsertMyLastData (void)
+static void Usr_DB_InsertMyLastData (void)
{
/***** Insert my last accessed course, tab and time of click in database *****/
DB_QueryINSERT ("can not insert last user's data",
@@ -4170,7 +4170,7 @@ static void Usr_WriteUsrData (const char *BgColor,
/*****************************************************************************/
// Returns user's code or -1 if no user found
-long Usr_GetRamdomStdFromCrs (long CrsCod)
+long Usr_DB_GetRamdomStdFromCrs (long CrsCod)
{
/***** Get a random student from current course from database *****/
return DB_QuerySELECTCode ("can not get a random student from a course",
@@ -4189,7 +4189,7 @@ long Usr_GetRamdomStdFromCrs (long CrsCod)
/*****************************************************************************/
// Returns user's code or -1 if no user found
-long Usr_GetRamdomStdFromGrp (long GrpCod)
+long Usr_DB_GetRamdomStdFromGrp (long GrpCod)
{
/***** Get a random student from a group from database *****/
return DB_QuerySELECTCode ("can not get a random student from a group",
@@ -4209,7 +4209,7 @@ long Usr_GetRamdomStdFromGrp (long GrpCod)
/* Get number of teachers in courses of the current instit. in a department **/
/*****************************************************************************/
-unsigned Usr_GetNumTchsCurrentInsInDepartment (long DptCod)
+unsigned Usr_DB_GetNumTchsCurrentInsInDepartment (long DptCod)
{
/***** Get the number of teachers
from the current institution in a department *****/
@@ -5670,8 +5670,8 @@ static void Usr_GetListUsrsFromQuery (char *Query,Rol_Role_t Role,HieLvl_Level_t
case HieLvl_SYS: // System
// Query result has not a column with the acceptation
UsrInList->RoleInCurrentCrsDB = Rol_UNK;
- if (Usr_GetNumCrssOfUsr (UsrInList->UsrCod))
- UsrInList->Accepted = (Usr_GetNumCrssOfUsrNotAccepted (UsrInList->UsrCod) == 0);
+ if (Usr_DB_GetNumCrssOfUsr (UsrInList->UsrCod))
+ UsrInList->Accepted = (Usr_DB_GetNumCrssOfUsrNotAccepted (UsrInList->UsrCod) == 0);
else
UsrInList->Accepted = false;
break;
@@ -5681,7 +5681,7 @@ static void Usr_GetListUsrsFromQuery (char *Query,Rol_Role_t Role,HieLvl_Level_t
case HieLvl_DEG: // Degree
// Query result has not a column with the acceptation
UsrInList->RoleInCurrentCrsDB = Rol_UNK;
- UsrInList->Accepted = (Usr_GetNumCrssOfUsrNotAccepted (UsrInList->UsrCod) == 0);
+ UsrInList->Accepted = (Usr_DB_GetNumCrssOfUsrNotAccepted (UsrInList->UsrCod) == 0);
break;
case HieLvl_CRS: // Course
// Query result has a column with the acceptation
@@ -5712,7 +5712,7 @@ static void Usr_GetListUsrsFromQuery (char *Query,Rol_Role_t Role,HieLvl_Level_t
case HieLvl_DEG: // Degree
// Query result has not a column with the acceptation
UsrInList->RoleInCurrentCrsDB = Rol_UNK;
- UsrInList->Accepted = (Usr_GetNumCrssOfUsrWithARoleNotAccepted (UsrInList->UsrCod,Role) == 0);
+ UsrInList->Accepted = (Usr_DB_GetNumCrssOfUsrWithARoleNotAccepted (UsrInList->UsrCod,Role) == 0);
break;
case HieLvl_CRS: // Course
// Query result has a column with the acceptation
@@ -6469,8 +6469,8 @@ static void Usr_FormToSelectUsrListType (void (*FuncParams) (void *Args),void *A
The_ClassFormLinkInBoxNoWrap[Gbl.Prefs.Theme],
Gbl.Action.Act == ActReqMsgUsr ? "CopyMessageToHiddenFields();" :
NULL);
- Ico_PutIcon (Usr_IconsClassPhotoOrList[ListType],Txt_USR_LIST_TYPES[ListType],"ICO20x20");
- HTM_TxtF (" %s",Txt_USR_LIST_TYPES[ListType]);
+ Ico_PutIcon (Usr_IconsClassPhotoOrList[ListType],Txt_USR_LIST_TYPES[ListType],"ICO20x20");
+ HTM_TxtF (" %s",Txt_USR_LIST_TYPES[ListType]);
HTM_BUTTON_End ();
/***** End form *****/
@@ -6504,109 +6504,109 @@ void Usr_PutFormToSelectUsrsToGoToAct (struct SelectedUsrs *SelectedUsrs,
NULL,NULL,
HelpLink,Box_NOT_CLOSABLE);
- /***** Get and update type of list,
- number of columns in class photo
- and preference about view photos *****/
- Usr_GetAndUpdatePrefsAboutUsrList ();
+ /***** Get and update type of list,
+ number of columns in class photo
+ and preference about view photos *****/
+ Usr_GetAndUpdatePrefsAboutUsrList ();
- /***** Get groups to show ******/
- Grp_GetParCodsSeveralGrpsToShowUsrs ();
+ /***** Get groups to show ******/
+ Grp_GetParCodsSeveralGrpsToShowUsrs ();
- /***** Get and order lists of users from this course *****/
- Usr_GetListUsrs (HieLvl_CRS,Rol_STD);
- Usr_GetListUsrs (HieLvl_CRS,Rol_NET);
- Usr_GetListUsrs (HieLvl_CRS,Rol_TCH);
- NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs +
- Gbl.Usrs.LstUsrs[Rol_NET].NumUsrs +
- Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs;
+ /***** Get and order lists of users from this course *****/
+ Usr_GetListUsrs (HieLvl_CRS,Rol_STD);
+ Usr_GetListUsrs (HieLvl_CRS,Rol_NET);
+ Usr_GetListUsrs (HieLvl_CRS,Rol_TCH);
+ NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs +
+ Gbl.Usrs.LstUsrs[Rol_NET].NumUsrs +
+ Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs;
- /***** Draw class photos to select users *****/
- Box_BoxBegin (NULL,Txt_Select_users,
- NULL,NULL,
- HelpLink,Box_NOT_CLOSABLE);
+ /***** Draw class photos to select users *****/
+ Box_BoxBegin (NULL,Txt_Select_users,
+ NULL,NULL,
+ HelpLink,Box_NOT_CLOSABLE);
- /***** Show form to select the groups *****/
- Grp_ShowFormToSelectSeveralGroups (FuncParams,Args,
- Grp_MY_GROUPS);
+ /***** Show form to select the groups *****/
+ Grp_ShowFormToSelectSeveralGroups (FuncParams,Args,
+ Grp_MY_GROUPS);
- /***** Begin section with user list *****/
- HTM_SECTION_Begin (Usr_USER_LIST_SECTION_ID);
+ /***** Begin section with user list *****/
+ HTM_SECTION_Begin (Usr_USER_LIST_SECTION_ID);
- if (NumTotalUsrs)
- {
- if (Usr_GetIfShowBigList (NumTotalUsrs,
- FuncParams,Args,
- NULL))
- {
- /***** Form to select type of list used for select several users *****/
- Usr_ShowFormsToSelectUsrListType (FuncParams,Args);
+ if (NumTotalUsrs)
+ {
+ if (Usr_GetIfShowBigList (NumTotalUsrs,
+ FuncParams,Args,
+ NULL))
+ {
+ /***** Form to select type of list used for select several users *****/
+ Usr_ShowFormsToSelectUsrListType (FuncParams,Args);
- /***** Link to register students *****/
- Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs ();
+ /***** Link to register students *****/
+ Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs ();
- /***** Form to select users and select date range ****/
- /* Begin form */
- Frm_BeginForm (NextAction);
+ /***** Form to select users and select date range ****/
+ /* Begin form */
+ Frm_BeginForm (NextAction);
- /* Hidden parameters */
- Grp_PutParamsCodGrps ();
- if (NextAction == ActAdmAsgWrkCrs)
- {
- Gbl.FileBrowser.FullTree = true; // By default, show all files
- Brw_PutHiddenParamFullTreeIfSelected (&Gbl.FileBrowser.FullTree);
- }
- if (FuncParams)
- FuncParams (Args);
+ /* Hidden parameters */
+ Grp_PutParamsCodGrps ();
+ if (NextAction == ActAdmAsgWrkCrs)
+ {
+ Gbl.FileBrowser.FullTree = true; // By default, show all files
+ Brw_PutHiddenParamFullTreeIfSelected (&Gbl.FileBrowser.FullTree);
+ }
+ if (FuncParams)
+ FuncParams (Args);
- HTM_TABLE_BeginCenterPadding (2);
+ HTM_TABLE_BeginCenterPadding (2);
- /* Put list of users to select some of them */
- HTM_TR_Begin (NULL);
+ /* Put list of users to select some of them */
+ HTM_TR_Begin (NULL);
- HTM_TD_Begin ("class=\"%s RT\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
- HTM_TxtColon (Txt_Users);
- HTM_TD_End ();
+ HTM_TD_Begin ("class=\"%s RT\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
+ HTM_TxtColon (Txt_Users);
+ HTM_TD_End ();
- HTM_TD_Begin ("class=\"%s LT\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
- HTM_TABLE_BeginCenterPadding (2);
- Usr_ListUsersToSelect (Rol_TCH,SelectedUsrs);
- Usr_ListUsersToSelect (Rol_NET,SelectedUsrs);
- Usr_ListUsersToSelect (Rol_STD,SelectedUsrs);
- HTM_TABLE_End ();
- HTM_TD_End ();
+ HTM_TD_Begin ("class=\"%s LT\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
+ HTM_TABLE_BeginCenterPadding (2);
+ Usr_ListUsersToSelect (Rol_TCH,SelectedUsrs);
+ Usr_ListUsersToSelect (Rol_NET,SelectedUsrs);
+ Usr_ListUsersToSelect (Rol_STD,SelectedUsrs);
+ HTM_TABLE_End ();
+ HTM_TD_End ();
- HTM_TR_End ();
+ HTM_TR_End ();
- /* Starting and ending dates in the search */
- if (PutFormDateRange)
- Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (SetHMS);
+ /* Starting and ending dates in the search */
+ if (PutFormDateRange)
+ Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (SetHMS);
- HTM_TABLE_End ();
+ HTM_TABLE_End ();
- /***** Send button *****/
- Btn_PutConfirmButton (TxtButton);
+ /***** Send button *****/
+ Btn_PutConfirmButton (TxtButton);
- /***** End form *****/
- Frm_EndForm ();
- }
- }
- else // NumTotalUsrs == 0
- /***** Show warning indicating no users found *****/
- Usr_ShowWarningNoUsersFound (Rol_UNK);
+ /***** End form *****/
+ Frm_EndForm ();
+ }
+ }
+ else // NumTotalUsrs == 0
+ /***** Show warning indicating no users found *****/
+ Usr_ShowWarningNoUsersFound (Rol_UNK);
- /***** End section with user list *****/
- HTM_SECTION_End ();
+ /***** End section with user list *****/
+ HTM_SECTION_End ();
- /***** End box *****/
- Box_BoxEnd ();
+ /***** End box *****/
+ Box_BoxEnd ();
- /***** Free memory for users' list *****/
- Usr_FreeUsrsList (Rol_TCH);
- Usr_FreeUsrsList (Rol_NET);
- Usr_FreeUsrsList (Rol_STD);
+ /***** Free memory for users' list *****/
+ Usr_FreeUsrsList (Rol_TCH);
+ Usr_FreeUsrsList (Rol_NET);
+ Usr_FreeUsrsList (Rol_STD);
- /***** Free memory for list of selected groups *****/
- Grp_FreeListCodSelectedGrps ();
+ /***** Free memory for list of selected groups *****/
+ Grp_FreeListCodSelectedGrps ();
/***** End box *****/
Box_BoxEnd ();
@@ -6675,25 +6675,25 @@ static void Usr_PutCheckboxToSelectAllUsers (Rol_Role_t Role,
HTM_TR_Begin (NULL);
- HTM_TH_Begin (1,Usr_GetColumnsForSelectUsrs (),"LM LIGHT_BLUE");
+ HTM_TH_Begin (1,Usr_GetColumnsForSelectUsrs (),"LM LIGHT_BLUE");
- HTM_LABEL_Begin (NULL);
- if (Usr_NameSelUnsel[Role] && Usr_ParamUsrCod[Role])
- {
- Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Role],SelectedUsrs->ParamSuffix);
- HTM_INPUT_CHECKBOX (Usr_NameSelUnsel[Role],HTM_DONT_SUBMIT_ON_CHANGE,
- "value=\"\" onclick=\"togglecheckChildren(this,'%s')\"",
- ParamName);
- free (ParamName);
- }
- else
- Err_WrongRoleExit ();
- Sex = Usr_GetSexOfUsrsLst (Role);
- HTM_TxtColon (Gbl.Usrs.LstUsrs[Role].NumUsrs == 1 ? Txt_ROLES_SINGUL_Abc[Role][Sex] :
- Txt_ROLES_PLURAL_Abc[Role][Sex]);
- HTM_LABEL_End ();
+ HTM_LABEL_Begin (NULL);
+ if (Usr_NameSelUnsel[Role] && Usr_ParamUsrCod[Role])
+ {
+ Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Role],SelectedUsrs->ParamSuffix);
+ HTM_INPUT_CHECKBOX (Usr_NameSelUnsel[Role],HTM_DONT_SUBMIT_ON_CHANGE,
+ "value=\"\" onclick=\"togglecheckChildren(this,'%s')\"",
+ ParamName);
+ free (ParamName);
+ }
+ else
+ Err_WrongRoleExit ();
+ Sex = Usr_GetSexOfUsrsLst (Role);
+ HTM_TxtColon (Gbl.Usrs.LstUsrs[Role].NumUsrs == 1 ? Txt_ROLES_SINGUL_Abc[Role][Sex] :
+ Txt_ROLES_PLURAL_Abc[Role][Sex]);
+ HTM_LABEL_End ();
- HTM_TH_End ();
+ HTM_TH_End ();
HTM_TR_End ();
}
@@ -6783,11 +6783,11 @@ static void Usr_PutCheckboxListWithPhotos (void)
/***** Put checkbox to select whether list users with photos *****/
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
- HTM_INPUT_CHECKBOX ("WithPhotos",HTM_SUBMIT_ON_CHANGE,
- "value=\"Y\"%s",
- Gbl.Usrs.Listing.WithPhotos ? " checked=\"checked\"" :
- "");
- HTM_Txt (Txt_Display_photos);
+ HTM_INPUT_CHECKBOX ("WithPhotos",HTM_SUBMIT_ON_CHANGE,
+ "value=\"Y\"%s",
+ Gbl.Usrs.Listing.WithPhotos ? " checked=\"checked\"" :
+ "");
+ HTM_Txt (Txt_Display_photos);
HTM_LABEL_End ();
}
@@ -6826,16 +6826,16 @@ void Usr_WriteHeaderFieldsUsrDat (bool PutCheckBoxToSelectUsr)
HTM_TR_Begin (NULL);
- /***** First column used for selection *****/
- if (PutCheckBoxToSelectUsr)
- HTM_TH (1,1,"LM LIGHT_BLUE",NULL);
+ /***** First column used for selection *****/
+ if (PutCheckBoxToSelectUsr)
+ HTM_TH (1,1,"LM LIGHT_BLUE",NULL);
- /***** Columns for user's data fields *****/
- for (NumCol = 0;
- NumCol < Usr_NUM_MAIN_FIELDS_DATA_USR;
- NumCol++)
- if (NumCol != 2 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want this column
- HTM_TH (1,1,"LM LIGHT_BLUE",Usr_UsrDatMainFieldNames[NumCol]);
+ /***** Columns for user's data fields *****/
+ for (NumCol = 0;
+ NumCol < Usr_NUM_MAIN_FIELDS_DATA_USR;
+ NumCol++)
+ if (NumCol != 2 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want this column
+ HTM_TH (1,1,"LM LIGHT_BLUE",Usr_UsrDatMainFieldNames[NumCol]);
HTM_TR_End ();
}
@@ -6864,21 +6864,21 @@ static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr)
/***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat);
- /***** List guests' data *****/
- for (NumUsr = 0, Gbl.RowEvenOdd = 0;
- NumUsr < Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs;
- NumUsr++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
- {
- /* Copy user's basic data from list */
- Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_GST].Lst[NumUsr]);
+ /***** List guests' data *****/
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
+ NumUsr < Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs;
+ NumUsr++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
+ {
+ /* Copy user's basic data from list */
+ Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_GST].Lst[NumUsr]);
- /* Get list of user's IDs */
- ID_GetListIDsFromUsrCod (&UsrDat);
+ /* Get list of user's IDs */
+ ID_GetListIDsFromUsrCod (&UsrDat);
- /* Show row for this guest */
- Usr_WriteRowUsrMainData (NumUsr + 1,&UsrDat,true,Rol_GST,
- &Gbl.Usrs.Selected);
- }
+ /* Show row for this guest */
+ Usr_WriteRowUsrMainData (NumUsr + 1,&UsrDat,true,Rol_GST,
+ &Gbl.Usrs.Selected);
+ }
/***** Free memory used for user's data *****/
Usr_UsrDataDestructor (&UsrDat);
@@ -6917,10 +6917,10 @@ static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr)
if (!Gbl.Usrs.ClassPhoto.AllGroups)
{
HTM_TR_Begin (NULL);
- HTM_TD_Begin ("colspan=\"%u\" class=\"TIT CM\"",
- 1 + Usr_NUM_MAIN_FIELDS_DATA_USR);
- Grp_WriteNamesOfSelectedGrps ();
- HTM_TD_End ();
+ HTM_TD_Begin ("colspan=\"%u\" class=\"TIT CM\"",
+ 1 + Usr_NUM_MAIN_FIELDS_DATA_USR);
+ Grp_WriteNamesOfSelectedGrps ();
+ HTM_TD_End ();
HTM_TR_End ();
}
@@ -7228,97 +7228,100 @@ void Usr_ListAllDataStds (void)
/***** Begin table with list of students *****/
HTM_TABLE_BeginWide ();
- if (!Gbl.Usrs.ClassPhoto.AllGroups)
- {
- HTM_TR_Begin (NULL);
- HTM_TD_Begin ("colspan=\"%u\" class=\"TIT CM\"",NumColumnsTotal);
- Grp_WriteNamesOfSelectedGrps ();
- HTM_TD_End ();
- HTM_TR_End ();
- }
- /***** Heading row with column names *****/
- /* Begin row */
- HTM_TR_Begin (NULL);
-
- /* 1. Columns for the data */
- for (NumCol = (Gbl.Usrs.Listing.WithPhotos ? 0 :
- 1);
- NumCol < NumColumnsCommonCard;
- NumCol++)
- HTM_TH (1,1,"LM LIGHT_BLUE",FieldNames[NumCol]);
-
- /* 2. Columns for the groups */
- if (Gbl.Scope.Current == HieLvl_CRS)
+ if (!Gbl.Usrs.ClassPhoto.AllGroups)
{
- if (Gbl.Crs.Grps.GrpTypes.NumGrpTypes)
- for (NumGrpTyp = 0;
- NumGrpTyp < Gbl.Crs.Grps.GrpTypes.NumGrpTypes;
- NumGrpTyp++)
- if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If current course tiene groups of este type
- {
- HTM_TH_Begin (1,1,"LM LIGHT_BLUE");
- HTM_TxtF ("%s %s",
- Txt_Group,
- Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName);
- HTM_TH_End ();
- }
+ HTM_TR_Begin (NULL);
+ HTM_TD_Begin ("colspan=\"%u\" class=\"TIT CM\"",NumColumnsTotal);
+ Grp_WriteNamesOfSelectedGrps ();
+ HTM_TD_End ();
+ HTM_TR_End ();
+ }
- if (Gbl.Crs.Records.LstFields.Num)
+ /***** Heading row with column names *****/
+ /* Begin row */
+ HTM_TR_Begin (NULL);
+
+ /* 1. Columns for the data */
+ for (NumCol = (Gbl.Usrs.Listing.WithPhotos ? 0 :
+ 1);
+ NumCol < NumColumnsCommonCard;
+ NumCol++)
+ HTM_TH (1,1,"LM LIGHT_BLUE",FieldNames[NumCol]);
+
+ /* 2. Columns for the groups */
+ if (Gbl.Scope.Current == HieLvl_CRS)
{
- /* 3. Names of record fields that depend on the course */
- for (NumField = 0;
- NumField < Gbl.Crs.Records.LstFields.Num;
- NumField++)
- HTM_TH (1,1,"LM LIGHT_BLUE",Gbl.Crs.Records.LstFields.Lst[NumField].Name);
+ if (Gbl.Crs.Grps.GrpTypes.NumGrpTypes)
+ for (NumGrpTyp = 0;
+ NumGrpTyp < Gbl.Crs.Grps.GrpTypes.NumGrpTypes;
+ NumGrpTyp++)
+ if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If current course tiene groups of este type
+ {
+ HTM_TH_Begin (1,1,"LM LIGHT_BLUE");
+ HTM_TxtF ("%s %s",
+ Txt_Group,
+ Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName);
+ HTM_TH_End ();
+ }
- /* 4. Visibility type for the record fields that depend on the course, in other row */
- HTM_TR_End ();
- HTM_TR_Begin (NULL);
- for (NumCol = 0;
- NumCol < NumColumnsCardAndGroups;
- NumCol++)
- if (NumCol != 1 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want it in listing
- {
- HTM_TD_Begin ("class=\"VERY_LIGHT_BLUE\"");
- HTM_TD_End ();
- }
- for (NumField = 0;
- NumField < Gbl.Crs.Records.LstFields.Num;
- NumField++)
+ if (Gbl.Crs.Records.LstFields.Num)
{
- HTM_TH_Begin (1,1,"LM VERY_LIGHT_BLUE");
- HTM_TxtF ("(%s)",Txt_RECORD_FIELD_VISIBILITY_RECORD[Gbl.Crs.Records.LstFields.Lst[NumField].Visibility]);
- HTM_TH_End ();
+ /* 3. Names of record fields that depend on the course */
+ for (NumField = 0;
+ NumField < Gbl.Crs.Records.LstFields.Num;
+ NumField++)
+ HTM_TH (1,1,"LM LIGHT_BLUE",Gbl.Crs.Records.LstFields.Lst[NumField].Name);
+
+ /* 4. Visibility type for the record fields that depend on the course, in other row */
+ HTM_TR_End ();
+
+ HTM_TR_Begin (NULL);
+
+ for (NumCol = 0;
+ NumCol < NumColumnsCardAndGroups;
+ NumCol++)
+ if (NumCol != 1 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want it in listing
+ {
+ HTM_TD_Begin ("class=\"VERY_LIGHT_BLUE\"");
+ HTM_TD_End ();
+ }
+ for (NumField = 0;
+ NumField < Gbl.Crs.Records.LstFields.Num;
+ NumField++)
+ {
+ HTM_TH_Begin (1,1,"LM VERY_LIGHT_BLUE");
+ HTM_TxtF ("(%s)",Txt_RECORD_FIELD_VISIBILITY_RECORD[Gbl.Crs.Records.LstFields.Lst[NumField].Visibility]);
+ HTM_TH_End ();
+ }
}
}
+
+ /* End row */
+ HTM_TR_End ();
+
+ /***** Initialize structure with user's data *****/
+ Usr_UsrDataConstructor (&UsrDat);
+
+ /***** List students' data *****/
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
+ NumUsr < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs; )
+ {
+ UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod;
+ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
+ Usr_DONT_GET_PREFS,
+ Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
+ {
+ UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].Accepted;
+ NumUsr++;
+ Usr_WriteRowStdAllData (&UsrDat,GroupNames);
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
+ }
}
- /* End row */
- HTM_TR_End ();
-
- /***** Initialize structure with user's data *****/
- Usr_UsrDataConstructor (&UsrDat);
-
- /***** List students' data *****/
- for (NumUsr = 0, Gbl.RowEvenOdd = 0;
- NumUsr < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs; )
- {
- UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod;
- if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
- Usr_DONT_GET_PREFS,
- Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
- {
- UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].Accepted;
- NumUsr++;
- Usr_WriteRowStdAllData (&UsrDat,GroupNames);
-
- Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
- }
- }
-
- /***** Free memory used for user's data *****/
- Usr_UsrDataDestructor (&UsrDat);
+ /***** Free memory used for user's data *****/
+ Usr_UsrDataDestructor (&UsrDat);
/***** End table *****/
HTM_TABLE_End ();
@@ -7460,10 +7463,10 @@ void Usr_ListAllDataTchs (void)
/***** Begin table with lists of teachers *****/
HTM_TABLE_BeginWide ();
- /***** List teachers and non-editing teachers *****/
- Gbl.RowEvenOdd = 0;
- Usr_ListRowsAllDataTchs (Rol_TCH,FieldNames,NumColumns);
- Usr_ListRowsAllDataTchs (Rol_NET,FieldNames,NumColumns);
+ /***** List teachers and non-editing teachers *****/
+ Gbl.RowEvenOdd = 0;
+ Usr_ListRowsAllDataTchs (Rol_TCH,FieldNames,NumColumns);
+ Usr_ListRowsAllDataTchs (Rol_NET,FieldNames,NumColumns);
/***** End table *****/
HTM_TABLE_End ();
@@ -7492,11 +7495,11 @@ static void Usr_ListRowsAllDataTchs (Rol_Role_t Role,
/***** Heading row *****/
HTM_TR_Begin (NULL);
- for (NumCol = (Gbl.Usrs.Listing.WithPhotos ? 0 :
- 1);
- NumCol < NumColumns;
- NumCol++)
- HTM_TH (1,1,"LM LIGHT_BLUE",FieldNames[NumCol]);
+ for (NumCol = (Gbl.Usrs.Listing.WithPhotos ? 0 :
+ 1);
+ NumCol < NumColumns;
+ NumCol++)
+ HTM_TH (1,1,"LM LIGHT_BLUE",FieldNames[NumCol]);
HTM_TR_End ();
@@ -7566,60 +7569,60 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,
NULL,Box_NOT_CLOSABLE,2);
Str_FreeString ();
- /***** Heading row with column names *****/
- Gbl.Usrs.Listing.WithPhotos = true;
- Usr_WriteHeaderFieldsUsrDat (false); // Columns for the data
+ /***** Heading row with column names *****/
+ Gbl.Usrs.Listing.WithPhotos = true;
+ Usr_WriteHeaderFieldsUsrDat (false); // Columns for the data
- /***** Initialize structure with user's data *****/
- Usr_UsrDataConstructor (&UsrDat);
+ /***** Initialize structure with user's data *****/
+ Usr_UsrDataConstructor (&UsrDat);
- /***** List data of users *****/
- for (NumUsr = 0, Gbl.RowEvenOdd = 0;
- NumUsr < NumUsrs;
- NumUsr++)
- {
- UsrInList = &Gbl.Usrs.LstUsrs[Role].Lst[NumUsr];
-
- /* Copy user's basic data from list */
- Usr_CopyBasicUsrDataFromList (&UsrDat,UsrInList);
-
- /* Get list of user's IDs */
- ID_GetListIDsFromUsrCod (&UsrDat);
-
- /* Write data of this user */
- Usr_WriteRowUsrMainData (NumUsr + 1,&UsrDat,false,Role,
- &Gbl.Usrs.Selected);
-
- /* Write all the courses this user belongs to */
- if (Role != Rol_GST && // Guests do not belong to any course
- Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // Only admins can view the courses
+ /***** List data of users *****/
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
+ NumUsr < NumUsrs;
+ NumUsr++)
{
- HTM_TR_Begin (NULL);
+ UsrInList = &Gbl.Usrs.LstUsrs[Role].Lst[NumUsr];
- HTM_TD_Begin ("colspan=\"2\" class=\"COLOR%u\"",Gbl.RowEvenOdd);
- HTM_TD_End ();
+ /* Copy user's basic data from list */
+ Usr_CopyBasicUsrDataFromList (&UsrDat,UsrInList);
- HTM_TD_Begin ("colspan=\"%u\" class=\"COLOR%u\"",
- Usr_NUM_MAIN_FIELDS_DATA_USR-2,
- Gbl.RowEvenOdd);
- if (Role == Rol_UNK)
+ /* Get list of user's IDs */
+ ID_GetListIDsFromUsrCod (&UsrDat);
+
+ /* Write data of this user */
+ Usr_WriteRowUsrMainData (NumUsr + 1,&UsrDat,false,Role,
+ &Gbl.Usrs.Selected);
+
+ /* Write all the courses this user belongs to */
+ if (Role != Rol_GST && // Guests do not belong to any course
+ Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // Only admins can view the courses
{
- Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_TCH);
- Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_NET);
- Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_STD);
- }
- else
- Crs_GetAndWriteCrssOfAUsr (&UsrDat,Role);
- HTM_TD_End ();
+ HTM_TR_Begin (NULL);
- HTM_TR_End ();
+ HTM_TD_Begin ("colspan=\"2\" class=\"COLOR%u\"",Gbl.RowEvenOdd);
+ HTM_TD_End ();
+
+ HTM_TD_Begin ("colspan=\"%u\" class=\"COLOR%u\"",
+ Usr_NUM_MAIN_FIELDS_DATA_USR-2,
+ Gbl.RowEvenOdd);
+ if (Role == Rol_UNK)
+ {
+ Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_TCH);
+ Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_NET);
+ Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_STD);
+ }
+ else
+ Crs_GetAndWriteCrssOfAUsr (&UsrDat,Role);
+ HTM_TD_End ();
+
+ HTM_TR_End ();
+ }
+
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
- Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
- }
-
- /***** Free memory used for user's data *****/
- Usr_UsrDataDestructor (&UsrDat);
+ /***** Free memory used for user's data *****/
+ Usr_UsrDataDestructor (&UsrDat);
/***** End table and box *****/
Box_BoxTableEnd ();
@@ -7667,14 +7670,14 @@ void Usr_ListDataAdms (void)
case Rol_SYS_ADM:
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
- {
- Usr_PutLinkToSeeGuests (); // List guests
- Dup_PutLinkToListDupUsrs (); // List possible duplicate users
- }
- Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); // Admin one user
- if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
- Enr_PutLinkToRemOldUsrs (); // Remove old users
+ if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
+ {
+ Usr_PutLinkToSeeGuests (); // List guests
+ Dup_PutLinkToListDupUsrs (); // List possible duplicate users
+ }
+ Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); // Admin one user
+ if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
+ Enr_PutLinkToRemOldUsrs (); // Remove old users
Mnu_ContextMenuEnd ();
break;
default:
@@ -7712,69 +7715,69 @@ void Usr_ListDataAdms (void)
NULL,NULL,
Hlp_USERS_Administrators,Box_NOT_CLOSABLE);
- /***** Form to select scope *****/
- HTM_DIV_Begin ("class=\"CM\"");
- Frm_BeginForm (ActLstOth);
- Usr_PutParamListWithPhotos ();
- HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
- HTM_TxtColonNBSP (Txt_Scope);
- Sco_PutSelectorScope ("ScopeUsr",HTM_SUBMIT_ON_CHANGE);
- HTM_LABEL_End ();
- Frm_EndForm ();
- HTM_DIV_End ();
-
- if (Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs)
- {
- /****** Show photos? *****/
- HTM_DIV_Begin ("class=\"PREF_CONT\"");
- HTM_DIV_Begin ("class=\"PREF_OFF\"");
- Frm_BeginForm (ActLstOth);
- Sco_PutParamCurrentScope (&Gbl.Scope.Current);
- Usr_PutCheckboxListWithPhotos ();
- Frm_EndForm ();
- HTM_DIV_End ();
+ /***** Form to select scope *****/
+ HTM_DIV_Begin ("class=\"CM\"");
+ Frm_BeginForm (ActLstOth);
+ Usr_PutParamListWithPhotos ();
+ HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
+ HTM_TxtColonNBSP (Txt_Scope);
+ Sco_PutSelectorScope ("ScopeUsr",HTM_SUBMIT_ON_CHANGE);
+ HTM_LABEL_End ();
+ Frm_EndForm ();
HTM_DIV_End ();
- /***** Heading row with column names *****/
- HTM_TABLE_Begin (NULL);
- HTM_TR_Begin (NULL);
+ if (Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs)
+ {
+ /****** Show photos? *****/
+ HTM_DIV_Begin ("class=\"PREF_CONT\"");
+ HTM_DIV_Begin ("class=\"PREF_OFF\"");
+ Frm_BeginForm (ActLstOth);
+ Sco_PutParamCurrentScope (&Gbl.Scope.Current);
+ Usr_PutCheckboxListWithPhotos ();
+ Frm_EndForm ();
+ HTM_DIV_End ();
+ HTM_DIV_End ();
- for (NumCol = 0;
- NumCol < Usr_NUM_MAIN_FIELDS_DATA_ADM;
- NumCol++)
- if (NumCol != 1 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want this column
- HTM_TH (1,1,"LM LIGHT_BLUE",FieldNames[NumCol]);
+ /***** Heading row with column names *****/
+ HTM_TABLE_Begin (NULL);
+ HTM_TR_Begin (NULL);
- HTM_TR_End ();
+ for (NumCol = 0;
+ NumCol < Usr_NUM_MAIN_FIELDS_DATA_ADM;
+ NumCol++)
+ if (NumCol != 1 || Gbl.Usrs.Listing.WithPhotos) // Skip photo column if I don't want this column
+ HTM_TH (1,1,"LM LIGHT_BLUE",FieldNames[NumCol]);
- /***** Initialize structure with user's data *****/
- Usr_UsrDataConstructor (&UsrDat);
+ HTM_TR_End ();
- /***** List data of administrators *****/
- for (NumUsr = 0, Gbl.RowEvenOdd = 0;
- NumUsr < Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs; )
- {
- UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].UsrCod;
- if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
- Usr_DONT_GET_PREFS,
- Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
- {
- UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].Accepted;
- Usr_WriteRowAdmData (++NumUsr,&UsrDat);
+ /***** Initialize structure with user's data *****/
+ Usr_UsrDataConstructor (&UsrDat);
- Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
- }
- }
+ /***** List data of administrators *****/
+ for (NumUsr = 0, Gbl.RowEvenOdd = 0;
+ NumUsr < Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs; )
+ {
+ UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].UsrCod;
+ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
+ Usr_DONT_GET_PREFS,
+ Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
+ {
+ UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].Accepted;
+ Usr_WriteRowAdmData (++NumUsr,&UsrDat);
- /***** Free memory used for user's data *****/
- Usr_UsrDataDestructor (&UsrDat);
+ Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
+ }
+ }
- /***** End table *****/
- HTM_TABLE_End ();
- }
- else // Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs == 0
- /***** Show warning indicating no admins found *****/
- Usr_ShowWarningNoUsersFound (Rol_DEG_ADM);
+ /***** Free memory used for user's data *****/
+ Usr_UsrDataDestructor (&UsrDat);
+
+ /***** End table *****/
+ HTM_TABLE_End ();
+ }
+ else // Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs == 0
+ /***** Show warning indicating no admins found *****/
+ Usr_ShowWarningNoUsersFound (Rol_DEG_ADM);
/***** End box *****/
Box_BoxEnd ();
@@ -7825,7 +7828,7 @@ static void Usr_GetAndUpdateUsrListType (void)
if (Gbl.Usrs.Me.ListType != Usr_LIST_UNKNOWN)
/* Save in the database the type of list preferred by me */
- Usr_UpdateMyUsrListTypeInDB ();
+ Usr_DB_UpdateMyUsrListType ();
else
/* If parameter can't be retrieved from,
get my preference from database */
@@ -7905,7 +7908,7 @@ static void Usr_GetMyUsrListTypeFromDB (void)
/***************** Save my preference about type of users' list **************/
/*****************************************************************************/
-static void Usr_UpdateMyUsrListTypeInDB (void)
+static void Usr_DB_UpdateMyUsrListType (void)
{
/***** Update type of users listing *****/
DB_QueryUPDATE ("can not update type of listing",
@@ -7929,7 +7932,7 @@ void Usr_GetAndUpdateColsClassPhoto (void)
if (Gbl.Usrs.ClassPhoto.Cols)
/* Save the number of columns into the database */
- Usr_UpdateMyColsClassPhotoInDB ();
+ Usr_DB_UpdateMyColsClassPhoto ();
else
/* If parameter can't be retrieved from form,
get my preference from database */
@@ -8007,7 +8010,7 @@ static void Usr_GetMyColsClassPhotoFromDB (void)
/** Save my prefs. about number of colums in class photo for current course **/
/*****************************************************************************/
-static void Usr_UpdateMyColsClassPhotoInDB (void)
+static void Usr_DB_UpdateMyColsClassPhoto (void)
{
if (Gbl.Usrs.Me.Logged &&
Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
@@ -8031,7 +8034,7 @@ static void Usr_GetAndUpdatePrefAboutListWithPhotos (void)
/***** Get my preference about photos in users' list from form *****/
if (Usr_GetParamListWithPhotosFromForm ())
/* Save preference about photos in users' list into the database */
- Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB ();
+ Usr_DB_UpdateMyPrefAboutListWithPhotosPhoto ();
else
/* If parameter can't be retrieved from form,
get my preference from database */
@@ -8114,7 +8117,7 @@ void Usr_GetMyPrefAboutListWithPhotosFromDB (void)
/**** Save my preference about photos in users' list for current course ******/
/*****************************************************************************/
-static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void)
+static void Usr_DB_UpdateMyPrefAboutListWithPhotosPhoto (void)
{
if (Gbl.Usrs.Me.Logged &&
Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
@@ -8176,10 +8179,10 @@ void Usr_SeeGuests (void)
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- Usr_PutLinkToSeeAdmins (); // List admins
- Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); // Admin one user
- if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
- Enr_PutLinkToRemOldUsrs (); // Remove old users
+ Usr_PutLinkToSeeAdmins (); // List admins
+ Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); // Admin one user
+ if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
+ Enr_PutLinkToRemOldUsrs (); // Remove old users
Mnu_ContextMenuEnd ();
/***** Get and update type of list,
@@ -8199,83 +8202,83 @@ void Usr_SeeGuests (void)
Usr_PutIconsListGsts,NULL,
Hlp_USERS_Guests,Box_NOT_CLOSABLE);
- /***** Form to select scope *****/
- if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
- {
- HTM_DIV_Begin ("class=\"CM\"");
- Frm_BeginForm (ActLstGst);
- Usr_PutParamsPrefsAboutUsrList ();
- HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
- HTM_TxtColonNBSP (Txt_Scope);
- Sco_PutSelectorScope ("ScopeUsr",HTM_SUBMIT_ON_CHANGE);
- HTM_LABEL_End ();
- Frm_EndForm ();
- HTM_DIV_End ();
- }
-
- /***** Begin section with user list *****/
- HTM_SECTION_Begin (Usr_USER_LIST_SECTION_ID);
-
- if (Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs)
- {
- if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs,
- Sco_PutParamCurrentScope,&Gbl.Scope.Current,
- NULL))
- {
- /***** Form to select type of list of users *****/
- Usr_ShowFormsToSelectUsrListType (Sco_PutParamCurrentScope,&Gbl.Scope.Current);
-
- /***** Draw a class photo with guests *****/
- if (Gbl.Usrs.Me.ListType == Usr_LIST_AS_CLASS_PHOTO)
- Lay_WriteHeaderClassPhoto (false,true,
- (Gbl.Scope.Current == HieLvl_CTR ||
- Gbl.Scope.Current == HieLvl_INS) ? Gbl.Hierarchy.Ins.InsCod :
- -1L,
- -1L,
- -1L);
-
- /* Set options allowed */
- PutForm = Usr_SetOptionsListUsrsAllowed (Rol_GST,ICanChooseOption);
-
- /* Begin form */
- if (PutForm)
- Frm_BeginForm (ActDoActOnSevGst);
-
- /* Begin table */
- HTM_TABLE_BeginWide ();
-
- /* Draw the classphoto/list */
- switch (Gbl.Usrs.Me.ListType)
- {
- case Usr_LIST_AS_CLASS_PHOTO:
- Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
- Rol_GST,&Gbl.Usrs.Selected,
- PutForm); // Put checkbox to select users?
- break;
- case Usr_LIST_AS_LISTING:
- Usr_ListMainDataGsts (PutForm); // Put checkbox to select users?
- break;
- default:
- break;
- }
-
- /* End table */
- HTM_TABLE_End ();
-
- /***** Which action, show records, follow...? *****/
- if (PutForm)
- {
- Usr_PutOptionsListUsrs (ICanChooseOption);
+ /***** Form to select scope *****/
+ if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
+ {
+ HTM_DIV_Begin ("class=\"CM\"");
+ Frm_BeginForm (ActLstGst);
+ Usr_PutParamsPrefsAboutUsrList ();
+ HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
+ HTM_TxtColonNBSP (Txt_Scope);
+ Sco_PutSelectorScope ("ScopeUsr",HTM_SUBMIT_ON_CHANGE);
+ HTM_LABEL_End ();
Frm_EndForm ();
- }
+ HTM_DIV_End ();
}
- }
- else // Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs == 0
- /***** Show warning indicating no guests found *****/
- Usr_ShowWarningNoUsersFound (Rol_GST);
- /***** End section with user list *****/
- HTM_SECTION_End ();
+ /***** Begin section with user list *****/
+ HTM_SECTION_Begin (Usr_USER_LIST_SECTION_ID);
+
+ if (Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs)
+ {
+ if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs,
+ Sco_PutParamCurrentScope,&Gbl.Scope.Current,
+ NULL))
+ {
+ /***** Form to select type of list of users *****/
+ Usr_ShowFormsToSelectUsrListType (Sco_PutParamCurrentScope,&Gbl.Scope.Current);
+
+ /***** Draw a class photo with guests *****/
+ if (Gbl.Usrs.Me.ListType == Usr_LIST_AS_CLASS_PHOTO)
+ Lay_WriteHeaderClassPhoto (false,true,
+ (Gbl.Scope.Current == HieLvl_CTR ||
+ Gbl.Scope.Current == HieLvl_INS) ? Gbl.Hierarchy.Ins.InsCod :
+ -1L,
+ -1L,
+ -1L);
+
+ /* Set options allowed */
+ PutForm = Usr_SetOptionsListUsrsAllowed (Rol_GST,ICanChooseOption);
+
+ /* Begin form */
+ if (PutForm)
+ Frm_BeginForm (ActDoActOnSevGst);
+
+ /* Begin table */
+ HTM_TABLE_BeginWide ();
+
+ /* Draw the classphoto/list */
+ switch (Gbl.Usrs.Me.ListType)
+ {
+ case Usr_LIST_AS_CLASS_PHOTO:
+ Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
+ Rol_GST,&Gbl.Usrs.Selected,
+ PutForm); // Put checkbox to select users?
+ break;
+ case Usr_LIST_AS_LISTING:
+ Usr_ListMainDataGsts (PutForm); // Put checkbox to select users?
+ break;
+ default:
+ break;
+ }
+
+ /* End table */
+ HTM_TABLE_End ();
+
+ /***** Which action, show records, follow...? *****/
+ if (PutForm)
+ {
+ Usr_PutOptionsListUsrs (ICanChooseOption);
+ Frm_EndForm ();
+ }
+ }
+ }
+ else // Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs == 0
+ /***** Show warning indicating no guests found *****/
+ Usr_ShowWarningNoUsersFound (Rol_GST);
+
+ /***** End section with user list *****/
+ HTM_SECTION_End ();
/***** End box *****/
Box_BoxEnd ();
@@ -8308,13 +8311,13 @@ void Usr_SeeStudents (void)
case Rol_SYS_ADM:
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); // Admin one student
- if (Gbl.Hierarchy.Level == HieLvl_CRS && // Course selected
- Gbl.Usrs.Me.Role.Logged != Rol_STD) // Teacher or admin
- {
- Enr_PutLinkToAdminSeveralUsrs (Rol_STD); // Admin several students
- Rec_PutLinkToEditRecordFields (); // Edit record fields
- }
+ Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); // Admin one student
+ if (Gbl.Hierarchy.Level == HieLvl_CRS && // Course selected
+ Gbl.Usrs.Me.Role.Logged != Rol_STD) // Teacher or admin
+ {
+ Enr_PutLinkToAdminSeveralUsrs (Rol_STD); // Admin several students
+ Rec_PutLinkToEditRecordFields (); // Edit record fields
+ }
Mnu_ContextMenuEnd ();
break;
default:
@@ -8342,103 +8345,103 @@ void Usr_SeeStudents (void)
Usr_PutIconsListStds,NULL,
Hlp_USERS_Students,Box_NOT_CLOSABLE);
- /***** Form to select scope *****/
- switch (Gbl.Usrs.Me.Role.Logged)
- {
- case Rol_DEG_ADM:
- case Rol_CTR_ADM:
- case Rol_INS_ADM:
- case Rol_SYS_ADM:
- HTM_DIV_Begin ("class=\"CM\"");
- Frm_BeginForm (ActLstStd);
- Usr_PutParamsPrefsAboutUsrList ();
- HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
- HTM_TxtColonNBSP (Txt_Scope);
- Sco_PutSelectorScope ("ScopeUsr",HTM_SUBMIT_ON_CHANGE);
- HTM_LABEL_End ();
- Frm_EndForm ();
- HTM_DIV_End ();
- break;
- default:
- break;
- }
+ /***** Form to select scope *****/
+ switch (Gbl.Usrs.Me.Role.Logged)
+ {
+ case Rol_DEG_ADM:
+ case Rol_CTR_ADM:
+ case Rol_INS_ADM:
+ case Rol_SYS_ADM:
+ HTM_DIV_Begin ("class=\"CM\"");
+ Frm_BeginForm (ActLstStd);
+ Usr_PutParamsPrefsAboutUsrList ();
+ HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
+ HTM_TxtColonNBSP (Txt_Scope);
+ Sco_PutSelectorScope ("ScopeUsr",HTM_SUBMIT_ON_CHANGE);
+ HTM_LABEL_End ();
+ Frm_EndForm ();
+ HTM_DIV_End ();
+ break;
+ default:
+ break;
+ }
- /***** Form to select groups *****/
- if (Gbl.Scope.Current == HieLvl_CRS)
- Grp_ShowFormToSelectSeveralGroups (Sco_PutParamCurrentScope,&Gbl.Scope.Current,
- Grp_MY_GROUPS);
+ /***** Form to select groups *****/
+ if (Gbl.Scope.Current == HieLvl_CRS)
+ Grp_ShowFormToSelectSeveralGroups (Sco_PutParamCurrentScope,&Gbl.Scope.Current,
+ Grp_MY_GROUPS);
- /***** Begin section with user list *****/
- HTM_SECTION_Begin (Usr_USER_LIST_SECTION_ID);
+ /***** Begin section with user list *****/
+ HTM_SECTION_Begin (Usr_USER_LIST_SECTION_ID);
- if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs)
- {
- if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs,
- Sco_PutParamCurrentScope,&Gbl.Scope.Current,
- NULL))
- {
- /***** Form to select type of list of users *****/
- Usr_ShowFormsToSelectUsrListType (Sco_PutParamCurrentScope,&Gbl.Scope.Current);
+ if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs)
+ {
+ if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs,
+ Sco_PutParamCurrentScope,&Gbl.Scope.Current,
+ NULL))
+ {
+ /***** Form to select type of list of users *****/
+ Usr_ShowFormsToSelectUsrListType (Sco_PutParamCurrentScope,&Gbl.Scope.Current);
- /***** Draw a class photo with students of the course *****/
- if (Gbl.Usrs.Me.ListType == Usr_LIST_AS_CLASS_PHOTO)
- Lay_WriteHeaderClassPhoto (false,true,
- (Gbl.Scope.Current == HieLvl_CRS ||
- Gbl.Scope.Current == HieLvl_DEG ||
- Gbl.Scope.Current == HieLvl_CTR ||
- Gbl.Scope.Current == HieLvl_INS) ? Gbl.Hierarchy.Ins.InsCod :
- -1L,
- (Gbl.Scope.Current == HieLvl_CRS ||
- Gbl.Scope.Current == HieLvl_DEG) ? Gbl.Hierarchy.Deg.DegCod :
- -1L,
- Gbl.Scope.Current == HieLvl_CRS ? Gbl.Hierarchy.Crs.CrsCod :
- -1L);
+ /***** Draw a class photo with students of the course *****/
+ if (Gbl.Usrs.Me.ListType == Usr_LIST_AS_CLASS_PHOTO)
+ Lay_WriteHeaderClassPhoto (false,true,
+ (Gbl.Scope.Current == HieLvl_CRS ||
+ Gbl.Scope.Current == HieLvl_DEG ||
+ Gbl.Scope.Current == HieLvl_CTR ||
+ Gbl.Scope.Current == HieLvl_INS) ? Gbl.Hierarchy.Ins.InsCod :
+ -1L,
+ (Gbl.Scope.Current == HieLvl_CRS ||
+ Gbl.Scope.Current == HieLvl_DEG) ? Gbl.Hierarchy.Deg.DegCod :
+ -1L,
+ Gbl.Scope.Current == HieLvl_CRS ? Gbl.Hierarchy.Crs.CrsCod :
+ -1L);
- /* Set options allowed */
- PutForm = Usr_SetOptionsListUsrsAllowed (Rol_STD,ICanChooseOption);
+ /* Set options allowed */
+ PutForm = Usr_SetOptionsListUsrsAllowed (Rol_STD,ICanChooseOption);
- /* Begin form */
- if (PutForm)
- {
- Frm_BeginForm (ActDoActOnSevStd);
- Grp_PutParamsCodGrps ();
- }
+ /* Begin form */
+ if (PutForm)
+ {
+ Frm_BeginForm (ActDoActOnSevStd);
+ Grp_PutParamsCodGrps ();
+ }
- /* Begin table */
- HTM_TABLE_BeginWide ();
+ /* Begin table */
+ HTM_TABLE_BeginWide ();
- /* Draw the classphoto/list */
- switch (Gbl.Usrs.Me.ListType)
- {
- case Usr_LIST_AS_CLASS_PHOTO:
- Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
- Rol_STD,&Gbl.Usrs.Selected,
- PutForm); // Put checkbox to select users?
- break;
- case Usr_LIST_AS_LISTING:
- Usr_ListMainDataStds (PutForm); // Put checkbox to select users?
- break;
- default:
- break;
- }
+ /* Draw the classphoto/list */
+ switch (Gbl.Usrs.Me.ListType)
+ {
+ case Usr_LIST_AS_CLASS_PHOTO:
+ Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
+ Rol_STD,&Gbl.Usrs.Selected,
+ PutForm); // Put checkbox to select users?
+ break;
+ case Usr_LIST_AS_LISTING:
+ Usr_ListMainDataStds (PutForm); // Put checkbox to select users?
+ break;
+ default:
+ break;
+ }
- /* End table */
- HTM_TABLE_End ();
+ /* End table */
+ HTM_TABLE_End ();
- /***** Which action, show records, follow...? *****/
- if (PutForm)
- {
- Usr_PutOptionsListUsrs (ICanChooseOption);
- Frm_EndForm ();
- }
- }
- }
- else // Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs == 0
- /***** Show warning indicating no students found *****/
- Usr_ShowWarningNoUsersFound (Rol_STD);
+ /***** Which action, show records, follow...? *****/
+ if (PutForm)
+ {
+ Usr_PutOptionsListUsrs (ICanChooseOption);
+ Frm_EndForm ();
+ }
+ }
+ }
+ else // Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs == 0
+ /***** Show warning indicating no students found *****/
+ Usr_ShowWarningNoUsersFound (Rol_STD);
- /***** End section with user list *****/
- HTM_SECTION_End ();
+ /***** End section with user list *****/
+ HTM_SECTION_End ();
/***** End box *****/
Box_BoxEnd ();
@@ -8475,13 +8478,13 @@ void Usr_SeeTeachers (void)
case Rol_SYS_ADM:
/***** Contextual menu *****/
Mnu_ContextMenuBegin ();
- Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch); // Admin one teacher
- if (Gbl.Hierarchy.Level == HieLvl_CRS && // Course selected
- Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // I am logged as admin
- {
- Enr_PutLinkToAdminSeveralUsrs (Rol_NET); // Admin several non-editing teachers
- Enr_PutLinkToAdminSeveralUsrs (Rol_TCH); // Admin several teachers
- }
+ Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch); // Admin one teacher
+ if (Gbl.Hierarchy.Level == HieLvl_CRS && // Course selected
+ Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // I am logged as admin
+ {
+ Enr_PutLinkToAdminSeveralUsrs (Rol_NET); // Admin several non-editing teachers
+ Enr_PutLinkToAdminSeveralUsrs (Rol_TCH); // Admin several teachers
+ }
Mnu_ContextMenuEnd ();
break;
default:
@@ -8520,7 +8523,7 @@ void Usr_SeeTeachers (void)
(Gbl.Scope.Current == HieLvl_CTR ? Gbl.Hierarchy.Ctr.CtrCod :
(Gbl.Scope.Current == HieLvl_DEG ? Gbl.Hierarchy.Deg.DegCod :
(Gbl.Scope.Current == HieLvl_CRS ? Gbl.Hierarchy.Crs.CrsCod :
- -1L))))),
+ -1L))))),
1 << Rol_NET |
1 << Rol_TCH);
@@ -8529,104 +8532,104 @@ void Usr_SeeTeachers (void)
Usr_PutIconsListTchs,NULL,
Hlp_USERS_Teachers,Box_NOT_CLOSABLE);
- /***** Form to select scope *****/
- HTM_DIV_Begin ("class=\"CM\"");
- Frm_BeginForm (ActLstTch);
- Usr_PutParamsPrefsAboutUsrList ();
- HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
- HTM_TxtColonNBSP (Txt_Scope);
- Sco_PutSelectorScope ("ScopeUsr",HTM_SUBMIT_ON_CHANGE);
- HTM_LABEL_End ();
- Frm_EndForm ();
- HTM_DIV_End ();
+ /***** Form to select scope *****/
+ HTM_DIV_Begin ("class=\"CM\"");
+ Frm_BeginForm (ActLstTch);
+ Usr_PutParamsPrefsAboutUsrList ();
+ HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
+ HTM_TxtColonNBSP (Txt_Scope);
+ Sco_PutSelectorScope ("ScopeUsr",HTM_SUBMIT_ON_CHANGE);
+ HTM_LABEL_End ();
+ Frm_EndForm ();
+ HTM_DIV_End ();
- /***** Form to select groups *****/
- if (Gbl.Scope.Current == HieLvl_CRS)
- Grp_ShowFormToSelectSeveralGroups (Sco_PutParamCurrentScope,&Gbl.Scope.Current,
- Grp_MY_GROUPS);
+ /***** Form to select groups *****/
+ if (Gbl.Scope.Current == HieLvl_CRS)
+ Grp_ShowFormToSelectSeveralGroups (Sco_PutParamCurrentScope,&Gbl.Scope.Current,
+ Grp_MY_GROUPS);
- /***** Begin section with user list *****/
- HTM_SECTION_Begin (Usr_USER_LIST_SECTION_ID);
+ /***** Begin section with user list *****/
+ HTM_SECTION_Begin (Usr_USER_LIST_SECTION_ID);
- if (NumUsrs)
- {
- if (Usr_GetIfShowBigList (NumUsrs,
- Sco_PutParamCurrentScope,&Gbl.Scope.Current,
- NULL))
- {
- /***** Form to select type of list of users *****/
- Usr_ShowFormsToSelectUsrListType (Sco_PutParamCurrentScope,&Gbl.Scope.Current);
+ if (NumUsrs)
+ {
+ if (Usr_GetIfShowBigList (NumUsrs,
+ Sco_PutParamCurrentScope,&Gbl.Scope.Current,
+ NULL))
+ {
+ /***** Form to select type of list of users *****/
+ Usr_ShowFormsToSelectUsrListType (Sco_PutParamCurrentScope,&Gbl.Scope.Current);
- /***** Draw a class photo with teachers of the course *****/
- if (Gbl.Usrs.Me.ListType == Usr_LIST_AS_CLASS_PHOTO)
- Lay_WriteHeaderClassPhoto (false,true,
- (Gbl.Scope.Current == HieLvl_CRS ||
- Gbl.Scope.Current == HieLvl_DEG ||
- Gbl.Scope.Current == HieLvl_CTR ||
- Gbl.Scope.Current == HieLvl_INS) ? Gbl.Hierarchy.Ins.InsCod :
- -1L,
- (Gbl.Scope.Current == HieLvl_CRS ||
- Gbl.Scope.Current == HieLvl_DEG) ? Gbl.Hierarchy.Deg.DegCod :
- -1L,
- Gbl.Scope.Current == HieLvl_CRS ? Gbl.Hierarchy.Crs.CrsCod :
- -1L);
+ /***** Draw a class photo with teachers of the course *****/
+ if (Gbl.Usrs.Me.ListType == Usr_LIST_AS_CLASS_PHOTO)
+ Lay_WriteHeaderClassPhoto (false,true,
+ (Gbl.Scope.Current == HieLvl_CRS ||
+ Gbl.Scope.Current == HieLvl_DEG ||
+ Gbl.Scope.Current == HieLvl_CTR ||
+ Gbl.Scope.Current == HieLvl_INS) ? Gbl.Hierarchy.Ins.InsCod :
+ -1L,
+ (Gbl.Scope.Current == HieLvl_CRS ||
+ Gbl.Scope.Current == HieLvl_DEG) ? Gbl.Hierarchy.Deg.DegCod :
+ -1L,
+ Gbl.Scope.Current == HieLvl_CRS ? Gbl.Hierarchy.Crs.CrsCod :
+ -1L);
- /* Set options allowed */
- PutForm = Usr_SetOptionsListUsrsAllowed (Rol_TCH,ICanChooseOption);
+ /* Set options allowed */
+ PutForm = Usr_SetOptionsListUsrsAllowed (Rol_TCH,ICanChooseOption);
- /* Begin form */
- if (PutForm)
- {
- Frm_BeginForm (ActDoActOnSevTch);
- Grp_PutParamsCodGrps ();
- }
+ /* Begin form */
+ if (PutForm)
+ {
+ Frm_BeginForm (ActDoActOnSevTch);
+ Grp_PutParamsCodGrps ();
+ }
- /* Begin table */
- HTM_TABLE_BeginWide ();
+ /* Begin table */
+ HTM_TABLE_BeginWide ();
- /***** Draw the classphoto/list *****/
- switch (Gbl.Usrs.Me.ListType)
- {
- case Usr_LIST_AS_CLASS_PHOTO:
- /* List teachers and non-editing teachers */
- Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
- Rol_TCH,&Gbl.Usrs.Selected,
- PutForm); // Put checkbox to select users?
- Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
- Rol_NET,&Gbl.Usrs.Selected,
- PutForm); // Put checkbox to select users?
- break;
- case Usr_LIST_AS_LISTING:
- /* Initialize field names */
- Usr_SetUsrDatMainFieldNames ();
+ /***** Draw the classphoto/list *****/
+ switch (Gbl.Usrs.Me.ListType)
+ {
+ case Usr_LIST_AS_CLASS_PHOTO:
+ /* List teachers and non-editing teachers */
+ Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
+ Rol_TCH,&Gbl.Usrs.Selected,
+ PutForm); // Put checkbox to select users?
+ Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
+ Rol_NET,&Gbl.Usrs.Selected,
+ PutForm); // Put checkbox to select users?
+ break;
+ case Usr_LIST_AS_LISTING:
+ /* Initialize field names */
+ Usr_SetUsrDatMainFieldNames ();
- /* List teachers and non-editing teachers */
- Usr_ListMainDataTchs (Rol_TCH,
- PutForm); // Put checkbox to select users?
- Usr_ListMainDataTchs (Rol_NET,
- PutForm); // Put checkbox to select users?
- break;
- default:
- break;
- }
+ /* List teachers and non-editing teachers */
+ Usr_ListMainDataTchs (Rol_TCH,
+ PutForm); // Put checkbox to select users?
+ Usr_ListMainDataTchs (Rol_NET,
+ PutForm); // Put checkbox to select users?
+ break;
+ default:
+ break;
+ }
- /* End table */
- HTM_TABLE_End ();
+ /* End table */
+ HTM_TABLE_End ();
- /***** Which action, show records, follow...? *****/
- if (PutForm)
- {
- Usr_PutOptionsListUsrs (ICanChooseOption);
- Frm_EndForm ();
- }
- }
- }
- else // NumUsrs == 0
- /***** Show warning indicating no teachers found *****/
- Usr_ShowWarningNoUsersFound (Rol_TCH);
+ /***** Which action, show records, follow...? *****/
+ if (PutForm)
+ {
+ Usr_PutOptionsListUsrs (ICanChooseOption);
+ Frm_EndForm ();
+ }
+ }
+ }
+ else // NumUsrs == 0
+ /***** Show warning indicating no teachers found *****/
+ Usr_ShowWarningNoUsersFound (Rol_TCH);
- /***** End section with user list *****/
- HTM_SECTION_End ();
+ /***** End section with user list *****/
+ HTM_SECTION_End ();
/***** End box *****/
Box_BoxEnd ();
@@ -8769,13 +8772,13 @@ static void Usr_ShowOneListUsrsOption (Usr_ListUsrsOption_t ListUsrsAction,
const char *Label)
{
HTM_LI_Begin (NULL);
- HTM_LABEL_Begin (NULL);
- HTM_INPUT_RADIO ("ListUsrsAction",false,
- "value=\"%u\"%s",
- (unsigned) ListUsrsAction,
- ListUsrsAction == Gbl.Usrs.Selected.Option ? " checked=\"checked\"" : "");
- HTM_Txt (Label);
- HTM_LABEL_End ();
+ HTM_LABEL_Begin (NULL);
+ HTM_INPUT_RADIO ("ListUsrsAction",false,
+ "value=\"%u\"%s",
+ (unsigned) ListUsrsAction,
+ ListUsrsAction == Gbl.Usrs.Selected.Option ? " checked=\"checked\"" : "");
+ HTM_Txt (Label);
+ HTM_LABEL_End ();
HTM_LI_End ();
}
@@ -9114,8 +9117,8 @@ void Usr_SeeGstClassPhotoPrn (void)
-1L,
-1L,-1L);
HTM_TABLE_BeginWide ();
- Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,
- Rol_GST,&Gbl.Usrs.Selected,false);
+ Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,
+ Rol_GST,&Gbl.Usrs.Selected,false);
HTM_TABLE_End ();
}
else // Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs
@@ -9162,8 +9165,8 @@ void Usr_SeeStdClassPhotoPrn (void)
Gbl.Scope.Current == HieLvl_CRS ? Gbl.Hierarchy.Crs.CrsCod :
-1L);
HTM_TABLE_BeginWide ();
- Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,
- Rol_STD,&Gbl.Usrs.Selected,false);
+ Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,
+ Rol_STD,&Gbl.Usrs.Selected,false);
HTM_TABLE_End ();
}
else // Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs == 0
@@ -9236,11 +9239,11 @@ void Usr_SeeTchClassPhotoPrn (void)
-1L);
HTM_TABLE_BeginWide ();
- /* List teachers and non-editing teachers */
- Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,
- Rol_TCH,&Gbl.Usrs.Selected,false);
- Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,
- Rol_NET,&Gbl.Usrs.Selected,false);
+ /* List teachers and non-editing teachers */
+ Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,
+ Rol_TCH,&Gbl.Usrs.Selected,false);
+ Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,
+ Rol_NET,&Gbl.Usrs.Selected,false);
HTM_TABLE_End ();
}
@@ -9423,7 +9426,7 @@ void Usr_ConstructPathUsr (long UsrCod,char PathUsr[PATH_MAX + 1 + Cns_MAX_DECIM
/************** Check if a user exists with a given user's code **************/
/*****************************************************************************/
-bool Usr_ChkIfUsrCodExists (long UsrCod)
+bool Usr_DB_ChkIfUsrCodExists (long UsrCod)
{
/***** Trivial check: user's code should be > 0 *****/
if (UsrCod <= 0) // Wrong user's code
@@ -10199,13 +10202,13 @@ void Usr_PrintUsrQRCode (void)
NULL,NULL,
NULL,Box_NOT_CLOSABLE);
- /***** Show QR code *****/
- if (Gbl.Usrs.Other.UsrDat.Nickname[0])
- {
- snprintf (NewNickWithArr,sizeof (NewNickWithArr),"@%s",
- Gbl.Usrs.Other.UsrDat.Nickname);
- QR_ImageQRCode (NewNickWithArr);
- }
+ /***** Show QR code *****/
+ if (Gbl.Usrs.Other.UsrDat.Nickname[0])
+ {
+ snprintf (NewNickWithArr,sizeof (NewNickWithArr),"@%s",
+ Gbl.Usrs.Other.UsrDat.Nickname);
+ QR_ImageQRCode (NewNickWithArr);
+ }
/***** End box *****/
Box_BoxEnd ();
@@ -10242,7 +10245,7 @@ void Usr_WriteAuthor1Line (long UsrCod,bool Hidden)
/***** Write name *****/
HTM_DIV_Begin ("class=\"AUTHOR_1_LINE %s\"",Hidden ? "AUTHOR_TXT_LIGHT" :
"AUTHOR_TXT");
- HTM_Txt (UsrDat.FullName);
+ HTM_Txt (UsrDat.FullName);
HTM_DIV_End ();
/***** Free memory used for user's data *****/
diff --git a/swad_user.h b/swad_user.h
index 0aa08ae0..85891811 100644
--- a/swad_user.h
+++ b/swad_user.h
@@ -305,17 +305,17 @@ void Usr_WriteFirstNameBRSurnames (const struct UsrData *UsrDat);
void Usr_FlushCachesUsr (void);
-bool Usr_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Scope,long Cod);
+bool Usr_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Scope,long Cod);
void Usr_FlushCacheUsrIsSuperuser (void);
bool Usr_CheckIfUsrIsSuperuser (long UsrCod);
bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat);
bool Usr_ICanEditOtherUsr (const struct UsrData *UsrDat);
-unsigned Usr_GetNumCrssOfUsr (long UsrCod);
-unsigned Usr_GetNumCrssOfUsrNotAccepted (long UsrCod);
-unsigned Usr_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role);
-unsigned Usr_GetNumCrssOfUsrWithARoleNotAccepted (long UsrCod,Rol_Role_t Role);
+unsigned Usr_DB_GetNumCrssOfUsr (long UsrCod);
+unsigned Usr_DB_GetNumCrssOfUsrNotAccepted (long UsrCod);
+unsigned Usr_DB_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role);
+unsigned Usr_DB_GetNumCrssOfUsrWithARoleNotAccepted (long UsrCod,Rol_Role_t Role);
unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
unsigned OthersRoles);
@@ -364,7 +364,7 @@ bool Usr_CheckIfIBelongToCtr (long CtrCod);
bool Usr_CheckIfIBelongToDeg (long DegCod);
bool Usr_CheckIfIBelongToCrs (long CrsCod);
-unsigned Usr_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res);
+unsigned Usr_DB_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res);
unsigned Usr_GetInssFromUsr (long UsrCod,long CtyCod,MYSQL_RES **mysql_res);
unsigned Usr_GetCtrsFromUsr (long UsrCod,long InsCod,MYSQL_RES **mysql_res);
unsigned Usr_GetDegsFromUsr (long UsrCod,long CtrCod,MYSQL_RES **mysql_res);
@@ -373,7 +373,7 @@ void Usr_GetMainDeg (long UsrCod,
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1],
Rol_Role_t *MaxRole);
-bool Usr_ChkIfEncryptedUsrCodExists (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64]);
+bool Usr_DB_ChkIfEncryptedUsrCodExists (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64]);
void Usr_WriteLandingPage (void);
void Usr_WriteFormLogout (void);
@@ -417,10 +417,10 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
bool PutCheckBoxToSelectUsr,Rol_Role_t Role,
struct SelectedUsrs *SelectedUsrs);
-long Usr_GetRamdomStdFromCrs (long CrsCod);
-long Usr_GetRamdomStdFromGrp (long GrpCod);
+long Usr_DB_GetRamdomStdFromCrs (long CrsCod);
+long Usr_DB_GetRamdomStdFromGrp (long GrpCod);
-unsigned Usr_GetNumTchsCurrentInsInDepartment (long DptCod);
+unsigned Usr_DB_GetNumTchsCurrentInsInDepartment (long DptCod);
void Usr_FlushCacheNumUsrsWhoDontClaimToBelongToAnyCty (void);
unsigned Usr_GetNumUsrsWhoDontClaimToBelongToAnyCty (void);
@@ -527,7 +527,7 @@ void Usr_SeeTchClassPhotoPrn (void);
void Usr_PutSelectorNumColsClassPhoto (void);
void Usr_ConstructPathUsr (long UsrCod,char PathUsr[PATH_MAX + 1 + Cns_MAX_DECIMAL_DIGITS_LONG + 1]);
-bool Usr_ChkIfUsrCodExists (long UsrCod);
+bool Usr_DB_ChkIfUsrCodExists (long UsrCod);
void Usr_ShowWarningNoUsersFound (Rol_Role_t Role);