mirror of https://github.com/acanas/swad-core.git
Version19.18.1
This commit is contained in:
parent
33b62e9a82
commit
f6d93a3c57
|
@ -471,10 +471,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.18 (2019-09-28)"
|
#define Log_PLATFORM_VERSION "SWAD 19.18.1 (2019-09-28)"
|
||||||
#define CSS_FILE "swad19.15.css"
|
#define CSS_FILE "swad19.15.css"
|
||||||
#define JS_FILE "swad19.15.js"
|
#define JS_FILE "swad19.15.js"
|
||||||
/*
|
/*
|
||||||
|
Version 19.18.1: Sep 28, 2019 Students will not see hidden games. (246571 lines)
|
||||||
Version 19.18: Sep 28, 2019 New module swad_match_result for match results. (246540 lines)
|
Version 19.18: Sep 28, 2019 New module swad_match_result for match results. (246540 lines)
|
||||||
Version 19.17.3: Sep 28, 2019 Code refactoring removing matches and games. (246446 lines)
|
Version 19.17.3: Sep 28, 2019 Code refactoring removing matches and games. (246446 lines)
|
||||||
Version 19.17.2: Sep 27, 2019 Code refactoring removing matches and games. (246448 lines)
|
Version 19.17.2: Sep 27, 2019 Code refactoring removing matches and games. (246448 lines)
|
||||||
|
|
41
swad_game.c
41
swad_game.c
|
@ -175,7 +175,12 @@ static void Gam_ListAllGames (void)
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Mch_PutFormToViewMchResults (ActReqSeeUsrMchRes);
|
Mch_PutFormToViewMchResults (ActReqSeeUsrMchRes);
|
||||||
break;
|
break;
|
||||||
|
case Rol_DEG_ADM:
|
||||||
|
case Rol_CTR_ADM:
|
||||||
|
case Rol_INS_ADM:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
Lay_ShowErrorAndExit ("Wrong role.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,6 +635,7 @@ void Gam_GetListGames (void)
|
||||||
};
|
};
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
char *HiddenSubQuery;
|
||||||
unsigned long NumRows = 0; // Initialized to avoid warning
|
unsigned long NumRows = 0; // Initialized to avoid warning
|
||||||
unsigned NumGame;
|
unsigned NumGame;
|
||||||
|
|
||||||
|
@ -637,19 +643,46 @@ void Gam_GetListGames (void)
|
||||||
if (Gbl.Games.LstIsRead)
|
if (Gbl.Games.LstIsRead)
|
||||||
Gam_FreeListGames ();
|
Gam_FreeListGames ();
|
||||||
|
|
||||||
|
/***** Subquery: get hidden games depending on user's role *****/
|
||||||
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
|
{
|
||||||
|
case Rol_STD:
|
||||||
|
if (asprintf (&HiddenSubQuery," AND Hidden='N'") < 0)
|
||||||
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
break;
|
||||||
|
case Rol_NET:
|
||||||
|
case Rol_TCH:
|
||||||
|
case Rol_DEG_ADM:
|
||||||
|
case Rol_CTR_ADM:
|
||||||
|
case Rol_INS_ADM:
|
||||||
|
case Rol_SYS_ADM:
|
||||||
|
if (asprintf (&HiddenSubQuery,"%s","") < 0)
|
||||||
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Lay_ShowErrorAndExit ("Wrong role.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/***** Get list of games from database *****/
|
/***** Get list of games from database *****/
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get games",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get games",
|
||||||
"SELECT gam_games.GamCod,"
|
"SELECT gam_games.GamCod," // row[0]
|
||||||
"MIN(mch_matches.StartTime) AS StartTime,"
|
"MIN(mch_matches.StartTime) AS StartTime," // row[1]
|
||||||
"MAX(mch_matches.EndTime) AS EndTime"
|
"MAX(mch_matches.EndTime) AS EndTime" // row[2]
|
||||||
" FROM gam_games"
|
" FROM gam_games"
|
||||||
" LEFT JOIN mch_matches"
|
" LEFT JOIN mch_matches"
|
||||||
" ON gam_games.GamCod=mch_matches.GamCod"
|
" ON gam_games.GamCod=mch_matches.GamCod"
|
||||||
" WHERE gam_games.CrsCod=%ld"
|
" WHERE gam_games.CrsCod=%ld"
|
||||||
|
"%s"
|
||||||
" GROUP BY gam_games.GamCod"
|
" GROUP BY gam_games.GamCod"
|
||||||
" ORDER BY %s",
|
" ORDER BY %s",
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
|
HiddenSubQuery,
|
||||||
OrderBySubQuery[Gbl.Games.SelectedOrder]);
|
OrderBySubQuery[Gbl.Games.SelectedOrder]);
|
||||||
|
|
||||||
|
/***** Free allocated memory for subquery *****/
|
||||||
|
free ((void *) HiddenSubQuery);
|
||||||
|
|
||||||
if (NumRows) // Games found...
|
if (NumRows) // Games found...
|
||||||
{
|
{
|
||||||
Gbl.Games.Num = (unsigned) NumRows;
|
Gbl.Games.Num = (unsigned) NumRows;
|
||||||
|
@ -663,7 +696,7 @@ void Gam_GetListGames (void)
|
||||||
NumGame < Gbl.Games.Num;
|
NumGame < Gbl.Games.Num;
|
||||||
NumGame++)
|
NumGame++)
|
||||||
{
|
{
|
||||||
/* Get next game code */
|
/* Get next game code (row[0]) */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Gbl.Games.LstGamCods[NumGame] = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
if ((Gbl.Games.LstGamCods[NumGame] = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Error: wrong game code.");
|
Lay_ShowErrorAndExit ("Error: wrong game code.");
|
||||||
|
|
Loading…
Reference in New Issue