mirror of https://github.com/acanas/swad-core.git
Version 22.36: Sep 30, 2022 Code refactoring in exams.
This commit is contained in:
parent
114f552583
commit
1a1a46dd5b
|
@ -606,11 +606,12 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate
|
|||
|
||||
TODO: Attach pdf files in multimedia.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.35 (2022-09-30)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.36 (2022-09-30)"
|
||||
#define CSS_FILE "swad22.35.css"
|
||||
#define JS_FILE "swad21.100.js"
|
||||
/*
|
||||
Version 22.35: Sep 30, 2022 Changes in layout of projects. (? lines)
|
||||
Version 22.36: Sep 30, 2022 Code refactoring in exams. (332589 lines)
|
||||
Version 22.35: Sep 30, 2022 Changes in layout of projects. (332690 lines)
|
||||
Version 22.34: Sep 29, 2022 Changes in layout of assignments. (332721 lines)
|
||||
Version 22.33.4: Sep 29, 2022 Code refactoring in program resources. (332711 lines)
|
||||
Version 22.33.3: Sep 29, 2022 Fixed layout of marks file metadata. (332709 lines)
|
||||
|
|
209
swad_exam.c
209
swad_exam.c
|
@ -112,16 +112,14 @@ static void Exa_PutIconToCreateNewExam (struct Exa_Exams *Exams);
|
|||
static void Exa_PutButtonToCreateNewExam (struct Exa_Exams *Exams);
|
||||
static void Exa_PutParamsToCreateNewExam (void *Exams);
|
||||
|
||||
static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,bool ShowOnlyThisExam);
|
||||
static void Exa_ShowOneExam (struct Exa_Exams *Exams,bool ShowOnlyThisExam);
|
||||
|
||||
static void Exa_PutIconToShowResultsOfExam (void *Exams);
|
||||
static void Exa_PutIconsOneExam (void *Exams);
|
||||
static void Exa_WriteAuthor (struct Exa_Exam *Exam);
|
||||
|
||||
static void Exa_PutHiddenParamExamOrder (Exa_Order_t SelectedOrder);
|
||||
|
||||
static void Exa_PutIconsToRemEditOneExam (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
const char *Anchor);
|
||||
|
||||
static void Exa_PutHiddenParamOrder (Exa_Order_t SelectedOrder);
|
||||
|
@ -157,7 +155,7 @@ void Exa_ResetExams (struct Exa_Exams *Exams)
|
|||
Exams->CurrentPage = 0;
|
||||
Exams->ListQuestions = NULL;
|
||||
Exams->ExaCodsSelected = NULL; // String with selected exam codes separated by separator multiple
|
||||
Exams->ExaCod = -1L; // Selected/current exam code
|
||||
Exams->Exam.ExaCod = -1L; // Selected/current exam code
|
||||
Exams->SesCod = -1L; // Selected/current session code
|
||||
Exams->SetInd = 0; // Current set index
|
||||
Exams->QstCod = -1L; // Current question code
|
||||
|
@ -218,7 +216,6 @@ void Exa_ListAllExams (struct Exa_Exams *Exams)
|
|||
Exa_Order_t Order;
|
||||
struct Pagination Pagination;
|
||||
unsigned NumExam;
|
||||
struct Exa_Exam Exam;
|
||||
|
||||
/***** Get number of groups in current course *****/
|
||||
if (!Gbl.Crs.Grps.NumGrps)
|
||||
|
@ -283,13 +280,11 @@ void Exa_ListAllExams (struct Exa_Exams *Exams)
|
|||
NumExam++)
|
||||
{
|
||||
/* Get data of this exam */
|
||||
Exam.ExaCod = Exams->Lst[NumExam - 1].ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams->ExaCod = Exam.ExaCod;
|
||||
Exams->Exam.ExaCod = Exams->Lst[NumExam - 1].ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams->Exam);
|
||||
|
||||
/* Show exam */
|
||||
Exa_ShowOneExam (Exams,
|
||||
&Exam,
|
||||
false); // Do not show only this exam
|
||||
}
|
||||
|
||||
|
@ -408,26 +403,23 @@ static void Exa_PutParamsToCreateNewExam (void *Exams)
|
|||
void Exa_SeeOneExam (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
|
||||
/***** Get exam data *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Show exam *****/
|
||||
Exa_ShowOnlyOneExam (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExam (&Exams,&Session,
|
||||
false); // Do not put form for session
|
||||
}
|
||||
|
||||
|
@ -436,16 +428,14 @@ void Exa_SeeOneExam (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSes_Session *Session,
|
||||
bool PutFormSession)
|
||||
{
|
||||
Exa_ShowOnlyOneExamBegin (Exams,Exam,Session,PutFormSession);
|
||||
Exa_ShowOnlyOneExamBegin (Exams,Session,PutFormSession);
|
||||
Exa_ShowOnlyOneExamEnd ();
|
||||
}
|
||||
|
||||
void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSes_Session *Session,
|
||||
bool PutFormSession)
|
||||
{
|
||||
|
@ -453,18 +443,16 @@ void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams,
|
|||
extern const char *Txt_Exam;
|
||||
|
||||
/***** Begin box *****/
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
Box_BoxBegin (NULL,Txt_Exam,
|
||||
Exa_PutIconToShowResultsOfExam,Exams,
|
||||
Exa_PutIconsOneExam,Exams,
|
||||
Hlp_ASSESSMENT_Exams,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Show exam *****/
|
||||
Exa_ShowOneExam (Exams,
|
||||
Exam,
|
||||
true); // Show only this exam
|
||||
|
||||
/***** List sessions *****/
|
||||
ExaSes_ListSessions (Exams,Exam,Session,PutFormSession);
|
||||
ExaSes_ListSessions (Exams,Session,PutFormSession);
|
||||
}
|
||||
|
||||
void Exa_ShowOnlyOneExamEnd (void)
|
||||
|
@ -473,8 +461,7 @@ void Exa_ShowOnlyOneExamEnd (void)
|
|||
Box_BoxEnd ();
|
||||
}
|
||||
|
||||
static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,bool ShowOnlyThisExam)
|
||||
static void Exa_ShowOneExam (struct Exa_Exams *Exams,bool ShowOnlyThisExam)
|
||||
{
|
||||
extern const char *Txt_View_exam;
|
||||
extern const char *Txt_Sets_of_questions;
|
||||
|
@ -489,7 +476,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
|||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||
|
||||
/***** Build anchor string *****/
|
||||
Frm_SetAnchorStr (Exam->ExaCod,&Anchor);
|
||||
Frm_SetAnchorStr (Exams->Exam.ExaCod,&Anchor);
|
||||
|
||||
/***** Begin box and table *****/
|
||||
if (ShowOnlyThisExam)
|
||||
|
@ -508,7 +495,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
|||
The_GetColorRows ());
|
||||
|
||||
/* Icons to remove/edit this exam */
|
||||
Exa_PutIconsToRemEditOneExam (Exams,Exam,Anchor);
|
||||
Exa_PutIconsToRemEditOneExam (Exams,Anchor);
|
||||
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
@ -521,18 +508,18 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
|||
{
|
||||
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");
|
||||
Color = Exams->Exam.NumOpenSess ? (Exams->Exam.Hidden ? "DATE_GREEN_LIGHT":
|
||||
"DATE_GREEN") :
|
||||
(Exams->Exam.Hidden ? "DATE_RED_LIGHT":
|
||||
"DATE_RED");
|
||||
if (ShowOnlyThisExam)
|
||||
HTM_TD_Begin ("id=\"%s\" class=\"LT %s_%s\"",
|
||||
Id,Color,The_GetSuffix ());
|
||||
else
|
||||
HTM_TD_Begin ("id=\"%s\" class=\"LT %s_%s %s\"",
|
||||
Id,Color,The_GetSuffix (),The_GetColorRows ());
|
||||
if (Exam->TimeUTC[Dat_STR_TIME])
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Exam->TimeUTC[StartEndTime],
|
||||
if (Exams->Exam.TimeUTC[Dat_STR_TIME])
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Exams->Exam.TimeUTC[StartEndTime],
|
||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||
true,true,true,0x6);
|
||||
HTM_TD_End ();
|
||||
|
@ -546,32 +533,31 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
|||
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
||||
|
||||
/* Exam title */
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
HTM_ARTICLE_Begin (Anchor);
|
||||
Frm_BeginForm (ActSeeExa);
|
||||
Exa_PutParams (Exams);
|
||||
HTM_BUTTON_Submit_Begin (Txt_View_exam,"class=\"LT BT_LINK %s_%s\"",
|
||||
Exam->Hidden ? "ASG_TITLE_LIGHT":
|
||||
"ASG_TITLE",
|
||||
Exams->Exam.Hidden ? "ASG_TITLE_LIGHT":
|
||||
"ASG_TITLE",
|
||||
The_GetSuffix ());
|
||||
HTM_Txt (Exam->Title);
|
||||
HTM_Txt (Exams->Exam.Title);
|
||||
HTM_BUTTON_End ();
|
||||
Frm_EndForm ();
|
||||
HTM_ARTICLE_End ();
|
||||
|
||||
/* Number of questions, maximum grade, visibility of results */
|
||||
HTM_DIV_Begin ("class=\"%s_%s\"",
|
||||
Exam->Hidden ? "ASG_GRP_LIGHT" :
|
||||
"ASG_GRP",
|
||||
Exams->Exam.Hidden ? "ASG_GRP_LIGHT" :
|
||||
"ASG_GRP",
|
||||
The_GetSuffix ());
|
||||
HTM_TxtColonNBSP (Txt_Sets_of_questions);
|
||||
HTM_Unsigned (Exam->NumSets);
|
||||
HTM_Unsigned (Exams->Exam.NumSets);
|
||||
HTM_BR ();
|
||||
HTM_TxtColonNBSP (Txt_Maximum_grade);
|
||||
HTM_Double (Exam->MaxGrade);
|
||||
HTM_Double (Exams->Exam.MaxGrade);
|
||||
HTM_BR ();
|
||||
HTM_TxtColonNBSP (Txt_Result_visibility);
|
||||
TstVis_ShowVisibilityIcons (Exam->Visibility,Exam->Hidden);
|
||||
TstVis_ShowVisibilityIcons (Exams->Exam.Visibility,Exams->Exam.Hidden);
|
||||
HTM_DIV_End ();
|
||||
|
||||
/***** Number of sessions in exam *****/
|
||||
|
@ -580,16 +566,15 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
|||
else
|
||||
HTM_TD_Begin ("class=\"RT %s\"",The_GetColorRows ());
|
||||
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
Frm_BeginForm (ActSeeExa);
|
||||
Exa_PutParams (Exams);
|
||||
HTM_BUTTON_Submit_Begin (Txt_Sessions,"class=\"LT BT_LINK %s_%s\"",
|
||||
Exam->Hidden ? "ASG_TITLE_LIGHT":
|
||||
"ASG_TITLE",
|
||||
Exams->Exam.Hidden ? "ASG_TITLE_LIGHT":
|
||||
"ASG_TITLE",
|
||||
The_GetSuffix ());
|
||||
if (ShowOnlyThisExam)
|
||||
HTM_TxtColonNBSP (Txt_Sessions);
|
||||
HTM_Unsigned (Exam->NumSess);
|
||||
HTM_Unsigned (Exams->Exam.NumSess);
|
||||
HTM_BUTTON_End ();
|
||||
Frm_EndForm ();
|
||||
|
||||
|
@ -607,7 +592,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
|||
else
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",
|
||||
The_GetColorRows ());
|
||||
Exa_WriteAuthor (Exam);
|
||||
Exa_WriteAuthor (&Exams->Exam);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Text of the exam *****/
|
||||
|
@ -616,13 +601,13 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
|||
else
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",
|
||||
The_GetColorRows ());
|
||||
Exa_DB_GetExamTxt (Exam->ExaCod,Txt);
|
||||
Exa_DB_GetExamTxt (Exams->Exam.ExaCod,Txt);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
||||
ALn_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
HTM_DIV_Begin ("class=\"PAR %s_%s\"",
|
||||
Exam->Hidden ? "DAT_LIGHT" :
|
||||
"DAT",
|
||||
Exams->Exam.Hidden ? "DAT_LIGHT" :
|
||||
"DAT",
|
||||
The_GetSuffix ());
|
||||
HTM_Txt (Txt);
|
||||
HTM_DIV_End ();
|
||||
|
@ -645,7 +630,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
|||
/************ Put icon to show results of sessions in an exam ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Exa_PutIconToShowResultsOfExam (void *Exams)
|
||||
static void Exa_PutIconsOneExam (void *Exams)
|
||||
{
|
||||
static const Act_Action_t NextAction[Rol_NUM_ROLES] =
|
||||
{
|
||||
|
@ -657,7 +642,7 @@ static void Exa_PutIconToShowResultsOfExam (void *Exams)
|
|||
|
||||
if (Exams)
|
||||
{
|
||||
/***** Put icon to view sessions results *****/
|
||||
/***** Put icon to view results of sessions in exam *****/
|
||||
if (NextAction[Gbl.Usrs.Me.Role.Logged])
|
||||
Ico_PutContextualIconToShowResults (NextAction[Gbl.Usrs.Me.Role.Logged],ExaRes_RESULTS_BOX_ID,
|
||||
Exa_PutParams,Exams);
|
||||
|
@ -692,7 +677,6 @@ static void Exa_PutHiddenParamExamOrder (Exa_Order_t SelectedOrder)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Exa_PutIconsToRemEditOneExam (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
const char *Anchor)
|
||||
{
|
||||
static Act_Action_t ActionHideUnhide[2] =
|
||||
|
@ -700,8 +684,13 @@ static void Exa_PutIconsToRemEditOneExam (struct Exa_Exams *Exams,
|
|||
[false] = ActHidExa, // Visible ==> action to hide
|
||||
[true ] = ActUnhExa, // Hidden ==> action to unhide
|
||||
};
|
||||
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
static const Act_Action_t NextAction[Rol_NUM_ROLES] =
|
||||
{
|
||||
[Rol_STD ] = ActSeeMyExaResExa,
|
||||
[Rol_NET ] = ActSeeUsrExaResExa,
|
||||
[Rol_TCH ] = ActSeeUsrExaResExa,
|
||||
[Rol_SYS_ADM] = ActSeeUsrExaResExa,
|
||||
};
|
||||
|
||||
/***** Icon to remove exam *****/
|
||||
Ico_PutContextualIconToRemove (ActReqRemExa,NULL,
|
||||
|
@ -710,11 +699,21 @@ static void Exa_PutIconsToRemEditOneExam (struct Exa_Exams *Exams,
|
|||
/***** Icon to hide/unhide exam *****/
|
||||
Ico_PutContextualIconToHideUnhide (ActionHideUnhide,Anchor,
|
||||
Exa_PutParams,Exams,
|
||||
Exam->Hidden);
|
||||
Exams->Exam.Hidden);
|
||||
|
||||
/***** Icon to edit exam *****/
|
||||
Ico_PutContextualIconToEdit (ActEdiOneExa,NULL,
|
||||
Exa_PutParams,Exams);
|
||||
|
||||
/***** Put icon to view results of sessions in exam *****/
|
||||
if (NextAction[Gbl.Usrs.Me.Role.Logged])
|
||||
Ico_PutContextualIconToShowResults (NextAction[Gbl.Usrs.Me.Role.Logged],ExaRes_RESULTS_BOX_ID,
|
||||
Exa_PutParams,Exams);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkExa,NULL,
|
||||
Exa_PutParams,Exams);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -727,8 +726,8 @@ void Exa_PutParams (void *Exams)
|
|||
|
||||
if (Exams)
|
||||
{
|
||||
if (((struct Exa_Exams *) Exams)->ExaCod > 0)
|
||||
Exa_PutParamExamCod (((struct Exa_Exams *) Exams)->ExaCod);
|
||||
if (((struct Exa_Exams *) Exams)->Exam.ExaCod > 0)
|
||||
Exa_PutParamExamCod (((struct Exa_Exams *) Exams)->Exam.ExaCod);
|
||||
Exa_PutHiddenParamOrder (((struct Exa_Exams *) Exams)->SelectedOrder);
|
||||
WhichGroups = Grp_GetParamWhichGroups ();
|
||||
Grp_PutParamWhichGroups (&WhichGroups);
|
||||
|
@ -767,7 +766,7 @@ void Exa_GetParams (struct Exa_Exams *Exams)
|
|||
Exams->CurrentPage = Pag_GetParamPagNum (Pag_EXAMS);
|
||||
|
||||
/***** Get exam code *****/
|
||||
Exams->ExaCod = Exa_GetParamExamCod ();
|
||||
Exams->Exam.ExaCod = Exa_GetParamExamCod ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1004,7 +1003,6 @@ void Exa_AskRemExam (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_exam_X;
|
||||
extern const char *Txt_Remove_exam;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
|
||||
/***** Check if I can edit exams *****/
|
||||
if (!Exa_CheckIfICanEditExams ())
|
||||
|
@ -1012,25 +1010,22 @@ void Exa_AskRemExam (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
|
||||
/***** Get data of the exam from database *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Show question and button to remove exam *****/
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Ale_ShowAlertAndButton (ActRemExa,NULL,NULL,
|
||||
Exa_PutParams,&Exams,
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_exam,
|
||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_exam_X,
|
||||
Exam.Title);
|
||||
Exams.Exam.Title);
|
||||
|
||||
/***** Show exams again *****/
|
||||
Exa_ListAllExams (&Exams);
|
||||
|
@ -1044,7 +1039,6 @@ void Exa_RemoveExam (void)
|
|||
{
|
||||
extern const char *Txt_Exam_X_removed;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
|
||||
/***** Check if I can edit exams *****/
|
||||
if (!Exa_CheckIfICanEditExams ())
|
||||
|
@ -1052,22 +1046,21 @@ void Exa_RemoveExam (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
|
||||
/***** Get exam code *****/
|
||||
if ((Exam.ExaCod = Exa_GetParamExamCod ()) <= 0)
|
||||
if ((Exams.Exam.ExaCod = Exa_GetParamExamCod ()) <= 0)
|
||||
Err_WrongExamExit ();
|
||||
|
||||
/***** Get data of the exam from database *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Remove exam from all tables *****/
|
||||
Exa_RemoveExamFromAllTables (Exam.ExaCod);
|
||||
Exa_RemoveExamFromAllTables (Exams.Exam.ExaCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Exam_X_removed,
|
||||
Exam.Title);
|
||||
Exams.Exam.Title);
|
||||
|
||||
/***** Show exams again *****/
|
||||
Exa_ListAllExams (&Exams);
|
||||
|
@ -1235,7 +1228,6 @@ void Exa_UnhideExam (void)
|
|||
static void Exa_HideUnhideExam (bool Hide)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
|
||||
/***** Check if I can edit exams *****/
|
||||
if (!Exa_CheckIfICanEditExams ())
|
||||
|
@ -1243,20 +1235,18 @@ static void Exa_HideUnhideExam (bool Hide)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
|
||||
/***** Get data of the exam from database *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Unhide exam *****/
|
||||
Exa_DB_HideOrUnhideExam (Exam.ExaCod,Hide);
|
||||
Exa_DB_HideOrUnhideExam (Exams.Exam.ExaCod,Hide);
|
||||
|
||||
/***** Show exams again *****/
|
||||
Exa_ListAllExams (&Exams);
|
||||
|
@ -1269,7 +1259,6 @@ static void Exa_HideUnhideExam (bool Hide)
|
|||
void Exa_RequestCreatOrEditExam (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
bool ItsANewExam;
|
||||
|
||||
|
@ -1279,27 +1268,23 @@ void Exa_RequestCreatOrEditExam (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
ItsANewExam = (Exam.ExaCod <= 0);
|
||||
ItsANewExam = (Exams.Exam.ExaCod <= 0);
|
||||
|
||||
/***** Get exam data *****/
|
||||
if (ItsANewExam)
|
||||
/* Initialize to empty exam */
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
else
|
||||
{
|
||||
/* Get exam data from database */
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
}
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Put form to create/edit an exam and show sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,ItsANewExam);
|
||||
Exa_PutFormsOneExam (&Exams,&Set,ItsANewExam);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1307,7 +1292,6 @@ void Exa_RequestCreatOrEditExam (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Exa_PutFormsOneExam (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSet_Set *Set,
|
||||
bool ItsANewExam)
|
||||
{
|
||||
|
@ -1317,10 +1301,10 @@ void Exa_PutFormsOneExam (struct Exa_Exams *Exams,
|
|||
if (ItsANewExam)
|
||||
Txt[0] = '\0';
|
||||
else
|
||||
Exa_DB_GetExamTxt (Exam->ExaCod,Txt);
|
||||
Exa_DB_GetExamTxt (Exams->Exam.ExaCod,Txt);
|
||||
|
||||
/***** Put form to create/edit an exam *****/
|
||||
Exa_PutFormEditionExam (Exams,Exam,Txt,ItsANewExam);
|
||||
Exa_PutFormEditionExam (Exams,Txt,ItsANewExam);
|
||||
|
||||
/***** Show other lists *****/
|
||||
if (ItsANewExam)
|
||||
|
@ -1328,7 +1312,7 @@ void Exa_PutFormsOneExam (struct Exa_Exams *Exams,
|
|||
Exa_ListAllExams (Exams);
|
||||
else
|
||||
/* Show list of sets */
|
||||
ExaSet_ListExamSets (Exams,Exam,Set);
|
||||
ExaSet_ListExamSets (Exams,Set);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1336,7 +1320,6 @@ void Exa_PutFormsOneExam (struct Exa_Exams *Exams,
|
|||
/*****************************************************************************/
|
||||
|
||||
void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1],
|
||||
bool ItsANewExam)
|
||||
{
|
||||
|
@ -1352,7 +1335,6 @@ void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
|||
extern const char *Txt_Save_changes;
|
||||
|
||||
/***** Begin form *****/
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
Frm_BeginForm (ItsANewExam ? ActNewExa :
|
||||
ActChgExa);
|
||||
Exa_PutParams (Exams);
|
||||
|
@ -1364,8 +1346,8 @@ void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
|||
Hlp_ASSESSMENT_Exams_new_exam,Box_NOT_CLOSABLE,2);
|
||||
else
|
||||
Box_BoxTableBegin (NULL,
|
||||
Exam->Title[0] ? Exam->Title :
|
||||
Txt_Edit_exam,
|
||||
Exams->Exam.Title[0] ? Exams->Exam.Title :
|
||||
Txt_Edit_exam,
|
||||
NULL,NULL,
|
||||
Hlp_ASSESSMENT_Exams_edit_exam,Box_NOT_CLOSABLE,2);
|
||||
|
||||
|
@ -1377,7 +1359,7 @@ void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
|||
|
||||
/* Data */
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
HTM_INPUT_TEXT ("Title",Exa_MAX_CHARS_TITLE,Exam->Title,
|
||||
HTM_INPUT_TEXT ("Title",Exa_MAX_CHARS_TITLE,Exams->Exam.Title,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"Title\""
|
||||
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\""
|
||||
|
@ -1395,7 +1377,7 @@ void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
|||
HTM_TD_End ();
|
||||
|
||||
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,Exams->Exam.MaxGrade,false,
|
||||
" class=\"INPUT_%s\" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
@ -1410,7 +1392,7 @@ void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
|||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("class=\"LB\"");
|
||||
TstVis_PutVisibilityCheckboxes (Exam->Visibility);
|
||||
TstVis_PutVisibilityCheckboxes (Exams->Exam.Visibility);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
@ -1449,7 +1431,6 @@ void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
|||
void Exa_ReceiveFormExam (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
bool ItsANewExam;
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||
|
@ -1460,40 +1441,36 @@ void Exa_ReceiveFormExam (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
ItsANewExam = (Exam.ExaCod <= 0);
|
||||
ItsANewExam = (Exams.Exam.ExaCod <= 0);
|
||||
|
||||
/***** Get all current exam data from database *****/
|
||||
// Some data, not received from form,
|
||||
// are necessary to show exam and sets of questions again
|
||||
if (!ItsANewExam)
|
||||
{
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
}
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** If I can edit exams ==>
|
||||
overwrite some exam data with the data received from form *****/
|
||||
Exa_ReceiveExamFieldsFromForm (&Exam,Txt);
|
||||
if (Exa_CheckExamFieldsReceivedFromForm (&Exam))
|
||||
Exa_ReceiveExamFieldsFromForm (&Exams.Exam,Txt);
|
||||
if (Exa_CheckExamFieldsReceivedFromForm (&Exams.Exam))
|
||||
{
|
||||
/***** Create a new exam or update an existing one *****/
|
||||
if (ItsANewExam)
|
||||
{
|
||||
Exa_CreateExam (&Exam,Txt); // Add new exam to database
|
||||
Exa_CreateExam (&Exams.Exam,Txt); // Add new exam to database
|
||||
ItsANewExam = false;
|
||||
}
|
||||
else
|
||||
Exa_UpdateExam (&Exam,Txt); // Update exam data in database
|
||||
Exa_UpdateExam (&Exams.Exam,Txt); // Update exam data in database
|
||||
}
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
ItsANewExam); // It's not a new exam
|
||||
}
|
||||
|
||||
|
|
|
@ -43,11 +43,9 @@ bool Exa_CheckIfICanEditExams (void);
|
|||
|
||||
void Exa_SeeOneExam (void);
|
||||
void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSes_Session *Session,
|
||||
bool PutFormSession);
|
||||
void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSes_Session *Session,
|
||||
bool PutFormSession);
|
||||
void Exa_ShowOnlyOneExamEnd (void);
|
||||
|
@ -73,11 +71,9 @@ void Exa_UnhideExam (void);
|
|||
|
||||
void Exa_RequestCreatOrEditExam (void);
|
||||
void Exa_PutFormsOneExam (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSet_Set *Set,
|
||||
bool ItsANewExam);
|
||||
void Exa_PutFormEditionExam (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1],
|
||||
bool ItsANewExam);
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ static void ExaPrn_GenerateChoiceIndexes (struct TstPrn_PrintedQuestion *Printed
|
|||
static void ExaPrn_CreatePrint (struct ExaPrn_Print *Print);
|
||||
|
||||
static void ExaPrn_ShowExamPrintToFillIt (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
struct ExaPrn_Print *Print);
|
||||
static void ExaPrn_GetAndWriteDescription (long ExaCod);
|
||||
static void ExaPrn_ShowTableWithQstsToFill (struct Exa_Exams *Exams,
|
||||
|
@ -163,20 +162,19 @@ void ExaPrn_ShowExamPrint (void)
|
|||
{
|
||||
extern const char *Txt_You_dont_have_access_to_the_exam;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
struct ExaPrn_Print Print;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session);
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Session);
|
||||
|
||||
/***** Check if I can access to this session *****/
|
||||
if (ExaSes_CheckIfICanAnswerThisSession (&Exam,&Session))
|
||||
if (ExaSes_CheckIfICanAnswerThisSession (&Exams.Exam,&Session))
|
||||
{
|
||||
/***** Set basic data of exam print *****/
|
||||
Print.SesCod = Session.SesCod;
|
||||
|
@ -192,7 +190,7 @@ void ExaPrn_ShowExamPrint (void)
|
|||
Print.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
|
||||
/***** Get questions from database *****/
|
||||
ExaPrn_GetQuestionsForNewPrintFromDB (&Print,Exam.ExaCod);
|
||||
ExaPrn_GetQuestionsForNewPrintFromDB (&Print,Exams.Exam.ExaCod);
|
||||
|
||||
if (Print.NumQsts.All)
|
||||
{
|
||||
|
@ -220,7 +218,7 @@ void ExaPrn_ShowExamPrint (void)
|
|||
}
|
||||
|
||||
/***** Show test to be answered *****/
|
||||
ExaPrn_ShowExamPrintToFillIt (&Exams,&Exam,&Print);
|
||||
ExaPrn_ShowExamPrintToFillIt (&Exams,&Print);
|
||||
}
|
||||
else // Session not open or accessible
|
||||
/***** Show warning *****/
|
||||
|
@ -583,13 +581,12 @@ void ExaPrn_GetPrintQuestionsFromDB (struct ExaPrn_Print *Print)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void ExaPrn_ShowExamPrintToFillIt (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
struct ExaPrn_Print *Print)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Exams_answer_exam;
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Exam->Title,
|
||||
Box_BoxBegin (NULL,Exams->Exam.Title,
|
||||
NULL,NULL,
|
||||
Hlp_ASSESSMENT_Exams_answer_exam,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -607,7 +604,7 @@ static void ExaPrn_ShowExamPrintToFillIt (struct Exa_Exams *Exams,
|
|||
HTM_TABLE_End ();
|
||||
|
||||
/***** Exam description *****/
|
||||
ExaPrn_GetAndWriteDescription (Exam->ExaCod);
|
||||
ExaPrn_GetAndWriteDescription (Exams->Exam.ExaCod);
|
||||
|
||||
if (Print->NumQsts.All)
|
||||
{
|
||||
|
@ -961,14 +958,13 @@ void ExaPrn_ReceivePrintAnswer (void)
|
|||
extern const char *Txt_You_dont_have_access_to_the_exam;
|
||||
extern const char *Txt_Continue;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
struct ExaPrn_Print Print;
|
||||
unsigned QstInd;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get session code *****/
|
||||
|
@ -988,13 +984,12 @@ void ExaPrn_ReceivePrintAnswer (void)
|
|||
Exams.SesCod = Session.SesCod;
|
||||
|
||||
/***** Get exam data *****/
|
||||
Exam.ExaCod = Session.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
if (Exam.ExaCod <= 0)
|
||||
Exams.Exam.ExaCod = Session.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
if (Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
if (Exams.Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Err_WrongExamExit ();
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
|
||||
/***** Get question index from form *****/
|
||||
QstInd = ExaPrn_GetParamQstInd ();
|
||||
|
@ -1005,7 +1000,7 @@ void ExaPrn_ReceivePrintAnswer (void)
|
|||
ExaLog_SetQstInd (QstInd);
|
||||
|
||||
/***** Check if session if visible and open *****/
|
||||
if (ExaSes_CheckIfICanAnswerThisSession (&Exam,&Session))
|
||||
if (ExaSes_CheckIfICanAnswerThisSession (&Exams.Exam,&Session))
|
||||
{
|
||||
/***** Set log open to true ****/
|
||||
ExaLog_SetIfCanAnswer (true);
|
||||
|
|
|
@ -50,10 +50,10 @@ void ExaRsc_GetLinkToExam (void)
|
|||
Exa_GetParams (&Exams);
|
||||
|
||||
/***** Get exam title *****/
|
||||
ExaRsc_GetTitleFromExaCod (Exams.ExaCod,Title,sizeof (Title) - 1);
|
||||
ExaRsc_GetTitleFromExaCod (Exams.Exam.ExaCod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Copy link to exam into resource clipboard *****/
|
||||
Prg_DB_CopyToClipboard (PrgRsc_EXAM,Exams.ExaCod);
|
||||
Prg_DB_CopyToClipboard (PrgRsc_EXAM,Exams.Exam.ExaCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
|
|
|
@ -74,13 +74,13 @@ struct ExaRes_ICanView
|
|||
/*****************************************************************************/
|
||||
|
||||
static void ExaRes_ListMyResultsInCrs (struct Exa_Exams *Exams);
|
||||
static void ExaRes_ListMyResultsInExa (struct Exa_Exams *Exams,long ExaCod);
|
||||
static void ExaRes_ListMyResultsInExa (struct Exa_Exams *Exams);
|
||||
static void ExaRes_ListMyResultsInSes (struct Exa_Exams *Exams,long SesCod);
|
||||
|
||||
static void ExaRes_PutFormToSelUsrsToViewResults (__attribute__((unused)) void *Args);
|
||||
static void ExaRes_ShowAllResultsInSelectedExams (void *Exams);
|
||||
static void ExaRes_ListAllResultsInSelectedExams (struct Exa_Exams *Exams);
|
||||
static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams,long ExaCod);
|
||||
static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams);
|
||||
static void ExaRes_ListAllResultsInSes (struct Exa_Exams *Exams,long SesCod);
|
||||
|
||||
static void ExaRes_ShowResultsBegin (struct Exa_Exams *Exams,
|
||||
|
@ -182,49 +182,46 @@ void ExaRes_ShowMyResultsInExa (void)
|
|||
{
|
||||
extern const char *Txt_Results_of_exam_X;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
char *Title;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
|
||||
/***** Get exam data from database *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Exam begin *****/
|
||||
Exa_ShowOnlyOneExamBegin (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExamBegin (&Exams,&Session,
|
||||
false); // Do not put form to start new session
|
||||
|
||||
/***** List my sessions results in exam *****/
|
||||
if (asprintf (&Title,Txt_Results_of_exam_X,Exam.Title) < 0)
|
||||
if (asprintf (&Title,Txt_Results_of_exam_X,Exams.Exam.Title) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select
|
||||
free (Title);
|
||||
ExaRes_ListMyResultsInExa (&Exams,Exam.ExaCod);
|
||||
ExaRes_ListMyResultsInExa (&Exams);
|
||||
ExaRes_ShowResultsEnd ();
|
||||
|
||||
/***** Exam end *****/
|
||||
Exa_ShowOnlyOneExamEnd ();
|
||||
}
|
||||
|
||||
static void ExaRes_ListMyResultsInExa (struct Exa_Exams *Exams,long ExaCod)
|
||||
static void ExaRes_ListMyResultsInExa (struct Exa_Exams *Exams)
|
||||
{
|
||||
/***** Table header *****/
|
||||
ExaRes_ShowHeaderResults (Usr_ME);
|
||||
|
||||
/***** List my sessions results in exam *****/
|
||||
TstCfg_GetConfig (); // Get feedback type
|
||||
ExaRes_ShowResults (Exams,Usr_ME,-1L,ExaCod,NULL);
|
||||
ExaRes_ShowResults (Exams,Usr_ME,-1L,Exams->Exam.ExaCod,NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -235,28 +232,25 @@ void ExaRes_ShowMyResultsInSes (void)
|
|||
{
|
||||
extern const char *Txt_Results_of_session_X;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
char *Title;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
if ((Session.SesCod = ExaSes_GetParamSesCod ()) <= 0)
|
||||
Err_WrongExamSessionExit ();
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
ExaSes_GetDataOfSessionByCod (&Session);
|
||||
|
||||
/***** Exam begin *****/
|
||||
Exa_ShowOnlyOneExamBegin (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExamBegin (&Exams,&Session,
|
||||
false); // Do not put form to start new session
|
||||
|
||||
/***** List my sessions results in session *****/
|
||||
|
@ -387,40 +381,37 @@ void ExaRes_ShowAllResultsInExa (void)
|
|||
{
|
||||
extern const char *Txt_Results_of_exam_X;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
char *Title;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Exam begin *****/
|
||||
Exa_ShowOnlyOneExamBegin (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExamBegin (&Exams,&Session,
|
||||
false); // Do not put form to start new session
|
||||
|
||||
/***** List sessions results in exam *****/
|
||||
if (asprintf (&Title,Txt_Results_of_exam_X,Exam.Title) < 0)
|
||||
if (asprintf (&Title,Txt_Results_of_exam_X,Exams.Exam.Title) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select
|
||||
free (Title);
|
||||
ExaRes_ListAllResultsInExa (&Exams,Exam.ExaCod);
|
||||
ExaRes_ListAllResultsInExa (&Exams);
|
||||
ExaRes_ShowResultsEnd ();
|
||||
|
||||
/***** Exam end *****/
|
||||
Exa_ShowOnlyOneExamEnd ();
|
||||
}
|
||||
|
||||
static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams,long ExaCod)
|
||||
static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumUsrs;
|
||||
|
@ -430,7 +421,7 @@ static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams,long ExaCod)
|
|||
ExaRes_ShowHeaderResults (Usr_OTHER);
|
||||
|
||||
/***** Get all users who have answered any session question in this exam *****/
|
||||
NumUsrs = Exa_DB_GetAllUsrsWhoHaveMadeExam (&mysql_res,ExaCod);
|
||||
NumUsrs = Exa_DB_GetAllUsrsWhoHaveMadeExam (&mysql_res,Exams->Exam.ExaCod);
|
||||
|
||||
/***** List sessions results for each user *****/
|
||||
for (NumUsr = 0;
|
||||
|
@ -445,7 +436,7 @@ static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams,long ExaCod)
|
|||
{
|
||||
/***** Show sessions results *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Enr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
ExaRes_ShowResults (Exams,Usr_OTHER,-1L,ExaCod,NULL);
|
||||
ExaRes_ShowResults (Exams,Usr_OTHER,-1L,Exams->Exam.ExaCod,NULL);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -460,30 +451,27 @@ void ExaRes_ShowAllResultsInSes (void)
|
|||
{
|
||||
extern const char *Txt_Results_of_session_X;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
char *Title;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
if ((Session.SesCod = ExaSes_GetParamSesCod ()) <= 0)
|
||||
Err_WrongExamSessionExit ();
|
||||
|
||||
/***** Get exam data and session *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
ExaSes_GetDataOfSessionByCod (&Session);
|
||||
|
||||
/***** Exam begin *****/
|
||||
Exa_ShowOnlyOneExamBegin (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExamBegin (&Exams,&Session,
|
||||
false); // Do not put form to start new session
|
||||
|
||||
/***** List sessions results in session *****/
|
||||
|
@ -584,10 +572,9 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams)
|
|||
extern const char *Txt_Update_results;
|
||||
unsigned UniqueId;
|
||||
unsigned NumExam;
|
||||
struct Exa_Exam Exam;
|
||||
|
||||
/***** Reset exam *****/
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams->Exam);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Txt_Exams,
|
||||
|
@ -615,9 +602,8 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams)
|
|||
NumExam++, UniqueId++, The_ChangeRowColor ())
|
||||
{
|
||||
/* Get data of this exam */
|
||||
Exam.ExaCod = Exams->Lst[NumExam].ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams->ExaCod = Exam.ExaCod;
|
||||
Exams->Exam.ExaCod = Exams->Lst[NumExam].ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams->Exam);
|
||||
|
||||
/* Write a row for this session */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -643,7 +629,7 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams)
|
|||
HTM_TD_Begin ("class=\"LT DAT_%s %s\"",
|
||||
The_GetSuffix (),
|
||||
The_GetColorRows ());
|
||||
HTM_Txt (Exam.Title);
|
||||
HTM_Txt (Exams->Exam.Title);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
@ -1041,8 +1027,8 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams,
|
|||
The_GetColorRows ());
|
||||
if (ICanView.Result)
|
||||
{
|
||||
Exams->ExaCod = Session.ExaCod;
|
||||
Exams->SesCod = Session.SesCod;
|
||||
Exams->Exam.ExaCod = Session.ExaCod;
|
||||
Exams->SesCod = Session.SesCod;
|
||||
switch (MeOrOther)
|
||||
{
|
||||
case Usr_ME:
|
||||
|
@ -1248,7 +1234,6 @@ static void ExaRes_ShowResultsSummaryRow (unsigned NumResults,
|
|||
void ExaRes_ShowExaResultAfterFinish (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
struct ExaPrn_Print Print;
|
||||
struct ExaRes_ICanView ICanView =
|
||||
|
@ -1260,11 +1245,11 @@ void ExaRes_ShowExaResultAfterFinish (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session);
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Session);
|
||||
|
||||
/***** Get exam print data *****/
|
||||
Print.SesCod = Session.SesCod;
|
||||
|
@ -1275,13 +1260,13 @@ void ExaRes_ShowExaResultAfterFinish (void)
|
|||
// The user has clicked on the "I have finished" button in an exam print
|
||||
ExaLog_SetAction (ExaLog_FINISH_EXAM);
|
||||
ExaLog_SetPrnCod (Print.PrnCod);
|
||||
ExaLog_SetIfCanAnswer (ExaSes_CheckIfICanAnswerThisSession (&Exam,&Session));
|
||||
ExaLog_SetIfCanAnswer (ExaSes_CheckIfICanAnswerThisSession (&Exams.Exam,&Session));
|
||||
|
||||
/***** Get questions and user's answers of exam print from database *****/
|
||||
ExaPrn_GetPrintQuestionsFromDB (&Print);
|
||||
|
||||
/***** Show exam result *****/
|
||||
ExaRes_ShowExamResult (&Exam,&Session,&Print,
|
||||
ExaRes_ShowExamResult (&Exams.Exam,&Session,&Print,
|
||||
&Gbl.Usrs.Me.UsrDat,&ICanView,Visibility);
|
||||
}
|
||||
|
||||
|
@ -1292,7 +1277,6 @@ void ExaRes_ShowExaResultAfterFinish (void)
|
|||
void ExaRes_ShowOneExaResult (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
Usr_MeOrOther_t MeOrOther;
|
||||
struct Usr_Data *UsrDat;
|
||||
|
@ -1301,11 +1285,11 @@ void ExaRes_ShowOneExaResult (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session);
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Session);
|
||||
|
||||
/***** Pointer to user's data *****/
|
||||
MeOrOther = (Gbl.Action.Act == ActSeeOneExaResMe) ? Usr_ME :
|
||||
|
@ -1331,11 +1315,11 @@ void ExaRes_ShowOneExaResult (void)
|
|||
ExaPrn_GetPrintQuestionsFromDB (&Print);
|
||||
|
||||
/***** Check if I can view this print result and its score *****/
|
||||
ExaRes_CheckIfICanViewResult (&Exam,&Session,UsrDat->UsrCod,&ICanView);
|
||||
ExaRes_CheckIfICanViewResult (&Exams.Exam,&Session,UsrDat->UsrCod,&ICanView);
|
||||
|
||||
/***** Show exam result *****/
|
||||
ExaRes_ShowExamResult (&Exam,&Session,&Print,
|
||||
UsrDat,&ICanView,Exam.Visibility);
|
||||
ExaRes_ShowExamResult (&Exams.Exam,&Session,&Print,
|
||||
UsrDat,&ICanView,Exams.Exam.Visibility);
|
||||
|
||||
/***** Show exam log *****/
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
|
|
|
@ -64,7 +64,6 @@ static void ExaSes_PutIconsInListOfSessions (void *Exams);
|
|||
static void ExaSes_PutIconToCreateNewSession (struct Exa_Exams *Exams);
|
||||
|
||||
static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
long SesCodToBeEdited,
|
||||
unsigned NumSessions,
|
||||
MYSQL_RES *mysql_res);
|
||||
|
@ -79,7 +78,6 @@ static void ExaSes_ListOneOrMoreSessionsAuthor (const struct ExaSes_Session *Ses
|
|||
static void ExaSes_ListOneOrMoreSessionsTimes (const struct ExaSes_Session *Session,
|
||||
unsigned UniqueId);
|
||||
static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
const struct ExaSes_Session *Session,
|
||||
const char *Anchor);
|
||||
static void ExaSes_GetAndWriteNamesOfGrpsAssociatedToSession (const struct ExaSes_Session *Session);
|
||||
|
@ -129,7 +127,6 @@ void ExaSes_ResetSession (struct ExaSes_Session *Session)
|
|||
/*****************************************************************************/
|
||||
|
||||
void ExaSes_ListSessions (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSes_Session *Session,
|
||||
bool PutFormSession)
|
||||
{
|
||||
|
@ -139,7 +136,6 @@ void ExaSes_ListSessions (struct Exa_Exams *Exams,
|
|||
unsigned NumSessions;
|
||||
|
||||
/***** Begin box *****/
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
Box_BoxBegin ("100%",Txt_Sessions,
|
||||
ExaSes_PutIconsInListOfSessions,Exams,
|
||||
Hlp_ASSESSMENT_Exams_sessions,Box_NOT_CLOSABLE);
|
||||
|
@ -163,8 +159,8 @@ void ExaSes_ListSessions (struct Exa_Exams *Exams,
|
|||
}
|
||||
|
||||
/***** Show the table with the sessions *****/
|
||||
if ((NumSessions = Exa_DB_GetSessions (&mysql_res,Exam->ExaCod)))
|
||||
ExaSes_ListOneOrMoreSessions (Exams,Exam,
|
||||
if ((NumSessions = Exa_DB_GetSessions (&mysql_res,Exams->Exam.ExaCod)))
|
||||
ExaSes_ListOneOrMoreSessions (Exams,
|
||||
PutFormSession &&
|
||||
Session->SesCod > 0 ? Session->SesCod :
|
||||
-1L,
|
||||
|
@ -183,16 +179,16 @@ void ExaSes_ListSessions (struct Exa_Exams *Exams,
|
|||
{
|
||||
/* Reset session */
|
||||
ExaSes_ResetSession (Session);
|
||||
Session->ExaCod = Exam->ExaCod;
|
||||
Session->ExaCod = Exams->Exam.ExaCod;
|
||||
Session->TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC; // Now
|
||||
Session->TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (1 * 60 * 60); // Now + 1 hour
|
||||
Str_Copy (Session->Title,Exam->Title,sizeof (Session->Title) - 1);
|
||||
Str_Copy (Session->Title,Exams->Exam.Title,sizeof (Session->Title) - 1);
|
||||
|
||||
/* Put form to create new session */
|
||||
ExaSes_PutFormSession (Session); // Form to create session
|
||||
}
|
||||
else
|
||||
ExaSes_PutButtonNewSession (Exams,Exam->ExaCod); // Button to create a new exam session
|
||||
ExaSes_PutButtonNewSession (Exams); // Button to create a new exam session
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -262,7 +258,6 @@ static void ExaSes_PutIconToCreateNewSession (struct Exa_Exams *Exams)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
long SesCodToBeEdited,
|
||||
unsigned NumSessions,
|
||||
MYSQL_RES *mysql_res)
|
||||
|
@ -297,7 +292,7 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams,
|
|||
if (ExaSes_CheckIfICanListThisSessionBasedOnGrps (Session.SesCod))
|
||||
{
|
||||
/***** Build anchor string *****/
|
||||
if (asprintf (&Anchor,"evt_%ld_%ld",Exam->ExaCod,Session.SesCod) < 0)
|
||||
if (asprintf (&Anchor,"evt_%ld_%ld",Exams->Exam.ExaCod,Session.SesCod) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
|
||||
/***** Begin row for this exam session ****/
|
||||
|
@ -315,7 +310,7 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams,
|
|||
ExaSes_ListOneOrMoreSessionsTimes (&Session,UniqueId);
|
||||
|
||||
/* Title and groups */
|
||||
ExaSes_ListOneOrMoreSessionsTitleGrps (Exams,Exam,&Session,Anchor);
|
||||
ExaSes_ListOneOrMoreSessionsTitleGrps (Exams,&Session,Anchor);
|
||||
|
||||
/* Session result visible? */
|
||||
ExaSes_ListOneOrMoreSessionsResult (Exams,&Session);
|
||||
|
@ -434,8 +429,8 @@ static void ExaSes_ListOneOrMoreSessionsIcons (struct Exa_Exams *Exams,
|
|||
[true ] = ActUnhExaSes, // Hidden ==> action to unhide
|
||||
};
|
||||
|
||||
Exams->ExaCod = Session->ExaCod;
|
||||
Exams->SesCod = Session->SesCod;
|
||||
Exams->Exam.ExaCod = Session->ExaCod;
|
||||
Exams->SesCod = Session->SesCod;
|
||||
|
||||
/***** Begin cell *****/
|
||||
HTM_TD_Begin ("class=\"BT %s\"",The_GetColorRows ());
|
||||
|
@ -506,7 +501,6 @@ static void ExaSes_ListOneOrMoreSessionsTimes (const struct ExaSes_Session *Sess
|
|||
/*****************************************************************************/
|
||||
|
||||
static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
const struct ExaSes_Session *Session,
|
||||
const char *Anchor)
|
||||
{
|
||||
|
@ -517,7 +511,7 @@ static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams,
|
|||
|
||||
/***** Session title *****/
|
||||
HTM_ARTICLE_Begin (Anchor);
|
||||
if (ExaSes_CheckIfICanAnswerThisSession (Exam,Session))
|
||||
if (ExaSes_CheckIfICanAnswerThisSession (&Exams->Exam,Session))
|
||||
{
|
||||
Frm_BeginForm (ActSeeExaPrn);
|
||||
Exa_PutParams (Exams);
|
||||
|
@ -644,8 +638,8 @@ static void ExaSes_ListOneOrMoreSessionsResultStd (struct Exa_Exams *Exams,
|
|||
if (Session->ShowUsrResults)
|
||||
{
|
||||
/* Result is visible by me */
|
||||
Exams->ExaCod = Session->ExaCod;
|
||||
Exams->SesCod = Session->SesCod;
|
||||
Exams->Exam.ExaCod = Session->ExaCod;
|
||||
Exams->SesCod = Session->SesCod;
|
||||
Lay_PutContextualLinkOnlyIcon (ActSeeMyExaResSes,ExaRes_RESULTS_BOX_ID,
|
||||
ExaSes_PutParamsEdit,Exams,
|
||||
"trophy.svg",Ico_BLACK);
|
||||
|
@ -661,8 +655,8 @@ static void ExaSes_ListOneOrMoreSessionsResultTch (struct Exa_Exams *Exams,
|
|||
extern const char *Txt_Visible_results;
|
||||
extern const char *Txt_Hidden_results;
|
||||
|
||||
Exams->ExaCod = Session->ExaCod;
|
||||
Exams->SesCod = Session->SesCod;
|
||||
Exams->Exam.ExaCod = Session->ExaCod;
|
||||
Exams->SesCod = Session->SesCod;
|
||||
|
||||
/***** Show exam session results *****/
|
||||
if (ExaSes_CheckIfICanEditThisSession (Session->UsrCod))
|
||||
|
@ -700,16 +694,15 @@ static void ExaSes_ListOneOrMoreSessionsResultTch (struct Exa_Exams *Exams,
|
|||
void ExaSes_ToggleVisResultsSesUsr (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session);
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Session);
|
||||
|
||||
/***** Check if visibility of session results can be changed *****/
|
||||
if (!ExaSes_CheckIfVisibilityOfResultsCanBeChanged (&Session))
|
||||
|
@ -720,7 +713,7 @@ void ExaSes_ToggleVisResultsSesUsr (void)
|
|||
Exa_DB_ToggleVisResultsSesUsr (&Session);
|
||||
|
||||
/***** Show current exam *****/
|
||||
Exa_ShowOnlyOneExam (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExam (&Exams,&Session,
|
||||
false); // Do not put form for session
|
||||
}
|
||||
|
||||
|
@ -790,20 +783,19 @@ void ExaSes_RequestRemoveSession (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_session_X;
|
||||
extern const char *Txt_Remove_session;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session);
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Session);
|
||||
|
||||
/***** Show question and button to remove question *****/
|
||||
Exams.ExaCod = Session.ExaCod;
|
||||
Exams.SesCod = Session.SesCod;
|
||||
Exams.Exam.ExaCod = Session.ExaCod;
|
||||
Exams.SesCod = Session.SesCod;
|
||||
Ale_ShowAlertAndButton (ActRemExaSes,NULL,NULL,
|
||||
ExaSes_PutParamsEdit,&Exams,
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_session,
|
||||
|
@ -811,7 +803,7 @@ void ExaSes_RequestRemoveSession (void)
|
|||
Session.Title);
|
||||
|
||||
/***** Show current exam *****/
|
||||
Exa_ShowOnlyOneExam (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExam (&Exams,&Session,
|
||||
false); // Do not put form for session
|
||||
}
|
||||
|
||||
|
@ -823,16 +815,15 @@ void ExaSes_RemoveSession (void)
|
|||
{
|
||||
extern const char *Txt_Session_X_removed;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session);
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Session);
|
||||
|
||||
/***** Check if I can remove this exam session *****/
|
||||
if (!ExaSes_CheckIfICanEditThisSession (Session.UsrCod))
|
||||
|
@ -855,10 +846,10 @@ void ExaSes_RemoveSession (void)
|
|||
Session.Title);
|
||||
|
||||
/***** Get exam data again to update it after changes in session *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Show current exam *****/
|
||||
Exa_ShowOnlyOneExam (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExam (&Exams,&Session,
|
||||
false); // Do not put form for session
|
||||
}
|
||||
|
||||
|
@ -869,16 +860,15 @@ void ExaSes_RemoveSession (void)
|
|||
void ExaSes_HideSession (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session);
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Session);
|
||||
|
||||
/***** Check if I can remove this exam session *****/
|
||||
if (!ExaSes_CheckIfICanEditThisSession (Session.UsrCod))
|
||||
|
@ -888,7 +878,7 @@ void ExaSes_HideSession (void)
|
|||
Exa_DB_HideUnhideSession (&Session,true);
|
||||
|
||||
/***** Show current exam *****/
|
||||
Exa_ShowOnlyOneExam (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExam (&Exams,&Session,
|
||||
false); // Do not put form for session
|
||||
}
|
||||
|
||||
|
@ -899,16 +889,15 @@ void ExaSes_HideSession (void)
|
|||
void ExaSes_UnhideSession (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Exam,&Session);
|
||||
ExaSes_GetAndCheckParameters (&Exams,&Session);
|
||||
|
||||
/***** Check if I can remove this exam session *****/
|
||||
if (!ExaSes_CheckIfICanEditThisSession (Session.UsrCod))
|
||||
|
@ -918,7 +907,7 @@ void ExaSes_UnhideSession (void)
|
|||
Exa_DB_HideUnhideSession (&Session,false);
|
||||
|
||||
/***** Show current exam *****/
|
||||
Exa_ShowOnlyOneExam (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExam (&Exams,&Session,
|
||||
false); // Do not put form for session
|
||||
}
|
||||
|
||||
|
@ -949,27 +938,24 @@ void ExaSes_PutParamSesCod (long SesCod)
|
|||
/*****************************************************************************/
|
||||
|
||||
void ExaSes_GetAndCheckParameters (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSes_Session *Session)
|
||||
{
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (Exams);
|
||||
if (Exams->ExaCod <= 0)
|
||||
if (Exams->Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam->ExaCod = Exams->ExaCod;
|
||||
Grp_GetParamWhichGroups ();
|
||||
if ((Session->SesCod = ExaSes_GetParamSesCod ()) <= 0)
|
||||
Err_WrongExamSessionExit ();
|
||||
|
||||
/***** Get exam data from database *****/
|
||||
Exa_GetDataOfExamByCod (Exam);
|
||||
if (Exam->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Exa_GetDataOfExamByCod (&Exams->Exam);
|
||||
if (Exams->Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Err_WrongExamExit ();
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
|
||||
/***** Get set data from database *****/
|
||||
ExaSes_GetDataOfSessionByCod (Session);
|
||||
if (Session->ExaCod != Exam->ExaCod)
|
||||
if (Session->ExaCod != Exams->Exam.ExaCod)
|
||||
Err_WrongSetExit ();
|
||||
Exams->SesCod = Session->SesCod;
|
||||
}
|
||||
|
@ -1122,11 +1108,10 @@ static void ExaSes_ShowLstGrpsToCreateSession (long SesCod)
|
|||
/******************** Put button to create a new session *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ExaSes_PutButtonNewSession (struct Exa_Exams *Exams,long ExaCod)
|
||||
void ExaSes_PutButtonNewSession (struct Exa_Exams *Exams)
|
||||
{
|
||||
extern const char *Txt_New_session;
|
||||
|
||||
Exams->ExaCod = ExaCod;
|
||||
Frm_BeginFormAnchor (ActReqNewExaSes,ExaSes_NEW_SESSION_SECTION_ID);
|
||||
Exa_PutParams (Exams);
|
||||
Btn_PutConfirmButton (Txt_New_session);
|
||||
|
@ -1140,29 +1125,26 @@ void ExaSes_PutButtonNewSession (struct Exa_Exams *Exams,long ExaCod)
|
|||
void ExaSes_RequestCreatOrEditSes (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
bool ItsANewSession;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
Grp_GetParamWhichGroups ();
|
||||
Session.SesCod = ExaSes_GetParamSesCod ();
|
||||
ItsANewSession = (Session.SesCod <= 0);
|
||||
|
||||
/***** Get exam data from database *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
if (Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
if (Exams.Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Err_WrongExamExit ();
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
|
||||
/***** Get session data *****/
|
||||
if (ItsANewSession)
|
||||
|
@ -1172,13 +1154,13 @@ void ExaSes_RequestCreatOrEditSes (void)
|
|||
{
|
||||
/* Get session data from database */
|
||||
ExaSes_GetDataOfSessionByCod (&Session);
|
||||
if (Exam.ExaCod != Session.ExaCod)
|
||||
if (Exams.Exam.ExaCod != Session.ExaCod)
|
||||
Err_WrongExamExit ();
|
||||
Exams.SesCod = Session.SesCod;
|
||||
}
|
||||
|
||||
/***** Show exam *****/
|
||||
Exa_ShowOnlyOneExam (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExam (&Exams,&Session,
|
||||
true); // Put form for session
|
||||
}
|
||||
|
||||
|
@ -1191,42 +1173,39 @@ void ExaSes_ReceiveFormSession (void)
|
|||
extern const char *Txt_Created_new_event_X;
|
||||
extern const char *Txt_The_event_has_been_modified;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSes_Session Session;
|
||||
bool ItsANewSession;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Get main parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
Grp_GetParamWhichGroups ();
|
||||
Session.SesCod = ExaSes_GetParamSesCod ();
|
||||
ItsANewSession = (Session.SesCod <= 0);
|
||||
|
||||
/***** Get exam data from database *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
if (Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
if (Exams.Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Err_WrongExamExit ();
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
|
||||
/***** Get session data from database *****/
|
||||
if (ItsANewSession)
|
||||
{
|
||||
/* Initialize to empty session */
|
||||
ExaSes_ResetSession (&Session);
|
||||
Session.ExaCod = Exam.ExaCod;
|
||||
Session.ExaCod = Exams.Exam.ExaCod;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get session data from database */
|
||||
ExaSes_GetDataOfSessionByCod (&Session);
|
||||
if (Session.ExaCod != Exam.ExaCod)
|
||||
if (Session.ExaCod != Exams.Exam.ExaCod)
|
||||
Err_WrongExamExit ();
|
||||
Exams.SesCod = Session.SesCod;
|
||||
}
|
||||
|
@ -1263,10 +1242,10 @@ void ExaSes_ReceiveFormSession (void)
|
|||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_event_has_been_modified);
|
||||
|
||||
/***** Get exam data again to update it after changes in session *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Show current exam *****/
|
||||
Exa_ShowOnlyOneExam (&Exams,&Exam,&Session,
|
||||
Exa_ShowOnlyOneExam (&Exams,&Session,
|
||||
false); // Do not put form for session
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ struct ExaSes_UsrAnswer
|
|||
void ExaSes_ResetSession (struct ExaSes_Session *Session);
|
||||
|
||||
void ExaSes_ListSessions (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSes_Session *Session,
|
||||
bool PutFormSession);
|
||||
void ExaSes_GetDataOfSessionByCod (struct ExaSes_Session *Session);
|
||||
|
@ -67,11 +66,10 @@ void ExaSes_UnhideSession (void);
|
|||
void ExaSes_PutParamsEdit (void *Exams);
|
||||
void ExaSes_PutParamSesCod (long SesCod);
|
||||
void ExaSes_GetAndCheckParameters (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSes_Session *Session);
|
||||
long ExaSes_GetParamSesCod (void);
|
||||
|
||||
void ExaSes_PutButtonNewSession (struct Exa_Exams *Exams,long ExaCod);
|
||||
void ExaSes_PutButtonNewSession (struct Exa_Exams *Exams);
|
||||
void ExaSes_RequestCreatOrEditSes (void);
|
||||
void ExaSes_ReceiveFormSession (void);
|
||||
|
||||
|
|
175
swad_exam_set.c
175
swad_exam_set.c
|
@ -73,7 +73,6 @@ extern struct Globals Gbl;
|
|||
static void ExaSet_PutParamsOneQst (void *Exams);
|
||||
|
||||
static void ExaSet_PutFormNewSet (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSet_Set *Set,
|
||||
unsigned MaxSetInd);
|
||||
static void ExaSet_ReceiveSetFieldsFromForm (struct ExaSet_Set *Set);
|
||||
|
@ -86,10 +85,8 @@ static void ExaSet_UpdateSet (const struct ExaSet_Set *Set);
|
|||
static void ExaSet_PutParamSetCod (long SetCod);
|
||||
|
||||
static void ExaSet_ListSetQuestions (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
const struct ExaSet_Set *Set);
|
||||
static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
unsigned MaxSetInd,
|
||||
unsigned NumSets,
|
||||
MYSQL_RES *mysql_res,
|
||||
|
@ -114,7 +111,6 @@ static void ExaSet_RemoveMediaFromAllAnsOfQst (long QstCod,long SetCod);
|
|||
static void ExaSet_ChangeValidityQst (Qst_Validity_t Valid);
|
||||
|
||||
static void ExaSet_GetAndCheckParameters (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSet_Set *Set);
|
||||
|
||||
static long ExaSet_GetParamQstCod (void);
|
||||
|
@ -218,7 +214,6 @@ void ExaSet_GetDataOfSetByCod (struct ExaSet_Set *Set)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void ExaSet_PutFormNewSet (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSet_Set *Set,
|
||||
unsigned MaxSetInd)
|
||||
{
|
||||
|
@ -226,7 +221,6 @@ static void ExaSet_PutFormNewSet (struct Exa_Exams *Exams,
|
|||
extern const char *Txt_Create_set_of_questions;
|
||||
|
||||
/***** Begin form *****/
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
Frm_BeginForm (ActNewExaSet);
|
||||
Exa_PutParams (Exams);
|
||||
|
||||
|
@ -289,29 +283,27 @@ static void ExaSet_PutFormNewSet (struct Exa_Exams *Exams,
|
|||
void ExaSet_ReceiveFormSet (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
bool ItsANewSet;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Set.ExaCod = Exam.ExaCod = Exams.ExaCod;
|
||||
Set.ExaCod = Exams.Exam.ExaCod;
|
||||
Exams.SetCod = Set.SetCod = ExaSet_GetParamSetCod ();
|
||||
ItsANewSet = (Set.SetCod <= 0);
|
||||
|
||||
/***** Get exam data from database *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
|
||||
/***** Check if exam is editable *****/
|
||||
if (!Exa_CheckIfEditable (&Exam))
|
||||
if (!Exa_CheckIfEditable (&Exams.Exam))
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** If I can edit exams ==> receive set from form *****/
|
||||
|
@ -326,7 +318,7 @@ void ExaSet_ReceiveFormSet (void)
|
|||
}
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -381,7 +373,6 @@ static bool ExaSet_CheckSetTitleReceivedFromForm (const struct ExaSet_Set *Set,
|
|||
void ExaSet_ChangeSetTitle (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
char NewTitle[ExaSet_MAX_BYTES_TITLE + 1];
|
||||
|
||||
|
@ -391,14 +382,14 @@ void ExaSet_ChangeSetTitle (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Check if exam is editable *****/
|
||||
if (!Exa_CheckIfEditable (&Exam))
|
||||
if (!Exa_CheckIfEditable (&Exams.Exam))
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Receive new title from form *****/
|
||||
|
@ -415,9 +406,10 @@ void ExaSet_ChangeSetTitle (void)
|
|||
}
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***** Receive form to change number of questions to appear in the exam ******/
|
||||
/*****************************************************************************/
|
||||
|
@ -425,7 +417,6 @@ void ExaSet_ChangeSetTitle (void)
|
|||
void ExaSet_ChangeNumQstsToExam (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
unsigned NumQstsToPrint;
|
||||
|
||||
|
@ -435,14 +426,14 @@ void ExaSet_ChangeNumQstsToExam (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Check if exam is editable *****/
|
||||
if (!Exa_CheckIfEditable (&Exam))
|
||||
if (!Exa_CheckIfEditable (&Exams.Exam))
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Get number of questions in set to appear in exam print *****/
|
||||
|
@ -462,7 +453,7 @@ void ExaSet_ChangeNumQstsToExam (void)
|
|||
}
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -508,7 +499,6 @@ static void ExaSet_UpdateSet (const struct ExaSet_Set *Set)
|
|||
void ExaSet_RequestCreatOrEditSet (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
bool ItsANewSet;
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||
|
@ -519,21 +509,19 @@ void ExaSet_RequestCreatOrEditSet (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (&Exams);
|
||||
if (Exams.ExaCod <= 0)
|
||||
if (Exams.Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam.ExaCod = Exams.ExaCod;
|
||||
Exams.SetCod = Set.SetCod = ExaSet_GetParamSetCod ();
|
||||
ItsANewSet = (Set.SetCod <= 0);
|
||||
|
||||
/***** Get exam data from database *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_DB_GetExamTxt (Exam.ExaCod,Txt);
|
||||
Exa_GetDataOfExamByCod (&Exams.Exam);
|
||||
Exa_DB_GetExamTxt (Exams.Exam.ExaCod,Txt);
|
||||
|
||||
/***** Get set data *****/
|
||||
if (ItsANewSet)
|
||||
|
@ -547,7 +535,7 @@ void ExaSet_RequestCreatOrEditSet (void)
|
|||
}
|
||||
|
||||
/***** Put form to edit the exam created or updated *****/
|
||||
Exa_PutFormEditionExam (&Exams,&Exam,Txt,
|
||||
Exa_PutFormEditionExam (&Exams,Txt,
|
||||
false); // No new exam
|
||||
}
|
||||
|
||||
|
@ -558,22 +546,21 @@ void ExaSet_RequestCreatOrEditSet (void)
|
|||
void ExaSet_ReqSelectQstsToAddToSet (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Show form to select questions for set *****/
|
||||
Qst_RequestSelectQstsForExamSet (&Exams);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -584,16 +571,15 @@ void ExaSet_ReqSelectQstsToAddToSet (void)
|
|||
void ExaSet_ListQstsToAddToSet (void)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Get set data from database *****/
|
||||
ExaSet_GetDataOfSetByCod (&Set);
|
||||
|
@ -603,7 +589,7 @@ void ExaSet_ListQstsToAddToSet (void)
|
|||
Qst_ListQuestionsToSelectForExamSet (&Exams);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -621,7 +607,6 @@ static void ExaSet_PutParamSetCod (long SetCod)
|
|||
/*****************************************************************************/
|
||||
|
||||
void ExaSet_ListExamSets (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSet_Set *Set)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Exams_question_sets;
|
||||
|
@ -629,13 +614,13 @@ void ExaSet_ListExamSets (struct Exa_Exams *Exams,
|
|||
MYSQL_RES *mysql_res;
|
||||
unsigned MaxSetInd;
|
||||
unsigned NumSets;
|
||||
bool ICanEditSets = Exa_CheckIfEditable (Exam);
|
||||
bool ICanEditSets = Exa_CheckIfEditable (&Exams->Exam);
|
||||
|
||||
/***** Get maximum set index *****/
|
||||
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Exam->ExaCod);
|
||||
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Exams->Exam.ExaCod);
|
||||
|
||||
/***** Get data of set of questions from database *****/
|
||||
NumSets = Exa_DB_GetExamSets (&mysql_res,Exam->ExaCod);
|
||||
NumSets = Exa_DB_GetExamSets (&mysql_res,Exams->Exam.ExaCod);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Txt_Sets_of_questions,
|
||||
|
@ -643,9 +628,8 @@ void ExaSet_ListExamSets (struct Exa_Exams *Exams,
|
|||
Hlp_ASSESSMENT_Exams_question_sets,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Show table with sets *****/
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
if (NumSets)
|
||||
ExaSet_ListOneOrMoreSetsForEdition (Exams,Exam,
|
||||
ExaSet_ListOneOrMoreSetsForEdition (Exams,
|
||||
MaxSetInd,
|
||||
NumSets,mysql_res,
|
||||
ICanEditSets);
|
||||
|
@ -655,7 +639,7 @@ void ExaSet_ListExamSets (struct Exa_Exams *Exams,
|
|||
|
||||
/***** Put forms to create/edit a set *****/
|
||||
if (ICanEditSets)
|
||||
ExaSet_PutFormNewSet (Exams,Exam,Set,MaxSetInd);
|
||||
ExaSet_PutFormNewSet (Exams,Set,MaxSetInd);
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
|
@ -666,14 +650,13 @@ void ExaSet_ListExamSets (struct Exa_Exams *Exams,
|
|||
/*****************************************************************************/
|
||||
|
||||
static void ExaSet_ListSetQuestions (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
const struct ExaSet_Set *Set)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Exams_questions;
|
||||
extern const char *Txt_Questions;
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumQsts;
|
||||
bool ICanEditQuestions = Exa_CheckIfEditable (Exam);
|
||||
bool ICanEditQuestions = Exa_CheckIfEditable (&Exams->Exam);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Txt_Questions,
|
||||
|
@ -704,7 +687,6 @@ static void ExaSet_ListSetQuestions (struct Exa_Exams *Exams,
|
|||
/*****************************************************************************/
|
||||
|
||||
static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
unsigned MaxSetInd,
|
||||
unsigned NumSets,
|
||||
MYSQL_RES *mysql_res,
|
||||
|
@ -865,7 +847,7 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
|
|||
The_GetColorRows ());
|
||||
|
||||
/* List questions */
|
||||
ExaSet_ListSetQuestions (Exams,Exam,&Set);
|
||||
ExaSet_ListSetQuestions (Exams,&Set);
|
||||
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -1225,7 +1207,6 @@ void ExaSet_AddQstsToSet (void)
|
|||
{
|
||||
extern const char *Txt_No_questions_have_been_added;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
const char *Ptr;
|
||||
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
||||
|
@ -1233,11 +1214,11 @@ void ExaSet_AddQstsToSet (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Get set data from database *****/
|
||||
ExaSet_GetDataOfSetByCod (&Set);
|
||||
|
@ -1273,7 +1254,7 @@ void ExaSet_AddQstsToSet (void)
|
|||
ExaSet_FreeListsSelectedQuestions (&Exams);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -1382,19 +1363,18 @@ void ExaSet_RequestRemoveSet (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_set_of_questions_X;
|
||||
extern const char *Txt_Remove_set_of_questions;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Check if exam is editable *****/
|
||||
if (!Exa_CheckIfEditable (&Exam))
|
||||
if (!Exa_CheckIfEditable (&Exams.Exam))
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Show question and button to remove question *****/
|
||||
|
@ -1405,7 +1385,7 @@ void ExaSet_RequestRemoveSet (void)
|
|||
Set.Title);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -1417,19 +1397,18 @@ void ExaSet_RemoveSet (void)
|
|||
{
|
||||
extern const char *Txt_Set_of_questions_removed;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Check if exam is editable *****/
|
||||
if (!Exa_CheckIfEditable (&Exam))
|
||||
if (!Exa_CheckIfEditable (&Exams.Exam))
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Remove the set from all tables *****/
|
||||
|
@ -1446,7 +1425,7 @@ void ExaSet_RemoveSet (void)
|
|||
Ale_ShowAlert (Ale_SUCCESS,Txt_Set_of_questions_removed);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -1458,42 +1437,41 @@ void ExaSet_MoveUpSet (void)
|
|||
{
|
||||
extern const char *Txt_Movement_not_allowed;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
unsigned SetIndTop;
|
||||
unsigned SetIndBottom;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Check if exam is editable *****/
|
||||
if (!Exa_CheckIfEditable (&Exam))
|
||||
if (!Exa_CheckIfEditable (&Exams.Exam))
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Get set index *****/
|
||||
SetIndBottom = Exa_DB_GetSetIndFromSetCod (Exam.ExaCod,Set.SetCod);
|
||||
SetIndBottom = Exa_DB_GetSetIndFromSetCod (Exams.Exam.ExaCod,Set.SetCod);
|
||||
|
||||
/***** Move up set *****/
|
||||
if (SetIndBottom > 1)
|
||||
{
|
||||
/* Indexes of sets to be exchanged */
|
||||
SetIndTop = Exa_DB_GetPrevSetIndexInExam (Exam.ExaCod,SetIndBottom);
|
||||
SetIndTop = Exa_DB_GetPrevSetIndexInExam (Exams.Exam.ExaCod,SetIndBottom);
|
||||
if (SetIndTop == 0)
|
||||
Err_ShowErrorAndExit ("Wrong set index.");
|
||||
|
||||
/* Exchange sets */
|
||||
ExaSet_ExchangeSets (Exam.ExaCod,SetIndTop,SetIndBottom);
|
||||
ExaSet_ExchangeSets (Exams.Exam.ExaCod,SetIndTop,SetIndBottom);
|
||||
}
|
||||
else
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -1505,7 +1483,6 @@ void ExaSet_MoveDownSet (void)
|
|||
{
|
||||
extern const char *Txt_Movement_not_allowed;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
unsigned SetIndTop;
|
||||
unsigned SetIndBottom;
|
||||
|
@ -1513,38 +1490,38 @@ void ExaSet_MoveDownSet (void)
|
|||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Check if exam is editable *****/
|
||||
if (!Exa_CheckIfEditable (&Exam))
|
||||
if (!Exa_CheckIfEditable (&Exams.Exam))
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Get set index *****/
|
||||
SetIndTop = Exa_DB_GetSetIndFromSetCod (Exam.ExaCod,Set.SetCod);
|
||||
SetIndTop = Exa_DB_GetSetIndFromSetCod (Exams.Exam.ExaCod,Set.SetCod);
|
||||
|
||||
/***** Get maximum set index *****/
|
||||
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Exam.ExaCod);
|
||||
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Exams.Exam.ExaCod);
|
||||
|
||||
/***** Move down set *****/
|
||||
if (SetIndTop < MaxSetInd)
|
||||
{
|
||||
/* Indexes of sets to be exchanged */
|
||||
SetIndBottom = Exa_DB_GetNextSetIndexInExam (Exam.ExaCod,SetIndTop);
|
||||
SetIndBottom = Exa_DB_GetNextSetIndexInExam (Exams.Exam.ExaCod,SetIndTop);
|
||||
if (SetIndBottom == 0)
|
||||
Err_ShowErrorAndExit ("Wrong set index.");
|
||||
|
||||
/* Exchange sets */
|
||||
ExaSet_ExchangeSets (Exam.ExaCod,SetIndTop,SetIndBottom);
|
||||
ExaSet_ExchangeSets (Exams.Exam.ExaCod,SetIndTop,SetIndBottom);
|
||||
}
|
||||
else
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -1557,17 +1534,16 @@ void ExaSet_RequestRemoveQstFromSet (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_question_X;
|
||||
extern const char *Txt_Remove_question;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
char *Anchor;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Get question index *****/
|
||||
Exams.QstCod = ExaSet_GetParamQstCod ();
|
||||
|
@ -1586,7 +1562,7 @@ void ExaSet_RequestRemoveQstFromSet (void)
|
|||
Frm_FreeAnchorStr (Anchor);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -1598,17 +1574,16 @@ void ExaSet_RemoveQstFromSet (void)
|
|||
{
|
||||
extern const char *Txt_Question_removed;
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
long QstCod;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Get question index *****/
|
||||
QstCod = ExaSet_GetParamQstCod ();
|
||||
|
@ -1624,7 +1599,7 @@ void ExaSet_RemoveQstFromSet (void)
|
|||
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -1680,27 +1655,26 @@ void ExaSet_InvalidateQst (void)
|
|||
static void ExaSet_ChangeValidityQst (Qst_Validity_t Validity)
|
||||
{
|
||||
struct Exa_Exams Exams;
|
||||
struct Exa_Exam Exam;
|
||||
struct ExaSet_Set Set;
|
||||
long QstCod;
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
Exa_ResetExam (&Exam);
|
||||
Exa_ResetExam (&Exams.Exam);
|
||||
ExaSet_ResetSet (&Set);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Exam,&Set);
|
||||
ExaSet_GetAndCheckParameters (&Exams,&Set);
|
||||
|
||||
/***** Get question index *****/
|
||||
QstCod = ExaSet_GetParamQstCod ();
|
||||
|
||||
/***** Validate/unvalidate question *****/
|
||||
Exa_DB_ChangeValidityQst (QstCod,Set.SetCod,Exam.ExaCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Exa_DB_ChangeValidityQst (QstCod,Set.SetCod,Exams.Exam.ExaCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Validity);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Exam,&Set,
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
false); // It's not a new exam
|
||||
}
|
||||
|
||||
|
@ -1709,27 +1683,24 @@ static void ExaSet_ChangeValidityQst (Qst_Validity_t Validity)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void ExaSet_GetAndCheckParameters (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSet_Set *Set)
|
||||
{
|
||||
/***** Get parameters *****/
|
||||
Exa_GetParams (Exams);
|
||||
if (Exams->ExaCod <= 0)
|
||||
if (Exams->Exam.ExaCod <= 0)
|
||||
Err_WrongExamExit ();
|
||||
Exam->ExaCod = Exams->ExaCod;
|
||||
Grp_GetParamWhichGroups ();
|
||||
if ((Set->SetCod = ExaSet_GetParamSetCod ()) <= 0)
|
||||
Err_WrongSetExit ();
|
||||
|
||||
/***** Get exam data from database *****/
|
||||
Exa_GetDataOfExamByCod (Exam);
|
||||
if (Exam->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Exa_GetDataOfExamByCod (&Exams->Exam);
|
||||
if (Exams->Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Err_WrongExamExit ();
|
||||
Exams->ExaCod = Exam->ExaCod;
|
||||
|
||||
/***** Get set data from database *****/
|
||||
ExaSet_GetDataOfSetByCod (Set);
|
||||
if (Set->ExaCod != Exam->ExaCod)
|
||||
if (Set->ExaCod != Exams->Exam.ExaCod)
|
||||
Err_WrongSetExit ();
|
||||
Exams->SetCod = Set->SetCod;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ void ExaSet_ReqSelectQstsToAddToSet (void);
|
|||
void ExaSet_ListQstsToAddToSet (void);
|
||||
|
||||
void ExaSet_ListExamSets (struct Exa_Exams *Exams,
|
||||
struct Exa_Exam *Exam,
|
||||
struct ExaSet_Set *Set);
|
||||
|
||||
void ExaSet_ResetSet (struct ExaSet_Set *Set);
|
||||
|
|
|
@ -62,6 +62,24 @@ struct Exa_ExamSelected
|
|||
bool Selected; // Is this exam selected when seeing match results?
|
||||
};
|
||||
|
||||
struct Exa_Exam
|
||||
{
|
||||
long ExaCod; // Exam code
|
||||
long CrsCod; // Course code
|
||||
long UsrCod; // Author code
|
||||
double MaxGrade; // Score range [0...max.score]
|
||||
// will be converted to
|
||||
// grade range [0...max.grade]
|
||||
unsigned Visibility; // Visibility of results
|
||||
char Title[Exa_MAX_BYTES_TITLE + 1];
|
||||
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||
bool Hidden; // Exam is hidden
|
||||
unsigned NumSets; // Number of sets in the exam
|
||||
unsigned NumQsts; // Number of questions in the exam
|
||||
unsigned NumSess; // Number of sessions in the exam
|
||||
unsigned NumOpenSess; // Number of open sessions in the exam
|
||||
};
|
||||
|
||||
/* Exams context */
|
||||
struct Exa_Exams
|
||||
{
|
||||
|
@ -74,7 +92,8 @@ struct Exa_Exams
|
|||
unsigned CurrentPage;
|
||||
char *ListQuestions;
|
||||
char *ExaCodsSelected; // String with selected exam codes separated by separator multiple
|
||||
long ExaCod; // Selected/current exam code
|
||||
struct Exa_Exam Exam; // Selected/current exam
|
||||
// long ExaCod; // Selected/current exam code
|
||||
long SetCod; // Selected/current set code
|
||||
long SesCod; // Selected/current session code
|
||||
unsigned SetInd; // Current set index
|
||||
|
@ -99,24 +118,6 @@ struct Exa_Exams
|
|||
+----------------+ +--------------+ +--------------+
|
||||
... ... */
|
||||
|
||||
struct Exa_Exam
|
||||
{
|
||||
long ExaCod; // Exam code
|
||||
long CrsCod; // Course code
|
||||
long UsrCod; // Author code
|
||||
double MaxGrade; // Score range [0...max.score]
|
||||
// will be converted to
|
||||
// grade range [0...max.grade]
|
||||
unsigned Visibility; // Visibility of results
|
||||
char Title[Exa_MAX_BYTES_TITLE + 1];
|
||||
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||
bool Hidden; // Exam is hidden
|
||||
unsigned NumSets; // Number of sets in the exam
|
||||
unsigned NumQsts; // Number of questions in the exam
|
||||
unsigned NumSess; // Number of sessions in the exam
|
||||
unsigned NumOpenSess; // Number of open sessions in the exam
|
||||
};
|
||||
|
||||
struct ExaSet_Set
|
||||
{
|
||||
long ExaCod; // Exam code
|
||||
|
|
Loading…
Reference in New Issue