mirror of https://github.com/acanas/swad-core.git
Version19.0
This commit is contained in:
parent
4e9c759f28
commit
bea194144a
|
@ -639,8 +639,7 @@ CREATE TABLE IF NOT EXISTS gam_matches (
|
||||||
QstInd INT NOT NULL DEFAULT 0,
|
QstInd INT NOT NULL DEFAULT 0,
|
||||||
QstCod INT NOT NULL DEFAULT -1,
|
QstCod INT NOT NULL DEFAULT -1,
|
||||||
QstStartTime DATETIME NOT NULL,
|
QstStartTime DATETIME NOT NULL,
|
||||||
ShowResults ENUM('N','Y') NOT NULL DEFAULT 'N',
|
Showing ENUM('wording','answers','request','results') NOT NULL DEFAULT 'wording',
|
||||||
Showing ENUM('stem','answers','results') NOT NULL DEFAULT 'stem',
|
|
||||||
UNIQUE INDEX(MchCod),
|
UNIQUE INDEX(MchCod),
|
||||||
INDEX(GamCod));
|
INDEX(GamCod));
|
||||||
--
|
--
|
||||||
|
|
|
@ -613,12 +613,11 @@ Assessment:
|
||||||
NEW. ActResMchTch Resume an unfinished match showing current question in a new browser tab (by a teacher)
|
NEW. ActResMchTch Resume an unfinished match showing current question in a new browser tab (by a teacher)
|
||||||
NEW. ActPauMchTch Pause current match (by a teacher)
|
NEW. ActPauMchTch Pause current match (by a teacher)
|
||||||
NEW. ActPlyMchTch Play/resume current match (by a teacher)
|
NEW. ActPlyMchTch Play/resume current match (by a teacher)
|
||||||
NEW. ActShoSteMchTch Show stem of current question, hiding answers, when playing a match (by a teacher)
|
|
||||||
NEW. ActShoAnsMchTch Show full current question, including answers, when playing a match (by a teacher)
|
NEW. ActBckMchTch Go back when playing a match (by a teacher)
|
||||||
|
457. ActFwdMchTch Go forward when playing a match (by a teacher)
|
||||||
NEW. ActShoResMchTch Show results when playing a match (by a teacher)
|
NEW. ActShoResMchTch Show results when playing a match (by a teacher)
|
||||||
NEW. ActPrvQstMchTch Show previous question when playing a match (by a teacher)
|
|
||||||
457. ActNxtQstMchTch Show next question when playing a match (by a teacher)
|
|
||||||
NEW. ActChgShoResMchTch Change display of results when playing a match (by a teacher)
|
|
||||||
NEW. ActRefMchTch Refresh current question when playing a match (as teacher)
|
NEW. ActRefMchTch Refresh current question when playing a match (as teacher)
|
||||||
NEW. ActShoMchTch Show finished match results
|
NEW. ActShoMchTch Show finished match results
|
||||||
|
|
||||||
|
@ -2160,12 +2159,9 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
||||||
/* ActResMchTch */{1785,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Gam_GetMatchBeingPlayed ,Gam_RequestStartResumeMatchTch ,NULL},
|
/* ActResMchTch */{1785,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Gam_GetMatchBeingPlayed ,Gam_RequestStartResumeMatchTch ,NULL},
|
||||||
/* ActPauMchTch */{1791,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_PauseMatchTch ,NULL},
|
/* ActPauMchTch */{1791,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_PauseMatchTch ,NULL},
|
||||||
/* ActPlyMchTch */{1789,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_ResumeMatchTch ,NULL},
|
/* ActPlyMchTch */{1789,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_ResumeMatchTch ,NULL},
|
||||||
/* ActShoSteMchTch */{1792,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_ShowStemQstMatchTch ,NULL},
|
/* ActBckMchTch */{1790,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_BackMatchTch ,NULL},
|
||||||
/* ActShoAnsMchTch */{1793,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_ShowAnssQstMatchTch ,NULL},
|
/* ActFwdMchTch */{1672,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_ForwardMatchTch ,NULL},
|
||||||
/* ActShoResMchTch */{1795,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_ShowRessQstMatchTch ,NULL},
|
/* ActShoResMchTch */{1795,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_ShowResultsQstMatchTch ,NULL},
|
||||||
/* ActPrvQstMchTch */{1790,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_PrevQstMatchTch ,NULL},
|
|
||||||
/* ActNxtQstMchTch */{1672,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_NextQstMatchTch ,NULL},
|
|
||||||
/* ActChgShoResMchTch*/{1794,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_CurrQstMatchTch ,NULL},
|
|
||||||
/* ActRefMchTch */{1788,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Gam_GetMatchBeingPlayed ,Gam_RefreshMatchTch ,NULL},
|
/* ActRefMchTch */{1788,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Gam_GetMatchBeingPlayed ,Gam_RefreshMatchTch ,NULL},
|
||||||
/* ActShoMchTch */{1786,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ShowFinishedMatchResults ,NULL},
|
/* ActShoMchTch */{1786,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ShowFinishedMatchResults ,NULL},
|
||||||
|
|
||||||
|
@ -4895,7 +4891,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
||||||
ActDwnGamQst, // #1669
|
ActDwnGamQst, // #1669
|
||||||
ActReqNewMchTch, // #1670
|
ActReqNewMchTch, // #1670
|
||||||
ActNewMchTch, // #1671
|
ActNewMchTch, // #1671
|
||||||
ActNxtQstMchTch, // #1672
|
ActFwdMchTch, // #1672
|
||||||
-1, // #1673 (obsolete action)
|
-1, // #1673 (obsolete action)
|
||||||
ActSeePrj, // #1674
|
ActSeePrj, // #1674
|
||||||
ActFrmNewPrj, // #1675
|
ActFrmNewPrj, // #1675
|
||||||
|
@ -5013,11 +5009,11 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
||||||
ActCreMyAcc, // #1787
|
ActCreMyAcc, // #1787
|
||||||
ActRefMchTch, // #1788
|
ActRefMchTch, // #1788
|
||||||
ActPlyMchTch, // #1789
|
ActPlyMchTch, // #1789
|
||||||
ActPrvQstMchTch, // #1790
|
ActBckMchTch, // #1790
|
||||||
ActPauMchTch, // #1791
|
ActPauMchTch, // #1791
|
||||||
ActShoSteMchTch, // #1792
|
-1, // #1792 (obsolete action)
|
||||||
ActShoAnsMchTch, // #1793
|
-1, // #1793 (obsolete action)
|
||||||
ActChgShoResMchTch, // #1794
|
-1, // #1794 (obsolete action)
|
||||||
ActShoResMchTch, // #1795
|
ActShoResMchTch, // #1795
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
103
swad_action.h
103
swad_action.h
|
@ -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
|
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
||||||
|
|
||||||
#define Act_NUM_ACTIONS (1 + 4 + 64 + 38 + 12 + 42 + 36 + 19 + 110 + 176 + 437 + 176 + 169 + 16 + 68)
|
#define Act_NUM_ACTIONS (1 + 4 + 64 + 38 + 12 + 42 + 36 + 19 + 110 + 173 + 437 + 176 + 169 + 16 + 68)
|
||||||
|
|
||||||
#define Act_MAX_ACTION_COD 1795
|
#define Act_MAX_ACTION_COD 1795
|
||||||
|
|
||||||
|
@ -614,61 +614,58 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
||||||
#define ActResMchTch (ActChgCrsTT1stDay + 121)
|
#define ActResMchTch (ActChgCrsTT1stDay + 121)
|
||||||
#define ActPauMchTch (ActChgCrsTT1stDay + 122)
|
#define ActPauMchTch (ActChgCrsTT1stDay + 122)
|
||||||
#define ActPlyMchTch (ActChgCrsTT1stDay + 123)
|
#define ActPlyMchTch (ActChgCrsTT1stDay + 123)
|
||||||
#define ActShoSteMchTch (ActChgCrsTT1stDay + 124)
|
#define ActBckMchTch (ActChgCrsTT1stDay + 124)
|
||||||
#define ActShoAnsMchTch (ActChgCrsTT1stDay + 125)
|
#define ActFwdMchTch (ActChgCrsTT1stDay + 125)
|
||||||
#define ActShoResMchTch (ActChgCrsTT1stDay + 126)
|
#define ActShoResMchTch (ActChgCrsTT1stDay + 126)
|
||||||
#define ActPrvQstMchTch (ActChgCrsTT1stDay + 127)
|
#define ActRefMchTch (ActChgCrsTT1stDay + 127)
|
||||||
#define ActNxtQstMchTch (ActChgCrsTT1stDay + 128)
|
#define ActShoMchTch (ActChgCrsTT1stDay + 128)
|
||||||
#define ActChgShoResMchTch (ActChgCrsTT1stDay + 129)
|
#define ActPlyMchStd (ActChgCrsTT1stDay + 129)
|
||||||
#define ActRefMchTch (ActChgCrsTT1stDay + 130)
|
#define ActRefMchStd (ActChgCrsTT1stDay + 130)
|
||||||
#define ActShoMchTch (ActChgCrsTT1stDay + 131)
|
#define ActAnsMchQstStd (ActChgCrsTT1stDay + 131)
|
||||||
#define ActPlyMchStd (ActChgCrsTT1stDay + 132)
|
#define ActFrmNewGam (ActChgCrsTT1stDay + 132)
|
||||||
#define ActRefMchStd (ActChgCrsTT1stDay + 133)
|
#define ActEdiOneGam (ActChgCrsTT1stDay + 133)
|
||||||
#define ActAnsMchQstStd (ActChgCrsTT1stDay + 134)
|
#define ActNewGam (ActChgCrsTT1stDay + 134)
|
||||||
#define ActFrmNewGam (ActChgCrsTT1stDay + 135)
|
#define ActChgGam (ActChgCrsTT1stDay + 135)
|
||||||
#define ActEdiOneGam (ActChgCrsTT1stDay + 136)
|
#define ActReqRemGam (ActChgCrsTT1stDay + 136)
|
||||||
#define ActNewGam (ActChgCrsTT1stDay + 137)
|
#define ActRemGam (ActChgCrsTT1stDay + 137)
|
||||||
#define ActChgGam (ActChgCrsTT1stDay + 138)
|
#define ActReqRstGam (ActChgCrsTT1stDay + 138)
|
||||||
#define ActReqRemGam (ActChgCrsTT1stDay + 139)
|
#define ActRstGam (ActChgCrsTT1stDay + 139)
|
||||||
#define ActRemGam (ActChgCrsTT1stDay + 140)
|
#define ActHidGam (ActChgCrsTT1stDay + 140)
|
||||||
#define ActReqRstGam (ActChgCrsTT1stDay + 141)
|
#define ActShoGam (ActChgCrsTT1stDay + 141)
|
||||||
#define ActRstGam (ActChgCrsTT1stDay + 142)
|
#define ActAddOneGamQst (ActChgCrsTT1stDay + 142)
|
||||||
#define ActHidGam (ActChgCrsTT1stDay + 143)
|
#define ActGamLstTstQst (ActChgCrsTT1stDay + 143)
|
||||||
#define ActShoGam (ActChgCrsTT1stDay + 144)
|
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 144)
|
||||||
#define ActAddOneGamQst (ActChgCrsTT1stDay + 145)
|
#define ActReqRemGamQst (ActChgCrsTT1stDay + 145)
|
||||||
#define ActGamLstTstQst (ActChgCrsTT1stDay + 146)
|
#define ActRemGamQst (ActChgCrsTT1stDay + 146)
|
||||||
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 147)
|
#define ActUp_GamQst (ActChgCrsTT1stDay + 147)
|
||||||
#define ActReqRemGamQst (ActChgCrsTT1stDay + 148)
|
#define ActDwnGamQst (ActChgCrsTT1stDay + 148)
|
||||||
#define ActRemGamQst (ActChgCrsTT1stDay + 149)
|
|
||||||
#define ActUp_GamQst (ActChgCrsTT1stDay + 150)
|
|
||||||
#define ActDwnGamQst (ActChgCrsTT1stDay + 151)
|
|
||||||
|
|
||||||
#define ActSeeSvy (ActChgCrsTT1stDay + 152)
|
#define ActSeeSvy (ActChgCrsTT1stDay + 149)
|
||||||
#define ActAnsSvy (ActChgCrsTT1stDay + 153)
|
#define ActAnsSvy (ActChgCrsTT1stDay + 150)
|
||||||
#define ActFrmNewSvy (ActChgCrsTT1stDay + 154)
|
#define ActFrmNewSvy (ActChgCrsTT1stDay + 151)
|
||||||
#define ActEdiOneSvy (ActChgCrsTT1stDay + 155)
|
#define ActEdiOneSvy (ActChgCrsTT1stDay + 152)
|
||||||
#define ActNewSvy (ActChgCrsTT1stDay + 156)
|
#define ActNewSvy (ActChgCrsTT1stDay + 153)
|
||||||
#define ActChgSvy (ActChgCrsTT1stDay + 157)
|
#define ActChgSvy (ActChgCrsTT1stDay + 154)
|
||||||
#define ActReqRemSvy (ActChgCrsTT1stDay + 158)
|
#define ActReqRemSvy (ActChgCrsTT1stDay + 155)
|
||||||
#define ActRemSvy (ActChgCrsTT1stDay + 159)
|
#define ActRemSvy (ActChgCrsTT1stDay + 156)
|
||||||
#define ActReqRstSvy (ActChgCrsTT1stDay + 160)
|
#define ActReqRstSvy (ActChgCrsTT1stDay + 157)
|
||||||
#define ActRstSvy (ActChgCrsTT1stDay + 161)
|
#define ActRstSvy (ActChgCrsTT1stDay + 158)
|
||||||
#define ActHidSvy (ActChgCrsTT1stDay + 162)
|
#define ActHidSvy (ActChgCrsTT1stDay + 159)
|
||||||
#define ActShoSvy (ActChgCrsTT1stDay + 163)
|
#define ActShoSvy (ActChgCrsTT1stDay + 160)
|
||||||
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 164)
|
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 161)
|
||||||
#define ActRcvSvyQst (ActChgCrsTT1stDay + 165)
|
#define ActRcvSvyQst (ActChgCrsTT1stDay + 162)
|
||||||
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 166)
|
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 163)
|
||||||
#define ActRemSvyQst (ActChgCrsTT1stDay + 167)
|
#define ActRemSvyQst (ActChgCrsTT1stDay + 164)
|
||||||
|
|
||||||
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 168)
|
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 165)
|
||||||
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 169)
|
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 166)
|
||||||
#define ActEdiExaAnn (ActChgCrsTT1stDay + 170)
|
#define ActEdiExaAnn (ActChgCrsTT1stDay + 167)
|
||||||
#define ActRcvExaAnn (ActChgCrsTT1stDay + 171)
|
#define ActRcvExaAnn (ActChgCrsTT1stDay + 168)
|
||||||
#define ActPrnExaAnn (ActChgCrsTT1stDay + 172)
|
#define ActPrnExaAnn (ActChgCrsTT1stDay + 169)
|
||||||
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 173)
|
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 170)
|
||||||
#define ActRemExaAnn (ActChgCrsTT1stDay + 174)
|
#define ActRemExaAnn (ActChgCrsTT1stDay + 171)
|
||||||
#define ActHidExaAnn (ActChgCrsTT1stDay + 175)
|
#define ActHidExaAnn (ActChgCrsTT1stDay + 172)
|
||||||
#define ActShoExaAnn (ActChgCrsTT1stDay + 176)
|
#define ActShoExaAnn (ActChgCrsTT1stDay + 173)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************** Files tab **********************************/
|
/******************************** Files tab **********************************/
|
||||||
|
|
|
@ -460,10 +460,16 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.144 (2019-09-10)"
|
#define Log_PLATFORM_VERSION "SWAD 19.0 (2019-09-12)"
|
||||||
#define CSS_FILE "swad18.138.css"
|
#define CSS_FILE "swad18.138.css"
|
||||||
#define JS_FILE "swad18.130.2.js"
|
#define JS_FILE "swad18.130.2.js"
|
||||||
/*
|
/*
|
||||||
|
Version 19.0: Sep 12, 2019 Changes in behaviour of matches. (244585 lines)
|
||||||
|
3 changes necessary in database:
|
||||||
|
ALTER TABLE gam_matches DROP COLUMN ShowResults,DROP COLUMN Showing;
|
||||||
|
ALTER TABLE gam_matches ADD COLUMN Showing ENUM('wording','answers','request','results') NOT NULL DEFAULT 'wording' AFTER QstStartTime;
|
||||||
|
UPDATE actions SET Obsolete='Y' WHERE ActCod IN (1792,1793,1794);
|
||||||
|
|
||||||
Version 18.144: Sep 10, 2019 Show question results in match. (244641 lines)
|
Version 18.144: Sep 10, 2019 Show question results in match. (244641 lines)
|
||||||
3 changes necessary in database:
|
3 changes necessary in database:
|
||||||
ALTER TABLE gam_matches DROP COLUMN ShowingAnswers,DROP COLUMN ShowResults;
|
ALTER TABLE gam_matches DROP COLUMN ShowingAnswers,DROP COLUMN ShowResults;
|
||||||
|
|
|
@ -1369,22 +1369,21 @@ mysql> DESCRIBE gam_grp;
|
||||||
/***** Table gam_matches *****/
|
/***** Table gam_matches *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE gam_matches;
|
mysql> DESCRIBE gam_matches;
|
||||||
+--------------+----------------------------------+------+-----+---------+----------------+
|
+--------------+-----------------------------------------------+------+-----+---------+----------------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+--------------+----------------------------------+------+-----+---------+----------------+
|
+--------------+-----------------------------------------------+------+-----+---------+----------------+
|
||||||
| MchCod | int(11) | NO | PRI | NULL | auto_increment |
|
| MchCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||||
| GamCod | int(11) | NO | MUL | NULL | |
|
| GamCod | int(11) | NO | MUL | NULL | |
|
||||||
| UsrCod | int(11) | NO | | NULL | |
|
| UsrCod | int(11) | NO | | NULL | |
|
||||||
| StartTime | datetime | NO | | NULL | |
|
| StartTime | datetime | NO | | NULL | |
|
||||||
| EndTime | datetime | NO | | NULL | |
|
| EndTime | datetime | NO | | NULL | |
|
||||||
| Title | varchar(2047) | NO | | NULL | |
|
| Title | varchar(2047) | NO | | NULL | |
|
||||||
| QstInd | int(11) | NO | | 0 | |
|
| QstInd | int(11) | NO | | 0 | |
|
||||||
| QstCod | int(11) | NO | | -1 | |
|
| QstCod | int(11) | NO | | -1 | |
|
||||||
| QstStartTime | datetime | NO | | NULL | |
|
| QstStartTime | datetime | NO | | NULL | |
|
||||||
| ShowResults | enum('N','Y') | NO | | N | |
|
| Showing | enum('wording','answers','request','results') | NO | | wording | |
|
||||||
| Showing | enum('stem','answers','results') | NO | | stem | |
|
+--------------+-----------------------------------------------+------+-----+---------+----------------+
|
||||||
+--------------+----------------------------------+------+-----+---------+----------------+
|
10 rows in set (0.00 sec)
|
||||||
11 rows in set (0.00 sec)
|
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS gam_matches ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS gam_matches ("
|
||||||
"MchCod INT NOT NULL AUTO_INCREMENT,"
|
"MchCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
|
@ -1396,8 +1395,7 @@ mysql> DESCRIBE gam_matches;
|
||||||
"QstInd INT NOT NULL DEFAULT 0,"
|
"QstInd INT NOT NULL DEFAULT 0,"
|
||||||
"QstCod INT NOT NULL DEFAULT -1,"
|
"QstCod INT NOT NULL DEFAULT -1,"
|
||||||
"QstStartTime DATETIME NOT NULL,"
|
"QstStartTime DATETIME NOT NULL,"
|
||||||
"ShowResults ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Showing ENUM('wording','answers','request','results') NOT NULL DEFAULT 'wording',"
|
||||||
"Showing ENUM('stem','answers','results') NOT NULL DEFAULT 'stem',"
|
|
||||||
"UNIQUE INDEX(MchCod),"
|
"UNIQUE INDEX(MchCod),"
|
||||||
"INDEX(GamCod)");
|
"INDEX(GamCod)");
|
||||||
|
|
||||||
|
|
541
swad_game.c
541
swad_game.c
|
@ -75,39 +75,32 @@ const char *Gam_StrAnswerTypesDB[Gam_NUM_ANS_TYPES] =
|
||||||
#define Gam_NEW_MATCH_SECTION_ID "new_match"
|
#define Gam_NEW_MATCH_SECTION_ID "new_match"
|
||||||
|
|
||||||
#define Gam_AFTER_LAST_QUESTION ((unsigned)((1UL << 31) - 1)) // 2^31 - 1, don't change this number because it is used in database to indicate that a match is finished
|
#define Gam_AFTER_LAST_QUESTION ((unsigned)((1UL << 31) - 1)) // 2^31 - 1, don't change this number because it is used in database to indicate that a match is finished
|
||||||
/*
|
|
||||||
#define Gam_ICON_CLOSE "❎" // Alternatives: "✕" "❌" "×"
|
|
||||||
#define Gam_ICON_PLAY "🏁" // Alternatives: "‣" "⏩" "▶" "▸" "⇥" "▸"
|
|
||||||
#define Gam_ICON_STEM "⏪" // Alternatives: "⇤"
|
|
||||||
#define Gam_ICON_START "⏪" // Alternatives: "⇤"
|
|
||||||
#define Gam_ICON_PREVIOUS "⏪" // Alternatives: "⇤"
|
|
||||||
#define Gam_ICON_FINISH "⏩" // Alternatives: "🏁" "⇥"
|
|
||||||
#define Gam_ICON_NEXT "⏩" // Alternatives: "⇥"
|
|
||||||
#define Gam_ICON_ANSWERS "⏩" // Alternatives: "⇥"
|
|
||||||
*/
|
|
||||||
#define Gam_ICON_CLOSE "fas fa-times"
|
#define Gam_ICON_CLOSE "fas fa-times"
|
||||||
#define Gam_ICON_PLAY "fas fa-play"
|
#define Gam_ICON_PLAY "fas fa-play"
|
||||||
#define Gam_ICON_PAUSE "fas fa-pause"
|
#define Gam_ICON_PAUSE "fas fa-pause"
|
||||||
#define Gam_ICON_PREVIOUS "fas fa-step-backward"
|
#define Gam_ICON_PREVIOUS "fas fa-step-backward"
|
||||||
#define Gam_ICON_NEXT "fas fa-step-forward"
|
#define Gam_ICON_NEXT "fas fa-step-forward"
|
||||||
|
#define Gam_ICON_RESULTS "fas fa-chart-bar"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************* Private types *******************************/
|
/******************************* Private types *******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Gam_NUM_SHOWING 3
|
#define Gam_NUM_SHOWING 4
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Gam_SHOWING_WORDING, // Showing only the question wording
|
Gam_WORDING, // Showing only the question wording
|
||||||
Gam_SHOWING_ANSWERS, // Showing the question wording and the answers
|
Gam_ANSWERS, // Showing the question wording and the answers
|
||||||
Gam_REQUEST_RESULTS, // Requesting confirmation to show the results
|
Gam_REQUEST, // Requesting confirmation to show the results
|
||||||
Gam_SHOWING_RESULTS, // Showing the results
|
Gam_RESULTS, // Showing the results
|
||||||
} Gam_Showing_t;
|
} Gam_Showing_t;
|
||||||
#define Gam_SHOWING_DEFAULT Gam_SHOWING_WORDING
|
#define Gam_SHOWING_DEFAULT Gam_WORDING
|
||||||
const char *Gam_ShowingStringsDB[Gam_NUM_SHOWING] =
|
const char *Gam_ShowingStringsDB[Gam_NUM_SHOWING] =
|
||||||
{
|
{
|
||||||
"stem",
|
"wording",
|
||||||
"answers",
|
"answers",
|
||||||
|
"request",
|
||||||
"results",
|
"results",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,10 +113,9 @@ struct Match
|
||||||
char Title[Gam_MAX_BYTES_TITLE + 1];
|
char Title[Gam_MAX_BYTES_TITLE + 1];
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned QstInd; // 0 means that the game has not started. First question has index 0.
|
unsigned QstInd; // 0 means that the game has not started. First question has index 1.
|
||||||
long QstCod;
|
long QstCod;
|
||||||
time_t QstStartTimeUTC;
|
time_t QstStartTimeUTC;
|
||||||
bool ShowResults;
|
|
||||||
Gam_Showing_t Showing;
|
Gam_Showing_t Showing;
|
||||||
bool BeingPlayed;
|
bool BeingPlayed;
|
||||||
unsigned NumPlayers;
|
unsigned NumPlayers;
|
||||||
|
@ -229,14 +221,14 @@ static void Gam_GetElapsedTimeInMatch (struct Match *Match,
|
||||||
static void Gam_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res,
|
static void Gam_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res,
|
||||||
struct Time *Time);
|
struct Time *Time);
|
||||||
|
|
||||||
static void Gam_SetMatchStatusToPrevQuestion (struct Match *Match);
|
static void Gam_SetMatchStatusToPrev (struct Match *Match);
|
||||||
static void Gam_SetMatchStatusToNextQuestion (struct Match *Match);
|
static void Gam_SetMatchStatusToNext (struct Match *Match);
|
||||||
static void Gam_ShowMatchStatusForTch (struct Match *Match);
|
static void Gam_ShowMatchStatusForTch (struct Match *Match);
|
||||||
static void Gam_ShowMatchStatusForStd (struct Match *Match);
|
static void Gam_ShowMatchStatusForStd (struct Match *Match);
|
||||||
static void Gam_ShowLeftColumnTch (struct Match *Match);
|
static void Gam_ShowLeftColumnTch (struct Match *Match);
|
||||||
static void Gam_ShowLeftColumnStd (struct Match *Match);
|
static void Gam_ShowLeftColumnStd (struct Match *Match);
|
||||||
static void Gam_PutMatchControlButtons (struct Match *Match);
|
static void Gam_PutMatchControlButtons (struct Match *Match);
|
||||||
static void Gam_PutCheckboxResult (struct Match *Match);
|
// static void Gam_PutCheckboxResult (struct Match *Match);
|
||||||
static void Gam_ShowNumQstInGame (struct Match *Match);
|
static void Gam_ShowNumQstInGame (struct Match *Match);
|
||||||
static void Gam_ShowNumPlayers (struct Match *Match);
|
static void Gam_ShowNumPlayers (struct Match *Match);
|
||||||
static void Gam_ShowMatchTitle (struct Match *Match);
|
static void Gam_ShowMatchTitle (struct Match *Match);
|
||||||
|
@ -2722,17 +2714,16 @@ static void Gam_ListMatches (struct Game *Game,bool PutFormNewMatch)
|
||||||
|
|
||||||
/* Make query */
|
/* Make query */
|
||||||
NumMatches = (unsigned) DB_QuerySELECT (&mysql_res,"can not get matches",
|
NumMatches = (unsigned) DB_QuerySELECT (&mysql_res,"can not get matches",
|
||||||
"SELECT MchCod," // row[ 0]
|
"SELECT MchCod," // row[0]
|
||||||
"GamCod," // row[ 1]
|
"GamCod," // row[1]
|
||||||
"UsrCod," // row[ 2]
|
"UsrCod," // row[2]
|
||||||
"UNIX_TIMESTAMP(StartTime)," // row[ 3]
|
"UNIX_TIMESTAMP(StartTime)," // row[3]
|
||||||
"UNIX_TIMESTAMP(EndTime)," // row[ 4]
|
"UNIX_TIMESTAMP(EndTime)," // row[4]
|
||||||
"Title," // row[ 5]
|
"Title," // row[5]
|
||||||
"ShowResults," // row[ 6]
|
"QstInd," // row[6]
|
||||||
"QstInd," // row[ 7]
|
"QstCod," // row[7]
|
||||||
"QstCod," // row[ 8]
|
"UNIX_TIMESTAMP(QstStartTime)," // row[8]
|
||||||
"UNIX_TIMESTAMP(QstStartTime)," // row[ 9]
|
"Showing" // row[9]
|
||||||
"Showing" // row[10]
|
|
||||||
" FROM gam_matches"
|
" FROM gam_matches"
|
||||||
" WHERE GamCod=%ld%s"
|
" WHERE GamCod=%ld%s"
|
||||||
" ORDER BY MchCod",
|
" ORDER BY MchCod",
|
||||||
|
@ -2784,17 +2775,16 @@ void Gam_GetDataOfMatchByCod (struct Match *Match)
|
||||||
|
|
||||||
/***** Get data of match from database *****/
|
/***** Get data of match from database *****/
|
||||||
NumRows = (unsigned) DB_QuerySELECT (&mysql_res,"can not get matches",
|
NumRows = (unsigned) DB_QuerySELECT (&mysql_res,"can not get matches",
|
||||||
"SELECT MchCod," // row[ 0]
|
"SELECT MchCod," // row[0]
|
||||||
"GamCod," // row[ 1]
|
"GamCod," // row[1]
|
||||||
"UsrCod," // row[ 2]
|
"UsrCod," // row[2]
|
||||||
"UNIX_TIMESTAMP(StartTime)," // row[ 3]
|
"UNIX_TIMESTAMP(StartTime)," // row[3]
|
||||||
"UNIX_TIMESTAMP(EndTime)," // row[ 4]
|
"UNIX_TIMESTAMP(EndTime)," // row[4]
|
||||||
"Title," // row[ 5]
|
"Title," // row[5]
|
||||||
"ShowResults," // row[ 6]
|
"QstInd," // row[6]
|
||||||
"QstInd," // row[ 7]
|
"QstCod," // row[7]
|
||||||
"QstCod," // row[ 8]
|
"UNIX_TIMESTAMP(QstStartTime)," // row[8]
|
||||||
"UNIX_TIMESTAMP(QstStartTime)," // row[ 9]
|
"Showing" // row[9]
|
||||||
"Showing" // row[10]
|
|
||||||
" FROM gam_matches"
|
" FROM gam_matches"
|
||||||
" WHERE MchCod=%ld"
|
" WHERE MchCod=%ld"
|
||||||
" AND GamCod IN" // Extra check
|
" AND GamCod IN" // Extra check
|
||||||
|
@ -2817,8 +2807,7 @@ void Gam_GetDataOfMatchByCod (struct Match *Match)
|
||||||
Match->Status.QstInd = 0;
|
Match->Status.QstInd = 0;
|
||||||
Match->Status.QstCod = -1L;
|
Match->Status.QstCod = -1L;
|
||||||
Match->Status.QstStartTimeUTC = (time_t) 0;
|
Match->Status.QstStartTimeUTC = (time_t) 0;
|
||||||
Match->Status.ShowResults = false;
|
Match->Status.Showing = Gam_WORDING;
|
||||||
Match->Status.Showing = Gam_SHOWING_WORDING;
|
|
||||||
Match->Status.BeingPlayed = false;
|
Match->Status.BeingPlayed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3022,13 +3011,12 @@ static void Gam_GetMatchDataFromRow (MYSQL_RES *mysql_res,
|
||||||
/***** Get match data *****/
|
/***** Get match data *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
/*
|
/*
|
||||||
row[ 0] MchCod
|
row[0] MchCod
|
||||||
row[ 1] GamCod
|
row[1] GamCod
|
||||||
row[ 2] UsrCod
|
row[2] UsrCod
|
||||||
row[ 3] UNIX_TIMESTAMP(StartTime)
|
row[3] UNIX_TIMESTAMP(StartTime)
|
||||||
row[ 4] UNIX_TIMESTAMP(EndTime)
|
row[4] UNIX_TIMESTAMP(EndTime)
|
||||||
row[ 5] Title
|
row[5] Title
|
||||||
row[ 6] ShowResults
|
|
||||||
*/
|
*/
|
||||||
/***** Get match data *****/
|
/***** Get match data *****/
|
||||||
/* Code of the match (row[0]) */
|
/* Code of the match (row[0]) */
|
||||||
|
@ -3055,27 +3043,24 @@ static void Gam_GetMatchDataFromRow (MYSQL_RES *mysql_res,
|
||||||
else
|
else
|
||||||
Match->Title[0] = '\0';
|
Match->Title[0] = '\0';
|
||||||
|
|
||||||
/* Get whether to show results or not (row(6)) */
|
|
||||||
Match->Status.ShowResults = (row[6][0] == 'Y');
|
|
||||||
|
|
||||||
/***** Get current match status *****/
|
/***** Get current match status *****/
|
||||||
/*
|
/*
|
||||||
row[ 7] QstInd
|
row[6] QstInd
|
||||||
row[ 8] QstCod
|
row[7] QstCod
|
||||||
row[ 9] UNIX_TIMESTAMP(QstStartTime)
|
row[8] UNIX_TIMESTAMP(QstStartTime)
|
||||||
row[10] Showing
|
row[9] Showing
|
||||||
*/
|
*/
|
||||||
/* Current question index (row[7]) */
|
/* Current question index (row[6]) */
|
||||||
Match->Status.QstInd = Gam_GetQstIndFromStr (row[7]);
|
Match->Status.QstInd = Gam_GetQstIndFromStr (row[6]);
|
||||||
|
|
||||||
/* Current question code (row[8]) */
|
/* Current question code (row[7]) */
|
||||||
Match->Status.QstCod = Str_ConvertStrCodToLongCod (row[8]);
|
Match->Status.QstCod = Str_ConvertStrCodToLongCod (row[7]);
|
||||||
|
|
||||||
/* Get question start date (row[9] holds the start UTC time) */
|
/* Get question start date (row[8] holds the start UTC time) */
|
||||||
Match->Status.QstStartTimeUTC = Dat_GetUNIXTimeFromStr (row[9]);
|
Match->Status.QstStartTimeUTC = Dat_GetUNIXTimeFromStr (row[8]);
|
||||||
|
|
||||||
/* Get what to show (stem, answers, results) (row(10)) */
|
/* Get what to show (stem, answers, results) (row(9)) */
|
||||||
Match->Status.Showing = Gam_GetShowingFromStr (row[10]);
|
Match->Status.Showing = Gam_GetShowingFromStr (row[9]);
|
||||||
|
|
||||||
/***** Get whether the match is being played or not *****/
|
/***** Get whether the match is being played or not *****/
|
||||||
if (Match->Status.QstInd >= Gam_AFTER_LAST_QUESTION) // Finished
|
if (Match->Status.QstInd >= Gam_AFTER_LAST_QUESTION) // Finished
|
||||||
|
@ -3557,7 +3542,7 @@ void Gam_ResumeMatchTch (void)
|
||||||
if (Match.Status.QstInd < Gam_AFTER_LAST_QUESTION) // Unfinished
|
if (Match.Status.QstInd < Gam_AFTER_LAST_QUESTION) // Unfinished
|
||||||
{
|
{
|
||||||
if (Match.Status.QstInd == 0) // Match has been created, but it has not started
|
if (Match.Status.QstInd == 0) // Match has been created, but it has not started
|
||||||
Gam_SetMatchStatusToNextQuestion (&Match);
|
Gam_SetMatchStatusToNext (&Match);
|
||||||
Match.Status.BeingPlayed = true; // Start/resume match
|
Match.Status.BeingPlayed = true; // Start/resume match
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3573,64 +3558,64 @@ void Gam_ResumeMatchTch (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/** Show stem, hiding answers, of current question in a match (by a teacher) */
|
/** Show stem, hiding answers, of current question in a match (by a teacher) */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
void Gam_ShowStemQstMatchTch (void)
|
void Gam_ShowStemQstMatchTch (void)
|
||||||
{
|
{
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
|
||||||
/***** Remove old players.
|
***** Remove old players.
|
||||||
This function must be called before getting match status. *****/
|
This function must be called before getting match status. *****
|
||||||
Gam_RemoveOldPlayers ();
|
Gam_RemoveOldPlayers ();
|
||||||
|
|
||||||
/***** Get data of the match from database *****/
|
***** Get data of the match from database *****
|
||||||
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
||||||
Gam_GetDataOfMatchByCod (&Match);
|
Gam_GetDataOfMatchByCod (&Match);
|
||||||
|
|
||||||
/***** Update status *****/
|
***** Update status *****
|
||||||
Match.Status.Showing = Gam_SHOWING_WORDING; // Show only the stem
|
Match.Status.Showing = Gam_WORDING; // Show only the stem
|
||||||
|
|
||||||
/***** Update match status in database *****/
|
***** Update match status in database *****
|
||||||
Gam_UpdateMatchStatusInDB (&Match);
|
Gam_UpdateMatchStatusInDB (&Match);
|
||||||
|
|
||||||
/***** Show current match status *****/
|
***** Show current match status *****
|
||||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||||
Gam_ShowMatchStatusForTch (&Match);
|
Gam_ShowMatchStatusForTch (&Match);
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**** Show stem and answers of current question in a match (by a teacher) ****/
|
/**** Show stem and answers of current question in a match (by a teacher) ****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
void Gam_ShowAnssQstMatchTch (void)
|
void Gam_ShowAnssQstMatchTch (void)
|
||||||
{
|
{
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
|
||||||
/***** Remove old players.
|
***** Remove old players.
|
||||||
This function must be called before getting match status. *****/
|
This function must be called before getting match status. *****
|
||||||
Gam_RemoveOldPlayers ();
|
Gam_RemoveOldPlayers ();
|
||||||
|
|
||||||
/***** Get data of the match from database *****/
|
***** Get data of the match from database *****
|
||||||
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
||||||
Gam_GetDataOfMatchByCod (&Match);
|
Gam_GetDataOfMatchByCod (&Match);
|
||||||
|
|
||||||
/***** Update status *****/
|
***** Update status *****
|
||||||
Match.Status.Showing = Gam_SHOWING_ANSWERS; // Show answers
|
Match.Status.Showing = Gam_ANSWERS; // Show answers
|
||||||
|
|
||||||
/***** Update match status in database *****/
|
***** Update match status in database *****
|
||||||
Gam_UpdateMatchStatusInDB (&Match);
|
Gam_UpdateMatchStatusInDB (&Match);
|
||||||
|
|
||||||
/***** Show current match status *****/
|
***** Show current match status *****
|
||||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||||
Gam_ShowMatchStatusForTch (&Match);
|
Gam_ShowMatchStatusForTch (&Match);
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******** Show results of current question in a match (by a teacher) *********/
|
/******** Show results of current question in a match (by a teacher) *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Gam_ShowRessQstMatchTch (void)
|
void Gam_ShowResultsQstMatchTch (void)
|
||||||
{
|
{
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
|
||||||
|
@ -3643,7 +3628,7 @@ void Gam_ShowRessQstMatchTch (void)
|
||||||
Gam_GetDataOfMatchByCod (&Match);
|
Gam_GetDataOfMatchByCod (&Match);
|
||||||
|
|
||||||
/***** Update status *****/
|
/***** Update status *****/
|
||||||
Match.Status.Showing = Gam_REQUEST_RESULTS; // Show results
|
Match.Status.Showing = Gam_RESULTS; // Show results
|
||||||
|
|
||||||
/***** Update match status in database *****/
|
/***** Update match status in database *****/
|
||||||
Gam_UpdateMatchStatusInDB (&Match);
|
Gam_UpdateMatchStatusInDB (&Match);
|
||||||
|
@ -3658,7 +3643,7 @@ void Gam_ShowRessQstMatchTch (void)
|
||||||
/************* Show previous question in a match (by a teacher) **************/
|
/************* Show previous question in a match (by a teacher) **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Gam_PrevQstMatchTch (void)
|
void Gam_BackMatchTch (void)
|
||||||
{
|
{
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
|
||||||
|
@ -3671,7 +3656,7 @@ void Gam_PrevQstMatchTch (void)
|
||||||
Gam_GetDataOfMatchByCod (&Match);
|
Gam_GetDataOfMatchByCod (&Match);
|
||||||
|
|
||||||
/***** Update status *****/
|
/***** Update status *****/
|
||||||
Gam_SetMatchStatusToPrevQuestion (&Match);
|
Gam_SetMatchStatusToPrev (&Match);
|
||||||
|
|
||||||
/***** Update match status in database *****/
|
/***** Update match status in database *****/
|
||||||
Gam_UpdateMatchStatusInDB (&Match);
|
Gam_UpdateMatchStatusInDB (&Match);
|
||||||
|
@ -3686,7 +3671,7 @@ void Gam_PrevQstMatchTch (void)
|
||||||
/*************** Show next question in a match (by a teacher) ****************/
|
/*************** Show next question in a match (by a teacher) ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Gam_NextQstMatchTch (void)
|
void Gam_ForwardMatchTch (void)
|
||||||
{
|
{
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
|
||||||
|
@ -3699,7 +3684,7 @@ void Gam_NextQstMatchTch (void)
|
||||||
Gam_GetDataOfMatchByCod (&Match);
|
Gam_GetDataOfMatchByCod (&Match);
|
||||||
|
|
||||||
/***** Update status *****/
|
/***** Update status *****/
|
||||||
Gam_SetMatchStatusToNextQuestion (&Match);
|
Gam_SetMatchStatusToNext (&Match);
|
||||||
|
|
||||||
/***** Update match status in database *****/
|
/***** Update match status in database *****/
|
||||||
Gam_UpdateMatchStatusInDB (&Match);
|
Gam_UpdateMatchStatusInDB (&Match);
|
||||||
|
@ -3713,79 +3698,99 @@ void Gam_NextQstMatchTch (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************** Show current question in a match (by a teacher) **************/
|
/************** Show current question in a match (by a teacher) **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
void Gam_CurrQstMatchTch (void)
|
void Gam_CurrQstMatchTch (void)
|
||||||
{
|
{
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
|
||||||
/***** Remove old players.
|
***** Remove old players.
|
||||||
This function must be called before getting match status. *****/
|
This function must be called before getting match status. *****
|
||||||
Gam_RemoveOldPlayers ();
|
Gam_RemoveOldPlayers ();
|
||||||
|
|
||||||
/***** Get data of the match from database *****/
|
***** Get data of the match from database *****
|
||||||
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
||||||
Gam_GetDataOfMatchByCod (&Match);
|
Gam_GetDataOfMatchByCod (&Match);
|
||||||
|
|
||||||
/***** Toggle display of results *****/
|
***** Toggle display of results *****
|
||||||
Match.Status.ShowResults = !Match.Status.ShowResults;
|
Match.Status.ShowResults = !Match.Status.ShowResults;
|
||||||
|
|
||||||
/***** Update match status in database *****/
|
***** Update match status in database *****
|
||||||
Gam_UpdateMatchStatusInDB (&Match);
|
Gam_UpdateMatchStatusInDB (&Match);
|
||||||
|
|
||||||
/***** Show current match status *****/
|
***** Show current match status *****
|
||||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||||
Gam_ShowMatchStatusForTch (&Match);
|
Gam_ShowMatchStatusForTch (&Match);
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Set match status to previous question *******************/
|
/************** Set match status to previous (backward) status ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Gam_SetMatchStatusToPrevQuestion (struct Match *Match)
|
static void Gam_SetMatchStatusToPrev (struct Match *Match)
|
||||||
{
|
{
|
||||||
/***** Get index of the previous question *****/
|
|
||||||
Match->Status.QstInd = Gam_GetPrevQuestionIndexInGame (Match->GamCod,
|
|
||||||
Match->Status.QstInd);
|
|
||||||
if (Match->Status.QstInd == 0) // Start of questions has been reached
|
|
||||||
{
|
|
||||||
Match->Status.QstCod = -1L; // No previous questions
|
|
||||||
Match->Status.BeingPlayed = false; // Match is not being played
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Match->Status.QstCod = Gam_GetQstCodFromQstInd (Match->GamCod,
|
|
||||||
Match->Status.QstInd);
|
|
||||||
|
|
||||||
/***** What to show *****/
|
/***** What to show *****/
|
||||||
if (Match->Status.BeingPlayed)
|
switch (Match->Status.Showing)
|
||||||
{
|
{
|
||||||
if (Match->Status.ShowResults)
|
case Gam_WORDING:
|
||||||
Match->Status.Showing = Gam_REQUEST_RESULTS; // Show results
|
Match->Status.Showing = Gam_REQUEST;
|
||||||
else
|
|
||||||
Match->Status.Showing = Gam_SHOWING_ANSWERS; // Show answers
|
/***** Get index of the previous question *****/
|
||||||
|
Match->Status.QstInd = Gam_GetPrevQuestionIndexInGame (Match->GamCod,
|
||||||
|
Match->Status.QstInd);
|
||||||
|
if (Match->Status.QstInd == 0) // Start of questions has been reached
|
||||||
|
{
|
||||||
|
Match->Status.QstCod = -1L; // No previous questions
|
||||||
|
Match->Status.BeingPlayed = false; // Match is not being played
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Match->Status.QstCod = Gam_GetQstCodFromQstInd (Match->GamCod,
|
||||||
|
Match->Status.QstInd);
|
||||||
|
break;
|
||||||
|
case Gam_ANSWERS:
|
||||||
|
Match->Status.Showing = Gam_WORDING;
|
||||||
|
break;
|
||||||
|
case Gam_REQUEST:
|
||||||
|
Match->Status.Showing = Gam_ANSWERS;
|
||||||
|
break;
|
||||||
|
case Gam_RESULTS:
|
||||||
|
Match->Status.Showing = Gam_REQUEST;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Match->Status.Showing = Gam_SHOWING_WORDING; // Show only stem
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Set match status to next question *********************/
|
/**************** Set match status to next (forward) status ******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Gam_SetMatchStatusToNextQuestion (struct Match *Match)
|
static void Gam_SetMatchStatusToNext (struct Match *Match)
|
||||||
{
|
{
|
||||||
/***** Get index of the next question *****/
|
/***** What to show *****/
|
||||||
Match->Status.QstInd = Gam_GetNextQuestionIndexInGame (Match->GamCod,
|
switch (Match->Status.Showing)
|
||||||
Match->Status.QstInd);
|
|
||||||
if (Match->Status.QstInd < Gam_AFTER_LAST_QUESTION) // Unfinished
|
|
||||||
Match->Status.QstCod = Gam_GetQstCodFromQstInd (Match->GamCod,
|
|
||||||
Match->Status.QstInd);
|
|
||||||
else // Finished
|
|
||||||
{
|
{
|
||||||
Match->Status.QstCod = -1L; // No more questions
|
case Gam_WORDING:
|
||||||
Match->Status.BeingPlayed = false;
|
Match->Status.Showing = Gam_ANSWERS;
|
||||||
|
break;
|
||||||
|
case Gam_ANSWERS:
|
||||||
|
Match->Status.Showing = Gam_REQUEST;
|
||||||
|
break;
|
||||||
|
case Gam_REQUEST:
|
||||||
|
case Gam_RESULTS:
|
||||||
|
Match->Status.Showing = Gam_WORDING;
|
||||||
|
|
||||||
|
/***** Get index of the next question *****/
|
||||||
|
Match->Status.QstInd = Gam_GetNextQuestionIndexInGame (Match->GamCod,
|
||||||
|
Match->Status.QstInd);
|
||||||
|
if (Match->Status.QstInd < Gam_AFTER_LAST_QUESTION) // Unfinished
|
||||||
|
Match->Status.QstCod = Gam_GetQstCodFromQstInd (Match->GamCod,
|
||||||
|
Match->Status.QstInd);
|
||||||
|
else // Finished
|
||||||
|
{
|
||||||
|
Match->Status.QstCod = -1L; // No more questions
|
||||||
|
Match->Status.BeingPlayed = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
Match->Status.Showing = Gam_SHOWING_WORDING; // Show only the stem
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3794,8 +3799,6 @@ static void Gam_SetMatchStatusToNextQuestion (struct Match *Match)
|
||||||
|
|
||||||
static void Gam_ShowMatchStatusForTch (struct Match *Match)
|
static void Gam_ShowMatchStatusForTch (struct Match *Match)
|
||||||
{
|
{
|
||||||
extern const char *Txt_MATCH_Paused;
|
|
||||||
|
|
||||||
/***** Get current number of players *****/
|
/***** Get current number of players *****/
|
||||||
Gam_GetNumPlayers (Match);
|
Gam_GetNumPlayers (Match);
|
||||||
|
|
||||||
|
@ -3806,15 +3809,11 @@ static void Gam_ShowMatchStatusForTch (struct Match *Match)
|
||||||
/* Start right container */
|
/* Start right container */
|
||||||
fprintf (Gbl.F.Out,"<div class=\"MATCH_RIGHT\">");
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_RIGHT\">");
|
||||||
|
|
||||||
/* Top row */
|
/* Top row: match title */
|
||||||
Gam_ShowMatchTitle (Match);
|
Gam_ShowMatchTitle (Match);
|
||||||
|
|
||||||
/* Bottom row */
|
/* Bottom row: current question and possible answers */
|
||||||
if (Match->Status.BeingPlayed)
|
Gam_ShowQuestionAndAnswersTch (Match);
|
||||||
/* Show current question and possible answers */
|
|
||||||
Gam_ShowQuestionAndAnswersTch (Match);
|
|
||||||
else // Not being played
|
|
||||||
Gam_ShowWaitImage (Txt_MATCH_Paused);
|
|
||||||
|
|
||||||
/* End right container */
|
/* End right container */
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
@ -3910,7 +3909,7 @@ static void Gam_ShowLeftColumnTch (struct Match *Match)
|
||||||
Gam_PutMatchControlButtons (Match);
|
Gam_PutMatchControlButtons (Match);
|
||||||
|
|
||||||
/***** Checkbox to show results *****/
|
/***** Checkbox to show results *****/
|
||||||
Gam_PutCheckboxResult (Match);
|
// Gam_PutCheckboxResult (Match);
|
||||||
|
|
||||||
/***** Number of players *****/
|
/***** Number of players *****/
|
||||||
Gam_ShowNumPlayers (Match);
|
Gam_ShowNumPlayers (Match);
|
||||||
|
@ -3956,95 +3955,43 @@ static void Gam_ShowLeftColumnStd (struct Match *Match)
|
||||||
|
|
||||||
static void Gam_PutMatchControlButtons (struct Match *Match)
|
static void Gam_PutMatchControlButtons (struct Match *Match)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Stem;
|
extern const char *Txt_Go_back;
|
||||||
extern const char *Txt_MATCH_Start;
|
extern const char *Txt_Go_forward;
|
||||||
extern const char *Txt_Previous_QUESTION;
|
|
||||||
extern const char *Txt_Pause;
|
extern const char *Txt_Pause;
|
||||||
extern const char *Txt_Start;
|
extern const char *Txt_Start;
|
||||||
extern const char *Txt_Resume;
|
extern const char *Txt_Resume;
|
||||||
extern const char *Txt_Next_QUESTION;
|
|
||||||
extern const char *Txt_Answers;
|
|
||||||
extern const char *Txt_View_results;
|
|
||||||
extern const char *Txt_Finish;
|
|
||||||
unsigned PrvQstInd; // Previous question index
|
|
||||||
unsigned NxtQstInd; // Next question index
|
|
||||||
|
|
||||||
/***** Start buttons container *****/
|
/***** Start buttons container *****/
|
||||||
fprintf (Gbl.F.Out,"<div class=\"MATCH_BUTTONS_CONTAINER\">");
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_BUTTONS_CONTAINER\">");
|
||||||
|
|
||||||
/***** Left button *****/
|
/***** Left button *****/
|
||||||
fprintf (Gbl.F.Out,"<div class=\"MATCH_BUTTON_LEFT_CONTAINER\">");
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_BUTTON_LEFT_CONTAINER\">");
|
||||||
if (Match->Status.QstInd < Gam_AFTER_LAST_QUESTION) // Unfinished
|
if (Match->Status.QstInd == 0)
|
||||||
{
|
/* Put button to close browser tab */
|
||||||
if (Match->Status.BeingPlayed)
|
Gam_PutBigButtonClose ();
|
||||||
{
|
else
|
||||||
switch (Match->Status.Showing)
|
/* Put button to go back */
|
||||||
{
|
Gam_PutBigButton (ActBckMchTch,Match->MchCod,
|
||||||
case Gam_SHOWING_WORDING:
|
Gam_ICON_PREVIOUS,Txt_Go_back);
|
||||||
/* Put button to show stem of current question, hiding answers */
|
|
||||||
Gam_PutBigButton (ActPrvQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_PREVIOUS,Txt_Previous_QUESTION);
|
|
||||||
break;
|
|
||||||
case Gam_SHOWING_ANSWERS:
|
|
||||||
/* Put button to show stem of current question, hiding answers */
|
|
||||||
Gam_PutBigButton (ActShoSteMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_PREVIOUS,Txt_Stem);
|
|
||||||
break;
|
|
||||||
case Gam_REQUEST_RESULTS:
|
|
||||||
/* Put button to show stem of current question, hiding answers */
|
|
||||||
Gam_PutBigButton (ActShoAnsMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_PREVIOUS,Txt_Stem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Match->Status.QstInd == 0)
|
|
||||||
{
|
|
||||||
if (Match->Status.BeingPlayed)
|
|
||||||
/* Put button to go to start of match before first question */
|
|
||||||
Gam_PutBigButton (ActPrvQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_PREVIOUS,Txt_MATCH_Start);
|
|
||||||
else // Not being played
|
|
||||||
/* Put button to close browser tab */
|
|
||||||
Gam_PutBigButtonClose ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Get index of the previous question */
|
|
||||||
PrvQstInd = Gam_GetPrevQuestionIndexInGame (Match->GamCod,
|
|
||||||
Match->Status.QstInd);
|
|
||||||
if (PrvQstInd == 0) // There is not a previous question
|
|
||||||
/* Put button to resume match before first question */
|
|
||||||
Gam_PutBigButton (ActPrvQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_PREVIOUS,Txt_MATCH_Start);
|
|
||||||
else // There is a previous question
|
|
||||||
/* Put button to show previous question */
|
|
||||||
Gam_PutBigButton (ActPrvQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_PREVIOUS,Txt_Previous_QUESTION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // Finished
|
|
||||||
/* Put button to show last question */
|
|
||||||
Gam_PutBigButton (ActPrvQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_PREVIOUS,Txt_Previous_QUESTION);
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
/***** Center button *****/
|
/***** Center button *****/
|
||||||
fprintf (Gbl.F.Out,"<div class=\"MATCH_BUTTON_CENTER_CONTAINER\">");
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_BUTTON_CENTER_CONTAINER\">");
|
||||||
if (Match->Status.BeingPlayed)
|
if (Match->Status.BeingPlayed) // Being played
|
||||||
/* Put button to pause match */
|
/* Put button to pause match */
|
||||||
Gam_PutBigButton (ActPauMchTch,
|
Gam_PutBigButton (ActPauMchTch,
|
||||||
Match->MchCod,
|
Match->MchCod,
|
||||||
Gam_ICON_PAUSE,Txt_Pause);
|
Gam_ICON_PAUSE,Txt_Pause);
|
||||||
else
|
else // Paused
|
||||||
{
|
{
|
||||||
if (Match->Status.QstInd < Gam_AFTER_LAST_QUESTION) // Not finished
|
if (Match->Status.QstInd < Gam_AFTER_LAST_QUESTION) // Not finished
|
||||||
/* Put button to resume match */
|
/* Put button to play match */
|
||||||
Gam_PutBigButton (ActPlyMchTch,
|
Gam_PutBigButton (ActPlyMchTch,
|
||||||
Match->MchCod,
|
Match->MchCod,
|
||||||
Gam_ICON_PLAY,Match->Status.QstInd == 0 ? Txt_Start :
|
Gam_ICON_PLAY,Match->Status.QstInd == 0 ? Txt_Start :
|
||||||
Txt_Resume);
|
Txt_Resume);
|
||||||
else // Finished
|
else // Finished
|
||||||
|
/* Put disabled button to play match */
|
||||||
Gam_PutBigButtonOff (Gam_ICON_PLAY);
|
Gam_PutBigButtonOff (Gam_ICON_PLAY);
|
||||||
}
|
}
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
@ -4055,103 +4002,15 @@ static void Gam_PutMatchControlButtons (struct Match *Match)
|
||||||
/* Put button to close browser tab */
|
/* Put button to close browser tab */
|
||||||
Gam_PutBigButtonClose ();
|
Gam_PutBigButtonClose ();
|
||||||
else
|
else
|
||||||
{
|
/* Put button to show answers */
|
||||||
/* Get index of the next question */
|
Gam_PutBigButton (ActFwdMchTch,Match->MchCod,
|
||||||
NxtQstInd = Gam_GetNextQuestionIndexInGame (Match->GamCod,
|
Gam_ICON_NEXT,Txt_Go_forward);
|
||||||
Match->Status.QstInd);
|
|
||||||
if (Match->Status.BeingPlayed) // Being played
|
|
||||||
{
|
|
||||||
if (Match->Status.Showing == Gam_SHOWING_WORDING) // Not showing answers
|
|
||||||
{
|
|
||||||
if (Match->Status.QstInd == 0)
|
|
||||||
/* Put button to show first question */
|
|
||||||
Gam_PutBigButton (ActNxtQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_NEXT,Txt_Next_QUESTION);
|
|
||||||
else
|
|
||||||
/* Put button to show answers */
|
|
||||||
Gam_PutBigButton (ActShoAnsMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_NEXT,Txt_Answers);
|
|
||||||
}
|
|
||||||
else // Showing answers
|
|
||||||
{
|
|
||||||
if (Match->Status.ShowResults) // Show results
|
|
||||||
{
|
|
||||||
/* Put button to show results */
|
|
||||||
Gam_PutBigButton (ActShoResMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_NEXT,Txt_View_results);
|
|
||||||
}
|
|
||||||
else // Don't show results
|
|
||||||
{
|
|
||||||
if (NxtQstInd >= Gam_AFTER_LAST_QUESTION) // No more questions
|
|
||||||
/* Put button to finish */
|
|
||||||
Gam_PutBigButton (ActNxtQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_NEXT,Txt_Finish);
|
|
||||||
else // There are more questions
|
|
||||||
/* Put button to show next question */
|
|
||||||
Gam_PutBigButton (ActNxtQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_NEXT,Txt_Next_QUESTION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // Not being played
|
|
||||||
{
|
|
||||||
if (NxtQstInd >= Gam_AFTER_LAST_QUESTION) // No more questions
|
|
||||||
/* Put button to finish */
|
|
||||||
Gam_PutBigButton (ActNxtQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_NEXT,Txt_Finish);
|
|
||||||
else // There are more questions
|
|
||||||
/* Put button to show next question */
|
|
||||||
Gam_PutBigButton (ActNxtQstMchTch,Match->MchCod,
|
|
||||||
Gam_ICON_NEXT,Txt_Next_QUESTION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
/***** End buttons container *****/
|
/***** End buttons container *****/
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/***************** Put checkbox to select if show results ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Gam_PutCheckboxResult (struct Match *Match)
|
|
||||||
{
|
|
||||||
extern const char *Txt_View_results;
|
|
||||||
|
|
||||||
/***** Start container *****/
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"MATCH_SHOW_RESULTS\">");
|
|
||||||
|
|
||||||
/***** Start form *****/
|
|
||||||
Frm_StartForm (ActChgShoResMchTch);
|
|
||||||
Gam_PutParamMatchCod (Match->MchCod); // Current match being played
|
|
||||||
|
|
||||||
/***** Put icon with link *****/
|
|
||||||
/* Submitting onmousedown instead of default onclick
|
|
||||||
is necessary in order to be fast
|
|
||||||
and not lose clicks due to refresh */
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT\">"
|
|
||||||
"<a href=\"\" class=\"ICO_HIGHLIGHT\""
|
|
||||||
" title=\"%s\" "
|
|
||||||
" onmousedown=\"document.getElementById('%s').submit();"
|
|
||||||
" return false;\">"
|
|
||||||
"<i class=\"%s\"></i>"
|
|
||||||
" %s"
|
|
||||||
"</a>"
|
|
||||||
"</div>",
|
|
||||||
Txt_View_results,
|
|
||||||
Gbl.Form.Id,
|
|
||||||
Match->Status.ShowResults ? "fas fa-toggle-on" :
|
|
||||||
"fas fa-toggle-off",
|
|
||||||
Txt_View_results);
|
|
||||||
|
|
||||||
/***** End form *****/
|
|
||||||
Frm_EndForm ();
|
|
||||||
|
|
||||||
/***** End container *****/
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Show number of question in game ***********************/
|
/********************* Show number of question in game ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4203,11 +4062,14 @@ static void Gam_ShowMatchTitle (struct Match *Match)
|
||||||
|
|
||||||
static void Gam_ShowQuestionAndAnswersTch (struct Match *Match)
|
static void Gam_ShowQuestionAndAnswersTch (struct Match *Match)
|
||||||
{
|
{
|
||||||
|
extern const char *Txt_MATCH_Paused;
|
||||||
|
extern const char *Txt_View_results;
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
|
||||||
/***** Trivial check: Question index should be > 0 *****/
|
/***** Trivial check: question index should be correct *****/
|
||||||
if (Match->Status.QstInd == 0)
|
if (Match->Status.QstInd == 0 ||
|
||||||
|
Match->Status.QstInd >= Gam_AFTER_LAST_QUESTION)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Get data of question from database *****/
|
/***** Get data of question from database *****/
|
||||||
|
@ -4241,16 +4103,77 @@ static void Gam_ShowQuestionAndAnswersTch (struct Match *Match)
|
||||||
"TEST_MED_EDIT_LIST_STEM");
|
"TEST_MED_EDIT_LIST_STEM");
|
||||||
|
|
||||||
/* Write answers? */
|
/* Write answers? */
|
||||||
if (Match->Status.Showing == Gam_SHOWING_ANSWERS)
|
switch (Match->Status.Showing)
|
||||||
/* Write answers */
|
{
|
||||||
Tst_WriteAnswersGameResult (Match->GamCod,
|
case Gam_WORDING:
|
||||||
Match->Status.QstInd,
|
/* Don't write anything */
|
||||||
Match->Status.QstCod,
|
break;
|
||||||
"MATCH_TCH_QST",false); // Don't show result
|
case Gam_ANSWERS:
|
||||||
|
if (Match->Status.BeingPlayed)
|
||||||
|
/* Write answers */
|
||||||
|
Tst_WriteAnswersGameResult (Match->GamCod,
|
||||||
|
Match->Status.QstInd,
|
||||||
|
Match->Status.QstCod,
|
||||||
|
"MATCH_TCH_QST",false); // Don't show result
|
||||||
|
else // Not being played
|
||||||
|
Gam_ShowWaitImage (Txt_MATCH_Paused);
|
||||||
|
break;
|
||||||
|
case Gam_REQUEST:
|
||||||
|
/* Write button to request viewing results */
|
||||||
|
Gam_PutBigButton (ActShoResMchTch,Match->MchCod,
|
||||||
|
Gam_ICON_RESULTS,Txt_View_results);
|
||||||
|
break;
|
||||||
|
case Gam_RESULTS:
|
||||||
|
/* Show results */
|
||||||
|
fprintf (Gbl.F.Out,"%s","Resultados aquí"); // TODO: Show results here
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************ Put button to show results *************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
|
static void Gam_PutCheckboxResult (struct Match *Match)
|
||||||
|
{
|
||||||
|
extern const char *Txt_View_results;
|
||||||
|
|
||||||
|
***** Start container *****
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_SHOW_RESULTS\">");
|
||||||
|
|
||||||
|
***** Start form *****
|
||||||
|
Frm_StartForm (ActChgShoResMchTch);
|
||||||
|
Gam_PutParamMatchCod (Match->MchCod); // Current match being played
|
||||||
|
|
||||||
|
***** Put icon with link *****
|
||||||
|
* Submitting onmousedown instead of default onclick
|
||||||
|
is necessary in order to be fast
|
||||||
|
and not lose clicks due to refresh *
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT\">"
|
||||||
|
"<a href=\"\" class=\"ICO_HIGHLIGHT\""
|
||||||
|
" title=\"%s\" "
|
||||||
|
" onmousedown=\"document.getElementById('%s').submit();"
|
||||||
|
" return false;\">"
|
||||||
|
"<i class=\"%s\"></i>"
|
||||||
|
" %s"
|
||||||
|
"</a>"
|
||||||
|
"</div>",
|
||||||
|
Txt_View_results,
|
||||||
|
Gbl.Form.Id,
|
||||||
|
Match->Status.ShowResults ? "fas fa-toggle-on" :
|
||||||
|
"fas fa-toggle-off",
|
||||||
|
Txt_View_results);
|
||||||
|
|
||||||
|
***** End form *****
|
||||||
|
Frm_EndForm ();
|
||||||
|
|
||||||
|
***** End container *****
|
||||||
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***** Show question and its answers when playing a match (as a student) *****/
|
/***** Show question and its answers when playing a match (as a student) *****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4268,7 +4191,7 @@ static void Gam_ShowQuestionAndAnswersStd (struct Match *Match)
|
||||||
|
|
||||||
/***** Show question *****/
|
/***** Show question *****/
|
||||||
/* Write buttons for answers? */
|
/* Write buttons for answers? */
|
||||||
if (Match->Status.Showing == Gam_SHOWING_ANSWERS)
|
if (Match->Status.Showing == Gam_ANSWERS)
|
||||||
{
|
{
|
||||||
if (Tst_CheckIfQuestionIsValidForGame (Match->Status.QstCod))
|
if (Tst_CheckIfQuestionIsValidForGame (Match->Status.QstCod))
|
||||||
{
|
{
|
||||||
|
|
12
swad_game.h
12
swad_game.h
|
@ -123,12 +123,12 @@ void Gam_CreateNewMatchTch (void);
|
||||||
void Gam_RequestStartResumeMatchTch (void);
|
void Gam_RequestStartResumeMatchTch (void);
|
||||||
void Gam_PauseMatchTch (void);
|
void Gam_PauseMatchTch (void);
|
||||||
void Gam_ResumeMatchTch (void);
|
void Gam_ResumeMatchTch (void);
|
||||||
void Gam_ShowStemQstMatchTch (void);
|
// void Gam_ShowStemQstMatchTch (void);
|
||||||
void Gam_ShowAnssQstMatchTch (void);
|
// void Gam_ShowAnssQstMatchTch (void);
|
||||||
void Gam_ShowRessQstMatchTch (void);
|
void Gam_ShowResultsQstMatchTch (void);
|
||||||
void Gam_PrevQstMatchTch (void);
|
void Gam_BackMatchTch (void);
|
||||||
void Gam_NextQstMatchTch (void);
|
void Gam_ForwardMatchTch (void);
|
||||||
void Gam_CurrQstMatchTch (void);
|
// void Gam_CurrQstMatchTch (void);
|
||||||
|
|
||||||
void Gam_ShowFinishedMatchResults (void);
|
void Gam_ShowFinishedMatchResults (void);
|
||||||
|
|
||||||
|
|
|
@ -698,12 +698,9 @@ static void Lay_WriteScriptInit (void)
|
||||||
case ActResMchTch:
|
case ActResMchTch:
|
||||||
case ActPauMchTch:
|
case ActPauMchTch:
|
||||||
case ActPlyMchTch:
|
case ActPlyMchTch:
|
||||||
case ActShoSteMchTch:
|
case ActBckMchTch:
|
||||||
case ActShoAnsMchTch:
|
case ActFwdMchTch:
|
||||||
case ActShoResMchTch:
|
case ActShoResMchTch:
|
||||||
case ActPrvQstMchTch:
|
|
||||||
case ActNxtQstMchTch:
|
|
||||||
case ActChgShoResMchTch:
|
|
||||||
case ActPlyMchStd:
|
case ActPlyMchStd:
|
||||||
case ActAnsMchQstStd:
|
case ActAnsMchQstStd:
|
||||||
RefreshGame = true;
|
RefreshGame = true;
|
||||||
|
@ -824,12 +821,9 @@ static void Lay_WriteScriptParamsAJAX (void)
|
||||||
case ActResMchTch:
|
case ActResMchTch:
|
||||||
case ActPauMchTch:
|
case ActPauMchTch:
|
||||||
case ActPlyMchTch:
|
case ActPlyMchTch:
|
||||||
case ActShoSteMchTch:
|
case ActBckMchTch:
|
||||||
case ActShoAnsMchTch:
|
case ActFwdMchTch:
|
||||||
case ActShoResMchTch:
|
case ActShoResMchTch:
|
||||||
case ActPrvQstMchTch:
|
|
||||||
case ActNxtQstMchTch:
|
|
||||||
case ActChgShoResMchTch:
|
|
||||||
fprintf (Gbl.F.Out,"var RefreshParamNxtActGam = \"act=%ld\";\n"
|
fprintf (Gbl.F.Out,"var RefreshParamNxtActGam = \"act=%ld\";\n"
|
||||||
"var RefreshParamMchCod = \"MchCod=%ld\";\n",
|
"var RefreshParamMchCod = \"MchCod=%ld\";\n",
|
||||||
Act_GetActCod (ActRefMchTch),
|
Act_GetActCod (ActRefMchTch),
|
||||||
|
|
|
@ -2576,7 +2576,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
|
||||||
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
||||||
extern const char *Txt_Question;
|
extern const char *Txt_Question;
|
||||||
extern const char *Txt_New_question;
|
extern const char *Txt_New_question;
|
||||||
extern const char *Txt_Stem;
|
extern const char *Txt_Wording;
|
||||||
extern const char *Txt_Type;
|
extern const char *Txt_Type;
|
||||||
extern const char *Txt_SURVEY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES];
|
extern const char *Txt_SURVEY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES];
|
||||||
extern const char *Txt_Save_changes;
|
extern const char *Txt_Save_changes;
|
||||||
|
@ -2674,7 +2674,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
|
||||||
"</textarea>"
|
"</textarea>"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassFormInBox[Gbl.Prefs.Theme],Txt_Stem,
|
The_ClassFormInBox[Gbl.Prefs.Theme],Txt_Wording,
|
||||||
Txt);
|
Txt);
|
||||||
|
|
||||||
/***** Type of answer *****/
|
/***** Type of answer *****/
|
||||||
|
|
|
@ -4932,7 +4932,7 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
||||||
extern const char *Txt_New_question;
|
extern const char *Txt_New_question;
|
||||||
extern const char *Txt_Tags;
|
extern const char *Txt_Tags;
|
||||||
extern const char *Txt_new_tag;
|
extern const char *Txt_new_tag;
|
||||||
extern const char *Txt_Stem;
|
extern const char *Txt_Wording;
|
||||||
extern const char *Txt_Feedback;
|
extern const char *Txt_Feedback;
|
||||||
extern const char *Txt_optional;
|
extern const char *Txt_optional;
|
||||||
extern const char *Txt_Type;
|
extern const char *Txt_Type;
|
||||||
|
@ -5069,7 +5069,7 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
||||||
"%s"
|
"%s"
|
||||||
"</textarea><br />",
|
"</textarea><br />",
|
||||||
The_ClassFormInBox[Gbl.Prefs.Theme],
|
The_ClassFormInBox[Gbl.Prefs.Theme],
|
||||||
Txt_Stem,
|
Txt_Wording,
|
||||||
Stem);
|
Stem);
|
||||||
Tst_PutFormToEditQstMedia (&Gbl.Test.Media,-1,
|
Tst_PutFormToEditQstMedia (&Gbl.Test.Media,-1,
|
||||||
false);
|
false);
|
||||||
|
|
74
swad_text.c
74
swad_text.c
|
@ -12225,7 +12225,7 @@ const char *Txt_Filter = // As a noun
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Filtro";
|
"Filtro";
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
const char *Txt_Finish =
|
const char *Txt_Finish =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Acabar";
|
"Acabar";
|
||||||
|
@ -12246,6 +12246,7 @@ const char *Txt_Finish =
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Terminar";
|
"Terminar";
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
const char *Txt_Finished_match =
|
const char *Txt_Finished_match =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
|
@ -13888,6 +13889,27 @@ const char *Txt_Go_back =
|
||||||
"Voltar";
|
"Voltar";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char *Txt_Go_forward =
|
||||||
|
#if L==1 // ca
|
||||||
|
"Anar endavant";
|
||||||
|
#elif L==2 // de
|
||||||
|
"Vorwärts gehen";
|
||||||
|
#elif L==3 // en
|
||||||
|
"Go forward";
|
||||||
|
#elif L==4 // es
|
||||||
|
"Avanzar";
|
||||||
|
#elif L==5 // fr
|
||||||
|
"Aller de l'avant";
|
||||||
|
#elif L==6 // gn
|
||||||
|
"Avanzar"; // Okoteve traducción
|
||||||
|
#elif L==7 // it
|
||||||
|
"Avanzare";
|
||||||
|
#elif L==8 // pl
|
||||||
|
"Idź napród";
|
||||||
|
#elif L==9 // pt
|
||||||
|
"Avançar";
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *Txt_Go_to_X = // Warning: it is very important to include %s in the following sentences
|
const char *Txt_Go_to_X = // Warning: it is very important to include %s in the following sentences
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Ir a %s"; // Necessita traduccio
|
"Ir a %s"; // Necessita traduccio
|
||||||
|
@ -24463,7 +24485,7 @@ const char *Txt_NEW_YEAR_GREETING = // Warning: it is very important to include
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Feliz %u!";
|
"Feliz %u!";
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
const char *Txt_Next_QUESTION =
|
const char *Txt_Next_QUESTION =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Següent";
|
"Següent";
|
||||||
|
@ -24484,7 +24506,7 @@ const char *Txt_Next_QUESTION =
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Seguinte";
|
"Seguinte";
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
const char *Txt_nick_email_or_ID =
|
const char *Txt_nick_email_or_ID =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"@sobrenom, correu o ID (DNI/cèdula)";
|
"@sobrenom, correu o ID (DNI/cèdula)";
|
||||||
|
@ -29751,7 +29773,7 @@ const char *Txt_Presents =
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Presentes";
|
"Presentes";
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
const char *Txt_Previous_QUESTION =
|
const char *Txt_Previous_QUESTION =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Anterior";
|
"Anterior";
|
||||||
|
@ -29772,7 +29794,7 @@ const char *Txt_Previous_QUESTION =
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Anterior";
|
"Anterior";
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
const char *Txt_Print =
|
const char *Txt_Print =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Imprimir";
|
"Imprimir";
|
||||||
|
@ -41476,27 +41498,6 @@ const char *Txt_Stay_connected_with_SWADroid =
|
||||||
"Fique ligado/a com <strong>SWADroid</strong>.";
|
"Fique ligado/a com <strong>SWADroid</strong>.";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Txt_Stem = // Stem of a test question
|
|
||||||
#if L==1 // ca
|
|
||||||
"Enunciat";
|
|
||||||
#elif L==2 // de
|
|
||||||
"Stamm";
|
|
||||||
#elif L==3 // en
|
|
||||||
"Stem";
|
|
||||||
#elif L==4 // es
|
|
||||||
"Enunciado";
|
|
||||||
#elif L==5 // fr
|
|
||||||
"Question";
|
|
||||||
#elif L==6 // gn
|
|
||||||
"Enunciado"; // Okoteve traducción
|
|
||||||
#elif L==7 // it
|
|
||||||
"Domanda";
|
|
||||||
#elif L==8 // pl
|
|
||||||
"Stem"; // Potrzebujesz tlumaczenie
|
|
||||||
#elif L==9 // pt
|
|
||||||
"Questão";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *Txt_Step_1_Provide_a_list_of_users =
|
const char *Txt_Step_1_Provide_a_list_of_users =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Paso 1: Proporcione una lista de usuarios"; // Necessita traduccio
|
"Paso 1: Proporcione una lista de usuarios"; // Necessita traduccio
|
||||||
|
@ -53311,6 +53312,27 @@ const char *Txt_works_ZIP_FILE_NAME = // Name (without extension) of the ZIP fil
|
||||||
"trabalhos";
|
"trabalhos";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char *Txt_Wording = // Statement of a question
|
||||||
|
#if L==1 // ca
|
||||||
|
"Enunciat";
|
||||||
|
#elif L==2 // de
|
||||||
|
"Aussage";
|
||||||
|
#elif L==3 // en
|
||||||
|
"Wording";
|
||||||
|
#elif L==4 // es
|
||||||
|
"Enunciado";
|
||||||
|
#elif L==5 // fr
|
||||||
|
"Énoncé";
|
||||||
|
#elif L==6 // gn
|
||||||
|
"Enunciado"; // Okoteve traducción
|
||||||
|
#elif L==7 // it
|
||||||
|
"Formulazione";
|
||||||
|
#elif L==8 // pl
|
||||||
|
"Sformułowanie";
|
||||||
|
#elif L==9 // pt
|
||||||
|
"Redação";
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *Txt_Works_area =
|
const char *Txt_Works_area =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Zona d'altres treballs";
|
"Zona d'altres treballs";
|
||||||
|
|
Loading…
Reference in New Issue