Version19.169

This commit is contained in:
acanas 2020-04-08 03:06:45 +02:00
parent 19c764abf7
commit d84b913144
25 changed files with 1141 additions and 954 deletions

View File

@ -4939,7 +4939,7 @@ int swad__getMatches (struct soap *soap,
struct swad__getMatchesOutput *getMatchesOut) // output struct swad__getMatchesOutput *getMatchesOut) // output
{ {
int ReturnCode; int ReturnCode;
struct Game Game; struct Gam_Game Game;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned long NumRows; unsigned long NumRows;
@ -5119,8 +5119,8 @@ int swad__getMatchStatus (struct soap *soap,
struct swad__getMatchStatusOutput *getMatchStatusOut) // output struct swad__getMatchStatusOutput *getMatchStatusOut) // output
{ {
int ReturnCode; int ReturnCode;
struct Match Match; struct Mch_Match Match;
struct Game Game; struct Gam_Game Game;
bool ICanPlayThisMatchBasedOnGrps; bool ICanPlayThisMatchBasedOnGrps;
unsigned NumOptions; unsigned NumOptions;
struct Mch_UsrAnswer UsrAnswer; struct Mch_UsrAnswer UsrAnswer;

View File

@ -675,13 +675,13 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActSeeMyMchResCrs ] = {1796,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInCrs ,NULL}, [ActSeeMyMchResCrs ] = {1796,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInCrs ,NULL},
[ActSeeMyMchResGam ] = {1810,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInGam ,NULL}, [ActSeeMyMchResGam ] = {1810,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInGam ,NULL},
[ActSeeMyMchResMch ] = {1812,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInMch ,NULL}, [ActSeeMyMchResMch ] = {1812,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInMch ,NULL},
[ActSeeOneMchResMe ] = {1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowOneMchResult ,NULL}, [ActSeeOneMchResMe ] = {1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowOneMchResult ,NULL},
[ActReqSeeAllMchRes ] = {1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_SelUsrsToViewMchResults ,NULL}, [ActReqSeeAllMchRes ] = {1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_SelUsrsToViewMchResults ,NULL},
[ActSeeAllMchResCrs ] = {1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInCrs ,NULL}, [ActSeeAllMchResCrs ] = {1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInCrs ,NULL},
[ActSeeAllMchResGam ] = {1811,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInGam ,NULL}, [ActSeeAllMchResGam ] = {1811,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInGam ,NULL},
[ActSeeAllMchResMch ] = {1813,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInMch ,NULL}, [ActSeeAllMchResMch ] = {1813,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInMch ,NULL},
[ActSeeOneMchResOth ] = {1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowOneMchResult ,NULL}, [ActSeeOneMchResOth ] = {1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowOneMchResult ,NULL},
[ActChgVisResMchUsr ] = {1801,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ToggleVisibilResultsMchUsr ,NULL}, [ActChgVisResMchUsr ] = {1801,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ToggleVisibilResultsMchUsr ,NULL},

View File

@ -108,18 +108,18 @@ static void Agd_PutIconsOtherPublicAgenda (void *EncryptedUsrCod);
static void Agd_PutButtonToCreateNewEvent (void); static void Agd_PutButtonToCreateNewEvent (void);
static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod); static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod);
static void Agd_GetParamEventOrder (void); static void Agd_GetParamEventOrder (void);
static void Agd_PutFormsToRemEditOneEvent (struct AgendaEvent *AgdEvent, static void Agd_PutFormsToRemEditOneEvent (struct Agd_Event *AgdEvent,
const char *Anchor); const char *Anchor);
static void Agd_PutCurrentParamsMyAgenda (void *Agenda); static void Agd_PutCurrentParamsMyAgenda (void *Agenda);
static void Agd_GetParams (Agd_AgendaType_t AgendaType); static void Agd_GetParams (Agd_AgendaType_t AgendaType);
static void Agd_GetListEvents (Agd_AgendaType_t AgendaType); static void Agd_GetListEvents (Agd_AgendaType_t AgendaType);
static void Agd_GetDataOfEventByCod (struct AgendaEvent *AgdEvent); static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent);
static void Agd_GetEventTxtFromDB (struct AgendaEvent *AgdEvent, static void Agd_GetEventTxtFromDB (struct Agd_Event *AgdEvent,
char Txt[Cns_MAX_BYTES_TEXT + 1]); char Txt[Cns_MAX_BYTES_TEXT + 1]);
static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt); static void Agd_CreateEvent (struct Agd_Event *AgdEvent,const char *Txt);
static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt); static void Agd_UpdateEvent (struct Agd_Event *AgdEvent,const char *Txt);
/*****************************************************************************/ /*****************************************************************************/
/********** Put form to log in and then show another user's agenda ***********/ /********** Put form to log in and then show another user's agenda ***********/
@ -739,7 +739,7 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
char *Anchor = NULL; char *Anchor = NULL;
static unsigned UniqueId = 0; static unsigned UniqueId = 0;
char *Id; char *Id;
struct AgendaEvent AgdEvent; struct Agd_Event AgdEvent;
Dat_StartEndTime_t StartEndTime; Dat_StartEndTime_t StartEndTime;
char Txt[Cns_MAX_BYTES_TEXT + 1]; char Txt[Cns_MAX_BYTES_TEXT + 1];
@ -845,7 +845,7 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
/******************* Put a link (form) to edit one event *********************/ /******************* Put a link (form) to edit one event *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Agd_PutFormsToRemEditOneEvent (struct AgendaEvent *AgdEvent, static void Agd_PutFormsToRemEditOneEvent (struct Agd_Event *AgdEvent,
const char *Anchor) const char *Anchor)
{ {
extern const char *Txt_Event_private_click_to_make_it_visible_to_the_users_of_your_courses; extern const char *Txt_Event_private_click_to_make_it_visible_to_the_users_of_your_courses;
@ -1145,7 +1145,7 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType)
/*********************** Get event data using its code ***********************/ /*********************** Get event data using its code ***********************/
/*****************************************************************************/ /*****************************************************************************/
static void Agd_GetDataOfEventByCod (struct AgendaEvent *AgdEvent) static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1240,7 +1240,7 @@ void Agd_FreeListEvents (void)
/*********************** Get event text from database ************************/ /*********************** Get event text from database ************************/
/*****************************************************************************/ /*****************************************************************************/
static void Agd_GetEventTxtFromDB (struct AgendaEvent *AgdEvent, static void Agd_GetEventTxtFromDB (struct Agd_Event *AgdEvent,
char Txt[Cns_MAX_BYTES_TEXT + 1]) char Txt[Cns_MAX_BYTES_TEXT + 1])
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
@ -1289,7 +1289,7 @@ void Agd_AskRemEvent (void)
{ {
extern const char *Txt_Do_you_really_want_to_remove_the_event_X; extern const char *Txt_Do_you_really_want_to_remove_the_event_X;
extern const char *Txt_Remove_event; extern const char *Txt_Remove_event;
struct AgendaEvent AgdEvent; struct Agd_Event AgdEvent;
/***** Get parameters *****/ /***** Get parameters *****/
Agd_GetParams (Agd_MY_AGENDA); Agd_GetParams (Agd_MY_AGENDA);
@ -1321,7 +1321,7 @@ void Agd_AskRemEvent (void)
void Agd_RemoveEvent (void) void Agd_RemoveEvent (void)
{ {
extern const char *Txt_Event_X_removed; extern const char *Txt_Event_X_removed;
struct AgendaEvent AgdEvent; struct Agd_Event AgdEvent;
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
@ -1350,7 +1350,7 @@ void Agd_RemoveEvent (void)
void Agd_HideEvent (void) void Agd_HideEvent (void)
{ {
struct AgendaEvent AgdEvent; struct Agd_Event AgdEvent;
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
@ -1376,7 +1376,7 @@ void Agd_HideEvent (void)
void Agd_UnhideEvent (void) void Agd_UnhideEvent (void)
{ {
struct AgendaEvent AgdEvent; struct Agd_Event AgdEvent;
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
@ -1403,7 +1403,7 @@ void Agd_UnhideEvent (void)
void Agd_MakeEventPrivate (void) void Agd_MakeEventPrivate (void)
{ {
extern const char *Txt_Event_X_is_now_private; extern const char *Txt_Event_X_is_now_private;
struct AgendaEvent AgdEvent; struct Agd_Event AgdEvent;
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
@ -1434,7 +1434,7 @@ void Agd_MakeEventPrivate (void)
void Agd_MakeEventPublic (void) void Agd_MakeEventPublic (void)
{ {
extern const char *Txt_Event_X_is_now_visible_to_users_of_your_courses; extern const char *Txt_Event_X_is_now_visible_to_users_of_your_courses;
struct AgendaEvent AgdEvent; struct Agd_Event AgdEvent;
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
@ -1473,7 +1473,7 @@ void Agd_RequestCreatOrEditEvent (void)
extern const char *Txt_Description; extern const char *Txt_Description;
extern const char *Txt_Create_event; extern const char *Txt_Create_event;
extern const char *Txt_Save_changes; extern const char *Txt_Save_changes;
struct AgendaEvent AgdEvent; struct Agd_Event AgdEvent;
bool ItsANewEvent; bool ItsANewEvent;
char Txt[Cns_MAX_BYTES_TEXT + 1]; char Txt[Cns_MAX_BYTES_TEXT + 1];
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] = static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
@ -1606,7 +1606,7 @@ void Agd_RecFormEvent (void)
extern const char *Txt_You_must_specify_the_title_of_the_event; extern const char *Txt_You_must_specify_the_title_of_the_event;
extern const char *Txt_Created_new_event_X; extern const char *Txt_Created_new_event_X;
extern const char *Txt_The_event_has_been_modified; extern const char *Txt_The_event_has_been_modified;
struct AgendaEvent AgdEvent; struct Agd_Event AgdEvent;
bool ItsANewEvent; bool ItsANewEvent;
bool NewEventIsCorrect = true; bool NewEventIsCorrect = true;
char EventTxt[Cns_MAX_BYTES_TEXT + 1]; char EventTxt[Cns_MAX_BYTES_TEXT + 1];
@ -1684,7 +1684,7 @@ void Agd_RecFormEvent (void)
/************************** Create a new event *******************************/ /************************** Create a new event *******************************/
/*****************************************************************************/ /*****************************************************************************/
static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt) static void Agd_CreateEvent (struct Agd_Event *AgdEvent,const char *Txt)
{ {
/***** Create a new event *****/ /***** Create a new event *****/
AgdEvent->AgdCod = AgdEvent->AgdCod =
@ -1706,7 +1706,7 @@ static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
/************************ Update an existing event ***************************/ /************************ Update an existing event ***************************/
/*****************************************************************************/ /*****************************************************************************/
static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt) static void Agd_UpdateEvent (struct Agd_Event *AgdEvent,const char *Txt)
{ {
/***** Update the data of the event *****/ /***** Update the data of the event *****/
DB_QueryUPDATE ("can not update event", DB_QueryUPDATE ("can not update event",

View File

@ -47,7 +47,7 @@ typedef enum
Agd_END_TIME = 1, Agd_END_TIME = 1,
} Agd_StartOrEndTime_t; } Agd_StartOrEndTime_t;
struct AgendaEvent struct Agd_Event
{ {
long AgdCod; long AgdCod;
long UsrCod; long UsrCod;

View File

@ -83,35 +83,35 @@ static void Asg_ShowAllAssignments (struct Asg_Assignments *Assignments);
static void Asg_PutHeadForSeeing (struct Asg_Assignments *Assignments, static void Asg_PutHeadForSeeing (struct Asg_Assignments *Assignments,
bool PrintView); bool PrintView);
static bool Asg_CheckIfICanCreateAssignments (void); static bool Asg_CheckIfICanCreateAssignments (void);
static void Asg_PutIconsListAssignments (void *Args); static void Asg_PutIconsListAssignments (void *Assignments);
static void Asg_PutIconToCreateNewAsg (void *Assignments); static void Asg_PutIconToCreateNewAsg (void *Assignments);
static void Asg_PutButtonToCreateNewAsg (void *Assignments); static void Asg_PutButtonToCreateNewAsg (void *Assignments);
static void Asg_ParamsWhichGroupsToShow (void *Args); static void Asg_ParamsWhichGroupsToShow (void *Assignments);
static void Asg_ShowOneAssignment (long AsgCod,bool PrintView); static void Asg_ShowOneAssignment (long AsgCod,bool PrintView);
static void Asg_WriteAsgAuthor (struct Assignment *Asg); static void Asg_WriteAsgAuthor (struct Asg_Assignment *Asg);
static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView); static void Asg_WriteAssignmentFolder (struct Asg_Assignment *Asg,bool PrintView);
static Dat_StartEndTime_t Asg_GetParamAsgOrder (void); static Dat_StartEndTime_t Asg_GetParamAsgOrder (void);
static void Asg_PutFormsToRemEditOneAsg (const struct Assignment *Asg, static void Asg_PutFormsToRemEditOneAsg (const struct Asg_Assignment *Asg,
const char *Anchor); const char *Anchor);
static void Asg_PutParams (void *Assignments); static void Asg_PutParams (void *Assignments);
static void Asg_GetListAssignments (struct Asg_Assignments *Assignments); static void Asg_GetListAssignments (struct Asg_Assignments *Assignments);
static void Asg_GetDataOfAssignment (struct Assignment *Asg, static void Asg_GetDataOfAssignment (struct Asg_Assignment *Asg,
MYSQL_RES **mysql_res, MYSQL_RES **mysql_res,
unsigned long NumRows); unsigned long NumRows);
static void Asg_ResetAssignment (struct Assignment *Asg); static void Asg_ResetAssignment (struct Asg_Assignment *Asg);
static void Asg_FreeListAssignments (struct Asg_Assignments *Assignments); static void Asg_FreeListAssignments (struct Asg_Assignments *Assignments);
static void Asg_GetAssignmentTxtFromDB (long AsgCod,char Txt[Cns_MAX_BYTES_TEXT + 1]); static void Asg_GetAssignmentTxtFromDB (long AsgCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
static void Asg_PutParamAsgCod (long AsgCod); static void Asg_PutParamAsgCod (long AsgCod);
static bool Asg_CheckIfSimilarAssignmentExists (const char *Field,const char *Value,long AsgCod); static bool Asg_CheckIfSimilarAssignmentExists (const char *Field,const char *Value,long AsgCod);
static void Asg_ShowLstGrpsToEditAssignment (long AsgCod); static void Asg_ShowLstGrpsToEditAssignment (long AsgCod);
static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigned NumUsrsToBeNotifiedByEMail); static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigned NumUsrsToBeNotifiedByEMail);
static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt); static void Asg_CreateAssignment (struct Asg_Assignment *Asg,const char *Txt);
static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt); static void Asg_UpdateAssignment (struct Asg_Assignment *Asg,const char *Txt);
static bool Asg_CheckIfAsgIsAssociatedToGrps (long AsgCod); static bool Asg_CheckIfAsgIsAssociatedToGrps (long AsgCod);
static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod); static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod);
static void Asg_CreateGrps (long AsgCod); static void Asg_CreateGrps (long AsgCod);
static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Assignment *Asg); static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Asg_Assignment *Asg);
static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod); static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod);
/*****************************************************************************/ /*****************************************************************************/
@ -395,7 +395,7 @@ static void Asg_ShowOneAssignment (long AsgCod,bool PrintView)
char *Anchor = NULL; char *Anchor = NULL;
static unsigned UniqueId = 0; static unsigned UniqueId = 0;
char *Id; char *Id;
struct Assignment Asg; struct Asg_Assignment Asg;
Dat_StartEndTime_t StartEndTime; Dat_StartEndTime_t StartEndTime;
char Txt[Cns_MAX_BYTES_TEXT + 1]; char Txt[Cns_MAX_BYTES_TEXT + 1];
@ -521,7 +521,7 @@ static void Asg_ShowOneAssignment (long AsgCod,bool PrintView)
/********************* Write the author of an assignment *********************/ /********************* Write the author of an assignment *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Asg_WriteAsgAuthor (struct Assignment *Asg) static void Asg_WriteAsgAuthor (struct Asg_Assignment *Asg)
{ {
Usr_WriteAuthor1Line (Asg->UsrCod,Asg->Hidden); Usr_WriteAuthor1Line (Asg->UsrCod,Asg->Hidden);
} }
@ -530,7 +530,7 @@ static void Asg_WriteAsgAuthor (struct Assignment *Asg)
/********************* Write the folder of an assignment *********************/ /********************* Write the folder of an assignment *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView) static void Asg_WriteAssignmentFolder (struct Asg_Assignment *Asg,bool PrintView)
{ {
extern const char *Txt_Upload_file_or_create_folder; extern const char *Txt_Upload_file_or_create_folder;
extern const char *Txt_Folder; extern const char *Txt_Folder;
@ -611,7 +611,7 @@ static Dat_StartEndTime_t Asg_GetParamAsgOrder (void)
/***************** Put a link (form) to edit one assignment ******************/ /***************** Put a link (form) to edit one assignment ******************/
/*****************************************************************************/ /*****************************************************************************/
static void Asg_PutFormsToRemEditOneAsg (const struct Assignment *Asg, static void Asg_PutFormsToRemEditOneAsg (const struct Asg_Assignment *Asg,
const char *Anchor) const char *Anchor)
{ {
struct Asg_Assignments Assignments; struct Asg_Assignments Assignments;
@ -760,7 +760,7 @@ static void Asg_GetListAssignments (struct Asg_Assignments *Assignments)
/******************* Get assignment data using its code **********************/ /******************* Get assignment data using its code **********************/
/*****************************************************************************/ /*****************************************************************************/
void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg) void Asg_GetDataOfAssignmentByCod (struct Asg_Assignment *Asg)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned long NumRows; unsigned long NumRows;
@ -793,7 +793,7 @@ void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg)
/*************** Get assignment data using its folder name *******************/ /*************** Get assignment data using its folder name *******************/
/*****************************************************************************/ /*****************************************************************************/
void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg) void Asg_GetDataOfAssignmentByFolder (struct Asg_Assignment *Asg)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned long NumRows; unsigned long NumRows;
@ -826,7 +826,7 @@ void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg)
/************************* Get assignment data *******************************/ /************************* Get assignment data *******************************/
/*****************************************************************************/ /*****************************************************************************/
static void Asg_GetDataOfAssignment (struct Assignment *Asg, static void Asg_GetDataOfAssignment (struct Asg_Assignment *Asg,
MYSQL_RES **mysql_res, MYSQL_RES **mysql_res,
unsigned long NumRows) unsigned long NumRows)
{ {
@ -880,7 +880,7 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,
/************************* Clear all assignment data **************************/ /************************* Clear all assignment data **************************/
/*****************************************************************************/ /*****************************************************************************/
static void Asg_ResetAssignment (struct Assignment *Asg) static void Asg_ResetAssignment (struct Asg_Assignment *Asg)
{ {
if (Asg->AsgCod <= 0) // If > 0 ==> keep value if (Asg->AsgCod <= 0) // If > 0 ==> keep value
Asg->AsgCod = -1L; Asg->AsgCod = -1L;
@ -1022,7 +1022,7 @@ void Asg_ReqRemAssignment (void)
extern const char *Txt_Do_you_really_want_to_remove_the_assignment_X; extern const char *Txt_Do_you_really_want_to_remove_the_assignment_X;
extern const char *Txt_Remove_assignment; extern const char *Txt_Remove_assignment;
struct Asg_Assignments Assignments; struct Asg_Assignments Assignments;
struct Assignment Asg; struct Asg_Assignment Asg;
/***** Reset assignments *****/ /***** Reset assignments *****/
Asg_ResetAssignments (&Assignments); Asg_ResetAssignments (&Assignments);
@ -1059,7 +1059,7 @@ void Asg_RemoveAssignment (void)
{ {
extern const char *Txt_Assignment_X_removed; extern const char *Txt_Assignment_X_removed;
struct Asg_Assignments Assignments; struct Asg_Assignments Assignments;
struct Assignment Asg; struct Asg_Assignment Asg;
/***** Reset assignments *****/ /***** Reset assignments *****/
Asg_ResetAssignments (&Assignments); Asg_ResetAssignments (&Assignments);
@ -1101,7 +1101,7 @@ void Asg_RemoveAssignment (void)
void Asg_HideAssignment (void) void Asg_HideAssignment (void)
{ {
struct Asg_Assignments Assignments; struct Asg_Assignments Assignments;
struct Assignment Asg; struct Asg_Assignment Asg;
/***** Reset assignments *****/ /***** Reset assignments *****/
Asg_ResetAssignments (&Assignments); Asg_ResetAssignments (&Assignments);
@ -1130,7 +1130,7 @@ void Asg_HideAssignment (void)
void Asg_ShowAssignment (void) void Asg_ShowAssignment (void)
{ {
struct Asg_Assignments Assignments; struct Asg_Assignments Assignments;
struct Assignment Asg; struct Asg_Assignment Asg;
/***** Reset assignments *****/ /***** Reset assignments *****/
Asg_ResetAssignments (&Assignments); Asg_ResetAssignments (&Assignments);
@ -1184,7 +1184,7 @@ void Asg_RequestCreatOrEditAsg (void)
extern const char *Txt_Create_assignment; extern const char *Txt_Create_assignment;
extern const char *Txt_Save_changes; extern const char *Txt_Save_changes;
struct Asg_Assignments Assignments; struct Asg_Assignments Assignments;
struct Assignment Asg; struct Asg_Assignment Asg;
bool ItsANewAssignment; bool ItsANewAssignment;
char Txt[Cns_MAX_BYTES_TEXT + 1]; char Txt[Cns_MAX_BYTES_TEXT + 1];
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] = static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
@ -1398,8 +1398,8 @@ void Asg_RecFormAssignment (void)
extern const char *Txt_The_assignment_has_been_modified; extern const char *Txt_The_assignment_has_been_modified;
extern const char *Txt_You_can_not_disable_file_uploading_once_folders_have_been_created; extern const char *Txt_You_can_not_disable_file_uploading_once_folders_have_been_created;
struct Asg_Assignments Assignments; struct Asg_Assignments Assignments;
struct Assignment OldAsg; // Current assigment data in database struct Asg_Assignment OldAsg; // Current assigment data in database
struct Assignment NewAsg; // Assignment data received from form struct Asg_Assignment NewAsg; // Assignment data received from form
bool ItsANewAssignment; bool ItsANewAssignment;
bool NewAssignmentIsCorrect = true; bool NewAssignmentIsCorrect = true;
unsigned NumUsrsToBeNotifiedByEMail; unsigned NumUsrsToBeNotifiedByEMail;
@ -1557,7 +1557,7 @@ static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigne
/************************ Create a new assignment ****************************/ /************************ Create a new assignment ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt) static void Asg_CreateAssignment (struct Asg_Assignment *Asg,const char *Txt)
{ {
/***** Create a new assignment *****/ /***** Create a new assignment *****/
Asg->AsgCod = Asg->AsgCod =
@ -1584,7 +1584,7 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
/********************* Update an existing assignment *************************/ /********************* Update an existing assignment *************************/
/*****************************************************************************/ /*****************************************************************************/
static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt) static void Asg_UpdateAssignment (struct Asg_Assignment *Asg,const char *Txt)
{ {
/***** Update the data of the assignment *****/ /***** Update the data of the assignment *****/
DB_QueryUPDATE ("can not update assignment", DB_QueryUPDATE ("can not update assignment",
@ -1702,7 +1702,7 @@ static void Asg_CreateGrps (long AsgCod)
/********* Get and write the names of the groups of an assignment ************/ /********* Get and write the names of the groups of an assignment ************/
/*****************************************************************************/ /*****************************************************************************/
static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Assignment *Asg) static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Asg_Assignment *Asg)
{ {
extern const char *Txt_Group; extern const char *Txt_Group;
extern const char *Txt_Groups; extern const char *Txt_Groups;

View File

@ -46,7 +46,7 @@ typedef enum
Asg_SEND_WORK = 1, Asg_SEND_WORK = 1,
} Asg_SendWork_t; } Asg_SendWork_t;
struct Assignment struct Asg_Assignment
{ {
long AsgCod; long AsgCod;
bool Hidden; bool Hidden;
@ -72,8 +72,8 @@ void Asg_SeeAssignments (void);
void Asg_PrintOneAssignment (void); void Asg_PrintOneAssignment (void);
void Asg_RequestCreatOrEditAsg (void); void Asg_RequestCreatOrEditAsg (void);
void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg); void Asg_GetDataOfAssignmentByCod (struct Asg_Assignment *Asg);
void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg); void Asg_GetDataOfAssignmentByFolder (struct Asg_Assignment *Asg);
void Asg_GetNotifAssignment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Asg_GetNotifAssignment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr, char **ContentStr,

View File

@ -171,8 +171,8 @@ static void Att_PutParamsToPrintStdsList (void *Events);
static void Att_PutButtonToShowDetails (const struct Att_Events *Events); static void Att_PutButtonToShowDetails (const struct Att_Events *Events);
static void Att_ListEventsToSelect (const struct Att_Events *Events, static void Att_ListEventsToSelect (const struct Att_Events *Events,
Att_TypeOfView_t TypeOfView); Att_TypeOfView_t TypeOfView);
static void Att_PutIconToViewAttEvents (void *Args); static void Att_PutIconToViewAttEvents (void *Events);
static void Att_PutIconToEditAttEvents (void *Args); static void Att_PutIconToEditAttEvents (void *Events);
static void Att_ListUsrsAttendanceTable (const struct Att_Events *Events, static void Att_ListUsrsAttendanceTable (const struct Att_Events *Events,
Att_TypeOfView_t TypeOfView, Att_TypeOfView_t TypeOfView,
unsigned NumUsrsInList, unsigned NumUsrsInList,
@ -2733,33 +2733,39 @@ void Att_RemoveUsrsAbsentWithoutCommentsFromAttEvent (long AttCod)
/********** Request listing attendance of users to several events ************/ /********** Request listing attendance of users to several events ************/
/*****************************************************************************/ /*****************************************************************************/
void Att_ReqListUsrsAttendanceCrs (void *Args) void Att_ReqListUsrsAttendanceCrs (void *TypeOfView)
{ {
extern const char *Hlp_USERS_Attendance_attendance_list; extern const char *Hlp_USERS_Attendance_attendance_list;
extern const char *Txt_Attendance_list; extern const char *Txt_Attendance_list;
extern const char *Txt_View_attendance; extern const char *Txt_View_attendance;
struct Att_Events Events; struct Att_Events Events;
if (!Args) switch (*(Att_TypeOfView_t *) TypeOfView)
return; {
case Att_VIEW_SEL_USR:
case Att_PRNT_SEL_USR:
/***** Reset attendance events *****/
Att_ResetEvents (&Events);
/***** Reset attendance events *****/ /***** Get list of attendance events *****/
Att_ResetEvents (&Events); Att_GetListAttEvents (&Events,Att_OLDEST_FIRST);
/***** Get list of attendance events *****/ /***** List users to select some of them *****/
Att_GetListAttEvents (&Events,Att_OLDEST_FIRST); Usr_PutFormToSelectUsrsToGoToAct (&Gbl.Usrs.Selected,
ActSeeLstUsrAtt,
NULL,NULL,
Txt_Attendance_list,
Hlp_USERS_Attendance_attendance_list,
Txt_View_attendance,
false); // Do not put form with date range
/***** List users to select some of them *****/ /***** Free list of attendance events *****/
Usr_PutFormToSelectUsrsToGoToAct (&Gbl.Usrs.Selected, Att_FreeListAttEvents (&Events);
ActSeeLstUsrAtt, break;
NULL,NULL, default:
Txt_Attendance_list, Lay_WrongTypeOfViewExit ();
Hlp_USERS_Attendance_attendance_list, break;
Txt_View_attendance, }
false); // Do not put form with date range
/***** Free list of attendance events *****/
Att_FreeListAttEvents (&Events);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2783,72 +2789,81 @@ static void Att_ListOrPrintMyAttendanceCrs (Att_TypeOfView_t TypeOfView)
struct Att_Events Events; struct Att_Events Events;
unsigned NumAttEvent; unsigned NumAttEvent;
/***** Reset attendance events *****/
Att_ResetEvents (&Events);
/***** Get list of attendance events *****/
Att_GetListAttEvents (&Events,Att_OLDEST_FIRST);
/***** Get boolean parameter that indicates if details must be shown *****/
Events.ShowDetails = Par_GetParToBool ("ShowDetails");
/***** Get list of groups selected ******/
Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get number of students in each event *****/
for (NumAttEvent = 0;
NumAttEvent < Events.Num;
NumAttEvent++)
/* Get number of students in this event */
Events.Lst[NumAttEvent].NumStdsFromList =
Att_GetNumUsrsFromAListWhoAreInAttEvent (Events.Lst[NumAttEvent].AttCod,
&Gbl.Usrs.Me.UsrDat.UsrCod,1);
/***** Get list of attendance events selected *****/
Att_GetListSelectedAttCods (&Events);
/***** Begin box *****/
switch (TypeOfView) switch (TypeOfView)
{ {
case Att_VIEW_ONLY_ME: case Att_VIEW_ONLY_ME:
Box_BoxBegin (NULL,Txt_Attendance,
Att_PutIconsMyAttList,&Gbl,
Hlp_USERS_Attendance_attendance_list,Box_NOT_CLOSABLE);
break;
case Att_PRNT_ONLY_ME: case Att_PRNT_ONLY_ME:
Box_BoxBegin (NULL,Txt_Attendance, /***** Reset attendance events *****/
NULL,NULL, Att_ResetEvents (&Events);
NULL,Box_NOT_CLOSABLE);
/***** Get list of attendance events *****/
Att_GetListAttEvents (&Events,Att_OLDEST_FIRST);
/***** Get boolean parameter that indicates if details must be shown *****/
Events.ShowDetails = Par_GetParToBool ("ShowDetails");
/***** Get list of groups selected ******/
Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get number of students in each event *****/
for (NumAttEvent = 0;
NumAttEvent < Events.Num;
NumAttEvent++)
/* Get number of students in this event */
Events.Lst[NumAttEvent].NumStdsFromList =
Att_GetNumUsrsFromAListWhoAreInAttEvent (Events.Lst[NumAttEvent].AttCod,
&Gbl.Usrs.Me.UsrDat.UsrCod,1);
/***** Get list of attendance events selected *****/
Att_GetListSelectedAttCods (&Events);
/***** Begin box *****/
switch (TypeOfView)
{
case Att_VIEW_ONLY_ME:
Box_BoxBegin (NULL,Txt_Attendance,
Att_PutIconsMyAttList,&Gbl,
Hlp_USERS_Attendance_attendance_list,Box_NOT_CLOSABLE);
break;
case Att_PRNT_ONLY_ME:
Box_BoxBegin (NULL,Txt_Attendance,
NULL,NULL,
NULL,Box_NOT_CLOSABLE);
break;
default:
Lay_WrongTypeOfViewExit ();
break;
}
/***** List events to select *****/
Att_ListEventsToSelect (&Events,TypeOfView);
/***** Get my preference about photos in users' list for current course *****/
Usr_GetMyPrefAboutListWithPhotosFromDB ();
/***** Show table with attendances for every student in list *****/
Att_ListUsrsAttendanceTable (&Events,TypeOfView,1,&Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show details or put button to show details *****/
if (Events.ShowDetails)
Att_ListStdsWithAttEventsDetails (&Events,1,&Gbl.Usrs.Me.UsrDat.UsrCod);
/***** End box *****/
Box_BoxEnd ();
/***** Free memory for list of attendance events selected *****/
free (Events.StrAttCodsSelected);
/***** Free list of groups selected *****/
Grp_FreeListCodSelectedGrps ();
/***** Free list of attendance events *****/
Att_FreeListAttEvents (&Events);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong type of view."); Lay_WrongTypeOfViewExit ();
break; break;
} }
/***** List events to select *****/
Att_ListEventsToSelect (&Events,TypeOfView);
/***** Get my preference about photos in users' list for current course *****/
Usr_GetMyPrefAboutListWithPhotosFromDB ();
/***** Show table with attendances for every student in list *****/
Att_ListUsrsAttendanceTable (&Events,TypeOfView,1,&Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show details or put button to show details *****/
if (Events.ShowDetails)
Att_ListStdsWithAttEventsDetails (&Events,1,&Gbl.Usrs.Me.UsrDat.UsrCod);
/***** End box *****/
Box_BoxEnd ();
/***** Free memory for list of attendance events selected *****/
free (Events.StrAttCodsSelected);
/***** Free list of groups selected *****/
Grp_FreeListCodSelectedGrps ();
/***** Free list of attendance events *****/
Att_FreeListAttEvents (&Events);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2869,7 +2884,7 @@ static void Att_GetUsrsAndListOrPrintAttendanceCrs (Att_TypeOfView_t TypeOfView)
{ {
Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected, Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected,
Att_ListOrPrintUsrsAttendanceCrs,&TypeOfView, Att_ListOrPrintUsrsAttendanceCrs,&TypeOfView,
Att_ReqListUsrsAttendanceCrs,&Gbl); Att_ReqListUsrsAttendanceCrs,&TypeOfView);
} }
static void Att_ListOrPrintUsrsAttendanceCrs (void *TypeOfView) static void Att_ListOrPrintUsrsAttendanceCrs (void *TypeOfView)
@ -2881,84 +2896,93 @@ static void Att_ListOrPrintUsrsAttendanceCrs (void *TypeOfView)
long *LstSelectedUsrCods; long *LstSelectedUsrCods;
unsigned NumAttEvent; unsigned NumAttEvent;
/***** Reset attendance events *****/ switch (*(Att_TypeOfView_t *) TypeOfView)
Att_ResetEvents (&Events);
/***** Get parameters *****/
/* Get boolean parameter that indicates if details must be shown */
Events.ShowDetails = Par_GetParToBool ("ShowDetails");
/* Get list of groups selected */
Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Count number of valid users in list of encrypted user codes *****/
NumUsrsInList = Usr_CountNumUsrsInListOfSelectedEncryptedUsrCods (&Gbl.Usrs.Selected);
if (NumUsrsInList)
{ {
/***** Get list of students selected to show their attendances *****/ case Att_VIEW_SEL_USR:
Usr_GetListSelectedUsrCods (&Gbl.Usrs.Selected,NumUsrsInList,&LstSelectedUsrCods); case Att_PRNT_SEL_USR:
/***** Reset attendance events *****/
Att_ResetEvents (&Events);
/***** Get list of attendance events *****/ /***** Get parameters *****/
Att_GetListAttEvents (&Events,Att_OLDEST_FIRST); /* Get boolean parameter that indicates if details must be shown */
Events.ShowDetails = Par_GetParToBool ("ShowDetails");
/***** Get number of students in each event *****/ /* Get list of groups selected */
for (NumAttEvent = 0; Grp_GetParCodsSeveralGrpsToShowUsrs ();
NumAttEvent < Events.Num;
NumAttEvent++)
/* Get number of students in this event */
Events.Lst[NumAttEvent].NumStdsFromList =
Att_GetNumUsrsFromAListWhoAreInAttEvent (Events.Lst[NumAttEvent].AttCod,
LstSelectedUsrCods,NumUsrsInList);
/***** Get list of attendance events selected *****/ /***** Count number of valid users in list of encrypted user codes *****/
Att_GetListSelectedAttCods (&Events); NumUsrsInList = Usr_CountNumUsrsInListOfSelectedEncryptedUsrCods (&Gbl.Usrs.Selected);
/***** Begin box *****/ if (NumUsrsInList)
switch (*(Att_TypeOfView_t *) TypeOfView) {
{ /***** Get list of students selected to show their attendances *****/
case Att_VIEW_SEL_USR: Usr_GetListSelectedUsrCods (&Gbl.Usrs.Selected,NumUsrsInList,&LstSelectedUsrCods);
Box_BoxBegin (NULL,Txt_Attendance_list,
Att_PutIconsStdsAttList,&Events,
Hlp_USERS_Attendance_attendance_list,Box_NOT_CLOSABLE);
break;
case Att_PRNT_SEL_USR:
Box_BoxBegin (NULL,Txt_Attendance_list,
NULL,NULL,
NULL,Box_NOT_CLOSABLE);
break;
default:
Lay_ShowErrorAndExit ("Wrong type of view.");
}
/***** List events to select *****/ /***** Get list of attendance events *****/
Att_ListEventsToSelect (&Events,*(Att_TypeOfView_t *) TypeOfView); Att_GetListAttEvents (&Events,Att_OLDEST_FIRST);
/***** Get my preference about photos in users' list for current course *****/ /***** Get number of students in each event *****/
Usr_GetMyPrefAboutListWithPhotosFromDB (); for (NumAttEvent = 0;
NumAttEvent < Events.Num;
NumAttEvent++)
/* Get number of students in this event */
Events.Lst[NumAttEvent].NumStdsFromList =
Att_GetNumUsrsFromAListWhoAreInAttEvent (Events.Lst[NumAttEvent].AttCod,
LstSelectedUsrCods,NumUsrsInList);
/***** Show table with attendances for every student in list *****/ /***** Get list of attendance events selected *****/
Att_ListUsrsAttendanceTable (&Events,*(Att_TypeOfView_t *) TypeOfView,NumUsrsInList,LstSelectedUsrCods); Att_GetListSelectedAttCods (&Events);
/***** Show details or put button to show details *****/ /***** Begin box *****/
if (Events.ShowDetails) switch (*(Att_TypeOfView_t *) TypeOfView)
Att_ListStdsWithAttEventsDetails (&Events,NumUsrsInList,LstSelectedUsrCods); {
case Att_VIEW_SEL_USR:
Box_BoxBegin (NULL,Txt_Attendance_list,
Att_PutIconsStdsAttList,&Events,
Hlp_USERS_Attendance_attendance_list,Box_NOT_CLOSABLE);
break;
case Att_PRNT_SEL_USR:
Box_BoxBegin (NULL,Txt_Attendance_list,
NULL,NULL,
NULL,Box_NOT_CLOSABLE);
break;
default:
Lay_WrongTypeOfViewExit ();
}
/***** End box *****/ /***** List events to select *****/
Box_BoxEnd (); Att_ListEventsToSelect (&Events,*(Att_TypeOfView_t *) TypeOfView);
/***** Free memory for list of attendance events selected *****/ /***** Get my preference about photos in users' list for current course *****/
free (Events.StrAttCodsSelected); Usr_GetMyPrefAboutListWithPhotosFromDB ();
/***** Free list of attendance events *****/ /***** Show table with attendances for every student in list *****/
Att_FreeListAttEvents (&Events); Att_ListUsrsAttendanceTable (&Events,*(Att_TypeOfView_t *) TypeOfView,NumUsrsInList,LstSelectedUsrCods);
/***** Free list of user codes *****/ /***** Show details or put button to show details *****/
Usr_FreeListSelectedUsrCods (LstSelectedUsrCods); if (Events.ShowDetails)
Att_ListStdsWithAttEventsDetails (&Events,NumUsrsInList,LstSelectedUsrCods);
/***** End box *****/
Box_BoxEnd ();
/***** Free memory for list of attendance events selected *****/
free (Events.StrAttCodsSelected);
/***** Free list of attendance events *****/
Att_FreeListAttEvents (&Events);
/***** Free list of user codes *****/
Usr_FreeListSelectedUsrCods (LstSelectedUsrCods);
}
/***** Free list of groups selected *****/
Grp_FreeListCodSelectedGrps ();
break;
default:
Lay_WrongTypeOfViewExit ();
break;
} }
/***** Free list of groups selected *****/
Grp_FreeListCodSelectedGrps ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3178,12 +3202,12 @@ static void Att_ListEventsToSelect (const struct Att_Events *Events,
{ {
case Att_VIEW_ONLY_ME: case Att_VIEW_ONLY_ME:
Box_BoxBegin (NULL,Txt_Events, Box_BoxBegin (NULL,Txt_Events,
Att_PutIconToViewAttEvents,&Gbl, Att_PutIconToViewAttEvents,&Events,
NULL,Box_NOT_CLOSABLE); NULL,Box_NOT_CLOSABLE);
break; break;
case Att_VIEW_SEL_USR: case Att_VIEW_SEL_USR:
Box_BoxBegin (NULL,Txt_Events, Box_BoxBegin (NULL,Txt_Events,
Att_PutIconToEditAttEvents,&Gbl, Att_PutIconToEditAttEvents,&Events,
NULL,Box_NOT_CLOSABLE); NULL,Box_NOT_CLOSABLE);
break; break;
case Att_PRNT_ONLY_ME: case Att_PRNT_ONLY_ME:
@ -3295,9 +3319,9 @@ static void Att_ListEventsToSelect (const struct Att_Events *Events,
/*********** Put icon to list (without edition) attendance events ************/ /*********** Put icon to list (without edition) attendance events ************/
/*****************************************************************************/ /*****************************************************************************/
static void Att_PutIconToViewAttEvents (void *Args) static void Att_PutIconToViewAttEvents (void *Events)
{ {
if (Args) if (Events) // Not used
Ico_PutContextualIconToView (ActSeeAtt, Ico_PutContextualIconToView (ActSeeAtt,
NULL,NULL); NULL,NULL);
} }
@ -3306,9 +3330,9 @@ static void Att_PutIconToViewAttEvents (void *Args)
/************ Put icon to list (with edition) attendance events **************/ /************ Put icon to list (with edition) attendance events **************/
/*****************************************************************************/ /*****************************************************************************/
static void Att_PutIconToEditAttEvents (void *Args) static void Att_PutIconToEditAttEvents (void *Events)
{ {
if (Args) if (Events) // Not used
Ico_PutContextualIconToEdit (ActSeeAtt,NULL, Ico_PutContextualIconToEdit (ActSeeAtt,NULL,
NULL,NULL); NULL,NULL);
} }

View File

@ -111,7 +111,7 @@ void Att_RegisterStudentsInAttEvent (void);
void Att_RegUsrInAttEventNotChangingComments (long AttCod,long UsrCod); void Att_RegUsrInAttEventNotChangingComments (long AttCod,long UsrCod);
void Att_RemoveUsrsAbsentWithoutCommentsFromAttEvent (long AttCod); void Att_RemoveUsrsAbsentWithoutCommentsFromAttEvent (long AttCod);
void Att_ReqListUsrsAttendanceCrs (void *Args); void Att_ReqListUsrsAttendanceCrs (void *TypeOfView);
void Att_ListMyAttendanceCrs (void); void Att_ListMyAttendanceCrs (void);
void Att_PrintMyAttendanceCrs (void); void Att_PrintMyAttendanceCrs (void);
void Att_ListUsrsAttendanceCrs (void); void Att_ListUsrsAttendanceCrs (void);

View File

@ -58,7 +58,7 @@ extern struct Globals Gbl;
struct Ban_Banners struct Ban_Banners
{ {
unsigned Num; // Number of banners unsigned Num; // Number of banners
struct Banner *Lst; // List of banners struct Ban_Banner *Lst; // List of banners
long BanCodToEdit; // Used as parameter in contextual links long BanCodToEdit; // Used as parameter in contextual links
long BanCodClicked; // Banned clicked, used to log it long BanCodClicked; // Banned clicked, used to log it
}; };
@ -67,57 +67,57 @@ struct Ban_Banners
/***************************** Private variables *****************************/ /***************************** Private variables *****************************/
/*****************************************************************************/ /*****************************************************************************/
static struct Banner *Ban_EditingBan; static struct Ban_Banner *Ban_EditingBan;
static long Ban_BanCodClicked; static long Ban_BanCodClicked;
/*****************************************************************************/ /*****************************************************************************/
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ban_SetEditingBanner (struct Banner *Ban); static void Ban_SetEditingBanner (struct Ban_Banner *Ban);
static struct Banner *Ban_GetEditingBanner (void); static struct Ban_Banner *Ban_GetEditingBanner (void);
static void Ban_WriteListOfBanners (const struct Ban_Banners *Banners); static void Ban_WriteListOfBanners (const struct Ban_Banners *Banners);
static void Ban_PutIconsListingBanners (void *Args); static void Ban_PutIconsListingBanners (void *Banners);
static void Ban_PutIconToEditBanners (void); static void Ban_PutIconToEditBanners (void);
static void Ban_EditBannersInternal (struct Ban_Banners *Banners, static void Ban_EditBannersInternal (struct Ban_Banners *Banners,
const struct Banner *Ban); const struct Ban_Banner *Ban);
static void Ban_GetListBanners (struct Ban_Banners *Banners, static void Ban_GetListBanners (struct Ban_Banners *Banners,
MYSQL_RES **mysql_res,unsigned long NumRows); MYSQL_RES **mysql_res,unsigned long NumRows);
static void Ban_FreeListBanners (struct Ban_Banners *Banners); static void Ban_FreeListBanners (struct Ban_Banners *Banners);
static void Ban_PutIconsEditingBanners (void *Args); static void Ban_PutIconsEditingBanners (void *Banners);
static void Ban_ListBannersForEdition (struct Ban_Banners *Banners); static void Ban_ListBannersForEdition (struct Ban_Banners *Banners);
static void Ban_PutParamBanCodToEdit (void *BanCod); static void Ban_PutParamBanCodToEdit (void *BanCod);
static void Ban_PutParamBanCod (long BanCod); static void Ban_PutParamBanCod (long BanCod);
static void Ban_ShowOrHideBanner (struct Banner *Ban,bool Hide); static void Ban_ShowOrHideBanner (struct Ban_Banner *Ban,bool Hide);
static void Ban_RenameBanner (struct Banner *Ban, static void Ban_RenameBanner (struct Ban_Banner *Ban,
Cns_ShrtOrFullName_t ShrtOrFullName); Cns_ShrtOrFullName_t ShrtOrFullName);
static bool Ban_CheckIfBannerNameExists (const char *FieldName,const char *Name,long BanCod); static bool Ban_CheckIfBannerNameExists (const char *FieldName,const char *Name,long BanCod);
static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName, static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName,
const char *NewBanName); const char *NewBanName);
static void Ban_PutFormToCreateBanner (const struct Banner *Ban); static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban);
static void Ban_PutHeadBanners (void); static void Ban_PutHeadBanners (void);
static void Ban_CreateBanner (const struct Banner *Ban); static void Ban_CreateBanner (const struct Ban_Banner *Ban);
static void Ban_SetBanCodClicked (long BanCod); static void Ban_SetBanCodClicked (long BanCod);
static void Ban_ResetBanners (struct Ban_Banners *Banners); static void Ban_ResetBanners (struct Ban_Banners *Banners);
static void Ban_ResetBanner (struct Banner *Ban); static void Ban_ResetBanner (struct Ban_Banner *Ban);
/*****************************************************************************/ /*****************************************************************************/
/************************** Access to editing banner *************************/ /************************** Access to editing banner *************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ban_SetEditingBanner (struct Banner *Ban) static void Ban_SetEditingBanner (struct Ban_Banner *Ban)
{ {
Ban_EditingBan = Ban; Ban_EditingBan = Ban;
} }
static struct Banner *Ban_GetEditingBanner (void) static struct Ban_Banner *Ban_GetEditingBanner (void)
{ {
return Ban_EditingBan; return Ban_EditingBan;
} }
@ -149,7 +149,7 @@ void Ban_SeeBanners (void)
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_Banners, Box_BoxBegin (NULL,Txt_Banners,
Ban_PutIconsListingBanners,&Gbl, Ban_PutIconsListingBanners,&Banners,
Hlp_SYSTEM_Banners,Box_NOT_CLOSABLE); Hlp_SYSTEM_Banners,Box_NOT_CLOSABLE);
/***** Write all banners *****/ /***** Write all banners *****/
@ -208,9 +208,9 @@ static void Ban_WriteListOfBanners (const struct Ban_Banners *Banners)
/***************** Put contextual icons in list of banners *******************/ /***************** Put contextual icons in list of banners *******************/
/*****************************************************************************/ /*****************************************************************************/
static void Ban_PutIconsListingBanners (void *Args) static void Ban_PutIconsListingBanners (void *Banners)
{ {
if (Args) if (Banners) // Not used
{ {
/***** Put icon to view banners *****/ /***** Put icon to view banners *****/
if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
@ -238,7 +238,7 @@ static void Ban_PutIconToEditBanners (void)
void Ban_EditBanners (void) void Ban_EditBanners (void)
{ {
struct Ban_Banners Banners; struct Ban_Banners Banners;
struct Banner Ban; struct Ban_Banner Ban;
/***** Reset banners *****/ /***** Reset banners *****/
Ban_ResetBanners (&Banners); Ban_ResetBanners (&Banners);
@ -251,7 +251,7 @@ void Ban_EditBanners (void)
} }
static void Ban_EditBannersInternal (struct Ban_Banners *Banners, static void Ban_EditBannersInternal (struct Ban_Banners *Banners,
const struct Banner *Ban) const struct Ban_Banner *Ban)
{ {
extern const char *Hlp_SYSTEM_Banners_edit; extern const char *Hlp_SYSTEM_Banners_edit;
extern const char *Txt_Banners; extern const char *Txt_Banners;
@ -266,7 +266,7 @@ static void Ban_EditBannersInternal (struct Ban_Banners *Banners,
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_Banners, Box_BoxBegin (NULL,Txt_Banners,
Ban_PutIconsEditingBanners,&Gbl, Ban_PutIconsEditingBanners,Banners,
Hlp_SYSTEM_Banners_edit,Box_NOT_CLOSABLE); Hlp_SYSTEM_Banners_edit,Box_NOT_CLOSABLE);
/***** Put a form to create a new banner *****/ /***** Put a form to create a new banner *****/
@ -292,7 +292,7 @@ static void Ban_GetListBanners (struct Ban_Banners *Banners,
{ {
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumBan; unsigned NumBan;
struct Banner *Ban; struct Ban_Banner *Ban;
/***** Get banners from database *****/ /***** Get banners from database *****/
if (NumRows) // Banners found... if (NumRows) // Banners found...
@ -300,8 +300,8 @@ static void Ban_GetListBanners (struct Ban_Banners *Banners,
Banners->Num = (unsigned) NumRows; Banners->Num = (unsigned) NumRows;
/***** Create list with banners *****/ /***** Create list with banners *****/
if ((Banners->Lst = (struct Banner *) if ((Banners->Lst = (struct Ban_Banner *)
calloc (NumRows,sizeof (struct Banner))) == NULL) calloc (NumRows,sizeof (struct Ban_Banner))) == NULL)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
/***** Get the banners *****/ /***** Get the banners *****/
@ -349,7 +349,7 @@ static void Ban_GetListBanners (struct Ban_Banners *Banners,
/*************************** Get banner full name ****************************/ /*************************** Get banner full name ****************************/
/*****************************************************************************/ /*****************************************************************************/
void Ban_GetDataOfBannerByCod (struct Banner *Ban) void Ban_GetDataOfBannerByCod (struct Ban_Banner *Ban)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -416,9 +416,9 @@ static void Ban_FreeListBanners (struct Ban_Banners *Banners)
/**************** Put contextual icons in edition of banners *****************/ /**************** Put contextual icons in edition of banners *****************/
/*****************************************************************************/ /*****************************************************************************/
static void Ban_PutIconsEditingBanners (void *Args) static void Ban_PutIconsEditingBanners (void *Banners)
{ {
if (Args) if (Banners) // Not used
{ {
/***** Put icon to view banners *****/ /***** Put icon to view banners *****/
Ban_PutIconToViewBanners (); Ban_PutIconToViewBanners ();
@ -449,7 +449,7 @@ void Ban_PutIconToViewBanners (void)
static void Ban_ListBannersForEdition (struct Ban_Banners *Banners) static void Ban_ListBannersForEdition (struct Ban_Banners *Banners)
{ {
unsigned NumBan; unsigned NumBan;
struct Banner *Ban; struct Ban_Banner *Ban;
char *Anchor = NULL; char *Anchor = NULL;
/***** Begin table *****/ /***** Begin table *****/
@ -574,7 +574,7 @@ long Ban_GetParamBanCod (void)
void Ban_RemoveBanner (void) void Ban_RemoveBanner (void)
{ {
extern const char *Txt_Banner_X_removed; extern const char *Txt_Banner_X_removed;
struct Banner Ban; struct Ban_Banner Ban;
/***** Reset banner *****/ /***** Reset banner *****/
Ban_ResetBanner (&Ban); Ban_ResetBanner (&Ban);
@ -606,7 +606,7 @@ void Ban_RemoveBanner (void)
void Ban_ShowBanner (void) void Ban_ShowBanner (void)
{ {
struct Banner Ban; struct Ban_Banner Ban;
/***** Reset banner *****/ /***** Reset banner *****/
Ban_ResetBanner (&Ban); Ban_ResetBanner (&Ban);
@ -624,7 +624,7 @@ void Ban_ShowBanner (void)
void Ban_HideBanner (void) void Ban_HideBanner (void)
{ {
struct Banner Ban; struct Ban_Banner Ban;
/***** Reset banner *****/ /***** Reset banner *****/
Ban_ResetBanner (&Ban); Ban_ResetBanner (&Ban);
@ -640,7 +640,7 @@ void Ban_HideBanner (void)
/*************** Change hiddeness of banner in the database ******************/ /*************** Change hiddeness of banner in the database ******************/
/*****************************************************************************/ /*****************************************************************************/
static void Ban_ShowOrHideBanner (struct Banner *Ban,bool Hide) static void Ban_ShowOrHideBanner (struct Ban_Banner *Ban,bool Hide)
{ {
/***** Get banner code *****/ /***** Get banner code *****/
if ((Ban->BanCod = Ban_GetParamBanCod ()) == -1L) if ((Ban->BanCod = Ban_GetParamBanCod ()) == -1L)
@ -665,7 +665,7 @@ static void Ban_ShowOrHideBanner (struct Banner *Ban,bool Hide)
void Ban_RenameBannerShort (void) void Ban_RenameBannerShort (void)
{ {
struct Banner Ban; struct Ban_Banner Ban;
/***** Reset banner *****/ /***** Reset banner *****/
Ban_ResetBanner (&Ban); Ban_ResetBanner (&Ban);
@ -683,7 +683,7 @@ void Ban_RenameBannerShort (void)
void Ban_RenameBannerFull (void) void Ban_RenameBannerFull (void)
{ {
struct Banner Ban; struct Ban_Banner Ban;
/***** Reset banner *****/ /***** Reset banner *****/
Ban_ResetBanner (&Ban); Ban_ResetBanner (&Ban);
@ -699,7 +699,7 @@ void Ban_RenameBannerFull (void)
/*********************** Change the name of a banner *************************/ /*********************** Change the name of a banner *************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ban_RenameBanner (struct Banner *Ban, static void Ban_RenameBanner (struct Ban_Banner *Ban,
Cns_ShrtOrFullName_t ShrtOrFullName) Cns_ShrtOrFullName_t ShrtOrFullName)
{ {
extern const char *Txt_The_banner_X_already_exists; extern const char *Txt_The_banner_X_already_exists;
@ -809,7 +809,7 @@ void Ban_ChangeBannerImg (void)
{ {
extern const char *Txt_The_new_image_is_X; extern const char *Txt_The_new_image_is_X;
extern const char *Txt_You_can_not_leave_the_image_empty; extern const char *Txt_You_can_not_leave_the_image_empty;
struct Banner Ban; struct Ban_Banner Ban;
char NewImg[Ban_MAX_BYTES_IMAGE + 1]; char NewImg[Ban_MAX_BYTES_IMAGE + 1];
/***** Reset banner *****/ /***** Reset banner *****/
@ -858,7 +858,7 @@ void Ban_ChangeBannerImg (void)
void Ban_ChangeBannerWWW (void) void Ban_ChangeBannerWWW (void)
{ {
extern const char *Txt_The_new_web_address_is_X; extern const char *Txt_The_new_web_address_is_X;
struct Banner Ban; struct Ban_Banner Ban;
char NewWWW[Cns_MAX_BYTES_WWW + 1]; char NewWWW[Cns_MAX_BYTES_WWW + 1];
/***** Reset banner *****/ /***** Reset banner *****/
@ -906,7 +906,7 @@ void Ban_ChangeBannerWWW (void)
void Ban_ContEditAfterChgBan (void) void Ban_ContEditAfterChgBan (void)
{ {
struct Ban_Banners Banners; struct Ban_Banners Banners;
struct Banner *Ban = Ban_GetEditingBanner (); struct Ban_Banner *Ban = Ban_GetEditingBanner ();
/***** Reset banners *****/ /***** Reset banners *****/
Ban_ResetBanners (&Banners); Ban_ResetBanners (&Banners);
@ -922,7 +922,7 @@ void Ban_ContEditAfterChgBan (void)
/********************* Put a form to create a new banner *********************/ /********************* Put a form to create a new banner *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Ban_PutFormToCreateBanner (const struct Banner *Ban) static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban)
{ {
extern const char *Hlp_SYSTEM_Banners_edit; extern const char *Hlp_SYSTEM_Banners_edit;
extern const char *Txt_New_banner; extern const char *Txt_New_banner;
@ -1019,7 +1019,7 @@ void Ban_RecFormNewBanner (void)
extern const char *Txt_You_must_specify_the_URL_of_the_new_banner; extern const char *Txt_You_must_specify_the_URL_of_the_new_banner;
extern const char *Txt_Created_new_banner_X; extern const char *Txt_Created_new_banner_X;
extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_banner; extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_banner;
struct Banner Ban; struct Ban_Banner Ban;
/***** Reset banner *****/ /***** Reset banner *****/
Ban_ResetBanner (&Ban); Ban_ResetBanner (&Ban);
@ -1074,7 +1074,7 @@ void Ban_RecFormNewBanner (void)
/**************************** Create a new banner ****************************/ /**************************** Create a new banner ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ban_CreateBanner (const struct Banner *Ban) static void Ban_CreateBanner (const struct Ban_Banner *Ban)
{ {
/***** Create a new banner *****/ /***** Create a new banner *****/
DB_QueryINSERT ("can not create banner", DB_QueryINSERT ("can not create banner",
@ -1136,7 +1136,7 @@ void Ban_WriteMenuWithBanners (void)
void Ban_ClickOnBanner (void) void Ban_ClickOnBanner (void)
{ {
struct Banner Ban; struct Ban_Banner Ban;
/***** Get banner code *****/ /***** Get banner code *****/
if ((Ban.BanCod = Ban_GetParamBanCod ()) == -1L) if ((Ban.BanCod = Ban_GetParamBanCod ()) == -1L)
@ -1184,7 +1184,7 @@ static void Ban_ResetBanners (struct Ban_Banners *Banners)
/************************* Reset banner/destructor **********************/ /************************* Reset banner/destructor **********************/
/*****************************************************************************/ /*****************************************************************************/
static void Ban_ResetBanner (struct Banner *Ban) static void Ban_ResetBanner (struct Ban_Banner *Ban)
{ {
/***** Reset banner *****/ /***** Reset banner *****/
Ban->BanCod = -1L; Ban->BanCod = -1L;

View File

@ -42,7 +42,7 @@
#define Ban_MAX_CHARS_IMAGE NAME_MAX // 255 #define Ban_MAX_CHARS_IMAGE NAME_MAX // 255
#define Ban_MAX_BYTES_IMAGE Ban_MAX_CHARS_IMAGE // 255 #define Ban_MAX_BYTES_IMAGE Ban_MAX_CHARS_IMAGE // 255
struct Banner struct Ban_Banner
{ {
long BanCod; long BanCod;
bool Hidden; bool Hidden;
@ -61,7 +61,7 @@ void Ban_EditBanners (void);
void Ban_PutIconToViewBanners (void); void Ban_PutIconToViewBanners (void);
void Ban_GetDataOfBannerByCod (struct Banner *Ban); void Ban_GetDataOfBannerByCod (struct Ban_Banner *Ban);
long Ban_GetParamLnkCod (void); long Ban_GetParamLnkCod (void);
void Ban_RemoveBanner (void); void Ban_RemoveBanner (void);
void Ban_ShowBanner (void); void Ban_ShowBanner (void);

View File

@ -497,7 +497,7 @@ 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.168 (2020-04-07)" #define Log_PLATFORM_VERSION "SWAD 19.169 (2020-04-08)"
#define CSS_FILE "swad19.146.css" #define CSS_FILE "swad19.146.css"
#define JS_FILE "swad19.153.js" #define JS_FILE "swad19.153.js"
/* /*
@ -548,8 +548,7 @@ Funci
// TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores // TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores
// TODO: Integrar pull requests con traducciones del alemán del usuario eruedin en GitHub // TODO: Integrar pull requests con traducciones del alemán del usuario eruedin en GitHub
// TODO: Bug en SWADroid: loginByUserPasswordKey falla cuando se le pasa como parámetro un DNI Version 19.169: Apr 08, 2020 Code refactoring in games and matches. (285024 lines)
Version 19.168: Apr 07, 2020 Code refactoring in forums. (284866 lines) Version 19.168: Apr 07, 2020 Code refactoring in forums. (284866 lines)
Version 19.167: Apr 06, 2020 Code refactoring in figures. (284772 lines) Version 19.167: Apr 06, 2020 Code refactoring in figures. (284772 lines)
Version 19.166.1: Apr 06, 2020 Fixed bug in API function loginByUserPasswordKey, reported by Javier Bueno López. (? lines) Version 19.166.1: Apr 06, 2020 Fixed bug in API function loginByUserPasswordKey, reported by Javier Bueno López. (? lines)

File diff suppressed because it is too large Load Diff

View File

@ -37,29 +37,6 @@
#define Gam_MAX_CHARS_TITLE (128 - 1) // 127 #define Gam_MAX_CHARS_TITLE (128 - 1) // 127
#define Gam_MAX_BYTES_TITLE ((Gam_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 #define Gam_MAX_BYTES_TITLE ((Gam_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
struct GameSelected
{
long GamCod; // Game code
bool Selected; // Is this game selected when seeing match results?
};
struct Game
{
long GamCod; // Game code
long CrsCod; // Course code
long UsrCod; // Author code
double MaxGrade; // Score range [0...max.score]
// will be converted to
// grade range [0...max.grade]
unsigned Visibility; // Visibility of results
char Title[Gam_MAX_BYTES_TITLE + 1];
time_t TimeUTC[Dat_NUM_START_END_TIME];
bool Hidden; // Game is hidden
unsigned NumQsts; // Number of questions in the game
unsigned NumMchs; // Number of matches in the game
unsigned NumUnfinishedMchs; // Number of unfinished matches in the game
};
#define Gam_NUM_ORDERS 3 #define Gam_NUM_ORDERS 3
typedef enum typedef enum
{ {
@ -77,33 +54,74 @@ typedef enum
} Gam_AnswerType_t; } Gam_AnswerType_t;
#define Gam_ANSWER_TYPE_DEFAULT Gam_ANS_UNIQUE_CHOICE #define Gam_ANSWER_TYPE_DEFAULT Gam_ANS_UNIQUE_CHOICE
struct Gam_GameSelected
{
long GamCod; // Game code
bool Selected; // Is this game selected when seeing match results?
};
struct Gam_Games
{
bool LstIsRead; // Is the list already read from database...
// ...or it needs to be read?
unsigned Num; // Total number of games
unsigned NumSelected; // Number of games selected
struct Gam_GameSelected *Lst;// List of games
Gam_Order_t SelectedOrder;
unsigned CurrentPage;
char *ListQuestions;
char *GamCodsSelected; // String with selected game codes separated by separator multiple
long GamCod; // Selected/current game code
long MchCod; // Selected/current match code
unsigned QstInd; // Current question index
};
struct Gam_Game
{
long GamCod; // Game code
long CrsCod; // Course code
long UsrCod; // Author code
double MaxGrade; // Score range [0...max.score]
// will be converted to
// grade range [0...max.grade]
unsigned Visibility; // Visibility of results
char Title[Gam_MAX_BYTES_TITLE + 1];
time_t TimeUTC[Dat_NUM_START_END_TIME];
bool Hidden; // Game is hidden
unsigned NumQsts; // Number of questions in the game
unsigned NumMchs; // Number of matches in the game
unsigned NumUnfinishedMchs; // Number of unfinished matches in the game
};
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Gam_ResetGames (struct Gam_Games *Games);
void Gam_SeeAllGames (void); void Gam_SeeAllGames (void);
void Gam_SeeOneGame (void); void Gam_SeeOneGame (void);
void Gam_ShowOnlyOneGame (struct Game *Game, void Gam_ShowOnlyOneGame (struct Gam_Games *Games,
struct Gam_Game *Game,
bool ListGameQuestions, bool ListGameQuestions,
bool PutFormNewMatch); bool PutFormNewMatch);
void Gam_ShowOnlyOneGameBegin (struct Game *Game, void Gam_ShowOnlyOneGameBegin (struct Gam_Games *Games,
struct Gam_Game *Game,
bool ListGameQuestions, bool ListGameQuestions,
bool PutFormNewMatch); bool PutFormNewMatch);
void Gam_ShowOnlyOneGameEnd (void); void Gam_ShowOnlyOneGameEnd (void);
void Gam_PutHiddenParamGameOrder (void);
void Gam_RequestCreatOrEditGame (void);
void Gam_SetCurrentGamCod (long GamCod); void Gam_SetCurrentGamCod (long GamCod);
void Gam_PutParams (void *Args); void Gam_PutParams (void *Games);
void Gam_PutParamGameCod (long GamCod); void Gam_PutParamGameCod (long GamCod);
long Gam_GetParamGameCod (void); long Gam_GetParamGameCod (void);
long Gam_GetParams (void); long Gam_GetParams (struct Gam_Games *Games);
void Gam_GetListGames (Gam_Order_t SelectedOrder); void Gam_GetListGames (struct Gam_Games *Games,Gam_Order_t SelectedOrder);
void Gam_GetListSelectedGamCods (void); void Gam_GetListSelectedGamCods (struct Gam_Games *Games);
void Gam_GetDataOfGameByCod (struct Game *Gam); void Gam_GetDataOfGameByCod (struct Gam_Game *Gam);
void Gam_GetDataOfGameByFolder (struct Game *Gam); void Gam_GetDataOfGameByFolder (struct Gam_Game *Gam);
void Gam_FreeListGames (void); void Gam_FreeListGames (struct Gam_Games *Games);
void Gam_AskRemGame (void); void Gam_AskRemGame (void);
void Gam_RemoveGame (void); void Gam_RemoveGame (void);
@ -111,8 +129,11 @@ void Gam_RemoveGamesCrs (long CrsCod);
void Gam_HideGame (void); void Gam_HideGame (void);
void Gam_UnhideGame (void); void Gam_UnhideGame (void);
void Gam_RequestCreatOrEditGame (void);
void Gam_RecFormGame (void); void Gam_RecFormGame (void);
bool Gam_CheckIfMatchIsAssociatedToGrp (long MchCod,long GrpCod); bool Mch_CheckIfMatchIsAssociatedToGrp (long MchCod,long GrpCod);
unsigned Gam_GetNumQstsGame (long GamCod); unsigned Gam_GetNumQstsGame (long GamCod);
@ -133,7 +154,7 @@ void Gam_RemoveQst (void);
void Gam_MoveUpQst (void); void Gam_MoveUpQst (void);
void Gam_MoveDownQst (void); void Gam_MoveDownQst (void);
void Gam_PutButtonNewMatch (long GamCod); void Gam_PutButtonNewMatch (struct Gam_Games *Games,long GamCod);
void Gam_RequestNewMatch (void); void Gam_RequestNewMatch (void);
unsigned Gam_GetNumCoursesWithGames (Hie_Level_t Scope); unsigned Gam_GetNumCoursesWithGames (Hie_Level_t Scope);

View File

@ -337,9 +337,6 @@ void Gbl_InitializeGlobals (void)
Gbl.Usrs.Connected.TimeToRefreshInMs = Con_MAX_TIME_TO_REFRESH_CONNECTED_IN_MS; Gbl.Usrs.Connected.TimeToRefreshInMs = Con_MAX_TIME_TO_REFRESH_CONNECTED_IN_MS;
/* Games for remote control */
Gbl.Games.ListQuestions = NULL;
/* Public activity */ /* Public activity */
Gbl.Timeline.Who = TL_DEFAULT_WHO; Gbl.Timeline.Who = TL_DEFAULT_WHO;

View File

@ -513,7 +513,7 @@ struct Globals
bool HiddenLevels[1 + Brw_MAX_DIR_LEVELS]; bool HiddenLevels[1 + Brw_MAX_DIR_LEVELS];
const char *TxtStyle; const char *TxtStyle;
const char *InputStyle; const char *InputStyle;
struct Assignment Asg; // Data of assignment when browsing level 1 or an assignment zone struct Asg_Assignment Asg; // Data of assignment when browsing level 1 or an assignment zone
struct struct
{ {
bool CreateZIP; bool CreateZIP;
@ -603,19 +603,6 @@ struct Globals
struct DateTime DateEnd; // TODO: Remove in future versions struct DateTime DateEnd; // TODO: Remove in future versions
time_t TimeUTC[Dat_NUM_START_END_TIME]; time_t TimeUTC[Dat_NUM_START_END_TIME];
} DateRange; } DateRange;
struct
{
bool LstIsRead; // Is the list already read from database...
// ...or it needs to be read?
unsigned Num; // Total number of games
unsigned NumSelected; // Number of games selected
struct GameSelected *Lst; // List of games
Gam_Order_t SelectedOrder;
unsigned CurrentPage;
char *ListQuestions;
long MchCodBeingPlayed; // Used to refresh game via AJAX
char *GamCodsSelected; // String with selected game codes separated by separator multiple
} Games;
struct struct
{ {
bool LstIsRead; // Is the list already read from database, or it needs to be read? bool LstIsRead; // Is the list already read from database, or it needs to be read?

View File

@ -1718,7 +1718,7 @@ void Grp_ListGrpsToEditAsgAttSvyMch (struct GroupType *GrpTyp,long Cod,
AssociatedToGrp = Svy_CheckIfSvyIsAssociatedToGrp (Cod,Grp->GrpCod); AssociatedToGrp = Svy_CheckIfSvyIsAssociatedToGrp (Cod,Grp->GrpCod);
break; break;
case Grp_MATCH: case Grp_MATCH:
AssociatedToGrp = Gam_CheckIfMatchIsAssociatedToGrp (Cod,Grp->GrpCod); AssociatedToGrp = Mch_CheckIfMatchIsAssociatedToGrp (Cod,Grp->GrpCod);
break; break;
} }

View File

@ -48,6 +48,7 @@
#include "swad_language.h" #include "swad_language.h"
#include "swad_log.h" #include "swad_log.h"
#include "swad_logo.h" #include "swad_logo.h"
#include "swad_match.h"
#include "swad_MFU.h" #include "swad_MFU.h"
#include "swad_notice.h" #include "swad_notice.h"
#include "swad_notification.h" #include "swad_notification.h"
@ -898,7 +899,7 @@ static void Lay_WriteScriptParamsAJAX (void)
HTM_TxtF ("var RefreshParamNxtActMch = \"act=%ld\";\n" HTM_TxtF ("var RefreshParamNxtActMch = \"act=%ld\";\n"
"var RefreshParamMchCod = \"MchCod=%ld\";\n", "var RefreshParamMchCod = \"MchCod=%ld\";\n",
Act_GetActCod (ActRefMchStd), Act_GetActCod (ActRefMchStd),
Gbl.Games.MchCodBeingPlayed); Mch_GetMchCodBeingPlayed ());
break; break;
/* Parameters related with match refreshing (for teachers) */ /* Parameters related with match refreshing (for teachers) */
case ActNewMch: case ActNewMch:
@ -915,7 +916,7 @@ static void Lay_WriteScriptParamsAJAX (void)
HTM_TxtF ("var RefreshParamNxtActMch = \"act=%ld\";\n" HTM_TxtF ("var RefreshParamNxtActMch = \"act=%ld\";\n"
"var RefreshParamMchCod = \"MchCod=%ld\";\n", "var RefreshParamMchCod = \"MchCod=%ld\";\n",
Act_GetActCod (ActRefMchTch), Act_GetActCod (ActRefMchTch),
Gbl.Games.MchCodBeingPlayed); Mch_GetMchCodBeingPlayed ());
break; break;
/* Parameter related with clicks refreshing */ /* Parameter related with clicks refreshing */
case ActLstClk: case ActLstClk:
@ -1389,6 +1390,15 @@ void Lay_WrongOrderExit (void)
Lay_ShowErrorAndExit ("Wrong order."); Lay_ShowErrorAndExit ("Wrong order.");
} }
/*****************************************************************************/
/************* Write error message and exit when wrong order *****************/
/*****************************************************************************/
void Lay_WrongTypeOfViewExit (void)
{
Lay_ShowErrorAndExit ("Wrong type of view.");
}
/*****************************************************************************/ /*****************************************************************************/
/******* Write error message, close files, remove lock file, and exit ********/ /******* Write error message, close files, remove lock file, and exit ********/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -72,6 +72,7 @@ void Lay_PutContextualCheckbox (Act_Action_t NextAction,
void Lay_NotEnoughMemoryExit (void); void Lay_NotEnoughMemoryExit (void);
void Lay_WrongScopeExit (void); void Lay_WrongScopeExit (void);
void Lay_WrongOrderExit (void); void Lay_WrongOrderExit (void);
void Lay_WrongTypeOfViewExit (void);
void Lay_NoPermissionExit (void); void Lay_NoPermissionExit (void);
void Lay_ShowErrorAndExit (const char *Txt); void Lay_ShowErrorAndExit (const char *Txt);

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@ typedef enum
} Mch_Showing_t; } Mch_Showing_t;
#define Mch_SHOWING_DEFAULT Mch_START #define Mch_SHOWING_DEFAULT Mch_START
struct Match struct Mch_Match
{ {
long MchCod; long MchCod;
long GamCod; long GamCod;
@ -82,8 +82,12 @@ struct Mch_UsrAnswer
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Mch_ListMatches (struct Game *Game,bool PutFormNewMatch); long Mch_GetMchCodBeingPlayed (void);
void Mch_GetDataOfMatchByCod (struct Match *Match);
void Mch_ListMatches (struct Gam_Games *Games,
struct Gam_Game *Game,
bool PutFormNewMatch);
void Mch_GetDataOfMatchByCod (struct Mch_Match *Match);
void Mch_ToggleVisibilResultsMchUsr (void); void Mch_ToggleVisibilResultsMchUsr (void);
@ -94,8 +98,10 @@ void Mch_RemoveMatchesInGameFromAllTables (long GamCod);
void Mch_RemoveMatchInCourseFromAllTables (long CrsCod); void Mch_RemoveMatchInCourseFromAllTables (long CrsCod);
void Mch_RemoveUsrFromMatchTablesInCrs (long UsrCod,long CrsCod); void Mch_RemoveUsrFromMatchTablesInCrs (long UsrCod,long CrsCod);
void Mch_PutParamsEdit (void *Args); void Mch_PutParamsEdit (void *Games);
void Mch_GetAndCheckParameters (struct Game *Game,struct Match *Match); void Mch_GetAndCheckParameters (struct Gam_Games *Games,
struct Gam_Game *Game,
struct Mch_Match *Match);
long Mch_GetParamMchCod (void); long Mch_GetParamMchCod (void);
void Mch_CreateNewMatchTch (void); void Mch_CreateNewMatchTch (void);
@ -115,13 +121,13 @@ void Mch_ForwardMatch (void);
unsigned Mch_GetNumMchsInGame (long GamCod); unsigned Mch_GetNumMchsInGame (long GamCod);
unsigned Mch_GetNumUnfinishedMchsInGame (long GamCod); unsigned Mch_GetNumUnfinishedMchsInGame (long GamCod);
bool Mch_CheckIfICanPlayThisMatchBasedOnGrps (const struct Match *Match); bool Mch_CheckIfICanPlayThisMatchBasedOnGrps (const struct Mch_Match *Match);
void Mch_WriteChoiceAnsViewMatch (const struct Match *Match, void Mch_WriteChoiceAnsViewMatch (const struct Mch_Match *Match,
const struct Tst_Question *Question, const struct Tst_Question *Question,
const char *Class,bool ShowResult); const char *Class,bool ShowResult);
bool Mch_RegisterMeAsPlayerInMatch (struct Match *Match); bool Mch_RegisterMeAsPlayerInMatch (struct Mch_Match *Match);
void Mch_GetMatchBeingPlayed (void); void Mch_GetMatchBeingPlayed (void);
void Mch_JoinMatchAsStd (void); void Mch_JoinMatchAsStd (void);
@ -139,6 +145,4 @@ unsigned Mch_GetNumUsrsWhoAnsweredQst (long MchCod,unsigned QstInd);
unsigned Mch_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsigned AnsInd); unsigned Mch_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsigned AnsInd);
void Mch_DrawBarNumUsrs (unsigned NumRespondersAns,unsigned NumRespondersQst,bool Correct); void Mch_DrawBarNumUsrs (unsigned NumRespondersAns,unsigned NumRespondersQst,bool Correct);
void Mch_SetCurrentMchCod (long MchCod);
#endif #endif

View File

@ -70,56 +70,41 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void MchRes_ListMyMchResultsInCrs (void); static void MchRes_PutFormToSelUsrsToViewMchResults (void *Games);
static void MchRes_ListMyMchResultsInGam (long GamCod);
static void MchRes_ListMyMchResultsInMch (long MchCod);
static void MchRes_ShowAllMchResultsInSelectedGames (void *Args);
static void MchRes_ListAllMchResultsInSelectedGames (void);
static void MchRes_ListAllMchResultsInGam (long GamCod);
static void MchRes_ListAllMchResultsInMch (long MchCod);
static void MchRes_ShowResultsBegin (const char *Title,bool ListGamesToSelect); static void MchRes_ListMyMchResultsInCrs (struct Gam_Games *Games);
static void MchRes_ListMyMchResultsInGam (struct Gam_Games *Games,long GamCod);
static void MchRes_ListMyMchResultsInMch (struct Gam_Games *Games,long MchCod);
static void MchRes_ShowAllMchResultsInSelectedGames (void *Games);
static void MchRes_ListAllMchResultsInSelectedGames (struct Gam_Games *Games);
static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games,long GamCod);
static void MchRes_ListAllMchResultsInMch (struct Gam_Games *Games,long MchCod);
static void MchRes_ShowResultsBegin (struct Gam_Games *Games,
const char *Title,bool ListGamesToSelect);
static void MchRes_ShowResultsEnd (void); static void MchRes_ShowResultsEnd (void);
static void MchRes_ListGamesToSelect (void); static void MchRes_ListGamesToSelect (struct Gam_Games *Games);
static void MchRes_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther); static void MchRes_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther);
static void MchRes_BuildGamesSelectedCommas (char **GamesSelectedCommas); static void MchRes_BuildGamesSelectedCommas (struct Gam_Games *Games,
static void MchRes_ShowMchResults (Usr_MeOrOther_t MeOrOther, char **GamesSelectedCommas);
long MchCod, // <= 0 ==> any static void MchRes_ShowMchResults (struct Gam_Games *Games,
long GamCod, // <= 0 ==> any Usr_MeOrOther_t MeOrOther,
const char *GamesSelectedCommas); long MchCod, // <= 0 ==> any
long GamCod, // <= 0 ==> any
const char *GamesSelectedCommas);
static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults, static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults,
unsigned NumTotalQsts, unsigned NumTotalQsts,
unsigned NumTotalQstsNotBlank, unsigned NumTotalQstsNotBlank,
double TotalScoreOfAllResults, double TotalScoreOfAllResults,
double TotalGrade); double TotalGrade);
static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod, static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
struct TstExa_Exam *Exam); struct TstExa_Exam *Exam);
static bool MchRes_CheckIfICanSeeMatchResult (struct Match *Match,long UsrCod); static bool MchRes_CheckIfICanSeeMatchResult (struct Mch_Match *Match,long UsrCod);
static bool MchRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility); static bool MchRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility);
/*****************************************************************************/
/*********** Select users and dates to show their matches results ************/
/*****************************************************************************/
void MchRes_SelUsrsToViewMchResults (void *Args)
{
extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *Txt_Results;
extern const char *Txt_View_matches_results;
if (Args)
Usr_PutFormToSelectUsrsToGoToAct (&Gbl.Usrs.Selected,
ActSeeAllMchResCrs,
NULL,NULL,
Txt_Results,
Hlp_ASSESSMENT_Games_results,
Txt_View_matches_results,
false); // Do not put form with date range
}
/*****************************************************************************/ /*****************************************************************************/
/*************************** Show my matches results *************************/ /*************************** Show my matches results *************************/
/*****************************************************************************/ /*****************************************************************************/
@ -127,22 +112,26 @@ void MchRes_SelUsrsToViewMchResults (void *Args)
void MchRes_ShowMyMchResultsInCrs (void) void MchRes_ShowMyMchResultsInCrs (void)
{ {
extern const char *Txt_Results; extern const char *Txt_Results;
struct Gam_Games Games;
/***** Reset games *****/
Gam_ResetGames (&Games);
/***** Get list of games *****/ /***** Get list of games *****/
Gam_GetListGames (Gam_ORDER_BY_TITLE); Gam_GetListGames (&Games,Gam_ORDER_BY_TITLE);
Gam_GetListSelectedGamCods (); Gam_GetListSelectedGamCods (&Games);
/***** List my matches results in the current course *****/ /***** List my matches results in the current course *****/
MchRes_ShowResultsBegin (Txt_Results,true); // List games to select MchRes_ShowResultsBegin (&Games,Txt_Results,true); // List games to select
MchRes_ListMyMchResultsInCrs (); MchRes_ListMyMchResultsInCrs (&Games);
MchRes_ShowResultsEnd (); MchRes_ShowResultsEnd ();
/***** Free list of games *****/ /***** Free list of games *****/
free (Gbl.Games.GamCodsSelected); free (Games.GamCodsSelected);
Gam_FreeListGames (); Gam_FreeListGames (&Games);
} }
static void MchRes_ListMyMchResultsInCrs (void) static void MchRes_ListMyMchResultsInCrs (struct Gam_Games *Games)
{ {
char *GamesSelectedCommas = NULL; // Initialized to avoid warning char *GamesSelectedCommas = NULL; // Initialized to avoid warning
@ -151,8 +140,8 @@ static void MchRes_ListMyMchResultsInCrs (void)
/***** List my matches results in the current course *****/ /***** List my matches results in the current course *****/
TstCfg_GetConfigFromDB (); // Get feedback type TstCfg_GetConfigFromDB (); // Get feedback type
MchRes_BuildGamesSelectedCommas (&GamesSelectedCommas); MchRes_BuildGamesSelectedCommas (Games,&GamesSelectedCommas);
MchRes_ShowMchResults (Usr_ME,-1L,-1L,GamesSelectedCommas); MchRes_ShowMchResults (Games,Usr_ME,-1L,-1L,GamesSelectedCommas);
free (GamesSelectedCommas); free (GamesSelectedCommas);
} }
@ -163,37 +152,42 @@ static void MchRes_ListMyMchResultsInCrs (void)
void MchRes_ShowMyMchResultsInGam (void) void MchRes_ShowMyMchResultsInGam (void)
{ {
extern const char *Txt_Results_of_game_X; extern const char *Txt_Results_of_game_X;
struct Game Game; struct Gam_Games Games;
struct Gam_Game Game;
/***** Reset games *****/
Gam_ResetGames (&Games);
/***** Get parameters *****/ /***** Get parameters *****/
if ((Game.GamCod = Gam_GetParams ()) == -1L) if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
Lay_ShowErrorAndExit ("Code of game is missing."); Lay_ShowErrorAndExit ("Code of game is missing.");
Gam_GetDataOfGameByCod (&Game); Gam_GetDataOfGameByCod (&Game);
/***** Game begin *****/ /***** Game begin *****/
Gam_ShowOnlyOneGameBegin (&Game, Gam_ShowOnlyOneGameBegin (&Games,&Game,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match false); // Do not put form to start new match
/***** List my matches results in game *****/ /***** List my matches results in game *****/
MchRes_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_game_X,Game.Title), MchRes_ShowResultsBegin (&Games,
false); // Do not list games to select Str_BuildStringStr (Txt_Results_of_game_X,Game.Title),
false); // Do not list games to select
Str_FreeString (); Str_FreeString ();
MchRes_ListMyMchResultsInGam (Game.GamCod); MchRes_ListMyMchResultsInGam (&Games,Game.GamCod);
MchRes_ShowResultsEnd (); MchRes_ShowResultsEnd ();
/***** Game end *****/ /***** Game end *****/
Gam_ShowOnlyOneGameEnd (); Gam_ShowOnlyOneGameEnd ();
} }
static void MchRes_ListMyMchResultsInGam (long GamCod) static void MchRes_ListMyMchResultsInGam (struct Gam_Games *Games,long GamCod)
{ {
/***** Table header *****/ /***** Table header *****/
MchRes_ShowHeaderMchResults (Usr_ME); MchRes_ShowHeaderMchResults (Usr_ME);
/***** List my matches results in game *****/ /***** List my matches results in game *****/
TstCfg_GetConfigFromDB (); // Get feedback type TstCfg_GetConfigFromDB (); // Get feedback type
MchRes_ShowMchResults (Usr_ME,-1L,GamCod,NULL); MchRes_ShowMchResults (Games,Usr_ME,-1L,GamCod,NULL);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -203,41 +197,45 @@ static void MchRes_ListMyMchResultsInGam (long GamCod)
void MchRes_ShowMyMchResultsInMch (void) void MchRes_ShowMyMchResultsInMch (void)
{ {
extern const char *Txt_Results_of_match_X; extern const char *Txt_Results_of_match_X;
struct Game Game; struct Gam_Games Games;
struct Match Match; struct Gam_Game Game;
struct Mch_Match Match;
/***** Reset games *****/
Gam_ResetGames (&Games);
/***** Get parameters *****/ /***** Get parameters *****/
if ((Game.GamCod = Gam_GetParams ()) == -1L) if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
Lay_ShowErrorAndExit ("Code of game is missing."); Lay_ShowErrorAndExit ("Code of game is missing.");
if ((Match.MchCod = Mch_GetParamMchCod ()) == -1L) if ((Match.MchCod = Mch_GetParamMchCod ()) <= 0)
Lay_ShowErrorAndExit ("Code of match is missing."); Lay_ShowErrorAndExit ("Code of match is missing.");
Gam_GetDataOfGameByCod (&Game); Gam_GetDataOfGameByCod (&Game);
Mch_GetDataOfMatchByCod (&Match); Mch_GetDataOfMatchByCod (&Match);
/***** Game begin *****/ /***** Game begin *****/
Gam_ShowOnlyOneGameBegin (&Game, Gam_ShowOnlyOneGameBegin (&Games,&Game,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match false); // Do not put form to start new match
/***** List my matches results in match *****/ /***** List my matches results in match *****/
MchRes_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_match_X,Match.Title), MchRes_ShowResultsBegin (&Games,Str_BuildStringStr (Txt_Results_of_match_X,Match.Title),
false); // Do not list games to select false); // Do not list games to select
Str_FreeString (); Str_FreeString ();
MchRes_ListMyMchResultsInMch (Match.MchCod); MchRes_ListMyMchResultsInMch (&Games,Match.MchCod);
MchRes_ShowResultsEnd (); MchRes_ShowResultsEnd ();
/***** Game end *****/ /***** Game end *****/
Gam_ShowOnlyOneGameEnd (); Gam_ShowOnlyOneGameEnd ();
} }
static void MchRes_ListMyMchResultsInMch (long MchCod) static void MchRes_ListMyMchResultsInMch (struct Gam_Games *Games,long MchCod)
{ {
/***** Table header *****/ /***** Table header *****/
MchRes_ShowHeaderMchResults (Usr_ME); MchRes_ShowHeaderMchResults (Usr_ME);
/***** List my matches results in game *****/ /***** List my matches results in game *****/
TstCfg_GetConfigFromDB (); // Get feedback type TstCfg_GetConfigFromDB (); // Get feedback type
MchRes_ShowMchResults (Usr_ME,MchCod,-1L,NULL); MchRes_ShowMchResults (Games,Usr_ME,MchCod,-1L,NULL);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -246,37 +244,45 @@ static void MchRes_ListMyMchResultsInMch (long MchCod)
void MchRes_ShowAllMchResultsInCrs (void) void MchRes_ShowAllMchResultsInCrs (void)
{ {
struct Gam_Games Games;
/***** Reset games *****/
Gam_ResetGames (&Games);
/***** Get users and show their matches results *****/
Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected, Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected,
MchRes_ShowAllMchResultsInSelectedGames,&Gbl, MchRes_ShowAllMchResultsInSelectedGames,&Games,
MchRes_SelUsrsToViewMchResults,&Gbl); MchRes_PutFormToSelUsrsToViewMchResults,&Games);
} }
/*****************************************************************************/ /*****************************************************************************/
/****************** Show matches results for several users *******************/ /****************** Show matches results for several users *******************/
/*****************************************************************************/ /*****************************************************************************/
static void MchRes_ShowAllMchResultsInSelectedGames (void *Args) static void MchRes_ShowAllMchResultsInSelectedGames (void *Games)
{ {
extern const char *Txt_Results; extern const char *Txt_Results;
if (!Args) if (!Games)
return; return;
/***** Get list of games *****/ /***** Get list of games *****/
Gam_GetListGames (Gam_ORDER_BY_TITLE); Gam_GetListGames ((struct Gam_Games *) Games,Gam_ORDER_BY_TITLE);
Gam_GetListSelectedGamCods (); Gam_GetListSelectedGamCods ((struct Gam_Games *) Games);
/***** List the matches results of the selected users *****/ /***** List the matches results of the selected users *****/
MchRes_ShowResultsBegin (Txt_Results,true); // List games to select MchRes_ShowResultsBegin ((struct Gam_Games *) Games,
MchRes_ListAllMchResultsInSelectedGames (); Txt_Results,
true); // List games to select
MchRes_ListAllMchResultsInSelectedGames ((struct Gam_Games *) Games);
MchRes_ShowResultsEnd (); MchRes_ShowResultsEnd ();
/***** Free list of games *****/ /***** Free list of games *****/
free (Gbl.Games.GamCodsSelected); free (((struct Gam_Games *) Games)->GamCodsSelected);
Gam_FreeListGames (); Gam_FreeListGames ((struct Gam_Games *) Games);
} }
static void MchRes_ListAllMchResultsInSelectedGames (void) static void MchRes_ListAllMchResultsInSelectedGames (struct Gam_Games *Games)
{ {
char *GamesSelectedCommas = NULL; // Initialized to avoid warning char *GamesSelectedCommas = NULL; // Initialized to avoid warning
const char *Ptr; const char *Ptr;
@ -285,7 +291,7 @@ static void MchRes_ListAllMchResultsInSelectedGames (void)
MchRes_ShowHeaderMchResults (Usr_OTHER); MchRes_ShowHeaderMchResults (Usr_OTHER);
/***** List the matches results of the selected users *****/ /***** List the matches results of the selected users *****/
MchRes_BuildGamesSelectedCommas (&GamesSelectedCommas); MchRes_BuildGamesSelectedCommas (Games,&GamesSelectedCommas);
Ptr = Gbl.Usrs.Selected.List[Rol_UNK]; Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
while (*Ptr) while (*Ptr)
{ {
@ -297,12 +303,43 @@ static void MchRes_ListAllMchResultsInSelectedGames (void)
{ {
/***** Show matches results *****/ /***** Show matches results *****/
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
MchRes_ShowMchResults (Usr_OTHER,-1L,-1L,GamesSelectedCommas); MchRes_ShowMchResults (Games,Usr_OTHER,-1L,-1L,GamesSelectedCommas);
} }
} }
free (GamesSelectedCommas); free (GamesSelectedCommas);
} }
/*****************************************************************************/
/**************** Select users to show their matches results *****************/
/*****************************************************************************/
void MchRes_SelUsrsToViewMchResults (void)
{
struct Gam_Games Games;
/***** Reset games *****/
Gam_ResetGames (&Games);
/***** Put form to select users *****/
MchRes_PutFormToSelUsrsToViewMchResults (&Games);
}
static void MchRes_PutFormToSelUsrsToViewMchResults (void *Games)
{
extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *Txt_Results;
extern const char *Txt_View_matches_results;
if (Games) // Not used
Usr_PutFormToSelectUsrsToGoToAct (&Gbl.Usrs.Selected,
ActSeeAllMchResCrs,
NULL,NULL,
Txt_Results,
Hlp_ASSESSMENT_Games_results,
Txt_View_matches_results,
false); // Do not put form with date range
}
/*****************************************************************************/ /*****************************************************************************/
/*** Show matches results of a game for the users who answered in that game **/ /*** Show matches results of a game for the users who answered in that game **/
/*****************************************************************************/ /*****************************************************************************/
@ -310,30 +347,35 @@ static void MchRes_ListAllMchResultsInSelectedGames (void)
void MchRes_ShowAllMchResultsInGam (void) void MchRes_ShowAllMchResultsInGam (void)
{ {
extern const char *Txt_Results_of_game_X; extern const char *Txt_Results_of_game_X;
struct Game Game; struct Gam_Games Games;
struct Gam_Game Game;
/***** Reset games *****/
Gam_ResetGames (&Games);
/***** Get parameters *****/ /***** Get parameters *****/
if ((Game.GamCod = Gam_GetParams ()) == -1L) if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
Lay_ShowErrorAndExit ("Code of game is missing."); Lay_ShowErrorAndExit ("Code of game is missing.");
Gam_GetDataOfGameByCod (&Game); Gam_GetDataOfGameByCod (&Game);
/***** Game begin *****/ /***** Game begin *****/
Gam_ShowOnlyOneGameBegin (&Game, Gam_ShowOnlyOneGameBegin (&Games,&Game,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match false); // Do not put form to start new match
/***** List matches results in game *****/ /***** List matches results in game *****/
MchRes_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_game_X,Game.Title), MchRes_ShowResultsBegin (&Games,
false); // Do not list games to select Str_BuildStringStr (Txt_Results_of_game_X,Game.Title),
false); // Do not list games to select
Str_FreeString (); Str_FreeString ();
MchRes_ListAllMchResultsInGam (Game.GamCod); MchRes_ListAllMchResultsInGam (&Games,Game.GamCod);
MchRes_ShowResultsEnd (); MchRes_ShowResultsEnd ();
/***** Game end *****/ /***** Game end *****/
Gam_ShowOnlyOneGameEnd (); Gam_ShowOnlyOneGameEnd ();
} }
static void MchRes_ListAllMchResultsInGam (long GamCod) static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games,long GamCod)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -375,7 +417,7 @@ static void MchRes_ListAllMchResultsInGam (long GamCod)
{ {
/***** Show matches results *****/ /***** Show matches results *****/
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
MchRes_ShowMchResults (Usr_OTHER,-1L,GamCod,NULL); MchRes_ShowMchResults (Games,Usr_OTHER,-1L,GamCod,NULL);
} }
} }
} }
@ -391,34 +433,39 @@ static void MchRes_ListAllMchResultsInGam (long GamCod)
void MchRes_ShowAllMchResultsInMch (void) void MchRes_ShowAllMchResultsInMch (void)
{ {
extern const char *Txt_Results_of_match_X; extern const char *Txt_Results_of_match_X;
struct Game Game; struct Gam_Games Games;
struct Match Match; struct Gam_Game Game;
struct Mch_Match Match;
/***** Reset games *****/
Gam_ResetGames (&Games);
/***** Get parameters *****/ /***** Get parameters *****/
if ((Game.GamCod = Gam_GetParams ()) == -1L) if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
Lay_ShowErrorAndExit ("Code of game is missing."); Lay_ShowErrorAndExit ("Code of game is missing.");
if ((Match.MchCod = Mch_GetParamMchCod ()) == -1L) if ((Match.MchCod = Mch_GetParamMchCod ()) <= 0)
Lay_ShowErrorAndExit ("Code of match is missing."); Lay_ShowErrorAndExit ("Code of match is missing.");
Gam_GetDataOfGameByCod (&Game); Gam_GetDataOfGameByCod (&Game);
Mch_GetDataOfMatchByCod (&Match); Mch_GetDataOfMatchByCod (&Match);
/***** Game begin *****/ /***** Game begin *****/
Gam_ShowOnlyOneGameBegin (&Game, Gam_ShowOnlyOneGameBegin (&Games,&Game,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match false); // Do not put form to start new match
/***** List matches results in match *****/ /***** List matches results in match *****/
MchRes_ShowResultsBegin (Str_BuildStringStr (Txt_Results_of_match_X,Match.Title), MchRes_ShowResultsBegin (&Games,
false); // Do not list games to select Str_BuildStringStr (Txt_Results_of_match_X,Match.Title),
false); // Do not list games to select
Str_FreeString (); Str_FreeString ();
MchRes_ListAllMchResultsInMch (Match.MchCod); MchRes_ListAllMchResultsInMch (&Games,Match.MchCod);
MchRes_ShowResultsEnd (); MchRes_ShowResultsEnd ();
/***** Game end *****/ /***** Game end *****/
Gam_ShowOnlyOneGameEnd (); Gam_ShowOnlyOneGameEnd ();
} }
static void MchRes_ListAllMchResultsInMch (long MchCod) static void MchRes_ListAllMchResultsInMch (struct Gam_Games *Games,long MchCod)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -460,7 +507,7 @@ static void MchRes_ListAllMchResultsInMch (long MchCod)
{ {
/***** Show matches results *****/ /***** Show matches results *****/
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
MchRes_ShowMchResults (Usr_OTHER,MchCod,-1L,NULL); MchRes_ShowMchResults (Games,Usr_OTHER,MchCod,-1L,NULL);
} }
} }
} }
@ -473,7 +520,8 @@ static void MchRes_ListAllMchResultsInMch (long MchCod)
/************************ Show results (begin / end) *************************/ /************************ Show results (begin / end) *************************/
/*****************************************************************************/ /*****************************************************************************/
static void MchRes_ShowResultsBegin (const char *Title,bool ListGamesToSelect) static void MchRes_ShowResultsBegin (struct Gam_Games *Games,
const char *Title,bool ListGamesToSelect)
{ {
extern const char *Hlp_ASSESSMENT_Games_results; extern const char *Hlp_ASSESSMENT_Games_results;
@ -485,7 +533,7 @@ static void MchRes_ShowResultsBegin (const char *Title,bool ListGamesToSelect)
/***** List games to select *****/ /***** List games to select *****/
if (ListGamesToSelect) if (ListGamesToSelect)
MchRes_ListGamesToSelect (); MchRes_ListGamesToSelect (Games);
/***** Begin match results table *****/ /***** Begin match results table *****/
HTM_SECTION_Begin (MchRes_RESULTS_TABLE_ID); HTM_SECTION_Begin (MchRes_RESULTS_TABLE_ID);
@ -507,7 +555,7 @@ static void MchRes_ShowResultsEnd (void)
/********** Write list of those attendance events that have students *********/ /********** Write list of those attendance events that have students *********/
/*****************************************************************************/ /*****************************************************************************/
static void MchRes_ListGamesToSelect (void) static void MchRes_ListGamesToSelect (struct Gam_Games *Games)
{ {
extern const char *Hlp_ASSESSMENT_Games_results; extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *The_ClassFormLinkInBoxBold[The_NUM_THEMES]; extern const char *The_ClassFormLinkInBoxBold[The_NUM_THEMES];
@ -516,7 +564,7 @@ static void MchRes_ListGamesToSelect (void)
extern const char *Txt_Update_results; extern const char *Txt_Update_results;
unsigned UniqueId; unsigned UniqueId;
unsigned NumGame; unsigned NumGame;
struct Game Game; struct Gam_Game Game;
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_Games, Box_BoxBegin (NULL,Txt_Games,
@ -542,11 +590,11 @@ static void MchRes_ListGamesToSelect (void)
/***** List the events *****/ /***** List the events *****/
for (NumGame = 0, UniqueId = 1, Gbl.RowEvenOdd = 0; for (NumGame = 0, UniqueId = 1, Gbl.RowEvenOdd = 0;
NumGame < Gbl.Games.Num; NumGame < Games->Num;
NumGame++, UniqueId++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd) NumGame++, UniqueId++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
{ {
/* Get data of this game */ /* Get data of this game */
Game.GamCod = Gbl.Games.Lst[NumGame].GamCod; Game.GamCod = Games->Lst[NumGame].GamCod;
Gam_GetDataOfGameByCod (&Game); Gam_GetDataOfGameByCod (&Game);
/* Write a row for this event */ /* Write a row for this event */
@ -555,9 +603,9 @@ static void MchRes_ListGamesToSelect (void)
HTM_TD_Begin ("class=\"DAT CT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"DAT CT COLOR%u\"",Gbl.RowEvenOdd);
HTM_INPUT_CHECKBOX ("GamCod",HTM_DONT_SUBMIT_ON_CHANGE, HTM_INPUT_CHECKBOX ("GamCod",HTM_DONT_SUBMIT_ON_CHANGE,
"id=\"Gam%u\" value=\"%ld\"%s", "id=\"Gam%u\" value=\"%ld\"%s",
NumGame,Gbl.Games.Lst[NumGame].GamCod, NumGame,Games->Lst[NumGame].GamCod,
Gbl.Games.Lst[NumGame].Selected ? " checked=\"checked\"" : Games->Lst[NumGame].Selected ? " checked=\"checked\"" :
""); "");
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd);
@ -633,25 +681,26 @@ static void MchRes_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther)
/******* from list of selected games ********/ /******* from list of selected games ********/
/*****************************************************************************/ /*****************************************************************************/
static void MchRes_BuildGamesSelectedCommas (char **GamesSelectedCommas) static void MchRes_BuildGamesSelectedCommas (struct Gam_Games *Games,
char **GamesSelectedCommas)
{ {
size_t MaxLength; size_t MaxLength;
unsigned NumGame; unsigned NumGame;
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1]; char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
/***** Allocate memory for subquery of games selected *****/ /***** Allocate memory for subquery of games selected *****/
MaxLength = (size_t) Gbl.Games.NumSelected * (Cns_MAX_DECIMAL_DIGITS_LONG + 1); MaxLength = (size_t) Games->NumSelected * (Cns_MAX_DECIMAL_DIGITS_LONG + 1);
if ((*GamesSelectedCommas = (char *) malloc (MaxLength + 1)) == NULL) if ((*GamesSelectedCommas = (char *) malloc (MaxLength + 1)) == NULL)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
/***** Build subquery with list of selected games *****/ /***** Build subquery with list of selected games *****/
(*GamesSelectedCommas)[0] = '\0'; (*GamesSelectedCommas)[0] = '\0';
for (NumGame = 0; for (NumGame = 0;
NumGame < Gbl.Games.Num; NumGame < Games->Num;
NumGame++) NumGame++)
if (Gbl.Games.Lst[NumGame].Selected) if (Games->Lst[NumGame].Selected)
{ {
sprintf (LongStr,"%ld",Gbl.Games.Lst[NumGame].GamCod); sprintf (LongStr,"%ld",Games->Lst[NumGame].GamCod);
if ((*GamesSelectedCommas)[0]) if ((*GamesSelectedCommas)[0])
Str_Concat (*GamesSelectedCommas,",",MaxLength); Str_Concat (*GamesSelectedCommas,",",MaxLength);
Str_Concat (*GamesSelectedCommas,LongStr,MaxLength); Str_Concat (*GamesSelectedCommas,LongStr,MaxLength);
@ -662,10 +711,11 @@ static void MchRes_BuildGamesSelectedCommas (char **GamesSelectedCommas)
/********* Show the matches results of a user in the current course **********/ /********* Show the matches results of a user in the current course **********/
/*****************************************************************************/ /*****************************************************************************/
static void MchRes_ShowMchResults (Usr_MeOrOther_t MeOrOther, static void MchRes_ShowMchResults (struct Gam_Games *Games,
long MchCod, // <= 0 ==> any Usr_MeOrOther_t MeOrOther,
long GamCod, // <= 0 ==> any long MchCod, // <= 0 ==> any
const char *GamesSelectedCommas) long GamCod, // <= 0 ==> any
const char *GamesSelectedCommas)
{ {
extern const char *Txt_Match_result; extern const char *Txt_Match_result;
char *MchSubQuery; char *MchSubQuery;
@ -679,7 +729,7 @@ static void MchRes_ShowMchResults (Usr_MeOrOther_t MeOrOther,
unsigned NumResult; unsigned NumResult;
static unsigned UniqueId = 0; static unsigned UniqueId = 0;
char *Id; char *Id;
struct Match Match; struct Mch_Match Match;
Dat_StartEndTime_t StartEndTime; Dat_StartEndTime_t StartEndTime;
unsigned NumQstsInThisResult; unsigned NumQstsInThisResult;
unsigned NumQstsNotBlankInThisResult; unsigned NumQstsNotBlankInThisResult;
@ -888,17 +938,17 @@ static void MchRes_ShowMchResults (Usr_MeOrOther_t MeOrOther,
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
if (ICanViewResult) if (ICanViewResult)
{ {
Gam_SetCurrentGamCod (Match.GamCod); // Used to pass parameter Games->GamCod = Match.GamCod;
Mch_SetCurrentMchCod (Match.MchCod); // Used to pass parameter Games->MchCod = Match.MchCod;
switch (MeOrOther) switch (MeOrOther)
{ {
case Usr_ME: case Usr_ME:
Frm_StartForm (ActSeeOneMchResMe); Frm_StartForm (ActSeeOneMchResMe);
Mch_PutParamsEdit (&Gbl); Mch_PutParamsEdit (Games);
break; break;
case Usr_OTHER: case Usr_OTHER:
Frm_StartForm (ActSeeOneMchResOth); Frm_StartForm (ActSeeOneMchResOth);
Mch_PutParamsEdit (&Gbl); Mch_PutParamsEdit (Games);
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod); Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
break; break;
} }
@ -935,10 +985,10 @@ static void MchRes_ShowMchResults (Usr_MeOrOther_t MeOrOther,
/*****************************************************************************/ /*****************************************************************************/
static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults, static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults,
unsigned NumTotalQsts, unsigned NumTotalQsts,
unsigned NumTotalQstsNotBlank, unsigned NumTotalQstsNotBlank,
double TotalScoreOfAllResults, double TotalScoreOfAllResults,
double TotalGrade) double TotalGrade)
{ {
extern const char *Txt_Matches; extern const char *Txt_Matches;
@ -1003,8 +1053,9 @@ void MchRes_ShowOneMchResult (void)
extern const char *Txt_Score; extern const char *Txt_Score;
extern const char *Txt_Grade; extern const char *Txt_Grade;
extern const char *Txt_Tags; extern const char *Txt_Tags;
struct Game Game; struct Gam_Games Games;
struct Match Match; struct Gam_Game Game;
struct Mch_Match Match;
Usr_MeOrOther_t MeOrOther; Usr_MeOrOther_t MeOrOther;
struct UsrData *UsrDat; struct UsrData *UsrDat;
Dat_StartEndTime_t StartEndTime; Dat_StartEndTime_t StartEndTime;
@ -1015,8 +1066,11 @@ void MchRes_ShowOneMchResult (void)
bool ICanViewResult; bool ICanViewResult;
bool ICanViewScore; bool ICanViewScore;
/***** Reset games *****/
Gam_ResetGames (&Games);
/***** Get and check parameters *****/ /***** Get and check parameters *****/
Mch_GetAndCheckParameters (&Game,&Match); Mch_GetAndCheckParameters (&Games,&Game,&Match);
/***** Pointer to user's data *****/ /***** Pointer to user's data *****/
MeOrOther = (Gbl.Action.Act == ActSeeOneMchResMe) ? Usr_ME : MeOrOther = (Gbl.Action.Act == ActSeeOneMchResMe) ? Usr_ME :
@ -1353,7 +1407,7 @@ static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
/********************** Get if I can see match result ************************/ /********************** Get if I can see match result ************************/
/*****************************************************************************/ /*****************************************************************************/
static bool MchRes_CheckIfICanSeeMatchResult (struct Match *Match,long UsrCod) static bool MchRes_CheckIfICanSeeMatchResult (struct Mch_Match *Match,long UsrCod)
{ {
bool ItsMe; bool ItsMe;

View File

@ -40,13 +40,12 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void MchRes_SelUsrsToViewMchResults (void *Args);
void MchRes_ShowMyMchResultsInCrs (void); void MchRes_ShowMyMchResultsInCrs (void);
void MchRes_ShowMyMchResultsInGam (void); void MchRes_ShowMyMchResultsInGam (void);
void MchRes_ShowMyMchResultsInMch (void); void MchRes_ShowMyMchResultsInMch (void);
void MchRes_ShowAllMchResultsInCrs (void); void MchRes_ShowAllMchResultsInCrs (void);
void MchRes_SelUsrsToViewMchResults (void);
void MchRes_ShowAllMchResultsInGam (void); void MchRes_ShowAllMchResultsInGam (void);
void MchRes_ShowAllMchResultsInMch (void); void MchRes_ShowAllMchResultsInMch (void);

View File

@ -3182,7 +3182,7 @@ static void Sta_ShowNumHitsPerBanner (unsigned long NumRows,
double MaxClicks = 0.0; double MaxClicks = 0.0;
double TotalClicks = 0.0; double TotalClicks = 0.0;
MYSQL_ROW row; MYSQL_ROW row;
struct Banner Ban; struct Ban_Banner Ban;
/***** Write heading *****/ /***** Write heading *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);

View File

@ -159,7 +159,8 @@ static void Tst_IncreaseMyNumAccessTst (void);
static void Tst_UpdateLastAccTst (unsigned NumQsts); static void Tst_UpdateLastAccTst (unsigned NumQsts);
static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test); static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test);
static void Tst_ShowFormRequestSelectTestsForGame (struct Tst_Test *Test); static void Tst_ShowFormRequestSelectTestsForGame (struct Gam_Games *Games,
struct Tst_Test *Test);
static bool Tst_CheckIfICanEditTests (void); static bool Tst_CheckIfICanEditTests (void);
static void Tst_PutIconsTests (void *TestPtr); static void Tst_PutIconsTests (void *TestPtr);
static void Tst_PutButtonToAddQuestion (void); static void Tst_PutButtonToAddQuestion (void);
@ -192,7 +193,8 @@ static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
MYSQL_RES *mysql_res); MYSQL_RES *mysql_res);
static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test); static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test);
static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned NumQst); static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned NumQst);
static void Tst_ListOneOrMoreQuestionsForSelection (unsigned NumQsts, static void Tst_ListOneOrMoreQuestionsForSelection (struct Gam_Games *Games,
unsigned NumQsts,
MYSQL_RES *mysql_res); MYSQL_RES *mysql_res);
static void Tst_WriteQuestionRowForSelection (unsigned NumQst, static void Tst_WriteQuestionRowForSelection (unsigned NumQst,
struct Tst_Question *Question); struct Tst_Question *Question);
@ -1285,7 +1287,7 @@ static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test)
/******************* Select test questions for a game ************************/ /******************* Select test questions for a game ************************/
/*****************************************************************************/ /*****************************************************************************/
void Tst_RequestSelectTestsForGame (void) void Tst_RequestSelectTestsForGame (struct Gam_Games *Games)
{ {
struct Tst_Test Test; struct Tst_Test Test;
@ -1293,7 +1295,7 @@ void Tst_RequestSelectTestsForGame (void)
Tst_TstConstructor (&Test); Tst_TstConstructor (&Test);
/***** Show form to select test for game *****/ /***** Show form to select test for game *****/
Tst_ShowFormRequestSelectTestsForGame (&Test); // No tags selected Tst_ShowFormRequestSelectTestsForGame (Games,&Test); // No tags selected
/***** Destroy test *****/ /***** Destroy test *****/
Tst_TstDestructor (&Test); Tst_TstDestructor (&Test);
@ -1303,7 +1305,8 @@ void Tst_RequestSelectTestsForGame (void)
/************** Show form to select test questions for a game ****************/ /************** Show form to select test questions for a game ****************/
/*****************************************************************************/ /*****************************************************************************/
static void Tst_ShowFormRequestSelectTestsForGame (struct Tst_Test *Test) static void Tst_ShowFormRequestSelectTestsForGame (struct Gam_Games *Games,
struct Tst_Test *Test)
{ {
extern const char *Hlp_ASSESSMENT_Games_questions; extern const char *Hlp_ASSESSMENT_Games_questions;
extern const char *Txt_No_test_questions; extern const char *Txt_No_test_questions;
@ -1325,7 +1328,7 @@ static void Tst_ShowFormRequestSelectTestsForGame (struct Tst_Test *Test)
if ((Test->Tags.Num = Tst_GetAllTagsFromCurrentCrs (&mysql_res))) if ((Test->Tags.Num = Tst_GetAllTagsFromCurrentCrs (&mysql_res)))
{ {
Frm_StartForm (ActGamLstTstQst); Frm_StartForm (ActGamLstTstQst);
Gam_PutParams (&Gbl); Gam_PutParams (Games);
HTM_TABLE_BeginPadding (2); HTM_TABLE_BeginPadding (2);
@ -2215,7 +2218,7 @@ void Tst_ListQuestionsToEdit (void)
/**************** List several test questions for selection ******************/ /**************** List several test questions for selection ******************/
/*****************************************************************************/ /*****************************************************************************/
void Tst_ListQuestionsToSelect (void) void Tst_ListQuestionsToSelect (struct Gam_Games *Games)
{ {
struct Tst_Test Test; struct Tst_Test Test;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
@ -2229,14 +2232,14 @@ void Tst_ListQuestionsToSelect (void)
Tst_GetQuestions (&Test,&mysql_res); // Query database Tst_GetQuestions (&Test,&mysql_res); // Query database
if (Test.NumQsts) if (Test.NumQsts)
/* Show the table with the questions */ /* Show the table with the questions */
Tst_ListOneOrMoreQuestionsForSelection (Test.NumQsts,mysql_res); Tst_ListOneOrMoreQuestionsForSelection (Games,Test.NumQsts,mysql_res);
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
else else
/* Show the form again */ /* Show the form again */
Tst_ShowFormRequestSelectTestsForGame (&Test); Tst_ShowFormRequestSelectTestsForGame (Games,&Test);
/***** Destroy test *****/ /***** Destroy test *****/
Tst_TstDestructor (&Test); Tst_TstDestructor (&Test);
@ -2926,7 +2929,8 @@ static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned NumQst)
/*************** List for selection one or more test questions ***************/ /*************** List for selection one or more test questions ***************/
/*****************************************************************************/ /*****************************************************************************/
static void Tst_ListOneOrMoreQuestionsForSelection (unsigned NumQsts, static void Tst_ListOneOrMoreQuestionsForSelection (struct Gam_Games *Games,
unsigned NumQsts,
MYSQL_RES *mysql_res) MYSQL_RES *mysql_res)
{ {
extern const char *Hlp_ASSESSMENT_Games_questions; extern const char *Hlp_ASSESSMENT_Games_questions;
@ -2950,7 +2954,7 @@ static void Tst_ListOneOrMoreQuestionsForSelection (unsigned NumQsts,
/***** Begin form *****/ /***** Begin form *****/
Frm_StartForm (ActAddTstQstToGam); Frm_StartForm (ActAddTstQstToGam);
Gam_PutParams (&Gbl); Gam_PutParams (Games);
/***** Write the heading *****/ /***** Write the heading *****/
HTM_TABLE_BeginWideMarginPadding (2); HTM_TABLE_BeginWideMarginPadding (2);

View File

@ -166,10 +166,10 @@ void Tst_WriteQstStem (const char *Stem,const char *ClassStem,bool Visible);
void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback); void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback);
void Tst_RequestEditTests (void); void Tst_RequestEditTests (void);
void Tst_RequestSelectTestsForGame (void); void Tst_RequestSelectTestsForGame (struct Gam_Games *Games);
void Tst_ListQuestionsToEdit (void); void Tst_ListQuestionsToEdit (void);
void Tst_ListQuestionsToSelect (void); void Tst_ListQuestionsToSelect (struct Gam_Games *Games);
void Tst_WriteParamEditQst (const struct Tst_Test *Test); void Tst_WriteParamEditQst (const struct Tst_Test *Test);
unsigned Tst_GetNumAnswersQst (long QstCod); unsigned Tst_GetNumAnswersQst (long QstCod);