Version19.216

This commit is contained in:
acanas 2020-05-07 12:56:47 +02:00
parent 018a1f9918
commit a010ff4915
11 changed files with 182 additions and 128 deletions

View File

@ -36,7 +36,7 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \
swad_database.o swad_date.o swad_degree.o swad_degree_config.o \
swad_degree_type.o swad_department.o swad_duplicate.o \
swad_enrolment.o swad_exam.o swad_exam_announcement.o \
swad_exam_event.o swad_exam_result.o swad_exam_set.o \
swad_exam_event.o swad_exam_print.o swad_exam_result.o swad_exam_set.o \
swad_figure.o swad_figure_cache.o swad_file.o swad_file_browser.o \
swad_file_extension.o swad_file_MIME.o swad_firewall.o swad_follow.o \
swad_form.o swad_forum.o \

View File

@ -549,7 +549,7 @@ CREATE TABLE IF NOT EXISTS exa_sets (
SetCod INT NOT NULL AUTO_INCREMENT,
ExaCod INT NOT NULL,
SetInd INT NOT NULL,
NumQstsToExam INT NOT NULL DEFAULT 0,
NumQstsToPrint INT NOT NULL DEFAULT 0,
Title VARCHAR(2047) NOT NULL,
UNIQUE INDEX(SetCod),
UNIQUE INDEX(ExaCod,SetInd));

View File

@ -49,6 +49,7 @@
#include "swad_exam.h"
#include "swad_exam_announcement.h"
#include "swad_exam_event.h"
#include "swad_exam_print.h"
#include "swad_exam_result.h"
#include "swad_exam_set.h"
#include "swad_enrolment.h"
@ -739,6 +740,8 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActReqRemSetQst ] = {1888,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_RequestRemoveQstFromSet ,NULL},
[ActRemExaQst ] = {1889,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_RemoveQstFromSet ,NULL},
[ActSeeExaPrn ] = {1904,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaPrn_ShowNewExamPrint ,NULL},
[ActSeeGam ] = {1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL},
[ActReqRemMch ] = {1783,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_RequestRemoveMatch ,NULL},
@ -3720,6 +3723,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActShoExaEvt, // #1901
ActEdiOneExaEvt, // #1902
ActChgExaEvt, // #1903
ActSeeExaPrn, // #1904
};
/*****************************************************************************/

View File

