mirror of
https://github.com/acanas/swad-core.git
synced 2024-09-20 00:02:42 +02:00
Version18.122.3
This commit is contained in:
parent
91f6886e86
commit
15cf5ba1e3
|
@ -2565,6 +2565,7 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
display:table;
|
display:table;
|
||||||
margin:5%;
|
margin:5%;
|
||||||
|
width:90%;
|
||||||
}
|
}
|
||||||
.GAM_PLAY_NUM_QST
|
.GAM_PLAY_NUM_QST
|
||||||
{
|
{
|
||||||
|
@ -2575,7 +2576,7 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
color:#808080;
|
color:#808080;
|
||||||
font-size:48pt;
|
font-size:48pt;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
.GAM_PLAY_QST_CONTAINER
|
.GAM_PLAY_QST_CONTAINER
|
||||||
{
|
{
|
||||||
width:80%;
|
width:80%;
|
|
@ -633,8 +633,8 @@ CREATE TABLE IF NOT EXISTS gam_grp (
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS gam_playing (
|
CREATE TABLE IF NOT EXISTS gam_playing (
|
||||||
GamCod INT NOT NULL,
|
GamCod INT NOT NULL,
|
||||||
QstCod INT NOT NULL DEFAULT -1,
|
|
||||||
QstInd INT NOT NULL DEFAULT 0,
|
QstInd INT NOT NULL DEFAULT 0,
|
||||||
|
QstCod INT NOT NULL DEFAULT -1,
|
||||||
ShowingAnswers ENUM('N','Y') NOT NULL DEFAULT 'N',
|
ShowingAnswers ENUM('N','Y') NOT NULL DEFAULT 'N',
|
||||||
GamStart DATETIME NOT NULL,
|
GamStart DATETIME NOT NULL,
|
||||||
QstStart DATETIME NOT NULL,
|
QstStart DATETIME NOT NULL,
|
||||||
|
|
|
@ -610,6 +610,7 @@ Assessment:
|
||||||
456. ActGamTch1stQst Show first question when playing a game (by a teacher)
|
456. ActGamTch1stQst Show first question when playing a game (by a teacher)
|
||||||
457. ActGamTchNxtQst Show next question when playing a game (by a teacher)
|
457. ActGamTchNxtQst Show next question when playing a game (by a teacher)
|
||||||
458. ActGamTchAns Show answers of current question when playing a game (by a teacher)
|
458. ActGamTchAns Show answers of current question when playing a game (by a teacher)
|
||||||
|
NEW. ActGamTchEnd End playing a game (by a teacher)
|
||||||
|
|
||||||
NEW. ActPlyGamStd Play a game (by a student)
|
NEW. ActPlyGamStd Play a game (by a student)
|
||||||
NEW. ActGamStdCurQst Show current question when playing a game (by a student)
|
NEW. ActGamStdCurQst Show current question when playing a game (by a student)
|
||||||
|
@ -2141,9 +2142,10 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
||||||
/* ActSeeGam */{1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL},
|
/* ActSeeGam */{1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL},
|
||||||
|
|
||||||
/* ActStrGamTch */{1670,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_StartGameTch ,NULL},
|
/* ActStrGamTch */{1670,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_StartGameTch ,NULL},
|
||||||
/* ActGamTch1stQst */{1671,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Gam_GameTchNextQuestion ,NULL},
|
/* ActGamTch1stQst */{1671,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Gam_GameTchFirstQuestion ,NULL},
|
||||||
/* ActGamTchNxtQst */{1672,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_GameTchNextQuestion ,NULL},
|
/* ActGamTchNxtQst */{1672,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_GameTchNextQuestion ,NULL},
|
||||||
/* ActGamTchAns */{1673,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_GameTchShowAnswers ,NULL},
|
/* ActGamTchAns */{1673,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_GameTchShowAnswers ,NULL},
|
||||||
|
/* ActGamTchEnd */{1781,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_GameTchEnd ,NULL},
|
||||||
|
|
||||||
/* ActPlyGamStd */{1779,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_PlayGameStd ,NULL},
|
/* ActPlyGamStd */{1779,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_PlayGameStd ,NULL},
|
||||||
/* ActGamStdCurQst */{1780,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Gam_GameStdCurrentQuestion ,NULL},
|
/* ActGamStdCurQst */{1780,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Gam_GameStdCurrentQuestion ,NULL},
|
||||||
|
@ -4978,6 +4980,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
||||||
ActUnlAllPrj, // #1778
|
ActUnlAllPrj, // #1778
|
||||||
ActPlyGamStd, // #1779
|
ActPlyGamStd, // #1779
|
||||||
ActGamStdCurQst, // #1780
|
ActGamStdCurQst, // #1780
|
||||||
|
ActGamTchEnd, // #1781
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -64,9 +64,9 @@ typedef enum
|
||||||
|
|
||||||
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
||||||
|
|
||||||
#define Act_NUM_ACTIONS (1 + 8 + 61 + 38 + 12 + 42 + 36 + 19 + 110 + 165 + 437 + 176 + 169 + 15 + 67)
|
#define Act_NUM_ACTIONS (1 + 8 + 61 + 38 + 12 + 42 + 36 + 19 + 110 + 166 + 437 + 176 + 169 + 15 + 67)
|
||||||
|
|
||||||
#define Act_MAX_ACTION_COD 1780
|
#define Act_MAX_ACTION_COD 1781
|
||||||
|
|
||||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
|
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
|
||||||
|
|
||||||
|
@ -612,54 +612,55 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
||||||
#define ActStrGamTch (ActChgCrsTT1stDay + 117)
|
#define ActStrGamTch (ActChgCrsTT1stDay + 117)
|
||||||
#define ActGamTch1stQst (ActChgCrsTT1stDay + 118)
|
#define ActGamTch1stQst (ActChgCrsTT1stDay + 118)
|
||||||
#define ActGamTchNxtQst (ActChgCrsTT1stDay + 119)
|
#define ActGamTchNxtQst (ActChgCrsTT1stDay + 119)
|
||||||
#define ActGamTchAns (ActChgCrsTT1stDay + 120)
|
#define ActGamTchEnd (ActChgCrsTT1stDay + 120)
|
||||||
#define ActPlyGamStd (ActChgCrsTT1stDay + 121)
|
#define ActGamTchAns (ActChgCrsTT1stDay + 121)
|
||||||
#define ActGamStdCurQst (ActChgCrsTT1stDay + 122)
|
#define ActPlyGamStd (ActChgCrsTT1stDay + 122)
|
||||||
#define ActAnsGam (ActChgCrsTT1stDay + 123)
|
#define ActGamStdCurQst (ActChgCrsTT1stDay + 123)
|
||||||
#define ActFrmNewGam (ActChgCrsTT1stDay + 124)
|
#define ActAnsGam (ActChgCrsTT1stDay + 124)
|
||||||
#define ActEdiOneGam (ActChgCrsTT1stDay + 125)
|
#define ActFrmNewGam (ActChgCrsTT1stDay + 125)
|
||||||
#define ActNewGam (ActChgCrsTT1stDay + 126)
|
#define ActEdiOneGam (ActChgCrsTT1stDay + 126)
|
||||||
#define ActChgGam (ActChgCrsTT1stDay + 127)
|
#define ActNewGam (ActChgCrsTT1stDay + 127)
|
||||||
#define ActReqRemGam (ActChgCrsTT1stDay + 128)
|
#define ActChgGam (ActChgCrsTT1stDay + 128)
|
||||||
#define ActRemGam (ActChgCrsTT1stDay + 129)
|
#define ActReqRemGam (ActChgCrsTT1stDay + 129)
|
||||||
#define ActReqRstGam (ActChgCrsTT1stDay + 130)
|
#define ActRemGam (ActChgCrsTT1stDay + 130)
|
||||||
#define ActRstGam (ActChgCrsTT1stDay + 131)
|
#define ActReqRstGam (ActChgCrsTT1stDay + 131)
|
||||||
#define ActHidGam (ActChgCrsTT1stDay + 132)
|
#define ActRstGam (ActChgCrsTT1stDay + 132)
|
||||||
#define ActShoGam (ActChgCrsTT1stDay + 133)
|
#define ActHidGam (ActChgCrsTT1stDay + 133)
|
||||||
#define ActAddOneGamQst (ActChgCrsTT1stDay + 134)
|
#define ActShoGam (ActChgCrsTT1stDay + 134)
|
||||||
#define ActGamLstTstQst (ActChgCrsTT1stDay + 135)
|
#define ActAddOneGamQst (ActChgCrsTT1stDay + 135)
|
||||||
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 136)
|
#define ActGamLstTstQst (ActChgCrsTT1stDay + 136)
|
||||||
#define ActReqRemGamQst (ActChgCrsTT1stDay + 137)
|
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 137)
|
||||||
#define ActRemGamQst (ActChgCrsTT1stDay + 138)
|
#define ActReqRemGamQst (ActChgCrsTT1stDay + 138)
|
||||||
#define ActUp_GamQst (ActChgCrsTT1stDay + 139)
|
#define ActRemGamQst (ActChgCrsTT1stDay + 139)
|
||||||
#define ActDwnGamQst (ActChgCrsTT1stDay + 140)
|
#define ActUp_GamQst (ActChgCrsTT1stDay + 140)
|
||||||
|
#define ActDwnGamQst (ActChgCrsTT1stDay + 141)
|
||||||
|
|
||||||
#define ActSeeSvy (ActChgCrsTT1stDay + 141)
|
#define ActSeeSvy (ActChgCrsTT1stDay + 142)
|
||||||
#define ActAnsSvy (ActChgCrsTT1stDay + 142)
|
#define ActAnsSvy (ActChgCrsTT1stDay + 143)
|
||||||
#define ActFrmNewSvy (ActChgCrsTT1stDay + 143)
|
#define ActFrmNewSvy (ActChgCrsTT1stDay + 144)
|
||||||
#define ActEdiOneSvy (ActChgCrsTT1stDay + 144)
|
#define ActEdiOneSvy (ActChgCrsTT1stDay + 145)
|
||||||
#define ActNewSvy (ActChgCrsTT1stDay + 145)
|
#define ActNewSvy (ActChgCrsTT1stDay + 146)
|
||||||
#define ActChgSvy (ActChgCrsTT1stDay + 146)
|
#define ActChgSvy (ActChgCrsTT1stDay + 147)
|
||||||
#define ActReqRemSvy (ActChgCrsTT1stDay + 147)
|
#define ActReqRemSvy (ActChgCrsTT1stDay + 148)
|
||||||
#define ActRemSvy (ActChgCrsTT1stDay + 148)
|
#define ActRemSvy (ActChgCrsTT1stDay + 149)
|
||||||
#define ActReqRstSvy (ActChgCrsTT1stDay + 149)
|
#define ActReqRstSvy (ActChgCrsTT1stDay + 150)
|
||||||
#define ActRstSvy (ActChgCrsTT1stDay + 150)
|
#define ActRstSvy (ActChgCrsTT1stDay + 151)
|
||||||
#define ActHidSvy (ActChgCrsTT1stDay + 151)
|
#define ActHidSvy (ActChgCrsTT1stDay + 152)
|
||||||
#define ActShoSvy (ActChgCrsTT1stDay + 152)
|
#define ActShoSvy (ActChgCrsTT1stDay + 153)
|
||||||
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 153)
|
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 154)
|
||||||
#define ActRcvSvyQst (ActChgCrsTT1stDay + 154)
|
#define ActRcvSvyQst (ActChgCrsTT1stDay + 155)
|
||||||
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 155)
|
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 156)
|
||||||
#define ActRemSvyQst (ActChgCrsTT1stDay + 156)
|
#define ActRemSvyQst (ActChgCrsTT1stDay + 157)
|
||||||
|
|
||||||
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 157)
|
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 158)
|
||||||
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 158)
|
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 159)
|
||||||
#define ActEdiExaAnn (ActChgCrsTT1stDay + 159)
|
#define ActEdiExaAnn (ActChgCrsTT1stDay + 160)
|
||||||
#define ActRcvExaAnn (ActChgCrsTT1stDay + 160)
|
#define ActRcvExaAnn (ActChgCrsTT1stDay + 161)
|
||||||
#define ActPrnExaAnn (ActChgCrsTT1stDay + 161)
|
#define ActPrnExaAnn (ActChgCrsTT1stDay + 162)
|
||||||
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 162)
|
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 163)
|
||||||
#define ActRemExaAnn (ActChgCrsTT1stDay + 163)
|
#define ActRemExaAnn (ActChgCrsTT1stDay + 164)
|
||||||
#define ActHidExaAnn (ActChgCrsTT1stDay + 164)
|
#define ActHidExaAnn (ActChgCrsTT1stDay + 165)
|
||||||
#define ActShoExaAnn (ActChgCrsTT1stDay + 165)
|
#define ActShoExaAnn (ActChgCrsTT1stDay + 166)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************** Files tab **********************************/
|
/******************************** Files tab **********************************/
|
||||||
|
|
|
@ -149,3 +149,14 @@ void Btn_PutRemoveButtonInline (const char *TxtButton)
|
||||||
"</button>",
|
"</button>",
|
||||||
TxtButton);
|
TxtButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Btn_PutCloseButton (const char *TxtButton)
|
||||||
|
{
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
|
||||||
|
"<button type=\"submit\" class=\"BT_SUBMIT BT_CONFIRM\""
|
||||||
|
" onclick=\"window.close();\">"
|
||||||
|
"%s"
|
||||||
|
"</button>"
|
||||||
|
"</div>",
|
||||||
|
TxtButton);
|
||||||
|
}
|
||||||
|
|
|
@ -55,5 +55,6 @@ void Btn_PutConfirmButton (const char *TxtButton);
|
||||||
void Btn_PutConfirmButtonInline (const char *TxtButton);
|
void Btn_PutConfirmButtonInline (const char *TxtButton);
|
||||||
void Btn_PutRemoveButton (const char *TxtButton);
|
void Btn_PutRemoveButton (const char *TxtButton);
|
||||||
void Btn_PutRemoveButtonInline (const char *TxtButton);
|
void Btn_PutRemoveButtonInline (const char *TxtButton);
|
||||||
|
void Btn_PutCloseButton (const char *TxtButton);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -448,14 +448,20 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.122.2 (2019-05-18)"
|
#define Log_PLATFORM_VERSION "SWAD 18.122.3 (2019-05-20)"
|
||||||
#define CSS_FILE "swad18.112.1.css"
|
#define CSS_FILE "swad18.122.3.css"
|
||||||
#define JS_FILE "swad18.116.5.js"
|
#define JS_FILE "swad18.116.5.js"
|
||||||
/*
|
/*
|
||||||
|
Version 18.122.3: May 20, 2019 Changes in games. (242558 lines)
|
||||||
|
Copy the following icon to icon public directory:
|
||||||
|
sudo cp icon/flag-checkered.svg /var/www/html/swad/icon/
|
||||||
|
1 change necessary in database:
|
||||||
|
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1781','es','N','Finalizar juego');
|
||||||
|
|
||||||
Version 18.122.2: May 20, 2019 New action to show current question (in a game beeing played) to a student. (242378 lines)
|
Version 18.122.2: May 20, 2019 New action to show current question (in a game beeing played) to a student. (242378 lines)
|
||||||
2 changes necessary in database:
|
2 changes necessary in database:
|
||||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1780','es','N','Mostrar juego a estudiante');
|
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1780','es','N','Mostrar juego a estudiante');
|
||||||
CREATE TABLE IF NOT EXISTS gam_playing (GamCod INT NOT NULL,QstCod INT NOT NULL DEFAULT -1,QstInd INT NOT NULL DEFAULT 0,ShowingAnswers ENUM('N','Y') NOT NULL DEFAULT 'N',GamStart DATETIME NOT NULL,QstStart DATETIME NOT NULL,UNIQUE INDEX(GamCod));
|
CREATE TABLE IF NOT EXISTS gam_playing (GamCod INT NOT NULL,QstInd INT NOT NULL DEFAULT 0,QstCod INT NOT NULL DEFAULT -1,ShowingAnswers ENUM('N','Y') NOT NULL DEFAULT 'N',GamStart DATETIME NOT NULL,QstStart DATETIME NOT NULL,UNIQUE INDEX(GamCod));
|
||||||
|
|
||||||
Version 18.122.1: May 20, 2019 New action to play game by a student. (242257 lines)
|
Version 18.122.1: May 20, 2019 New action to play game by a student. (242257 lines)
|
||||||
2 changes necessary in database:
|
2 changes necessary in database:
|
||||||
|
|
|
@ -1377,8 +1377,8 @@ mysql> DESCRIBE gam_playing;
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+----------------+---------------+------+-----+---------+-------+
|
+----------------+---------------+------+-----+---------+-------+
|
||||||
| GamCod | int(11) | NO | PRI | NULL | |
|
| GamCod | int(11) | NO | PRI | NULL | |
|
||||||
| QstCod | int(11) | NO | | -1 | |
|
|
||||||
| QstInd | int(11) | NO | | 0 | |
|
| QstInd | int(11) | NO | | 0 | |
|
||||||
|
| QstCod | int(11) | NO | | -1 | |
|
||||||
| ShowingAnswers | enum('N','Y') | NO | | N | |
|
| ShowingAnswers | enum('N','Y') | NO | | N | |
|
||||||
| GamStart | datetime | NO | | NULL | |
|
| GamStart | datetime | NO | | NULL | |
|
||||||
| QstStart | datetime | NO | | NULL | |
|
| QstStart | datetime | NO | | NULL | |
|
||||||
|
@ -1387,8 +1387,8 @@ mysql> DESCRIBE gam_playing;
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS gam_playing ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS gam_playing ("
|
||||||
"GamCod INT NOT NULL,"
|
"GamCod INT NOT NULL,"
|
||||||
"QstCod INT NOT NULL DEFAULT -1,"
|
|
||||||
"QstInd INT NOT NULL DEFAULT 0,"
|
"QstInd INT NOT NULL DEFAULT 0,"
|
||||||
|
"QstCod INT NOT NULL DEFAULT -1,"
|
||||||
"ShowingAnswers ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"ShowingAnswers ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"GamStart DATETIME NOT NULL,"
|
"GamStart DATETIME NOT NULL,"
|
||||||
"QstStart DATETIME NOT NULL,"
|
"QstStart DATETIME NOT NULL,"
|
||||||
|
|
217
swad_game.c
217
swad_game.c
|
@ -156,9 +156,16 @@ static void Gam_ExchangeQuestions (long GamCod,
|
||||||
static void Gam_PutBigButtonToStartGameTch (long GamCod);
|
static void Gam_PutBigButtonToStartGameTch (long GamCod);
|
||||||
static void Gam_PutBigButtonToPlayGameStd (long GamCod);
|
static void Gam_PutBigButtonToPlayGameStd (long GamCod);
|
||||||
|
|
||||||
static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers);
|
static bool Gam_CheckIfGameIsBeeingPlayed (long GamCod);
|
||||||
|
static void Gam_UpdateGameQstBeeingPlayed (long GamCod,unsigned QstInd,long QstCod,bool ShowingAnswers);
|
||||||
|
static void Gam_RemoveGameBeeingPlayed (long GamCod);
|
||||||
|
|
||||||
|
static void Gam_PlayGameShowQuestionAndAnswers (long GamCod,
|
||||||
|
unsigned QstInd,
|
||||||
|
bool ShowAnswers);
|
||||||
static void Gam_PutBigButtonToContinue (Act_Action_t NextAction,
|
static void Gam_PutBigButtonToContinue (Act_Action_t NextAction,
|
||||||
long GamCod,unsigned QstInd);
|
long GamCod,unsigned QstInd);
|
||||||
|
static void Gam_PutBigButtonToEnd (long GamCod);
|
||||||
|
|
||||||
static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod);
|
static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod);
|
||||||
static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd);
|
static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd);
|
||||||
|
@ -2628,8 +2635,6 @@ static void Gam_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs)
|
||||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||||
|
|
||||||
/***** Draw bar with a with proportional to the number of clicks *****/
|
/***** Draw bar with a with proportional to the number of clicks *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_TOP\" style=\"width:%upx;\">",
|
|
||||||
Gam_MAX_BAR_WIDTH + 125);
|
|
||||||
if (NumUsrs && MaxUsrs)
|
if (NumUsrs && MaxUsrs)
|
||||||
BarWidth = (unsigned) ((((float) NumUsrs * (float) Gam_MAX_BAR_WIDTH) /
|
BarWidth = (unsigned) ((((float) NumUsrs * (float) Gam_MAX_BAR_WIDTH) /
|
||||||
(float) MaxUsrs) + 0.5);
|
(float) MaxUsrs) + 0.5);
|
||||||
|
@ -2646,7 +2651,7 @@ static void Gam_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs)
|
||||||
BarWidth);
|
BarWidth);
|
||||||
|
|
||||||
/***** Write the number of users *****/
|
/***** Write the number of users *****/
|
||||||
fprintf (Gbl.F.Out,"%s</td>",Gbl.Title);
|
fprintf (Gbl.F.Out,"%s",Gbl.Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3012,12 +3017,103 @@ static void Gam_PutBigButtonToPlayGameStd (long GamCod)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************** Show next question when playing a game *********************/
|
/********* Show first question when playing a game (by a teacher) ************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Gam_GameTchFirstQuestion (void)
|
||||||
|
{
|
||||||
|
long GamCod;
|
||||||
|
|
||||||
|
/***** Get parameters *****/
|
||||||
|
/* Get game code */
|
||||||
|
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
|
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||||
|
|
||||||
|
/***** Check that the game is not being played *****/
|
||||||
|
if (Gam_CheckIfGameIsBeeingPlayed (GamCod))
|
||||||
|
Ale_ShowAlert (Ale_WARNING,"Este juego ya está jugándose."); // TODO: Need translation!!!!!!
|
||||||
|
else
|
||||||
|
/***** Show questions and possible answers *****/
|
||||||
|
Gam_PlayGameShowQuestionAndAnswers (GamCod,0,
|
||||||
|
false); // Don't show answers
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Check if I have answered a game ************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static bool Gam_CheckIfGameIsBeeingPlayed (long GamCod)
|
||||||
|
{
|
||||||
|
/***** Get if game is being played from database *****/
|
||||||
|
return (DB_QueryCOUNT ("can not check if game is being played",
|
||||||
|
"SELECT COUNT(*) FROM gam_playing"
|
||||||
|
" WHERE GamCod=%ld",
|
||||||
|
GamCod) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************** Insert/update game being played **********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Gam_UpdateGameQstBeeingPlayed (long GamCod,unsigned QstInd,long QstCod,bool ShowingAnswers)
|
||||||
|
{
|
||||||
|
if (ShowingAnswers) // Show a question previously shown and its answers
|
||||||
|
DB_QueryUPDATE ("can not update game beeing played",
|
||||||
|
"UPDATE gam_playing"
|
||||||
|
" SET ShowingAnswers='Y'"
|
||||||
|
" WHERE GamCod=%ld AND QstInd=%u AND QstCod=%ld",
|
||||||
|
GamCod,QstInd,QstCod);
|
||||||
|
else // Show a question without answers
|
||||||
|
{
|
||||||
|
if (QstInd == 0) // 1st question beeing shown
|
||||||
|
DB_QueryINSERT ("can not update game beeing played",
|
||||||
|
"INSERT gam_playing"
|
||||||
|
" (GamCod,QstInd,QstCod,ShowingAnswers,GamStart,QstStart)"
|
||||||
|
" VALUES"
|
||||||
|
" (%ld,0,%ld,'N',NOW(),NOW())",
|
||||||
|
GamCod,QstCod);
|
||||||
|
else // 2nd, 3rd... question beeing shown
|
||||||
|
DB_QueryUPDATE ("can not update game beeing played",
|
||||||
|
"UPDATE gam_playing"
|
||||||
|
" SET QstInd=%u,QstCod=%ld,ShowingAnswers='N',QstStart=NOW()"
|
||||||
|
" WHERE GamCod=%ld",
|
||||||
|
QstInd,QstCod,GamCod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Remove game from games being played ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Gam_RemoveGameBeeingPlayed (long GamCod)
|
||||||
|
{
|
||||||
|
/***** Remove game being played from database *****/
|
||||||
|
DB_QueryDELETE ("can not remove game being played",
|
||||||
|
"DELETE FROM gam_playing"
|
||||||
|
" WHERE GamCod=%ld",
|
||||||
|
GamCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********* Show next question when playing a game (by a teacher) *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Gam_GameTchNextQuestion (void)
|
void Gam_GameTchNextQuestion (void)
|
||||||
{
|
{
|
||||||
Gam_PlayGameShowQuestionAndAnswers (false); // Don't show answers
|
long GamCod;
|
||||||
|
unsigned QstInd;
|
||||||
|
|
||||||
|
/***** Get parameters *****/
|
||||||
|
/* Get game code */
|
||||||
|
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
|
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||||
|
|
||||||
|
/* Get question index */
|
||||||
|
QstInd = Gam_GetParamQstInd ();
|
||||||
|
|
||||||
|
/***** Show questions and possible answers *****/
|
||||||
|
Gam_PlayGameShowQuestionAndAnswers (GamCod,QstInd,
|
||||||
|
false); // Don't show answers
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3026,31 +3122,38 @@ void Gam_GameTchNextQuestion (void)
|
||||||
|
|
||||||
void Gam_GameTchShowAnswers (void)
|
void Gam_GameTchShowAnswers (void)
|
||||||
{
|
{
|
||||||
Gam_PlayGameShowQuestionAndAnswers (true); // Show answers
|
long GamCod;
|
||||||
|
unsigned QstInd;
|
||||||
|
|
||||||
|
/***** Get parameters *****/
|
||||||
|
/* Get game code */
|
||||||
|
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
|
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||||
|
|
||||||
|
/* Get question index */
|
||||||
|
QstInd = Gam_GetParamQstInd ();
|
||||||
|
|
||||||
|
/***** Show questions and possible answers *****/
|
||||||
|
Gam_PlayGameShowQuestionAndAnswers (GamCod,QstInd,
|
||||||
|
true); // Show answers
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************ Show question and its answers when playing a game **************/
|
/************ Show question and its answers when playing a game **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers)
|
static void Gam_PlayGameShowQuestionAndAnswers (long GamCod,
|
||||||
|
unsigned QstInd,
|
||||||
|
bool ShowAnswers)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
struct Game Game;
|
|
||||||
unsigned QstInd;
|
|
||||||
int NxtQstInd;
|
int NxtQstInd;
|
||||||
long QstCod;
|
long QstCod;
|
||||||
|
struct Game Game;
|
||||||
/***** Get parameters *****/
|
|
||||||
/* Get game code */
|
|
||||||
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
|
||||||
|
|
||||||
/* Get question index */
|
|
||||||
QstInd = Gam_GetParamQstInd ();
|
|
||||||
|
|
||||||
/***** Get data of question from database *****/
|
/***** Get data of question from database *****/
|
||||||
|
Game.GamCod = GamCod;
|
||||||
if (!DB_QuerySELECT (&mysql_res,"can not get data of a question",
|
if (!DB_QuerySELECT (&mysql_res,"can not get data of a question",
|
||||||
"SELECT tst_questions.QstCod," // row[0]
|
"SELECT tst_questions.QstCod," // row[0]
|
||||||
"tst_questions.AnsType," // row[1]
|
"tst_questions.AnsType," // row[1]
|
||||||
|
@ -3074,6 +3177,10 @@ static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers)
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_QST_CONTAINER\">");
|
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_QST_CONTAINER\">");
|
||||||
|
|
||||||
|
/* Get question code (row[0]) */
|
||||||
|
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
|
Lay_ShowErrorAndExit ("Error: wrong question code.");
|
||||||
|
|
||||||
/* Write stem (row[2]) */
|
/* Write stem (row[2]) */
|
||||||
Tst_WriteQstStem (row[2],"GAM_PLAY_QST");
|
Tst_WriteQstStem (row[2],"GAM_PLAY_QST");
|
||||||
|
|
||||||
|
@ -3089,10 +3196,6 @@ static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers)
|
||||||
/* Write answers? */
|
/* Write answers? */
|
||||||
if (ShowAnswers)
|
if (ShowAnswers)
|
||||||
{
|
{
|
||||||
/* Get question code (row[0]) */
|
|
||||||
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
|
||||||
Lay_ShowErrorAndExit ("Error: wrong question code.");
|
|
||||||
|
|
||||||
/* Get answer type (row[1]) */
|
/* Get answer type (row[1]) */
|
||||||
Gbl.Test.AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
Gbl.Test.AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
||||||
|
|
||||||
|
@ -3111,9 +3214,12 @@ static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers)
|
||||||
{
|
{
|
||||||
/* Get index of the next question */
|
/* Get index of the next question */
|
||||||
NxtQstInd = Gam_GetNextQuestionIndexInGame (Game.GamCod,QstInd);
|
NxtQstInd = Gam_GetNextQuestionIndexInGame (Game.GamCod,QstInd);
|
||||||
if (NxtQstInd > 0)
|
if (NxtQstInd >= 0) // Not last question
|
||||||
/* Put button to show next question */
|
/* Put button to show next question */
|
||||||
Gam_PutBigButtonToContinue (ActGamTchNxtQst,Game.GamCod,(unsigned) NxtQstInd);
|
Gam_PutBigButtonToContinue (ActGamTchNxtQst,Game.GamCod,(unsigned) NxtQstInd);
|
||||||
|
else // Last question
|
||||||
|
/* Put button to end */
|
||||||
|
Gam_PutBigButtonToEnd (Game.GamCod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* Put button to show answers */
|
/* Put button to show answers */
|
||||||
|
@ -3122,6 +3228,9 @@ static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers)
|
||||||
|
|
||||||
/***** End container for question *****/
|
/***** End container for question *****/
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
|
/***** Insert/update game in table of games currently being played *****/
|
||||||
|
Gam_UpdateGameQstBeeingPlayed (GamCod,QstInd,QstCod,ShowAnswers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3147,8 +3256,9 @@ static void Gam_PutBigButtonToContinue (Act_Action_t NextAction,
|
||||||
" alt=\"%s\" title=\"%s\" class=\"ICO64x64\" />"
|
" alt=\"%s\" title=\"%s\" class=\"ICO64x64\" />"
|
||||||
"<br />"
|
"<br />"
|
||||||
"%s",
|
"%s",
|
||||||
Cfg_URL_ICON_PUBLIC,Txt_Continue,Txt_Continue,
|
Cfg_URL_ICON_PUBLIC,
|
||||||
Txt_Continue);
|
Txt_Continue,Txt_Continue,
|
||||||
|
Txt_Continue);
|
||||||
fprintf (Gbl.F.Out,"</a>");
|
fprintf (Gbl.F.Out,"</a>");
|
||||||
|
|
||||||
/***** End form *****/
|
/***** End form *****/
|
||||||
|
@ -3158,6 +3268,63 @@ static void Gam_PutBigButtonToContinue (Act_Action_t NextAction,
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************* Put a big button to end ***************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Gam_PutBigButtonToEnd (long GamCod)
|
||||||
|
{
|
||||||
|
extern const char *Txt_Finish;
|
||||||
|
|
||||||
|
/***** Start container *****/
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_CONTINUE_CONTAINER\">");
|
||||||
|
|
||||||
|
/***** Start form *****/
|
||||||
|
Frm_StartForm (ActGamTchEnd);
|
||||||
|
Gam_PutParamGameCod (GamCod);
|
||||||
|
|
||||||
|
/***** Put icon with link *****/
|
||||||
|
Frm_LinkFormSubmit (Txt_Finish,"GAM_PLAY_CONTINUE ICO_HIGHLIGHT",NULL);
|
||||||
|
fprintf (Gbl.F.Out,"<img src=\"%s/flag-checkered.svg\""
|
||||||
|
" alt=\"%s\" title=\"%s\" class=\"ICO64x64\" />"
|
||||||
|
"<br />"
|
||||||
|
"%s",
|
||||||
|
Cfg_URL_ICON_PUBLIC,
|
||||||
|
Txt_Finish,Txt_Finish,
|
||||||
|
Txt_Finish);
|
||||||
|
fprintf (Gbl.F.Out,"</a>");
|
||||||
|
|
||||||
|
/***** End form *****/
|
||||||
|
Frm_EndForm ();
|
||||||
|
|
||||||
|
/***** End container *****/
|
||||||
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** End playing a game (by a teacher) **********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Gam_GameTchEnd (void)
|
||||||
|
{
|
||||||
|
long GamCod;
|
||||||
|
|
||||||
|
/***** Get parameters *****/
|
||||||
|
/* Get game code */
|
||||||
|
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
|
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||||
|
|
||||||
|
/***** Remove game being played *****/
|
||||||
|
Gam_RemoveGameBeeingPlayed (GamCod);
|
||||||
|
|
||||||
|
/***** Show alert *****/
|
||||||
|
Ale_ShowAlert (Ale_INFO,"Juego finalizado."); // TODO: Need translation!!!!!
|
||||||
|
|
||||||
|
/***** Button to close *****/
|
||||||
|
Btn_PutCloseButton ("Cerrar"); // TODO: Need translation!!!!!
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***** Show current question to a student when he/she is playing a game ******/
|
/***** Show current question to a student when he/she is playing a game ******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -122,8 +122,10 @@ void Gam_StartGameTch (void);
|
||||||
void Gam_PlayGameStd (void);
|
void Gam_PlayGameStd (void);
|
||||||
|
|
||||||
void Gam_ReceiveGameAnswers (void);
|
void Gam_ReceiveGameAnswers (void);
|
||||||
|
void Gam_GameTchFirstQuestion (void);
|
||||||
void Gam_GameTchNextQuestion (void);
|
void Gam_GameTchNextQuestion (void);
|
||||||
void Gam_GameTchShowAnswers (void);
|
void Gam_GameTchShowAnswers (void);
|
||||||
|
void Gam_GameTchEnd (void);
|
||||||
|
|
||||||
void Gam_GameStdCurrentQuestion (void);
|
void Gam_GameStdCurrentQuestion (void);
|
||||||
|
|
||||||
|
|
|
@ -686,7 +686,6 @@ static void Lay_WriteScriptInit (void)
|
||||||
if ((Gbl.Prefs.SideCols & Lay_SHOW_RIGHT_COLUMN)) // Right column visible
|
if ((Gbl.Prefs.SideCols & Lay_SHOW_RIGHT_COLUMN)) // Right column visible
|
||||||
Con_WriteScriptClockConnected ();
|
Con_WriteScriptClockConnected ();
|
||||||
|
|
||||||
// Put the focus on login form
|
|
||||||
fprintf (Gbl.F.Out," ActionAJAX = \"%s\";\n"
|
fprintf (Gbl.F.Out," ActionAJAX = \"%s\";\n"
|
||||||
" setTimeout(\"refreshConnected()\",%lu);\n",
|
" setTimeout(\"refreshConnected()\",%lu);\n",
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
|
|
13
swad_test.c
13
swad_test.c
|
@ -4122,16 +4122,17 @@ static void Tst_WriteChoiceAnsViewGame (struct Game *Game,
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
/***** Show result (number of users who answered? *****/
|
/***** Show result (number of users who answered? *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
|
||||||
"<td class=\"LEFT_TOP\">");
|
|
||||||
if (ShowResult)
|
if (ShowResult)
|
||||||
|
{
|
||||||
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
"<td></td>"
|
||||||
|
"<td class=\"DAT LEFT_TOP\">");
|
||||||
/* Get number of users who selected this answer
|
/* Get number of users who selected this answer
|
||||||
and draw proportional bar */
|
and draw proportional bar */
|
||||||
Gam_GetAndDrawBarNumUsrsWhoAnswered (Game,QstCod,AnsInd);
|
Gam_GetAndDrawBarNumUsrsWhoAnswered (Game,QstCod,AnsInd);
|
||||||
else
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
fprintf (Gbl.F.Out," ");
|
"</tr>");
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
}
|
||||||
"</tr>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
|
|
21
swad_text.c
21
swad_text.c
|
@ -12205,6 +12205,27 @@ const char *Txt_Filter = // As a noun
|
||||||
"Filtro";
|
"Filtro";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char *Txt_Finish =
|
||||||
|
#if L==1 // ca
|
||||||
|
"Acabar";
|
||||||
|
#elif L==2 // de
|
||||||
|
"Fertig";
|
||||||
|
#elif L==3 // en
|
||||||
|
"Finish";
|
||||||
|
#elif L==4 // es
|
||||||
|
"Terminar";
|
||||||
|
#elif L==5 // fr
|
||||||
|
"Terminer";
|
||||||
|
#elif L==6 // gn
|
||||||
|
"Momba";
|
||||||
|
#elif L==7 // it
|
||||||
|
"Finire";
|
||||||
|
#elif L==8 // pl
|
||||||
|
"Koniec";
|
||||||
|
#elif L==9 // pt
|
||||||
|
"Terminar";
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *Txt_First_day_of_the_week =
|
const char *Txt_First_day_of_the_week =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Primer dia de la setmana";
|
"Primer dia de la setmana";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user