mirror of https://github.com/acanas/swad-core.git
Version 20.93: Jun 17, 2021 Code refactoring.
This commit is contained in:
parent
59a34f37fe
commit
3c7089216b
|
@ -2169,7 +2169,7 @@ int swad__getGroups (struct soap *soap,
|
||||||
(int) MaxStudents;
|
(int) MaxStudents;
|
||||||
|
|
||||||
/* Get number of current students */
|
/* Get number of current students */
|
||||||
getGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_CountNumUsrsInGrp (Rol_STD,GrpCod);
|
getGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_DB_CountNumUsrsInGrp (Rol_STD,GrpCod);
|
||||||
|
|
||||||
/* Get whether group is open ('Y') or closed ('N') (row[5]) */
|
/* Get whether group is open ('Y') or closed ('N') (row[5]) */
|
||||||
getGroupsOut->groupsArray.__ptr[NumRow].open = (row[5][0] == 'Y') ? 1 :
|
getGroupsOut->groupsArray.__ptr[NumRow].open = (row[5][0] == 'Y') ? 1 :
|
||||||
|
@ -2343,7 +2343,7 @@ int swad__sendMyGroups (struct soap *soap,
|
||||||
(int) MaxStudents;
|
(int) MaxStudents;
|
||||||
|
|
||||||
/* Get number of current students */
|
/* Get number of current students */
|
||||||
SendMyGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_CountNumUsrsInGrp (Rol_STD,GrpCod);
|
SendMyGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_DB_CountNumUsrsInGrp (Rol_STD,GrpCod);
|
||||||
|
|
||||||
/* Get whether group is open ('Y') or closed ('N') (row[5]) */
|
/* Get whether group is open ('Y') or closed ('N') (row[5]) */
|
||||||
SendMyGroupsOut->groupsArray.__ptr[NumRow].open = (row[5][0] == 'Y') ? 1 :
|
SendMyGroupsOut->groupsArray.__ptr[NumRow].open = (row[5][0] == 'Y') ? 1 :
|
||||||
|
@ -2846,7 +2846,7 @@ static void API_GetLstGrpsSel (const char *Groups)
|
||||||
{
|
{
|
||||||
Str_GetNextStringUntilComma (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
|
Str_GetNextStringUntilComma (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
|
||||||
Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp] = Str_ConvertStrCodToLongCod (LongStr);
|
Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp] = Str_ConvertStrCodToLongCod (LongStr);
|
||||||
if (Grp_CheckIfGroupBelongsToCourse (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp],Gbl.Hierarchy.Crs.CrsCod))
|
if (Grp_DB_CheckIfGrpBelongsToCrs (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp],Gbl.Hierarchy.Crs.CrsCod))
|
||||||
NumGrp++;
|
NumGrp++;
|
||||||
}
|
}
|
||||||
Gbl.Crs.Grps.LstGrpsSel.NumGrps = NumGrp; // Update number of groups
|
Gbl.Crs.Grps.LstGrpsSel.NumGrps = NumGrp; // Update number of groups
|
||||||
|
@ -2902,7 +2902,7 @@ int swad__getAttendanceUsers (struct soap *soap,
|
||||||
"Requester must be a teacher");
|
"Requester must be a teacher");
|
||||||
|
|
||||||
/***** Query list of attendance users *****/
|
/***** Query list of attendance users *****/
|
||||||
if (Grp_CheckIfAssociatedToGrps ("att_groups","AttCod",Event.AttCod))
|
if (Grp_DB_CheckIfAssociatedToGrps ("att_groups","AttCod",Event.AttCod))
|
||||||
// Event for one or more groups
|
// Event for one or more groups
|
||||||
// Subquery: list of users in groups of this attendance event...
|
// Subquery: list of users in groups of this attendance event...
|
||||||
// ...who have no entry in attendance list of users
|
// ...who have no entry in attendance list of users
|
||||||
|
|
|
@ -1264,7 +1264,7 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod)
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Grp_CheckIfAssociatedToGrps ("asg_groups","AsgCod",AsgCod) ? "" :
|
Grp_DB_CheckIfAssociatedToGrps ("asg_groups","AsgCod",AsgCod) ? "" :
|
||||||
" checked=\"checked\"");
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
|
|
|
@ -1157,7 +1157,7 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod)
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Grp_CheckIfAssociatedToGrps ("att_groups","AttCod",AttCod) ? "" :
|
Grp_DB_CheckIfAssociatedToGrps ("att_groups","AttCod",AttCod) ? "" :
|
||||||
" checked=\"checked\"");
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
|
|
|
@ -602,14 +602,15 @@ 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.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.92 (2021-06-11)"
|
#define Log_PLATFORM_VERSION "SWAD 20.93 (2021-06-17)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.69.1.js"
|
#define JS_FILE "swad20.69.1.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
Version 20.92: Jun 09, 2021 New modules swad_admin and swad_admin_database for administrators. (313381 lines)
|
Version 20.93: Jun 17, 2021 Code refactoring. (313382 lines)
|
||||||
|
Version 20.92: Jun 11, 2021 New modules swad_admin and swad_admin_database for administrators. (313381 lines)
|
||||||
Version 20.91.3: Jun 11, 2021 Queries moved to module swad_enrolment_database. (313173 lines)
|
Version 20.91.3: Jun 11, 2021 Queries moved to module swad_enrolment_database. (313173 lines)
|
||||||
Version 20.91.2: Jun 11, 2021 Queries moved to module swad_enrolment_database. (313143 lines)
|
Version 20.91.2: Jun 11, 2021 Queries moved to module swad_enrolment_database. (313143 lines)
|
||||||
Version 20.91.1: Jun 10, 2021 Queries moved to module swad_enrolment_database. (313145 lines)
|
Version 20.91.1: Jun 10, 2021 Queries moved to module swad_enrolment_database. (313145 lines)
|
||||||
|
|
496
swad_exam.c
496
swad_exam.c
|
@ -139,7 +139,7 @@ static void Exa_RemoveExamFromAllTables (long ExaCod);
|
||||||
static void Exa_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod);
|
static void Exa_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod);
|
||||||
static void Exa_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod);
|
static void Exa_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod);
|
||||||
|
|
||||||
static bool Exa_CheckIfSimilarExamExists (const struct Exa_Exam *Exam);
|
static bool Exa_DB_CheckIfSimilarExamExists (const struct Exa_Exam *Exam);
|
||||||
|
|
||||||
static void Exa_ReceiveExamFieldsFromForm (struct Exa_Exam *Exam,
|
static void Exa_ReceiveExamFieldsFromForm (struct Exa_Exam *Exam,
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||||
|
@ -243,73 +243,73 @@ static void Exa_ListAllExams (struct Exa_Exams *Exams)
|
||||||
Exa_PutIconsListExams,Exams,
|
Exa_PutIconsListExams,Exams,
|
||||||
Hlp_ASSESSMENT_Exams,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Exams,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Write links to pages *****/
|
/***** Write links to pages *****/
|
||||||
Pag_WriteLinksToPagesCentered (Pag_EXAMS,&Pagination,
|
Pag_WriteLinksToPagesCentered (Pag_EXAMS,&Pagination,
|
||||||
Exams,-1L);
|
Exams,-1L);
|
||||||
|
|
||||||
if (Exams->Num)
|
if (Exams->Num)
|
||||||
{
|
{
|
||||||
/***** Table head *****/
|
/***** Table head *****/
|
||||||
HTM_TABLE_BeginWideMarginPadding (5);
|
HTM_TABLE_BeginWideMarginPadding (5);
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
if (Exa_CheckIfICanEditExams ())
|
||||||
|
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
||||||
|
|
||||||
|
for (Order = (Exa_Order_t) 0;
|
||||||
|
Order <= (Exa_Order_t) (Exa_NUM_ORDERS - 1);
|
||||||
|
Order++)
|
||||||
|
{
|
||||||
|
HTM_TH_Begin (1,1,"LM");
|
||||||
|
|
||||||
|
/* Form to change order */
|
||||||
|
Frm_BeginForm (ActSeeAllExa);
|
||||||
|
Pag_PutHiddenParamPagNum (Pag_EXAMS,Exams->CurrentPage);
|
||||||
|
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order);
|
||||||
|
HTM_BUTTON_SUBMIT_Begin (Txt_EXAMS_ORDER_HELP[Order],"BT_LINK TIT_TBL",NULL);
|
||||||
|
if (Order == Exams->SelectedOrder)
|
||||||
|
HTM_U_Begin ();
|
||||||
|
HTM_Txt (Txt_EXAMS_ORDER[Order]);
|
||||||
|
if (Order == Exams->SelectedOrder)
|
||||||
|
HTM_U_End ();
|
||||||
|
HTM_BUTTON_End ();
|
||||||
|
Frm_EndForm ();
|
||||||
|
|
||||||
|
HTM_TH_End ();
|
||||||
|
}
|
||||||
|
|
||||||
|
HTM_TH (1,1,"RM",Txt_Sessions);
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Write all exams *****/
|
||||||
|
for (NumExam = Pagination.FirstItemVisible;
|
||||||
|
NumExam <= Pagination.LastItemVisible;
|
||||||
|
NumExam++)
|
||||||
|
{
|
||||||
|
/* Get data of this exam */
|
||||||
|
Exam.ExaCod = Exams->Lst[NumExam - 1].ExaCod;
|
||||||
|
Exa_GetDataOfExamByCod (&Exam);
|
||||||
|
Exams->ExaCod = Exam.ExaCod;
|
||||||
|
|
||||||
|
/* Show exam */
|
||||||
|
Exa_ShowOneExam (Exams,
|
||||||
|
&Exam,
|
||||||
|
false); // Do not show only this exam
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** End table *****/
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
}
|
||||||
|
else // No exams created
|
||||||
|
Ale_ShowAlert (Ale_INFO,Txt_No_exams);
|
||||||
|
|
||||||
|
/***** Write again links to pages *****/
|
||||||
|
Pag_WriteLinksToPagesCentered (Pag_EXAMS,&Pagination,
|
||||||
|
Exams,-1L);
|
||||||
|
|
||||||
|
/***** Button to create a new exam *****/
|
||||||
if (Exa_CheckIfICanEditExams ())
|
if (Exa_CheckIfICanEditExams ())
|
||||||
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
Exa_PutButtonToCreateNewExam (Exams);
|
||||||
|
|
||||||
for (Order = (Exa_Order_t) 0;
|
|
||||||
Order <= (Exa_Order_t) (Exa_NUM_ORDERS - 1);
|
|
||||||
Order++)
|
|
||||||
{
|
|
||||||
HTM_TH_Begin (1,1,"LM");
|
|
||||||
|
|
||||||
/* Form to change order */
|
|
||||||
Frm_BeginForm (ActSeeAllExa);
|
|
||||||
Pag_PutHiddenParamPagNum (Pag_EXAMS,Exams->CurrentPage);
|
|
||||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order);
|
|
||||||
HTM_BUTTON_SUBMIT_Begin (Txt_EXAMS_ORDER_HELP[Order],"BT_LINK TIT_TBL",NULL);
|
|
||||||
if (Order == Exams->SelectedOrder)
|
|
||||||
HTM_U_Begin ();
|
|
||||||
HTM_Txt (Txt_EXAMS_ORDER[Order]);
|
|
||||||
if (Order == Exams->SelectedOrder)
|
|
||||||
HTM_U_End ();
|
|
||||||
HTM_BUTTON_End ();
|
|
||||||
Frm_EndForm ();
|
|
||||||
|
|
||||||
HTM_TH_End ();
|
|
||||||
}
|
|
||||||
|
|
||||||
HTM_TH (1,1,"RM",Txt_Sessions);
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** Write all exams *****/
|
|
||||||
for (NumExam = Pagination.FirstItemVisible;
|
|
||||||
NumExam <= Pagination.LastItemVisible;
|
|
||||||
NumExam++)
|
|
||||||
{
|
|
||||||
/* Get data of this exam */
|
|
||||||
Exam.ExaCod = Exams->Lst[NumExam - 1].ExaCod;
|
|
||||||
Exa_GetDataOfExamByCod (&Exam);
|
|
||||||
Exams->ExaCod = Exam.ExaCod;
|
|
||||||
|
|
||||||
/* Show exam */
|
|
||||||
Exa_ShowOneExam (Exams,
|
|
||||||
&Exam,
|
|
||||||
false); // Do not show only this exam
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** End table *****/
|
|
||||||
HTM_TABLE_End ();
|
|
||||||
}
|
|
||||||
else // No exams created
|
|
||||||
Ale_ShowAlert (Ale_INFO,Txt_No_exams);
|
|
||||||
|
|
||||||
/***** Write again links to pages *****/
|
|
||||||
Pag_WriteLinksToPagesCentered (Pag_EXAMS,&Pagination,
|
|
||||||
Exams,-1L);
|
|
||||||
|
|
||||||
/***** Button to create a new exam *****/
|
|
||||||
if (Exa_CheckIfICanEditExams ())
|
|
||||||
Exa_PutButtonToCreateNewExam (Exams);
|
|
||||||
|
|
||||||
/***** End box *****/
|
/***** End box *****/
|
||||||
Box_BoxEnd ();
|
Box_BoxEnd ();
|
||||||
|
@ -392,7 +392,7 @@ static void Exa_PutButtonToCreateNewExam (struct Exa_Exams *Exams)
|
||||||
|
|
||||||
Frm_BeginForm (ActFrmNewExa);
|
Frm_BeginForm (ActFrmNewExa);
|
||||||
Exa_PutParamsToCreateNewExam (Exams);
|
Exa_PutParamsToCreateNewExam (Exams);
|
||||||
Btn_PutConfirmButton (Txt_New_exam);
|
Btn_PutConfirmButton (Txt_New_exam);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,99 +506,99 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
||||||
/***** Start first row of this exam *****/
|
/***** Start first row of this exam *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/***** Icons related to this exam *****/
|
/***** Icons related to this exam *****/
|
||||||
if (Exa_CheckIfICanEditExams ())
|
if (Exa_CheckIfICanEditExams ())
|
||||||
{
|
{
|
||||||
if (ShowOnlyThisExam)
|
if (ShowOnlyThisExam)
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL\"");
|
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
/* Icons to remove/edit this exam */
|
/* Icons to remove/edit this exam */
|
||||||
Exa_PutIconsToRemEditOneExam (Exams,Exam,Anchor);
|
Exa_PutIconsToRemEditOneExam (Exams,Exam,Anchor);
|
||||||
|
|
||||||
|
HTM_TD_End ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Start/end date/time *****/
|
||||||
|
UniqueId++;
|
||||||
|
for (StartEndTime = (Dat_StartEndTime_t) 0;
|
||||||
|
StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1);
|
||||||
|
StartEndTime++)
|
||||||
|
{
|
||||||
|
if (asprintf (&Id,"exa_date_%u_%u",(unsigned) StartEndTime,UniqueId) < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
Color = Exam->NumOpenSess ? (Exam->Hidden ? "DATE_GREEN_LIGHT":
|
||||||
|
"DATE_GREEN") :
|
||||||
|
(Exam->Hidden ? "DATE_RED_LIGHT":
|
||||||
|
"DATE_RED");
|
||||||
|
if (ShowOnlyThisExam)
|
||||||
|
HTM_TD_Begin ("id=\"%s\" class=\"%s LT\"",
|
||||||
|
Id,Color);
|
||||||
|
else
|
||||||
|
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
||||||
|
Id,Color,Gbl.RowEvenOdd);
|
||||||
|
if (Exam->TimeUTC[Dat_START_TIME])
|
||||||
|
Dat_WriteLocalDateHMSFromUTC (Id,Exam->TimeUTC[StartEndTime],
|
||||||
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||||
|
true,true,true,0x6);
|
||||||
|
HTM_TD_End ();
|
||||||
|
free (Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Exam title and main data *****/
|
||||||
|
if (ShowOnlyThisExam)
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
else
|
||||||
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
|
/* Exam title */
|
||||||
|
Exams->ExaCod = Exam->ExaCod;
|
||||||
|
HTM_ARTICLE_Begin (Anchor);
|
||||||
|
Frm_BeginForm (ActSeeExa);
|
||||||
|
Exa_PutParams (Exams);
|
||||||
|
HTM_BUTTON_SUBMIT_Begin (Txt_View_exam,
|
||||||
|
Exam->Hidden ? "BT_LINK LT ASG_TITLE_LIGHT":
|
||||||
|
"BT_LINK LT ASG_TITLE",
|
||||||
|
NULL);
|
||||||
|
HTM_Txt (Exam->Title);
|
||||||
|
HTM_BUTTON_End ();
|
||||||
|
Frm_EndForm ();
|
||||||
|
HTM_ARTICLE_End ();
|
||||||
|
|
||||||
|
/* Number of questions, maximum grade, visibility of results */
|
||||||
|
HTM_DIV_Begin ("class=\"%s\"",Exam->Hidden ? "ASG_GRP_LIGHT" :
|
||||||
|
"ASG_GRP");
|
||||||
|
HTM_TxtColonNBSP (Txt_Sets_of_questions);
|
||||||
|
HTM_Unsigned (Exam->NumSets);
|
||||||
|
HTM_BR ();
|
||||||
|
HTM_TxtColonNBSP (Txt_Maximum_grade);
|
||||||
|
HTM_Double (Exam->MaxGrade);
|
||||||
|
HTM_BR ();
|
||||||
|
HTM_TxtColonNBSP (Txt_Result_visibility);
|
||||||
|
TstVis_ShowVisibilityIcons (Exam->Visibility,Exam->Hidden);
|
||||||
|
HTM_DIV_End ();
|
||||||
|
|
||||||
|
/***** Number of sessions in exam *****/
|
||||||
|
if (ShowOnlyThisExam)
|
||||||
|
HTM_TD_Begin ("class=\"RT\"");
|
||||||
|
else
|
||||||
|
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
|
Exams->ExaCod = Exam->ExaCod;
|
||||||
|
Frm_BeginForm (ActSeeExa);
|
||||||
|
Exa_PutParams (Exams);
|
||||||
|
HTM_BUTTON_SUBMIT_Begin (Txt_Sessions,
|
||||||
|
Exam->Hidden ? "BT_LINK LT ASG_TITLE_LIGHT" :
|
||||||
|
"BT_LINK LT ASG_TITLE",
|
||||||
|
NULL);
|
||||||
|
if (ShowOnlyThisExam)
|
||||||
|
HTM_TxtColonNBSP (Txt_Sessions);
|
||||||
|
HTM_Unsigned (Exam->NumSess);
|
||||||
|
HTM_BUTTON_End ();
|
||||||
|
Frm_EndForm ();
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
}
|
|
||||||
|
|
||||||
/***** Start/end date/time *****/
|
|
||||||
UniqueId++;
|
|
||||||
for (StartEndTime = (Dat_StartEndTime_t) 0;
|
|
||||||
StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1);
|
|
||||||
StartEndTime++)
|
|
||||||
{
|
|
||||||
if (asprintf (&Id,"exa_date_%u_%u",(unsigned) StartEndTime,UniqueId) < 0)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
Color = Exam->NumOpenSess ? (Exam->Hidden ? "DATE_GREEN_LIGHT":
|
|
||||||
"DATE_GREEN") :
|
|
||||||
(Exam->Hidden ? "DATE_RED_LIGHT":
|
|
||||||
"DATE_RED");
|
|
||||||
if (ShowOnlyThisExam)
|
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT\"",
|
|
||||||
Id,Color);
|
|
||||||
else
|
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
|
||||||
Id,Color,Gbl.RowEvenOdd);
|
|
||||||
if (Exam->TimeUTC[Dat_START_TIME])
|
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Exam->TimeUTC[StartEndTime],
|
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
|
||||||
true,true,true,0x6);
|
|
||||||
HTM_TD_End ();
|
|
||||||
free (Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Exam title and main data *****/
|
|
||||||
if (ShowOnlyThisExam)
|
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
|
||||||
else
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
|
|
||||||
/* Exam title */
|
|
||||||
Exams->ExaCod = Exam->ExaCod;
|
|
||||||
HTM_ARTICLE_Begin (Anchor);
|
|
||||||
Frm_BeginForm (ActSeeExa);
|
|
||||||
Exa_PutParams (Exams);
|
|
||||||
HTM_BUTTON_SUBMIT_Begin (Txt_View_exam,
|
|
||||||
Exam->Hidden ? "BT_LINK LT ASG_TITLE_LIGHT":
|
|
||||||
"BT_LINK LT ASG_TITLE",
|
|
||||||
NULL);
|
|
||||||
HTM_Txt (Exam->Title);
|
|
||||||
HTM_BUTTON_End ();
|
|
||||||
Frm_EndForm ();
|
|
||||||
HTM_ARTICLE_End ();
|
|
||||||
|
|
||||||
/* Number of questions, maximum grade, visibility of results */
|
|
||||||
HTM_DIV_Begin ("class=\"%s\"",Exam->Hidden ? "ASG_GRP_LIGHT" :
|
|
||||||
"ASG_GRP");
|
|
||||||
HTM_TxtColonNBSP (Txt_Sets_of_questions);
|
|
||||||
HTM_Unsigned (Exam->NumSets);
|
|
||||||
HTM_BR ();
|
|
||||||
HTM_TxtColonNBSP (Txt_Maximum_grade);
|
|
||||||
HTM_Double (Exam->MaxGrade);
|
|
||||||
HTM_BR ();
|
|
||||||
HTM_TxtColonNBSP (Txt_Result_visibility);
|
|
||||||
TstVis_ShowVisibilityIcons (Exam->Visibility,Exam->Hidden);
|
|
||||||
HTM_DIV_End ();
|
|
||||||
|
|
||||||
/***** Number of sessions in exam *****/
|
|
||||||
if (ShowOnlyThisExam)
|
|
||||||
HTM_TD_Begin ("class=\"RT\"");
|
|
||||||
else
|
|
||||||
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
|
|
||||||
Exams->ExaCod = Exam->ExaCod;
|
|
||||||
Frm_BeginForm (ActSeeExa);
|
|
||||||
Exa_PutParams (Exams);
|
|
||||||
HTM_BUTTON_SUBMIT_Begin (Txt_Sessions,
|
|
||||||
Exam->Hidden ? "BT_LINK LT ASG_TITLE_LIGHT" :
|
|
||||||
"BT_LINK LT ASG_TITLE",
|
|
||||||
NULL);
|
|
||||||
if (ShowOnlyThisExam)
|
|
||||||
HTM_TxtColonNBSP (Txt_Sessions);
|
|
||||||
HTM_Unsigned (Exam->NumSess);
|
|
||||||
HTM_BUTTON_End ();
|
|
||||||
Frm_EndForm ();
|
|
||||||
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** End 1st row of this exam *****/
|
/***** End 1st row of this exam *****/
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -606,28 +606,28 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
||||||
/***** Start 2nd row of this exam *****/
|
/***** Start 2nd row of this exam *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/***** Author of the exam *****/
|
/***** Author of the exam *****/
|
||||||
if (ShowOnlyThisExam)
|
if (ShowOnlyThisExam)
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
Exa_WriteAuthor (Exam);
|
Exa_WriteAuthor (Exam);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Text of the exam *****/
|
/***** Text of the exam *****/
|
||||||
if (ShowOnlyThisExam)
|
if (ShowOnlyThisExam)
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
Exa_GetExamTxtFromDB (Exam->ExaCod,Txt);
|
Exa_DB_GetExamTxt (Exam->ExaCod,Txt);
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
||||||
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||||
HTM_DIV_Begin ("class=\"PAR %s\"",Exam->Hidden ? "DAT_LIGHT" :
|
HTM_DIV_Begin ("class=\"PAR %s\"",Exam->Hidden ? "DAT_LIGHT" :
|
||||||
"DAT");
|
"DAT");
|
||||||
HTM_Txt (Txt);
|
HTM_Txt (Txt);
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** End 2nd row of this exam *****/
|
/***** End 2nd row of this exam *****/
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -994,10 +994,10 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam)
|
||||||
Str_Copy (Exam->Title,row[6],sizeof (Exam->Title) - 1);
|
Str_Copy (Exam->Title,row[6],sizeof (Exam->Title) - 1);
|
||||||
|
|
||||||
/* Get number of sets */
|
/* Get number of sets */
|
||||||
Exam->NumSets = ExaSet_GetNumSetsExam (Exam->ExaCod);
|
Exam->NumSets = Exa_DB_GetNumSetsExam (Exam->ExaCod);
|
||||||
|
|
||||||
/* Get number of questions */
|
/* Get number of questions */
|
||||||
Exam->NumQsts = ExaSet_GetNumQstsExam (Exam->ExaCod);
|
Exam->NumQsts = Exa_DB_GetNumQstsExam (Exam->ExaCod);
|
||||||
|
|
||||||
/* Get number of sessions */
|
/* Get number of sessions */
|
||||||
Exam->NumSess = ExaSes_GetNumSessionsInExam (Exam->ExaCod);
|
Exam->NumSess = ExaSes_GetNumSessionsInExam (Exam->ExaCod);
|
||||||
|
@ -1062,7 +1062,7 @@ void Exa_FreeListExams (struct Exa_Exams *Exams)
|
||||||
/********************** Get exam text from database **************************/
|
/********************** Get exam text from database **************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Exa_GetExamTxtFromDB (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1])
|
void Exa_DB_GetExamTxt (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1])
|
||||||
{
|
{
|
||||||
/***** Get text of exam from database *****/
|
/***** Get text of exam from database *****/
|
||||||
DB_QuerySELECTString (Txt,Cns_MAX_BYTES_TEXT,"can not get exam text",
|
DB_QuerySELECTString (Txt,Cns_MAX_BYTES_TEXT,"can not get exam text",
|
||||||
|
@ -1157,7 +1157,7 @@ void Exa_RemoveExam (void)
|
||||||
static void Exa_RemoveExamFromAllTables (long ExaCod)
|
static void Exa_RemoveExamFromAllTables (long ExaCod)
|
||||||
{
|
{
|
||||||
/***** Remove all sessions in this exam *****/
|
/***** Remove all sessions in this exam *****/
|
||||||
ExaSes_RemoveSessionsInExamFromAllTables (ExaCod);
|
Exa_DB_RemoveSessionsInExamFromAllTables (ExaCod);
|
||||||
|
|
||||||
/***** Remove exam questions *****/
|
/***** Remove exam questions *****/
|
||||||
DB_QueryDELETE ("can not remove exam questions",
|
DB_QueryDELETE ("can not remove exam questions",
|
||||||
|
@ -1191,7 +1191,7 @@ void Exa_RemoveCrsExams (long CrsCod)
|
||||||
ExaPrn_RemoveCrsPrints (CrsCod);
|
ExaPrn_RemoveCrsPrints (CrsCod);
|
||||||
|
|
||||||
/***** Remove all sessions in the course *****/
|
/***** Remove all sessions in the course *****/
|
||||||
ExaSes_RemoveSessionInCourseFromAllTables (CrsCod);
|
Exa_DB_RemoveSessionInCourseFromAllTables (CrsCod);
|
||||||
|
|
||||||
/***** Remove media associated to test questions in the course *****/
|
/***** Remove media associated to test questions in the course *****/
|
||||||
Exa_RemoveAllMedFilesFromStemOfAllQstsInCrs (CrsCod);
|
Exa_RemoveAllMedFilesFromStemOfAllQstsInCrs (CrsCod);
|
||||||
|
@ -1375,7 +1375,7 @@ void Exa_UnhideExam (void)
|
||||||
/******************* Check if the title of an exam exists *******************/
|
/******************* Check if the title of an exam exists *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static bool Exa_CheckIfSimilarExamExists (const struct Exa_Exam *Exam)
|
static bool Exa_DB_CheckIfSimilarExamExists (const struct Exa_Exam *Exam)
|
||||||
{
|
{
|
||||||
/***** Get number of exams with a field value from database *****/
|
/***** Get number of exams with a field value from database *****/
|
||||||
return (DB_QueryCOUNT ("can not get similar exams",
|
return (DB_QueryCOUNT ("can not get similar exams",
|
||||||
|
@ -1444,7 +1444,7 @@ void Exa_PutFormsOneExam (struct Exa_Exams *Exams,
|
||||||
if (ItsANewExam)
|
if (ItsANewExam)
|
||||||
Txt[0] = '\0';
|
Txt[0] = '\0';
|
||||||
else
|
else
|
||||||
Exa_GetExamTxtFromDB (Exam->ExaCod,Txt);
|
Exa_DB_GetExamTxt (Exam->ExaCod,Txt);
|
||||||
|
|
||||||
/***** Put form to create/edit an exam *****/
|
/***** Put form to create/edit an exam *****/
|
||||||
Exa_PutFormEditionExam (Exams,Exam,Txt,ItsANewExam);
|
Exa_PutFormEditionExam (Exams,Exam,Txt,ItsANewExam);
|
||||||
|
@ -1485,82 +1485,82 @@ void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
||||||
ActChgExa);
|
ActChgExa);
|
||||||
Exa_PutParams (Exams);
|
Exa_PutParams (Exams);
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
/***** Begin box and table *****/
|
||||||
if (ItsANewExam)
|
if (ItsANewExam)
|
||||||
Box_BoxTableBegin (NULL,Txt_New_exam,
|
Box_BoxTableBegin (NULL,Txt_New_exam,
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
Hlp_ASSESSMENT_Exams_new_exam,Box_NOT_CLOSABLE,2);
|
Hlp_ASSESSMENT_Exams_new_exam,Box_NOT_CLOSABLE,2);
|
||||||
else
|
else
|
||||||
Box_BoxTableBegin (NULL,
|
Box_BoxTableBegin (NULL,
|
||||||
Exam->Title[0] ? Exam->Title :
|
Exam->Title[0] ? Exam->Title :
|
||||||
Txt_Edit_exam,
|
Txt_Edit_exam,
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
Hlp_ASSESSMENT_Exams_edit_exam,Box_NOT_CLOSABLE,2);
|
Hlp_ASSESSMENT_Exams_edit_exam,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
/***** Exam title *****/
|
/***** Exam title *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT","Title",Txt_Title);
|
Frm_LabelColumn ("RT","Title",Txt_Title);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
HTM_INPUT_TEXT ("Title",Exa_MAX_CHARS_TITLE,Exam->Title,
|
HTM_INPUT_TEXT ("Title",Exa_MAX_CHARS_TITLE,Exam->Title,
|
||||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"Title\" required=\"required\""
|
"id=\"Title\" required=\"required\""
|
||||||
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Maximum grade *****/
|
/***** Maximum grade *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||||
HTM_TxtColon (Txt_Maximum_grade);
|
HTM_TxtColon (Txt_Maximum_grade);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"LM\"");
|
HTM_TD_Begin ("class=\"LM\"");
|
||||||
HTM_INPUT_FLOAT ("MaxGrade",0.0,DBL_MAX,0.01,Exam->MaxGrade,false,
|
HTM_INPUT_FLOAT ("MaxGrade",0.0,DBL_MAX,0.01,Exam->MaxGrade,false,
|
||||||
"required=\"required\"");
|
"required=\"required\"");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Visibility of results *****/
|
/***** Visibility of results *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s RT\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
HTM_TD_Begin ("class=\"%s RT\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||||
HTM_TxtColon (Txt_Result_visibility);
|
HTM_TxtColon (Txt_Result_visibility);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"LB\"");
|
HTM_TD_Begin ("class=\"LB\"");
|
||||||
TstVis_PutVisibilityCheckboxes (Exam->Visibility);
|
TstVis_PutVisibilityCheckboxes (Exam->Visibility);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Exam text *****/
|
/***** Exam text *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT","Txt",Txt_Description);
|
Frm_LabelColumn ("RT","Txt",Txt_Description);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
HTM_TEXTAREA_Begin ("id=\"Txt\" name=\"Txt\" rows=\"5\""
|
HTM_TEXTAREA_Begin ("id=\"Txt\" name=\"Txt\" rows=\"5\""
|
||||||
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
||||||
HTM_Txt (Txt);
|
HTM_Txt (Txt);
|
||||||
HTM_TEXTAREA_End ();
|
HTM_TEXTAREA_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** End table, send button and end box *****/
|
/***** End table, send button and end box *****/
|
||||||
if (ItsANewExam)
|
if (ItsANewExam)
|
||||||
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_exam);
|
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_exam);
|
||||||
else
|
else
|
||||||
Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Save_changes);
|
Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Save_changes);
|
||||||
|
|
||||||
/***** End form *****/
|
/***** End form *****/
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
@ -1653,7 +1653,7 @@ static bool Exa_CheckExamFieldsReceivedFromForm (const struct Exa_Exam *Exam)
|
||||||
if (Exam->Title[0]) // If there's an exam title
|
if (Exam->Title[0]) // If there's an exam title
|
||||||
{
|
{
|
||||||
/* If title of exam was in database... */
|
/* If title of exam was in database... */
|
||||||
if (Exa_CheckIfSimilarExamExists (Exam))
|
if (Exa_DB_CheckIfSimilarExamExists (Exam))
|
||||||
{
|
{
|
||||||
NewExamIsCorrect = false;
|
NewExamIsCorrect = false;
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_Already_existed_an_exam_with_the_title_X,
|
Ale_ShowAlert (Ale_WARNING,Txt_Already_existed_an_exam_with_the_title_X,
|
||||||
|
@ -1749,7 +1749,7 @@ bool Exa_CheckIfEditable (const struct Exa_Exam *Exam)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Returns the number of courses with exams in this location
|
// Returns the number of courses with exams in this location
|
||||||
|
|
||||||
unsigned Exa_GetNumCoursesWithExams (HieLvl_Level_t Scope)
|
unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Scope)
|
||||||
{
|
{
|
||||||
/***** Get number of courses with exams from database *****/
|
/***** Get number of courses with exams from database *****/
|
||||||
switch (Scope)
|
switch (Scope)
|
||||||
|
@ -1819,7 +1819,7 @@ unsigned Exa_GetNumCoursesWithExams (HieLvl_Level_t Scope)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Returns the number of exams in this location
|
// Returns the number of exams in this location
|
||||||
|
|
||||||
unsigned Exa_GetNumExams (HieLvl_Level_t Scope)
|
unsigned Exa_DB_GetNumExams (HieLvl_Level_t Scope)
|
||||||
{
|
{
|
||||||
/***** Get number of exams from database *****/
|
/***** Get number of exams from database *****/
|
||||||
switch (Scope)
|
switch (Scope)
|
||||||
|
@ -1888,7 +1888,7 @@ unsigned Exa_GetNumExams (HieLvl_Level_t Scope)
|
||||||
/************* Get average number of questions per course exam ***************/
|
/************* Get average number of questions per course exam ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
double Exa_GetNumQstsPerCrsExam (HieLvl_Level_t Scope)
|
double Exa_DB_GetNumQstsPerCrsExam (HieLvl_Level_t Scope)
|
||||||
{
|
{
|
||||||
/***** Get number of questions per exam from database *****/
|
/***** Get number of questions per exam from database *****/
|
||||||
switch (Scope)
|
switch (Scope)
|
||||||
|
|
|
@ -68,7 +68,7 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam);
|
||||||
void Exa_GetDataOfExamByFolder (struct Exa_Exam *Exam);
|
void Exa_GetDataOfExamByFolder (struct Exa_Exam *Exam);
|
||||||
void Exa_FreeListExams (struct Exa_Exams *Exams);
|
void Exa_FreeListExams (struct Exa_Exams *Exams);
|
||||||
|
|
||||||
void Exa_GetExamTxtFromDB (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
void Exa_DB_GetExamTxt (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||||
|
|
||||||
void Exa_AskRemExam (void);
|
void Exa_AskRemExam (void);
|
||||||
void Exa_RemoveExam (void);
|
void Exa_RemoveExam (void);
|
||||||
|
@ -91,8 +91,8 @@ void Exa_ReceiveFormExam (void);
|
||||||
|
|
||||||
bool Exa_CheckIfEditable (const struct Exa_Exam *Exam);
|
bool Exa_CheckIfEditable (const struct Exa_Exam *Exam);
|
||||||
|
|
||||||
unsigned Exa_GetNumCoursesWithExams (HieLvl_Level_t Scope);
|
unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Scope);
|
||||||
unsigned Exa_GetNumExams (HieLvl_Level_t Scope);
|
unsigned Exa_DB_GetNumExams (HieLvl_Level_t Scope);
|
||||||
double Exa_GetNumQstsPerCrsExam (HieLvl_Level_t Scope);
|
double Exa_DB_GetNumQstsPerCrsExam (HieLvl_Level_t Scope);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
318
swad_exam_log.c
318
swad_exam_log.c
|
@ -336,170 +336,168 @@ void ExaLog_ShowExamLog (const struct ExaPrn_Print *Print)
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
NULL,Box_CLOSABLE,2);
|
NULL,Box_CLOSABLE,2);
|
||||||
|
|
||||||
/***** Begin table *****/
|
/***** Begin table *****/
|
||||||
HTM_TABLE_BeginWideMarginPadding (2);
|
HTM_TABLE_BeginWideMarginPadding (2);
|
||||||
|
|
||||||
/***** Write heading *****/
|
/***** Write heading *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
HTM_TH (1,1,"RB",Txt_Click);
|
||||||
|
HTM_TH (1,1,"LB",Txt_Date_and_time);
|
||||||
|
HTM_TH (1,1,"LB",Txt_Action);
|
||||||
|
HTM_TH (1,1,"RB",Txt_Question);
|
||||||
|
HTM_TH (1,1,"CB",Txt_EXAM_Open);
|
||||||
|
HTM_TH (1,1,"LB",Txt_IP);
|
||||||
|
HTM_TH (1,1,"LB",Txt_Session);
|
||||||
|
HTM_TH (1,1,"LB",Txt_Web_browser);
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
HTM_TH (1,1,"RB",Txt_Click);
|
/***** Write clicks *****/
|
||||||
HTM_TH (1,1,"LB",Txt_Date_and_time);
|
for (NumClick = 0;
|
||||||
HTM_TH (1,1,"LB",Txt_Action);
|
NumClick < NumClicks;
|
||||||
HTM_TH (1,1,"RB",Txt_Question);
|
NumClick++)
|
||||||
HTM_TH (1,1,"CB",Txt_EXAM_Open);
|
|
||||||
HTM_TH (1,1,"LB",Txt_IP);
|
|
||||||
HTM_TH (1,1,"LB",Txt_Session);
|
|
||||||
HTM_TH (1,1,"LB",Txt_Web_browser);
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** Write clicks *****/
|
|
||||||
for (NumClick = 0;
|
|
||||||
NumClick < NumClicks;
|
|
||||||
NumClick++)
|
|
||||||
{
|
|
||||||
Gbl.RowEvenOdd = NumClick % 2;
|
|
||||||
|
|
||||||
/***** Get row *****/
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
/* Get code of action (row[0]) */
|
|
||||||
ActCod = Str_ConvertStrToUnsigned (row[0]);
|
|
||||||
if (ActCod < ExaLog_NUM_ACTIONS)
|
|
||||||
Action = (ExaLog_Action_t) ActCod;
|
|
||||||
else
|
|
||||||
Action = ExaLog_UNKNOWN_ACTION;
|
|
||||||
|
|
||||||
/* Get question index (row[1]) */
|
|
||||||
QstInd = (int) Str_ConvertStrCodToLongCod (row[1]);
|
|
||||||
|
|
||||||
/* Get if the user could answer (row[2]) */
|
|
||||||
UsrCouldAnswer = (row[2][0] == 'Y');
|
|
||||||
|
|
||||||
/* Get click time (row[3] holds the UTC time) */
|
|
||||||
ClickTimeUTC = Dat_GetUNIXTimeFromStr (row[3]);
|
|
||||||
|
|
||||||
/* Get IP (row[4]) */
|
|
||||||
Str_Copy (IP,row[4],sizeof (IP) - 1);
|
|
||||||
|
|
||||||
/* Get session id (row[5]) */
|
|
||||||
Str_Copy (SessionId,row[5] ? row[5] : // This row has a user agent stored in database
|
|
||||||
"=",
|
|
||||||
sizeof (SessionId) - 1);
|
|
||||||
|
|
||||||
/* Get session id (row[6]) */
|
|
||||||
if (asprintf (&UserAgent,"%s",row[6] ? row[6] :
|
|
||||||
"=") < 0)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
|
|
||||||
/***** Set color of row depending on action *****/
|
|
||||||
if (UsrCouldAnswer)
|
|
||||||
switch (Action)
|
|
||||||
{
|
{
|
||||||
case ExaLog_START_EXAM:
|
Gbl.RowEvenOdd = NumClick % 2;
|
||||||
case ExaLog_RESUME_EXAM:
|
|
||||||
case ExaLog_FINISH_EXAM:
|
/***** Get row *****/
|
||||||
Class = "DAT_SMALL_N";
|
row = mysql_fetch_row (mysql_res);
|
||||||
break;
|
|
||||||
case ExaLog_ANSWER_QUESTION:
|
/* Get code of action (row[0]) */
|
||||||
Class = "DAT_SMALL";
|
ActCod = Str_ConvertStrToUnsigned (row[0]);
|
||||||
break;
|
if (ActCod < ExaLog_NUM_ACTIONS)
|
||||||
default:
|
Action = (ExaLog_Action_t) ActCod;
|
||||||
Class = "DAT_SMALL_LIGHT";
|
else
|
||||||
break;
|
Action = ExaLog_UNKNOWN_ACTION;
|
||||||
|
|
||||||
|
/* Get question index (row[1]) */
|
||||||
|
QstInd = (int) Str_ConvertStrCodToLongCod (row[1]);
|
||||||
|
|
||||||
|
/* Get if the user could answer (row[2]) */
|
||||||
|
UsrCouldAnswer = (row[2][0] == 'Y');
|
||||||
|
|
||||||
|
/* Get click time (row[3] holds the UTC time) */
|
||||||
|
ClickTimeUTC = Dat_GetUNIXTimeFromStr (row[3]);
|
||||||
|
|
||||||
|
/* Get IP (row[4]) */
|
||||||
|
Str_Copy (IP,row[4],sizeof (IP) - 1);
|
||||||
|
|
||||||
|
/* Get session id (row[5]) */
|
||||||
|
Str_Copy (SessionId,row[5] ? row[5] : // This row has a user agent stored in database
|
||||||
|
"=",
|
||||||
|
sizeof (SessionId) - 1);
|
||||||
|
|
||||||
|
/* Get session id (row[6]) */
|
||||||
|
if (asprintf (&UserAgent,"%s",row[6] ? row[6] :
|
||||||
|
"=") < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/***** Set color of row depending on action *****/
|
||||||
|
if (UsrCouldAnswer)
|
||||||
|
switch (Action)
|
||||||
|
{
|
||||||
|
case ExaLog_START_EXAM:
|
||||||
|
case ExaLog_RESUME_EXAM:
|
||||||
|
case ExaLog_FINISH_EXAM:
|
||||||
|
Class = "DAT_SMALL_N";
|
||||||
|
break;
|
||||||
|
case ExaLog_ANSWER_QUESTION:
|
||||||
|
Class = "DAT_SMALL";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Class = "DAT_SMALL_LIGHT";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else // Closed or not accesible exam print
|
||||||
|
Class = "DAT_SMALL_LIGHT";
|
||||||
|
|
||||||
|
/***** Write row *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/* Write number of click */
|
||||||
|
HTM_TD_Begin ("class=\"RT COLOR%u %s\"",
|
||||||
|
Gbl.RowEvenOdd,UsrCouldAnswer ? "DAT_SMALL" :
|
||||||
|
"DAT_SMALL_LIGHT");
|
||||||
|
HTM_Unsigned (NumClick + 1);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Write click time */
|
||||||
|
if (asprintf (&Id,"click_date_%u",NumClick) < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
HTM_TD_Begin ("id=\"%s\" class=\"LT COLOR%u %s\"",Id,Gbl.RowEvenOdd,Class);
|
||||||
|
Dat_WriteLocalDateHMSFromUTC (Id,ClickTimeUTC,
|
||||||
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
||||||
|
true,true,true,0x7);
|
||||||
|
free (Id);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Write action */
|
||||||
|
HTM_TD_Begin ("class=\"LT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
||||||
|
HTM_Txt (Txt_EXAM_LOG_ACTIONS[Action]);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Write number of question */
|
||||||
|
HTM_TD_Begin ("class=\"RT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
||||||
|
if (QstInd >= 0)
|
||||||
|
HTM_Unsigned ((unsigned) QstInd + 1);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Write if exam print was open and accesible to answer */
|
||||||
|
HTM_TD_Begin ("class=\"CT COLOR%u %s\"",
|
||||||
|
Gbl.RowEvenOdd,UsrCouldAnswer ? "DAT_SMALL_GREEN" :
|
||||||
|
"DAT_SMALL_RED");
|
||||||
|
HTM_Txt (UsrCouldAnswer ? "✓" :
|
||||||
|
"✗");
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Write IP */
|
||||||
|
HTM_TD_Begin ("class=\"LT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
||||||
|
Length = strlen (IP);
|
||||||
|
if (Length > 6)
|
||||||
|
{
|
||||||
|
sprintf (Anonymized,"%c%c%c…%c%c%c",
|
||||||
|
IP[0],
|
||||||
|
IP[1],
|
||||||
|
IP[2],
|
||||||
|
IP[Length - 3],
|
||||||
|
IP[Length - 2],
|
||||||
|
IP[Length - 1]);
|
||||||
|
HTM_Txt (Anonymized);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
HTM_Txt (IP);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Write session id */
|
||||||
|
HTM_TD_Begin ("class=\"LT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
||||||
|
if (SessionId[0])
|
||||||
|
{
|
||||||
|
Length = strlen (SessionId);
|
||||||
|
if (Length > 6)
|
||||||
|
{
|
||||||
|
sprintf (Anonymized,"%c%c%c…%c%c%c",
|
||||||
|
SessionId[0],
|
||||||
|
SessionId[1],
|
||||||
|
SessionId[2],
|
||||||
|
SessionId[Length - 3],
|
||||||
|
SessionId[Length - 2],
|
||||||
|
SessionId[Length - 1]);
|
||||||
|
HTM_Txt (Anonymized);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
HTM_Txt (SessionId);
|
||||||
|
}
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Write user agent (row[6]) */
|
||||||
|
HTM_TD_Begin ("class=\"LT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
||||||
|
if (UserAgent[0])
|
||||||
|
HTM_Txt (UserAgent);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Free user agent *****/
|
||||||
|
free (UserAgent);
|
||||||
}
|
}
|
||||||
else // Closed or not accesible exam print
|
|
||||||
Class = "DAT_SMALL_LIGHT";
|
|
||||||
|
|
||||||
/***** Write row *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
/* Write number of click */
|
|
||||||
HTM_TD_Begin ("class=\"RT COLOR%u %s\"",
|
|
||||||
Gbl.RowEvenOdd,UsrCouldAnswer ? "DAT_SMALL" :
|
|
||||||
"DAT_SMALL_LIGHT");
|
|
||||||
HTM_Unsigned (NumClick + 1);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Write click time */
|
|
||||||
if (asprintf (&Id,"click_date_%u",NumClick) < 0)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"LT COLOR%u %s\"",Id,Gbl.RowEvenOdd,Class);
|
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,ClickTimeUTC,
|
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
|
||||||
true,true,true,0x7);
|
|
||||||
free (Id);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Write action */
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
|
||||||
HTM_Txt (Txt_EXAM_LOG_ACTIONS[Action]);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Write number of question */
|
|
||||||
HTM_TD_Begin ("class=\"RT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
|
||||||
if (QstInd >= 0)
|
|
||||||
HTM_Unsigned ((unsigned) QstInd + 1);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Write if exam print was open and accesible to answer */
|
|
||||||
HTM_TD_Begin ("class=\"CT COLOR%u %s\"",
|
|
||||||
Gbl.RowEvenOdd,UsrCouldAnswer ? "DAT_SMALL_GREEN" :
|
|
||||||
"DAT_SMALL_RED");
|
|
||||||
HTM_Txt (UsrCouldAnswer ? "✓" :
|
|
||||||
"✗");
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Write IP */
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
|
||||||
Length = strlen (IP);
|
|
||||||
if (Length > 6)
|
|
||||||
{
|
|
||||||
sprintf (Anonymized,"%c%c%c…%c%c%c",
|
|
||||||
IP[0],
|
|
||||||
IP[1],
|
|
||||||
IP[2],
|
|
||||||
IP[Length - 3],
|
|
||||||
IP[Length - 2],
|
|
||||||
IP[Length - 1]);
|
|
||||||
HTM_Txt (Anonymized);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
HTM_Txt (IP);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Write session id */
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
|
||||||
if (SessionId[0])
|
|
||||||
{
|
|
||||||
Length = strlen (SessionId);
|
|
||||||
if (Length > 6)
|
|
||||||
{
|
|
||||||
sprintf (Anonymized,"%c%c%c…%c%c%c",
|
|
||||||
SessionId[0],
|
|
||||||
SessionId[1],
|
|
||||||
SessionId[2],
|
|
||||||
SessionId[Length - 3],
|
|
||||||
SessionId[Length - 2],
|
|
||||||
SessionId[Length - 1]);
|
|
||||||
HTM_Txt (Anonymized);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
HTM_Txt (SessionId);
|
|
||||||
}
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Write user agent (row[6]) */
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u %s\"",Gbl.RowEvenOdd,Class);
|
|
||||||
if (UserAgent[0])
|
|
||||||
HTM_Txt (UserAgent);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** Free user agent *****/
|
|
||||||
free (UserAgent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
Box_BoxTableEnd ();
|
Box_BoxTableEnd ();
|
||||||
|
|
|
@ -146,9 +146,9 @@ static void ExaPrn_GetAnswerFromDB (struct ExaPrn_Print *Print,long QstCod,
|
||||||
static void ExaPrn_StoreOneQstOfPrintInDB (const struct ExaPrn_Print *Print,
|
static void ExaPrn_StoreOneQstOfPrintInDB (const struct ExaPrn_Print *Print,
|
||||||
unsigned QstInd);
|
unsigned QstInd);
|
||||||
|
|
||||||
static void ExaPrn_GetNumQstsNotBlank (struct ExaPrn_Print *Print);
|
static unsigned Exa_DB_GetNumQstsNotBlankInPrint (long PrnCod);
|
||||||
static void ExaPrn_ComputeTotalScoreOfPrint (struct ExaPrn_Print *Print);
|
static double Exa_DB_ComputeTotalScoreOfPrint (long PrnCod);
|
||||||
static void ExaPrn_UpdatePrintInDB (const struct ExaPrn_Print *Print);
|
static void Exa_DB_UpdatePrint (const struct ExaPrn_Print *Print);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************************** Reset exam print *******************************/
|
/**************************** Reset exam print *******************************/
|
||||||
|
@ -679,34 +679,29 @@ static void ExaPrn_ShowExamPrintToFillIt (struct Exa_Exams *Exams,
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
Hlp_ASSESSMENT_Exams_answer_exam,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Exams_answer_exam,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Heading *****/
|
/***** Heading *****/
|
||||||
/* Institution, degree and course */
|
/* Institution, degree and course */
|
||||||
Lay_WriteHeaderClassPhoto (false,false,
|
Lay_WriteHeaderClassPhoto (false,false,
|
||||||
Gbl.Hierarchy.Ins.InsCod,
|
Gbl.Hierarchy.Ins.InsCod,
|
||||||
Gbl.Hierarchy.Deg.DegCod,
|
Gbl.Hierarchy.Deg.DegCod,
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
|
||||||
|
|
||||||
/***** Show user and time *****/
|
/***** Show user and time *****/
|
||||||
/* Begin table */
|
HTM_TABLE_BeginWideMarginPadding (10);
|
||||||
HTM_TABLE_BeginWideMarginPadding (10);
|
ExaRes_ShowExamResultUser (&Gbl.Usrs.Me.UsrDat);
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
|
||||||
/* User */
|
/***** Exam description *****/
|
||||||
ExaRes_ShowExamResultUser (&Gbl.Usrs.Me.UsrDat);
|
ExaPrn_GetAndWriteDescription (Exam->ExaCod);
|
||||||
|
|
||||||
/* End table */
|
if (Print->NumQsts.All)
|
||||||
HTM_TABLE_End ();
|
{
|
||||||
|
/***** Show table with questions to answer *****/
|
||||||
/* Exam description */
|
HTM_DIV_Begin ("id=\"examprint\""); // Used for AJAX based refresh
|
||||||
ExaPrn_GetAndWriteDescription (Exam->ExaCod);
|
ExaPrn_ShowTableWithQstsToFill (Exams,Print);
|
||||||
|
HTM_DIV_End (); // Used for AJAX based refresh
|
||||||
if (Print->NumQsts.All)
|
}
|
||||||
{
|
|
||||||
/***** Show table with questions to answer *****/
|
|
||||||
HTM_DIV_Begin ("id=\"examprint\""); // Used for AJAX based refresh
|
|
||||||
ExaPrn_ShowTableWithQstsToFill (Exams,Print);
|
|
||||||
HTM_DIV_End (); // Used for AJAX based refresh
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** End box *****/
|
/***** End box *****/
|
||||||
Box_BoxEnd ();
|
Box_BoxEnd ();
|
||||||
|
@ -721,14 +716,14 @@ static void ExaPrn_GetAndWriteDescription (long ExaCod)
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
|
||||||
/***** Get description from database *****/
|
/***** Get description from database *****/
|
||||||
Exa_GetExamTxtFromDB (ExaCod,Txt);
|
Exa_DB_GetExamTxt (ExaCod,Txt);
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, // Convert from HTML to rigorous HTML
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, // Convert from HTML to rigorous HTML
|
||||||
Txt,Cns_MAX_BYTES_TEXT,false);
|
Txt,Cns_MAX_BYTES_TEXT,false);
|
||||||
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||||
|
|
||||||
/***** Write description *****/
|
/***** Write description *****/
|
||||||
HTM_DIV_Begin ("class=\"EXA_PRN_DESC DAT_SMALL\"");
|
HTM_DIV_Begin ("class=\"EXA_PRN_DESC DAT_SMALL\"");
|
||||||
HTM_Txt (Txt);
|
HTM_Txt (Txt);
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,24 +741,24 @@ static void ExaPrn_ShowTableWithQstsToFill (struct Exa_Exams *Exams,
|
||||||
/***** Begin table *****/
|
/***** Begin table *****/
|
||||||
HTM_TABLE_BeginWideMarginPadding (10);
|
HTM_TABLE_BeginWideMarginPadding (10);
|
||||||
|
|
||||||
/***** Write one row for each question *****/
|
/***** Write one row for each question *****/
|
||||||
for (QstInd = 0;
|
for (QstInd = 0;
|
||||||
QstInd < Print->NumQsts.All;
|
QstInd < Print->NumQsts.All;
|
||||||
QstInd++)
|
QstInd++)
|
||||||
{
|
{
|
||||||
/* Create test question */
|
/* Create test question */
|
||||||
Tst_QstConstructor (&Question);
|
Tst_QstConstructor (&Question);
|
||||||
Question.QstCod = Print->PrintedQuestions[QstInd].QstCod;
|
Question.QstCod = Print->PrintedQuestions[QstInd].QstCod;
|
||||||
|
|
||||||
/* Get question from database */
|
/* Get question from database */
|
||||||
ExaSet_GetQstDataFromDB (&Question);
|
ExaSet_GetQstDataFromDB (&Question);
|
||||||
|
|
||||||
/* Write question and answers */
|
/* Write question and answers */
|
||||||
ExaPrn_WriteQstAndAnsToFill (Print,QstInd,&Question);
|
ExaPrn_WriteQstAndAnsToFill (Print,QstInd,&Question);
|
||||||
|
|
||||||
/* Destroy test question */
|
/* Destroy test question */
|
||||||
Tst_QstDestructor (&Question);
|
Tst_QstDestructor (&Question);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
@ -771,7 +766,7 @@ static void ExaPrn_ShowTableWithQstsToFill (struct Exa_Exams *Exams,
|
||||||
/***** Form to end/close this exam print *****/
|
/***** Form to end/close this exam print *****/
|
||||||
Frm_BeginFormId (ActEndExaPrn,"finished");
|
Frm_BeginFormId (ActEndExaPrn,"finished");
|
||||||
ExaSes_PutParamsEdit (Exams);
|
ExaSes_PutParamsEdit (Exams);
|
||||||
Btn_PutCreateButton (Txt_I_have_finished);
|
Btn_PutCreateButton (Txt_I_have_finished);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -800,38 +795,38 @@ static void ExaPrn_WriteQstAndAnsToFill (const struct ExaPrn_Print *Print,
|
||||||
|
|
||||||
/***** Title for this set *****/
|
/***** Title for this set *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"COLOR0\"");
|
HTM_TD_Begin ("colspan=\"2\" class=\"COLOR0\"");
|
||||||
ExaSet_WriteSetTitle (&CurrentSet);
|
ExaSet_WriteSetTitle (&CurrentSet);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Begin row *****/
|
/***** Begin row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/***** Number of question and answer type *****/
|
/***** Number of question and answer type *****/
|
||||||
HTM_TD_Begin ("class=\"RT\"");
|
HTM_TD_Begin ("class=\"RT\"");
|
||||||
Tst_WriteNumQst (QstInd + 1,"BIG_INDEX");
|
Tst_WriteNumQst (QstInd + 1,"BIG_INDEX");
|
||||||
Tst_WriteAnswerType (Question->Answer.Type,"DAT_SMALL");
|
Tst_WriteAnswerType (Question->Answer.Type,"DAT_SMALL");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Stem, media and answers *****/
|
/***** Stem, media and answers *****/
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
|
||||||
/* Stem */
|
/* Stem */
|
||||||
Tst_WriteQstStem (Question->Stem,"TEST_TXT",true);
|
Tst_WriteQstStem (Question->Stem,"TEST_TXT",true);
|
||||||
|
|
||||||
/* Media */
|
/* Media */
|
||||||
Med_ShowMedia (&Question->Media,
|
Med_ShowMedia (&Question->Media,
|
||||||
"TEST_MED_SHOW_CONT",
|
"TEST_MED_SHOW_CONT",
|
||||||
"TEST_MED_SHOW");
|
"TEST_MED_SHOW");
|
||||||
|
|
||||||
/* Answers */
|
/* Answers */
|
||||||
Frm_BeginFormNoAction (); // Form that can not be submitted, to avoid enter key to send it
|
Frm_BeginFormNoAction (); // Form that can not be submitted, to avoid enter key to send it
|
||||||
ExaPrn_WriteAnswersToFill (Print,QstInd,Question);
|
ExaPrn_WriteAnswersToFill (Print,QstInd,Question);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** End row *****/
|
/***** End row *****/
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -950,48 +945,48 @@ static void ExaPrn_WriteChoAnsToFill (const struct ExaPrn_Print *Print,
|
||||||
/***** Begin table *****/
|
/***** Begin table *****/
|
||||||
HTM_TABLE_BeginPadding (2);
|
HTM_TABLE_BeginPadding (2);
|
||||||
|
|
||||||
for (NumOpt = 0;
|
for (NumOpt = 0;
|
||||||
NumOpt < Question->Answer.NumOptions;
|
NumOpt < Question->Answer.NumOptions;
|
||||||
NumOpt++)
|
NumOpt++)
|
||||||
{
|
{
|
||||||
/***** Indexes are 0 1 2 3... if no shuffle
|
/***** Indexes are 0 1 2 3... if no shuffle
|
||||||
or 3 1 0 2... (example) if shuffle *****/
|
or 3 1 0 2... (example) if shuffle *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/***** Write selectors and letter of this option *****/
|
/***** Write selectors and letter of this option *****/
|
||||||
/* Initially user has not answered the question ==> initially all the answers will be blank.
|
/* Initially user has not answered the question ==> initially all the answers will be blank.
|
||||||
If the user does not confirm the submission of their exam ==>
|
If the user does not confirm the submission of their exam ==>
|
||||||
==> the exam may be half filled ==> the answers displayed will be those selected by the user. */
|
==> the exam may be half filled ==> the answers displayed will be those selected by the user. */
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
snprintf (Id,sizeof (Id),"Ans%010u",QstInd);
|
snprintf (Id,sizeof (Id),"Ans%010u",QstInd);
|
||||||
HTM_TxtF ("<input type=\"%s\" id=\"%s_%u\" name=\"Ans\" value=\"%u\"%s",
|
HTM_TxtF ("<input type=\"%s\" id=\"%s_%u\" name=\"Ans\" value=\"%u\"%s",
|
||||||
Question->Answer.Type == Tst_ANS_UNIQUE_CHOICE ? "radio" :
|
Question->Answer.Type == Tst_ANS_UNIQUE_CHOICE ? "radio" :
|
||||||
"checkbox",
|
"checkbox",
|
||||||
Id,NumOpt,Indexes[NumOpt],
|
Id,NumOpt,Indexes[NumOpt],
|
||||||
UsrAnswers[Indexes[NumOpt]] ? " checked=\"checked\"" :
|
UsrAnswers[Indexes[NumOpt]] ? " checked=\"checked\"" :
|
||||||
"");
|
"");
|
||||||
ExaPrn_WriteJSToUpdateExamPrint (Print,QstInd,Id,(int) NumOpt);
|
ExaPrn_WriteJSToUpdateExamPrint (Print,QstInd,Id,(int) NumOpt);
|
||||||
HTM_Txt (" />");
|
HTM_Txt (" />");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
HTM_LABEL_Begin ("for=\"Ans%010u_%u\" class=\"TEST_TXT\"",QstInd,NumOpt);
|
HTM_LABEL_Begin ("for=\"Ans%010u_%u\" class=\"TEST_TXT\"",QstInd,NumOpt);
|
||||||
HTM_TxtF ("%c) ",'a' + (char) NumOpt);
|
HTM_TxtF ("%c) ",'a' + (char) NumOpt);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write the option text *****/
|
/***** Write the option text *****/
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
HTM_LABEL_Begin ("for=\"Ans%010u_%u\" class=\"TEST_TXT\"",QstInd,NumOpt);
|
HTM_LABEL_Begin ("for=\"Ans%010u_%u\" class=\"TEST_TXT\"",QstInd,NumOpt);
|
||||||
HTM_Txt (Question->Answer.Options[Indexes[NumOpt]].Text);
|
HTM_Txt (Question->Answer.Options[Indexes[NumOpt]].Text);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
Med_ShowMedia (&Question->Answer.Options[Indexes[NumOpt]].Media,
|
Med_ShowMedia (&Question->Answer.Options[Indexes[NumOpt]].Media,
|
||||||
"TEST_MED_SHOW_CONT",
|
"TEST_MED_SHOW_CONT",
|
||||||
"TEST_MED_SHOW");
|
"TEST_MED_SHOW");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
@ -1110,9 +1105,9 @@ void ExaPrn_ReceivePrintAnswer (void)
|
||||||
ExaPrn_ComputeScoreAndStoreQuestionOfPrint (&Print,QstInd);
|
ExaPrn_ComputeScoreAndStoreQuestionOfPrint (&Print,QstInd);
|
||||||
|
|
||||||
/* Update exam print in database */
|
/* Update exam print in database */
|
||||||
ExaPrn_GetNumQstsNotBlank (&Print);
|
Print.NumQsts.NotBlank = Exa_DB_GetNumQstsNotBlankInPrint (Print.PrnCod);
|
||||||
ExaPrn_ComputeTotalScoreOfPrint (&Print);
|
Print.Score.All = Exa_DB_ComputeTotalScoreOfPrint (Print.PrnCod);
|
||||||
ExaPrn_UpdatePrintInDB (&Print);
|
Exa_DB_UpdatePrint (&Print);
|
||||||
|
|
||||||
/***** Show table with questions to answer *****/
|
/***** Show table with questions to answer *****/
|
||||||
ExaPrn_ShowTableWithQstsToFill (&Exams,&Print);
|
ExaPrn_ShowTableWithQstsToFill (&Exams,&Print);
|
||||||
|
@ -1128,7 +1123,7 @@ void ExaPrn_ReceivePrintAnswer (void)
|
||||||
/***** Form to end/close this exam print *****/
|
/***** Form to end/close this exam print *****/
|
||||||
Frm_BeginForm (ActEndExaPrn);
|
Frm_BeginForm (ActEndExaPrn);
|
||||||
ExaSes_PutParamsEdit (&Exams);
|
ExaSes_PutParamsEdit (&Exams);
|
||||||
Btn_PutCreateButton (Txt_Continue);
|
Btn_PutCreateButton (Txt_Continue);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1485,37 +1480,35 @@ static void ExaPrn_StoreOneQstOfPrintInDB (const struct ExaPrn_Print *Print,
|
||||||
/************ Get number of questions not blank in an exam print *************/
|
/************ Get number of questions not blank in an exam print *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaPrn_GetNumQstsNotBlank (struct ExaPrn_Print *Print)
|
static unsigned Exa_DB_GetNumQstsNotBlankInPrint (long PrnCod)
|
||||||
{
|
{
|
||||||
/***** Count number of questions not blank in exam print in database *****/
|
return (unsigned)
|
||||||
Print->NumQsts.NotBlank = (unsigned)
|
|
||||||
DB_QueryCOUNT ("can not get number of questions not blank",
|
DB_QueryCOUNT ("can not get number of questions not blank",
|
||||||
"SELECT COUNT(*)"
|
"SELECT COUNT(*)"
|
||||||
" FROM exa_print_questions"
|
" FROM exa_print_questions"
|
||||||
" WHERE PrnCod=%ld"
|
" WHERE PrnCod=%ld"
|
||||||
" AND Answers<>''",
|
" AND Answers<>''",
|
||||||
Print->PrnCod);
|
PrnCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Compute score of questions of an exam print ***************/
|
/************* Compute total score of questions of an exam print *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaPrn_ComputeTotalScoreOfPrint (struct ExaPrn_Print *Print)
|
static double Exa_DB_ComputeTotalScoreOfPrint (long PrnCod)
|
||||||
{
|
{
|
||||||
/***** Compute total score of exam print *****/
|
return DB_QuerySELECTDouble ("can not get score of exam print",
|
||||||
Print->Score.All = DB_QuerySELECTDouble ("can not get score of exam print",
|
"SELECT SUM(Score)"
|
||||||
"SELECT SUM(Score)"
|
" FROM exa_print_questions"
|
||||||
" FROM exa_print_questions"
|
" WHERE PrnCod=%ld",
|
||||||
" WHERE PrnCod=%ld",
|
PrnCod);
|
||||||
Print->PrnCod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************** Update exam print in database ************************/
|
/********************** Update exam print in database ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaPrn_UpdatePrintInDB (const struct ExaPrn_Print *Print)
|
static void Exa_DB_UpdatePrint (const struct ExaPrn_Print *Print)
|
||||||
{
|
{
|
||||||
/***** Update exam print in database *****/
|
/***** Update exam print in database *****/
|
||||||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -107,8 +107,8 @@ static void ExaSes_ListOneOrMoreSessionsResultTch (struct Exa_Exams *Exams,
|
||||||
static void ExaSes_GetSessionDataFromRow (MYSQL_RES *mysql_res,
|
static void ExaSes_GetSessionDataFromRow (MYSQL_RES *mysql_res,
|
||||||
struct ExaSes_Session *Session);
|
struct ExaSes_Session *Session);
|
||||||
|
|
||||||
static void ExaSes_RemoveSessionFromAllTables (long SesCod);
|
static void Exa_DB_RemoveSessionFromAllTables (long SesCod);
|
||||||
static void ExaSes_RemoveUsrSesResultsInCrs (long UsrCod,long CrsCod,const char *TableName);
|
static void Exa_DB_RemoveUsrSesResultsInCrs (long UsrCod,long CrsCod,const char *TableName);
|
||||||
|
|
||||||
static void ExaSes_PutFormSession (const struct ExaSes_Session *Session);
|
static void ExaSes_PutFormSession (const struct ExaSes_Session *Session);
|
||||||
static void ExaSes_ShowLstGrpsToCreateSession (long SesCod);
|
static void ExaSes_ShowLstGrpsToCreateSession (long SesCod);
|
||||||
|
@ -116,8 +116,8 @@ static void ExaSes_ShowLstGrpsToCreateSession (long SesCod);
|
||||||
static void ExaSes_CreateSession (struct ExaSes_Session *Session);
|
static void ExaSes_CreateSession (struct ExaSes_Session *Session);
|
||||||
static void ExaSes_UpdateSession (struct ExaSes_Session *Session);
|
static void ExaSes_UpdateSession (struct ExaSes_Session *Session);
|
||||||
|
|
||||||
static void ExaSes_CreateGrps (long SesCod);
|
static void Exa_DB_CreateGrpsAssociatedToExamSession (long SesCod,const struct ListCodGrps *LstGrpsSel);
|
||||||
static void ExaSes_RemoveGroups (long SesCod);
|
static void Exa_DB_RemoveGrpsAssociatedToExamSession (long SesCod);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Reset exam session ****************************/
|
/***************************** Reset exam session ****************************/
|
||||||
|
@ -385,65 +385,67 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams,
|
||||||
/***** Reset session *****/
|
/***** Reset session *****/
|
||||||
ExaSes_ResetSession (&Session);
|
ExaSes_ResetSession (&Session);
|
||||||
|
|
||||||
/***** Write the heading *****/
|
/***** Begin table with sessions *****/
|
||||||
HTM_TABLE_BeginWidePadding (2);
|
HTM_TABLE_BeginWidePadding (2);
|
||||||
ExaSes_ListOneOrMoreSessionsHeading (ICanEditSessions);
|
|
||||||
|
|
||||||
/***** Write rows *****/
|
/***** Write the heading *****/
|
||||||
for (NumSession = 0, UniqueId = 1;
|
ExaSes_ListOneOrMoreSessionsHeading (ICanEditSessions);
|
||||||
NumSession < NumSessions;
|
|
||||||
NumSession++, UniqueId++)
|
|
||||||
{
|
|
||||||
Gbl.RowEvenOdd = NumSession % 2;
|
|
||||||
|
|
||||||
/***** Get exam session data from row *****/
|
/***** Write rows *****/
|
||||||
ExaSes_GetSessionDataFromRow (mysql_res,&Session);
|
for (NumSession = 0, UniqueId = 1;
|
||||||
|
NumSession < NumSessions;
|
||||||
if (ExaSes_CheckIfICanListThisSessionBasedOnGrps (Session.SesCod))
|
NumSession++, UniqueId++)
|
||||||
{
|
{
|
||||||
/***** Build anchor string *****/
|
Gbl.RowEvenOdd = NumSession % 2;
|
||||||
if (asprintf (&Anchor,"evt_%ld_%ld",Exam->ExaCod,Session.SesCod) < 0)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
|
|
||||||
/***** Begin row for this exam session ****/
|
/***** Get exam session data from row *****/
|
||||||
HTM_TR_Begin (NULL);
|
ExaSes_GetSessionDataFromRow (mysql_res,&Session);
|
||||||
|
|
||||||
/* Icons */
|
if (ExaSes_CheckIfICanListThisSessionBasedOnGrps (Session.SesCod))
|
||||||
if (ICanEditSessions)
|
|
||||||
if (ExaSes_CheckIfICanEditThisSession (&Session))
|
|
||||||
ExaSes_ListOneOrMoreSessionsIcons (Exams,&Session,Anchor);
|
|
||||||
|
|
||||||
/* Session participant */
|
|
||||||
ExaSes_ListOneOrMoreSessionsAuthor (&Session);
|
|
||||||
|
|
||||||
/* Start/end date/time */
|
|
||||||
ExaSes_ListOneOrMoreSessionsTimes (&Session,UniqueId);
|
|
||||||
|
|
||||||
/* Title and groups */
|
|
||||||
ExaSes_ListOneOrMoreSessionsTitleGrps (Exams,Exam,&Session,Anchor);
|
|
||||||
|
|
||||||
/* Session result visible? */
|
|
||||||
ExaSes_ListOneOrMoreSessionsResult (Exams,&Session);
|
|
||||||
|
|
||||||
/***** End row for this session ****/
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** For to edit this session ****/
|
|
||||||
if (Session.SesCod == EvtCodToBeEdited)
|
|
||||||
{
|
{
|
||||||
|
/***** Build anchor string *****/
|
||||||
|
if (asprintf (&Anchor,"evt_%ld_%ld",Exam->ExaCod,Session.SesCod) < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/***** Begin row for this exam session ****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
HTM_TD_Begin ("colspan=\"6\" class=\"CT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
ExaSes_PutFormSession (&Session); // Form to edit existing session
|
/* Icons */
|
||||||
HTM_TD_End ();
|
if (ICanEditSessions)
|
||||||
|
if (ExaSes_CheckIfICanEditThisSession (&Session))
|
||||||
|
ExaSes_ListOneOrMoreSessionsIcons (Exams,&Session,Anchor);
|
||||||
|
|
||||||
|
/* Session participant */
|
||||||
|
ExaSes_ListOneOrMoreSessionsAuthor (&Session);
|
||||||
|
|
||||||
|
/* Start/end date/time */
|
||||||
|
ExaSes_ListOneOrMoreSessionsTimes (&Session,UniqueId);
|
||||||
|
|
||||||
|
/* Title and groups */
|
||||||
|
ExaSes_ListOneOrMoreSessionsTitleGrps (Exams,Exam,&Session,Anchor);
|
||||||
|
|
||||||
|
/* Session result visible? */
|
||||||
|
ExaSes_ListOneOrMoreSessionsResult (Exams,&Session);
|
||||||
|
|
||||||
|
/***** End row for this session ****/
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** For to edit this session ****/
|
||||||
|
if (Session.SesCod == EvtCodToBeEdited)
|
||||||
|
{
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
HTM_TD_Begin ("colspan=\"6\" class=\"CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
ExaSes_PutFormSession (&Session); // Form to edit existing session
|
||||||
|
HTM_TD_End ();
|
||||||
|
HTM_TR_End ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Free anchor string *****/
|
||||||
|
free (Anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free anchor string *****/
|
|
||||||
free (Anchor);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table with sessions *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,16 +463,16 @@ static void ExaSes_ListOneOrMoreSessionsHeading (bool ICanEditSessions)
|
||||||
/***** Start row *****/
|
/***** Start row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/***** Column for icons *****/
|
/***** Column for icons *****/
|
||||||
if (ICanEditSessions)
|
if (ICanEditSessions)
|
||||||
HTM_TH_Empty (1);
|
HTM_TH_Empty (1);
|
||||||
|
|
||||||
/***** The rest of columns *****/
|
/***** The rest of columns *****/
|
||||||
HTM_TH (1,1,"LT",Txt_ROLES_SINGUL_Abc[Rol_TCH][Usr_SEX_UNKNOWN]);
|
HTM_TH (1,1,"LT",Txt_ROLES_SINGUL_Abc[Rol_TCH][Usr_SEX_UNKNOWN]);
|
||||||
HTM_TH (1,1,"LT",Txt_START_END_TIME[Exa_ORDER_BY_START_DATE]);
|
HTM_TH (1,1,"LT",Txt_START_END_TIME[Exa_ORDER_BY_START_DATE]);
|
||||||
HTM_TH (1,1,"LT",Txt_START_END_TIME[Exa_ORDER_BY_END_DATE ]);
|
HTM_TH (1,1,"LT",Txt_START_END_TIME[Exa_ORDER_BY_END_DATE ]);
|
||||||
HTM_TH (1,1,"LT",Txt_Session);
|
HTM_TH (1,1,"LT",Txt_Session);
|
||||||
HTM_TH (1,1,"CT",Txt_Results);
|
HTM_TH (1,1,"CT",Txt_Results);
|
||||||
|
|
||||||
/***** End row *****/
|
/***** End row *****/
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -533,27 +535,27 @@ static void ExaSes_ListOneOrMoreSessionsIcons (struct Exa_Exams *Exams,
|
||||||
const struct ExaSes_Session *Session,
|
const struct ExaSes_Session *Session,
|
||||||
const char *Anchor)
|
const char *Anchor)
|
||||||
{
|
{
|
||||||
/***** Begin cell *****/
|
|
||||||
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
|
|
||||||
|
|
||||||
Exams->ExaCod = Session->ExaCod;
|
Exams->ExaCod = Session->ExaCod;
|
||||||
Exams->SesCod = Session->SesCod;
|
Exams->SesCod = Session->SesCod;
|
||||||
|
|
||||||
/***** Icon to remove the exam session *****/
|
/***** Begin cell *****/
|
||||||
Ico_PutContextualIconToRemove (ActReqRemExaSes,NULL,
|
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
|
||||||
ExaSes_PutParamsEdit,Exams);
|
|
||||||
|
|
||||||
/***** Icon to hide/unhide the exam session *****/
|
/***** Icon to remove the exam session *****/
|
||||||
if (Session->Hidden)
|
Ico_PutContextualIconToRemove (ActReqRemExaSes,NULL,
|
||||||
Ico_PutContextualIconToUnhide (ActUnhExaSes,Anchor,
|
|
||||||
ExaSes_PutParamsEdit,Exams);
|
ExaSes_PutParamsEdit,Exams);
|
||||||
else
|
|
||||||
Ico_PutContextualIconToHide (ActHidExaSes,Anchor,
|
|
||||||
ExaSes_PutParamsEdit,Exams);
|
|
||||||
|
|
||||||
/***** Icon to edit the exam session *****/
|
/***** Icon to hide/unhide the exam session *****/
|
||||||
Ico_PutContextualIconToEdit (ActEdiOneExaSes,Anchor,
|
if (Session->Hidden)
|
||||||
ExaSes_PutParamsEdit,Exams);
|
Ico_PutContextualIconToUnhide (ActUnhExaSes,Anchor,
|
||||||
|
ExaSes_PutParamsEdit,Exams);
|
||||||
|
else
|
||||||
|
Ico_PutContextualIconToHide (ActHidExaSes,Anchor,
|
||||||
|
ExaSes_PutParamsEdit,Exams);
|
||||||
|
|
||||||
|
/***** Icon to edit the exam session *****/
|
||||||
|
Ico_PutContextualIconToEdit (ActEdiOneExaSes,Anchor,
|
||||||
|
ExaSes_PutParamsEdit,Exams);
|
||||||
|
|
||||||
/***** End cell *****/
|
/***** End cell *****/
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -567,7 +569,7 @@ static void ExaSes_ListOneOrMoreSessionsAuthor (const struct ExaSes_Session *Ses
|
||||||
{
|
{
|
||||||
/***** Session author (teacher) *****/
|
/***** Session author (teacher) *****/
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
Usr_WriteAuthor1Line (Session->UsrCod,Session->Hidden);
|
Usr_WriteAuthor1Line (Session->UsrCod,Session->Hidden);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,17 +589,17 @@ static void ExaSes_ListOneOrMoreSessionsTimes (const struct ExaSes_Session *Sess
|
||||||
StartEndTime++)
|
StartEndTime++)
|
||||||
{
|
{
|
||||||
Color = Session->Open ? (Session->Hidden ? "DATE_GREEN_LIGHT":
|
Color = Session->Open ? (Session->Hidden ? "DATE_GREEN_LIGHT":
|
||||||
"DATE_GREEN") :
|
"DATE_GREEN") :
|
||||||
(Session->Hidden ? "DATE_RED_LIGHT":
|
(Session->Hidden ? "DATE_RED_LIGHT":
|
||||||
"DATE_RED");
|
"DATE_RED");
|
||||||
|
|
||||||
if (asprintf (&Id,"exa_time_%u_%u",(unsigned) StartEndTime,UniqueId) < 0)
|
if (asprintf (&Id,"exa_time_%u_%u",(unsigned) StartEndTime,UniqueId) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
||||||
Id,Color,Gbl.RowEvenOdd);
|
Id,Color,Gbl.RowEvenOdd);
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Session->TimeUTC[StartEndTime],
|
Dat_WriteLocalDateHMSFromUTC (Id,Session->TimeUTC[StartEndTime],
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||||
true,true,true,0x6);
|
true,true,true,0x6);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
free (Id);
|
free (Id);
|
||||||
}
|
}
|
||||||
|
@ -617,34 +619,34 @@ static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams,
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
/***** Session title *****/
|
/***** Session title *****/
|
||||||
HTM_ARTICLE_Begin (Anchor);
|
HTM_ARTICLE_Begin (Anchor);
|
||||||
if (ExaSes_CheckIfICanAnswerThisSession (Exam,Session))
|
if (ExaSes_CheckIfICanAnswerThisSession (Exam,Session))
|
||||||
{
|
{
|
||||||
Frm_BeginForm (ActSeeExaPrn);
|
Frm_BeginForm (ActSeeExaPrn);
|
||||||
Exa_PutParams (Exams);
|
Exa_PutParams (Exams);
|
||||||
ExaSes_PutParamSesCod (Session->SesCod);
|
ExaSes_PutParamSesCod (Session->SesCod);
|
||||||
HTM_BUTTON_SUBMIT_Begin (Gbl.Usrs.Me.Role.Logged == Rol_STD ? Txt_Play :
|
HTM_BUTTON_SUBMIT_Begin (Gbl.Usrs.Me.Role.Logged == Rol_STD ? Txt_Play :
|
||||||
Txt_Resume,
|
Txt_Resume,
|
||||||
Session->Hidden ? "BT_LINK LT ASG_TITLE_LIGHT":
|
Session->Hidden ? "BT_LINK LT ASG_TITLE_LIGHT":
|
||||||
"BT_LINK LT ASG_TITLE",
|
"BT_LINK LT ASG_TITLE",
|
||||||
NULL);
|
NULL);
|
||||||
HTM_Txt (Session->Title);
|
HTM_Txt (Session->Title);
|
||||||
HTM_BUTTON_End ();
|
HTM_BUTTON_End ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HTM_SPAN_Begin ("class=\"%s\"",Session->Hidden ? "LT ASG_TITLE_LIGHT":
|
HTM_SPAN_Begin ("class=\"%s\"",Session->Hidden ? "LT ASG_TITLE_LIGHT":
|
||||||
"LT ASG_TITLE");
|
"LT ASG_TITLE");
|
||||||
HTM_Txt (Session->Title);
|
HTM_Txt (Session->Title);
|
||||||
HTM_SPAN_End ();
|
HTM_SPAN_End ();
|
||||||
}
|
}
|
||||||
HTM_ARTICLE_End ();
|
HTM_ARTICLE_End ();
|
||||||
|
|
||||||
/***** Groups whose students can answer this exam session *****/
|
/***** Groups whose students can answer this exam session *****/
|
||||||
if (Gbl.Crs.Grps.NumGrps)
|
if (Gbl.Crs.Grps.NumGrps)
|
||||||
ExaSes_GetAndWriteNamesOfGrpsAssociatedToSession (Session);
|
ExaSes_GetAndWriteNamesOfGrpsAssociatedToSession (Session);
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
}
|
}
|
||||||
|
@ -682,35 +684,35 @@ static void ExaSes_GetAndWriteNamesOfGrpsAssociatedToSession (const struct ExaSe
|
||||||
/***** Write heading *****/
|
/***** Write heading *****/
|
||||||
HTM_DIV_Begin ("class=\"%s\"",Session->Hidden ? "ASG_GRP_LIGHT":
|
HTM_DIV_Begin ("class=\"%s\"",Session->Hidden ? "ASG_GRP_LIGHT":
|
||||||
"ASG_GRP");
|
"ASG_GRP");
|
||||||
HTM_TxtColonNBSP (NumGrps == 1 ? Txt_Group :
|
HTM_TxtColonNBSP (NumGrps == 1 ? Txt_Group :
|
||||||
Txt_Groups);
|
Txt_Groups);
|
||||||
|
|
||||||
/***** Write groups *****/
|
/***** Write groups *****/
|
||||||
if (NumGrps) // Groups found...
|
if (NumGrps) // Groups found...
|
||||||
{
|
{
|
||||||
/* Get and write the group types and names */
|
/* Get and write the group types and names */
|
||||||
for (NumGrp = 0;
|
for (NumGrp = 0;
|
||||||
NumGrp < NumGrps;
|
NumGrp < NumGrps;
|
||||||
NumGrp++)
|
NumGrp++)
|
||||||
{
|
{
|
||||||
/* Get next group */
|
/* Get next group */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Write group type name and group name */
|
/* Write group type name and group name */
|
||||||
HTM_TxtF ("%s %s",row[0],row[1]);
|
HTM_TxtF ("%s %s",row[0],row[1]);
|
||||||
|
|
||||||
if (NumGrps >= 2)
|
if (NumGrps >= 2)
|
||||||
{
|
{
|
||||||
if (NumGrp == NumGrps - 2)
|
if (NumGrp == NumGrps - 2)
|
||||||
HTM_TxtF (" %s ",Txt_and);
|
HTM_TxtF (" %s ",Txt_and);
|
||||||
if (NumGrps >= 3)
|
if (NumGrps >= 3)
|
||||||
if (NumGrp < NumGrps - 2)
|
if (NumGrp < NumGrps - 2)
|
||||||
HTM_Txt (", ");
|
HTM_Txt (", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
|
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
||||||
|
@ -727,20 +729,20 @@ static void ExaSes_ListOneOrMoreSessionsResult (struct Exa_Exams *Exams,
|
||||||
{
|
{
|
||||||
HTM_TD_Begin ("class=\"DAT CT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
ExaSes_ListOneOrMoreSessionsResultStd (Exams,Session);
|
ExaSes_ListOneOrMoreSessionsResultStd (Exams,Session);
|
||||||
break;
|
break;
|
||||||
case Rol_NET:
|
case Rol_NET:
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
ExaSes_ListOneOrMoreSessionsResultTch (Exams,Session);
|
ExaSes_ListOneOrMoreSessionsResultTch (Exams,Session);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Err_WrongRoleExit ();
|
Err_WrongRoleExit ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
}
|
}
|
||||||
|
@ -833,7 +835,7 @@ void ExaSes_ToggleVisResultsSesUsr (void)
|
||||||
" WHERE exa_sessions.SesCod=%ld"
|
" WHERE exa_sessions.SesCod=%ld"
|
||||||
" AND exa_sessions.ExaCod=%ld" // Extra check
|
" AND exa_sessions.ExaCod=%ld" // Extra check
|
||||||
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
||||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||||
Session.ShowUsrResults ? 'Y' :
|
Session.ShowUsrResults ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Session.SesCod,
|
Session.SesCod,
|
||||||
|
@ -960,7 +962,7 @@ void ExaSes_RemoveSession (void)
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Remove the exam session from all database tables *****/
|
/***** Remove the exam session from all database tables *****/
|
||||||
ExaSes_RemoveSessionFromAllTables (Session.SesCod);
|
Exa_DB_RemoveSessionFromAllTables (Session.SesCod);
|
||||||
|
|
||||||
/***** Write message *****/
|
/***** Write message *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Session_X_removed,
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Session_X_removed,
|
||||||
|
@ -978,7 +980,7 @@ void ExaSes_RemoveSession (void)
|
||||||
/******************* Remove exam session from all tables *********************/
|
/******************* Remove exam session from all tables *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaSes_RemoveSessionFromAllTables (long SesCod)
|
static void Exa_DB_RemoveSessionFromAllTables (long SesCod)
|
||||||
{
|
{
|
||||||
/* To delete orphan exam prints:
|
/* To delete orphan exam prints:
|
||||||
// DELETE FROM exa_print_questions WHERE PrnCod IN (SELECT PrnCod FROM exa_prints WHERE SesCod NOT IN (SELECT SesCod FROM exa_sessions));
|
// DELETE FROM exa_print_questions WHERE PrnCod IN (SELECT PrnCod FROM exa_prints WHERE SesCod NOT IN (SELECT SesCod FROM exa_sessions));
|
||||||
|
@ -1017,7 +1019,7 @@ static void ExaSes_RemoveSessionFromAllTables (long SesCod)
|
||||||
/**************** Remove exam session in exam from all tables ****************/
|
/**************** Remove exam session in exam from all tables ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaSes_RemoveSessionsInExamFromAllTables (long ExaCod)
|
void Exa_DB_RemoveSessionsInExamFromAllTables (long ExaCod)
|
||||||
{
|
{
|
||||||
/***** Remove exam prints in this session *****/
|
/***** Remove exam prints in this session *****/
|
||||||
/*
|
/*
|
||||||
|
@ -1060,7 +1062,7 @@ void ExaSes_RemoveSessionsInExamFromAllTables (long ExaCod)
|
||||||
/*************** Remove exam session in course from all tables ***************/
|
/*************** Remove exam session in course from all tables ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaSes_RemoveSessionInCourseFromAllTables (long CrsCod)
|
void Exa_DB_RemoveSessionInCourseFromAllTables (long CrsCod)
|
||||||
{
|
{
|
||||||
/***** Remove exam prints in this course *****/
|
/***** Remove exam prints in this course *****/
|
||||||
/*
|
/*
|
||||||
|
@ -1112,13 +1114,13 @@ void ExaSes_RemoveSessionInCourseFromAllTables (long CrsCod)
|
||||||
/************* Remove user from secondary exam session tables ****************/
|
/************* Remove user from secondary exam session tables ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaSes_RemoveUsrFromSessionTablesInCrs (long UsrCod,long CrsCod)
|
void Exa_DB_RemoveUsrFromSessionTablesInCrs (long UsrCod,long CrsCod)
|
||||||
{
|
{
|
||||||
/***** Remove student from secondary tables *****/
|
/***** Remove student from secondary tables *****/
|
||||||
ExaSes_RemoveUsrSesResultsInCrs (UsrCod,CrsCod,"exa_prints");
|
Exa_DB_RemoveUsrSesResultsInCrs (UsrCod,CrsCod,"exa_prints");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ExaSes_RemoveUsrSesResultsInCrs (long UsrCod,long CrsCod,const char *TableName)
|
static void Exa_DB_RemoveUsrSesResultsInCrs (long UsrCod,long CrsCod,const char *TableName)
|
||||||
{
|
{
|
||||||
/***** Remove sessions in course from secondary table *****/
|
/***** Remove sessions in course from secondary table *****/
|
||||||
DB_QueryDELETE ("can not remove sessions of a user from table",
|
DB_QueryDELETE ("can not remove sessions of a user from table",
|
||||||
|
@ -1301,50 +1303,50 @@ static void ExaSes_PutFormSession (const struct ExaSes_Session *Session)
|
||||||
/***** Begin section for a new exam session *****/
|
/***** Begin section for a new exam session *****/
|
||||||
HTM_SECTION_Begin (ExaSes_NEW_SESSION_SECTION_ID);
|
HTM_SECTION_Begin (ExaSes_NEW_SESSION_SECTION_ID);
|
||||||
|
|
||||||
/***** Begin form *****/
|
/***** Begin form *****/
|
||||||
Frm_BeginForm (ItsANewSession ? ActNewExaSes : // New session
|
Frm_BeginForm (ItsANewSession ? ActNewExaSes : // New session
|
||||||
ActChgExaSes); // Existing session
|
ActChgExaSes); // Existing session
|
||||||
Exa_PutParamExamCod (Session->ExaCod);
|
Exa_PutParamExamCod (Session->ExaCod);
|
||||||
if (!ItsANewSession) // Existing session
|
if (!ItsANewSession) // Existing session
|
||||||
ExaSes_PutParamSesCod (Session->SesCod);
|
ExaSes_PutParamSesCod (Session->SesCod);
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
/***** Begin box and table *****/
|
||||||
Box_BoxTableBegin (NULL,ItsANewSession ? Txt_New_session :
|
Box_BoxTableBegin (NULL,ItsANewSession ? Txt_New_session :
|
||||||
Session->Title,
|
Session->Title,
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
Hlp_ASSESSMENT_Exams_sessions,Box_NOT_CLOSABLE,2);
|
Hlp_ASSESSMENT_Exams_sessions,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
/***** Session title *****/
|
/***** Session title *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RT","Title",Txt_Title);
|
Frm_LabelColumn ("RT","Title",Txt_Title);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
HTM_INPUT_TEXT ("Title",ExaSes_MAX_CHARS_TITLE,Session->Title,
|
HTM_INPUT_TEXT ("Title",ExaSes_MAX_CHARS_TITLE,Session->Title,
|
||||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"Title\" size=\"45\" required=\"required\"");
|
"id=\"Title\" size=\"45\" required=\"required\"");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Start and end dates *****/
|
/***** Start and end dates *****/
|
||||||
Dat_PutFormStartEndClientLocalDateTimes (Session->TimeUTC,
|
Dat_PutFormStartEndClientLocalDateTimes (Session->TimeUTC,
|
||||||
Dat_FORM_SECONDS_OFF,
|
Dat_FORM_SECONDS_OFF,
|
||||||
SetHMS);
|
SetHMS);
|
||||||
|
|
||||||
/***** Groups *****/
|
/***** Groups *****/
|
||||||
ExaSes_ShowLstGrpsToCreateSession (Session->SesCod);
|
ExaSes_ShowLstGrpsToCreateSession (Session->SesCod);
|
||||||
|
|
||||||
/***** End table, send button and end box *****/
|
/***** End table, send button and end box *****/
|
||||||
if (ItsANewSession)
|
if (ItsANewSession)
|
||||||
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_session);
|
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_session);
|
||||||
else
|
else
|
||||||
Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Save_changes);
|
Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Save_changes);
|
||||||
|
|
||||||
/***** End form *****/
|
/***** End form *****/
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
|
||||||
/***** End section for a new exam session *****/
|
/***** End section for a new exam session *****/
|
||||||
HTM_SECTION_End ();
|
HTM_SECTION_End ();
|
||||||
|
@ -1369,42 +1371,42 @@ static void ExaSes_ShowLstGrpsToCreateSession (long SesCod)
|
||||||
/***** Begin box and table *****/
|
/***** Begin box and table *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s RT\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
HTM_TD_Begin ("class=\"%s RT\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||||
HTM_TxtColon (Txt_Groups);
|
HTM_TxtColon (Txt_Groups);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
Box_BoxTableBegin ("95%",NULL,
|
Box_BoxTableBegin ("95%",NULL,
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
NULL,Box_NOT_CLOSABLE,0);
|
NULL,Box_NOT_CLOSABLE,0);
|
||||||
|
|
||||||
/***** First row: checkbox to select the whole course *****/
|
/***** First row: checkbox to select the whole course *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
|
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
|
||||||
HTM_LABEL_Begin (NULL);
|
HTM_LABEL_Begin (NULL);
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Grp_CheckIfAssociatedToGrps ("exa_groups","SesCod",SesCod) ? "" :
|
Grp_DB_CheckIfAssociatedToGrps ("exa_groups","SesCod",SesCod) ? "" :
|
||||||
" checked=\"checked\"");
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** List the groups for each group type *****/
|
/***** List the groups for each group type *****/
|
||||||
for (NumGrpTyp = 0;
|
for (NumGrpTyp = 0;
|
||||||
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgAttSvyEvtMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyEvtMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
Grp_EXA_EVENT,SesCod);
|
Grp_EXA_EVENT,SesCod);
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
Box_BoxTableEnd ();
|
Box_BoxTableEnd ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1423,7 +1425,7 @@ void ExaSes_PutButtonNewSession (struct Exa_Exams *Exams,long ExaCod)
|
||||||
Exams->ExaCod = ExaCod;
|
Exams->ExaCod = ExaCod;
|
||||||
Frm_StartFormAnchor (ActReqNewExaSes,ExaSes_NEW_SESSION_SECTION_ID);
|
Frm_StartFormAnchor (ActReqNewExaSes,ExaSes_NEW_SESSION_SECTION_ID);
|
||||||
Exa_PutParams (Exams);
|
Exa_PutParams (Exams);
|
||||||
Btn_PutConfirmButton (Txt_New_session);
|
Btn_PutConfirmButton (Txt_New_session);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1599,7 +1601,7 @@ static void ExaSes_CreateSession (struct ExaSes_Session *Session)
|
||||||
|
|
||||||
/***** Create groups associated to the exam session *****/
|
/***** Create groups associated to the exam session *****/
|
||||||
if (Gbl.Crs.Grps.LstGrpsSel.NumGrps)
|
if (Gbl.Crs.Grps.LstGrpsSel.NumGrps)
|
||||||
ExaSes_CreateGrps (Session->SesCod);
|
Exa_DB_CreateGrpsAssociatedToExamSession (Session->SesCod,&Gbl.Crs.Grps.LstGrpsSel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1633,22 +1635,22 @@ static void ExaSes_UpdateSession (struct ExaSes_Session *Session)
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
|
||||||
/***** Update groups associated to the exam session *****/
|
/***** Update groups associated to the exam session *****/
|
||||||
ExaSes_RemoveGroups (Session->SesCod); // Remove all groups associated to this session
|
Exa_DB_RemoveGrpsAssociatedToExamSession (Session->SesCod); // Remove all groups associated to this session
|
||||||
if (Gbl.Crs.Grps.LstGrpsSel.NumGrps)
|
if (Gbl.Crs.Grps.LstGrpsSel.NumGrps)
|
||||||
ExaSes_CreateGrps (Session->SesCod); // Associate new groups
|
Exa_DB_CreateGrpsAssociatedToExamSession (Session->SesCod,&Gbl.Crs.Grps.LstGrpsSel); // Associate new groups
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************** Create groups associated to an exam session *****************/
|
/*************** Create groups associated to an exam session *****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaSes_CreateGrps (long SesCod)
|
static void Exa_DB_CreateGrpsAssociatedToExamSession (long SesCod,const struct ListCodGrps *LstGrpsSel)
|
||||||
{
|
{
|
||||||
unsigned NumGrpSel;
|
unsigned NumGrpSel;
|
||||||
|
|
||||||
/***** Create groups associated to the exam session *****/
|
/***** Create groups associated to the exam session *****/
|
||||||
for (NumGrpSel = 0;
|
for (NumGrpSel = 0;
|
||||||
NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps;
|
NumGrpSel < LstGrpsSel->NumGrps;
|
||||||
NumGrpSel++)
|
NumGrpSel++)
|
||||||
/* Create group */
|
/* Create group */
|
||||||
DB_QueryINSERT ("can not associate a group to an exam session",
|
DB_QueryINSERT ("can not associate a group to an exam session",
|
||||||
|
@ -1657,14 +1659,14 @@ static void ExaSes_CreateGrps (long SesCod)
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld)",
|
" (%ld,%ld)",
|
||||||
SesCod,
|
SesCod,
|
||||||
Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
LstGrpsSel->GrpCods[NumGrpSel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Remove all groups from one session *********************/
|
/******************** Remove all groups from one session *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaSes_RemoveGroups (long SesCod)
|
static void Exa_DB_RemoveGrpsAssociatedToExamSession (long SesCod)
|
||||||
{
|
{
|
||||||
/***** Remove all groups from one session *****/
|
/***** Remove all groups from one session *****/
|
||||||
DB_QueryDELETE ("can not remove groups associated to a session",
|
DB_QueryDELETE ("can not remove groups associated to a session",
|
||||||
|
@ -1677,7 +1679,7 @@ static void ExaSes_RemoveGroups (long SesCod)
|
||||||
/******************** Remove one group from all sessions *********************/
|
/******************** Remove one group from all sessions *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaSes_RemoveGroup (long GrpCod)
|
void Exa_DB_RemoveGrpAssociatedToExamSessions (long GrpCod)
|
||||||
{
|
{
|
||||||
/***** Remove group from all the sessions *****/
|
/***** Remove group from all the sessions *****/
|
||||||
DB_QueryDELETE ("can not remove group"
|
DB_QueryDELETE ("can not remove group"
|
||||||
|
@ -1691,7 +1693,7 @@ void ExaSes_RemoveGroup (long GrpCod)
|
||||||
/**************** Remove groups of one type from all sessions ****************/
|
/**************** Remove groups of one type from all sessions ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaSes_RemoveGroupsOfType (long GrpTypCod)
|
void Exa_DB_RemoveGroupsOfTypeAssociatedToExamSessions (long GrpTypCod)
|
||||||
{
|
{
|
||||||
/***** Remove group from all the sessions *****/
|
/***** Remove group from all the sessions *****/
|
||||||
DB_QueryDELETE ("can not remove groups of a type"
|
DB_QueryDELETE ("can not remove groups of a type"
|
||||||
|
|
|
@ -61,9 +61,9 @@ void ExaSes_ToggleVisResultsSesUsr (void);
|
||||||
void ExaSes_RequestRemoveSession (void);
|
void ExaSes_RequestRemoveSession (void);
|
||||||
void ExaSes_RemoveSession (void);
|
void ExaSes_RemoveSession (void);
|
||||||
|
|
||||||
void ExaSes_RemoveSessionsInExamFromAllTables (long ExaCod);
|
void Exa_DB_RemoveSessionsInExamFromAllTables (long ExaCod);
|
||||||
void ExaSes_RemoveSessionInCourseFromAllTables (long CrsCod);
|
void Exa_DB_RemoveSessionInCourseFromAllTables (long CrsCod);
|
||||||
void ExaSes_RemoveUsrFromSessionTablesInCrs (long UsrCod,long CrsCod);
|
void Exa_DB_RemoveUsrFromSessionTablesInCrs (long UsrCod,long CrsCod);
|
||||||
|
|
||||||
void ExaSes_HideSession (void);
|
void ExaSes_HideSession (void);
|
||||||
void ExaSes_UnhideSession (void);
|
void ExaSes_UnhideSession (void);
|
||||||
|
@ -79,8 +79,8 @@ void ExaSes_PutButtonNewSession (struct Exa_Exams *Exams,long ExaCod);
|
||||||
void ExaSes_RequestCreatOrEditSession (void);
|
void ExaSes_RequestCreatOrEditSession (void);
|
||||||
void ExaSes_ReceiveFormSession (void);
|
void ExaSes_ReceiveFormSession (void);
|
||||||
|
|
||||||
void ExaSes_RemoveGroup (long GrpCod);
|
void Exa_DB_RemoveGrpAssociatedToExamSessions (long GrpCod);
|
||||||
void ExaSes_RemoveGroupsOfType (long GrpTypCod);
|
void Exa_DB_RemoveGroupsOfTypeAssociatedToExamSessions (long GrpTypCod);
|
||||||
|
|
||||||
unsigned ExaSes_GetNumSessionsInExam (long ExaCod);
|
unsigned ExaSes_GetNumSessionsInExam (long ExaCod);
|
||||||
unsigned ExaSes_GetNumOpenSessionsInExam (long ExaCod);
|
unsigned ExaSes_GetNumOpenSessionsInExam (long ExaCod);
|
||||||
|
|
609
swad_exam_set.c
609
swad_exam_set.c
|
@ -81,9 +81,9 @@ extern struct Globals Gbl;
|
||||||
|
|
||||||
static void ExaSet_PutParamsOneQst (void *Exams);
|
static void ExaSet_PutParamsOneQst (void *Exams);
|
||||||
|
|
||||||
static unsigned ExaSet_GetNumQstsInSet (long SetCod);
|
static unsigned Exa_DB_GetNumQstsInSet (long SetCod);
|
||||||
|
|
||||||
static bool ExaSet_CheckIfSimilarSetExists (const struct ExaSet_Set *Set,
|
static bool Exa_DB_CheckIfSimilarSetExists (const struct ExaSet_Set *Set,
|
||||||
const char Title[ExaSet_MAX_BYTES_TITLE + 1]);
|
const char Title[ExaSet_MAX_BYTES_TITLE + 1]);
|
||||||
|
|
||||||
static void ExaSet_PutFormNewSet (struct Exa_Exams *Exams,
|
static void ExaSet_PutFormNewSet (struct Exa_Exams *Exams,
|
||||||
|
@ -96,20 +96,20 @@ static bool ExaSet_CheckSetTitleReceivedFromForm (const struct ExaSet_Set *Set,
|
||||||
|
|
||||||
static void ExaSet_CreateSet (struct ExaSet_Set *Set);
|
static void ExaSet_CreateSet (struct ExaSet_Set *Set);
|
||||||
static void ExaSet_UpdateSet (const struct ExaSet_Set *Set);
|
static void ExaSet_UpdateSet (const struct ExaSet_Set *Set);
|
||||||
static void ExaSet_UpdateSetTitleDB (const struct ExaSet_Set *Set,
|
static void Exa_DB_UpdateSetTitle (const struct ExaSet_Set *Set,
|
||||||
const char NewTitle[ExaSet_MAX_BYTES_TITLE + 1]);
|
const char NewTitle[ExaSet_MAX_BYTES_TITLE + 1]);
|
||||||
static void ExaSet_UpdateNumQstsToExamDB (const struct ExaSet_Set *Set,
|
static void Exa_DB_UpdateNumQstsToExam (const struct ExaSet_Set *Set,
|
||||||
unsigned NumQstsToPrint);
|
unsigned NumQstsToPrint);
|
||||||
|
|
||||||
static void ExaSet_PutParamSetCod (long SetCod);
|
static void ExaSet_PutParamSetCod (long SetCod);
|
||||||
|
|
||||||
static unsigned ExaSet_GetSetIndFromSetCod (long ExaCod,long SetCod);
|
static unsigned ExaSet_GetSetIndFromSetCod (long ExaCod,long SetCod);
|
||||||
static long ExaSet_GetSetCodFromSetInd (long ExaCod,unsigned SetInd);
|
static long ExaSet_GetSetCodFromSetInd (long ExaCod,unsigned SetInd);
|
||||||
|
|
||||||
static unsigned ExaSet_GetMaxSetIndexInExam (long ExaCod);
|
static unsigned Exa_DB_GetMaxSetIndexInExam (long ExaCod);
|
||||||
|
|
||||||
static unsigned ExaSet_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd);
|
static unsigned Exa_DB_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd);
|
||||||
static unsigned ExaSet_GetNextSetIndexInExam (long ExaCod,unsigned SetInd);
|
static unsigned Exa_DB_GetNextSetIndexInExam (long ExaCod,unsigned SetInd);
|
||||||
|
|
||||||
static void ExaSet_ListSetQuestions (struct Exa_Exams *Exams,
|
static void ExaSet_ListSetQuestions (struct Exa_Exams *Exams,
|
||||||
const struct Exa_Exam *Exam,
|
const struct Exa_Exam *Exam,
|
||||||
|
@ -189,7 +189,7 @@ long ExaSet_GetParamSetCod (void)
|
||||||
/********************* Get number of questions in a set **********************/
|
/********************* Get number of questions in a set **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static unsigned ExaSet_GetNumQstsInSet (long SetCod)
|
static unsigned Exa_DB_GetNumQstsInSet (long SetCod)
|
||||||
{
|
{
|
||||||
/***** Get number of questions in set from database *****/
|
/***** Get number of questions in set from database *****/
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
|
@ -266,7 +266,7 @@ void ExaSet_GetDataOfSetByCod (struct ExaSet_Set *Set)
|
||||||
/************** Check if the title of a set of questions exists **************/
|
/************** Check if the title of a set of questions exists **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static bool ExaSet_CheckIfSimilarSetExists (const struct ExaSet_Set *Set,
|
static bool Exa_DB_CheckIfSimilarSetExists (const struct ExaSet_Set *Set,
|
||||||
const char Title[ExaSet_MAX_BYTES_TITLE + 1])
|
const char Title[ExaSet_MAX_BYTES_TITLE + 1])
|
||||||
{
|
{
|
||||||
/***** Get number of set of questions with a field value from database *****/
|
/***** Get number of set of questions with a field value from database *****/
|
||||||
|
@ -301,51 +301,51 @@ static void ExaSet_PutFormNewSet (struct Exa_Exams *Exams,
|
||||||
Frm_BeginForm (ActNewExaSet);
|
Frm_BeginForm (ActNewExaSet);
|
||||||
Exa_PutParams (Exams);
|
Exa_PutParams (Exams);
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
/***** Begin box and table *****/
|
||||||
Box_BoxTableBegin (NULL,Txt_New_set_of_questions,
|
Box_BoxTableBegin (NULL,Txt_New_set_of_questions,
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
NULL,Box_NOT_CLOSABLE,2);
|
NULL,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
/***** Table heading *****/
|
/***** Table heading *****/
|
||||||
ExaSet_PutTableHeadingForSets ();
|
ExaSet_PutTableHeadingForSets ();
|
||||||
|
|
||||||
/***** Begin row *****/
|
/***** Begin row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/***** Empty column for buttons *****/
|
/***** Empty column for buttons *****/
|
||||||
HTM_TD_Begin ("class=\"BM\"");
|
HTM_TD_Begin ("class=\"BM\"");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Index *****/
|
/***** Index *****/
|
||||||
HTM_TD_Begin ("class=\"RM\"");
|
HTM_TD_Begin ("class=\"RM\"");
|
||||||
Tst_WriteNumQst (MaxSetInd + 1,"BIG_INDEX");
|
Tst_WriteNumQst (MaxSetInd + 1,"BIG_INDEX");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Title *****/
|
/***** Title *****/
|
||||||
HTM_TD_Begin ("class=\"LM\"");
|
HTM_TD_Begin ("class=\"LM\"");
|
||||||
HTM_INPUT_TEXT ("Title",ExaSet_MAX_CHARS_TITLE,Set->Title,
|
HTM_INPUT_TEXT ("Title",ExaSet_MAX_CHARS_TITLE,Set->Title,
|
||||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"Title\" required=\"required\""
|
"id=\"Title\" required=\"required\""
|
||||||
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Current number of questions in set *****/
|
/***** Current number of questions in set *****/
|
||||||
HTM_TD_Begin ("class=\"RM\"");
|
HTM_TD_Begin ("class=\"RM\"");
|
||||||
HTM_Unsigned (0); // New set ==> no questions yet
|
HTM_Unsigned (0); // New set ==> no questions yet
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Number of questions to appear in the exam *****/
|
/***** Number of questions to appear in the exam *****/
|
||||||
HTM_TD_Begin ("class=\"RM\"");
|
HTM_TD_Begin ("class=\"RM\"");
|
||||||
HTM_INPUT_LONG ("NumQstsToPrint",0,UINT_MAX,(long) Set->NumQstsToPrint,
|
HTM_INPUT_LONG ("NumQstsToPrint",0,UINT_MAX,(long) Set->NumQstsToPrint,
|
||||||
HTM_DONT_SUBMIT_ON_CHANGE,false,
|
HTM_DONT_SUBMIT_ON_CHANGE,false,
|
||||||
"class=\"INPUT_LONG\" required=\"required\"");
|
"class=\"INPUT_LONG\" required=\"required\"");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** End row *****/
|
/***** End row *****/
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** End table, send button and end box *****/
|
/***** End table, send button and end box *****/
|
||||||
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_set_of_questions);
|
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_set_of_questions);
|
||||||
|
|
||||||
/***** End form *****/
|
/***** End form *****/
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
@ -427,7 +427,7 @@ static bool ExaSet_CheckSetTitleReceivedFromForm (const struct ExaSet_Set *Set,
|
||||||
if (strcmp (Set->Title,NewTitle)) // Different titles
|
if (strcmp (Set->Title,NewTitle)) // Different titles
|
||||||
{
|
{
|
||||||
/* If title of set was in database... */
|
/* If title of set was in database... */
|
||||||
if (ExaSet_CheckIfSimilarSetExists (Set,NewTitle))
|
if (Exa_DB_CheckIfSimilarSetExists (Set,NewTitle))
|
||||||
{
|
{
|
||||||
NewTitleIsCorrect = false;
|
NewTitleIsCorrect = false;
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_Already_existed_a_set_of_questions_in_this_exam_with_the_title_X,
|
Ale_ShowAlert (Ale_WARNING,Txt_Already_existed_a_set_of_questions_in_this_exam_with_the_title_X,
|
||||||
|
@ -478,7 +478,7 @@ void ExaSet_ChangeSetTitle (void)
|
||||||
if (ExaSet_CheckSetTitleReceivedFromForm (&Set,NewTitle))
|
if (ExaSet_CheckSetTitleReceivedFromForm (&Set,NewTitle))
|
||||||
{
|
{
|
||||||
/* Update the table changing old title by new title */
|
/* Update the table changing old title by new title */
|
||||||
ExaSet_UpdateSetTitleDB (&Set,NewTitle);
|
Exa_DB_UpdateSetTitle (&Set,NewTitle);
|
||||||
|
|
||||||
/* Update title */
|
/* Update title */
|
||||||
Str_Copy (Set.Title,NewTitle,sizeof (Set.Title) - 1);
|
Str_Copy (Set.Title,NewTitle,sizeof (Set.Title) - 1);
|
||||||
|
@ -525,7 +525,7 @@ void ExaSet_ChangeNumQstsToExam (void)
|
||||||
if (NumQstsToPrint != Set.NumQstsToPrint)
|
if (NumQstsToPrint != Set.NumQstsToPrint)
|
||||||
{
|
{
|
||||||
/* Update the table changing old number by new number */
|
/* Update the table changing old number by new number */
|
||||||
ExaSet_UpdateNumQstsToExamDB (&Set,NumQstsToPrint);
|
Exa_DB_UpdateNumQstsToExam (&Set,NumQstsToPrint);
|
||||||
|
|
||||||
/* Update title */
|
/* Update title */
|
||||||
Set.NumQstsToPrint = NumQstsToPrint;
|
Set.NumQstsToPrint = NumQstsToPrint;
|
||||||
|
@ -546,7 +546,7 @@ static void ExaSet_CreateSet (struct ExaSet_Set *Set)
|
||||||
unsigned MaxSetInd;
|
unsigned MaxSetInd;
|
||||||
|
|
||||||
/***** Get maximum set index *****/
|
/***** Get maximum set index *****/
|
||||||
MaxSetInd = ExaSet_GetMaxSetIndexInExam (Set->ExaCod);
|
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Set->ExaCod);
|
||||||
|
|
||||||
/***** Create a new exam *****/
|
/***** Create a new exam *****/
|
||||||
Set->SetCod =
|
Set->SetCod =
|
||||||
|
@ -595,8 +595,8 @@ static void ExaSet_UpdateSet (const struct ExaSet_Set *Set)
|
||||||
/************************ Update set title in database ***********************/
|
/************************ Update set title in database ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaSet_UpdateSetTitleDB (const struct ExaSet_Set *Set,
|
static void Exa_DB_UpdateSetTitle (const struct ExaSet_Set *Set,
|
||||||
const char NewTitle[ExaSet_MAX_BYTES_TITLE + 1])
|
const char NewTitle[ExaSet_MAX_BYTES_TITLE + 1])
|
||||||
{
|
{
|
||||||
/***** Update set of questions changing old title by new title *****/
|
/***** Update set of questions changing old title by new title *****/
|
||||||
DB_QueryUPDATE ("can not update the title of a set of questions",
|
DB_QueryUPDATE ("can not update the title of a set of questions",
|
||||||
|
@ -613,8 +613,8 @@ static void ExaSet_UpdateSetTitleDB (const struct ExaSet_Set *Set,
|
||||||
/****** Update number of questions to appear in exam print in database *******/
|
/****** Update number of questions to appear in exam print in database *******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaSet_UpdateNumQstsToExamDB (const struct ExaSet_Set *Set,
|
static void Exa_DB_UpdateNumQstsToExam (const struct ExaSet_Set *Set,
|
||||||
unsigned NumQstsToPrint)
|
unsigned NumQstsToPrint)
|
||||||
{
|
{
|
||||||
/***** Update set of questions changing old number by new number *****/
|
/***** Update set of questions changing old number by new number *****/
|
||||||
DB_QueryUPDATE ("can not update the number of questions to appear in exam print",
|
DB_QueryUPDATE ("can not update the number of questions to appear in exam print",
|
||||||
|
@ -631,7 +631,7 @@ static void ExaSet_UpdateNumQstsToExamDB (const struct ExaSet_Set *Set,
|
||||||
/******************* Get number of questions of an exam *********************/
|
/******************* Get number of questions of an exam *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
unsigned ExaSet_GetNumSetsExam (long ExaCod)
|
unsigned Exa_DB_GetNumSetsExam (long ExaCod)
|
||||||
{
|
{
|
||||||
/***** Get number of sets in an exam from database *****/
|
/***** Get number of sets in an exam from database *****/
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
|
@ -646,7 +646,7 @@ unsigned ExaSet_GetNumSetsExam (long ExaCod)
|
||||||
/******************* Get number of questions of an exam *********************/
|
/******************* Get number of questions of an exam *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
unsigned ExaSet_GetNumQstsExam (long ExaCod)
|
unsigned Exa_DB_GetNumQstsExam (long ExaCod)
|
||||||
{
|
{
|
||||||
/***** Get total number of questions to appear in exam print *****/
|
/***** Get total number of questions to appear in exam print *****/
|
||||||
return DB_QuerySELECTUnsigned ("can not get number of questions in an exam print",
|
return DB_QuerySELECTUnsigned ("can not get number of questions in an exam print",
|
||||||
|
@ -688,7 +688,7 @@ void ExaSet_RequestCreatOrEditSet (void)
|
||||||
/***** Get exam data from database *****/
|
/***** Get exam data from database *****/
|
||||||
Exa_GetDataOfExamByCod (&Exam);
|
Exa_GetDataOfExamByCod (&Exam);
|
||||||
Exams.ExaCod = Exam.ExaCod;
|
Exams.ExaCod = Exam.ExaCod;
|
||||||
Exa_GetExamTxtFromDB (Exam.ExaCod,Txt);
|
Exa_DB_GetExamTxt (Exam.ExaCod,Txt);
|
||||||
|
|
||||||
/***** Get set data *****/
|
/***** Get set data *****/
|
||||||
if (ItsANewSet)
|
if (ItsANewSet)
|
||||||
|
@ -828,7 +828,7 @@ static long ExaSet_GetSetCodFromSetInd (long ExaCod,unsigned SetInd)
|
||||||
// Question index can be 1, 2, 3...
|
// Question index can be 1, 2, 3...
|
||||||
// Return 0 if no questions
|
// Return 0 if no questions
|
||||||
|
|
||||||
static unsigned ExaSet_GetMaxSetIndexInExam (long ExaCod)
|
static unsigned Exa_DB_GetMaxSetIndexInExam (long ExaCod)
|
||||||
{
|
{
|
||||||
/***** Get maximum set index in an exam from database *****/
|
/***** Get maximum set index in an exam from database *****/
|
||||||
return DB_QuerySELECTUnsigned ("can not get max set index",
|
return DB_QuerySELECTUnsigned ("can not get max set index",
|
||||||
|
@ -844,7 +844,7 @@ static unsigned ExaSet_GetMaxSetIndexInExam (long ExaCod)
|
||||||
// Input set index can be 1, 2, 3... n-1
|
// Input set index can be 1, 2, 3... n-1
|
||||||
// Return set index will be 1, 2, 3... n if previous set exists, or 0 if no previous set
|
// Return set index will be 1, 2, 3... n if previous set exists, or 0 if no previous set
|
||||||
|
|
||||||
static unsigned ExaSet_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd)
|
static unsigned Exa_DB_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd)
|
||||||
{
|
{
|
||||||
/***** Get previous set index in an exam from database *****/
|
/***** Get previous set index in an exam from database *****/
|
||||||
// Although indexes are always continuous...
|
// Although indexes are always continuous...
|
||||||
|
@ -864,7 +864,7 @@ static unsigned ExaSet_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd)
|
||||||
// Input set index can be 0, 1, 2, 3... n-1
|
// Input set index can be 0, 1, 2, 3... n-1
|
||||||
// Return set index will be 1, 2, 3... n if next set exists, or big number if no next set
|
// Return set index will be 1, 2, 3... n if next set exists, or big number if no next set
|
||||||
|
|
||||||
static unsigned ExaSet_GetNextSetIndexInExam (long ExaCod,unsigned SetInd)
|
static unsigned Exa_DB_GetNextSetIndexInExam (long ExaCod,unsigned SetInd)
|
||||||
{
|
{
|
||||||
/***** Get next set index in an exam from database *****/
|
/***** Get next set index in an exam from database *****/
|
||||||
// Although indexes are always continuous...
|
// Although indexes are always continuous...
|
||||||
|
@ -895,7 +895,7 @@ void ExaSet_ListExamSets (struct Exa_Exams *Exams,
|
||||||
bool ICanEditSets = Exa_CheckIfEditable (Exam);
|
bool ICanEditSets = Exa_CheckIfEditable (Exam);
|
||||||
|
|
||||||
/***** Get maximum set index *****/
|
/***** Get maximum set index *****/
|
||||||
MaxSetInd = ExaSet_GetMaxSetIndexInExam (Exam->ExaCod);
|
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Exam->ExaCod);
|
||||||
|
|
||||||
/***** Get data of set of questions from database *****/
|
/***** Get data of set of questions from database *****/
|
||||||
NumSets = (unsigned)
|
NumSets = (unsigned)
|
||||||
|
@ -1007,162 +1007,164 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
|
||||||
if (!NumSets)
|
if (!NumSets)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Write the heading *****/
|
/***** Begin table *****/
|
||||||
HTM_TABLE_BeginWideMarginPadding (5);
|
HTM_TABLE_BeginWideMarginPadding (5);
|
||||||
ExaSet_PutTableHeadingForSets ();
|
|
||||||
|
|
||||||
/***** Write rows *****/
|
/***** Write the heading *****/
|
||||||
for (NumSet = 0;
|
ExaSet_PutTableHeadingForSets ();
|
||||||
NumSet < NumSets;
|
|
||||||
NumSet++)
|
|
||||||
{
|
|
||||||
Gbl.RowEvenOdd = NumSet % 2;
|
|
||||||
|
|
||||||
/***** Create set of questions *****/
|
/***** Write rows *****/
|
||||||
ExaSet_ResetSet (&Set);
|
for (NumSet = 0;
|
||||||
|
NumSet < NumSets;
|
||||||
/***** Get set data *****/
|
NumSet++)
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
/*
|
|
||||||
row[0] SetCod
|
|
||||||
row[1] SetInd
|
|
||||||
row[2] NumQstsToPrint
|
|
||||||
row[3] Title
|
|
||||||
*/
|
|
||||||
/* Get set code (row[0]) */
|
|
||||||
Set.SetCod = Str_ConvertStrCodToLongCod (row[0]);
|
|
||||||
|
|
||||||
/* Get set index (row[1]) */
|
|
||||||
Set.SetInd = Str_ConvertStrToUnsigned (row[1]);
|
|
||||||
snprintf (StrSetInd,sizeof (Set.SetInd),"%u",Set.SetInd);
|
|
||||||
|
|
||||||
/* Get number of questions to exam (row[2]) */
|
|
||||||
Set.NumQstsToPrint = Str_ConvertStrToUnsigned (row[2]);
|
|
||||||
|
|
||||||
/* Get the title of the set (row[3]) */
|
|
||||||
Str_Copy (Set.Title,row[3],sizeof (Set.Title) - 1);
|
|
||||||
|
|
||||||
/* Initialize context */
|
|
||||||
Exams->SetCod = Set.SetCod;
|
|
||||||
Exams->SetInd = Set.SetInd;
|
|
||||||
|
|
||||||
/***** Build anchor string *****/
|
|
||||||
Frm_SetAnchorStr (Set.SetCod,&Anchor);
|
|
||||||
|
|
||||||
/***** Begin first row *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
/***** Icons *****/
|
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"BT%u\"",Gbl.RowEvenOdd);
|
|
||||||
|
|
||||||
/* Put icon to remove the set */
|
|
||||||
if (ICanEditSets)
|
|
||||||
Ico_PutContextualIconToRemove (ActReqRemExaSet,NULL,
|
|
||||||
ExaSet_PutParamsOneSet,Exams);
|
|
||||||
else
|
|
||||||
Ico_PutIconRemovalNotAllowed ();
|
|
||||||
|
|
||||||
/* Put icon to move up the question */
|
|
||||||
if (ICanEditSets && Set.SetInd > 1)
|
|
||||||
{
|
{
|
||||||
Lay_PutContextualLinkOnlyIcon (ActUp_ExaSet,Anchor,
|
Gbl.RowEvenOdd = NumSet % 2;
|
||||||
ExaSet_PutParamsOneSet,Exams,
|
|
||||||
"arrow-up.svg",
|
/***** Create set of questions *****/
|
||||||
Str_BuildStringStr (Txt_Move_up_X,
|
ExaSet_ResetSet (&Set);
|
||||||
StrSetInd));
|
|
||||||
Str_FreeString ();
|
/***** Get set data *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
/*
|
||||||
|
row[0] SetCod
|
||||||
|
row[1] SetInd
|
||||||
|
row[2] NumQstsToPrint
|
||||||
|
row[3] Title
|
||||||
|
*/
|
||||||
|
/* Get set code (row[0]) */
|
||||||
|
Set.SetCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
|
||||||
|
/* Get set index (row[1]) */
|
||||||
|
Set.SetInd = Str_ConvertStrToUnsigned (row[1]);
|
||||||
|
snprintf (StrSetInd,sizeof (Set.SetInd),"%u",Set.SetInd);
|
||||||
|
|
||||||
|
/* Get number of questions to exam (row[2]) */
|
||||||
|
Set.NumQstsToPrint = Str_ConvertStrToUnsigned (row[2]);
|
||||||
|
|
||||||
|
/* Get the title of the set (row[3]) */
|
||||||
|
Str_Copy (Set.Title,row[3],sizeof (Set.Title) - 1);
|
||||||
|
|
||||||
|
/* Initialize context */
|
||||||
|
Exams->SetCod = Set.SetCod;
|
||||||
|
Exams->SetInd = Set.SetInd;
|
||||||
|
|
||||||
|
/***** Build anchor string *****/
|
||||||
|
Frm_SetAnchorStr (Set.SetCod,&Anchor);
|
||||||
|
|
||||||
|
/***** Begin first row *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/***** Icons *****/
|
||||||
|
HTM_TD_Begin ("rowspan=\"2\" class=\"BT%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
|
/* Put icon to remove the set */
|
||||||
|
if (ICanEditSets)
|
||||||
|
Ico_PutContextualIconToRemove (ActReqRemExaSet,NULL,
|
||||||
|
ExaSet_PutParamsOneSet,Exams);
|
||||||
|
else
|
||||||
|
Ico_PutIconRemovalNotAllowed ();
|
||||||
|
|
||||||
|
/* Put icon to move up the question */
|
||||||
|
if (ICanEditSets && Set.SetInd > 1)
|
||||||
|
{
|
||||||
|
Lay_PutContextualLinkOnlyIcon (ActUp_ExaSet,Anchor,
|
||||||
|
ExaSet_PutParamsOneSet,Exams,
|
||||||
|
"arrow-up.svg",
|
||||||
|
Str_BuildStringStr (Txt_Move_up_X,
|
||||||
|
StrSetInd));
|
||||||
|
Str_FreeString ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Ico_PutIconOff ("arrow-up.svg",Txt_Movement_not_allowed);
|
||||||
|
|
||||||
|
/* Put icon to move down the set */
|
||||||
|
if (ICanEditSets && Set.SetInd < MaxSetInd)
|
||||||
|
{
|
||||||
|
Lay_PutContextualLinkOnlyIcon (ActDwnExaSet,Anchor,
|
||||||
|
ExaSet_PutParamsOneSet,Exams,
|
||||||
|
"arrow-down.svg",
|
||||||
|
Str_BuildStringStr (Txt_Move_down_X,
|
||||||
|
StrSetInd));
|
||||||
|
Str_FreeString ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Ico_PutIconOff ("arrow-down.svg",Txt_Movement_not_allowed);
|
||||||
|
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Index *****/
|
||||||
|
HTM_TD_Begin ("rowspan=\"2\" class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
Tst_WriteNumQst (Set.SetInd,"BIG_INDEX");
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Title *****/
|
||||||
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
HTM_ARTICLE_Begin (Anchor);
|
||||||
|
if (ICanEditSets)
|
||||||
|
{
|
||||||
|
Frm_StartFormAnchor (ActChgTitExaSet,Anchor);
|
||||||
|
ExaSet_PutParamsOneSet (Exams);
|
||||||
|
HTM_INPUT_TEXT ("Title",ExaSet_MAX_CHARS_TITLE,Set.Title,
|
||||||
|
HTM_SUBMIT_ON_CHANGE,
|
||||||
|
"id=\"Title\" required=\"required\""
|
||||||
|
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
||||||
|
Frm_EndForm ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HTM_SPAN_Begin ("class=\"EXA_SET_TITLE\"");
|
||||||
|
HTM_Txt (Set.Title);
|
||||||
|
HTM_SPAN_End ();
|
||||||
|
}
|
||||||
|
HTM_ARTICLE_End ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Current number of questions in set *****/
|
||||||
|
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
HTM_SPAN_Begin ("class=\"EXA_SET_NUM_QSTS\"");
|
||||||
|
HTM_Unsigned (Exa_DB_GetNumQstsInSet (Set.SetCod));
|
||||||
|
HTM_SPAN_End ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Number of questions to appear in exam print *****/
|
||||||
|
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
if (ICanEditSets)
|
||||||
|
{
|
||||||
|
Frm_StartFormAnchor (ActChgNumQstExaSet,Anchor);
|
||||||
|
ExaSet_PutParamsOneSet (Exams);
|
||||||
|
HTM_INPUT_LONG ("NumQstsToPrint",0,UINT_MAX,(long) Set.NumQstsToPrint,
|
||||||
|
HTM_SUBMIT_ON_CHANGE,false,
|
||||||
|
"class=\"INPUT_LONG\" required=\"required\"");
|
||||||
|
Frm_EndForm ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HTM_SPAN_Begin ("class=\"EXA_SET_NUM_QSTS\"");
|
||||||
|
HTM_Unsigned (Set.NumQstsToPrint);
|
||||||
|
HTM_SPAN_End ();
|
||||||
|
}
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** End first row *****/
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Begin second row *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/***** Questions *****/
|
||||||
|
HTM_TD_Begin ("colspan=\"3\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
|
/* List questions */
|
||||||
|
ExaSet_ListSetQuestions (Exams,Exam,&Set);
|
||||||
|
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** End second row *****/
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Free anchor string *****/
|
||||||
|
Frm_FreeAnchorStr (Anchor);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Ico_PutIconOff ("arrow-up.svg",Txt_Movement_not_allowed);
|
|
||||||
|
|
||||||
/* Put icon to move down the set */
|
|
||||||
if (ICanEditSets && Set.SetInd < MaxSetInd)
|
|
||||||
{
|
|
||||||
Lay_PutContextualLinkOnlyIcon (ActDwnExaSet,Anchor,
|
|
||||||
ExaSet_PutParamsOneSet,Exams,
|
|
||||||
"arrow-down.svg",
|
|
||||||
Str_BuildStringStr (Txt_Move_down_X,
|
|
||||||
StrSetInd));
|
|
||||||
Str_FreeString ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Ico_PutIconOff ("arrow-down.svg",Txt_Movement_not_allowed);
|
|
||||||
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** Index *****/
|
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
Tst_WriteNumQst (Set.SetInd,"BIG_INDEX");
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** Title *****/
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
HTM_ARTICLE_Begin (Anchor);
|
|
||||||
if (ICanEditSets)
|
|
||||||
{
|
|
||||||
Frm_StartFormAnchor (ActChgTitExaSet,Anchor);
|
|
||||||
ExaSet_PutParamsOneSet (Exams);
|
|
||||||
HTM_INPUT_TEXT ("Title",ExaSet_MAX_CHARS_TITLE,Set.Title,
|
|
||||||
HTM_SUBMIT_ON_CHANGE,
|
|
||||||
"id=\"Title\" required=\"required\""
|
|
||||||
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
|
||||||
Frm_EndForm ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HTM_SPAN_Begin ("class=\"EXA_SET_TITLE\"");
|
|
||||||
HTM_Txt (Set.Title);
|
|
||||||
HTM_SPAN_End ();
|
|
||||||
}
|
|
||||||
HTM_ARTICLE_End ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** Current number of questions in set *****/
|
|
||||||
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
HTM_SPAN_Begin ("class=\"EXA_SET_NUM_QSTS\"");
|
|
||||||
HTM_Unsigned (ExaSet_GetNumQstsInSet (Set.SetCod));
|
|
||||||
HTM_SPAN_End ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** Number of questions to appear in exam print *****/
|
|
||||||
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
if (ICanEditSets)
|
|
||||||
{
|
|
||||||
Frm_StartFormAnchor (ActChgNumQstExaSet,Anchor);
|
|
||||||
ExaSet_PutParamsOneSet (Exams);
|
|
||||||
HTM_INPUT_LONG ("NumQstsToPrint",0,UINT_MAX,(long) Set.NumQstsToPrint,
|
|
||||||
HTM_SUBMIT_ON_CHANGE,false,
|
|
||||||
"class=\"INPUT_LONG\" required=\"required\"");
|
|
||||||
Frm_EndForm ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HTM_SPAN_Begin ("class=\"EXA_SET_NUM_QSTS\"");
|
|
||||||
HTM_Unsigned (Set.NumQstsToPrint);
|
|
||||||
HTM_SPAN_End ();
|
|
||||||
}
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** End first row *****/
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** Begin second row *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
/***** Questions *****/
|
|
||||||
HTM_TD_Begin ("colspan=\"3\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
|
|
||||||
/* List questions */
|
|
||||||
ExaSet_ListSetQuestions (Exams,Exam,&Set);
|
|
||||||
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** End second row *****/
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** Free anchor string *****/
|
|
||||||
Frm_FreeAnchorStr (Anchor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
@ -1182,12 +1184,12 @@ static void ExaSet_PutTableHeadingForSets (void)
|
||||||
/***** Begin row *****/
|
/***** Begin row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/***** Header cells *****/
|
/***** Header cells *****/
|
||||||
HTM_TH_Empty (1);
|
HTM_TH_Empty (1);
|
||||||
HTM_TH (1,1,"RB",Txt_No_INDEX);
|
HTM_TH (1,1,"RB",Txt_No_INDEX);
|
||||||
HTM_TH (1,1,"LB",Txt_Set_of_questions);
|
HTM_TH (1,1,"LB",Txt_Set_of_questions);
|
||||||
HTM_TH (1,1,"RB",Txt_Number_of_questions);
|
HTM_TH (1,1,"RB",Txt_Number_of_questions);
|
||||||
HTM_TH (1,1,"RB",Txt_Number_of_questions_to_show);
|
HTM_TH (1,1,"RB",Txt_Number_of_questions_to_show);
|
||||||
|
|
||||||
/***** End row *****/
|
/***** End row *****/
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -1239,67 +1241,70 @@ static void ExaSet_ListOneOrMoreQuestionsForEdition (struct Exa_Exams *Exams,
|
||||||
[Tst_VALID_QUESTION ] = Txt_Valid_question,
|
[Tst_VALID_QUESTION ] = Txt_Valid_question,
|
||||||
};
|
};
|
||||||
|
|
||||||
/***** Write the heading *****/
|
/***** Begin table *****/
|
||||||
HTM_TABLE_BeginWideMarginPadding (5);
|
HTM_TABLE_BeginWideMarginPadding (5);
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
HTM_TH_Empty (1);
|
/***** Write the heading *****/
|
||||||
|
|
||||||
HTM_TH (1,1,"CT",Txt_No_INDEX);
|
|
||||||
HTM_TH (1,1,"CT",Txt_Question);
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** Write rows *****/
|
|
||||||
for (QstInd = 0;
|
|
||||||
QstInd < NumQsts;
|
|
||||||
QstInd++)
|
|
||||||
{
|
|
||||||
Gbl.RowEvenOdd = QstInd % 2;
|
|
||||||
|
|
||||||
/***** Create test question *****/
|
|
||||||
Tst_QstConstructor (&Question);
|
|
||||||
|
|
||||||
/***** Get question data *****/
|
|
||||||
/* Get question code */
|
|
||||||
Exams->QstCod = Question.QstCod = DB_GetNextCode (mysql_res);
|
|
||||||
ExaSet_GetQstDataFromDB (&Question);
|
|
||||||
|
|
||||||
/***** Build anchor string *****/
|
|
||||||
Frm_SetAnchorStr (Exams->QstCod,&Anchor);
|
|
||||||
|
|
||||||
/***** Begin row *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/***** Icons *****/
|
HTM_TH_Empty (1);
|
||||||
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
|
|
||||||
|
|
||||||
/* Put icon to remove the question */
|
HTM_TH (1,1,"CT",Txt_No_INDEX);
|
||||||
if (ICanEditQuestions)
|
HTM_TH (1,1,"CT",Txt_Question);
|
||||||
Ico_PutContextualIconToRemove (ActReqRemSetQst,NULL,
|
|
||||||
ExaSet_PutParamsOneQst,Exams);
|
|
||||||
else
|
|
||||||
Ico_PutIconRemovalNotAllowed ();
|
|
||||||
|
|
||||||
/* Put icon to cancel the question */
|
|
||||||
Lay_PutContextualLinkOnlyIcon (NextAction[Question.Validity],Anchor,
|
|
||||||
ExaSet_PutParamsOneQst,Exams,
|
|
||||||
Icon[Question.Validity],
|
|
||||||
Title[Question.Validity]);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** List question *****/
|
|
||||||
ExaSet_ListQuestionForEdition (&Question,QstInd + 1,Anchor);
|
|
||||||
|
|
||||||
/***** End row *****/
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Free anchor string *****/
|
/***** Write rows *****/
|
||||||
Frm_FreeAnchorStr (Anchor);
|
for (QstInd = 0;
|
||||||
|
QstInd < NumQsts;
|
||||||
|
QstInd++)
|
||||||
|
{
|
||||||
|
Gbl.RowEvenOdd = QstInd % 2;
|
||||||
|
|
||||||
/***** Destroy test question *****/
|
/***** Create test question *****/
|
||||||
Tst_QstDestructor (&Question);
|
Tst_QstConstructor (&Question);
|
||||||
}
|
|
||||||
|
/***** Get question data *****/
|
||||||
|
/* Get question code */
|
||||||
|
Exams->QstCod = Question.QstCod = DB_GetNextCode (mysql_res);
|
||||||
|
ExaSet_GetQstDataFromDB (&Question);
|
||||||
|
|
||||||
|
/***** Build anchor string *****/
|
||||||
|
Frm_SetAnchorStr (Exams->QstCod,&Anchor);
|
||||||
|
|
||||||
|
/***** Begin row *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/***** Icons *****/
|
||||||
|
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
|
/* Put icon to remove the question */
|
||||||
|
if (ICanEditQuestions)
|
||||||
|
Ico_PutContextualIconToRemove (ActReqRemSetQst,NULL,
|
||||||
|
ExaSet_PutParamsOneQst,Exams);
|
||||||
|
else
|
||||||
|
Ico_PutIconRemovalNotAllowed ();
|
||||||
|
|
||||||
|
/* Put icon to cancel the question */
|
||||||
|
Lay_PutContextualLinkOnlyIcon (NextAction[Question.Validity],Anchor,
|
||||||
|
ExaSet_PutParamsOneQst,Exams,
|
||||||
|
Icon[Question.Validity],
|
||||||
|
Title[Question.Validity]);
|
||||||
|
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** List question *****/
|
||||||
|
ExaSet_ListQuestionForEdition (&Question,QstInd + 1,Anchor);
|
||||||
|
|
||||||
|
/***** End row *****/
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Free anchor string *****/
|
||||||
|
Frm_FreeAnchorStr (Anchor);
|
||||||
|
|
||||||
|
/***** Destroy test question *****/
|
||||||
|
Tst_QstDestructor (&Question);
|
||||||
|
}
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
@ -1521,32 +1526,32 @@ static void ExaSet_ListQuestionForEdition (struct Tst_Question *Question,
|
||||||
|
|
||||||
/***** Number of question and answer type (row[1]) *****/
|
/***** Number of question and answer type (row[1]) *****/
|
||||||
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
Tst_WriteNumQst (QstInd,ClassNumQst[Question->Validity]);
|
Tst_WriteNumQst (QstInd,ClassNumQst[Question->Validity]);
|
||||||
Tst_WriteAnswerType (Question->Answer.Type,ClassAnswerType[Question->Validity]);
|
Tst_WriteAnswerType (Question->Answer.Type,ClassAnswerType[Question->Validity]);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write stem (row[3]) and media *****/
|
/***** Write stem (row[3]) and media *****/
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
HTM_ARTICLE_Begin (Anchor);
|
HTM_ARTICLE_Begin (Anchor);
|
||||||
|
|
||||||
/* Write stem */
|
/* Write stem */
|
||||||
Tst_WriteQstStem (Question->Stem,ClassTxt[Question->Validity],
|
Tst_WriteQstStem (Question->Stem,ClassTxt[Question->Validity],
|
||||||
true); // Visible
|
true); // Visible
|
||||||
|
|
||||||
/* Show media */
|
/* Show media */
|
||||||
Med_ShowMedia (&Question->Media,
|
Med_ShowMedia (&Question->Media,
|
||||||
"TEST_MED_EDIT_LIST_CONT",
|
"TEST_MED_EDIT_LIST_CONT",
|
||||||
"TEST_MED_EDIT_LIST");
|
"TEST_MED_EDIT_LIST");
|
||||||
|
|
||||||
/* Show feedback */
|
/* Show feedback */
|
||||||
Tst_WriteQstFeedback (Question->Feedback,ClassFeedback[Question->Validity]);
|
Tst_WriteQstFeedback (Question->Feedback,ClassFeedback[Question->Validity]);
|
||||||
|
|
||||||
/* Show answers */
|
/* Show answers */
|
||||||
Tst_WriteAnswersBank (Question,
|
Tst_WriteAnswersBank (Question,
|
||||||
ClassTxt[Question->Validity],
|
ClassTxt[Question->Validity],
|
||||||
ClassFeedback[Question->Validity]);
|
ClassFeedback[Question->Validity]);
|
||||||
|
|
||||||
HTM_ARTICLE_End ();
|
HTM_ARTICLE_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1862,7 +1867,7 @@ void ExaSet_MoveUpSet (void)
|
||||||
if (SetIndBottom > 1)
|
if (SetIndBottom > 1)
|
||||||
{
|
{
|
||||||
/* Indexes of sets to be exchanged */
|
/* Indexes of sets to be exchanged */
|
||||||
SetIndTop = ExaSet_GetPrevSetIndexInExam (Exam.ExaCod,SetIndBottom);
|
SetIndTop = Exa_DB_GetPrevSetIndexInExam (Exam.ExaCod,SetIndBottom);
|
||||||
if (SetIndTop == 0)
|
if (SetIndTop == 0)
|
||||||
Err_ShowErrorAndExit ("Wrong set index.");
|
Err_ShowErrorAndExit ("Wrong set index.");
|
||||||
|
|
||||||
|
@ -1907,13 +1912,13 @@ void ExaSet_MoveDownSet (void)
|
||||||
SetIndTop = ExaSet_GetSetIndFromSetCod (Exam.ExaCod,Set.SetCod);
|
SetIndTop = ExaSet_GetSetIndFromSetCod (Exam.ExaCod,Set.SetCod);
|
||||||
|
|
||||||
/***** Get maximum set index *****/
|
/***** Get maximum set index *****/
|
||||||
MaxSetInd = ExaSet_GetMaxSetIndexInExam (Exam.ExaCod);
|
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Exam.ExaCod);
|
||||||
|
|
||||||
/***** Move down set *****/
|
/***** Move down set *****/
|
||||||
if (SetIndTop < MaxSetInd)
|
if (SetIndTop < MaxSetInd)
|
||||||
{
|
{
|
||||||
/* Indexes of sets to be exchanged */
|
/* Indexes of sets to be exchanged */
|
||||||
SetIndBottom = ExaSet_GetNextSetIndexInExam (Exam.ExaCod,SetIndTop);
|
SetIndBottom = Exa_DB_GetNextSetIndexInExam (Exam.ExaCod,SetIndTop);
|
||||||
if (SetIndBottom == ExaSet_AFTER_LAST_SET)
|
if (SetIndBottom == ExaSet_AFTER_LAST_SET)
|
||||||
Err_ShowErrorAndExit ("Wrong set index.");
|
Err_ShowErrorAndExit ("Wrong set index.");
|
||||||
|
|
||||||
|
@ -2290,18 +2295,18 @@ void ExaSet_WriteSetTitle (const struct ExaSet_Set *Set)
|
||||||
/***** Begin table *****/
|
/***** Begin table *****/
|
||||||
HTM_TABLE_BeginWide ();
|
HTM_TABLE_BeginWide ();
|
||||||
|
|
||||||
/***** Title *****/
|
/***** Title *****/
|
||||||
HTM_TD_Begin ("class=\"EXA_SET_TITLE\"");
|
HTM_TD_Begin ("class=\"EXA_SET_TITLE\"");
|
||||||
HTM_Txt (Set->Title);
|
HTM_Txt (Set->Title);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Number of questions to appear in exam print *****/
|
/***** Number of questions to appear in exam print *****/
|
||||||
HTM_TD_Begin ("class=\"EXA_SET_NUM_QSTS\"");
|
HTM_TD_Begin ("class=\"EXA_SET_NUM_QSTS\"");
|
||||||
HTM_Unsigned (Set->NumQstsToPrint);
|
HTM_Unsigned (Set->NumQstsToPrint);
|
||||||
HTM_NBSP ();
|
HTM_NBSP ();
|
||||||
HTM_Txt (Set->NumQstsToPrint == 1 ? Txt_question :
|
HTM_Txt (Set->NumQstsToPrint == 1 ? Txt_question :
|
||||||
Txt_questions);
|
Txt_questions);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
|
|
@ -48,8 +48,8 @@ void ExaSet_ReceiveFormSet (void);
|
||||||
void ExaSet_ChangeSetTitle (void);
|
void ExaSet_ChangeSetTitle (void);
|
||||||
void ExaSet_ChangeNumQstsToExam (void);
|
void ExaSet_ChangeNumQstsToExam (void);
|
||||||
|
|
||||||
unsigned ExaSet_GetNumSetsExam (long ExaCod);
|
unsigned Exa_DB_GetNumSetsExam (long ExaCod);
|
||||||
unsigned ExaSet_GetNumQstsExam (long ExaCod);
|
unsigned Exa_DB_GetNumQstsExam (long ExaCod);
|
||||||
|
|
||||||
void ExaSet_RequestCreatOrEditSet (void);
|
void ExaSet_RequestCreatOrEditSet (void);
|
||||||
void ExaSet_ReqSelectQstsToAddToSet (void);
|
void ExaSet_ReqSelectQstsToAddToSet (void);
|
||||||
|
|
4416
swad_figure.c
4416
swad_figure.c
File diff suppressed because it is too large
Load Diff
2185
swad_file_browser.c
2185
swad_file_browser.c
File diff suppressed because it is too large
Load Diff
|
@ -217,7 +217,7 @@ void Brw_RecLinkFileBrowser (void);
|
||||||
void Brw_SetDocumentAsVisible (void);
|
void Brw_SetDocumentAsVisible (void);
|
||||||
void Brw_SetDocumentAsHidden (void);
|
void Brw_SetDocumentAsHidden (void);
|
||||||
bool Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Brw_FileType_t FileType,const char *Path);
|
bool Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Brw_FileType_t FileType,const char *Path);
|
||||||
bool Brw_CheckIfFileOrFolderIsHidden (struct FileMetadata *FileMetadata);
|
bool Brw_DB_CheckIfFileOrFolderIsHidden (struct FileMetadata *FileMetadata);
|
||||||
void Brw_ShowFileMetadata (void);
|
void Brw_ShowFileMetadata (void);
|
||||||
void Brw_DownloadFile (void);
|
void Brw_DownloadFile (void);
|
||||||
void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char *URL);
|
void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char *URL);
|
||||||
|
@ -228,9 +228,9 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata);
|
||||||
bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata);
|
bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata);
|
||||||
void Brw_GetAndUpdateFileViews (struct FileMetadata *FileMetadata);
|
void Brw_GetAndUpdateFileViews (struct FileMetadata *FileMetadata);
|
||||||
void Brw_UpdateMyFileViews (long FilCod);
|
void Brw_UpdateMyFileViews (long FilCod);
|
||||||
unsigned Brw_GetNumFileViewsUsr (long UsrCod);
|
unsigned Brw_DB_GetNumFileViewsUsr (long UsrCod);
|
||||||
unsigned Brw_GetNumFilesUsr (long UsrCod);
|
unsigned Brw_DB_GetNumFilesUsr (long UsrCod);
|
||||||
unsigned Brw_GetNumPublicFilesUsr (long UsrCod);
|
unsigned Brw_DB_GetNumPublicFilesUsr (long UsrCod);
|
||||||
|
|
||||||
long Brw_GetCodForFiles (void);
|
long Brw_GetCodForFiles (void);
|
||||||
void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
|
void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
|
||||||
|
@ -246,7 +246,7 @@ long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
||||||
|
|
||||||
bool Brw_CheckIfICanViewProjectFiles (long PrjCod);
|
bool Brw_CheckIfICanViewProjectFiles (long PrjCod);
|
||||||
|
|
||||||
void Brw_RemoveExpiredExpandedFolders (void);
|
void Brw_DB_RemoveExpiredExpandedFolders (void);
|
||||||
|
|
||||||
void Brw_CalcSizeOfDir (char *Path);
|
void Brw_CalcSizeOfDir (char *Path);
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ extern struct Globals Gbl;
|
||||||
/****************************** Private prototypes ***************************/
|
/****************************** Private prototypes ***************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Fir_BanIP (void);
|
static void Fir_DB_BanIP (void);
|
||||||
|
|
||||||
static void Fir_WriteHTML (const char *Title,const char *H1);
|
static void Fir_WriteHTML (const char *Title,const char *H1);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ static void Fir_WriteHTML (const char *Title,const char *H1);
|
||||||
/************************** Log access into firewall *************************/
|
/************************** Log access into firewall *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Fir_LogAccess (void)
|
void Fir_DB_LogAccess (void)
|
||||||
{
|
{
|
||||||
/***** Log access in firewall recent log *****/
|
/***** Log access in firewall recent log *****/
|
||||||
DB_QueryINSERT ("can not log access into firewall_log",
|
DB_QueryINSERT ("can not log access into firewall_log",
|
||||||
|
@ -82,7 +82,7 @@ void Fir_LogAccess (void)
|
||||||
/********************** Remove old clicks from firewall **********************/
|
/********************** Remove old clicks from firewall **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Fir_PurgeFirewall (void)
|
void Fir_DB_PurgeFirewall (void)
|
||||||
{
|
{
|
||||||
/***** Remove old clicks *****/
|
/***** Remove old clicks *****/
|
||||||
DB_QueryDELETE ("can not purge firewall log",
|
DB_QueryDELETE ("can not purge firewall log",
|
||||||
|
@ -150,7 +150,7 @@ void Fir_CheckFirewallAndExitIfTooManyRequests (void)
|
||||||
if (NumClicks > Fw_MAX_CLICKS_IN_INTERVAL)
|
if (NumClicks > Fw_MAX_CLICKS_IN_INTERVAL)
|
||||||
{
|
{
|
||||||
/* Ban this IP */
|
/* Ban this IP */
|
||||||
Fir_BanIP ();
|
Fir_DB_BanIP ();
|
||||||
|
|
||||||
/* Return status 429 Too Many Requests */
|
/* Return status 429 Too Many Requests */
|
||||||
fprintf (stdout,"Content-Type: text/html; charset=windows-1252\n"
|
fprintf (stdout,"Content-Type: text/html; charset=windows-1252\n"
|
||||||
|
@ -169,7 +169,7 @@ void Fir_CheckFirewallAndExitIfTooManyRequests (void)
|
||||||
/********************************* Ban an IP *********************************/
|
/********************************* Ban an IP *********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Fir_BanIP (void)
|
static void Fir_DB_BanIP (void)
|
||||||
{
|
{
|
||||||
/***** Insert IP into table of banned IPs *****/
|
/***** Insert IP into table of banned IPs *****/
|
||||||
DB_QueryINSERT ("can not ban IP",
|
DB_QueryINSERT ("can not ban IP",
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
/***************************** Public prototypes *****************************/
|
/***************************** Public prototypes *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Fir_LogAccess (void);
|
void Fir_DB_LogAccess (void);
|
||||||
void Fir_PurgeFirewall (void);
|
void Fir_DB_PurgeFirewall (void);
|
||||||
|
|
||||||
void Fir_CheckFirewallAndExitIfBanned (void);
|
void Fir_CheckFirewallAndExitIfBanned (void);
|
||||||
void Fir_CheckFirewallAndExitIfTooManyRequests (void);
|
void Fir_CheckFirewallAndExitIfTooManyRequests (void);
|
||||||
|
|
1122
swad_forum.c
1122
swad_forum.c
File diff suppressed because it is too large
Load Diff
24
swad_forum.h
24
swad_forum.h
|
@ -122,7 +122,7 @@ void For_DisablePost (void);
|
||||||
|
|
||||||
void For_GetForumTypeAndLocationOfAPost (long PstCod,struct For_Forum *Forum);
|
void For_GetForumTypeAndLocationOfAPost (long PstCod,struct For_Forum *Forum);
|
||||||
|
|
||||||
unsigned For_GetNumPostsUsr (long UsrCod);
|
unsigned For_DB_GetNumPostsUsr (long UsrCod);
|
||||||
void For_DB_RemoveUsrFromReadThrs (long UsrCod);
|
void For_DB_RemoveUsrFromReadThrs (long UsrCod);
|
||||||
|
|
||||||
void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||||
|
@ -142,12 +142,24 @@ void For_SetForumName (const struct For_Forum *Forum,
|
||||||
Lan_Language_t Language,bool UseHTMLEntities);
|
Lan_Language_t Language,bool UseHTMLEntities);
|
||||||
|
|
||||||
void For_ShowForumTheads (void);
|
void For_ShowForumTheads (void);
|
||||||
unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
||||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod);
|
long CtyCod,
|
||||||
unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
long InsCod,
|
||||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod);
|
long CtrCod,
|
||||||
|
long DegCod,
|
||||||
|
long CrsCod);
|
||||||
|
unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
||||||
|
long CtyCod,
|
||||||
|
long InsCod,
|
||||||
|
long CtrCod,
|
||||||
|
long DegCod,
|
||||||
|
long CrsCod);
|
||||||
unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
|
unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
|
||||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
|
long CtyCod,
|
||||||
|
long InsCod,
|
||||||
|
long CtrCod,
|
||||||
|
long DegCod,
|
||||||
|
long CrsCod,
|
||||||
unsigned *NumUsrsToBeNotifiedByEMail);
|
unsigned *NumUsrsToBeNotifiedByEMail);
|
||||||
|
|
||||||
void For_ShowThreadPosts (void);
|
void For_ShowThreadPosts (void);
|
||||||
|
|
1405
swad_group.c
1405
swad_group.c
File diff suppressed because it is too large
Load Diff
12
swad_group.h
12
swad_group.h
|
@ -184,7 +184,7 @@ void Grp_ListGrpsToEditAsgAttSvyEvtMch (struct GroupType *GrpTyp,
|
||||||
Grp_WhichIsAssociatedToGrp_t WhichIsAssociatedToGrp,
|
Grp_WhichIsAssociatedToGrp_t WhichIsAssociatedToGrp,
|
||||||
long Cod);
|
long Cod);
|
||||||
|
|
||||||
bool Grp_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod);
|
bool Grp_DB_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod);
|
||||||
void Grp_ReqRegisterInGrps (void);
|
void Grp_ReqRegisterInGrps (void);
|
||||||
void Grp_ShowLstGrpsToChgMyGrps (void);
|
void Grp_ShowLstGrpsToChgMyGrps (void);
|
||||||
void Grp_ShowLstGrpsToChgOtherUsrsGrps (long UsrCod);
|
void Grp_ShowLstGrpsToChgOtherUsrsGrps (long UsrCod);
|
||||||
|
@ -193,12 +193,12 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes);
|
||||||
void Grp_FreeListGrpTypesAndGrps (void);
|
void Grp_FreeListGrpTypesAndGrps (void);
|
||||||
void Grp_OpenGroupsAutomatically (void);
|
void Grp_OpenGroupsAutomatically (void);
|
||||||
void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes);
|
void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes);
|
||||||
unsigned Grp_CountNumGrpsInCurrentCrs (void);
|
unsigned Grp_DB_CountNumGrpsInCurrentCrs (void);
|
||||||
unsigned Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res);
|
unsigned Grp_DB_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res);
|
||||||
void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat);
|
void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat);
|
||||||
bool Grp_CheckIfGroupExists (long GrpCod);
|
bool Grp_DB_CheckIfGroupExists (long GrpCod);
|
||||||
bool Grp_CheckIfGroupBelongsToCourse (long GrpCod,long CrsCod);
|
bool Grp_DB_CheckIfGrpBelongsToCrs (long GrpCod,long CrsCod);
|
||||||
unsigned Grp_CountNumUsrsInGrp (Rol_Role_t Role,long GrpCod);
|
unsigned Grp_DB_CountNumUsrsInGrp (Rol_Role_t Role,long GrpCod);
|
||||||
|
|
||||||
void Grp_FlushCacheIBelongToGrp (void);
|
void Grp_FlushCacheIBelongToGrp (void);
|
||||||
bool Grp_GetIfIBelongToGrp (long GrpCod);
|
bool Grp_GetIfIBelongToGrp (long GrpCod);
|
||||||
|
|
|
@ -617,7 +617,7 @@ void Hie_InitHierarchy (void)
|
||||||
|
|
||||||
/***** Count number of groups in current course
|
/***** Count number of groups in current course
|
||||||
(used in some actions) *****/
|
(used in some actions) *****/
|
||||||
Gbl.Crs.Grps.NumGrps = Grp_CountNumGrpsInCurrentCrs ();
|
Gbl.Crs.Grps.NumGrps = Grp_DB_CountNumGrpsInCurrentCrs ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1451,7 +1451,7 @@ void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
|
||||||
IndicatorsCrs->NumIndicators++;
|
IndicatorsCrs->NumIndicators++;
|
||||||
|
|
||||||
/***** Indicator #3: information about online tutoring *****/
|
/***** Indicator #3: information about online tutoring *****/
|
||||||
IndicatorsCrs->NumThreads = For_GetNumTotalThrsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod);
|
IndicatorsCrs->NumThreads = For_DB_GetNumTotalThrsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod);
|
||||||
IndicatorsCrs->NumPosts = For_GetNumTotalPstsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod,&(IndicatorsCrs->NumUsrsToBeNotifiedByEMail));
|
IndicatorsCrs->NumPosts = For_GetNumTotalPstsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod,&(IndicatorsCrs->NumUsrsToBeNotifiedByEMail));
|
||||||
IndicatorsCrs->NumMsgsSentByTchs = Msg_GetNumMsgsSentByTchsCrs (CrsCod);
|
IndicatorsCrs->NumMsgsSentByTchs = Msg_GetNumMsgsSentByTchsCrs (CrsCod);
|
||||||
IndicatorsCrs->ThereIsOnlineTutoring = (IndicatorsCrs->NumThreads != 0) ||
|
IndicatorsCrs->ThereIsOnlineTutoring = (IndicatorsCrs->NumThreads != 0) ||
|
||||||
|
|
|
@ -1436,11 +1436,11 @@ void Lay_RefreshNotifsAndConnected (void)
|
||||||
if (!(Gbl.PID % 11))
|
if (!(Gbl.PID % 11))
|
||||||
Ntf_SendPendingNotifByEMailToAllUsrs (); // Send pending notifications by email
|
Ntf_SendPendingNotifByEMailToAllUsrs (); // Send pending notifications by email
|
||||||
else if (!(Gbl.PID % 19))
|
else if (!(Gbl.PID % 19))
|
||||||
Fir_PurgeFirewall (); // Remove old clicks from firewall
|
Fir_DB_PurgeFirewall (); // Remove old clicks from firewall
|
||||||
else if (!(Gbl.PID % 23))
|
else if (!(Gbl.PID % 23))
|
||||||
Fil_RemoveOldTmpFiles (Cfg_PATH_FILE_BROWSER_TMP_PUBLIC ,Cfg_TIME_TO_DELETE_BROWSER_TMP_FILES ,false); // Remove the oldest temporary public directories used for downloading
|
Fil_RemoveOldTmpFiles (Cfg_PATH_FILE_BROWSER_TMP_PUBLIC ,Cfg_TIME_TO_DELETE_BROWSER_TMP_FILES ,false); // Remove the oldest temporary public directories used for downloading
|
||||||
else if (!(Gbl.PID % 101))
|
else if (!(Gbl.PID % 101))
|
||||||
Brw_RemoveExpiredExpandedFolders (); // Remove old expanded folders (from all users)
|
Brw_DB_RemoveExpiredExpandedFolders (); // Remove old expanded folders (from all users)
|
||||||
else if (!(Gbl.PID % 103))
|
else if (!(Gbl.PID % 103))
|
||||||
Set_RemoveOldSettingsFromIP (); // Remove old settings from IP
|
Set_RemoveOldSettingsFromIP (); // Remove old settings from IP
|
||||||
else if (!(Gbl.PID % 107))
|
else if (!(Gbl.PID % 107))
|
||||||
|
|
|
@ -117,7 +117,7 @@ int main (void)
|
||||||
|
|
||||||
/***** Mitigate DoS attacks *****/
|
/***** Mitigate DoS attacks *****/
|
||||||
Fir_CheckFirewallAndExitIfBanned ();
|
Fir_CheckFirewallAndExitIfBanned ();
|
||||||
Fir_LogAccess ();
|
Fir_DB_LogAccess ();
|
||||||
Fir_CheckFirewallAndExitIfTooManyRequests ();
|
Fir_CheckFirewallAndExitIfTooManyRequests ();
|
||||||
|
|
||||||
Hie_InitHierarchy ();
|
Hie_InitHierarchy ();
|
||||||
|
|
|
@ -614,7 +614,7 @@ void Mrk_ShowMyMarks (void)
|
||||||
/* Select a random student from the course */
|
/* Select a random student from the course */
|
||||||
if (Gbl.Crs.Grps.GrpCod > 0) // Group zone
|
if (Gbl.Crs.Grps.GrpCod > 0) // Group zone
|
||||||
{
|
{
|
||||||
if (Grp_CountNumUsrsInGrp (Rol_STD,Gbl.Crs.Grps.GrpCod)) // If there are students in this group
|
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_GetRamdomStdFromGrp (Gbl.Crs.Grps.GrpCod);
|
||||||
UsrDat = &Gbl.Usrs.Other.UsrDat;
|
UsrDat = &Gbl.Usrs.Other.UsrDat;
|
||||||
|
|
|
@ -1594,7 +1594,7 @@ static void Mch_ShowLstGrpsToEditMatch (long MchCod)
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Grp_CheckIfAssociatedToGrps ("mch_groups","MchCod",MchCod) ? "" :
|
Grp_DB_CheckIfAssociatedToGrps ("mch_groups","MchCod",MchCod) ? "" :
|
||||||
" checked=\"checked\"");
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
|
|
|
@ -578,8 +578,8 @@ static void Prf_ShowNumFilesCurrentlyPublished (const struct UsrData *UsrDat)
|
||||||
unsigned NumPublicFiles;
|
unsigned NumPublicFiles;
|
||||||
|
|
||||||
/***** Number of files currently published *****/
|
/***** Number of files currently published *****/
|
||||||
if ((NumFiles = Brw_GetNumFilesUsr (UsrDat->UsrCod)))
|
if ((NumFiles = Brw_DB_GetNumFilesUsr (UsrDat->UsrCod)))
|
||||||
NumPublicFiles = Brw_GetNumPublicFilesUsr (UsrDat->UsrCod);
|
NumPublicFiles = Brw_DB_GetNumPublicFilesUsr (UsrDat->UsrCod);
|
||||||
else
|
else
|
||||||
NumPublicFiles = 0;
|
NumPublicFiles = 0;
|
||||||
|
|
||||||
|
@ -1177,7 +1177,7 @@ static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
|
||||||
Prf_ResetUsrFigures (&UsrFigures);
|
Prf_ResetUsrFigures (&UsrFigures);
|
||||||
|
|
||||||
/***** Get number of file views from database *****/
|
/***** Get number of file views from database *****/
|
||||||
UsrFigures.NumFileViews = (long) Brw_GetNumFileViewsUsr (UsrCod);
|
UsrFigures.NumFileViews = (long) Brw_DB_GetNumFileViewsUsr (UsrCod);
|
||||||
|
|
||||||
/***** Update number of file views in user's figures *****/
|
/***** Update number of file views in user's figures *****/
|
||||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||||
|
@ -1206,7 +1206,7 @@ static void Prf_GetNumForumPostsAndStoreAsUsrFigure (long UsrCod)
|
||||||
Prf_ResetUsrFigures (&UsrFigures);
|
Prf_ResetUsrFigures (&UsrFigures);
|
||||||
|
|
||||||
/***** Get number of forum posts from database *****/
|
/***** Get number of forum posts from database *****/
|
||||||
UsrFigures.NumForPst = For_GetNumPostsUsr (UsrCod);
|
UsrFigures.NumForPst = For_DB_GetNumPostsUsr (UsrCod);
|
||||||
|
|
||||||
/***** Update number of forum posts in user's figures *****/
|
/***** Update number of forum posts in user's figures *****/
|
||||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||||
|
|
|
@ -655,8 +655,8 @@ static void Rep_WriteSectionUsrFigures (const struct Rep_Report *Report)
|
||||||
fprintf (Gbl.F.Rep,"</li>");
|
fprintf (Gbl.F.Rep,"</li>");
|
||||||
|
|
||||||
/***** Number of files currently published *****/
|
/***** Number of files currently published *****/
|
||||||
if ((NumFiles = Brw_GetNumFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod)))
|
if ((NumFiles = Brw_DB_GetNumFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod)))
|
||||||
NumPublicFiles = Brw_GetNumPublicFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod);
|
NumPublicFiles = Brw_DB_GetNumPublicFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
else
|
else
|
||||||
NumPublicFiles = 0;
|
NumPublicFiles = 0;
|
||||||
fprintf (Gbl.F.Rep,"<li>"
|
fprintf (Gbl.F.Rep,"<li>"
|
||||||
|
|
|
@ -428,6 +428,22 @@ void Set_DB_InsertUsrInCrsSettings (long UsrCod,long CrsCod)
|
||||||
'N');
|
'N');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******** Update the group of my last access to a file browser zone **********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Set_DB_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod)
|
||||||
|
{
|
||||||
|
DB_QueryUPDATE ("can not update the group of the last access to a file browser",
|
||||||
|
"UPDATE crs_user_settings"
|
||||||
|
" SET %s=%ld"
|
||||||
|
" WHERE UsrCod=%ld"
|
||||||
|
" AND CrsCod=%ld",
|
||||||
|
FieldNameDB,GrpCod,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************** Remove a user from a courses setting *********************/
|
/****************** Remove a user from a courses setting *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -59,6 +59,9 @@ void Set_BeginOneSettingSelector (void);
|
||||||
void Set_EndOneSettingSelector (void);
|
void Set_EndOneSettingSelector (void);
|
||||||
|
|
||||||
void Set_DB_InsertUsrInCrsSettings (long UsrCod,long CrsCod);
|
void Set_DB_InsertUsrInCrsSettings (long UsrCod,long CrsCod);
|
||||||
|
|
||||||
|
void Set_DB_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod);
|
||||||
|
|
||||||
void Set_DB_RemUsrFromCrsSettings (long UsrCod,long CrsCod);
|
void Set_DB_RemUsrFromCrsSettings (long UsrCod,long CrsCod);
|
||||||
void Set_DB_RemUsrFromAllCrssSettings (long UsrCod);
|
void Set_DB_RemUsrFromAllCrssSettings (long UsrCod);
|
||||||
void Set_DB_RemAllUsrsFromCrsSettings (long CrsCod);
|
void Set_DB_RemAllUsrsFromCrsSettings (long CrsCod);
|
||||||
|
|
|
@ -2155,7 +2155,7 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod)
|
||||||
HTM_LABEL_Begin (NULL);
|
HTM_LABEL_Begin (NULL);
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s onclick=\"uncheckChildren(this,'GrpCods')\"",
|
"id=\"WholeCrs\" value=\"Y\"%s onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Grp_CheckIfAssociatedToGrps ("svy_groups","SvyCod",SvyCod) ? "" :
|
Grp_DB_CheckIfAssociatedToGrps ("svy_groups","SvyCod",SvyCod) ? "" :
|
||||||
" checked=\"checked\"");
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
|
|
92
swad_user.c
92
swad_user.c
|
@ -10386,3 +10386,95 @@ unsigned Usr_DB_GetOldUsrs (MYSQL_RES **mysql_res,time_t SecondsWithoutAccess)
|
||||||
" FROM crs_users)",
|
" FROM crs_users)",
|
||||||
(unsigned long long) SecondsWithoutAccess);
|
(unsigned long long) SecondsWithoutAccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************** Get number of users who have chosen an option ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Usr_DB_GetNumUsrsWhoChoseAnOption (const char *SubQuery)
|
||||||
|
{
|
||||||
|
switch (Gbl.Scope.Current)
|
||||||
|
{
|
||||||
|
case HieLvl_SYS:
|
||||||
|
return (unsigned)
|
||||||
|
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||||
|
"SELECT COUNT(*)"
|
||||||
|
" FROM usr_data WHERE %s",
|
||||||
|
SubQuery);
|
||||||
|
case HieLvl_CTY:
|
||||||
|
return (unsigned)
|
||||||
|
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||||
|
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||||
|
" FROM ins_instits,"
|
||||||
|
"ctr_centers,"
|
||||||
|
"deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE ins_instits.CtyCod=%ld"
|
||||||
|
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||||
|
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND %s",
|
||||||
|
Gbl.Hierarchy.Cty.CtyCod,SubQuery);
|
||||||
|
case HieLvl_INS:
|
||||||
|
return (unsigned)
|
||||||
|
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||||
|
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||||
|
" FROM ctr_centers,"
|
||||||
|
"deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE ctr_centers.InsCod=%ld"
|
||||||
|
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND %s",
|
||||||
|
Gbl.Hierarchy.Ins.InsCod,SubQuery);
|
||||||
|
case HieLvl_CTR:
|
||||||
|
return (unsigned)
|
||||||
|
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||||
|
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE deg_degrees.CtrCod=%ld"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND %s",
|
||||||
|
Gbl.Hierarchy.Ctr.CtrCod,SubQuery);
|
||||||
|
case HieLvl_DEG:
|
||||||
|
return (unsigned)
|
||||||
|
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||||
|
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||||
|
" FROM crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE crs_courses.DegCod=%ld"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND %s",
|
||||||
|
Gbl.Hierarchy.Deg.DegCod,SubQuery);
|
||||||
|
case HieLvl_CRS:
|
||||||
|
return (unsigned)
|
||||||
|
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||||
|
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||||
|
" FROM crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE crs_users.CrsCod=%ld"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND %s",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,SubQuery);
|
||||||
|
default:
|
||||||
|
Err_WrongScopeExit ();
|
||||||
|
return 0; // Not reached
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0; // Not reached
|
||||||
|
}
|
||||||
|
|
|
@ -554,4 +554,6 @@ Usr_Who_t Usr_GetHiddenParamWho (void);
|
||||||
|
|
||||||
unsigned Usr_DB_GetOldUsrs (MYSQL_RES **mysql_res,time_t SecondsWithoutAccess);
|
unsigned Usr_DB_GetOldUsrs (MYSQL_RES **mysql_res,time_t SecondsWithoutAccess);
|
||||||
|
|
||||||
|
unsigned Usr_DB_GetNumUsrsWhoChoseAnOption (const char *SubQuery);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue