mirror of https://github.com/acanas/swad-core.git
Version19.221
This commit is contained in:
parent
e3084d0799
commit
8427c5d8e6
|
@ -548,11 +548,12 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.220 (2020-05-09)"
|
#define Log_PLATFORM_VERSION "SWAD 19.221 (2020-05-09)"
|
||||||
#define CSS_FILE "swad19.217.css"
|
#define CSS_FILE "swad19.217.css"
|
||||||
#define JS_FILE "swad19.193.1.js"
|
#define JS_FILE "swad19.193.1.js"
|
||||||
/*
|
/*
|
||||||
Version 19.220: May 09, 2020 Exam prints. (302480 lines)
|
Version 19.221: May 09, 2020 Changes in exam prints. (302686 lines)
|
||||||
|
Version 19.220: May 09, 2020 Changes in exam prints. (302480 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
ALTER TABLE exa_print_questions ADD COLUMN SetCod INT NOT NULL AFTER QstInd;
|
ALTER TABLE exa_print_questions ADD COLUMN SetCod INT NOT NULL AFTER QstInd;
|
||||||
|
|
||||||
|
|
|
@ -99,9 +99,27 @@ static void ExaPrn_StoreOneQstOfPrintInDB (const struct ExaPrn_Print *Print,
|
||||||
unsigned NumQst);
|
unsigned NumQst);
|
||||||
static void ExaPrn_ShowExamPrintToFillIt (struct Exa_Exam *Exam,
|
static void ExaPrn_ShowExamPrintToFillIt (struct Exa_Exam *Exam,
|
||||||
struct ExaPrn_Print *Print);
|
struct ExaPrn_Print *Print);
|
||||||
|
static void ExaPrn_WriteQstAndAnsToFill (const struct Exa_Exam *Exam,
|
||||||
|
struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst,
|
||||||
|
const struct Tst_Question *Question);
|
||||||
|
static void ExaPrn_WriteAnswersToFill (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst,
|
||||||
|
const struct Tst_Question *Question);
|
||||||
|
static void ExaPrn_WriteIntAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst);
|
||||||
|
static void ExaPrn_WriteFloatAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst);
|
||||||
|
static void ExaPrn_WriteTFAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst);
|
||||||
|
static void ExaPrn_WriteChoiceAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst,
|
||||||
|
const struct Tst_Question *Question);
|
||||||
|
static void ExaPrn_WriteTextAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst);
|
||||||
|
|
||||||
static void ExaPrn_PutParamPrnCod (long ExaCod);
|
static void ExaPrn_PutParamPrnCod (long ExaCod);
|
||||||
static long ExaPrn_GetParamPrnCod (void);
|
// static long ExaPrn_GetParamPrnCod (void);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************************** Reset exam print *******************************/
|
/**************************** Reset exam print *******************************/
|
||||||
|
@ -129,7 +147,6 @@ static void ExaPrn_ResetPrintExceptPrnCod (struct ExaPrn_Print *Print)
|
||||||
|
|
||||||
void ExaPrn_ShowExamPrint (void)
|
void ExaPrn_ShowExamPrint (void)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ASSESSMENT_Exams;
|
|
||||||
struct Exa_Exams Exams;
|
struct Exa_Exams Exams;
|
||||||
struct Exa_Exam Exam;
|
struct Exa_Exam Exam;
|
||||||
struct ExaEvt_Event Event;
|
struct ExaEvt_Event Event;
|
||||||
|
@ -145,18 +162,6 @@ void ExaPrn_ShowExamPrint (void)
|
||||||
/***** Get and check parameters *****/
|
/***** Get and check parameters *****/
|
||||||
ExaEvt_GetAndCheckParameters (&Exams,&Exam,&Event);
|
ExaEvt_GetAndCheckParameters (&Exams,&Exam,&Event);
|
||||||
|
|
||||||
/***** Begin box *****/
|
|
||||||
Box_BoxBegin (NULL,Exam.Title,
|
|
||||||
NULL,NULL,
|
|
||||||
Hlp_ASSESSMENT_Exams,Box_NOT_CLOSABLE);
|
|
||||||
Lay_WriteHeaderClassPhoto (false,false,
|
|
||||||
Gbl.Hierarchy.Ins.InsCod,
|
|
||||||
Gbl.Hierarchy.Deg.DegCod,
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
|
||||||
|
|
||||||
/***** Begin table *****/
|
|
||||||
HTM_TABLE_BeginWideMarginPadding (10);
|
|
||||||
|
|
||||||
/***** Check if already exists exam in database *****/
|
/***** Check if already exists exam in database *****/
|
||||||
PrintExists = ExaPrn_CheckIfMyPrintExists (&Event);
|
PrintExists = ExaPrn_CheckIfMyPrintExists (&Event);
|
||||||
|
|
||||||
|
@ -180,9 +185,6 @@ void ExaPrn_ShowExamPrint (void)
|
||||||
|
|
||||||
/***** Show test exam to be answered *****/
|
/***** Show test exam to be answered *****/
|
||||||
ExaPrn_ShowExamPrintToFillIt (&Exam,&Print);
|
ExaPrn_ShowExamPrintToFillIt (&Exam,&Print);
|
||||||
|
|
||||||
/***** End table *****/
|
|
||||||
HTM_TABLE_End ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -205,8 +207,6 @@ static bool ExaPrn_CheckIfMyPrintExists (const struct ExaEvt_Event *Event)
|
||||||
static void ExaPrn_GetQuestionsForNewPrintFromDB (struct Exa_Exam *Exam,
|
static void ExaPrn_GetQuestionsForNewPrintFromDB (struct Exa_Exam *Exam,
|
||||||
struct ExaPrn_Print *Print)
|
struct ExaPrn_Print *Print)
|
||||||
{
|
{
|
||||||
extern const char *Txt_question;
|
|
||||||
extern const char *Txt_questions;
|
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned NumSets;
|
unsigned NumSets;
|
||||||
|
@ -254,30 +254,6 @@ static void ExaPrn_GetQuestionsForNewPrintFromDB (struct Exa_Exam *Exam,
|
||||||
Str_Copy (Set.Title,row[2],
|
Str_Copy (Set.Title,row[2],
|
||||||
ExaSet_MAX_BYTES_TITLE);
|
ExaSet_MAX_BYTES_TITLE);
|
||||||
|
|
||||||
/***** Title for this set *****/
|
|
||||||
/* Begin title for this set */
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
HTM_TD_Begin ("colspan=\"2\"");
|
|
||||||
HTM_TABLE_BeginWide ();
|
|
||||||
|
|
||||||
/* Title */
|
|
||||||
HTM_TD_Begin ("class=\"EXA_SET_TITLE\"");
|
|
||||||
HTM_Txt (Set.Title);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Number of questions to appear in exam print */
|
|
||||||
HTM_TD_Begin ("class=\"EXA_SET_NUM_QSTS\"");
|
|
||||||
HTM_Unsigned (Set.NumQstsToPrint);
|
|
||||||
HTM_NBSP ();
|
|
||||||
HTM_Txt (Set.NumQstsToPrint == 1 ? Txt_question :
|
|
||||||
Txt_questions);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* End title for this set */
|
|
||||||
HTM_TABLE_End ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** Questions in this set *****/
|
/***** Questions in this set *****/
|
||||||
NumQstsFromSet = ExaPrn_GetSomeQstsFromSetToPrint (Print,&Set,&NumQstInPrint);
|
NumQstsFromSet = ExaPrn_GetSomeQstsFromSetToPrint (Print,&Set,&NumQstInPrint);
|
||||||
Print->NumQsts += NumQstsFromSet;
|
Print->NumQsts += NumQstsFromSet;
|
||||||
|
@ -341,9 +317,6 @@ static unsigned ExaPrn_GetSomeQstsFromSetToPrint (struct ExaPrn_Print *Print,
|
||||||
/* Set set of questions */
|
/* Set set of questions */
|
||||||
Print->PrintedQuestions[*NumQstInPrint].SetCod = Set->SetCod;
|
Print->PrintedQuestions[*NumQstInPrint].SetCod = Set->SetCod;
|
||||||
|
|
||||||
Ale_ShowAlert (Ale_INFO,"DEBUG: ExaPrn_GetSomeQstsFromSetToPrint Print->PrintedQuestions[*NumQstInPrint].SetCod = %ld",
|
|
||||||
Print->PrintedQuestions[*NumQstInPrint].SetCod);
|
|
||||||
|
|
||||||
/* Get answer type (row[1]) */
|
/* Get answer type (row[1]) */
|
||||||
AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
||||||
|
|
||||||
|
@ -374,22 +347,6 @@ static unsigned ExaPrn_GetSomeQstsFromSetToPrint (struct ExaPrn_Print *Print,
|
||||||
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. */
|
||||||
Print->PrintedQuestions[*NumQstInPrint].StrAnswers[0] = '\0';
|
Print->PrintedQuestions[*NumQstInPrint].StrAnswers[0] = '\0';
|
||||||
|
|
||||||
/* Begin row for this question */
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
/* Title */
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
HTM_TxtF ("Pregunta %ld",Print->PrintedQuestions[*NumQstInPrint].QstCod);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Number of questions to appear in exam print */
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
HTM_Txt ("Enunciado y respuestas");
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* End title for this question */
|
|
||||||
HTM_TR_End ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NumQstsInSet;
|
return NumQstsInSet;
|
||||||
|
@ -471,9 +428,6 @@ static void ExaPrn_StoreOneQstOfPrintInDB (const struct ExaPrn_Print *Print,
|
||||||
Par_ReplaceSeparatorMultipleByComma (Print->PrintedQuestions[NumQst].StrIndexes,StrIndexes);
|
Par_ReplaceSeparatorMultipleByComma (Print->PrintedQuestions[NumQst].StrIndexes,StrIndexes);
|
||||||
Par_ReplaceSeparatorMultipleByComma (Print->PrintedQuestions[NumQst].StrAnswers,StrAnswers);
|
Par_ReplaceSeparatorMultipleByComma (Print->PrintedQuestions[NumQst].StrAnswers,StrAnswers);
|
||||||
|
|
||||||
Ale_ShowAlert (Ale_INFO,"DEBUG: ExaPrn_StoreOneQstOfPrintInDB Print->PrintedQuestions[NumQst].SetCod = %ld",
|
|
||||||
Print->PrintedQuestions[NumQst].SetCod);
|
|
||||||
|
|
||||||
/***** Insert question and user's answers into database *****/
|
/***** Insert question and user's answers into database *****/
|
||||||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||||
DB_QueryREPLACE ("can not update a question in an exam print",
|
DB_QueryREPLACE ("can not update a question in an exam print",
|
||||||
|
@ -536,7 +490,7 @@ static void ExaPrn_ShowExamPrintToFillIt (struct Exa_Exam *Exam,
|
||||||
Lay_ShowErrorAndExit ("Wrong question.");
|
Lay_ShowErrorAndExit ("Wrong question.");
|
||||||
|
|
||||||
/* Write question and answers */
|
/* Write question and answers */
|
||||||
Tst_WriteQstAndAnsSeeing (&Print->PrintedQuestions[NumQst],NumQst,&Question);
|
ExaPrn_WriteQstAndAnsToFill (Exam,&Print->PrintedQuestions[NumQst],NumQst,&Question);
|
||||||
|
|
||||||
/* Destroy test question */
|
/* Destroy test question */
|
||||||
Tst_QstDestructor (&Question);
|
Tst_QstDestructor (&Question);
|
||||||
|
@ -554,6 +508,260 @@ static void ExaPrn_ShowExamPrintToFillIt (struct Exa_Exam *Exam,
|
||||||
Box_BoxEnd ();
|
Box_BoxEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********** Write a row of a test, with one question and its answer **********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaPrn_WriteQstAndAnsToFill (const struct Exa_Exam *Exam,
|
||||||
|
struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst,
|
||||||
|
const struct Tst_Question *Question)
|
||||||
|
{
|
||||||
|
static struct ExaSet_Set CurrentSet =
|
||||||
|
{
|
||||||
|
.ExaCod = -1L,
|
||||||
|
.SetCod = -1L,
|
||||||
|
.SetInd = 0,
|
||||||
|
.NumQstsToPrint = 0,
|
||||||
|
.Title[0] = '\0'
|
||||||
|
};
|
||||||
|
|
||||||
|
if (PrintedQuestion->SetCod != CurrentSet.SetCod)
|
||||||
|
{
|
||||||
|
/***** Get data of this set *****/
|
||||||
|
CurrentSet.ExaCod = Exam->ExaCod;
|
||||||
|
CurrentSet.SetCod = PrintedQuestion->SetCod;
|
||||||
|
ExaSet_GetDataOfSetByCod (&CurrentSet);
|
||||||
|
|
||||||
|
/***** Title for this set *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
HTM_TD_Begin ("colspan=\"2\"");
|
||||||
|
ExaSet_WriteSetTitle (&CurrentSet);
|
||||||
|
HTM_TD_End ();
|
||||||
|
HTM_TR_End ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Begin row *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/***** Number of question and answer type *****/
|
||||||
|
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
Tst_WriteNumQst (NumQst + 1);
|
||||||
|
Tst_WriteAnswerType (Question->Answer.Type);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Stem, media and answers *****/
|
||||||
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
|
/* Write parameter with question code */
|
||||||
|
Tst_WriteParamQstCod (NumQst,Question->QstCod);
|
||||||
|
|
||||||
|
/* Stem */
|
||||||
|
Tst_WriteQstStem (Question->Stem,"TEST_EXA",true);
|
||||||
|
|
||||||
|
/* Media */
|
||||||
|
Med_ShowMedia (&Question->Media,
|
||||||
|
"TEST_MED_SHOW_CONT",
|
||||||
|
"TEST_MED_SHOW");
|
||||||
|
|
||||||
|
/* Answers */
|
||||||
|
ExaPrn_WriteAnswersToFill (PrintedQuestion,NumQst,Question);
|
||||||
|
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** End row *****/
|
||||||
|
HTM_TR_End ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************** Write answers of a question to fill them ******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaPrn_WriteAnswersToFill (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst,
|
||||||
|
const struct Tst_Question *Question)
|
||||||
|
{
|
||||||
|
/***** Write answer depending on type *****/
|
||||||
|
switch (Question->Answer.Type)
|
||||||
|
{
|
||||||
|
case Tst_ANS_INT:
|
||||||
|
ExaPrn_WriteIntAnsSeeing (PrintedQuestion,NumQst);
|
||||||
|
break;
|
||||||
|
case Tst_ANS_FLOAT:
|
||||||
|
ExaPrn_WriteFloatAnsSeeing (PrintedQuestion,NumQst);
|
||||||
|
break;
|
||||||
|
case Tst_ANS_TRUE_FALSE:
|
||||||
|
ExaPrn_WriteTFAnsSeeing (PrintedQuestion,NumQst);
|
||||||
|
break;
|
||||||
|
case Tst_ANS_UNIQUE_CHOICE:
|
||||||
|
case Tst_ANS_MULTIPLE_CHOICE:
|
||||||
|
ExaPrn_WriteChoiceAnsSeeing (PrintedQuestion,NumQst,Question);
|
||||||
|
break;
|
||||||
|
case Tst_ANS_TEXT:
|
||||||
|
ExaPrn_WriteTextAnsSeeing (PrintedQuestion,NumQst);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****************** Write integer answer when seeing a test ******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaPrn_WriteIntAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst)
|
||||||
|
{
|
||||||
|
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
||||||
|
|
||||||
|
/***** Write input field for the answer *****/
|
||||||
|
snprintf (StrAns,sizeof (StrAns),
|
||||||
|
"Ans%010u",
|
||||||
|
NumQst);
|
||||||
|
HTM_INPUT_TEXT (StrAns,11,PrintedQuestion->StrAnswers,
|
||||||
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
|
"size=\"11\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****************** Write float answer when seeing a test ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaPrn_WriteFloatAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst)
|
||||||
|
{
|
||||||
|
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
||||||
|
|
||||||
|
/***** Write input field for the answer *****/
|
||||||
|
snprintf (StrAns,sizeof (StrAns),
|
||||||
|
"Ans%010u",
|
||||||
|
NumQst);
|
||||||
|
HTM_INPUT_TEXT (StrAns,Tst_MAX_BYTES_FLOAT_ANSWER,PrintedQuestion->StrAnswers,
|
||||||
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
|
"size=\"11\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************** Write false / true answer when seeing a test ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaPrn_WriteTFAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst)
|
||||||
|
{
|
||||||
|
extern const char *Txt_TF_QST[2];
|
||||||
|
|
||||||
|
/***** Write selector for the answer *****/
|
||||||
|
/* 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 ==>
|
||||||
|
==> the exam may be half filled ==> the answers displayed will be those selected by the user. */
|
||||||
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
|
"name=\"Ans%010u\"",NumQst);
|
||||||
|
HTM_OPTION (HTM_Type_STRING,"" ,PrintedQuestion->StrAnswers[0] == '\0',false," ");
|
||||||
|
HTM_OPTION (HTM_Type_STRING,"T",PrintedQuestion->StrAnswers[0] == 'T' ,false,"%s",Txt_TF_QST[0]);
|
||||||
|
HTM_OPTION (HTM_Type_STRING,"F",PrintedQuestion->StrAnswers[0] == 'F' ,false,"%s",Txt_TF_QST[1]);
|
||||||
|
HTM_SELECT_End ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******** Write single or multiple choice answer when seeing a test **********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaPrn_WriteChoiceAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst,
|
||||||
|
const struct Tst_Question *Question)
|
||||||
|
{
|
||||||
|
unsigned NumOpt;
|
||||||
|
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]; // Indexes of all answers of this question
|
||||||
|
bool UsrAnswers[Tst_MAX_OPTIONS_PER_QUESTION];
|
||||||
|
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
||||||
|
|
||||||
|
/***** Get indexes for this question from string *****/
|
||||||
|
TstPrn_GetIndexesFromStr (PrintedQuestion->StrIndexes,Indexes);
|
||||||
|
|
||||||
|
/***** Get the user's answers for this question from string *****/
|
||||||
|
TstPrn_GetAnswersFromStr (PrintedQuestion->StrAnswers,UsrAnswers);
|
||||||
|
|
||||||
|
/***** Begin table *****/
|
||||||
|
HTM_TABLE_BeginPadding (2);
|
||||||
|
|
||||||
|
for (NumOpt = 0;
|
||||||
|
NumOpt < Question->Answer.NumOptions;
|
||||||
|
NumOpt++)
|
||||||
|
{
|
||||||
|
/***** Indexes are 0 1 2 3... if no shuffle
|
||||||
|
or 3 1 0 2... (example) if shuffle *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/***** Write selectors and letter of this option *****/
|
||||||
|
/* 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 ==>
|
||||||
|
==> the exam may be half filled ==> the answers displayed will be those selected by the user. */
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
|
||||||
|
snprintf (StrAns,sizeof (StrAns),
|
||||||
|
"Ans%010u",
|
||||||
|
NumQst);
|
||||||
|
if (Question->Answer.Type == Tst_ANS_UNIQUE_CHOICE)
|
||||||
|
HTM_INPUT_RADIO (StrAns,false,
|
||||||
|
"id=\"Ans%010u_%u\" value=\"%u\"%s"
|
||||||
|
" onclick=\"selectUnselectRadio(this,this.form.Ans%010u,%u);\"",
|
||||||
|
NumQst,NumOpt,
|
||||||
|
Indexes[NumOpt],
|
||||||
|
UsrAnswers[Indexes[NumOpt]] ? " checked=\"checked\"" :
|
||||||
|
"",
|
||||||
|
NumQst,Question->Answer.NumOptions);
|
||||||
|
else // Answer.Type == Tst_ANS_MULTIPLE_CHOICE
|
||||||
|
HTM_INPUT_CHECKBOX (StrAns,HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
|
"id=\"Ans%010u_%u\" value=\"%u\"%s",
|
||||||
|
NumQst,NumOpt,
|
||||||
|
Indexes[NumOpt],
|
||||||
|
UsrAnswers[Indexes[NumOpt]] ? " checked=\"checked\"" :
|
||||||
|
"");
|
||||||
|
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
HTM_LABEL_Begin ("for=\"Ans%010u_%u\" class=\"ANS_TXT\"",NumQst,NumOpt);
|
||||||
|
HTM_TxtF ("%c) ",'a' + (char) NumOpt);
|
||||||
|
HTM_LABEL_End ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Write the option text *****/
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
HTM_LABEL_Begin ("for=\"Ans%010u_%u\" class=\"ANS_TXT\"",NumQst,NumOpt);
|
||||||
|
HTM_Txt (Question->Answer.Options[Indexes[NumOpt]].Text);
|
||||||
|
HTM_LABEL_End ();
|
||||||
|
Med_ShowMedia (&Question->Answer.Options[Indexes[NumOpt]].Media,
|
||||||
|
"TEST_MED_SHOW_CONT",
|
||||||
|
"TEST_MED_SHOW");
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** End table *****/
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Write text answer when seeing a test *******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaPrn_WriteTextAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst)
|
||||||
|
{
|
||||||
|
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
||||||
|
|
||||||
|
/***** Write input field for the answer *****/
|
||||||
|
snprintf (StrAns,sizeof (StrAns),
|
||||||
|
"Ans%010u",
|
||||||
|
NumQst);
|
||||||
|
HTM_INPUT_TEXT (StrAns,Tst_MAX_CHARS_ANSWERS_ONE_QST,PrintedQuestion->StrAnswers,
|
||||||
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
|
"size=\"40\"");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************** Receive answer to an exam print **********************/
|
/********************** Receive answer to an exam print **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -576,8 +784,8 @@ static void ExaPrn_PutParamPrnCod (long ExaCod)
|
||||||
/***************** Get parameter with code of exam print *********************/
|
/***************** Get parameter with code of exam print *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static long ExaPrn_GetParamPrnCod (void)
|
// static long ExaPrn_GetParamPrnCod (void)
|
||||||
{
|
// {
|
||||||
/***** Get code of exam print *****/
|
// /***** Get code of exam print *****/
|
||||||
return Par_GetParToLong ("PrnCod");
|
// return Par_GetParToLong ("PrnCod");
|
||||||
}
|
// }
|
||||||
|
|
|
@ -1938,3 +1938,32 @@ static void ExaSet_PutButtonToAddNewQuestions (struct Exa_Exams *Exams)
|
||||||
Btn_PutConfirmButtonInline (Txt_Add_questions);
|
Btn_PutConfirmButtonInline (Txt_Add_questions);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************* Show title of exam set in exam print ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void ExaSet_WriteSetTitle (const struct ExaSet_Set *Set)
|
||||||
|
{
|
||||||
|
extern const char *Txt_question;
|
||||||
|
extern const char *Txt_questions;
|
||||||
|
|
||||||
|
/***** Begin table *****/
|
||||||
|
HTM_TABLE_BeginWide ();
|
||||||
|
|
||||||
|
/***** Title *****/
|
||||||
|
HTM_TD_Begin ("class=\"EXA_SET_TITLE\"");
|
||||||
|
HTM_Txt (Set->Title);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Number of questions to appear in exam print *****/
|
||||||
|
HTM_TD_Begin ("class=\"EXA_SET_NUM_QSTS\"");
|
||||||
|
HTM_Unsigned (Set->NumQstsToPrint);
|
||||||
|
HTM_NBSP ();
|
||||||
|
HTM_Txt (Set->NumQstsToPrint == 1 ? Txt_question :
|
||||||
|
Txt_questions);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** End table *****/
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
void ExaSet_PutParamsOneSet (void *Exams);
|
void ExaSet_PutParamsOneSet (void *Exams);
|
||||||
long ExaSet_GetParamSetCod (void);
|
long ExaSet_GetParamSetCod (void);
|
||||||
|
|
||||||
|
void ExaSet_GetDataOfSetByCod (struct ExaSet_Set *Set);
|
||||||
|
|
||||||
void ExaSet_ReceiveFormSet (void);
|
void ExaSet_ReceiveFormSet (void);
|
||||||
void ExaSet_ChangeSetTitle (void);
|
void ExaSet_ChangeSetTitle (void);
|
||||||
void ExaSet_ChangeNumQstsToExam (void);
|
void ExaSet_ChangeNumQstsToExam (void);
|
||||||
|
@ -72,4 +74,6 @@ void ExaSet_MoveDownSet (void);
|
||||||
void ExaSet_RequestRemoveQstFromSet (void);
|
void ExaSet_RequestRemoveQstFromSet (void);
|
||||||
void ExaSet_RemoveQstFromSet (void);
|
void ExaSet_RemoveQstFromSet (void);
|
||||||
|
|
||||||
|
void ExaSet_WriteSetTitle (const struct ExaSet_Set *Set);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
85
swad_test.c
85
swad_test.c
|
@ -79,7 +79,6 @@ const char *Tst_StrAnswerTypesXML[Tst_NUM_ANS_TYPES] =
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Tst_MAX_BYTES_TAGS_LIST (16 * 1024)
|
#define Tst_MAX_BYTES_TAGS_LIST (16 * 1024)
|
||||||
#define Tst_MAX_BYTES_FLOAT_ANSWER 30 // Maximum length of the strings that store an floating point answer
|
|
||||||
|
|
||||||
static const char *Tst_StrAnswerTypesDB[Tst_NUM_ANS_TYPES] =
|
static const char *Tst_StrAnswerTypesDB[Tst_NUM_ANS_TYPES] =
|
||||||
{
|
{
|
||||||
|
@ -140,6 +139,9 @@ static unsigned Tst_GetNumExamsGeneratedByMe (void);
|
||||||
static void Tst_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
|
static void Tst_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
|
||||||
unsigned NumExamsGeneratedByMe,
|
unsigned NumExamsGeneratedByMe,
|
||||||
Tst_RequestOrConfirm_t RequestOrConfirm);
|
Tst_RequestOrConfirm_t RequestOrConfirm);
|
||||||
|
static void TstPrn_WriteQstAndAnsToFill (struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
|
unsigned NumQst,
|
||||||
|
const struct Tst_Question *Question);
|
||||||
|
|
||||||
static void Tst_PutFormToEditQstMedia (const struct Media *Media,int NumMediaInForm,
|
static void Tst_PutFormToEditQstMedia (const struct Media *Media,int NumMediaInForm,
|
||||||
bool OptionsDisabled);
|
bool OptionsDisabled);
|
||||||
|
@ -189,31 +191,30 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Gam
|
||||||
static void Tst_WriteQuestionRowForSelection (unsigned NumQst,
|
static void Tst_WriteQuestionRowForSelection (unsigned NumQst,
|
||||||
struct Tst_Question *Question);
|
struct Tst_Question *Question);
|
||||||
|
|
||||||
static void Tst_WriteAnswersSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteAnswersToFill (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst,
|
unsigned NumQst,
|
||||||
const struct Tst_Question *Question);
|
const struct Tst_Question *Question);
|
||||||
|
|
||||||
static void Tst_WriteIntAnsListing (const struct Tst_Question *Question);
|
static void Tst_WriteIntAnsListing (const struct Tst_Question *Question);
|
||||||
static void Tst_WriteIntAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteIntAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst);
|
unsigned NumQst);
|
||||||
|
|
||||||
static void Tst_WriteFloatAnsEdit (const struct Tst_Question *Question);
|
static void Tst_WriteFloatAnsEdit (const struct Tst_Question *Question);
|
||||||
static void Tst_WriteFloatAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteFloatAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst);
|
unsigned NumQst);
|
||||||
|
|
||||||
static void Tst_WriteTFAnsListing (const struct Tst_Question *Question);
|
static void Tst_WriteTFAnsListing (const struct Tst_Question *Question);
|
||||||
static void Tst_WriteTFAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteTFAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst);
|
unsigned NumQst);
|
||||||
|
|
||||||
static void Tst_WriteChoiceAnsListing (const struct Tst_Question *Question);
|
static void Tst_WriteChoiceAnsListing (const struct Tst_Question *Question);
|
||||||
static void Tst_WriteChoiceAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteChoiceAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst,
|
unsigned NumQst,
|
||||||
const struct Tst_Question *Question);
|
const struct Tst_Question *Question);
|
||||||
|
|
||||||
static void Tst_WriteTextAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteTextAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst);
|
unsigned NumQst);
|
||||||
|
|
||||||
static void Tst_WriteParamQstCod (unsigned NumQst,long QstCod);
|
|
||||||
static bool Tst_GetParamsTst (struct Tst_Test *Test,
|
static bool Tst_GetParamsTst (struct Tst_Test *Test,
|
||||||
Tst_ActionToDoWithQuestions_t ActionToDoWithQuestions);
|
Tst_ActionToDoWithQuestions_t ActionToDoWithQuestions);
|
||||||
static unsigned Tst_GetParamNumTst (void);
|
static unsigned Tst_GetParamNumTst (void);
|
||||||
|
@ -833,7 +834,7 @@ static void Tst_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
|
||||||
Lay_ShowErrorAndExit ("Wrong question.");
|
Lay_ShowErrorAndExit ("Wrong question.");
|
||||||
|
|
||||||
/* Write question and answers */
|
/* Write question and answers */
|
||||||
Tst_WriteQstAndAnsSeeing (&Print->PrintedQuestions[NumQst],NumQst,&Question);
|
TstPrn_WriteQstAndAnsToFill (&Print->PrintedQuestions[NumQst],NumQst,&Question);
|
||||||
|
|
||||||
/* Destroy test question */
|
/* Destroy test question */
|
||||||
Tst_QstDestructor (&Question);
|
Tst_QstDestructor (&Question);
|
||||||
|
@ -897,9 +898,9 @@ void Tst_ShowTagList (unsigned NumTags,MYSQL_RES *mysql_res)
|
||||||
/********** Write a row of a test, with one question and its answer **********/
|
/********** Write a row of a test, with one question and its answer **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Tst_WriteQstAndAnsSeeing (struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteQstAndAnsToFill (struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst,
|
unsigned NumQst,
|
||||||
const struct Tst_Question *Question)
|
const struct Tst_Question *Question)
|
||||||
{
|
{
|
||||||
/***** Begin row *****/
|
/***** Begin row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
@ -925,7 +926,7 @@ void Tst_WriteQstAndAnsSeeing (struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
"TEST_MED_SHOW");
|
"TEST_MED_SHOW");
|
||||||
|
|
||||||
/* Answers */
|
/* Answers */
|
||||||
Tst_WriteAnswersSeeing (PrintedQuestion,NumQst,Question);
|
TstPrn_WriteAnswersToFill (PrintedQuestion,NumQst,Question);
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
@ -3350,31 +3351,31 @@ void Tst_WriteAnswersListing (const struct Tst_Question *Question)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************** Write answers of a question when seeing a test ***************/
|
/***************** Write answers of a question to fill them ******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_WriteAnswersSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteAnswersToFill (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst,
|
unsigned NumQst,
|
||||||
const struct Tst_Question *Question)
|
const struct Tst_Question *Question)
|
||||||
{
|
{
|
||||||
/***** Write answer depending on type *****/
|
/***** Write answer depending on type *****/
|
||||||
switch (Question->Answer.Type)
|
switch (Question->Answer.Type)
|
||||||
{
|
{
|
||||||
case Tst_ANS_INT:
|
case Tst_ANS_INT:
|
||||||
Tst_WriteIntAnsSeeing (PrintedQuestion,NumQst);
|
TstPrn_WriteIntAnsSeeing (PrintedQuestion,NumQst);
|
||||||
break;
|
break;
|
||||||
case Tst_ANS_FLOAT:
|
case Tst_ANS_FLOAT:
|
||||||
Tst_WriteFloatAnsSeeing (PrintedQuestion,NumQst);
|
TstPrn_WriteFloatAnsSeeing (PrintedQuestion,NumQst);
|
||||||
break;
|
break;
|
||||||
case Tst_ANS_TRUE_FALSE:
|
case Tst_ANS_TRUE_FALSE:
|
||||||
Tst_WriteTFAnsSeeing (PrintedQuestion,NumQst);
|
TstPrn_WriteTFAnsSeeing (PrintedQuestion,NumQst);
|
||||||
break;
|
break;
|
||||||
case Tst_ANS_UNIQUE_CHOICE:
|
case Tst_ANS_UNIQUE_CHOICE:
|
||||||
case Tst_ANS_MULTIPLE_CHOICE:
|
case Tst_ANS_MULTIPLE_CHOICE:
|
||||||
Tst_WriteChoiceAnsSeeing (PrintedQuestion,NumQst,Question);
|
TstPrn_WriteChoiceAnsSeeing (PrintedQuestion,NumQst,Question);
|
||||||
break;
|
break;
|
||||||
case Tst_ANS_TEXT:
|
case Tst_ANS_TEXT:
|
||||||
Tst_WriteTextAnsSeeing (PrintedQuestion,NumQst);
|
TstPrn_WriteTextAnsSeeing (PrintedQuestion,NumQst);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -3410,8 +3411,8 @@ static void Tst_WriteIntAnsListing (const struct Tst_Question *Question)
|
||||||
/****************** Write integer answer when seeing a test ******************/
|
/****************** Write integer answer when seeing a test ******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_WriteIntAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteIntAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst)
|
unsigned NumQst)
|
||||||
{
|
{
|
||||||
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
||||||
|
|
||||||
|
@ -3443,8 +3444,8 @@ static void Tst_WriteFloatAnsEdit (const struct Tst_Question *Question)
|
||||||
/****************** Write float answer when seeing a test ********************/
|
/****************** Write float answer when seeing a test ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_WriteFloatAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteFloatAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst)
|
unsigned NumQst)
|
||||||
{
|
{
|
||||||
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
||||||
|
|
||||||
|
@ -3475,8 +3476,8 @@ static void Tst_WriteTFAnsListing (const struct Tst_Question *Question)
|
||||||
/************** Write false / true answer when seeing a test ****************/
|
/************** Write false / true answer when seeing a test ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_WriteTFAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteTFAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst)
|
unsigned NumQst)
|
||||||
{
|
{
|
||||||
extern const char *Txt_TF_QST[2];
|
extern const char *Txt_TF_QST[2];
|
||||||
|
|
||||||
|
@ -3608,9 +3609,9 @@ static void Tst_WriteChoiceAnsListing (const struct Tst_Question *Question)
|
||||||
/******** Write single or multiple choice answer when seeing a test **********/
|
/******** Write single or multiple choice answer when seeing a test **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_WriteChoiceAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteChoiceAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst,
|
unsigned NumQst,
|
||||||
const struct Tst_Question *Question)
|
const struct Tst_Question *Question)
|
||||||
{
|
{
|
||||||
unsigned NumOpt;
|
unsigned NumOpt;
|
||||||
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]; // Indexes of all answers of this question
|
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]; // Indexes of all answers of this question
|
||||||
|
@ -3749,8 +3750,8 @@ void Tst_GetChoiceAns (struct Tst_Question *Question,MYSQL_RES *mysql_res)
|
||||||
/******************** Write text answer when seeing a test *******************/
|
/******************** Write text answer when seeing a test *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_WriteTextAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
static void TstPrn_WriteTextAnsSeeing (const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
unsigned NumQst)
|
unsigned NumQst)
|
||||||
{
|
{
|
||||||
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
||||||
|
|
||||||
|
@ -3767,7 +3768,7 @@ static void Tst_WriteTextAnsSeeing (const struct TstPrn_PrintedQuestion *Printed
|
||||||
/*************** Write parameter with the code of a question *****************/
|
/*************** Write parameter with the code of a question *****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_WriteParamQstCod (unsigned NumQst,long QstCod)
|
void Tst_WriteParamQstCod (unsigned NumQst,long QstCod)
|
||||||
{
|
{
|
||||||
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
char StrAns[3 + Cns_MAX_DECIMAL_DIGITS_UINT + 1]; // "Ansxx...x"
|
||||||
|
|
||||||
|
|
|
@ -106,10 +106,6 @@ void Tst_AssessTest (void);
|
||||||
|
|
||||||
void Tst_ShowTagList (unsigned NumTags,MYSQL_RES *mysql_res);
|
void Tst_ShowTagList (unsigned NumTags,MYSQL_RES *mysql_res);
|
||||||
|
|
||||||
void Tst_WriteQstAndAnsSeeing (struct TstPrn_PrintedQuestion *PrintedQuestion,
|
|
||||||
unsigned NumQst,
|
|
||||||
const struct Tst_Question *Question);
|
|
||||||
|
|
||||||
void Tst_ListQuestionForEdition (const struct Tst_Question *Question,
|
void Tst_ListQuestionForEdition (const struct Tst_Question *Question,
|
||||||
unsigned QstInd,bool QuestionExists,
|
unsigned QstInd,bool QuestionExists,
|
||||||
const char *Anchor);
|
const char *Anchor);
|
||||||
|
@ -138,6 +134,9 @@ void Tst_WriteAnswersListing (const struct Tst_Question *Question);
|
||||||
bool Tst_CheckIfQuestionIsValidForGame (long QstCod);
|
bool Tst_CheckIfQuestionIsValidForGame (long QstCod);
|
||||||
void Tst_WriteAnsTF (char AnsTF);
|
void Tst_WriteAnsTF (char AnsTF);
|
||||||
void Tst_GetChoiceAns (struct Tst_Question *Question,MYSQL_RES *mysql_res);
|
void Tst_GetChoiceAns (struct Tst_Question *Question,MYSQL_RES *mysql_res);
|
||||||
|
|
||||||
|
void Tst_WriteParamQstCod (unsigned NumQst,long QstCod);
|
||||||
|
|
||||||
void Tst_CheckIfNumberOfAnswersIsOne (const struct Tst_Question *Question);
|
void Tst_CheckIfNumberOfAnswersIsOne (const struct Tst_Question *Question);
|
||||||
|
|
||||||
unsigned long Tst_GetTagsQst (long QstCod,MYSQL_RES **mysql_res);
|
unsigned long Tst_GetTagsQst (long QstCod,MYSQL_RES **mysql_res);
|
||||||
|
|
|
@ -26,15 +26,16 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************************* Headers ***********************************/
|
/********************************* Headers ***********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Public constants ******************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Tst_MAX_TAGS_PER_QUESTION 5
|
#define Tst_MAX_TAGS_PER_QUESTION 5
|
||||||
|
|
||||||
#define Tst_MAX_CHARS_TAG (128 - 1) // 127
|
#define Tst_MAX_CHARS_TAG (128 - 1) // 127
|
||||||
#define Tst_MAX_BYTES_TAG ((Tst_MAX_CHARS_TAG + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
#define Tst_MAX_BYTES_TAG ((Tst_MAX_CHARS_TAG + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||||
|
|
||||||
/*****************************************************************************/
|
#define Tst_MAX_BYTES_FLOAT_ANSWER 30 // Maximum length of the strings that store an floating point answer
|
||||||
/***************************** Public constants ******************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
#define Tst_MAX_OPTIONS_PER_QUESTION 10
|
#define Tst_MAX_OPTIONS_PER_QUESTION 10
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue