Version 21.42.1: Oct 25, 2021 Code refactoring in test questions.

This commit is contained in:
acanas 2021-10-25 09:30:46 +02:00
parent 265aa7e578
commit 9ab6f4c2d5
11 changed files with 515 additions and 512 deletions

View File

@ -74,7 +74,7 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \
swad_place.o swad_place_database.o swad_plugin.o swad_plugin_database.o \
swad_privacy.o swad_profile.o swad_profile_database.o swad_program.o \
swad_program_database.o swad_project.o swad_project_database.o \
swad_QR.o \
swad_question_import.o swad_QR.o \
swad_record.o swad_record_database.o swad_report.o \
swad_report_database.o swad_role.o swad_role_database.o swad_room.o \
swad_room_database.o swad_RSS.o \
@ -83,14 +83,12 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \
swad_statistic_database.o swad_string.o swad_survey.o \
swad_survey_database.o swad_syllabus.o swad_system_config.o \
swad_tab.o swad_tag.o swad_tag_database.o swad_test.o \
swad_test_config.o swad_test_import.o swad_test_print.o \
swad_test_visibility.o swad_theme.o swad_timeline.o \
swad_timeline_comment.o swad_timeline_database.o \
swad_timeline_favourite.o swad_timeline_form.o swad_timeline_note.o \
swad_timeline_notification.o swad_timeline_post.o \
swad_timeline_publication.o swad_timeline_share.o \
swad_timeline_user.o swad_timeline_who.o \
swad_timetable.o \
swad_test_config.o swad_test_print.o swad_test_visibility.o \
swad_theme.o swad_timeline.o swad_timeline_comment.o \
swad_timeline_database.o swad_timeline_favourite.o swad_timeline_form.o \
swad_timeline_note.o swad_timeline_notification.o swad_timeline_post.o \
swad_timeline_publication.o swad_timeline_share.o swad_timeline_user.o \
swad_timeline_who.o swad_timetable.o \
swad_user.o \
swad_xml.o \
swad_zip.o

View File

@ -87,6 +87,7 @@
#include "swad_profile.h"
#include "swad_program.h"
#include "swad_project.h"
#include "swad_question_import.h"
#include "swad_QR.h"
#include "swad_report.h"
#include "swad_role.h"
@ -96,7 +97,6 @@
#include "swad_system_config.h"
#include "swad_tab.h"
#include "swad_tag.h"
#include "swad_test_import.h"
#include "swad_timeline.h"
#include "swad_timeline_comment.h"
#include "swad_timeline_favourite.h"
@ -669,8 +669,8 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActUnhCfe ] = {1621,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cfe_UnhideCallForExam ,Cfe_ListCallsForExamsEdit ,NULL},
[ActEdiOneTstQst ] = { 105,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Qst_ShowFormEditOneQst ,NULL},
[ActReqImpTstQst ] = {1007,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TsI_ShowFormImportQstsFromXML ,NULL},
[ActImpTstQst ] = {1008,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,TsI_ImportQstsFromXML ,NULL},
[ActReqImpTstQst ] = {1007,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,QstImp_ShowFormImportQstsFromXML ,NULL},
[ActImpTstQst ] = {1008,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,QstImp_ImportQstsFromXML ,NULL},
[ActLstTstQst ] = { 132,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Qst_ListQuestionsToEdit ,NULL},
[ActRcvTstQst ] = { 126,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,Qst_ReceiveQst ,NULL},
[ActReqRemSevTstQst ] = {1835,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Qst_RequestRemoveSelectedQsts ,NULL},

View File

@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
*/
#define Log_PLATFORM_VERSION "SWAD 21.42 (2021-10-24)"
#define Log_PLATFORM_VERSION "SWAD 21.42.1 (2021-10-25)"
#define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.69.1.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 21.42.1: Oct 25, 2021 Code refactoring in test questions. (320784 lines)
Version 21.42: Oct 24, 2021 Code refactoring in test questions. (320782 lines)
Version 21.41.2: Oct 24, 2021 Query moved to module swad_setting_database. (320777 lines)
Version 21.41.1: Oct 24, 2021 Queries moved to module swad_tag_database. (320767 lines)

View File

@ -607,7 +607,7 @@ void ExaSet_ListQstsToAddToSet (void)
Exams.SetCod = Set.SetCod;
/***** List several test questions for selection *****/
Tst_ListQuestionsToSelectForSet (&Exams);
Qst_ListQuestionsToSelectForExamSet (&Exams);
/***** Show current exam and its sets *****/
Exa_PutFormsOneExam (&Exams,&Exam,&Set,

View File

@ -1616,7 +1616,7 @@ void Gam_ListQstsToAddToGame (void)
/***** List several test questions for selection *****/
Games.GamCod = Game.GamCod;
Tst_ListQuestionsToSelectForGame (&Games);
Qst_ListQuestionsToSelectForGame (&Games);
}
/*****************************************************************************/

View File

@ -67,21 +67,21 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/
/*****************************************************************************/
static void TsI_PutParamsExportQsts (void *Test);
static void TsI_PutCreateXMLParam (void);
static void QstImp_PutParamsExportQsts (void *Test);
static void QstImp_PutCreateXMLParam (void);
static void TsI_ExportQuestion (struct Qst_Question *Question,FILE *FileXML);
static void QstImp_ExportQuestion (struct Qst_Question *Question,FILE *FileXML);
static void TsI_GetAndWriteTagsXML (long QstCod,FILE *FileXML);
static void TsI_WriteAnswersOfAQstXML (const struct Qst_Question *Question,
static void QstImp_GetAndWriteTagsXML (long QstCod,FILE *FileXML);
static void QstImp_WriteAnswersOfAQstXML (const struct Qst_Question *Question,
FILE *FileXML);
static void TsI_ReadQuestionsFromXMLFileAndStoreInDB (const char *FileNameXML);
static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer);
static Qst_AnswerType_t TsI_ConvertFromStrAnsTypXMLToAnsTyp (const char *StrAnsTypeXML);
static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem,
static void QstImp_ReadQuestionsFromXMLFileAndStoreInDB (const char *FileNameXML);
static void QstImp_ImportQuestionsFromXMLBuffer (const char *XMLBuffer);
static Qst_AnswerType_t QstImp_ConvertFromStrAnsTypXMLToAnsTyp (const char *StrAnsTypeXML);
static void QstImp_GetAnswerFromXML (struct XMLElement *AnswerElem,
struct Qst_Question *Question);
static void TsI_WriteHeadingListImportedQst (void);
static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
static void QstImp_WriteHeadingListImportedQst (void);
static void QstImp_WriteRowImportedQst (struct XMLElement *StemElem,
struct XMLElement *FeedbackElem,
const struct Qst_Question *Question,
bool QuestionExists);
@ -90,13 +90,13 @@ static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
/**************** Put a link (form) to export test questions *****************/
/*****************************************************************************/
void TsI_PutIconToExportQuestions (struct Tst_Test *Test)
void QstImp_PutIconToExportQuestions (struct Tst_Test *Test)
{
extern const char *Txt_Export_questions;
/***** Put a link to create a file with questions *****/
Lay_PutContextualLinkOnlyIcon (ActLstTstQst,NULL,
TsI_PutParamsExportQsts,Test,
QstImp_PutParamsExportQsts,Test,
"file-import.svg",
Txt_Export_questions);
}
@ -105,14 +105,14 @@ void TsI_PutIconToExportQuestions (struct Tst_Test *Test)
/****************** Put params to export test questions **********************/
/*****************************************************************************/
static void TsI_PutParamsExportQsts (void *Test)
static void QstImp_PutParamsExportQsts (void *Test)
{
if (Test)
{
Qst_PutParamsEditQst (Test);
Par_PutHiddenParamChar ("OnlyThisQst",'N');
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) (((struct Tst_Test *) Test)->SelectedOrder));
TsI_PutCreateXMLParam ();
QstImp_PutCreateXMLParam ();
}
}
@ -120,12 +120,12 @@ static void TsI_PutParamsExportQsts (void *Test)
/************************ Parameter to create XML file ***********************/
/*****************************************************************************/
static void TsI_PutCreateXMLParam (void)
static void QstImp_PutCreateXMLParam (void)
{
Par_PutHiddenParamChar ("CreateXML",'Y');
}
bool TsI_GetCreateXMLParamFromForm (void)
bool QstImp_GetCreateXMLParamFromForm (void)
{
return Par_GetParToBool ("CreateXML");
}
@ -134,7 +134,7 @@ bool TsI_GetCreateXMLParamFromForm (void)
/*************** Put a link (form) to import test questions ******************/
/*****************************************************************************/
void TsI_PutIconToImportQuestions (void)
void QstImp_PutIconToImportQuestions (void)
{
extern const char *Txt_Import_questions;
@ -149,7 +149,7 @@ void TsI_PutIconToImportQuestions (void)
/*********** Show form to import test questions from an XML file *************/
/*****************************************************************************/
void TsI_ShowFormImportQstsFromXML (void)
void QstImp_ShowFormImportQstsFromXML (void)
{
extern const char *Hlp_ASSESSMENT_Tests;
extern const char *The_ClassFormInBox[The_NUM_THEMES];
@ -183,7 +183,7 @@ void TsI_ShowFormImportQstsFromXML (void)
/*** Create the XML file with test questions and put a link to download it ***/
/*****************************************************************************/
void TsI_CreateXML (unsigned NumQsts,MYSQL_RES *mysql_res)
void QstImp_CreateXML (unsigned NumQsts,MYSQL_RES *mysql_res)
{
extern const char *The_ClassFormOutBoxBold[The_NUM_THEMES];
extern const char *Txt_NEW_LINE;
@ -223,7 +223,7 @@ void TsI_CreateXML (unsigned NumQsts,MYSQL_RES *mysql_res)
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
Err_WrongQuestionExit ();
TsI_ExportQuestion (&Question,FileXML);
QstImp_ExportQuestion (&Question,FileXML);
/* Destroy test question */
Qst_QstDestructor (&Question);
@ -253,7 +253,7 @@ void TsI_CreateXML (unsigned NumQsts,MYSQL_RES *mysql_res)
/****************** Write one question into the XML file *********************/
/*****************************************************************************/
static void TsI_ExportQuestion (struct Qst_Question *Question,FILE *FileXML)
static void QstImp_ExportQuestion (struct Qst_Question *Question,FILE *FileXML)
{
extern const char *Tst_StrAnswerTypesXML[Qst_NUM_ANS_TYPES];
extern const char *Txt_NEW_LINE;
@ -266,7 +266,7 @@ static void TsI_ExportQuestion (struct Qst_Question *Question,FILE *FileXML)
/***** Write the question tags *****/
fprintf (FileXML,"<tags>%s",Txt_NEW_LINE);
TsI_GetAndWriteTagsXML (Question->QstCod,FileXML);
QstImp_GetAndWriteTagsXML (Question->QstCod,FileXML);
fprintf (FileXML,"</tags>%s",Txt_NEW_LINE);
/***** Write the stem, that is in HTML format *****/
@ -287,7 +287,7 @@ static void TsI_ExportQuestion (struct Qst_Question *Question,FILE *FileXML)
Question->Answer.Shuffle ? "yes" :
"no");
fprintf (FileXML,">");
TsI_WriteAnswersOfAQstXML (Question,FileXML);
QstImp_WriteAnswersOfAQstXML (Question,FileXML);
fprintf (FileXML,"</answer>%s",Txt_NEW_LINE);
/***** End question *****/
@ -300,7 +300,7 @@ static void TsI_ExportQuestion (struct Qst_Question *Question,FILE *FileXML)
/************* Get and write tags of a question into the XML file ************/
/*****************************************************************************/
static void TsI_GetAndWriteTagsXML (long QstCod,FILE *FileXML)
static void QstImp_GetAndWriteTagsXML (long QstCod,FILE *FileXML)
{
extern const char *Txt_NEW_LINE;
unsigned NumTags;
@ -327,7 +327,7 @@ static void TsI_GetAndWriteTagsXML (long QstCod,FILE *FileXML)
/**************** Get and write the answers of a test question ***************/
/*****************************************************************************/
static void TsI_WriteAnswersOfAQstXML (const struct Qst_Question *Question,
static void QstImp_WriteAnswersOfAQstXML (const struct Qst_Question *Question,
FILE *FileXML)
{
extern const char *Txt_NEW_LINE;
@ -395,7 +395,7 @@ static void TsI_WriteAnswersOfAQstXML (const struct Qst_Question *Question,
/************ Get questions from XML and store them in database **************/
/*****************************************************************************/
void TsI_ImportQstsFromXML (void)
void QstImp_ImportQstsFromXML (void)
{
extern const char *Txt_The_file_is_not_X;
struct Param *Param;
@ -429,7 +429,7 @@ void TsI_ImportQstsFromXML (void)
Cfg_PATH_TEST_PRIVATE,Gbl.UniqueNameEncrypted);
if (Fil_EndReceptionOfFile (FileNameXMLTmp,Param))
/***** Get questions from XML file and store them in database *****/
TsI_ReadQuestionsFromXMLFileAndStoreInDB (FileNameXMLTmp);
QstImp_ReadQuestionsFromXMLFileAndStoreInDB (FileNameXMLTmp);
else
Ale_ShowAlert (Ale_WARNING,"Error copying file.");
}
@ -439,7 +439,7 @@ void TsI_ImportQstsFromXML (void)
/********** Get questions from XML file and store them in database ***********/
/*****************************************************************************/
static void TsI_ReadQuestionsFromXMLFileAndStoreInDB (const char *FileNameXML)
static void QstImp_ReadQuestionsFromXMLFileAndStoreInDB (const char *FileNameXML)
{
FILE *FileXML;
char *XMLBuffer;
@ -466,7 +466,7 @@ static void TsI_ReadQuestionsFromXMLFileAndStoreInDB (const char *FileNameXML)
XMLBuffer[0] = '\0';
/***** Import questions from XML buffer *****/
TsI_ImportQuestionsFromXMLBuffer (XMLBuffer);
QstImp_ImportQuestionsFromXMLBuffer (XMLBuffer);
free (XMLBuffer);
}
@ -479,7 +479,7 @@ static void TsI_ReadQuestionsFromXMLFileAndStoreInDB (const char *FileNameXML)
/******************** Import questions from XML buffer ***********************/
/*****************************************************************************/
static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
static void QstImp_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
{
extern const char *Hlp_ASSESSMENT_Tests;
extern const char *Txt_XML_file_content;
@ -526,9 +526,11 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
{
/* Current element is <test> */
/***** Write heading of list of imported questions *****/
/***** Begin table *****/
HTM_TABLE_BeginWideMarginPadding (5);
TsI_WriteHeadingListImportedQst ();
/***** Write heading of list of imported questions *****/
QstImp_WriteHeadingListImportedQst ();
/***** For each question... *****/
for (QuestionElem = TestElem->FirstChild;
@ -547,7 +549,7 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
Attribute = Attribute->Next)
if (!strcmp (Attribute->AttributeName,"type"))
{
Question.Answer.Type = TsI_ConvertFromStrAnsTypXMLToAnsTyp (Attribute->Content);
Question.Answer.Type = QstImp_ConvertFromStrAnsTypXMLToAnsTyp (Attribute->Content);
AnswerTypeFound = true;
break; // Only first attribute "type"
}
@ -630,7 +632,7 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
}
/* Get answer (mandatory) */
TsI_GetAnswerFromXML (AnswerElem,&Question);
QstImp_GetAnswerFromXML (AnswerElem,&Question);
/* Make sure that tags, text and answer are not empty */
if (Qst_CheckIfQstFormatIsCorrectAndCountNumOptions (&Question))
@ -639,7 +641,7 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
QuestionExists = Qst_CheckIfQuestionExistsInDB (&Question);
/* Write row with this imported question */
TsI_WriteRowImportedQst (StemElem,FeedbackElem,
QstImp_WriteRowImportedQst (StemElem,FeedbackElem,
&Question,QuestionExists);
/***** If a new question ==> insert question, tags and answer in the database *****/
@ -676,7 +678,7 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
/***** Convert a string with the type of answer in XML to type of answer *****/
/*****************************************************************************/
static Qst_AnswerType_t TsI_ConvertFromStrAnsTypXMLToAnsTyp (const char *StrAnsTypeXML)
static Qst_AnswerType_t QstImp_ConvertFromStrAnsTypXMLToAnsTyp (const char *StrAnsTypeXML)
{
extern const char *Tst_StrAnswerTypesXML[Qst_NUM_ANS_TYPES];
Qst_AnswerType_t AnsType;
@ -698,7 +700,7 @@ static Qst_AnswerType_t TsI_ConvertFromStrAnsTypXMLToAnsTyp (const char *StrAnsT
/*****************************************************************************/
// Answer is mandatory
static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem,
static void QstImp_GetAnswerFromXML (struct XMLElement *AnswerElem,
struct Qst_Question *Question)
{
struct XMLElement *OptionElem;
@ -841,7 +843,7 @@ static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem,
/************* Write heading of list of imported test questions **************/
/*****************************************************************************/
static void TsI_WriteHeadingListImportedQst (void)
static void QstImp_WriteHeadingListImportedQst (void)
{
extern const char *Txt_No_INDEX;
extern const char *Txt_Tags;
@ -867,7 +869,7 @@ static void TsI_WriteHeadingListImportedQst (void)
/**************** Write a row with one imported test question ****************/
/*****************************************************************************/
static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
static void QstImp_WriteRowImportedQst (struct XMLElement *StemElem,
struct XMLElement *FeedbackElem,
const struct Qst_Question *Question,
bool QuestionExists)
@ -916,6 +918,7 @@ static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
/***** Write the question tags *****/
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
if (Question->Tags.Num)
{
/***** Write the tags *****/
@ -1070,5 +1073,6 @@ static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
break;
}
HTM_TD_End ();
HTM_TR_End ();
}

View File

@ -1,7 +1,7 @@
// swad_test_import.h: import and export self-assessment tests using XML files
// swad_question_import.h: import and export questions using XML files
#ifndef _SWAD_TSI
#define _SWAD_TSI
#ifndef _SWAD_QST_IMP
#define _SWAD_QST_IMP
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
@ -39,11 +39,11 @@
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void TsI_PutIconToExportQuestions (struct Tst_Test *Test);
bool TsI_GetCreateXMLParamFromForm (void);
void TsI_PutIconToImportQuestions (void);
void TsI_CreateXML (unsigned long NumRows,MYSQL_RES *mysql_res);
void TsI_ShowFormImportQstsFromXML (void);
void TsI_ImportQstsFromXML (void);
void QstImp_PutIconToExportQuestions (struct Tst_Test *Test);
bool QstImp_GetCreateXMLParamFromForm (void);
void QstImp_PutIconToImportQuestions (void);
void QstImp_CreateXML (unsigned long NumRows,MYSQL_RES *mysql_res);
void QstImp_ShowFormImportQstsFromXML (void);
void QstImp_ImportQstsFromXML (void);
#endif

View File

@ -52,10 +52,10 @@
#include "swad_match.h"
#include "swad_media.h"
#include "swad_parameter.h"
#include "swad_question_import.h"
#include "swad_tag_database.h"
#include "swad_test.h"
#include "swad_test_config.h"
#include "swad_test_import.h"
#include "swad_test_print.h"
#include "swad_test_visibility.h"
#include "swad_theme.h"
@ -117,19 +117,19 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/
/*****************************************************************************/
static void Tst_TstConstructor (struct Tst_Test *Test);
static void Tst_TstDestructor (struct Tst_Test *Test);
static void Tst_Constructor (struct Tst_Test *Test);
static void Tst_Destructor (struct Tst_Test *Test);
static void Tst_ShowFormRequestTest (struct Tst_Test *Test);
static void TstPrn_GetAnswersFromForm (struct TstPrn_Print *Print);
static bool Tst_CheckIfNextTstAllowed (void);
static unsigned Tst_GetNumExamsGeneratedByMe (void);
static unsigned Tst_GetNumTstExamsGeneratedByMe (void);
static void Tst_PutFormToEditQstMedia (const struct Med_Media *Media,int NumMedia,
static void Qst_PutFormToEditQstMedia (const struct Med_Media *Media,int NumMedia,
bool OptionsDisabled);
static void Tst_IncreaseMyNumAccessTst (void);
static void Tst_IncreaseMyNumTstExams (void);
static void Tst_UpdateLastAccTst (unsigned NumQsts);
static void Qst_ShowFormRequestEditQsts (struct Tst_Test *Test);
@ -152,34 +152,36 @@ static void Tst_ShowFormAnswerTypes (const struct Tst_AnswerTypes *AnswerTypes);
static void Qst_GetQuestions (struct Tst_Test *Test,MYSQL_RES **mysql_res);
static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test,
struct TstPrn_Print *Print);
static void Tst_GenerateChoiceIndexes (struct TstPrn_PrintedQuestion *PrintedQuestion,
bool Shuffle);
static void Tst_ListOneQstToEdit (struct Tst_Test *Test);
static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
static void Qst_ListOneQstToEdit (struct Tst_Test *Test);
static void Qst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
MYSQL_RES *mysql_res);
static void Tst_WriteHeadingRowQuestionsForEdition (struct Tst_Test *Test);
static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned QstInd);
static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exams,
static void Qst_WriteHeadingRowQuestionsForEdition (struct Tst_Test *Test);
static void Qst_WriteQuestionListing (struct Tst_Test *Test,unsigned QstInd);
static void Qst_ListOneOrMoreQuestionsForSelectionForExamSet (struct Exa_Exams *Exams,
unsigned NumQsts,
MYSQL_RES *mysql_res);
static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Games,
static void Qst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Games,
unsigned NumQsts,
MYSQL_RES *mysql_res);
static void Tst_PutCheckboxToSelectAllQuestions (void);
static void Tst_WriteQuestionRowForSelection (unsigned QstInd,
static void Qst_PutCheckboxToSelectAllQuestions (void);
static void Qst_WriteQuestionRowForSelection (unsigned QstInd,
struct Qst_Question *Question);
//-----------------------------------------------------------------------------
static void Tst_WriteIntAnsBank (struct Qst_Question *Question,
static void Qst_WriteIntAnsBank (struct Qst_Question *Question,
const char *ClassTxt,
__attribute__((unused)) const char *ClassFeedback);
static void Tst_WriteFltAnsBank (struct Qst_Question *Question,
static void Qst_WriteFltAnsBank (struct Qst_Question *Question,
const char *ClassTxt,
__attribute__((unused)) const char *ClassFeedback);
static void Tst_WriteTF_AnsBank (struct Qst_Question *Question,
static void Qst_WriteTF_AnsBank (struct Qst_Question *Question,
const char *ClassTxt,
__attribute__((unused)) const char *ClassFeedback);
static void Tst_WriteChoAnsBank (struct Qst_Question *Question,
static void Qst_WriteChoAnsBank (struct Qst_Question *Question,
const char *ClassTxt,
const char *ClassFeedback);
@ -206,7 +208,7 @@ static void Qst_ResetMediaOfQuestion (struct Qst_Question *Question);
static void Qst_FreeMediaOfQuestion (struct Qst_Question *Question);
static long Qst_GetMedCodFromDB (long CrsCod,long QstCod,int NumOpt);
static void Tst_GetMediaFromDB (long CrsCod,long QstCod,int NumOpt,
static void Qst_GetMediaFromDB (long CrsCod,long QstCod,int NumOpt,
struct Med_Media *Media);
static Qst_AnswerType_t Qst_ConvertFromUnsignedStrToAnsTyp (const char *UnsignedStr);
@ -241,20 +243,20 @@ void Tst_RequestTest (void)
struct Tst_Test Test;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Show form to generate a self-assessment test *****/
Tst_ShowFormRequestTest (&Test);
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
/***************************** Test constructor ******************************/
/*****************************************************************************/
static void Tst_TstConstructor (struct Tst_Test *Test)
static void Tst_Constructor (struct Tst_Test *Test)
{
/***** Reset tags *****/
Tag_ResetTags (&Test->Tags);
@ -274,7 +276,7 @@ static void Tst_TstConstructor (struct Tst_Test *Test)
/****************************** Test destructor ******************************/
/*****************************************************************************/
static void Tst_TstDestructor (struct Tst_Test *Test)
static void Tst_Destructor (struct Tst_Test *Test)
{
/***** Question destructor *****/
Qst_QstDestructor (&Test->Question);
@ -372,10 +374,10 @@ void Tst_ShowNewTest (void)
extern const char *Txt_No_questions_found_matching_your_search_criteria;
struct Tst_Test Test;
struct TstPrn_Print Print;
unsigned NumExamsGeneratedByMe;
unsigned NumTstExamsGeneratedByMe;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Read test configuration from database *****/
TstCfg_GetConfigFromDB ();
@ -391,8 +393,8 @@ void Tst_ShowNewTest (void)
if (Print.NumQsts.All)
{
/***** Increase number of exams generated (answered or not) by me *****/
Tst_IncreaseMyNumAccessTst ();
NumExamsGeneratedByMe = Tst_GetNumExamsGeneratedByMe ();
Tst_IncreaseMyNumTstExams ();
NumTstExamsGeneratedByMe = Tst_GetNumTstExamsGeneratedByMe ();
/***** Create new test exam in database *****/
TstPrn_CreatePrintInDB (&Print);
@ -400,7 +402,7 @@ void Tst_ShowNewTest (void)
false); // Don't update question score
/***** Show test exam to be answered *****/
TstPrn_ShowTestPrintToFillIt (&Print,NumExamsGeneratedByMe,TstPrn_REQUEST);
TstPrn_ShowTestPrintToFillIt (&Print,NumTstExamsGeneratedByMe,TstPrn_REQUEST);
/***** Update date-time of my next allowed access to test *****/
if (Gbl.Usrs.Me.Role.Logged == Rol_STD)
@ -417,7 +419,7 @@ void Tst_ShowNewTest (void)
}
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -650,12 +652,12 @@ static bool Tst_CheckIfNextTstAllowed (void)
/***************** Get number of test exams generated by me ******************/
/*****************************************************************************/
static unsigned Tst_GetNumExamsGeneratedByMe (void)
static unsigned Tst_GetNumTstExamsGeneratedByMe (void)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned long NumRows;
unsigned NumExamsGeneratedByMe = 0;
unsigned NumTstExamsGeneratedByMe = 0;
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
{
@ -669,15 +671,15 @@ static unsigned Tst_GetNumExamsGeneratedByMe (void)
Gbl.Hierarchy.Crs.CrsCod);
if (NumRows == 0)
NumExamsGeneratedByMe = 0;
NumTstExamsGeneratedByMe = 0;
else if (NumRows == 1)
{
/* Get number of hits */
row = mysql_fetch_row (mysql_res);
if (row[0] == NULL)
NumExamsGeneratedByMe = 0;
else if (sscanf (row[0],"%u",&NumExamsGeneratedByMe) != 1)
NumExamsGeneratedByMe = 0;
NumTstExamsGeneratedByMe = 0;
else if (sscanf (row[0],"%u",&NumTstExamsGeneratedByMe) != 1)
NumTstExamsGeneratedByMe = 0;
}
else
Err_ShowErrorAndExit ("Error when getting number of hits to test.");
@ -686,7 +688,7 @@ static unsigned Tst_GetNumExamsGeneratedByMe (void)
DB_FreeMySQLResult (&mysql_res);
}
return NumExamsGeneratedByMe;
return NumTstExamsGeneratedByMe;
}
/*****************************************************************************/
@ -816,7 +818,7 @@ void Qst_WriteQstStem (const char *Stem,const char *ClassStem,bool Visible)
/************* Put form to upload a new image for a test question ************/
/*****************************************************************************/
static void Tst_PutFormToEditQstMedia (const struct Med_Media *Media,int NumMedia,
static void Qst_PutFormToEditQstMedia (const struct Med_Media *Media,int NumMedia,
bool OptionsDisabled)
{
extern const char *The_ClassFormInBox[The_NUM_THEMES];
@ -910,7 +912,7 @@ void Qst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback)
/*********** Update my number of accesses to test in this course *************/
/*****************************************************************************/
static void Tst_IncreaseMyNumAccessTst (void)
static void Tst_IncreaseMyNumTstExams (void)
{
/***** Trivial check *****/
if (!Gbl.Usrs.Me.IBelongToCurrentCrs)
@ -953,13 +955,13 @@ void Qst_RequestEditQsts (void)
struct Tst_Test Test;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Show form to generate a self-assessment test *****/
Qst_ShowFormRequestEditQsts (&Test);
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -1033,13 +1035,13 @@ void Qst_RequestSelectQstsForExamSet (struct Exa_Exams *Exams)
struct Tst_Test Test;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Show form to select test for exam *****/
Tst_ShowFormRequestSelectTestsForSet (Exams,&Test); // No tags selected
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -1051,13 +1053,13 @@ void Qst_RequestSelectQstsForGame (struct Gam_Games *Games)
struct Tst_Test Test;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Show form to select test for game *****/
Tst_ShowFormRequestSelectTestsForGame (Games,&Test); // No tags selected
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -1210,7 +1212,7 @@ static void Qst_PutIconsRequestBankQsts (__attribute__((unused)) void *Args)
Tag_PutIconToEditTags ();
/***** Put icon to import questions *****/
TsI_PutIconToImportQuestions ();
QstImp_PutIconToImportQuestions ();
/***** Put icon to show a figure *****/
Fig_PutIconToShowFigure (Fig_TESTS);
@ -1249,7 +1251,7 @@ static void Qst_PutIconsEditBankQsts (void *Test)
Tag_PutIconToEditTags ();
/***** Put icon to export questions *****/
TsI_PutIconToExportQuestions (Test);
QstImp_PutIconToExportQuestions (Test);
/***** Put icon to show a figure *****/
Fig_PutIconToShowFigure (Fig_TESTS);
@ -1394,7 +1396,7 @@ static void Tst_ShowFormConfigTst (void)
char StrMinTimeNxtTstPerQst[Cns_MAX_DECIMAL_DIGITS_ULONG + 1];
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Read test configuration from database *****/
TstCfg_GetConfigFromDB ();
@ -1497,7 +1499,7 @@ static void Tst_ShowFormConfigTst (void)
Box_BoxEnd ();
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -1614,7 +1616,7 @@ void Qst_ListQuestionsToEdit (void)
MYSQL_RES *mysql_res;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Get parameters, query the database and list the questions *****/
if (Tst_GetParamsTst (&Test,Tst_EDIT_TEST)) // Get parameters from the form
@ -1624,16 +1626,16 @@ void Qst_ListQuestionsToEdit (void)
if (Test.NumQsts)
{
/* Contextual menu */
if (TsI_GetCreateXMLParamFromForm ())
if (QstImp_GetCreateXMLParamFromForm ())
{
Mnu_ContextMenuBegin ();
TsI_CreateXML (Test.NumQsts,mysql_res); // Create XML file with exported questions...
QstImp_CreateXML (Test.NumQsts,mysql_res); // Create XML file with exported questions...
// ...and put a link to download it
Mnu_ContextMenuEnd ();
}
/* Show the table with the questions */
Tst_ListOneOrMoreQuestionsForEdition (&Test,mysql_res);
Qst_ListOneOrMoreQuestionsForEdition (&Test,mysql_res);
}
/***** Free structure that stores the query result *****/
@ -1644,20 +1646,20 @@ void Qst_ListQuestionsToEdit (void)
Qst_ShowFormRequestEditQsts (&Test);
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
/************ List several test questions for selection for exam *************/
/*****************************************************************************/
void Tst_ListQuestionsToSelectForSet (struct Exa_Exams *Exams)
void Qst_ListQuestionsToSelectForExamSet (struct Exa_Exams *Exams)
{
struct Tst_Test Test;
MYSQL_RES *mysql_res;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Get parameters, query the database and list the questions *****/
if (Tst_GetParamsTst (&Test,Tst_SELECT_QUESTIONS_FOR_EXAM)) // Get parameters from the form
@ -1665,7 +1667,7 @@ void Tst_ListQuestionsToSelectForSet (struct Exa_Exams *Exams)
Qst_GetQuestions (&Test,&mysql_res); // Query database
if (Test.NumQsts)
/* Show the table with the questions */
Tst_ListOneOrMoreQuestionsForSelectionForSet (Exams,Test.NumQsts,mysql_res);
Qst_ListOneOrMoreQuestionsForSelectionForExamSet (Exams,Test.NumQsts,mysql_res);
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
@ -1675,20 +1677,20 @@ void Tst_ListQuestionsToSelectForSet (struct Exa_Exams *Exams)
Tst_ShowFormRequestSelectTestsForSet (Exams,&Test);
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
/************ List several test questions for selection for game *************/
/*****************************************************************************/
void Tst_ListQuestionsToSelectForGame (struct Gam_Games *Games)
void Qst_ListQuestionsToSelectForGame (struct Gam_Games *Games)
{
struct Tst_Test Test;
MYSQL_RES *mysql_res;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Get parameters, query the database and list the questions *****/
if (Tst_GetParamsTst (&Test,Tst_SELECT_QUESTIONS_FOR_GAME)) // Get parameters from the form
@ -1696,7 +1698,7 @@ void Tst_ListQuestionsToSelectForGame (struct Gam_Games *Games)
Qst_GetQuestions (&Test,&mysql_res); // Query database
if (Test.NumQsts)
/* Show the table with the questions */
Tst_ListOneOrMoreQuestionsForSelectionForGame (Games,Test.NumQsts,mysql_res);
Qst_ListOneOrMoreQuestionsForSelectionForGame (Games,Test.NumQsts,mysql_res);
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
@ -1706,7 +1708,7 @@ void Tst_ListQuestionsToSelectForGame (struct Gam_Games *Games)
Tst_ShowFormRequestSelectTestsForGame (Games,&Test);
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -2019,7 +2021,7 @@ static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test,
/*************** Generate choice indexes depending on shuffle ****************/
/*****************************************************************************/
void Tst_GenerateChoiceIndexes (struct TstPrn_PrintedQuestion *PrintedQuestion,
static void Tst_GenerateChoiceIndexes (struct TstPrn_PrintedQuestion *PrintedQuestion,
bool Shuffle)
{
struct Qst_Question Question;
@ -2082,7 +2084,7 @@ void Tst_GenerateChoiceIndexes (struct TstPrn_PrintedQuestion *PrintedQuestion,
/*********************** List a test question for edition ********************/
/*****************************************************************************/
static void Tst_ListOneQstToEdit (struct Tst_Test *Test)
static void Qst_ListOneQstToEdit (struct Tst_Test *Test)
{
extern const char *Hlp_ASSESSMENT_Tests;
extern const char *Txt_Questions;
@ -2099,10 +2101,10 @@ static void Tst_ListOneQstToEdit (struct Tst_Test *Test)
HTM_TABLE_BeginWideMarginPadding (5);
/***** Write the heading *****/
Tst_WriteHeadingRowQuestionsForEdition (Test);
Qst_WriteHeadingRowQuestionsForEdition (Test);
/***** Write question row *****/
Tst_WriteQuestionListing (Test,0);
Qst_WriteQuestionListing (Test,0);
/***** End table *****/
HTM_TABLE_End ();
@ -2118,7 +2120,7 @@ static void Tst_ListOneQstToEdit (struct Tst_Test *Test)
/****************** List for edition one or more test questions **************/
/*****************************************************************************/
static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
static void Qst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
MYSQL_RES *mysql_res)
{
extern const char *Hlp_ASSESSMENT_Tests;
@ -2135,7 +2137,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
HTM_TABLE_BeginWideMarginPadding (5);
/***** Write the heading *****/
Tst_WriteHeadingRowQuestionsForEdition (Test);
Qst_WriteHeadingRowQuestionsForEdition (Test);
/***** Write rows *****/
for (QstInd = 0;
@ -2153,7 +2155,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
Err_WrongQuestionExit ();
/***** Write question row *****/
Tst_WriteQuestionListing (Test,QstInd);
Qst_WriteQuestionListing (Test,QstInd);
/***** Destroy test question *****/
Qst_QstDestructor (&Test->Question);
@ -2173,7 +2175,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
/*********** Write heading row in listing of questions for edition ***********/
/*****************************************************************************/
static void Tst_WriteHeadingRowQuestionsForEdition (struct Tst_Test *Test)
static void Qst_WriteHeadingRowQuestionsForEdition (struct Tst_Test *Test)
{
extern const char *Txt_No_INDEX;
extern const char *Txt_Code;
@ -2234,7 +2236,7 @@ static void Tst_WriteHeadingRowQuestionsForEdition (struct Tst_Test *Test)
/********** Write question row in listing of questions for edition ***********/
/*****************************************************************************/
static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned QstInd)
static void Qst_WriteQuestionListing (struct Tst_Test *Test,unsigned QstInd)
{
static unsigned UniqueId = 0;
char *Id;
@ -2354,7 +2356,7 @@ static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned QstInd)
/*************** List for selection one or more test questions ***************/
/*****************************************************************************/
static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exams,
static void Qst_ListOneOrMoreQuestionsForSelectionForExamSet (struct Exa_Exams *Exams,
unsigned NumQsts,
MYSQL_RES *mysql_res)
{
@ -2382,7 +2384,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exam
ExaSet_PutParamsOneSet (Exams);
/***** Select all questions *****/
Tst_PutCheckboxToSelectAllQuestions ();
Qst_PutCheckboxToSelectAllQuestions ();
/***** Begin table *****/
HTM_TABLE_BeginWideMarginPadding (5);
@ -2418,7 +2420,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exam
Err_WrongQuestionExit ();
/* Write question row */
Tst_WriteQuestionRowForSelection (QstInd,&Question);
Qst_WriteQuestionRowForSelection (QstInd,&Question);
/* Destroy test question */
Qst_QstDestructor (&Question);
@ -2441,7 +2443,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exam
/*************** List for selection one or more test questions ***************/
/*****************************************************************************/
static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Games,
static void Qst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Games,
unsigned NumQsts,
MYSQL_RES *mysql_res)
{
@ -2469,7 +2471,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Gam
Gam_PutParams (Games);
/***** Select all questions *****/
Tst_PutCheckboxToSelectAllQuestions ();
Qst_PutCheckboxToSelectAllQuestions ();
/***** Begin table *****/
HTM_TABLE_BeginWideMarginPadding (5);
@ -2504,7 +2506,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Gam
Err_WrongQuestionExit ();
/* Write question row */
Tst_WriteQuestionRowForSelection (QstInd,&Question);
Qst_WriteQuestionRowForSelection (QstInd,&Question);
/* Destroy test question */
Qst_QstDestructor (&Question);
@ -2527,7 +2529,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Gam
/************** Select all questions to add them to set/game *****************/
/*****************************************************************************/
static void Tst_PutCheckboxToSelectAllQuestions (void)
static void Qst_PutCheckboxToSelectAllQuestions (void)
{
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_All_questions;
@ -2544,7 +2546,7 @@ static void Tst_PutCheckboxToSelectAllQuestions (void)
/********************** Write question row for selection *********************/
/*****************************************************************************/
static void Tst_WriteQuestionRowForSelection (unsigned QstInd,
static void Qst_WriteQuestionRowForSelection (unsigned QstInd,
struct Qst_Question *Question)
{
extern const char *Txt_TST_STR_ANSWER_TYPES[Qst_NUM_ANS_TYPES];
@ -2730,12 +2732,12 @@ void Qst_WriteAnswersBank (struct Qst_Question *Question,
const char *ClassTxt,
const char *ClassFeedback) =
{
[Qst_ANS_INT ] = Tst_WriteIntAnsBank,
[Qst_ANS_FLOAT ] = Tst_WriteFltAnsBank,
[Qst_ANS_TRUE_FALSE ] = Tst_WriteTF_AnsBank,
[Qst_ANS_UNIQUE_CHOICE ] = Tst_WriteChoAnsBank,
[Qst_ANS_MULTIPLE_CHOICE] = Tst_WriteChoAnsBank,
[Qst_ANS_TEXT ] = Tst_WriteChoAnsBank,
[Qst_ANS_INT ] = Qst_WriteIntAnsBank,
[Qst_ANS_FLOAT ] = Qst_WriteFltAnsBank,
[Qst_ANS_TRUE_FALSE ] = Qst_WriteTF_AnsBank,
[Qst_ANS_UNIQUE_CHOICE ] = Qst_WriteChoAnsBank,
[Qst_ANS_MULTIPLE_CHOICE] = Qst_WriteChoAnsBank,
[Qst_ANS_TEXT ] = Qst_WriteChoAnsBank,
};
/***** Write answers *****/
@ -2746,7 +2748,7 @@ void Qst_WriteAnswersBank (struct Qst_Question *Question,
/****************** Write integer answer when editing a test *****************/
/*****************************************************************************/
static void Tst_WriteIntAnsBank (struct Qst_Question *Question,
static void Qst_WriteIntAnsBank (struct Qst_Question *Question,
const char *ClassTxt,
__attribute__((unused)) const char *ClassFeedback)
{
@ -2759,7 +2761,7 @@ static void Tst_WriteIntAnsBank (struct Qst_Question *Question,
/****************** Write float answer when editing a test *******************/
/*****************************************************************************/
static void Tst_WriteFltAnsBank (struct Qst_Question *Question,
static void Qst_WriteFltAnsBank (struct Qst_Question *Question,
const char *ClassTxt,
__attribute__((unused)) const char *ClassFeedback)
{
@ -2776,7 +2778,7 @@ static void Tst_WriteFltAnsBank (struct Qst_Question *Question,
/*********** Write false / true answer when listing test questions ***********/
/*****************************************************************************/
static void Tst_WriteTF_AnsBank (struct Qst_Question *Question,
static void Qst_WriteTF_AnsBank (struct Qst_Question *Question,
const char *ClassTxt,
__attribute__((unused)) const char *ClassFeedback)
{
@ -2792,7 +2794,7 @@ static void Tst_WriteTF_AnsBank (struct Qst_Question *Question,
/**** Write single or multiple choice answer when listing test questions *****/
/*****************************************************************************/
static void Tst_WriteChoAnsBank (struct Qst_Question *Question,
static void Qst_WriteChoAnsBank (struct Qst_Question *Question,
const char *ClassTxt,
const char *ClassFeedback)
{
@ -3277,7 +3279,7 @@ static void Qst_PutFormEditOneQst (struct Qst_Question *Question)
HTM_Txt (Question->Stem);
HTM_TEXTAREA_End ();
HTM_BR ();
Tst_PutFormToEditQstMedia (&Question->Media,-1,
Qst_PutFormToEditQstMedia (&Question->Media,-1,
false);
/***** Feedback *****/
@ -3480,7 +3482,7 @@ static void Qst_PutFormEditOneQst (struct Qst_Question *Question)
HTM_TEXTAREA_End ();
/* Media */
Tst_PutFormToEditQstMedia (&Question->Answer.Options[NumOpt].Media,
Qst_PutFormToEditQstMedia (&Question->Answer.Options[NumOpt].Media,
(int) NumOpt,
OptionsDisabled);
@ -3956,7 +3958,7 @@ static long Qst_GetMedCodFromDB (long CrsCod,long QstCod,int NumOpt)
// NumOpt < 0 ==> media associated to stem
// NumOpt >= 0 ==> media associated to an answer option
static void Tst_GetMediaFromDB (long CrsCod,long QstCod,int NumOpt,
static void Qst_GetMediaFromDB (long CrsCod,long QstCod,int NumOpt,
struct Med_Media *Media)
{
/***** Get media *****/
@ -4007,7 +4009,7 @@ void Qst_ReceiveQst (void)
struct Tst_Test Test;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Get parameters of the question from form *****/
Qst_GetQstFromForm (&Test.Question);
@ -4024,7 +4026,7 @@ void Qst_ReceiveQst (void)
/***** Show the question just inserted in the database *****/
snprintf (Test.AnswerTypes.List,sizeof (Test.AnswerTypes.List),"%u",
(unsigned) Test.Question.Answer.Type);
Tst_ListOneQstToEdit (&Test);
Qst_ListOneQstToEdit (&Test);
}
else // Question is wrong
{
@ -4036,7 +4038,7 @@ void Qst_ReceiveQst (void)
}
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -4106,7 +4108,7 @@ static void Qst_GetQstFromForm (struct Qst_Question *Question)
Med_GetMediaFromForm (Gbl.Hierarchy.Crs.CrsCod,Question->QstCod,
-1, // < 0 ==> the image associated to the stem
&Question->Media,
Tst_GetMediaFromDB,
Qst_GetMediaFromDB,
NULL);
Ale_ShowAlerts (NULL);
@ -4181,7 +4183,7 @@ static void Qst_GetQstFromForm (struct Qst_Question *Question)
Med_GetMediaFromForm (Gbl.Hierarchy.Crs.CrsCod,Question->QstCod,
(int) NumOpt, // >= 0 ==> the image associated to an answer
&Question->Answer.Options[NumOpt].Media,
Tst_GetMediaFromDB,
Qst_GetMediaFromDB,
NULL);
Ale_ShowAlerts (NULL);
}
@ -4588,7 +4590,7 @@ void Qst_RequestRemoveSelectedQsts (void)
struct Tst_Test Test;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Get parameters *****/
if (Tst_GetParamsTst (&Test,Tst_EDIT_TEST)) // Get parameters from the form
@ -4606,7 +4608,7 @@ void Qst_RequestRemoveSelectedQsts (void)
Qst_ListQuestionsToEdit ();
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -4623,7 +4625,7 @@ void Qst_RemoveSelectedQsts (void)
long QstCod;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Get parameters *****/
if (Tst_GetParamsTst (&Test,Tst_EDIT_TEST)) // Get parameters
@ -4653,7 +4655,7 @@ void Qst_RemoveSelectedQsts (void)
}
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -4678,7 +4680,7 @@ void Qst_RequestRemoveOneQst (void)
struct Tst_Test Test;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Get main parameters from form *****/
/* Get the question code */
@ -4711,12 +4713,12 @@ void Qst_RequestRemoveOneQst (void)
/***** Continue editing questions *****/
if (EditingOnlyThisQst)
Tst_ListOneQstToEdit (&Test);
Qst_ListOneQstToEdit (&Test);
else
Qst_ListQuestionsToEdit ();
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/
@ -4800,7 +4802,7 @@ void Qst_ChangeShuffleQst (void)
bool Shuffle;
/***** Create test *****/
Tst_TstConstructor (&Test);
Tst_Constructor (&Test);
/***** Get the question code *****/
Test.Question.QstCod = Qst_GetParamQstCod ();
@ -4832,12 +4834,12 @@ void Qst_ChangeShuffleQst (void)
/***** Continue editing questions *****/
if (EditingOnlyThisQst)
Tst_ListOneQstToEdit (&Test);
Qst_ListOneQstToEdit (&Test);
else
Qst_ListQuestionsToEdit ();
/***** Destroy test *****/
Tst_TstDestructor (&Test);
Tst_Destructor (&Test);
}
/*****************************************************************************/

View File

@ -117,11 +117,8 @@ void Qst_RequestSelectQstsForExamSet (struct Exa_Exams *Exams);
void Qst_RequestSelectQstsForGame (struct Gam_Games *Games);
void Qst_ListQuestionsToEdit (void);
void Tst_ListQuestionsToSelectForSet (struct Exa_Exams *Exams);
void Tst_ListQuestionsToSelectForGame (struct Gam_Games *Games);
void Tst_GenerateChoiceIndexes (struct TstPrn_PrintedQuestion *PrintedQuestion,
bool Shuffle);
void Qst_ListQuestionsToSelectForExamSet (struct Exa_Exams *Exams);
void Qst_ListQuestionsToSelectForGame (struct Gam_Games *Games);
void Qst_PutParamsEditQst (void *Test);

View File

@ -263,7 +263,7 @@ void TstPrn_UpdatePrintInDB (const struct TstPrn_Print *Print)
/*****************************************************************************/
void TstPrn_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
unsigned NumExamsGeneratedByMe,
unsigned NumTstExamsGeneratedByMe,
TstPrn_RequestOrConfirm_t RequestOrConfirm)
{
extern const char *Hlp_ASSESSMENT_Tests;
@ -292,7 +292,7 @@ void TstPrn_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
/***** Begin form *****/
Frm_BeginForm (Action[RequestOrConfirm]);
TstPrn_PutParamPrnCod (Print->PrnCod);
Par_PutHiddenParamUnsigned (NULL,"NumTst",NumExamsGeneratedByMe);
Par_PutHiddenParamUnsigned (NULL,"NumTst",NumTstExamsGeneratedByMe);
/***** Begin table *****/
HTM_TABLE_BeginWideMarginPadding (10);

View File

@ -93,7 +93,7 @@ void TstPrn_CreatePrintInDB (struct TstPrn_Print *Print);
void TstPrn_UpdatePrintInDB (const struct TstPrn_Print *Print);
void TstPrn_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
unsigned NumExamsGeneratedByMe,
unsigned NumTstExamsGeneratedByMe,
TstPrn_RequestOrConfirm_t RequestOrConfirm);
void TstPrn_ShowPrintAfterAssess (struct TstPrn_Print *Print);
@ -115,6 +115,7 @@ void TstPrn_ComputeChoAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion,
const struct Qst_Question *Question);
void TstPrn_ComputeTxtAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion,
const struct Qst_Question *Question);
//-----------------------------------------------------------------------------
void Qst_ChangeFormatAnswersText (struct Qst_Question *Question);