mirror of https://github.com/acanas/swad-core.git
Version 16.254.2
This commit is contained in:
parent
f4ff9fdf80
commit
61e6492b60
|
@ -250,14 +250,17 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.254.1 (2017-09-13)"
|
#define Log_PLATFORM_VERSION "SWAD 16.254.2 (2017-09-13)"
|
||||||
#define CSS_FILE "swad16.252.2.css"
|
#define CSS_FILE "swad16.252.2.css"
|
||||||
#define JS_FILE "swad16.206.3.js"
|
#define JS_FILE "swad16.206.3.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
Version 16.254.1: Sep 12, 2017 Icon to start playing a game. (227122 lines)
|
Version 16.254.2: Sep 13, 2017 Removed notifications in games.
|
||||||
|
Start playing a game.
|
||||||
|
Changes in pagination in games. (227141 lines)
|
||||||
|
Version 16.254.1: Sep 13, 2017 Icon to start playing a game. (227122 lines)
|
||||||
Copy the following icon to icon public directory:
|
Copy the following icon to icon public directory:
|
||||||
sudo cp icon/play64x64.png /var/www/html/swad/icon/
|
sudo cp icon/play64x64.png /var/www/html/swad/icon/
|
||||||
|
|
||||||
|
|
278
swad_game.c
278
swad_game.c
|
@ -36,7 +36,6 @@
|
||||||
#include "swad_game.h"
|
#include "swad_game.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
#include "swad_group.h"
|
#include "swad_group.h"
|
||||||
#include "swad_notification.h"
|
|
||||||
#include "swad_pagination.h"
|
#include "swad_pagination.h"
|
||||||
#include "swad_parameter.h"
|
#include "swad_parameter.h"
|
||||||
#include "swad_role.h"
|
#include "swad_role.h"
|
||||||
|
@ -89,7 +88,10 @@ static void Gam_PutButtonToCreateNewGame (void);
|
||||||
static void Gam_PutParamsToCreateNewGame (void);
|
static void Gam_PutParamsToCreateNewGame (void);
|
||||||
static void Gam_PutFormToSelectWhichGroupsToShow (void);
|
static void Gam_PutFormToSelectWhichGroupsToShow (void);
|
||||||
static void Gam_ParamsWhichGroupsToShow (void);
|
static void Gam_ParamsWhichGroupsToShow (void);
|
||||||
static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete);
|
static void Gam_ShowOneGame (long GamCod,
|
||||||
|
bool ShowOnlyThisGame,
|
||||||
|
bool ListGameQuestions,
|
||||||
|
bool PutButtonToStart);
|
||||||
static void Gam_WriteAuthor (struct Game *Game);
|
static void Gam_WriteAuthor (struct Game *Game);
|
||||||
static void Gam_WriteStatus (struct Game *Game);
|
static void Gam_WriteStatus (struct Game *Game);
|
||||||
static void Gam_GetParamGameOrder (void);
|
static void Gam_GetParamGameOrder (void);
|
||||||
|
@ -107,8 +109,7 @@ static void Gam_PutButtonToResetGame (void);
|
||||||
static bool Gam_CheckIfSimilarGameExists (struct Game *Game);
|
static bool Gam_CheckIfSimilarGameExists (struct Game *Game);
|
||||||
static void Gam_SetDefaultAndAllowedScope (struct Game *Game);
|
static void Gam_SetDefaultAndAllowedScope (struct Game *Game);
|
||||||
static void Gam_ShowLstGrpsToEditGame (long GamCod);
|
static void Gam_ShowLstGrpsToEditGame (long GamCod);
|
||||||
static void Gam_UpdateNumUsrsNotifiedByEMailAboutGame (long GamCod,
|
|
||||||
unsigned NumUsrsToBeNotifiedByEMail);
|
|
||||||
static void Gam_CreateGame (struct Game *Game,const char *Txt);
|
static void Gam_CreateGame (struct Game *Game,const char *Txt);
|
||||||
static void Gam_UpdateGame (struct Game *Game,const char *Txt);
|
static void Gam_UpdateGame (struct Game *Game,const char *Txt);
|
||||||
static bool Gam_CheckIfGamIsAssociatedToGrps (long GamCod);
|
static bool Gam_CheckIfGamIsAssociatedToGrps (long GamCod);
|
||||||
|
@ -147,6 +148,8 @@ static void Gam_PutParamsOneQst (void);
|
||||||
static void Gam_ExchangeQuestions (long GamCod,
|
static void Gam_ExchangeQuestions (long GamCod,
|
||||||
unsigned QstIndTop,unsigned QstIndBottom);
|
unsigned QstIndTop,unsigned QstIndBottom);
|
||||||
|
|
||||||
|
static void Gam_PutBigButtonToStartGame (void);
|
||||||
|
|
||||||
static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod);
|
static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod);
|
||||||
static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd);
|
static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd);
|
||||||
static void Gam_RegisterIHaveAnsweredGame (long GamCod);
|
static void Gam_RegisterIHaveAnsweredGame (long GamCod);
|
||||||
|
@ -162,7 +165,7 @@ void Gam_SeeAllGames (void)
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Gam_GetParamGameOrder ();
|
Gam_GetParamGameOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
|
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
|
||||||
|
|
||||||
/***** Show all the games *****/
|
/***** Show all the games *****/
|
||||||
Gam_ListAllGames ();
|
Gam_ListAllGames ();
|
||||||
|
@ -200,7 +203,7 @@ static void Gam_ListAllGames (void)
|
||||||
|
|
||||||
/***** Write links to pages *****/
|
/***** Write links to pages *****/
|
||||||
if (Pagination.MoreThanOnePage)
|
if (Pagination.MoreThanOnePage)
|
||||||
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,
|
Pag_WriteLinksToPagesCentered (Pag_GAMES,
|
||||||
0,
|
0,
|
||||||
&Pagination);
|
&Pagination);
|
||||||
|
|
||||||
|
@ -227,7 +230,7 @@ static void Gam_ListAllGames (void)
|
||||||
/* Form to change order */
|
/* Form to change order */
|
||||||
Act_FormStart (ActSeeAllGam);
|
Act_FormStart (ActSeeAllGam);
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Gbl.Games.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||||
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
|
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
|
||||||
Act_LinkFormSubmit (Txt_START_END_TIME_HELP[Order],"TIT_TBL",NULL);
|
Act_LinkFormSubmit (Txt_START_END_TIME_HELP[Order],"TIT_TBL",NULL);
|
||||||
if (Order == Gbl.Games.SelectedOrder)
|
if (Order == Gbl.Games.SelectedOrder)
|
||||||
|
@ -254,7 +257,10 @@ static void Gam_ListAllGames (void)
|
||||||
for (NumGame = Pagination.FirstItemVisible;
|
for (NumGame = Pagination.FirstItemVisible;
|
||||||
NumGame <= Pagination.LastItemVisible;
|
NumGame <= Pagination.LastItemVisible;
|
||||||
NumGame++)
|
NumGame++)
|
||||||
Gam_ShowOneGame (Gbl.Games.LstGamCods[NumGame - 1],false);
|
Gam_ShowOneGame (Gbl.Games.LstGamCods[NumGame - 1],
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false);
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
Tbl_EndTable ();
|
Tbl_EndTable ();
|
||||||
|
@ -271,7 +277,7 @@ static void Gam_ListAllGames (void)
|
||||||
|
|
||||||
/***** Write again links to pages *****/
|
/***** Write again links to pages *****/
|
||||||
if (Pagination.MoreThanOnePage)
|
if (Pagination.MoreThanOnePage)
|
||||||
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,
|
Pag_WriteLinksToPagesCentered (Pag_GAMES,
|
||||||
0,
|
0,
|
||||||
&Pagination);
|
&Pagination);
|
||||||
|
|
||||||
|
@ -354,7 +360,7 @@ static void Gam_PutParamsToCreateNewGame (void)
|
||||||
{
|
{
|
||||||
Gam_PutHiddenParamGameOrder ();
|
Gam_PutHiddenParamGameOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Gbl.Games.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -371,7 +377,7 @@ static void Gam_PutFormToSelectWhichGroupsToShow (void)
|
||||||
static void Gam_ParamsWhichGroupsToShow (void)
|
static void Gam_ParamsWhichGroupsToShow (void)
|
||||||
{
|
{
|
||||||
Gam_PutHiddenParamGameOrder ();
|
Gam_PutHiddenParamGameOrder ();
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Gbl.Games.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -385,21 +391,27 @@ void Gam_SeeOneGame (void)
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Gam_GetParamGameOrder ();
|
Gam_GetParamGameOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
|
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get game code *****/
|
||||||
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||||
|
|
||||||
/***** Show game *****/
|
/***** Show game *****/
|
||||||
Gam_ShowOneGame (Game.GamCod,true);
|
Gam_ShowOneGame (Game.GamCod,
|
||||||
|
true, // Show only this game
|
||||||
|
true, // List game questions
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Show one game ******************************/
|
/******************************* Show one game *******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
static void Gam_ShowOneGame (long GamCod,
|
||||||
|
bool ShowOnlyThisGame,
|
||||||
|
bool ListGameQuestions,
|
||||||
|
bool PutButtonToStart)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ASSESSMENT_Games;
|
extern const char *Hlp_ASSESSMENT_Games;
|
||||||
extern const char *Txt_Game;
|
extern const char *Txt_Game;
|
||||||
|
@ -421,7 +433,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
|
||||||
/***** Start box *****/
|
/***** Start box *****/
|
||||||
if (ShowOnlyThisGameComplete)
|
if (ShowOnlyThisGame)
|
||||||
Box_StartBox (NULL,Txt_Game,NULL,
|
Box_StartBox (NULL,Txt_Game,NULL,
|
||||||
Hlp_ASSESSMENT_Games,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Games,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
|
@ -430,14 +442,14 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Start table *****/
|
/***** Start table *****/
|
||||||
if (ShowOnlyThisGameComplete)
|
if (ShowOnlyThisGame)
|
||||||
Tbl_StartTableWide (2);
|
Tbl_StartTableWide (2);
|
||||||
|
|
||||||
/***** Write first row of data of this assignment *****/
|
/***** Write first row of data of this assignment *****/
|
||||||
/* Forms to remove/edit this assignment */
|
/* Forms to remove/edit this assignment */
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td rowspan=\"2\" class=\"CONTEXT_COL");
|
"<td rowspan=\"2\" class=\"CONTEXT_COL");
|
||||||
if (!ShowOnlyThisGameComplete)
|
if (!ShowOnlyThisGame)
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||||
fprintf (Gbl.F.Out,"\">");
|
fprintf (Gbl.F.Out,"\">");
|
||||||
if (Game.Status.ICanEdit)
|
if (Game.Status.ICanEdit)
|
||||||
|
@ -449,10 +461,10 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
fprintf (Gbl.F.Out,"<td id=\"gam_date_start_%u\" class=\"%s LEFT_TOP",
|
fprintf (Gbl.F.Out,"<td id=\"gam_date_start_%u\" class=\"%s LEFT_TOP",
|
||||||
UniqueId,
|
UniqueId,
|
||||||
Game.Status.Visible ? (Game.Status.Open ? "DATE_GREEN" :
|
Game.Status.Visible ? (Game.Status.Open ? "DATE_GREEN" :
|
||||||
"DATE_RED") :
|
"DATE_RED") :
|
||||||
(Game.Status.Open ? "DATE_GREEN_LIGHT" :
|
(Game.Status.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT"));
|
"DATE_RED_LIGHT"));
|
||||||
if (!ShowOnlyThisGameComplete)
|
if (!ShowOnlyThisGame)
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||||
fprintf (Gbl.F.Out,"\">"
|
fprintf (Gbl.F.Out,"\">"
|
||||||
"<script type=\"text/javascript\">"
|
"<script type=\"text/javascript\">"
|
||||||
|
@ -470,7 +482,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
"DATE_RED") :
|
"DATE_RED") :
|
||||||
(Game.Status.Open ? "DATE_GREEN_LIGHT" :
|
(Game.Status.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT"));
|
"DATE_RED_LIGHT"));
|
||||||
if (!ShowOnlyThisGameComplete)
|
if (!ShowOnlyThisGame)
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||||
fprintf (Gbl.F.Out,"\">"
|
fprintf (Gbl.F.Out,"\">"
|
||||||
"<script type=\"text/javascript\">"
|
"<script type=\"text/javascript\">"
|
||||||
|
@ -483,7 +495,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
|
|
||||||
/* Game title */
|
/* Game title */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP");
|
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP");
|
||||||
if (!ShowOnlyThisGameComplete)
|
if (!ShowOnlyThisGame)
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||||
fprintf (Gbl.F.Out,"\">");
|
fprintf (Gbl.F.Out,"\">");
|
||||||
|
|
||||||
|
@ -492,7 +504,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
Gam_PutParamGameCod (GamCod);
|
Gam_PutParamGameCod (GamCod);
|
||||||
Gam_PutHiddenParamGameOrder ();
|
Gam_PutHiddenParamGameOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Gbl.Games.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||||
Act_LinkFormSubmit (Txt_View_game,
|
Act_LinkFormSubmit (Txt_View_game,
|
||||||
Game.Status.Visible ? "ASG_TITLE" :
|
Game.Status.Visible ? "ASG_TITLE" :
|
||||||
"ASG_TITLE_LIGHT",NULL);
|
"ASG_TITLE_LIGHT",NULL);
|
||||||
|
@ -504,7 +516,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
fprintf (Gbl.F.Out,"<div class=\"%s\">%s: %u; %s: %u</div>"
|
fprintf (Gbl.F.Out,"<div class=\"%s\">%s: %u; %s: %u</div>"
|
||||||
"</td>",
|
"</td>",
|
||||||
Game.Status.Visible ? "ASG_GRP" :
|
Game.Status.Visible ? "ASG_GRP" :
|
||||||
"ASG_GRP_LIGHT",
|
"ASG_GRP_LIGHT",
|
||||||
Txt_No_of_questions,
|
Txt_No_of_questions,
|
||||||
Game.NumQsts,
|
Game.NumQsts,
|
||||||
Txt_No_of_users,
|
Txt_No_of_users,
|
||||||
|
@ -512,12 +524,12 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
|
|
||||||
/* Status of the game */
|
/* Status of the game */
|
||||||
fprintf (Gbl.F.Out,"<td rowspan=\"2\" class=\"LEFT_TOP");
|
fprintf (Gbl.F.Out,"<td rowspan=\"2\" class=\"LEFT_TOP");
|
||||||
if (!ShowOnlyThisGameComplete)
|
if (!ShowOnlyThisGame)
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||||
fprintf (Gbl.F.Out,"\">");
|
fprintf (Gbl.F.Out,"\">");
|
||||||
Gam_WriteStatus (&Game);
|
Gam_WriteStatus (&Game);
|
||||||
|
|
||||||
if (ShowOnlyThisGameComplete)
|
if (ShowOnlyThisGame)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"BUTTONS_AFTER_ALERT\">");
|
fprintf (Gbl.F.Out,"<div class=\"BUTTONS_AFTER_ALERT\">");
|
||||||
|
|
||||||
|
@ -525,7 +537,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
Gam_PutParamGameCod (Game.GamCod);
|
Gam_PutParamGameCod (Game.GamCod);
|
||||||
Gam_PutHiddenParamGameOrder ();
|
Gam_PutHiddenParamGameOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Gbl.Games.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||||
Btn_PutCreateButtonInline (Txt_Play);
|
Btn_PutCreateButtonInline (Txt_Play);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
|
|
||||||
|
@ -542,7 +554,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
Gam_PutParamGameCod (Game.GamCod);
|
Gam_PutParamGameCod (Game.GamCod);
|
||||||
Gam_PutHiddenParamGameOrder ();
|
Gam_PutHiddenParamGameOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Gbl.Games.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||||
Btn_PutCreateButtonInline (Txt_Play);
|
Btn_PutCreateButtonInline (Txt_Play);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
|
|
||||||
|
@ -557,7 +569,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
Gam_PutParamGameCod (Game.GamCod);
|
Gam_PutParamGameCod (Game.GamCod);
|
||||||
Gam_PutHiddenParamGameOrder ();
|
Gam_PutHiddenParamGameOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Gbl.Games.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||||
Btn_PutConfirmButtonInline (Txt_View_game_results);
|
Btn_PutConfirmButtonInline (Txt_View_game_results);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
|
|
||||||
|
@ -571,7 +583,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
/***** Write second row of data of this game *****/
|
/***** Write second row of data of this game *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td colspan=\"2\" class=\"LEFT_TOP");
|
"<td colspan=\"2\" class=\"LEFT_TOP");
|
||||||
if (!ShowOnlyThisGameComplete)
|
if (!ShowOnlyThisGame)
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||||
fprintf (Gbl.F.Out,"\">");
|
fprintf (Gbl.F.Out,"\">");
|
||||||
|
|
||||||
|
@ -580,14 +592,14 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"<td class=\"LEFT_TOP");
|
"<td class=\"LEFT_TOP");
|
||||||
if (!ShowOnlyThisGameComplete)
|
if (!ShowOnlyThisGame)
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||||
fprintf (Gbl.F.Out,"\">");
|
fprintf (Gbl.F.Out,"\">");
|
||||||
|
|
||||||
/* Scope of the game */
|
/* Scope of the game */
|
||||||
fprintf (Gbl.F.Out,"<div class=\"%s\">%s: ",
|
fprintf (Gbl.F.Out,"<div class=\"%s\">%s: ",
|
||||||
Game.Status.Visible ? "ASG_GRP" :
|
Game.Status.Visible ? "ASG_GRP" :
|
||||||
"ASG_GRP_LIGHT",
|
"ASG_GRP_LIGHT",
|
||||||
Txt_Scope);
|
Txt_Scope);
|
||||||
switch (Game.Scope)
|
switch (Game.Scope)
|
||||||
{
|
{
|
||||||
|
@ -624,7 +636,7 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
/* Users' roles who can answer the game */
|
/* Users' roles who can answer the game */
|
||||||
fprintf (Gbl.F.Out,"<div class=\"%s\">%s:<br />",
|
fprintf (Gbl.F.Out,"<div class=\"%s\">%s:<br />",
|
||||||
Game.Status.Visible ? "ASG_GRP" :
|
Game.Status.Visible ? "ASG_GRP" :
|
||||||
"ASG_GRP_LIGHT",
|
"ASG_GRP_LIGHT",
|
||||||
Txt_Users);
|
Txt_Users);
|
||||||
Rol_WriteSelectorRoles (1 << Rol_STD |
|
Rol_WriteSelectorRoles (1 << Rol_STD |
|
||||||
1 << Rol_NET |
|
1 << Rol_NET |
|
||||||
|
@ -649,11 +661,11 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Game.Status.Visible ? "DAT" :
|
Game.Status.Visible ? "DAT" :
|
||||||
"DAT_LIGHT",
|
"DAT_LIGHT",
|
||||||
Txt);
|
Txt);
|
||||||
|
|
||||||
/***** Write questions of this game *****/
|
/***** Write questions of this game *****/
|
||||||
if (ShowOnlyThisGameComplete)
|
if (ListGameQuestions)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td colspan=\"5\">");
|
"<td colspan=\"5\">");
|
||||||
|
@ -662,22 +674,19 @@ static void Gam_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
|
||||||
"</tr>");
|
"</tr>");
|
||||||
}
|
}
|
||||||
|
|
||||||
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
/***** End table *****/
|
||||||
|
if (ShowOnlyThisGame)
|
||||||
/***** Mark possible notification as seen *****/
|
|
||||||
if (Game.Scope == Sco_SCOPE_CRS) // Only course games are notified
|
|
||||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_SURVEY,
|
|
||||||
GamCod,Game.Cod,
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
if (ShowOnlyThisGameComplete)
|
|
||||||
{
|
|
||||||
/***** End table *****/
|
|
||||||
Tbl_EndTable ();
|
Tbl_EndTable ();
|
||||||
|
else
|
||||||
|
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
||||||
|
|
||||||
/***** End box *****/
|
/***** Put big button to start playing *****/
|
||||||
|
if (PutButtonToStart)
|
||||||
|
Gam_PutBigButtonToStartGame ();
|
||||||
|
|
||||||
|
/***** End box *****/
|
||||||
|
if (ShowOnlyThisGame)
|
||||||
Box_EndBox ();
|
Box_EndBox ();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -837,7 +846,7 @@ static void Gam_PutParams (void)
|
||||||
Gam_PutParamGameCod (Gbl.Games.CurrentGamCod);
|
Gam_PutParamGameCod (Gbl.Games.CurrentGamCod);
|
||||||
Att_PutHiddenParamAttOrder ();
|
Att_PutHiddenParamAttOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Gbl.Games.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1415,52 +1424,6 @@ static void Gam_GetGameTxtFromDB (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1])
|
||||||
Lay_ShowErrorAndExit ("Error when getting game text.");
|
Lay_ShowErrorAndExit ("Error when getting game text.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******************** Get summary and content of a game *******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
// This function may be called inside a web service, so don't report error
|
|
||||||
|
|
||||||
void Gam_GetNotifGame (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|
||||||
char **ContentStr,
|
|
||||||
long GamCod,bool GetContent)
|
|
||||||
{
|
|
||||||
char Query[128];
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
size_t Length;
|
|
||||||
|
|
||||||
SummaryStr[0] = '\0'; // Return nothing on error
|
|
||||||
|
|
||||||
/***** Build query *****/
|
|
||||||
sprintf (Query,"SELECT Title,Txt FROM games WHERE GamCod=%ld",
|
|
||||||
GamCod);
|
|
||||||
if (!mysql_query (&Gbl.mysql,Query))
|
|
||||||
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
|
|
||||||
{
|
|
||||||
/***** Result should have a unique row *****/
|
|
||||||
if (mysql_num_rows (mysql_res) == 1)
|
|
||||||
{
|
|
||||||
/***** Get row *****/
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
/***** Get summary *****/
|
|
||||||
Str_Copy (SummaryStr,row[0],
|
|
||||||
Ntf_MAX_BYTES_SUMMARY);
|
|
||||||
|
|
||||||
/***** Get content *****/
|
|
||||||
if (GetContent)
|
|
||||||
{
|
|
||||||
Length = strlen (row[1]);
|
|
||||||
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
|
|
||||||
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
|
|
||||||
Str_Copy (*ContentStr,row[1],
|
|
||||||
Length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mysql_free_result (mysql_res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Write parameter with code of game *********************/
|
/******************* Write parameter with code of game *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1493,7 +1456,7 @@ void Gam_AskRemGame (void)
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Gam_GetParamGameOrder ();
|
Gam_GetParamGameOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
|
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get game code *****/
|
||||||
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
|
@ -1554,9 +1517,6 @@ void Gam_RemoveGame (void)
|
||||||
Game.GamCod);
|
Game.GamCod);
|
||||||
DB_QueryDELETE (Query,"can not remove game");
|
DB_QueryDELETE (Query,"can not remove game");
|
||||||
|
|
||||||
/***** Mark possible notifications as removed *****/
|
|
||||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_SURVEY,Game.GamCod);
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
sprintf (Gbl.Alert.Txt,Txt_Game_X_removed,
|
sprintf (Gbl.Alert.Txt,Txt_Game_X_removed,
|
||||||
Game.Title);
|
Game.Title);
|
||||||
|
@ -1578,7 +1538,7 @@ void Gam_AskResetGame (void)
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Gam_GetParamGameOrder ();
|
Gam_GetParamGameOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
|
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get game code *****/
|
||||||
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
|
@ -1764,7 +1724,7 @@ void Gam_RequestCreatOrEditGame (void)
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Gam_GetParamGameOrder ();
|
Gam_GetParamGameOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
|
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
|
||||||
|
|
||||||
/***** Get the code of the game *****/
|
/***** Get the code of the game *****/
|
||||||
ItsANewGame = ((Game.GamCod = Gam_GetParamGameCod ()) == -1L);
|
ItsANewGame = ((Game.GamCod = Gam_GetParamGameCod ()) == -1L);
|
||||||
|
@ -2061,7 +2021,6 @@ void Gam_RecFormGame (void)
|
||||||
struct Game NewGame;
|
struct Game NewGame;
|
||||||
bool ItsANewGame;
|
bool ItsANewGame;
|
||||||
bool NewGameIsCorrect = true;
|
bool NewGameIsCorrect = true;
|
||||||
unsigned NumUsrsToBeNotifiedByEMail;
|
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
|
||||||
/***** Get the code of the game *****/
|
/***** Get the code of the game *****/
|
||||||
|
@ -2183,31 +2142,10 @@ void Gam_RecFormGame (void)
|
||||||
else
|
else
|
||||||
Gam_RequestCreatOrEditGame ();
|
Gam_RequestCreatOrEditGame ();
|
||||||
|
|
||||||
/***** Notify by email about the new game *****/
|
|
||||||
if (NewGame.Scope == Sco_SCOPE_CRS) // Notify only the games for a course, not for a degree or global
|
|
||||||
if ((NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_SURVEY,NewGame.GamCod)))
|
|
||||||
Gam_UpdateNumUsrsNotifiedByEMailAboutGame (NewGame.GamCod,NumUsrsToBeNotifiedByEMail);
|
|
||||||
|
|
||||||
/***** Show games again *****/
|
/***** Show games again *****/
|
||||||
Gam_ListAllGames ();
|
Gam_ListAllGames ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Update number of users notified in table of games **************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Gam_UpdateNumUsrsNotifiedByEMailAboutGame (long GamCod,
|
|
||||||
unsigned NumUsrsToBeNotifiedByEMail)
|
|
||||||
{
|
|
||||||
char Query[256];
|
|
||||||
|
|
||||||
/***** Update number of users notified *****/
|
|
||||||
sprintf (Query,"UPDATE games SET NumNotif=NumNotif+%u"
|
|
||||||
" WHERE GamCod=%ld",
|
|
||||||
NumUsrsToBeNotifiedByEMail,GamCod);
|
|
||||||
DB_QueryUPDATE (Query,"can not update the number of notifications of a game");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************************** Create a new game ******************************/
|
/**************************** Create a new game ******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2552,13 +2490,16 @@ void Gam_RequestNewQuestion (void)
|
||||||
/***** Get other parameters *****/
|
/***** Get other parameters *****/
|
||||||
Gam_GetParamGameOrder ();
|
Gam_GetParamGameOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
|
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
|
||||||
|
|
||||||
/***** Show form to create a new question in this game *****/
|
/***** Show form to create a new question in this game *****/
|
||||||
Tst_ShowFormAskSelectTstsForGame (Game.GamCod);
|
Tst_ShowFormAskSelectTstsForGame (Game.GamCod);
|
||||||
|
|
||||||
/***** Show current game *****/
|
/***** Show current game *****/
|
||||||
Gam_ShowOneGame (Game.GamCod,true);
|
Gam_ShowOneGame (Game.GamCod,
|
||||||
|
true, // Show only this game
|
||||||
|
true, // List game questions
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3083,7 +3024,10 @@ void Gam_AddTstQuestionsToGame (void)
|
||||||
Gam_FreeListsSelectedQuestions ();
|
Gam_FreeListsSelectedQuestions ();
|
||||||
|
|
||||||
/***** Show current game *****/
|
/***** Show current game *****/
|
||||||
Gam_ShowOneGame (Game.GamCod,true);
|
Gam_ShowOneGame (Game.GamCod,
|
||||||
|
true, // Show only this game
|
||||||
|
true, // List game questions
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3274,7 +3218,10 @@ void Gam_RequestRemoveQst (void)
|
||||||
Btn_REMOVE_BUTTON,Txt_Remove_question);
|
Btn_REMOVE_BUTTON,Txt_Remove_question);
|
||||||
|
|
||||||
/***** Show current game *****/
|
/***** Show current game *****/
|
||||||
Gam_ShowOneGame (Game.GamCod,true);
|
Gam_ShowOneGame (Game.GamCod,
|
||||||
|
true, // Show only this game
|
||||||
|
true, // List game questions
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3323,7 +3270,10 @@ void Gam_RemoveQst (void)
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
|
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
|
||||||
|
|
||||||
/***** Show current game *****/
|
/***** Show current game *****/
|
||||||
Gam_ShowOneGame (Game.GamCod,true);
|
Gam_ShowOneGame (Game.GamCod,
|
||||||
|
true, // Show only this game
|
||||||
|
true, // List game questions
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3365,7 +3315,10 @@ void Gam_MoveUpQst (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Show current game *****/
|
/***** Show current game *****/
|
||||||
Gam_ShowOneGame (Game.GamCod,true);
|
Gam_ShowOneGame (Game.GamCod,
|
||||||
|
true, // Show only this game
|
||||||
|
true, // List game questions
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3411,7 +3364,10 @@ void Gam_MoveDownQst (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Show current game *****/
|
/***** Show current game *****/
|
||||||
Gam_ShowOneGame (Game.GamCod,true);
|
Gam_ShowOneGame (Game.GamCod,
|
||||||
|
true, // Show only this game
|
||||||
|
true, // List game questions
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3476,14 +3432,40 @@ void Gam_PlayGame (void)
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Gam_GetParamGameOrder ();
|
Gam_GetParamGameOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
|
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get game code *****/
|
||||||
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||||
|
|
||||||
/***** Show game *****/
|
/***** Show game *****/
|
||||||
Gam_ShowOneGame (Game.GamCod,true);
|
Gam_ShowOneGame (Game.GamCod,
|
||||||
|
true, // Show only this game
|
||||||
|
false,
|
||||||
|
true); // Put button to start
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************* Put a big button to start game ************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Gam_PutBigButtonToStartGame (void)
|
||||||
|
{
|
||||||
|
extern const char *Txt_Play;
|
||||||
|
|
||||||
|
/***** Start form *****/
|
||||||
|
Act_FormStart (ActPlyGam);
|
||||||
|
Gam_PutParams ();
|
||||||
|
|
||||||
|
/***** Put icon with link *****/
|
||||||
|
Act_LinkFormSubmit (Txt_Play,NULL,NULL);
|
||||||
|
fprintf (Gbl.F.Out,"<img src=\"%s/play64x64.png\" alt=\"%s\" title=\"%s\""
|
||||||
|
" class=\"CONTEXT_OPT ICO_HIGHLIGHT ICO64x64\" />",
|
||||||
|
Gbl.Prefs.IconsURL,Txt_Play,Txt_Play);
|
||||||
|
fprintf (Gbl.F.Out,"</a>");
|
||||||
|
|
||||||
|
/***** End form *****/
|
||||||
|
Act_FormEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3514,7 +3496,10 @@ void Gam_ReceiveGameAnswers (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Show current game *****/
|
/***** Show current game *****/
|
||||||
Gam_ShowOneGame (Game.GamCod,true);
|
Gam_ShowOneGame (Game.GamCod,
|
||||||
|
true, // Show only this game
|
||||||
|
true, // List game questions
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3736,7 +3721,7 @@ unsigned Gam_GetNumCoursesWithCrsGames (Sco_Scope_t Scope)
|
||||||
// Returns the number of games for courses
|
// Returns the number of games for courses
|
||||||
// in this location (all the platform, current degree or current course)
|
// in this location (all the platform, current degree or current course)
|
||||||
|
|
||||||
unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope,unsigned *NumNotif)
|
unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope)
|
||||||
{
|
{
|
||||||
extern const char *Sco_ScopeDB[Sco_NUM_SCOPES];
|
extern const char *Sco_ScopeDB[Sco_NUM_SCOPES];
|
||||||
char Query[1024];
|
char Query[1024];
|
||||||
|
@ -3748,13 +3733,13 @@ unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope,unsigned *NumNotif)
|
||||||
switch (Scope)
|
switch (Scope)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
sprintf (Query,"SELECT COUNT(*)"
|
||||||
" FROM games"
|
" FROM games"
|
||||||
" WHERE Scope='%s'",
|
" WHERE Scope='%s'",
|
||||||
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
sprintf (Query,"SELECT COUNT(*),SUM(games.NumNotif)"
|
sprintf (Query,"SELECT COUNT(*)"
|
||||||
" FROM institutions,centres,degrees,courses,games"
|
" FROM institutions,centres,degrees,courses,games"
|
||||||
" WHERE institutions.CtyCod=%ld"
|
" WHERE institutions.CtyCod=%ld"
|
||||||
" AND institutions.InsCod=centres.InsCod"
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
|
@ -3766,7 +3751,7 @@ unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope,unsigned *NumNotif)
|
||||||
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
sprintf (Query,"SELECT COUNT(*),SUM(games.NumNotif)"
|
sprintf (Query,"SELECT COUNT(*)"
|
||||||
" FROM centres,degrees,courses,games"
|
" FROM centres,degrees,courses,games"
|
||||||
" WHERE centres.InsCod=%ld"
|
" WHERE centres.InsCod=%ld"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
|
@ -3777,7 +3762,7 @@ unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope,unsigned *NumNotif)
|
||||||
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
sprintf (Query,"SELECT COUNT(*),SUM(games.NumNotif)"
|
sprintf (Query,"SELECT COUNT(*)"
|
||||||
" FROM degrees,courses,games"
|
" FROM degrees,courses,games"
|
||||||
" WHERE degrees.CtrCod=%ld"
|
" WHERE degrees.CtrCod=%ld"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
|
@ -3787,7 +3772,7 @@ unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope,unsigned *NumNotif)
|
||||||
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
sprintf (Query,"SELECT COUNT(*),SUM(games.NumNotif)"
|
sprintf (Query,"SELECT COUNT(*)"
|
||||||
" FROM courses,games"
|
" FROM courses,games"
|
||||||
" WHERE courses.DegCod=%ld"
|
" WHERE courses.DegCod=%ld"
|
||||||
" AND courses.CrsCod=games.Cod"
|
" AND courses.CrsCod=games.Cod"
|
||||||
|
@ -3796,7 +3781,7 @@ unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope,unsigned *NumNotif)
|
||||||
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
Sco_ScopeDB[Sco_SCOPE_CRS]);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
sprintf (Query,"SELECT COUNT(*)"
|
||||||
" FROM games"
|
" FROM games"
|
||||||
" WHERE games.Scope='%s'"
|
" WHERE games.Scope='%s'"
|
||||||
" AND CrsCod=%ld",
|
" AND CrsCod=%ld",
|
||||||
|
@ -3814,15 +3799,6 @@ unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope,unsigned *NumNotif)
|
||||||
if (sscanf (row[0],"%u",&NumGames) != 1)
|
if (sscanf (row[0],"%u",&NumGames) != 1)
|
||||||
Lay_ShowErrorAndExit ("Error when getting number of games.");
|
Lay_ShowErrorAndExit ("Error when getting number of games.");
|
||||||
|
|
||||||
/***** Get number of notifications by email *****/
|
|
||||||
if (row[1])
|
|
||||||
{
|
|
||||||
if (sscanf (row[1],"%u",NumNotif) != 1)
|
|
||||||
Lay_ShowErrorAndExit ("Error when getting number of notifications of games.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*NumNotif = 0;
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
/********************************* Headers ***********************************/
|
/********************************* Headers ***********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#include "swad_notification.h"
|
|
||||||
#include "swad_scope.h"
|
#include "swad_scope.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -96,9 +95,7 @@ void Gam_GetListGames (void);
|
||||||
void Gam_GetDataOfGameByCod (struct Game *Gam);
|
void Gam_GetDataOfGameByCod (struct Game *Gam);
|
||||||
void Gam_GetDataOfGameByFolder (struct Game *Gam);
|
void Gam_GetDataOfGameByFolder (struct Game *Gam);
|
||||||
void Gam_FreeListGames (void);
|
void Gam_FreeListGames (void);
|
||||||
void Gam_GetNotifGame (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|
||||||
char **ContentStr,
|
|
||||||
long GamCod,bool GetContent);
|
|
||||||
void Gam_PutParamGameCod (long GamCod);
|
void Gam_PutParamGameCod (long GamCod);
|
||||||
long Gam_GetParamGameCod (void);
|
long Gam_GetParamGameCod (void);
|
||||||
void Gam_AskRemGame (void);
|
void Gam_AskRemGame (void);
|
||||||
|
@ -130,7 +127,7 @@ void Gam_PlayGame (void);
|
||||||
void Gam_ReceiveGameAnswers (void);
|
void Gam_ReceiveGameAnswers (void);
|
||||||
|
|
||||||
unsigned Gam_GetNumCoursesWithCrsGames (Sco_Scope_t Scope);
|
unsigned Gam_GetNumCoursesWithCrsGames (Sco_Scope_t Scope);
|
||||||
unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope,unsigned *NumNotif);
|
unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope);
|
||||||
float Gam_GetNumQstsPerCrsGame (Sco_Scope_t Scope);
|
float Gam_GetNumQstsPerCrsGame (Sco_Scope_t Scope);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -48,6 +48,7 @@ extern const Act_Action_t For_ActionsSeePstFor[For_NUM_TYPES_FORUM];
|
||||||
static const char *Pag_ParamNumPag[Pag_NUM_WHAT_PAGINATE] =
|
static const char *Pag_ParamNumPag[Pag_NUM_WHAT_PAGINATE] =
|
||||||
{
|
{
|
||||||
"NumPagAsg", // Pag_ASSIGNMENTS
|
"NumPagAsg", // Pag_ASSIGNMENTS
|
||||||
|
"NumPagGam", // Pag_GAMES
|
||||||
"NumPagSvy", // Pag_SURVEYS
|
"NumPagSvy", // Pag_SURVEYS
|
||||||
"NumPagAtt", // Pag_ATT_EVENTS
|
"NumPagAtt", // Pag_ATT_EVENTS
|
||||||
"NumPagThr", // Pag_THREADS_FORUM
|
"NumPagThr", // Pag_THREADS_FORUM
|
||||||
|
@ -159,6 +160,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
||||||
Asg_PutHiddenParamAsgOrder ();
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
break;
|
break;
|
||||||
|
case Pag_GAMES:
|
||||||
|
Act_FormStartAnchor (ActSeeAllGam,Pagination->Anchor);
|
||||||
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
||||||
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
|
Grp_PutParamWhichGrps ();
|
||||||
|
break;
|
||||||
case Pag_SURVEYS:
|
case Pag_SURVEYS:
|
||||||
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
||||||
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
||||||
|
@ -254,6 +261,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
||||||
Asg_PutHiddenParamAsgOrder ();
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
break;
|
break;
|
||||||
|
case Pag_GAMES:
|
||||||
|
Act_FormStartAnchor (ActSeeAllGam,Pagination->Anchor);
|
||||||
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
||||||
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
|
Grp_PutParamWhichGrps ();
|
||||||
|
break;
|
||||||
case Pag_SURVEYS:
|
case Pag_SURVEYS:
|
||||||
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
||||||
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
||||||
|
@ -335,6 +348,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
||||||
Asg_PutHiddenParamAsgOrder ();
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
break;
|
break;
|
||||||
|
case Pag_GAMES:
|
||||||
|
Act_FormStartAnchor (ActSeeAllGam,Pagination->Anchor);
|
||||||
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
||||||
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
|
Grp_PutParamWhichGrps ();
|
||||||
|
break;
|
||||||
case Pag_SURVEYS:
|
case Pag_SURVEYS:
|
||||||
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
||||||
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
||||||
|
@ -427,6 +446,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
||||||
Asg_PutHiddenParamAsgOrder ();
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
break;
|
break;
|
||||||
|
case Pag_GAMES:
|
||||||
|
Act_FormStartAnchor (ActSeeAllGam,Pagination->Anchor);
|
||||||
|
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
||||||
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
|
Grp_PutParamWhichGrps ();
|
||||||
|
break;
|
||||||
case Pag_SURVEYS:
|
case Pag_SURVEYS:
|
||||||
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
||||||
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
||||||
|
@ -507,6 +532,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
||||||
Asg_PutHiddenParamAsgOrder ();
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
break;
|
break;
|
||||||
|
case Pag_GAMES:
|
||||||
|
Act_FormStartAnchor (ActSeeAllGam,Pagination->Anchor);
|
||||||
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
||||||
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
|
Grp_PutParamWhichGrps ();
|
||||||
|
break;
|
||||||
case Pag_SURVEYS:
|
case Pag_SURVEYS:
|
||||||
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
||||||
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
||||||
|
@ -586,6 +617,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
||||||
Asg_PutHiddenParamAsgOrder ();
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
break;
|
break;
|
||||||
|
case Pag_GAMES:
|
||||||
|
Act_FormStartAnchor (ActSeeAllGam,Pagination->Anchor);
|
||||||
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
||||||
|
Asg_PutHiddenParamAsgOrder ();
|
||||||
|
Grp_PutParamWhichGrps ();
|
||||||
|
break;
|
||||||
case Pag_SURVEYS:
|
case Pag_SURVEYS:
|
||||||
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
Act_FormStartAnchor (ActSeeAllSvy,Pagination->Anchor);
|
||||||
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
||||||
|
|
|
@ -37,18 +37,19 @@
|
||||||
/******************************** Public types *******************************/
|
/******************************** Public types *******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Pag_NUM_WHAT_PAGINATE 9
|
#define Pag_NUM_WHAT_PAGINATE 10
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Pag_ASSIGNMENTS = 0,
|
Pag_ASSIGNMENTS = 0,
|
||||||
Pag_SURVEYS = 1,
|
Pag_GAMES = 1,
|
||||||
Pag_ATT_EVENTS = 2,
|
Pag_SURVEYS = 2,
|
||||||
Pag_THREADS_FORUM = 3,
|
Pag_ATT_EVENTS = 3,
|
||||||
Pag_POSTS_FORUM = 4,
|
Pag_THREADS_FORUM = 4,
|
||||||
Pag_MESSAGES_RECEIVED = 5,
|
Pag_POSTS_FORUM = 5,
|
||||||
Pag_MESSAGES_SENT = 6,
|
Pag_MESSAGES_RECEIVED = 6,
|
||||||
Pag_MY_AGENDA = 7,
|
Pag_MESSAGES_SENT = 7,
|
||||||
Pag_ANOTHER_AGENDA = 8,
|
Pag_MY_AGENDA = 8,
|
||||||
|
Pag_ANOTHER_AGENDA = 9,
|
||||||
} Pag_WhatPaginate_t;
|
} Pag_WhatPaginate_t;
|
||||||
|
|
||||||
struct Pagination // Used for threads and messages pagination
|
struct Pagination // Used for threads and messages pagination
|
||||||
|
|
Loading…
Reference in New Issue