@ -64,7 +64,7 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_MAX_ACTION_COD 1903
#define Act_MAX_ACTION_COD 1904
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
@ -704,81 +704,83 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActReqRemSetQst (ActChgCrsTT1stDay + 174)
#define ActRemExaQst (ActChgCrsTT1stDay + 175)
#define ActSeeGam (ActChgCrsTT1stDay + 176)
#define ActReqRemMch (ActChgCrsTT1stDay + 177)
#define ActRemMch (ActChgCrsTT1stDay + 178)
#define ActReqNewMch (ActChgCrsTT1stDay + 179)
#define ActNewMch (ActChgCrsTT1stDay + 180)
#define ActResMch (ActChgCrsTT1stDay + 181)
#define ActBckMch (ActChgCrsTT1stDay + 182)
#define ActPlyPauMch (ActChgCrsTT1stDay + 183)
#define ActFwdMch (ActChgCrsTT1stDay + 184)
#define ActChgNumColMch (ActChgCrsTT1stDay + 185)
#define ActChgVisResMchQst (ActChgCrsTT1stDay + 186)
#define ActMchCntDwn (ActChgCrsTT1stDay + 187)
#define ActRefMchTch (ActChgCrsTT1stDay + 188)
#define ActSeeExaPrn (ActChgCrsTT1stDay + 176)
#define ActJoiMch (ActChgCrsTT1stDay + 189)
#define ActSeeMchAnsQstStd (ActChgCrsTT1stDay + 190)
#define ActRemMchAnsQstStd (ActChgCrsTT1stDay + 191)
#define ActAnsMchQstStd (ActChgCrsTT1stDay + 192)
#define ActRefMchStd (ActChgCrsTT1stDay + 193)
#define ActSeeGam (ActChgCrsTT1stDay + 177)
#define ActReqRemMch (ActChgCrsTT1stDay + 178)
#define ActRemMch (ActChgCrsTT1stDay + 179)
#define ActReqNewMch (ActChgCrsTT1stDay + 180)
#define ActNewMch (ActChgCrsTT1stDay + 181)
#define ActResMch (ActChgCrsTT1stDay + 182)
#define ActBckMch (ActChgCrsTT1stDay + 183)
#define ActPlyPauMch (ActChgCrsTT1stDay + 184)
#define ActFwdMch (ActChgCrsTT1stDay + 185)
#define ActChgNumColMch (ActChgCrsTT1stDay + 186)
#define ActChgVisResMchQst (ActChgCrsTT1stDay + 187)
#define ActMchCntDwn (ActChgCrsTT1stDay + 188)
#define ActRefMchTch (ActChgCrsTT1stDay + 189)
#define ActSeeMyMchResCrs (ActChgCrsTT1stDay + 194)
#define ActSeeMyMchResGam (ActChgCrsTT1stDay + 195)
#define ActSeeMyMchResMch (ActChgCrsTT1stDay + 196)
#define ActSeeOneMchResMe (ActChgCrsTT1stDay + 197)
#define ActJoiMch (ActChgCrsTT1stDay + 190)
#define ActSeeMchAnsQstStd (ActChgCrsTT1stDay + 191)
#define ActRemMchAnsQstStd (ActChgCrsTT1stDay + 192)
#define ActAnsMchQstStd (ActChgCrsTT1stDay + 193)
#define ActRefMchStd (ActChgCrsTT1stDay + 194)
#define ActReqSeeAllMchRes (ActChgCrsTT1stDay + 198)
#define ActSeeAllMchResCrs (ActChgCrsTT1stDay + 199)
#define ActSeeAllMchResGam (ActChgCrsTT1stDay + 200)
#define ActSeeAllMchResMch (ActChgCrsTT1stDay + 201)
#define ActSeeOneMchResOth (ActChgCrsTT1stDay + 202)
#define ActSeeMyMchResCrs (ActChgCrsTT1stDay + 195)
#define ActSeeMyMchResGam (ActChgCrsTT1stDay + 196)
#define ActSeeMyMchResMch (ActChgCrsTT1stDay + 197)
#define ActSeeOneMchResMe (ActChgCrsTT1stDay + 198)
#define ActChgVisResMchUsr (ActChgCrsTT1stDay + 203)
#define ActReqSeeAllMchRes (ActChgCrsTT1stDay + 199)
#define ActSeeAllMchResCrs (ActChgCrsTT1stDay + 200)
#define ActSeeAllMchResGam (ActChgCrsTT1stDay + 201)
#define ActSeeAllMchResMch (ActChgCrsTT1stDay + 202)
#define ActSeeOneMchResOth (ActChgCrsTT1stDay + 203)
#define ActFrmNewGam (ActChgCrsTT1stDay + 204)
#define ActEdiOneGam (ActChgCrsTT1stDay + 205)
#define ActNewGam (ActChgCrsTT1stDay + 206)
#define ActChgGam (ActChgCrsTT1stDay + 207)
#define ActReqRemGam (ActChgCrsTT1stDay + 208)
#define ActRemGam (ActChgCrsTT1stDay + 209)
#define ActHidGam (ActChgCrsTT1stDay + 210)
#define ActShoGam (ActChgCrsTT1stDay + 211)
#define ActAddOneGamQst (ActChgCrsTT1stDay + 212)
#define ActGamLstTstQst (ActChgCrsTT1stDay + 213)
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 214)
#define ActReqRemGamQst (ActChgCrsTT1stDay + 215)
#define ActRemGamQst (ActChgCrsTT1stDay + 216)
#define ActUp_GamQst (ActChgCrsTT1stDay + 217)
#define ActDwnGamQst (ActChgCrsTT1stDay + 218)
#define ActChgVisResMchUsr (ActChgCrsTT1stDay + 204)
#define ActSeeSvy (ActChgCrsTT1stDay + 219)
#define ActAnsSvy (ActChgCrsTT1stDay + 220)
#define ActFrmNewSvy (ActChgCrsTT1stDay + 221)
#define ActEdiOneSvy (ActChgCrsTT1stDay + 222)
#define ActNewSvy (ActChgCrsTT1stDay + 223)
#define ActChgSvy (ActChgCrsTT1stDay + 224)
#define ActReqRemSvy (ActChgCrsTT1stDay + 225)
#define ActRemSvy (ActChgCrsTT1stDay + 226)
#define ActReqRstSvy (ActChgCrsTT1stDay + 227)
#define ActRstSvy (ActChgCrsTT1stDay + 228)
#define ActHidSvy (ActChgCrsTT1stDay + 229)
#define ActShoSvy (ActChgCrsTT1stDay + 230)
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 231)
#define ActRcvSvyQst (ActChgCrsTT1stDay + 232)
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 233)
#define ActRemSvyQst (ActChgCrsTT1stDay + 234)
#define ActFrmNewGam (ActChgCrsTT1stDay + 205)
#define ActEdiOneGam (ActChgCrsTT1stDay + 206)
#define ActNewGam (ActChgCrsTT1stDay + 207)
#define ActChgGam (ActChgCrsTT1stDay + 208)
#define ActReqRemGam (ActChgCrsTT1stDay + 209)
#define ActRemGam (ActChgCrsTT1stDay + 210)
#define ActHidGam (ActChgCrsTT1stDay + 211)
#define ActShoGam (ActChgCrsTT1stDay + 212)
#define ActAddOneGamQst (ActChgCrsTT1stDay + 213)
#define ActGamLstTstQst (ActChgCrsTT1stDay + 214)
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 215)
#define ActReqRemGamQst (ActChgCrsTT1stDay + 216)
#define ActRemGamQst (ActChgCrsTT1stDay + 217)
#define ActUp_GamQst (ActChgCrsTT1stDay + 218)
#define ActDwnGamQst (ActChgCrsTT1stDay + 219)
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 235)
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 236)
#define ActEdiExaAnn (ActChgCrsTT1stDay + 237)
#define ActRcvExaAnn (ActChgCrsTT1stDay + 238)
#define ActPrnExaAnn (ActChgCrsTT1stDay + 239)
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 240)
#define ActRemExaAnn (ActChgCrsTT1stDay + 241)
#define ActHidExaAnn (ActChgCrsTT1stDay + 242)
#define ActShoExaAnn (ActChgCrsTT1stDay + 243)
#define ActSeeSvy (ActChgCrsTT1stDay + 220)
#define ActAnsSvy (ActChgCrsTT1stDay + 221)
#define ActFrmNewSvy (ActChgCrsTT1stDay + 222)
#define ActEdiOneSvy (ActChgCrsTT1stDay + 223)
#define ActNewSvy (ActChgCrsTT1stDay + 224)
#define ActChgSvy (ActChgCrsTT1stDay + 225)
#define ActReqRemSvy (ActChgCrsTT1stDay + 226)
#define ActRemSvy (ActChgCrsTT1stDay + 227)
#define ActReqRstSvy (ActChgCrsTT1stDay + 228)
#define ActRstSvy (ActChgCrsTT1stDay + 229)
#define ActHidSvy (ActChgCrsTT1stDay + 230)
#define ActShoSvy (ActChgCrsTT1stDay + 231)
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 232)
#define ActRcvSvyQst (ActChgCrsTT1stDay + 233)
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 234)
#define ActRemSvyQst (ActChgCrsTT1stDay + 235)
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 236)
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 237)
#define ActEdiExaAnn (ActChgCrsTT1stDay + 238)
#define ActRcvExaAnn (ActChgCrsTT1stDay + 239)
#define ActPrnExaAnn (ActChgCrsTT1stDay + 240)
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 241)
#define ActRemExaAnn (ActChgCrsTT1stDay + 242)
#define ActHidExaAnn (ActChgCrsTT1stDay + 243)
#define ActShoExaAnn (ActChgCrsTT1stDay + 244)
/*****************************************************************************/
/******************************** Files tab **********************************/

