Version 22.25: Sep 23, 2022 New module swad_game_resource.

This commit is contained in:
acanas 2022-09-23 22:57:42 +02:00
parent 1aeaeb5bf3
commit ba6a4f71b6
7 changed files with 13 additions and 101 deletions

View File

@ -53,10 +53,11 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \
swad_file_database.o swad_file_extension.o swad_file_MIME.o \
swad_firewall.o swad_firewall_database.o swad_follow.o \
swad_follow_database.o swad_form.o swad_forum.o swad_forum_database.o \
swad_game.o swad_game_database.o swad_global.o swad_group.o \
swad_group_database.o swad_help.o swad_hierarchy.o \
swad_hierarchy_config.o swad_hierarchy_database.o swad_holiday.o \
swad_holiday_database.o swad_HTML.o \
swad_game.o swad_game_database.o swad_game_resource.o swad_global.o \
swad_group.o swad_group_database.o \
swad_help.o swad_hierarchy.o swad_hierarchy_config.o \
swad_hierarchy_database.o swad_holiday.o swad_holiday_database.o \
swad_HTML.o \
swad_icon.o swad_ID.o swad_ID_database.o swad_indicator.o \
swad_indicator_database.o swad_info.o swad_info_database.o \
swad_institution.o swad_institution_config.o \

View File

@ -61,6 +61,7 @@
#include "swad_follow.h"
#include "swad_forum.h"
#include "swad_game.h"
#include "swad_game_resource.h"
#include "swad_global.h"
#include "swad_group_database.h"
#include "swad_hierarchy.h"

View File

@ -606,10 +606,11 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate
TODO: Attach pdf files in multimedia.
*/
#define Log_PLATFORM_VERSION "SWAD 22.24 (2022-09-23)"
#define Log_PLATFORM_VERSION "SWAD 22.25 (2022-09-23)"
#define CSS_FILE "swad22.22.1.css"
#define JS_FILE "swad21.100.js"
/*
Version 22.25: Sep 23, 2022 New module swad_game_resource. (332037 lines)
Version 22.24: Sep 23, 2022 New module swad_exam_resource. (331980 lines)
Version 22.23: Sep 23, 2022 New module swad_call_for_exam_resource. (331924 lines)
Version 22.22.1: Sep 23, 2022 Changes in layout of course program. (331875 lines)

View File

@ -106,7 +106,6 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/
/*****************************************************************************/
static void Gam_ListAllGames (struct Gam_Games *Games);
static bool Gam_CheckIfICanEditGames (void);
static bool Gam_CheckIfICanListGameQuestions (void);
static void Gam_PutIconsListGames (void *Games);
@ -223,7 +222,7 @@ void Gam_SeeAllGames (void)
/******************************* Show all games ******************************/
/*****************************************************************************/
static void Gam_ListAllGames (struct Gam_Games *Games)
void Gam_ListAllGames (struct Gam_Games *Games)
{
extern const char *Hlp_ASSESSMENT_Games;
extern const char *Txt_Games;
@ -2351,90 +2350,3 @@ void Gam_GetAndShowGamesStats (void)
/***** End table and box *****/
Box_BoxTableEnd ();
}
/*****************************************************************************/
/***************************** Get link to game ******************************/
/*****************************************************************************/
void Gam_GetLinkToGame (void)
{
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
struct Gam_Games Games;
long GamCod;
char Title[Gam_MAX_BYTES_TITLE + 1];
/***** Reset games context *****/
Gam_ResetGames (&Games);
/***** Get parameters *****/
if ((GamCod = Gam_GetParams (&Games)) <= 0)
Err_WrongGameExit ();
/***** Get game title *****/
Gam_DB_GetGameTitle (GamCod,Title);
/***** Copy link to game into resource clipboard *****/
Prg_DB_CopyToClipboard (PrgRsc_GAME,GamCod);
/***** Write sucess message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
Title);
/***** Show games again *****/
Gam_ListAllGames (&Games);
}
/*****************************************************************************/
/*********************** Write game in course program ************************/
/*****************************************************************************/
void GamRsc_WriteGameInCrsProgram (long GamCod,bool PutFormToGo,
const char *Icon,const char *IconTitle)
{
extern const char *Txt_Actions[Act_NUM_ACTIONS];
char Title[Gam_MAX_BYTES_TITLE + 1];
/***** Get game title *****/
Gam_DB_GetGameTitle (GamCod,Title);
/***** Begin form to go to game *****/
if (PutFormToGo)
{
Frm_BeginForm (ActSeeGam);
Gam_PutParamGameCod (GamCod);
HTM_BUTTON_Submit_Begin (Txt_Actions[ActSeeGam],
"class=\"LM BT_LINK PRG_LNK_%s\"",
The_GetSuffix ());
}
/***** Icon depending on type ******/
if (PutFormToGo)
Ico_PutIconLink (Icon,Ico_BLACK,ActSeeGam);
else
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
/***** Write game title of exam *****/
HTM_Txt (Title);
/***** End form to download file *****/
if (PutFormToGo)
{
/* End form */
HTM_BUTTON_End ();
Frm_EndForm ();
}
}
/*****************************************************************************/
/*********************** Get game title from game code ***********************/
/*****************************************************************************/
void GamRsc_GetTitleFromGamCod (long GamCod,char *Title,size_t TitleSize)
{
char TitleFromDB[Gam_MAX_BYTES_TITLE + 1];
/***** Get game title *****/
Gam_DB_GetGameTitle (GamCod,TitleFromDB);
Str_Copy (Title,TitleFromDB,TitleSize);
}

View File

@ -107,6 +107,7 @@ void Gam_ResetGames (struct Gam_Games *Games);
void Gam_ResetGame (struct Gam_Game *Game);
void Gam_SeeAllGames (void);
void Gam_ListAllGames (struct Gam_Games *Games);
void Gam_SeeOneGame (void);
void Gam_ShowOnlyOneGame (struct Gam_Games *Games,
struct Gam_Game *Game,
@ -167,10 +168,4 @@ void Gam_GetScoreRange (long GamCod,double *MinScore,double *MaxScore);
//-------------------------------- Figures ------------------------------------
void Gam_GetAndShowGamesStats (void);
//--------------------------- Program resources -------------------------------
void Gam_GetLinkToGame (void);
void GamRsc_WriteGameInCrsProgram (long GamCod,bool PutFormToGo,
const char *Icon,const char *IconTitle);
void GamRsc_GetTitleFromGamCod (long GamCod,char *Title,size_t TitleSize);
#endif

View File

@ -27,6 +27,8 @@
/********************************* Headers ***********************************/
/*****************************************************************************/
#include <mysql/mysql.h> // To access MySQL databases
#include "swad_game.h"
#include "swad_hierarchy_level.h"

View File

@ -37,7 +37,7 @@
#include "swad_error.h"
#include "swad_exam_resource.h"
#include "swad_form.h"
#include "swad_game.h"
#include "swad_game_resource.h"
#include "swad_global.h"
#include "swad_program.h"
#include "swad_program_database.h"