mirror of https://github.com/acanas/swad-core.git
Version18.122.1
This commit is contained in:
parent
f19ee52458
commit
2ea138f471
|
@ -606,10 +606,10 @@ Assessment:
|
|||
453. ActRemSvyQst Confirm the removal of a question of a survey
|
||||
|
||||
454. ActSeeGam Show one game
|
||||
455. ActPlyGam Start playing a game
|
||||
456. ActPlyGam1stQst Show first question when playing a game
|
||||
457. ActPlyGamNxtQst Show next question when playing a game
|
||||
458. ActPlyGamAns Show answers of current question when playing a game
|
||||
455. ActStrGamTch Start playing a game
|
||||
456. ActGamTch1stQst Show first question when playing a game
|
||||
457. ActGamTchNxtQst Show next question when playing a game
|
||||
458. ActGamTchAns Show answers of current question when playing a game
|
||||
459. ActAnsGam Answer a game
|
||||
460. ActFrmNewGam Form to create a new game
|
||||
461. ActEdiOneGam Edit one game
|
||||
|
@ -2135,10 +2135,14 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActSeeOneTstResOth*/{1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ShowOneTestResult ,NULL},
|
||||
|
||||
/* ActSeeGam */{1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL},
|
||||
/* ActPlyGam */{1670,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_PlayGame ,NULL},
|
||||
/* ActPlyGam1stQst */{1671,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Gam_PlayGameNextQuestion ,NULL},
|
||||
/* ActPlyGamNxtQst */{1672,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_PlayGameNextQuestion ,NULL},
|
||||
/* ActPlyGamAns */{1673,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_PlayGameShowAnswers ,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},
|
||||
/* 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},
|
||||
|
||||
/* ActPlyGamStd */{1779,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_PlayGameStd ,NULL},
|
||||
|
||||
/* ActAnsGam */{1651,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ReceiveGameAnswers ,NULL},
|
||||
/* ActFrmNewGam */{1652,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL},
|
||||
/* ActEdiOneGam */{1653,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL},
|
||||
|
@ -4858,10 +4862,10 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActAddTstQstToGam, // #1667
|
||||
ActUp_GamQst, // #1668
|
||||
ActDwnGamQst, // #1669
|
||||
ActPlyGam, // #1670
|
||||
ActPlyGam1stQst, // #1671
|
||||
ActPlyGamNxtQst, // #1672
|
||||
ActPlyGamAns, // #1673
|
||||
ActStrGamTch, // #1670
|
||||
ActGamTch1stQst, // #1671
|
||||
ActGamTchNxtQst, // #1672
|
||||
ActGamTchAns, // #1673
|
||||
ActSeePrj, // #1674
|
||||
ActFrmNewPrj, // #1675
|
||||
ActEdiOnePrj, // #1676
|
||||
|
@ -4967,6 +4971,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActReqUnlAllPrj, // #1776
|
||||
ActLckAllPrj, // #1777
|
||||
ActUnlAllPrj, // #1778
|
||||
ActPlyGamStd, // #1779
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -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
|
||||
|
||||
#define Act_NUM_ACTIONS (1 + 8 + 61 + 38 + 12 + 42 + 36 + 19 + 110 + 163 + 437 + 176 + 169 + 15 + 67)
|
||||
#define Act_NUM_ACTIONS (1 + 8 + 61 + 38 + 12 + 42 + 36 + 19 + 110 + 164 + 437 + 176 + 169 + 15 + 67)
|
||||
|
||||
#define Act_MAX_ACTION_COD 1778
|
||||
#define Act_MAX_ACTION_COD 1779
|
||||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
|
||||
|
||||
|
@ -609,55 +609,56 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
#define ActSeeOneTstResOth (ActChgCrsTT1stDay + 115)
|
||||
|
||||
#define ActSeeGam (ActChgCrsTT1stDay + 116)
|
||||
#define ActPlyGam (ActChgCrsTT1stDay + 117)
|
||||
#define ActPlyGam1stQst (ActChgCrsTT1stDay + 118)
|
||||
#define ActPlyGamNxtQst (ActChgCrsTT1stDay + 119)
|
||||
#define ActPlyGamAns (ActChgCrsTT1stDay + 120)
|
||||
#define ActAnsGam (ActChgCrsTT1stDay + 121)
|
||||
#define ActFrmNewGam (ActChgCrsTT1stDay + 122)
|
||||
#define ActEdiOneGam (ActChgCrsTT1stDay + 123)
|
||||
#define ActNewGam (ActChgCrsTT1stDay + 124)
|
||||
#define ActChgGam (ActChgCrsTT1stDay + 125)
|
||||
#define ActReqRemGam (ActChgCrsTT1stDay + 126)
|
||||
#define ActRemGam (ActChgCrsTT1stDay + 127)
|
||||
#define ActReqRstGam (ActChgCrsTT1stDay + 128)
|
||||
#define ActRstGam (ActChgCrsTT1stDay + 129)
|
||||
#define ActHidGam (ActChgCrsTT1stDay + 130)
|
||||
#define ActShoGam (ActChgCrsTT1stDay + 131)
|
||||
#define ActAddOneGamQst (ActChgCrsTT1stDay + 132)
|
||||
#define ActGamLstTstQst (ActChgCrsTT1stDay + 133)
|
||||
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 134)
|
||||
#define ActReqRemGamQst (ActChgCrsTT1stDay + 135)
|
||||
#define ActRemGamQst (ActChgCrsTT1stDay + 136)
|
||||
#define ActUp_GamQst (ActChgCrsTT1stDay + 137)
|
||||
#define ActDwnGamQst (ActChgCrsTT1stDay + 138)
|
||||
#define ActStrGamTch (ActChgCrsTT1stDay + 117)
|
||||
#define ActGamTch1stQst (ActChgCrsTT1stDay + 118)
|
||||
#define ActGamTchNxtQst (ActChgCrsTT1stDay + 119)
|
||||
#define ActGamTchAns (ActChgCrsTT1stDay + 120)
|
||||
#define ActPlyGamStd (ActChgCrsTT1stDay + 121)
|
||||
#define ActAnsGam (ActChgCrsTT1stDay + 122)
|
||||
#define ActFrmNewGam (ActChgCrsTT1stDay + 123)
|
||||
#define ActEdiOneGam (ActChgCrsTT1stDay + 124)
|
||||
#define ActNewGam (ActChgCrsTT1stDay + 125)
|
||||
#define ActChgGam (ActChgCrsTT1stDay + 126)
|
||||
#define ActReqRemGam (ActChgCrsTT1stDay + 127)
|
||||
#define ActRemGam (ActChgCrsTT1stDay + 128)
|
||||
#define ActReqRstGam (ActChgCrsTT1stDay + 129)
|
||||
#define ActRstGam (ActChgCrsTT1stDay + 130)
|
||||
#define ActHidGam (ActChgCrsTT1stDay + 131)
|
||||
#define ActShoGam (ActChgCrsTT1stDay + 132)
|
||||
#define ActAddOneGamQst (ActChgCrsTT1stDay + 133)
|
||||
#define ActGamLstTstQst (ActChgCrsTT1stDay + 134)
|
||||
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 135)
|
||||
#define ActReqRemGamQst (ActChgCrsTT1stDay + 136)
|
||||
#define ActRemGamQst (ActChgCrsTT1stDay + 137)
|
||||
#define ActUp_GamQst (ActChgCrsTT1stDay + 138)
|
||||
#define ActDwnGamQst (ActChgCrsTT1stDay + 139)
|
||||
|
||||
#define ActSeeSvy (ActChgCrsTT1stDay + 139)
|
||||
#define ActAnsSvy (ActChgCrsTT1stDay + 140)
|
||||
#define ActFrmNewSvy (ActChgCrsTT1stDay + 141)
|
||||
#define ActEdiOneSvy (ActChgCrsTT1stDay + 142)
|
||||
#define ActNewSvy (ActChgCrsTT1stDay + 143)
|
||||
#define ActChgSvy (ActChgCrsTT1stDay + 144)
|
||||
#define ActReqRemSvy (ActChgCrsTT1stDay + 145)
|
||||
#define ActRemSvy (ActChgCrsTT1stDay + 146)
|
||||
#define ActReqRstSvy (ActChgCrsTT1stDay + 147)
|
||||
#define ActRstSvy (ActChgCrsTT1stDay + 148)
|
||||
#define ActHidSvy (ActChgCrsTT1stDay + 149)
|
||||
#define ActShoSvy (ActChgCrsTT1stDay + 150)
|
||||
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 151)
|
||||
#define ActRcvSvyQst (ActChgCrsTT1stDay + 152)
|
||||
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 153)
|
||||
#define ActRemSvyQst (ActChgCrsTT1stDay + 154)
|
||||
#define ActSeeSvy (ActChgCrsTT1stDay + 140)
|
||||
#define ActAnsSvy (ActChgCrsTT1stDay + 141)
|
||||
#define ActFrmNewSvy (ActChgCrsTT1stDay + 142)
|
||||
#define ActEdiOneSvy (ActChgCrsTT1stDay + 143)
|
||||
#define ActNewSvy (ActChgCrsTT1stDay + 144)
|
||||
#define ActChgSvy (ActChgCrsTT1stDay + 145)
|
||||
#define ActReqRemSvy (ActChgCrsTT1stDay + 146)
|
||||
#define ActRemSvy (ActChgCrsTT1stDay + 147)
|
||||
#define ActReqRstSvy (ActChgCrsTT1stDay + 148)
|
||||
#define ActRstSvy (ActChgCrsTT1stDay + 149)
|
||||
#define ActHidSvy (ActChgCrsTT1stDay + 150)
|
||||
#define ActShoSvy (ActChgCrsTT1stDay + 151)
|
||||
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 152)
|
||||
#define ActRcvSvyQst (ActChgCrsTT1stDay + 153)
|
||||
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 154)
|
||||
#define ActRemSvyQst (ActChgCrsTT1stDay + 155)
|
||||
|
||||
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 155)
|
||||
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 156)
|
||||
#define ActEdiExaAnn (ActChgCrsTT1stDay + 157)
|
||||
#define ActRcvExaAnn (ActChgCrsTT1stDay + 158)
|
||||
#define ActPrnExaAnn (ActChgCrsTT1stDay + 159)
|
||||
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 160)
|
||||
#define ActRemExaAnn (ActChgCrsTT1stDay + 161)
|
||||
#define ActHidExaAnn (ActChgCrsTT1stDay + 162)
|
||||
#define ActShoExaAnn (ActChgCrsTT1stDay + 163)
|
||||
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 156)
|
||||
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 157)
|
||||
#define ActEdiExaAnn (ActChgCrsTT1stDay + 158)
|
||||
#define ActRcvExaAnn (ActChgCrsTT1stDay + 159)
|
||||
#define ActPrnExaAnn (ActChgCrsTT1stDay + 160)
|
||||
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 161)
|
||||
#define ActRemExaAnn (ActChgCrsTT1stDay + 162)
|
||||
#define ActHidExaAnn (ActChgCrsTT1stDay + 163)
|
||||
#define ActShoExaAnn (ActChgCrsTT1stDay + 164)
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** Files tab **********************************/
|
||||
|
|
|
@ -448,10 +448,15 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.122 (2019-05-18)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.122.1 (2019-05-18)"
|
||||
#define CSS_FILE "swad18.112.1.css"
|
||||
#define JS_FILE "swad18.116.5.js"
|
||||
/*
|
||||
Version 18.122.1: May 20, 2019 New action to play game by a student. (242257 lines)
|
||||
2 changes necessary in database:
|
||||
UPDATE actions SET Txt='Preparar para comenzar juego' WHERE ActCod='1670' AND Language='es';
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1779','es','N','Preparar para jugar como estudiante');
|
||||
|
||||
Version 18.122: May 18, 2019 Games available for students.
|
||||
Scope and roles removed from games. (242145 lines)
|
||||
3 changes necessary in database:
|
||||
|
|
195
swad_game.c
195
swad_game.c
|
@ -97,7 +97,8 @@ static void Gam_ParamsWhichGroupsToShow (void);
|
|||
static void Gam_ShowOneGame (long GamCod,
|
||||
bool ShowOnlyThisGame,
|
||||
bool ListGameQuestions,
|
||||
bool PutButtonToStart);
|
||||
bool PutButtonToStart,
|
||||
bool PutButtonToPlay);
|
||||
static void Gam_WriteAuthor (struct Game *Game);
|
||||
static void Gam_WriteStatus (struct Game *Game);
|
||||
static void Gam_GetParamGameOrder (void);
|
||||
|
@ -152,7 +153,8 @@ static void Gam_PutParamsOneQst (void);
|
|||
static void Gam_ExchangeQuestions (long GamCod,
|
||||
unsigned QstIndTop,unsigned QstIndBottom);
|
||||
|
||||
static void Gam_PutBigButtonToStartGame (long GamCod);
|
||||
static void Gam_PutBigButtonToStartGameTch (long GamCod);
|
||||
static void Gam_PutBigButtonToPlayGameStd (long GamCod);
|
||||
|
||||
static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers);
|
||||
static void Gam_PutBigButtonToContinue (Act_Action_t NextAction,
|
||||
|
@ -272,7 +274,8 @@ static void Gam_ListAllGames (void)
|
|||
Gam_ShowOneGame (Gbl.Games.LstGamCods[NumGame - 1],
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
false, // Do not put button to start game
|
||||
false); // Do not put button to play
|
||||
|
||||
/***** End table *****/
|
||||
Tbl_EndTable ();
|
||||
|
@ -400,7 +403,8 @@ void Gam_SeeOneGame (void)
|
|||
Gam_ShowOneGame (Game.GamCod,
|
||||
true, // Show only this game
|
||||
true, // List game questions
|
||||
false);
|
||||
false, // Do not put button to start game
|
||||
false); // Do not put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -410,7 +414,8 @@ void Gam_SeeOneGame (void)
|
|||
static void Gam_ShowOneGame (long GamCod,
|
||||
bool ShowOnlyThisGame,
|
||||
bool ListGameQuestions,
|
||||
bool PutButtonToStart)
|
||||
bool PutButtonToStart,
|
||||
bool PutButtonToPlay)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Games;
|
||||
extern const char *Txt_Game;
|
||||
|
@ -419,6 +424,7 @@ static void Gam_ShowOneGame (long GamCod,
|
|||
extern const char *Txt_No_of_questions;
|
||||
extern const char *Txt_No_of_users;
|
||||
extern const char *Txt_Play;
|
||||
extern const char *Txt_Start_game;
|
||||
extern const char *Txt_View_game_results;
|
||||
char *Anchor = NULL;
|
||||
static unsigned UniqueId = 0;
|
||||
|
@ -455,17 +461,33 @@ static void Gam_ShowOneGame (long GamCod,
|
|||
/* Icons to remove/edit this game */
|
||||
Gam_PutFormsToRemEditOneGame (&Game,Anchor);
|
||||
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
/* Icon to play game */
|
||||
Lay_PutContextualLinkOnlyIcon (ActPlyGamStd,NULL,
|
||||
Gam_PutParams,
|
||||
"play.svg",
|
||||
Txt_Play);
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
if (ShowOnlyThisGame)
|
||||
/* Icon to show first question */
|
||||
Lay_PutContextualLinkOnlyIcon (ActPlyGam1stQst,NULL,
|
||||
Lay_PutContextualLinkOnlyIcon (ActGamTch1stQst,NULL,
|
||||
Gam_PutParamsToPlayGame1stQst,
|
||||
"play.svg",
|
||||
Txt_Play);
|
||||
else
|
||||
/* Icon to play game */
|
||||
Lay_PutContextualLinkOnlyIcon (ActPlyGam,NULL,Gam_PutParams,
|
||||
/* Icon to start game */
|
||||
Lay_PutContextualLinkOnlyIcon (ActStrGamTch,NULL,
|
||||
Gam_PutParams,
|
||||
"play.svg",
|
||||
Txt_Play);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -516,9 +538,6 @@ static void Gam_ShowOneGame (long GamCod,
|
|||
Lay_StartArticle (Anchor);
|
||||
Frm_StartForm (ActSeeGam);
|
||||
Gam_PutParamGameCod (GamCod);
|
||||
// Gam_PutHiddenParamGameOrder ();
|
||||
// Grp_PutParamWhichGrps ();
|
||||
// Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||
Frm_LinkFormSubmit (Txt_View_game,
|
||||
Game.Status.Visible ? "ASG_TITLE" :
|
||||
"ASG_TITLE_LIGHT",NULL);
|
||||
|
@ -553,16 +572,29 @@ static void Gam_ShowOneGame (long GamCod,
|
|||
{
|
||||
fprintf (Gbl.F.Out,"<div class=\"BUTTONS_AFTER_ALERT\">");
|
||||
|
||||
/* Possible button to play the game */
|
||||
/* Possible button to play/start the game */
|
||||
if (Game.Status.Open)
|
||||
{
|
||||
Frm_StartForm (ActPlyGam);
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
/* Icon to play game */
|
||||
Frm_StartForm (ActPlyGamStd);
|
||||
Gam_PutParamGameCod (Game.GamCod);
|
||||
Gam_PutHiddenParamGameOrder ();
|
||||
Grp_PutParamWhichGrps ();
|
||||
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||
Btn_PutCreateButtonInline (Txt_Play);
|
||||
Frm_EndForm ();
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
/* Icon to start game */
|
||||
Frm_StartForm (ActStrGamTch);
|
||||
Gam_PutParamGameCod (Game.GamCod);
|
||||
Btn_PutCreateButtonInline (Txt_Start_game);
|
||||
Frm_EndForm ();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Possible button to see the result of the game */
|
||||
|
@ -586,7 +618,7 @@ static void Gam_ShowOneGame (long GamCod,
|
|||
/* Possible button to answer this game */
|
||||
if (Game.Status.ICanAnswer)
|
||||
{
|
||||
Frm_StartForm (ActPlyGam);
|
||||
Frm_StartForm (ActStrGamTch);
|
||||
Gam_PutParamGameCod (Game.GamCod);
|
||||
Gam_PutHiddenParamGameOrder ();
|
||||
Grp_PutParamWhichGrps ();
|
||||
|
@ -604,33 +636,34 @@ static void Gam_ShowOneGame (long GamCod,
|
|||
fprintf (Gbl.F.Out,"</tr>");
|
||||
|
||||
/***** Start 2nd row of this game *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td colspan=\"2\" class=\"LEFT_TOP");
|
||||
fprintf (Gbl.F.Out,"<tr>");
|
||||
|
||||
/***** Author of the game *****/
|
||||
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"LEFT_TOP");
|
||||
if (!ShowOnlyThisGame)
|
||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||
fprintf (Gbl.F.Out,"\">");
|
||||
|
||||
/* Author of the game */
|
||||
Gam_WriteAuthor (&Game);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"<td class=\"LEFT_TOP");
|
||||
/***** Text of the game *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP");
|
||||
if (!ShowOnlyThisGame)
|
||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||
fprintf (Gbl.F.Out,"\">");
|
||||
|
||||
/* Text of the game */
|
||||
Gam_GetGameTxtFromDB (Game.GamCod,Txt);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
||||
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
fprintf (Gbl.F.Out,"<div class=\"PAR %s\">%s</div>"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
"</td>",
|
||||
Game.Status.Visible ? "DAT" :
|
||||
"DAT_LIGHT",
|
||||
Txt);
|
||||
|
||||
/***** End 2nd row of this game *****/
|
||||
fprintf (Gbl.F.Out,"</tr>");
|
||||
|
||||
/***** Write questions of this game *****/
|
||||
if (ListGameQuestions)
|
||||
{
|
||||
|
@ -650,9 +683,13 @@ static void Gam_ShowOneGame (long GamCod,
|
|||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
|
||||
/***** Put big button to start playing *****/
|
||||
/***** Put big button to start game as a teacher *****/
|
||||
if (PutButtonToStart)
|
||||
Gam_PutBigButtonToStartGame (Game.GamCod);
|
||||
Gam_PutBigButtonToStartGameTch (Game.GamCod);
|
||||
|
||||
/***** Put big button to play game as a student *****/
|
||||
if (PutButtonToPlay)
|
||||
Gam_PutBigButtonToPlayGameStd (Game.GamCod);
|
||||
|
||||
/***** End box *****/
|
||||
if (ShowOnlyThisGame)
|
||||
|
@ -1913,7 +1950,8 @@ void Gam_RequestNewQuestion (void)
|
|||
Gam_ShowOneGame (Game.GamCod,
|
||||
true, // Show only this game
|
||||
true, // List game questions
|
||||
false);
|
||||
false, // Do not put button to start game
|
||||
false); // Do not put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2458,7 +2496,8 @@ void Gam_AddTstQuestionsToGame (void)
|
|||
Gam_ShowOneGame (Game.GamCod,
|
||||
true, // Show only this game
|
||||
true, // List game questions
|
||||
false);
|
||||
false, // Do not put button to start game
|
||||
false); // Do not put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2652,7 +2691,8 @@ void Gam_RequestRemoveQst (void)
|
|||
Gam_ShowOneGame (Game.GamCod,
|
||||
true, // Show only this game
|
||||
true, // List game questions
|
||||
false);
|
||||
false, // Do not put button to start game
|
||||
false); // Do not put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2702,7 +2742,8 @@ void Gam_RemoveQst (void)
|
|||
Gam_ShowOneGame (Game.GamCod,
|
||||
true, // Show only this game
|
||||
true, // List game questions
|
||||
false);
|
||||
false, // Do not put button to start game
|
||||
false); // Do not put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2749,7 +2790,8 @@ void Gam_MoveUpQst (void)
|
|||
Gam_ShowOneGame (Game.GamCod,
|
||||
true, // Show only this game
|
||||
true, // List game questions
|
||||
false);
|
||||
false, // Do not put button to start game
|
||||
false); // Do not put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2801,7 +2843,8 @@ void Gam_MoveDownQst (void)
|
|||
Gam_ShowOneGame (Game.GamCod,
|
||||
true, // Show only this game
|
||||
true, // List game questions
|
||||
false);
|
||||
false, // Do not put button to start game
|
||||
false); // Do not put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2856,12 +2899,12 @@ static void Gam_ExchangeQuestions (long GamCod,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Start playing a game ******************************/
|
||||
/******************* Start playing a game as a teacher ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Gam_PlayGame (void)
|
||||
void Gam_StartGameTch (void)
|
||||
{
|
||||
struct Game Game;
|
||||
long GamCod;
|
||||
|
||||
/***** Get parameters *****/
|
||||
Gam_GetParamGameOrder ();
|
||||
|
@ -2869,26 +2912,77 @@ void Gam_PlayGame (void)
|
|||
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
|
||||
|
||||
/***** Get game code *****/
|
||||
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||
|
||||
/***** Show game *****/
|
||||
Gam_ShowOneGame (Game.GamCod,
|
||||
Gam_ShowOneGame (GamCod,
|
||||
true, // Show only this game
|
||||
false,
|
||||
true); // Put button to start
|
||||
false, // Do not list questions
|
||||
true, // Put button to start game
|
||||
false); // Do not put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Put a big button to start game ************************/
|
||||
/******************* Start playing a game as a student ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Gam_PutBigButtonToStartGame (long GamCod)
|
||||
void Gam_PlayGameStd (void)
|
||||
{
|
||||
long GamCod;
|
||||
|
||||
/***** Get parameters *****/
|
||||
Gam_GetParamGameOrder ();
|
||||
Grp_GetParamWhichGrps ();
|
||||
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
|
||||
|
||||
/***** Get game code *****/
|
||||
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||
|
||||
/***** Show game *****/
|
||||
Gam_ShowOneGame (GamCod,
|
||||
true, // Show only this game
|
||||
false, // Do not list questions
|
||||
false, // Do not put button to start game
|
||||
true); // Put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Put a big button to start game as a teacher *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Gam_PutBigButtonToStartGameTch (long GamCod)
|
||||
{
|
||||
extern const char *Txt_Start_game;
|
||||
|
||||
/***** Start form *****/
|
||||
Frm_StartForm (ActGamTch1stQst);
|
||||
Gam_PutParamGameCod (GamCod);
|
||||
Gam_PutParamQstInd (0); // Start by first question in game
|
||||
|
||||
/***** Put icon with link *****/
|
||||
Frm_LinkFormSubmit (Txt_Start_game,NULL,NULL);
|
||||
fprintf (Gbl.F.Out,"<img src=\"%s/play.svg\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"CONTEXT_OPT ICO_HIGHLIGHT ICO64x64\" />",
|
||||
Cfg_URL_ICON_PUBLIC,Txt_Start_game,Txt_Start_game);
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
|
||||
/***** End form *****/
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Put a big button to play game as a student *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Gam_PutBigButtonToPlayGameStd (long GamCod)
|
||||
{
|
||||
extern const char *Txt_Play;
|
||||
|
||||
/***** Start form *****/
|
||||
Frm_StartForm (ActPlyGam1stQst);
|
||||
Frm_StartForm (ActPlyGamStd);
|
||||
Gam_PutParamGameCod (GamCod);
|
||||
Gam_PutParamQstInd (0); // Start by first question in game
|
||||
|
||||
|
@ -2908,7 +3002,7 @@ static void Gam_PutBigButtonToStartGame (long GamCod)
|
|||
/**************** Show next question when playing a game *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Gam_PlayGameNextQuestion (void)
|
||||
void Gam_GameTchNextQuestion (void)
|
||||
{
|
||||
Gam_PlayGameShowQuestionAndAnswers (false); // Don't show answers
|
||||
}
|
||||
|
@ -2917,7 +3011,7 @@ void Gam_PlayGameNextQuestion (void)
|
|||
/************ Show question and its answers when playing a game **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Gam_PlayGameShowAnswers (void)
|
||||
void Gam_GameTchShowAnswers (void)
|
||||
{
|
||||
Gam_PlayGameShowQuestionAndAnswers (true); // Show answers
|
||||
}
|
||||
|
@ -3006,11 +3100,11 @@ static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers)
|
|||
NxtQstInd = Gam_GetNextQuestionIndexInGame (Game.GamCod,QstInd);
|
||||
if (NxtQstInd > 0)
|
||||
/* Put button to show next question */
|
||||
Gam_PutBigButtonToContinue (ActPlyGamNxtQst,Game.GamCod,(unsigned) NxtQstInd);
|
||||
Gam_PutBigButtonToContinue (ActGamTchNxtQst,Game.GamCod,(unsigned) NxtQstInd);
|
||||
}
|
||||
else
|
||||
/* Put button to show answers */
|
||||
Gam_PutBigButtonToContinue (ActPlyGamAns,Game.GamCod,QstInd);
|
||||
Gam_PutBigButtonToContinue (ActGamTchAns,Game.GamCod,QstInd);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/***** End container for question *****/
|
||||
|
@ -3082,7 +3176,8 @@ void Gam_ReceiveGameAnswers (void)
|
|||
Gam_ShowOneGame (Game.GamCod,
|
||||
true, // Show only this game
|
||||
true, // List game questions
|
||||
false);
|
||||
false, // Do not put button to start game
|
||||
false); // Do not put button to play
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -118,11 +118,12 @@ void Gam_RemoveQst (void);
|
|||
void Gam_MoveUpQst (void);
|
||||
void Gam_MoveDownQst (void);
|
||||
|
||||
void Gam_PlayGame (void);
|
||||
void Gam_StartGameTch (void);
|
||||
void Gam_PlayGameStd (void);
|
||||
|
||||
void Gam_ReceiveGameAnswers (void);
|
||||
void Gam_PlayGameNextQuestion (void);
|
||||
void Gam_PlayGameShowAnswers (void);
|
||||
void Gam_GameTchNextQuestion (void);
|
||||
void Gam_GameTchShowAnswers (void);
|
||||
|
||||
unsigned Gam_GetNumCoursesWithGames (Hie_Level_t Scope);
|
||||
unsigned Gam_GetNumGames (Hie_Level_t Scope);
|
||||
|
|
21
swad_text.c
21
swad_text.c
|
@ -40875,6 +40875,27 @@ const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES] =
|
|||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_Start_game =
|
||||
#if L==1 // ca
|
||||
"Començar joc";
|
||||
#elif L==2 // de
|
||||
"Spiel starten";
|
||||
#elif L==3 // en
|
||||
"Start game";
|
||||
#elif L==4 // es
|
||||
"Comenzar juego";
|
||||
#elif L==5 // fr
|
||||
"Commencer le jeu";
|
||||
#elif L==6 // gn
|
||||
"Ñepyrũ ñembosarái";
|
||||
#elif L==7 // it
|
||||
"Inizia il gioco";
|
||||
#elif L==8 // pl
|
||||
"Rozpocznij grę";
|
||||
#elif L==9 // pt
|
||||
"Começar o jogo";
|
||||
#endif
|
||||
|
||||
const char *Txt_Statistic =
|
||||
#if L==1 // ca
|
||||
"Estadístique";
|
||||
|
|
Loading…
Reference in New Issue