View File

@ -548,10 +548,14 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.215 (2020-05-07)"
#define Log_PLATFORM_VERSION "SWAD 19.216 (2020-05-07)"
#define CSS_FILE "swad19.193.1.css"
#define JS_FILE "swad19.193.1.js"
/*
Version 19.216: May 07, 2020 New module exam_print to generate new exam prints. (301949 lines)
1 change necessary in database:
ALTER TABLE exa_sets CHANGE COLUMN NumQstsToExam NumQstsToPrint INT NOT NULL DEFAULT 0;
Version 19.215: May 07, 2020 New module exam_set for set of questions. (301695 lines)
Version 19.214.1: May 07, 2020 Change color of dates on current exam event. (301597 lines)
Version 19.214: May 06, 2020 New API function getLocations. (301568 lines)

View File

@ -1204,22 +1204,22 @@ mysql> DESCRIBE exa_results;
/***** Table exa_sets *****/
/*
mysql> DESCRIBE exa_sets;
+---------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------+------+-----+---------+----------------+
| SetCod | int(11) | NO | PRI | NULL | auto_increment |
| ExaCod | int(11) | NO | | NULL | |
| SetInd | int(11) | NO | | NULL | |
| NumQstsToExam | int(11) | NO | | 0 | |
| Title | varchar(2047) | NO | | NULL | |
+---------------+---------------+------+-----+---------+----------------+
+----------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------+------+-----+---------+----------------+
| SetCod | int(11) | NO | PRI | NULL | auto_increment |
| ExaCod | int(11) | NO | | NULL | |
| SetInd | int(11) | NO | | NULL | |
| NumQstsToPrint | int(11) | NO | | 0 | |
| Title | varchar(2047) | NO | | NULL | |
+----------------+---------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS exa_sets ("
"SetCod INT NOT NULL AUTO_INCREMENT,"
"ExaCod INT NOT NULL,"
"SetInd INT NOT NULL,"
"NumQstsToExam INT NOT NULL DEFAULT 0,"
"NumQstsToPrint INT NOT NULL DEFAULT 0,"
"Title VARCHAR(2047) NOT NULL," // ExaSet_MAX_BYTES_TITLE
"UNIQUE INDEX(SetCod),"
"UNIQUE INDEX(ExaCod,SetInd))");

View File

@ -121,7 +121,8 @@ static void ExaEvt_ListOneOrMoreEventsIcons (struct Exa_Exams *Exams,
const char *Anchor);
static void ExaEvt_ListOneOrMoreEventsAuthor (const struct ExaEvt_Event *Event);
static void ExaEvt_ListOneOrMoreEventsTimes (const struct ExaEvt_Event *Event,unsigned UniqueId);
static void ExaEvt_ListOneOrMoreEventsTitleGrps (const struct ExaEvt_Event *Event,
static void ExaEvt_ListOneOrMoreEventsTitleGrps (struct Exa_Exams *Exams,
const struct ExaEvt_Event *Event,
const char *Anchor);
static void ExaEvt_GetAndWriteNamesOfGrpsAssociatedToEvent (const struct ExaEvt_Event *Event);
static void ExaEvt_ListOneOrMoreEventsNumParticipants (const struct ExaEvt_Event *Event);
@ -550,7 +551,7 @@ static void ExaEvt_ListOneOrMoreEvents (struct Exa_Exams *Exams,
ExaEvt_ListOneOrMoreEventsTimes (&Event,UniqueId);
/* Title and groups */
ExaEvt_ListOneOrMoreEventsTitleGrps (&Event,Anchor);
ExaEvt_ListOneOrMoreEventsTitleGrps (Exams,&Event,Anchor);
/* Number of participants who have answered any question in the exam event */
ExaEvt_ListOneOrMoreEventsNumParticipants (&Event);
@ -734,7 +735,8 @@ static void ExaEvt_ListOneOrMoreEventsTimes (const struct ExaEvt_Event *Event,un
/*************** Put a column for exam event title and grous *****************/
/*****************************************************************************/
static void ExaEvt_ListOneOrMoreEventsTitleGrps (const struct ExaEvt_Event *Event,
static void ExaEvt_ListOneOrMoreEventsTitleGrps (struct Exa_Exams *Exams,
const struct ExaEvt_Event *Event,
const char *Anchor)
{
extern const char *Txt_Play;
@ -744,8 +746,8 @@ static void ExaEvt_ListOneOrMoreEventsTitleGrps (const struct ExaEvt_Event *Even
/***** Event title *****/
HTM_ARTICLE_Begin (Anchor);
Frm_StartForm (Gbl.Usrs.Me.Role.Logged == Rol_STD ? ActJoiExaEvt :
ActResExaEvt);
Frm_StartForm (ActSeeExaPrn);
Exa_PutParams (Exams);
ExaEvt_PutParamEvtCod (Event->EvtCod);
HTM_BUTTON_SUBMIT_Begin (Gbl.Usrs.Me.Role.Logged == Rol_STD ? Txt_Play :
Txt_Resume,

View File

@ -96,7 +96,7 @@ static void ExaSet_UpdateSet (const struct ExaSet_Set *Set);
static void ExaSet_UpdateSetTitleDB (const struct ExaSet_Set *Set,
const char NewTitle[ExaSet_MAX_BYTES_TITLE + 1]);
static void ExaSet_UpdateNumQstsToExamDB (const struct ExaSet_Set *Set,
unsigned NumQstsToExam);
unsigned NumQstsToPrint);
static void ExaSet_PutParamSetCod (long SetCod);
@ -202,7 +202,7 @@ void ExaSet_GetDataOfSetByCod (struct ExaSet_Set *Set)
if (DB_QuerySELECT (&mysql_res,"can not get set data",
"SELECT SetCod," // row[0]
"SetInd," // row[1]
"NumQstsToExam," // row[2]
"NumQstsToPrint," // row[2]
"Title" // row[3]
" FROM exa_sets"
" WHERE SetCod=%ld"
@ -214,7 +214,7 @@ void ExaSet_GetDataOfSetByCod (struct ExaSet_Set *Set)
/*
row[0] SetCod
row[1] SetInd
row[2] NumQstsToExam
row[2] NumQstsToPrint
row[3] Title
*/
/* Get set code (row[0]) */
@ -227,7 +227,7 @@ void ExaSet_GetDataOfSetByCod (struct ExaSet_Set *Set)
Set->SetInd);
/* Get set index (row[2]) */
Set->NumQstsToExam = Str_ConvertStrToUnsigned (row[2]);
Set->NumQstsToPrint = Str_ConvertStrToUnsigned (row[2]);
/* Get the title of the set (row[3]) */
Str_Copy (Set->Title,row[3],
@ -314,7 +314,7 @@ static void ExaSet_PutFormNewSet (struct Exa_Exams *Exams,
/***** Number of questions to appear in the exam *****/
HTM_TD_Begin ("class=\"RM\"");
HTM_INPUT_LONG ("NumQstsToExam",0,UINT_MAX,(long) Set->NumQstsToExam,
HTM_INPUT_LONG ("NumQstsToPrint",0,UINT_MAX,(long) Set->NumQstsToPrint,
HTM_DONT_SUBMIT_ON_CHANGE,false,
"class=\"INPUT_LONG\" required=\"required\"");
HTM_TD_End ();
@ -382,11 +382,11 @@ static void ExaSet_ReceiveSetFieldsFromForm (struct ExaSet_Set *Set)
/***** Get set title *****/
Par_GetParToText ("Title",Set->Title,ExaSet_MAX_BYTES_TITLE);
/***** Get number of questions in set to appear in exam *****/
Set->NumQstsToExam = (unsigned) Par_GetParToUnsignedLong ("NumQstsToExam",
0,
UINT_MAX,
0);
/***** Get number of questions in set to appear in exam print *****/
Set->NumQstsToPrint = (unsigned) Par_GetParToUnsignedLong ("NumQstsToPrint",
0,
UINT_MAX,
0);
}
static bool ExaSet_CheckSetTitleReceivedFromForm (const struct ExaSet_Set *Set,
@ -485,7 +485,7 @@ void ExaSet_ChangeNumQstsToExam (void)
struct Exa_Exams Exams;
struct Exa_Exam Exam;
struct ExaSet_Set Set;
unsigned NumQstsToExam;
unsigned NumQstsToPrint;
/***** Check if I can edit exams *****/
if (!Exa_CheckIfICanEditExams ())
@ -512,20 +512,20 @@ void ExaSet_ChangeNumQstsToExam (void)
ExaSet_GetDataOfSetByCod (&Set);
Exams.SetCod = Set.SetCod;
/***** Get number of questions in set to appear in exam *****/
NumQstsToExam = (unsigned) Par_GetParToUnsignedLong ("NumQstsToExam",
0,
UINT_MAX,
0);
/***** Get number of questions in set to appear in exam print *****/
NumQstsToPrint = (unsigned) Par_GetParToUnsignedLong ("NumQstsToPrint",
0,
UINT_MAX,
0);
/***** Check if title should be changed *****/
if (NumQstsToExam != Set.NumQstsToExam)
if (NumQstsToPrint != Set.NumQstsToPrint)
{
/* Update the table changing old number by new number */
ExaSet_UpdateNumQstsToExamDB (&Set,NumQstsToExam);
ExaSet_UpdateNumQstsToExamDB (&Set,NumQstsToPrint);
/* Update title */
Set.NumQstsToExam = NumQstsToExam;
Set.NumQstsToPrint = NumQstsToPrint;
}
/***** Show current exam and its sets *****/
@ -549,12 +549,12 @@ static void ExaSet_CreateSet (struct ExaSet_Set *Set)
Set->SetCod =
DB_QueryINSERTandReturnCode ("can not create new set of questions",
"INSERT INTO exa_sets"
" (ExaCod,SetInd,NumQstsToExam,Title)"
" (ExaCod,SetInd,NumQstsToPrint,Title)"
" VALUES"
" (%ld,%u,%u,'%s')",
Set->ExaCod,
MaxSetInd + 1,
Set->NumQstsToExam,
Set->NumQstsToPrint,
Set->Title);
/***** Write success message *****/
@ -575,12 +575,12 @@ static void ExaSet_UpdateSet (const struct ExaSet_Set *Set)
"UPDATE exa_sets"
" SET ExaCod=%ld,"
"SetInd=%u,"
"NumQstsToExam=%u,"
"NumQstsToPrint=%u,"
"Title='%s'"
" WHERE SetCod=%ld",
Set->ExaCod,
Set->SetInd,
Set->NumQstsToExam,
Set->NumQstsToPrint,
Set->Title,
Set->SetCod);
@ -605,18 +605,18 @@ static void ExaSet_UpdateSetTitleDB (const struct ExaSet_Set *Set,
}
/*****************************************************************************/
/********* Update number of questions to appear in exam in database **********/
/****** Update number of questions to appear in exam print in database *******/
/*****************************************************************************/
static void ExaSet_UpdateNumQstsToExamDB (const struct ExaSet_Set *Set,
unsigned NumQstsToExam)
unsigned NumQstsToPrint)
{
/***** Update set of questions changing old number by new number *****/
DB_QueryUPDATE ("can not update the number of questions to appear in exam",
"UPDATE exa_sets SET NumQstsToExam=%u"
DB_QueryUPDATE ("can not update the number of questions to appear in exam print",
"UPDATE exa_sets SET NumQstsToPrint=%u"
" WHERE SetCod=%ld"
" AND ExaCod=%ld", // Extra check
NumQstsToExam,
NumQstsToPrint,
Set->SetCod,Set->ExaCod);
}
@ -644,9 +644,9 @@ unsigned ExaSet_GetNumQstsExam (long ExaCod)
MYSQL_ROW row;
unsigned NumQsts = 0;
/***** Get total number of questions to appear in exam *****/
if (!DB_QuerySELECT (&mysql_res,"can not get number of questions in an exam",
"SELECT SUM(NumQstsToExam) FROM exa_sets"
/***** Get total number of questions to appear in exam print *****/
if (!DB_QuerySELECT (&mysql_res,"can not get number of questions in an exam print",
"SELECT SUM(NumQstsToPrint) FROM exa_sets"
" WHERE ExaCod=%ld",
ExaCod))
Lay_ShowErrorAndExit ("Error: wrong question index.");
@ -997,7 +997,7 @@ void ExaSet_ListExamSets (struct Exa_Exams *Exams,
DB_QuerySELECT (&mysql_res,"can not get sets of questions",
"SELECT SetCod," // row[0]
"SetInd," // row[1]
"NumQstsToExam," // row[2]
"NumQstsToPrint," // row[2]
"Title" // row[3]
" FROM exa_sets"
" WHERE ExaCod=%ld"
@ -1121,7 +1121,7 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
/*
row[0] SetCod
row[1] SetInd
row[2] NumQstsToExam
row[2] NumQstsToPrint
row[3] Title
*/
/* Get set code (row[0]) */
@ -1133,8 +1133,8 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
"%u",
Set.SetInd);
/* Get set index (row[2]) */
Set.NumQstsToExam = Str_ConvertStrToUnsigned (row[2]);
/* Get number of questions to exam (row[2]) */
Set.NumQstsToPrint = Str_ConvertStrToUnsigned (row[2]);
/* Get the title of the set (row[3]) */
Str_Copy (Set.Title,row[3],
@ -1215,11 +1215,11 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
HTM_Unsigned (ExaSet_GetNumQstsInSet (Set.SetCod));
HTM_TD_End ();
/***** Number of questions to appear in exam *****/
/***** Number of questions to appear in exam print *****/
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
Frm_StartFormAnchor (ActChgNumQstExaSet,Anchor);
ExaSet_PutParamsOneSet (Exams);
HTM_INPUT_LONG ("NumQstsToExam",0,UINT_MAX,(long) Set.NumQstsToExam,
HTM_INPUT_LONG ("NumQstsToPrint",0,UINT_MAX,(long) Set.NumQstsToPrint,
HTM_SUBMIT_ON_CHANGE,false,
"class=\"INPUT_LONG\" required=\"required\"");
Frm_EndForm ();
@ -1285,7 +1285,7 @@ void ExaSet_ResetSet (struct ExaSet_Set *Set)
Set->SetCod = -1L;
Set->SetInd = 0;
Set->Title[0] = '\0';
Set->NumQstsToExam = 0;
Set->NumQstsToPrint = 0;
}
/*****************************************************************************/

View File

@ -81,6 +81,24 @@ struct Exa_Exams
long QstCod; // Current question code
};
/* Student 1
+----------------+ +-----------+ +--------------+ +--------------+
| Exam 1 |--+--| Event 1 |--+--| Print 1 | | Result 1 |
|+--------------+| | | * Start | | | * Question 2 | | * Question 2 |
|| Set 1 || | | * End | | |--------------|-->|--------------|
|| * Question 1 || | | * Groups | | | * Question 5 | | * Question 5 |
|| * Question 2 || | +-----------+ | | * Question 3 | | * Question 3 |
|+--------------+| | +-----------+ | +--------------+ +--------------+
|+--------------+| +--| Event 2 | | Student 2
|| Set 2 || | * Start | | +--------------+ +--------------+
|| * Question 3 || | * End | +--| Print 2 | | Result 2 |
|| * Question 4 || | * Groups | | * Question 1 | | * Question 1 |
|| * Question 5 || +-----------+ |--------------|-->|--------------|
|| * Question 6 || ... | * Question 6 | | * Question 6 |
|+--------------+| | * Question 5 | | * Question 5 |
+----------------+ +--------------+ +--------------+
... ... */
struct Exa_Exam
{
long ExaCod; // Exam code
@ -104,7 +122,8 @@ struct ExaSet_Set
long ExaCod; // Exam code
long SetCod; // Set code
unsigned SetInd; // Set index (position in the exam)
unsigned NumQstsToExam; // Number of questions in this set taht will appear in the exam
unsigned NumQstsToPrint; // Number of questions in this set
// that will appear in each exam print
char Title[ExaSet_MAX_BYTES_TITLE + 1]; // Title of the set
};

View File

@ -27,6 +27,8 @@
/********************************* Headers ***********************************/
/*****************************************************************************/
#include <mysql/mysql.h> // To access MySQL databases
/*****************************************************************************/
/***************************** Public constants ******************************/
/*****************************************************************************/

View File

@ -11051,9 +11051,9 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Change number of questions in set to appear in exam"
"Change number of questions from set to each exam print"
#elif L==4 // es
"Cambiar n&uacute;mero de preguntas del conjunto que aparecer&aacute;n en el examen"
"Cambiar n&ordm; de preguntas del conjunto en cada examen impreso"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
@ -11169,6 +11169,27 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Potrzebujesz tlumaczenie
#elif L==9 // pt
"" // Precisa de tradução
#endif
,
[ActSeeExaPrn] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"See exam print"
#elif L==4 // es
"Ver impresi&oacute;n de examen"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
"" // Okoteve traducción
#elif L==7 // it
"" // Bisogno di traduzione
#elif L==8 // pl
"" // Potrzebujesz tlumaczenie
#elif L==9 // pt
"" // Precisa de tradução
#endif
,
[ActSeeGam] =