mirror of https://github.com/acanas/swad-core.git
Version19.242.1
This commit is contained in:
parent
91319694d2
commit
1981c0b605
|
@ -491,7 +491,7 @@ CREATE TABLE IF NOT EXISTS exa_log (
|
||||||
PrnCod INT NOT NULL,
|
PrnCod INT NOT NULL,
|
||||||
ActCod INT NOT NULL,
|
ActCod INT NOT NULL,
|
||||||
QstInd INT NOT NULL DEFAULT -1,
|
QstInd INT NOT NULL DEFAULT -1,
|
||||||
Open ENUM('N','Y') NOT NULL DEFAULT 'N',
|
CanAnswer ENUM('N','Y') NOT NULL DEFAULT 'N',
|
||||||
ClickTime DATETIME NOT NULL,
|
ClickTime DATETIME NOT NULL,
|
||||||
IP CHAR(15) NOT NULL,
|
IP CHAR(15) NOT NULL,
|
||||||
SessionId CHAR(43) NOT NULL,
|
SessionId CHAR(43) NOT NULL,
|
||||||
|
|
|
@ -557,10 +557,15 @@ 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.242 (2020-05-23)"
|
#define Log_PLATFORM_VERSION "SWAD 19.242.1 (2020-05-23)"
|
||||||
#define CSS_FILE "swad19.238.2.css"
|
#define CSS_FILE "swad19.238.2.css"
|
||||||
#define JS_FILE "swad19.239.6.js"
|
#define JS_FILE "swad19.239.6.js"
|
||||||
/*
|
/*
|
||||||
|
Version 19.243: May 23, 2020 List exam log. (? lines)
|
||||||
|
Version 19.242.1: May 23, 2020 Bug fixing and code refactoring in exam log. (301932 lines)
|
||||||
|
1 change necessary in database:
|
||||||
|
ALTER TABLE exa_log CHANGE COLUMN Open CanAnswer ENUM('N','Y') NOT NULL DEFAULT 'N';
|
||||||
|
|
||||||
Version 19.242: May 23, 2020 Changes in exam log. (301911 lines)
|
Version 19.242: May 23, 2020 Changes in exam log. (301911 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
ALTER TABLE exa_log CHANGE COLUMN Saved Open ENUM('N','Y') NOT NULL DEFAULT 'N';
|
ALTER TABLE exa_log CHANGE COLUMN Saved Open ENUM('N','Y') NOT NULL DEFAULT 'N';
|
||||||
|
|
|
@ -1054,7 +1054,7 @@ mysql> DESCRIBE exa_log;
|
||||||
| PrnCod | int(11) | NO | MUL | NULL | |
|
| PrnCod | int(11) | NO | MUL | NULL | |
|
||||||
| ActCod | int(11) | NO | | NULL | |
|
| ActCod | int(11) | NO | | NULL | |
|
||||||
| QstInd | int(11) | NO | | -1 | |
|
| QstInd | int(11) | NO | | -1 | |
|
||||||
| Open | enum('N','Y') | NO | | N | |
|
| CanAnswer | enum('N','Y') | NO | | N | |
|
||||||
| ClickTime | datetime | NO | MUL | NULL | |
|
| ClickTime | datetime | NO | MUL | NULL | |
|
||||||
| IP | char(15) | NO | | NULL | |
|
| IP | char(15) | NO | | NULL | |
|
||||||
| SessionId | char(43) | NO | | NULL | |
|
| SessionId | char(43) | NO | | NULL | |
|
||||||
|
@ -1067,7 +1067,7 @@ mysql> DESCRIBE exa_log;
|
||||||
"PrnCod INT NOT NULL,"
|
"PrnCod INT NOT NULL,"
|
||||||
"ActCod INT NOT NULL,"
|
"ActCod INT NOT NULL,"
|
||||||
"QstInd INT NOT NULL DEFAULT -1,"
|
"QstInd INT NOT NULL DEFAULT -1,"
|
||||||
"Open ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"CanAnswer ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"ClickTime DATETIME NOT NULL,"
|
"ClickTime DATETIME NOT NULL,"
|
||||||
"IP CHAR(15) NOT NULL," // Cns_MAX_BYTES_IP
|
"IP CHAR(15) NOT NULL," // Cns_MAX_BYTES_IP
|
||||||
"SessionId CHAR(43) NOT NULL," // Cns_BYTES_SESSION_ID
|
"SessionId CHAR(43) NOT NULL," // Cns_BYTES_SESSION_ID
|
||||||
|
|
18
swad_exam.c
18
swad_exam.c
|
@ -958,17 +958,15 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam)
|
||||||
|
|
||||||
/***** Get exam data from database *****/
|
/***** Get exam data from database *****/
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get exam data",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get exam data",
|
||||||
"SELECT exa_exams.ExaCod," // row[0]
|
"SELECT ExaCod," // row[0]
|
||||||
"exa_exams.CrsCod," // row[1]
|
"CrsCod," // row[1]
|
||||||
"exa_exams.Hidden," // row[2]
|
"Hidden," // row[2]
|
||||||
"exa_exams.UsrCod," // row[3]
|
"UsrCod," // row[3]
|
||||||
"exa_exams.MaxGrade," // row[4]
|
"MaxGrade," // row[4]
|
||||||
"exa_exams.Visibility," // row[5]
|
"Visibility," // row[5]
|
||||||
"exa_exams.Title" // row[6]
|
"Title" // row[6]
|
||||||
" FROM exa_exams"
|
" FROM exa_exams"
|
||||||
" LEFT JOIN exa_sessions"
|
" WHERE ExaCod=%ld",
|
||||||
" ON exa_exams.ExaCod=exa_sessions.ExaCod"
|
|
||||||
" WHERE exa_exams.ExaCod=%ld",
|
|
||||||
Exam->ExaCod);
|
Exam->ExaCod);
|
||||||
if (NumRows) // Exam found...
|
if (NumRows) // Exam found...
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,13 +53,13 @@ static struct
|
||||||
long PrnCod; // Exam print code
|
long PrnCod; // Exam print code
|
||||||
int QstInd; // Exam print question index
|
int QstInd; // Exam print question index
|
||||||
ExaLog_Action_t Action; // Action performed by user
|
ExaLog_Action_t Action; // Action performed by user
|
||||||
bool Open; // Exam print is open and accesible to answer by the user
|
bool ICanAnswer; // Exam print is open and accesible to answer by the user
|
||||||
} ExaLog_Log =
|
} ExaLog_Log =
|
||||||
{
|
{
|
||||||
.PrnCod = -1L, // -1 means no print code set
|
.PrnCod = -1L, // -1 means no print code set
|
||||||
.QstInd = -1, // -1 means no question index set
|
.QstInd = -1, // -1 means no question index set
|
||||||
.Action = ExaLog_UNKNOWN_ACTION,
|
.Action = ExaLog_UNKNOWN_ACTION,
|
||||||
.Open = false,
|
.ICanAnswer = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -81,7 +81,7 @@ ExaLog_Action_t ExaLog_GetAction (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************* Set and get current exam print code (used in log) *************/
|
/******************** Set and get current exam print code ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaLog_SetPrnCod (long PrnCod)
|
void ExaLog_SetPrnCod (long PrnCod)
|
||||||
|
@ -95,7 +95,7 @@ long ExaLog_GetPrnCod (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****** Set and get current question index in exam print (used in log) *******/
|
/************* Set and get current question index in exam print **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaLog_SetQstInd (unsigned QstInd)
|
void ExaLog_SetQstInd (unsigned QstInd)
|
||||||
|
@ -109,17 +109,17 @@ int ExaLog_GetQstInd (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******** Set and get if answer is saved in exam print (used in log) *********/
|
/************* Set and get if exam print is open and accessible **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaLog_SetOpen (bool Open)
|
void ExaLog_SetIfCanAnswer (bool ICanAnswer)
|
||||||
{
|
{
|
||||||
ExaLog_Log.Open = Open;
|
ExaLog_Log.ICanAnswer = ICanAnswer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExaLog_GetOpen (void)
|
bool ExaLog_GetIfCanAnswer (void)
|
||||||
{
|
{
|
||||||
return ExaLog_Log.Open;
|
return ExaLog_Log.ICanAnswer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -142,15 +142,15 @@ void ExaLog_LogAccess (long LogCod)
|
||||||
Redundant data (also present in log table) are stored for speed */
|
Redundant data (also present in log table) are stored for speed */
|
||||||
DB_QueryINSERT ("can not log exam access",
|
DB_QueryINSERT ("can not log exam access",
|
||||||
"INSERT INTO exa_log "
|
"INSERT INTO exa_log "
|
||||||
"(LogCod,PrnCod,ActCod,QstInd,Open,ClickTime,IP,SessionId)"
|
"(LogCod,PrnCod,ActCod,QstInd,UserCanAnswer,ClickTime,IP,SessionId)"
|
||||||
" VALUES "
|
" VALUES "
|
||||||
"(%ld,%ld,%ld,%d,'%c',NOW(),'%s','%s')",
|
"(%ld,%ld,%ld,%d,'%c',NOW(),'%s','%s')",
|
||||||
LogCod,
|
LogCod,
|
||||||
PrnCod,
|
PrnCod,
|
||||||
(unsigned) Action,
|
(unsigned) Action,
|
||||||
ExaLog_GetQstInd (),
|
ExaLog_GetQstInd (),
|
||||||
ExaLog_GetOpen () ? 'Y' :
|
ExaLog_GetIfCanAnswer () ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
// NOW() Redundant, for speed
|
// NOW() Redundant, for speed
|
||||||
Gbl.IP, // Redundant, for speed
|
Gbl.IP, // Redundant, for speed
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
|
|
|
@ -52,8 +52,8 @@ void ExaLog_SetAction (ExaLog_Action_t Action);
|
||||||
ExaLog_Action_t ExaLog_GetAction (void);
|
ExaLog_Action_t ExaLog_GetAction (void);
|
||||||
void ExaLog_SetQstInd (unsigned QstInd);
|
void ExaLog_SetQstInd (unsigned QstInd);
|
||||||
int ExaLog_GetQstInd (void);
|
int ExaLog_GetQstInd (void);
|
||||||
void ExaLog_SetOpen (bool Open);
|
void ExaLog_SetIfCanAnswer (bool CanBeAnswered);
|
||||||
bool ExaLog_GetOpen (void);
|
bool ExaLog_GetIfCanAnswer (void);
|
||||||
|
|
||||||
void ExaLog_LogAccess (long LogCod);
|
void ExaLog_LogAccess (long LogCod);
|
||||||
|
|
||||||
|
|
|
@ -196,22 +196,22 @@ void ExaPrn_ShowExamPrint (void)
|
||||||
/***** Get print data from database *****/
|
/***** Get print data from database *****/
|
||||||
Print.SesCod = Session.SesCod;
|
Print.SesCod = Session.SesCod;
|
||||||
Print.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
Print.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
ExaPrn_GetPrintDataBySesCodAndUsrCod (&Print);
|
ExaPrn_GetDataOfPrintByCodAndUsrCod (&Print);
|
||||||
|
|
||||||
if (Print.PrnCod <= 0) // Print does not exists
|
if (Print.PrnCod <= 0) // Print does not exists ==> create it
|
||||||
{
|
{
|
||||||
/***** Get questions from database *****/
|
/***** Get questions from database *****/
|
||||||
ExaPrn_GetQuestionsForNewPrintFromDB (&Print,Exam.ExaCod);
|
ExaPrn_GetQuestionsForNewPrintFromDB (&Print,Exam.ExaCod);
|
||||||
|
|
||||||
if (Print.NumQsts)
|
if (Print.NumQsts)
|
||||||
{
|
{
|
||||||
/***** Create/update new exam print in database *****/
|
/***** Create new exam print in database *****/
|
||||||
ExaPrn_CreatePrintInDB (&Print);
|
ExaPrn_CreatePrintInDB (&Print);
|
||||||
|
|
||||||
/***** Set log print code and action *****/
|
/***** Set log print code and action *****/
|
||||||
ExaLog_SetPrnCod (Print.PrnCod);
|
ExaLog_SetPrnCod (Print.PrnCod);
|
||||||
ExaLog_SetAction (ExaLog_START_EXAM);
|
ExaLog_SetAction (ExaLog_START_EXAM);
|
||||||
ExaLog_SetOpen (true);
|
ExaLog_SetIfCanAnswer (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Print exists
|
else // Print exists
|
||||||
|
@ -222,7 +222,7 @@ void ExaPrn_ShowExamPrint (void)
|
||||||
/***** Set log print code and action *****/
|
/***** Set log print code and action *****/
|
||||||
ExaLog_SetPrnCod (Print.PrnCod);
|
ExaLog_SetPrnCod (Print.PrnCod);
|
||||||
ExaLog_SetAction (ExaLog_RESUME_EXAM);
|
ExaLog_SetAction (ExaLog_RESUME_EXAM);
|
||||||
ExaLog_SetOpen (true);
|
ExaLog_SetIfCanAnswer (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Show test exam to be answered *****/
|
/***** Show test exam to be answered *****/
|
||||||
|
@ -237,7 +237,7 @@ void ExaPrn_ShowExamPrint (void)
|
||||||
/******** Get data of an exam print using session code and user code *********/
|
/******** Get data of an exam print using session code and user code *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaPrn_GetPrintDataBySesCodAndUsrCod (struct ExaPrn_Print *Print)
|
void ExaPrn_GetDataOfPrintByCodAndUsrCod (struct ExaPrn_Print *Print)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
@ -980,10 +980,14 @@ static void ExaPrn_WriteJSToUpdateExamPrint (const struct ExaPrn_Print *Print,
|
||||||
void ExaPrn_ReceivePrintAnswer (void)
|
void ExaPrn_ReceivePrintAnswer (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_You_dont_have_access_to_the_exam;
|
extern const char *Txt_You_dont_have_access_to_the_exam;
|
||||||
|
struct Exa_Exam Exam;
|
||||||
|
struct ExaSes_Session Session;
|
||||||
struct ExaPrn_Print Print;
|
struct ExaPrn_Print Print;
|
||||||
unsigned QstInd;
|
unsigned QstInd;
|
||||||
|
|
||||||
/***** Reset print *****/
|
/***** Reset exam, session and print *****/
|
||||||
|
Exa_ResetExam (&Exam);
|
||||||
|
ExaSes_ResetSession (&Session);
|
||||||
ExaPrn_ResetPrint (&Print);
|
ExaPrn_ResetPrint (&Print);
|
||||||
|
|
||||||
/***** Get session code *****/
|
/***** Get session code *****/
|
||||||
|
@ -991,12 +995,23 @@ void ExaPrn_ReceivePrintAnswer (void)
|
||||||
|
|
||||||
/***** Get print data *****/
|
/***** Get print data *****/
|
||||||
Print.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
Print.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
ExaPrn_GetPrintDataBySesCodAndUsrCod (&Print);
|
ExaPrn_GetDataOfPrintByCodAndUsrCod (&Print);
|
||||||
if (Print.PrnCod <= 0)
|
if (Print.PrnCod <= 0)
|
||||||
Lay_WrongExamExit ();
|
Lay_WrongExamExit ();
|
||||||
|
|
||||||
/***** Get questions and current user's answers of exam print from database *****/
|
/***** Get session data *****/
|
||||||
ExaPrn_GetPrintQuestionsFromDB (&Print);
|
Session.SesCod = Print.SesCod;
|
||||||
|
ExaSes_GetDataOfSessionByCod (&Session);
|
||||||
|
if (Session.SesCod <= 0)
|
||||||
|
Lay_WrongExamExit ();
|
||||||
|
|
||||||
|
/***** Get exam data *****/
|
||||||
|
Exam.ExaCod = Session.ExaCod;
|
||||||
|
Exa_GetDataOfExamByCod (&Exam);
|
||||||
|
if (Exam.ExaCod <= 0)
|
||||||
|
Lay_WrongExamExit ();
|
||||||
|
if (Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||||
|
Lay_WrongExamExit ();
|
||||||
|
|
||||||
/***** Get question index from form *****/
|
/***** Get question index from form *****/
|
||||||
QstInd = ExaPrn_GetParamQstInd ();
|
QstInd = ExaPrn_GetParamQstInd ();
|
||||||
|
@ -1007,10 +1022,13 @@ void ExaPrn_ReceivePrintAnswer (void)
|
||||||
ExaLog_SetQstInd (QstInd);
|
ExaLog_SetQstInd (QstInd);
|
||||||
|
|
||||||
/***** Check if session if visible and open *****/
|
/***** Check if session if visible and open *****/
|
||||||
if (ExaSes_CheckIfSessionIsVisibleAndOpen (Print.SesCod))
|
if (ExaSes_CheckIfICanAnswerThisSession (&Exam,&Session))
|
||||||
{
|
{
|
||||||
/***** Set log open ****/
|
/***** Set log open to true ****/
|
||||||
ExaLog_SetOpen (true);
|
ExaLog_SetIfCanAnswer (true);
|
||||||
|
|
||||||
|
/***** Get questions and current user's answers of exam print from database *****/
|
||||||
|
ExaPrn_GetPrintQuestionsFromDB (&Print);
|
||||||
|
|
||||||
/***** Get answers from form to assess a test *****/
|
/***** Get answers from form to assess a test *****/
|
||||||
ExaPrn_GetAnswerFromForm (&Print,QstInd);
|
ExaPrn_GetAnswerFromForm (&Print,QstInd);
|
||||||
|
@ -1029,8 +1047,8 @@ void ExaPrn_ReceivePrintAnswer (void)
|
||||||
}
|
}
|
||||||
else // Not accessible to answer
|
else // Not accessible to answer
|
||||||
{
|
{
|
||||||
/***** Set log open ****/
|
/***** Set log open to false ****/
|
||||||
ExaLog_SetOpen (true);
|
ExaLog_SetIfCanAnswer (false);
|
||||||
|
|
||||||
/***** Show warning *****/
|
/***** Show warning *****/
|
||||||
Ale_ShowAlert (Ale_INFO,Txt_You_dont_have_access_to_the_exam);
|
Ale_ShowAlert (Ale_INFO,Txt_You_dont_have_access_to_the_exam);
|
||||||
|
|
|
@ -57,7 +57,7 @@ void ExaPrn_ResetPrint (struct ExaPrn_Print *Print);
|
||||||
|
|
||||||
void ExaPrn_ShowExamPrint (void);
|
void ExaPrn_ShowExamPrint (void);
|
||||||
|
|
||||||
void ExaPrn_GetPrintDataBySesCodAndUsrCod (struct ExaPrn_Print *Print);
|
void ExaPrn_GetDataOfPrintByCodAndUsrCod (struct ExaPrn_Print *Print);
|
||||||
|
|
||||||
void ExaPrn_GetPrintQuestionsFromDB (struct ExaPrn_Print *Print);
|
void ExaPrn_GetPrintQuestionsFromDB (struct ExaPrn_Print *Print);
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,12 @@ static void ExaRes_ShowResultsSummaryRow (unsigned NumResults,
|
||||||
double TotalScoreOfAllResults,
|
double TotalScoreOfAllResults,
|
||||||
double TotalGrade);
|
double TotalGrade);
|
||||||
|
|
||||||
static bool ExaRes_CheckIfICanSeePrintResult (struct ExaSes_Session *Session,long UsrCod);
|
static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
|
||||||
|
const struct ExaSes_Session *Session,
|
||||||
|
struct ExaPrn_Print *Print,
|
||||||
|
struct UsrData *UsrDat);
|
||||||
|
|
||||||
|
static bool ExaRes_CheckIfICanSeePrintResult (const struct ExaSes_Session *Session,long UsrCod);
|
||||||
static bool ExaRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility);
|
static bool ExaRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility);
|
||||||
|
|
||||||
static void ExaRes_ShowExamAnswers (struct UsrData *UsrDat,
|
static void ExaRes_ShowExamAnswers (struct UsrData *UsrDat,
|
||||||
|
@ -1076,31 +1081,17 @@ static void ExaRes_ShowResultsSummaryRow (unsigned NumResults,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Show one session result of another user *******************/
|
/*************************** Show one exam result ****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void ExaRes_ShowOneExaResult (void)
|
void ExaRes_ShowOneExaResult (void)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ASSESSMENT_Exams_results;
|
|
||||||
extern const char *Txt_The_user_does_not_exist;
|
|
||||||
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
|
||||||
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
|
||||||
extern const char *Txt_Questions;
|
|
||||||
extern const char *Txt_non_blank_QUESTIONS;
|
|
||||||
extern const char *Txt_Score;
|
|
||||||
extern const char *Txt_Grade;
|
|
||||||
struct Exa_Exams Exams;
|
struct Exa_Exams Exams;
|
||||||
struct Exa_Exam Exam;
|
struct Exa_Exam Exam;
|
||||||
struct ExaSes_Session Session;
|
struct ExaSes_Session Session;
|
||||||
Usr_MeOrOther_t MeOrOther;
|
Usr_MeOrOther_t MeOrOther;
|
||||||
struct UsrData *UsrDat;
|
struct UsrData *UsrDat;
|
||||||
Dat_StartEndTime_t StartEndTime;
|
|
||||||
char *Id;
|
|
||||||
struct ExaPrn_Print Print;
|
struct ExaPrn_Print Print;
|
||||||
bool ShowPhoto;
|
|
||||||
char PhotoURL[PATH_MAX + 1];
|
|
||||||
bool ICanViewResult;
|
|
||||||
bool ICanViewScore;
|
|
||||||
|
|
||||||
/***** Reset exams context *****/
|
/***** Reset exams context *****/
|
||||||
Exa_ResetExams (&Exams);
|
Exa_ResetExams (&Exams);
|
||||||
|
@ -1126,31 +1117,68 @@ void ExaRes_ShowOneExaResult (void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Get session result data *****/
|
/***** Get exam print data *****/
|
||||||
ExaPrn_ResetPrint (&Print);
|
ExaPrn_ResetPrint (&Print);
|
||||||
Print.SesCod = Session.SesCod;
|
Print.SesCod = Session.SesCod;
|
||||||
Print.UsrCod = UsrDat->UsrCod;
|
Print.UsrCod = UsrDat->UsrCod;
|
||||||
ExaPrn_GetPrintDataBySesCodAndUsrCod (&Print);
|
ExaPrn_GetDataOfPrintByCodAndUsrCod (&Print);
|
||||||
|
|
||||||
/***** Set log action and print code *****/
|
/***** Set log action and print code *****/
|
||||||
if (Gbl.Action.Act == ActEndExaPrn)
|
if (Gbl.Action.Act == ActEndExaPrn)
|
||||||
{
|
{
|
||||||
ExaLog_SetAction (ExaLog_FINISH_EXAM);
|
ExaLog_SetAction (ExaLog_FINISH_EXAM);
|
||||||
ExaLog_SetPrnCod (Print.PrnCod);
|
ExaLog_SetPrnCod (Print.PrnCod);
|
||||||
|
ExaLog_SetIfCanAnswer (ExaSes_CheckIfICanAnswerThisSession (&Exam,&Session));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***** Get questions and user's answers of exam print from database *****/
|
||||||
|
ExaPrn_GetPrintQuestionsFromDB (&Print);
|
||||||
|
|
||||||
|
/***** Show exam result *****/
|
||||||
|
ExaRes_ShowExamResult (&Exam,&Session,&Print,UsrDat);
|
||||||
|
|
||||||
|
/***** Show exam log *****/
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*************************** Show one exam result ****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
|
||||||
|
const struct ExaSes_Session *Session,
|
||||||
|
struct ExaPrn_Print *Print,
|
||||||
|
struct UsrData *UsrDat)
|
||||||
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Exams_results;
|
||||||
|
extern const char *Txt_The_user_does_not_exist;
|
||||||
|
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
|
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
||||||
|
extern const char *Txt_Questions;
|
||||||
|
extern const char *Txt_non_blank_QUESTIONS;
|
||||||
|
extern const char *Txt_Score;
|
||||||
|
extern const char *Txt_Grade;
|
||||||
|
bool ShowPhoto;
|
||||||
|
char PhotoURL[PATH_MAX + 1];
|
||||||
|
Dat_StartEndTime_t StartEndTime;
|
||||||
|
char *Id;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool Result;
|
||||||
|
bool Score;
|
||||||
|
} ICanView;
|
||||||
|
|
||||||
/***** Check if I can view this print result *****/
|
/***** Check if I can view this print result *****/
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
// Depends on visibility of result for this session (eye icon)
|
// Depends on visibility of result for this session (eye icon)
|
||||||
ICanViewResult = ExaRes_CheckIfICanSeePrintResult (&Session,UsrDat->UsrCod);
|
ICanView.Result = ExaRes_CheckIfICanSeePrintResult (Session,UsrDat->UsrCod);
|
||||||
|
|
||||||
if (ICanViewResult)
|
if (ICanView.Result)
|
||||||
// Depends on 5 visibility icons
|
// Depends on 5 visibility icons
|
||||||
ICanViewScore = TstVis_IsVisibleTotalScore (Exam.Visibility);
|
ICanView.Score = TstVis_IsVisibleTotalScore (Exam->Visibility);
|
||||||
else
|
else
|
||||||
ICanViewScore = false;
|
ICanView.Score = false;
|
||||||
break;
|
break;
|
||||||
case Rol_NET:
|
case Rol_NET:
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
|
@ -1158,20 +1186,17 @@ void ExaRes_ShowOneExaResult (void)
|
||||||
case Rol_CTR_ADM:
|
case Rol_CTR_ADM:
|
||||||
case Rol_INS_ADM:
|
case Rol_INS_ADM:
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
ICanViewResult =
|
ICanView.Result =
|
||||||
ICanViewScore = true;
|
ICanView.Score = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ICanViewResult =
|
ICanView.Result =
|
||||||
ICanViewScore = false;
|
ICanView.Score = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Get questions and user's answers of exam print from database *****/
|
|
||||||
ExaPrn_GetPrintQuestionsFromDB (&Print);
|
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
Box_BoxBegin (NULL,Session.Title,
|
Box_BoxBegin (NULL,Session->Title,
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
Hlp_ASSESSMENT_Exams_results,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Exams_results,Box_NOT_CLOSABLE);
|
||||||
Lay_WriteHeaderClassPhoto (false,false,
|
Lay_WriteHeaderClassPhoto (false,false,
|
||||||
|
@ -1226,7 +1251,7 @@ void ExaRes_ShowOneExaResult (void)
|
||||||
if (asprintf (&Id,"match_%u",(unsigned) StartEndTime) < 0)
|
if (asprintf (&Id,"match_%u",(unsigned) StartEndTime) < 0)
|
||||||
Lay_NotEnoughMemoryExit ();
|
Lay_NotEnoughMemoryExit ();
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"DAT LT\"",Id);
|
HTM_TD_Begin ("id=\"%s\" class=\"DAT LT\"",Id);
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Print.TimeUTC[StartEndTime],
|
Dat_WriteLocalDateHMSFromUTC (Id,Print->TimeUTC[StartEndTime],
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
||||||
true,true,true,0x7);
|
true,true,true,0x7);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -1243,10 +1268,10 @@ void ExaRes_ShowOneExaResult (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||||
if (ICanViewResult)
|
if (ICanView.Result)
|
||||||
HTM_TxtF ("%u (%u %s)",
|
HTM_TxtF ("%u (%u %s)",
|
||||||
Print.NumQsts,
|
Print->NumQsts,
|
||||||
Print.NumQstsNotBlank,Txt_non_blank_QUESTIONS);
|
Print->NumQstsNotBlank,Txt_non_blank_QUESTIONS);
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -1261,8 +1286,8 @@ void ExaRes_ShowOneExaResult (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||||
if (ICanViewScore)
|
if (ICanView.Score)
|
||||||
HTM_Double2Decimals (Print.Score);
|
HTM_Double2Decimals (Print->Score);
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -1277,9 +1302,9 @@ void ExaRes_ShowOneExaResult (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT LT\"");
|
HTM_TD_Begin ("class=\"DAT LT\"");
|
||||||
if (ICanViewScore)
|
if (ICanView.Score)
|
||||||
TstPrn_ComputeAndShowGrade (Print.NumQsts,Print.Score,
|
TstPrn_ComputeAndShowGrade (Print->NumQsts,Print->Score,
|
||||||
Exam.MaxGrade);
|
Exam->MaxGrade);
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -1287,22 +1312,22 @@ void ExaRes_ShowOneExaResult (void)
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Write answers and solutions *****/
|
/***** Write answers and solutions *****/
|
||||||
if (ICanViewResult)
|
if (ICanView.Result)
|
||||||
ExaRes_ShowExamAnswers (UsrDat,&Print,Exam.Visibility);
|
ExaRes_ShowExamAnswers (UsrDat,Print,Exam->Visibility);
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
|
||||||
/***** Write total mark of session result *****/
|
/***** Write total mark of session result *****/
|
||||||
if (ICanViewScore)
|
if (ICanView.Score)
|
||||||
{
|
{
|
||||||
HTM_DIV_Begin ("class=\"DAT_N_BOLD CM\"");
|
HTM_DIV_Begin ("class=\"DAT_N_BOLD CM\"");
|
||||||
HTM_TxtColonNBSP (Txt_Score);
|
HTM_TxtColonNBSP (Txt_Score);
|
||||||
HTM_Double2Decimals (Print.Score);
|
HTM_Double2Decimals (Print->Score);
|
||||||
HTM_BR ();
|
HTM_BR ();
|
||||||
HTM_TxtColonNBSP (Txt_Grade);
|
HTM_TxtColonNBSP (Txt_Grade);
|
||||||
TstPrn_ComputeAndShowGrade (Print.NumQsts,Print.Score,
|
TstPrn_ComputeAndShowGrade (Print->NumQsts,Print->Score,
|
||||||
Exam.MaxGrade);
|
Exam->MaxGrade);
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1314,7 +1339,7 @@ void ExaRes_ShowOneExaResult (void)
|
||||||
/********************** Get if I can see session result ************************/
|
/********************** Get if I can see session result ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static bool ExaRes_CheckIfICanSeePrintResult (struct ExaSes_Session *Session,long UsrCod)
|
static bool ExaRes_CheckIfICanSeePrintResult (const struct ExaSes_Session *Session,long UsrCod)
|
||||||
{
|
{
|
||||||
bool ItsMe;
|
bool ItsMe;
|
||||||
|
|
||||||
|
@ -1405,16 +1430,16 @@ static void ExaRes_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
unsigned Visibility)
|
unsigned Visibility)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Score;
|
extern const char *Txt_Score;
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY];
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY];
|
||||||
|
|
||||||
/***** Check if I can view each part of the question *****/
|
/***** Check if I can view each part of the question *****/
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
IsVisible[TstVis_VISIBLE_QST_ANS_TXT ] = TstVis_IsVisibleQstAndAnsTxt (Visibility);
|
ICanView[TstVis_VISIBLE_QST_ANS_TXT ] = TstVis_IsVisibleQstAndAnsTxt (Visibility);
|
||||||
IsVisible[TstVis_VISIBLE_FEEDBACK_TXT ] = TstVis_IsVisibleFeedbackTxt (Visibility);
|
ICanView[TstVis_VISIBLE_FEEDBACK_TXT ] = TstVis_IsVisibleFeedbackTxt (Visibility);
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] = TstVis_IsVisibleCorrectAns (Visibility);
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] = TstVis_IsVisibleCorrectAns (Visibility);
|
||||||
IsVisible[TstVis_VISIBLE_EACH_QST_SCORE] = TstVis_IsVisibleEachQstScore (Visibility);
|
ICanView[TstVis_VISIBLE_EACH_QST_SCORE] = TstVis_IsVisibleEachQstScore (Visibility);
|
||||||
break;
|
break;
|
||||||
case Rol_NET:
|
case Rol_NET:
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
|
@ -1422,16 +1447,16 @@ static void ExaRes_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
case Rol_CTR_ADM:
|
case Rol_CTR_ADM:
|
||||||
case Rol_INS_ADM:
|
case Rol_INS_ADM:
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
IsVisible[TstVis_VISIBLE_QST_ANS_TXT ] =
|
ICanView[TstVis_VISIBLE_QST_ANS_TXT ] =
|
||||||
IsVisible[TstVis_VISIBLE_FEEDBACK_TXT ] =
|
ICanView[TstVis_VISIBLE_FEEDBACK_TXT ] =
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] =
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] =
|
||||||
IsVisible[TstVis_VISIBLE_EACH_QST_SCORE] = true;
|
ICanView[TstVis_VISIBLE_EACH_QST_SCORE] = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
IsVisible[TstVis_VISIBLE_QST_ANS_TXT ] =
|
ICanView[TstVis_VISIBLE_QST_ANS_TXT ] =
|
||||||
IsVisible[TstVis_VISIBLE_FEEDBACK_TXT ] =
|
ICanView[TstVis_VISIBLE_FEEDBACK_TXT ] =
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] =
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] =
|
||||||
IsVisible[TstVis_VISIBLE_EACH_QST_SCORE] = false;
|
ICanView[TstVis_VISIBLE_EACH_QST_SCORE] = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1448,10 +1473,10 @@ static void ExaRes_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
/* Stem */
|
/* Stem */
|
||||||
Tst_WriteQstStem (Question->Stem,"TEST_EXA",IsVisible[TstVis_VISIBLE_QST_ANS_TXT]);
|
Tst_WriteQstStem (Question->Stem,"TEST_EXA",ICanView[TstVis_VISIBLE_QST_ANS_TXT]);
|
||||||
|
|
||||||
/* Media */
|
/* Media */
|
||||||
if (IsVisible[TstVis_VISIBLE_QST_ANS_TXT])
|
if (ICanView[TstVis_VISIBLE_QST_ANS_TXT])
|
||||||
Med_ShowMedia (&Question->Media,
|
Med_ShowMedia (&Question->Media,
|
||||||
"TEST_MED_SHOW_CONT",
|
"TEST_MED_SHOW_CONT",
|
||||||
"TEST_MED_SHOW");
|
"TEST_MED_SHOW");
|
||||||
|
@ -1459,10 +1484,10 @@ static void ExaRes_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
/* Answers */
|
/* Answers */
|
||||||
ExaPrn_ComputeAnswerScore (&Print->PrintedQuestions[NumQst],Question);
|
ExaPrn_ComputeAnswerScore (&Print->PrintedQuestions[NumQst],Question);
|
||||||
TstPrn_WriteAnswersExam (UsrDat,&Print->PrintedQuestions[NumQst],Question,
|
TstPrn_WriteAnswersExam (UsrDat,&Print->PrintedQuestions[NumQst],Question,
|
||||||
IsVisible);
|
ICanView);
|
||||||
|
|
||||||
/* Write score retrieved from database */
|
/* Write score retrieved from database */
|
||||||
if (IsVisible[TstVis_VISIBLE_EACH_QST_SCORE])
|
if (ICanView[TstVis_VISIBLE_EACH_QST_SCORE])
|
||||||
{
|
{
|
||||||
HTM_DIV_Begin ("class=\"DAT_SMALL LM\"");
|
HTM_DIV_Begin ("class=\"DAT_SMALL LM\"");
|
||||||
HTM_TxtColonNBSP (Txt_Score);
|
HTM_TxtColonNBSP (Txt_Score);
|
||||||
|
@ -1477,7 +1502,7 @@ static void ExaRes_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Question feedback */
|
/* Question feedback */
|
||||||
if (IsVisible[TstVis_VISIBLE_FEEDBACK_TXT])
|
if (ICanView[TstVis_VISIBLE_FEEDBACK_TXT])
|
||||||
Tst_WriteQstFeedback (Question->Feedback,"TEST_EXA_LIGHT");
|
Tst_WriteQstFeedback (Question->Feedback,"TEST_EXA_LIGHT");
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
|
@ -333,25 +333,6 @@ void ExaSes_GetDataOfSessionByCod (struct ExaSes_Session *Session)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/***************** Check if exam session is visible and open *****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool ExaSes_CheckIfSessionIsVisibleAndOpen (long SesCod)
|
|
||||||
{
|
|
||||||
/***** Trivial check *****/
|
|
||||||
if (SesCod < 0) // A non-existing session...
|
|
||||||
return false; // ...is not visible or open
|
|
||||||
|
|
||||||
/***** Check if exam session is visible and open from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not check if session is visible and open",
|
|
||||||
"SELECT COUNT(*) FROM exa_sessions"
|
|
||||||
" WHERE SesCod=%ld"
|
|
||||||
" AND Hidden='N'" // Visible
|
|
||||||
" AND NOW() BETWEEN StartTime AND EndTime", // Open
|
|
||||||
SesCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Put icons in list of sessions of an exam ******************/
|
/***************** Put icons in list of sessions of an exam ******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -55,7 +55,6 @@ void ExaSes_ListSessions (struct Exa_Exams *Exams,
|
||||||
struct ExaSes_Session *Session,
|
struct ExaSes_Session *Session,
|
||||||
bool PutFormSession);
|
bool PutFormSession);
|
||||||
void ExaSes_GetDataOfSessionByCod (struct ExaSes_Session *Session);
|
void ExaSes_GetDataOfSessionByCod (struct ExaSes_Session *Session);
|
||||||
bool ExaSes_CheckIfSessionIsVisibleAndOpen (long SesCod);
|
|
||||||
|
|
||||||
void ExaSes_ToggleVisResultsSesUsr (void);
|
void ExaSes_ToggleVisResultsSesUsr (void);
|
||||||
|
|
||||||
|
|
|
@ -105,23 +105,23 @@ static void TstPrn_GetCorrectTxtAnswerFromDB (struct Tst_Question *Question);
|
||||||
static void TstPrn_WriteIntAnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteIntAnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY]);
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY]);
|
||||||
static void TstPrn_WriteFltAnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteFltAnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY]);
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY]);
|
||||||
static void TstPrn_WriteTF_AnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteTF_AnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY]);
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY]);
|
||||||
static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY]);
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY]);
|
||||||
static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY]);
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY]);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -280,16 +280,16 @@ static void TstPrn_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
extern const char *Txt_Question_removed;
|
extern const char *Txt_Question_removed;
|
||||||
extern const char *Txt_Question_modified;
|
extern const char *Txt_Question_modified;
|
||||||
bool QuestionUneditedAfterExam = false;
|
bool QuestionUneditedAfterExam = false;
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY];
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY];
|
||||||
|
|
||||||
/***** Check if I can view each part of the question *****/
|
/***** Check if I can view each part of the question *****/
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
IsVisible[TstVis_VISIBLE_QST_ANS_TXT ] = TstVis_IsVisibleQstAndAnsTxt (Visibility);
|
ICanView[TstVis_VISIBLE_QST_ANS_TXT ] = TstVis_IsVisibleQstAndAnsTxt (Visibility);
|
||||||
IsVisible[TstVis_VISIBLE_FEEDBACK_TXT ] = TstVis_IsVisibleFeedbackTxt (Visibility);
|
ICanView[TstVis_VISIBLE_FEEDBACK_TXT ] = TstVis_IsVisibleFeedbackTxt (Visibility);
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] = TstVis_IsVisibleCorrectAns (Visibility);
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] = TstVis_IsVisibleCorrectAns (Visibility);
|
||||||
IsVisible[TstVis_VISIBLE_EACH_QST_SCORE] = TstVis_IsVisibleEachQstScore (Visibility);
|
ICanView[TstVis_VISIBLE_EACH_QST_SCORE] = TstVis_IsVisibleEachQstScore (Visibility);
|
||||||
break;
|
break;
|
||||||
case Rol_NET:
|
case Rol_NET:
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
|
@ -297,16 +297,16 @@ static void TstPrn_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
case Rol_CTR_ADM:
|
case Rol_CTR_ADM:
|
||||||
case Rol_INS_ADM:
|
case Rol_INS_ADM:
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
IsVisible[TstVis_VISIBLE_QST_ANS_TXT ] =
|
ICanView[TstVis_VISIBLE_QST_ANS_TXT ] =
|
||||||
IsVisible[TstVis_VISIBLE_FEEDBACK_TXT ] =
|
ICanView[TstVis_VISIBLE_FEEDBACK_TXT ] =
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] =
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] =
|
||||||
IsVisible[TstVis_VISIBLE_EACH_QST_SCORE] = true;
|
ICanView[TstVis_VISIBLE_EACH_QST_SCORE] = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
IsVisible[TstVis_VISIBLE_QST_ANS_TXT ] =
|
ICanView[TstVis_VISIBLE_QST_ANS_TXT ] =
|
||||||
IsVisible[TstVis_VISIBLE_FEEDBACK_TXT ] =
|
ICanView[TstVis_VISIBLE_FEEDBACK_TXT ] =
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] =
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] =
|
||||||
IsVisible[TstVis_VISIBLE_EACH_QST_SCORE] = false;
|
ICanView[TstVis_VISIBLE_EACH_QST_SCORE] = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,10 +334,10 @@ static void TstPrn_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
if (QuestionUneditedAfterExam)
|
if (QuestionUneditedAfterExam)
|
||||||
{
|
{
|
||||||
/* Stem */
|
/* Stem */
|
||||||
Tst_WriteQstStem (Question->Stem,"TEST_EXA",IsVisible[TstVis_VISIBLE_QST_ANS_TXT]);
|
Tst_WriteQstStem (Question->Stem,"TEST_EXA",ICanView[TstVis_VISIBLE_QST_ANS_TXT]);
|
||||||
|
|
||||||
/* Media */
|
/* Media */
|
||||||
if (IsVisible[TstVis_VISIBLE_QST_ANS_TXT])
|
if (ICanView[TstVis_VISIBLE_QST_ANS_TXT])
|
||||||
Med_ShowMedia (&Question->Media,
|
Med_ShowMedia (&Question->Media,
|
||||||
"TEST_MED_SHOW_CONT",
|
"TEST_MED_SHOW_CONT",
|
||||||
"TEST_MED_SHOW");
|
"TEST_MED_SHOW");
|
||||||
|
@ -345,7 +345,7 @@ static void TstPrn_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
/* Answers */
|
/* Answers */
|
||||||
TstPrn_ComputeAnswerScore (&Print->PrintedQuestions[NumQst],Question);
|
TstPrn_ComputeAnswerScore (&Print->PrintedQuestions[NumQst],Question);
|
||||||
TstPrn_WriteAnswersExam (UsrDat,&Print->PrintedQuestions[NumQst],Question,
|
TstPrn_WriteAnswersExam (UsrDat,&Print->PrintedQuestions[NumQst],Question,
|
||||||
IsVisible);
|
ICanView);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_Question_modified);
|
Ale_ShowAlert (Ale_WARNING,Txt_Question_modified);
|
||||||
|
@ -354,7 +354,7 @@ static void TstPrn_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_Question_removed);
|
Ale_ShowAlert (Ale_WARNING,Txt_Question_removed);
|
||||||
|
|
||||||
/* Write score retrieved from database */
|
/* Write score retrieved from database */
|
||||||
if (IsVisible[TstVis_VISIBLE_EACH_QST_SCORE])
|
if (ICanView[TstVis_VISIBLE_EACH_QST_SCORE])
|
||||||
{
|
{
|
||||||
HTM_DIV_Begin ("class=\"DAT_SMALL LM\"");
|
HTM_DIV_Begin ("class=\"DAT_SMALL LM\"");
|
||||||
HTM_TxtColonNBSP (Txt_Score);
|
HTM_TxtColonNBSP (Txt_Score);
|
||||||
|
@ -370,7 +370,7 @@ static void TstPrn_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
|
|
||||||
/* Question feedback */
|
/* Question feedback */
|
||||||
if (QuestionUneditedAfterExam)
|
if (QuestionUneditedAfterExam)
|
||||||
if (IsVisible[TstVis_VISIBLE_FEEDBACK_TXT])
|
if (ICanView[TstVis_VISIBLE_FEEDBACK_TXT])
|
||||||
Tst_WriteQstFeedback (Question->Feedback,"TEST_EXA_LIGHT");
|
Tst_WriteQstFeedback (Question->Feedback,"TEST_EXA_LIGHT");
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -916,12 +916,12 @@ void TstPrn_ShowGrade (double Grade,double MaxGrade)
|
||||||
void TstPrn_WriteAnswersExam (struct UsrData *UsrDat,
|
void TstPrn_WriteAnswersExam (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY])
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY])
|
||||||
{
|
{
|
||||||
void (*TstPrn_WriteAnsExam[Tst_NUM_ANS_TYPES]) (struct UsrData *UsrDat,
|
void (*TstPrn_WriteAnsExam[Tst_NUM_ANS_TYPES]) (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY]) =
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY]) =
|
||||||
{
|
{
|
||||||
[Tst_ANS_INT ] = TstPrn_WriteIntAnsPrint,
|
[Tst_ANS_INT ] = TstPrn_WriteIntAnsPrint,
|
||||||
[Tst_ANS_FLOAT ] = TstPrn_WriteFltAnsPrint,
|
[Tst_ANS_FLOAT ] = TstPrn_WriteFltAnsPrint,
|
||||||
|
@ -933,7 +933,7 @@ void TstPrn_WriteAnswersExam (struct UsrData *UsrDat,
|
||||||
|
|
||||||
/***** Get correct answer and compute answer score depending on type *****/
|
/***** Get correct answer and compute answer score depending on type *****/
|
||||||
TstPrn_WriteAnsExam[Question->Answer.Type] (UsrDat,PrintedQuestion,Question,
|
TstPrn_WriteAnsExam[Question->Answer.Type] (UsrDat,PrintedQuestion,Question,
|
||||||
IsVisible);
|
ICanView);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -943,7 +943,7 @@ void TstPrn_WriteAnswersExam (struct UsrData *UsrDat,
|
||||||
static void TstPrn_WriteIntAnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteIntAnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY])
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY])
|
||||||
{
|
{
|
||||||
long IntAnswerUsr;
|
long IntAnswerUsr;
|
||||||
|
|
||||||
|
@ -964,7 +964,7 @@ static void TstPrn_WriteIntAnsPrint (struct UsrData *UsrDat,
|
||||||
if (sscanf (PrintedQuestion->StrAnswers,"%ld",&IntAnswerUsr) == 1)
|
if (sscanf (PrintedQuestion->StrAnswers,"%ld",&IntAnswerUsr) == 1)
|
||||||
{
|
{
|
||||||
HTM_TD_Begin ("class=\"%s CM\"",
|
HTM_TD_Begin ("class=\"%s CM\"",
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] ?
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] ?
|
||||||
(IntAnswerUsr == Question->Answer.Integer ? "ANS_OK" :
|
(IntAnswerUsr == Question->Answer.Integer ? "ANS_OK" :
|
||||||
"ANS_BAD") :
|
"ANS_BAD") :
|
||||||
"ANS_0");
|
"ANS_0");
|
||||||
|
@ -983,8 +983,8 @@ static void TstPrn_WriteIntAnsPrint (struct UsrData *UsrDat,
|
||||||
|
|
||||||
/***** Write the correct answer *****/
|
/***** Write the correct answer *****/
|
||||||
HTM_TD_Begin ("class=\"ANS_0 CM\"");
|
HTM_TD_Begin ("class=\"ANS_0 CM\"");
|
||||||
if (IsVisible[TstVis_VISIBLE_QST_ANS_TXT] &&
|
if (ICanView[TstVis_VISIBLE_QST_ANS_TXT] &&
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER])
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER])
|
||||||
HTM_Long (Question->Answer.Integer);
|
HTM_Long (Question->Answer.Integer);
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
|
@ -1002,7 +1002,7 @@ static void TstPrn_WriteIntAnsPrint (struct UsrData *UsrDat,
|
||||||
static void TstPrn_WriteFltAnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteFltAnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY])
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY])
|
||||||
{
|
{
|
||||||
double FloatAnsUsr = 0.0;
|
double FloatAnsUsr = 0.0;
|
||||||
|
|
||||||
|
@ -1024,7 +1024,7 @@ static void TstPrn_WriteFltAnsPrint (struct UsrData *UsrDat,
|
||||||
FloatAnsUsr = Str_GetDoubleFromStr (PrintedQuestion->StrAnswers);
|
FloatAnsUsr = Str_GetDoubleFromStr (PrintedQuestion->StrAnswers);
|
||||||
// A bad formatted floating point answer will interpreted as 0.0
|
// A bad formatted floating point answer will interpreted as 0.0
|
||||||
HTM_TD_Begin ("class=\"%s CM\"",
|
HTM_TD_Begin ("class=\"%s CM\"",
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] ?
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] ?
|
||||||
((FloatAnsUsr >= Question->Answer.FloatingPoint[0] &&
|
((FloatAnsUsr >= Question->Answer.FloatingPoint[0] &&
|
||||||
FloatAnsUsr <= Question->Answer.FloatingPoint[1]) ? "ANS_OK" :
|
FloatAnsUsr <= Question->Answer.FloatingPoint[1]) ? "ANS_OK" :
|
||||||
"ANS_BAD") :
|
"ANS_BAD") :
|
||||||
|
@ -1037,8 +1037,8 @@ static void TstPrn_WriteFltAnsPrint (struct UsrData *UsrDat,
|
||||||
|
|
||||||
/***** Write the correct answer *****/
|
/***** Write the correct answer *****/
|
||||||
HTM_TD_Begin ("class=\"ANS_0 CM\"");
|
HTM_TD_Begin ("class=\"ANS_0 CM\"");
|
||||||
if (IsVisible[TstVis_VISIBLE_QST_ANS_TXT] &&
|
if (ICanView[TstVis_VISIBLE_QST_ANS_TXT] &&
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER])
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER])
|
||||||
{
|
{
|
||||||
HTM_Txt ("[");
|
HTM_Txt ("[");
|
||||||
HTM_Double (Question->Answer.FloatingPoint[0]);
|
HTM_Double (Question->Answer.FloatingPoint[0]);
|
||||||
|
@ -1062,7 +1062,7 @@ static void TstPrn_WriteFltAnsPrint (struct UsrData *UsrDat,
|
||||||
static void TstPrn_WriteTF_AnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteTF_AnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY])
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY])
|
||||||
{
|
{
|
||||||
char AnsTFUsr;
|
char AnsTFUsr;
|
||||||
|
|
||||||
|
@ -1082,7 +1082,7 @@ static void TstPrn_WriteTF_AnsPrint (struct UsrData *UsrDat,
|
||||||
|
|
||||||
/***** Write the user answer *****/
|
/***** Write the user answer *****/
|
||||||
HTM_TD_Begin ("class=\"%s CM\"",
|
HTM_TD_Begin ("class=\"%s CM\"",
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] ?
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] ?
|
||||||
(AnsTFUsr == Question->Answer.TF ? "ANS_OK" :
|
(AnsTFUsr == Question->Answer.TF ? "ANS_OK" :
|
||||||
"ANS_BAD") :
|
"ANS_BAD") :
|
||||||
"ANS_0");
|
"ANS_0");
|
||||||
|
@ -1091,8 +1091,8 @@ static void TstPrn_WriteTF_AnsPrint (struct UsrData *UsrDat,
|
||||||
|
|
||||||
/***** Write the correct answer *****/
|
/***** Write the correct answer *****/
|
||||||
HTM_TD_Begin ("class=\"ANS_0 CM\"");
|
HTM_TD_Begin ("class=\"ANS_0 CM\"");
|
||||||
if (IsVisible[TstVis_VISIBLE_QST_ANS_TXT] &&
|
if (ICanView[TstVis_VISIBLE_QST_ANS_TXT] &&
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER])
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER])
|
||||||
Tst_WriteAnsTF (Question->Answer.TF);
|
Tst_WriteAnsTF (Question->Answer.TF);
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
|
@ -1110,7 +1110,7 @@ static void TstPrn_WriteTF_AnsPrint (struct UsrData *UsrDat,
|
||||||
static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY])
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY])
|
||||||
{
|
{
|
||||||
extern const char *Txt_TST_Answer_given_by_the_user;
|
extern const char *Txt_TST_Answer_given_by_the_user;
|
||||||
extern const char *Txt_TST_Answer_given_by_the_teachers;
|
extern const char *Txt_TST_Answer_given_by_the_teachers;
|
||||||
|
@ -1135,7 +1135,7 @@ static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||||
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK,false);
|
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK,false);
|
||||||
|
|
||||||
/* Convert answer feedback, that is in HTML, to rigorous HTML */
|
/* Convert answer feedback, that is in HTML, to rigorous HTML */
|
||||||
if (IsVisible[TstVis_VISIBLE_FEEDBACK_TXT])
|
if (ICanView[TstVis_VISIBLE_FEEDBACK_TXT])
|
||||||
if (Question->Answer.Options[NumOpt].Feedback)
|
if (Question->Answer.Options[NumOpt].Feedback)
|
||||||
if (Question->Answer.Options[NumOpt].Feedback[0])
|
if (Question->Answer.Options[NumOpt].Feedback[0])
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
|
@ -1166,7 +1166,7 @@ static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||||
/* Draw icon depending on user's answer */
|
/* Draw icon depending on user's answer */
|
||||||
if (UsrAnswers[Indexes[NumOpt]] == true) // This answer has been selected by the user
|
if (UsrAnswers[Indexes[NumOpt]] == true) // This answer has been selected by the user
|
||||||
{
|
{
|
||||||
if (IsVisible[TstVis_VISIBLE_CORRECT_ANSWER])
|
if (ICanView[TstVis_VISIBLE_CORRECT_ANSWER])
|
||||||
{
|
{
|
||||||
if (Question->Answer.Options[Indexes[NumOpt]].Correct)
|
if (Question->Answer.Options[Indexes[NumOpt]].Correct)
|
||||||
{
|
{
|
||||||
|
@ -1194,7 +1194,7 @@ static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||||
HTM_TD_Empty (1);
|
HTM_TD_Empty (1);
|
||||||
|
|
||||||
/* Draw icon that indicates whether the answer is correct */
|
/* Draw icon that indicates whether the answer is correct */
|
||||||
if (IsVisible[TstVis_VISIBLE_CORRECT_ANSWER])
|
if (ICanView[TstVis_VISIBLE_CORRECT_ANSWER])
|
||||||
{
|
{
|
||||||
if (Question->Answer.Options[Indexes[NumOpt]].Correct)
|
if (Question->Answer.Options[Indexes[NumOpt]].Correct)
|
||||||
{
|
{
|
||||||
|
@ -1222,7 +1222,7 @@ static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
|
||||||
HTM_DIV_Begin ("class=\"ANS_TXT\"");
|
HTM_DIV_Begin ("class=\"ANS_TXT\"");
|
||||||
if (IsVisible[TstVis_VISIBLE_QST_ANS_TXT])
|
if (ICanView[TstVis_VISIBLE_QST_ANS_TXT])
|
||||||
{
|
{
|
||||||
HTM_Txt (Question->Answer.Options[Indexes[NumOpt]].Text);
|
HTM_Txt (Question->Answer.Options[Indexes[NumOpt]].Text);
|
||||||
Med_ShowMedia (&Question->Answer.Options[Indexes[NumOpt]].Media,
|
Med_ShowMedia (&Question->Answer.Options[Indexes[NumOpt]].Media,
|
||||||
|
@ -1233,7 +1233,7 @@ static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
||||||
if (IsVisible[TstVis_VISIBLE_CORRECT_ANSWER])
|
if (ICanView[TstVis_VISIBLE_CORRECT_ANSWER])
|
||||||
if (Question->Answer.Options[Indexes[NumOpt]].Feedback)
|
if (Question->Answer.Options[Indexes[NumOpt]].Feedback)
|
||||||
if (Question->Answer.Options[Indexes[NumOpt]].Feedback[0])
|
if (Question->Answer.Options[Indexes[NumOpt]].Feedback[0])
|
||||||
{
|
{
|
||||||
|
@ -1258,7 +1258,7 @@ static void TstPrn_WriteChoAnsPrint (struct UsrData *UsrDat,
|
||||||
static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
||||||
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
const struct TstPrn_PrintedQuestion *PrintedQuestion,
|
||||||
const struct Tst_Question *Question,
|
const struct Tst_Question *Question,
|
||||||
bool IsVisible[TstVis_NUM_ITEMS_VISIBILITY])
|
bool ICanView[TstVis_NUM_ITEMS_VISIBILITY])
|
||||||
{
|
{
|
||||||
unsigned NumOpt;
|
unsigned NumOpt;
|
||||||
char TextAnsUsr[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1];
|
char TextAnsUsr[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1];
|
||||||
|
@ -1277,7 +1277,7 @@ static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
||||||
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK,false);
|
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK,false);
|
||||||
|
|
||||||
/* Convert answer feedback, that is in HTML, to rigorous HTML */
|
/* Convert answer feedback, that is in HTML, to rigorous HTML */
|
||||||
if (IsVisible[TstVis_VISIBLE_FEEDBACK_TXT])
|
if (ICanView[TstVis_VISIBLE_FEEDBACK_TXT])
|
||||||
if (Question->Answer.Options[NumOpt].Feedback)
|
if (Question->Answer.Options[NumOpt].Feedback)
|
||||||
if (Question->Answer.Options[NumOpt].Feedback[0])
|
if (Question->Answer.Options[NumOpt].Feedback[0])
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
|
@ -1323,7 +1323,7 @@ static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HTM_TD_Begin ("class=\"%s CT\"",
|
HTM_TD_Begin ("class=\"%s CT\"",
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER] ? (Correct ? "ANS_OK" :
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER] ? (Correct ? "ANS_OK" :
|
||||||
"ANS_BAD") :
|
"ANS_BAD") :
|
||||||
"ANS_0");
|
"ANS_0");
|
||||||
HTM_Txt (PrintedQuestion->StrAnswers);
|
HTM_Txt (PrintedQuestion->StrAnswers);
|
||||||
|
@ -1333,8 +1333,8 @@ static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write the correct answers *****/
|
/***** Write the correct answers *****/
|
||||||
if (IsVisible[TstVis_VISIBLE_QST_ANS_TXT] &&
|
if (ICanView[TstVis_VISIBLE_QST_ANS_TXT] &&
|
||||||
IsVisible[TstVis_VISIBLE_CORRECT_ANSWER])
|
ICanView[TstVis_VISIBLE_CORRECT_ANSWER])
|
||||||
{
|
{
|
||||||
HTM_TD_Begin ("class=\"CT\"");
|
HTM_TD_Begin ("class=\"CT\"");
|
||||||
HTM_TABLE_BeginPadding (2);
|
HTM_TABLE_BeginPadding (2);
|
||||||
|
@ -1357,7 +1357,7 @@ static void TstPrn_WriteTxtAnsPrint (struct UsrData *UsrDat,
|
||||||
HTM_Txt (Question->Answer.Options[NumOpt].Text);
|
HTM_Txt (Question->Answer.Options[NumOpt].Text);
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
||||||
if (IsVisible[TstVis_VISIBLE_FEEDBACK_TXT])
|
if (ICanView[TstVis_VISIBLE_FEEDBACK_TXT])
|
||||||
if (Question->Answer.Options[NumOpt].Feedback)
|
if (Question->Answer.Options[NumOpt].Feedback)
|
||||||
if (Question->Answer.Options[NumOpt].Feedback[0])
|
if (Question->Answer.Options[NumOpt].Feedback[0])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue