mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-08 09:45:26 +02:00
Version 21.6.1: Sep 18, 2021 Queries moved to module swad_game_database.
This commit is contained in:
parent
179fc2b6a0
commit
1514c65817
|
@ -623,7 +623,7 @@ static void Agd_WriteHeaderListEvents (const struct Agd_Agenda *Agenda,
|
||||||
/***** Table head *****/
|
/***** Table head *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
for (Order = Dat_START_TIME;
|
for (Order = Dat_STR_TIME;
|
||||||
Order <= Dat_END_TIME;
|
Order <= Dat_END_TIME;
|
||||||
Order++)
|
Order++)
|
||||||
{
|
{
|
||||||
|
@ -1119,7 +1119,7 @@ static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
|
||||||
AgdEvent->Hidden = (row[2][0] == 'Y');
|
AgdEvent->Hidden = (row[2][0] == 'Y');
|
||||||
|
|
||||||
/* Get start date (row[3]) and end date (row[4]) in UTC time */
|
/* Get start date (row[3]) and end date (row[4]) in UTC time */
|
||||||
AgdEvent->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
AgdEvent->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
||||||
AgdEvent->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
AgdEvent->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||||
|
|
||||||
/* Get whether the event is past, present or future (row(5), row[6]) */
|
/* Get whether the event is past, present or future (row(5), row[6]) */
|
||||||
|
@ -1137,7 +1137,7 @@ static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
|
||||||
AgdEvent->AgdCod = -1L;
|
AgdEvent->AgdCod = -1L;
|
||||||
AgdEvent->Public = false;
|
AgdEvent->Public = false;
|
||||||
AgdEvent->Hidden = false;
|
AgdEvent->Hidden = false;
|
||||||
AgdEvent->TimeUTC[Dat_START_TIME] =
|
AgdEvent->TimeUTC[Dat_STR_TIME] =
|
||||||
AgdEvent->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
AgdEvent->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
AgdEvent->TimeStatus = Dat_FUTURE;
|
AgdEvent->TimeStatus = Dat_FUTURE;
|
||||||
AgdEvent->Event[0] = '\0';
|
AgdEvent->Event[0] = '\0';
|
||||||
|
@ -1397,7 +1397,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
||||||
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] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1416,7 +1416,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
||||||
{
|
{
|
||||||
/* Initialize to empty event */
|
/* Initialize to empty event */
|
||||||
AgdEvent.AgdCod = -1L;
|
AgdEvent.AgdCod = -1L;
|
||||||
AgdEvent.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
|
AgdEvent.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
AgdEvent.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
AgdEvent.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
||||||
AgdEvent.TimeStatus = Dat_FUTURE;
|
AgdEvent.TimeStatus = Dat_FUTURE;
|
||||||
AgdEvent.Event[0] = '\0';
|
AgdEvent.Event[0] = '\0';
|
||||||
|
@ -1555,7 +1555,7 @@ void Agd_ReceiveFormEvent (void)
|
||||||
ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) <= 0);
|
ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) <= 0);
|
||||||
|
|
||||||
/***** Get start/end date-times *****/
|
/***** Get start/end date-times *****/
|
||||||
AgdEvent.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
AgdEvent.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||||
AgdEvent.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
AgdEvent.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||||
|
|
||||||
/***** Get event location *****/
|
/***** Get event location *****/
|
||||||
|
@ -1568,10 +1568,10 @@ void Agd_ReceiveFormEvent (void)
|
||||||
Par_GetParToHTML ("Txt",EventTxt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
Par_GetParToHTML ("Txt",EventTxt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||||
|
|
||||||
/***** Adjust dates *****/
|
/***** Adjust dates *****/
|
||||||
if (AgdEvent.TimeUTC[Dat_START_TIME] == 0)
|
if (AgdEvent.TimeUTC[Dat_STR_TIME] == 0)
|
||||||
AgdEvent.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
|
AgdEvent.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
if (AgdEvent.TimeUTC[Dat_END_TIME] == 0)
|
if (AgdEvent.TimeUTC[Dat_END_TIME] == 0)
|
||||||
AgdEvent.TimeUTC[Dat_END_TIME] = AgdEvent.TimeUTC[Dat_START_TIME] + 2 * 60 * 60; // +2 hours
|
AgdEvent.TimeUTC[Dat_END_TIME] = AgdEvent.TimeUTC[Dat_STR_TIME] + 2 * 60 * 60; // +2 hours
|
||||||
|
|
||||||
/***** Check if event is correct *****/
|
/***** Check if event is correct *****/
|
||||||
if (!AgdEvent.Location[0]) // If there is no event
|
if (!AgdEvent.Location[0]) // If there is no event
|
||||||
|
|
|
@ -76,7 +76,7 @@ typedef enum
|
||||||
#define Agd_DEFAULT_HIDDEN_EVENTS (0 << Agd_HIDDEN_EVENTS) // off
|
#define Agd_DEFAULT_HIDDEN_EVENTS (0 << Agd_HIDDEN_EVENTS) // off
|
||||||
#define Agd_DEFAULT_VISIBL_EVENTS (1 << Agd_VISIBL_EVENTS) // on
|
#define Agd_DEFAULT_VISIBL_EVENTS (1 << Agd_VISIBL_EVENTS) // on
|
||||||
|
|
||||||
#define Agd_ORDER_DEFAULT Dat_START_TIME
|
#define Agd_ORDER_DEFAULT Dat_STR_TIME
|
||||||
|
|
||||||
struct Agd_Agenda
|
struct Agd_Agenda
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,8 +74,14 @@ unsigned Agd_DB_GetListEvents (MYSQL_RES **mysql_res,
|
||||||
char HiddenVisiblEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
|
char HiddenVisiblEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
|
||||||
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
|
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = "StartTime,EndTime,Event,Location",
|
[Dat_STR_TIME] = "StartTime,"
|
||||||
[Dat_END_TIME ] = "EndTime,StartTime,Event,Location",
|
"EndTime,"
|
||||||
|
"Event,"
|
||||||
|
"Location",
|
||||||
|
[Dat_END_TIME] = "EndTime,"
|
||||||
|
"StartTime,"
|
||||||
|
"Event,"
|
||||||
|
"Location",
|
||||||
};
|
};
|
||||||
unsigned NumEvents;
|
unsigned NumEvents;
|
||||||
|
|
||||||
|
@ -250,7 +256,7 @@ long Agd_DB_CreateEvent (const struct Agd_Event *AgdEvent,const char *Txt)
|
||||||
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
|
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
|
||||||
"'%s','%s','%s')",
|
"'%s','%s','%s')",
|
||||||
AgdEvent->UsrCod,
|
AgdEvent->UsrCod,
|
||||||
AgdEvent->TimeUTC[Dat_START_TIME],
|
AgdEvent->TimeUTC[Dat_STR_TIME],
|
||||||
AgdEvent->TimeUTC[Dat_END_TIME],
|
AgdEvent->TimeUTC[Dat_END_TIME],
|
||||||
AgdEvent->Event,
|
AgdEvent->Event,
|
||||||
AgdEvent->Location,
|
AgdEvent->Location,
|
||||||
|
@ -273,7 +279,7 @@ void Agd_DB_UpdateEvent (const struct Agd_Event *AgdEvent,const char *Txt)
|
||||||
"Txt='%s'"
|
"Txt='%s'"
|
||||||
" WHERE AgdCod=%ld"
|
" WHERE AgdCod=%ld"
|
||||||
" AND UsrCod=%ld",
|
" AND UsrCod=%ld",
|
||||||
AgdEvent->TimeUTC[Dat_START_TIME],
|
AgdEvent->TimeUTC[Dat_STR_TIME],
|
||||||
AgdEvent->TimeUTC[Dat_END_TIME],
|
AgdEvent->TimeUTC[Dat_END_TIME],
|
||||||
AgdEvent->Event,
|
AgdEvent->Event,
|
||||||
AgdEvent->Location,
|
AgdEvent->Location,
|
||||||
|
|
|
@ -230,7 +230,7 @@ static void Asg_PutHeadForSeeing (struct Asg_Assignments *Assignments,
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
||||||
for (Order = Dat_START_TIME;
|
for (Order = Dat_STR_TIME;
|
||||||
Order <= Dat_END_TIME;
|
Order <= Dat_END_TIME;
|
||||||
Order++)
|
Order++)
|
||||||
{
|
{
|
||||||
|
@ -806,7 +806,7 @@ static void Asg_GetDataOfAssignment (struct Asg_Assignment *Asg,
|
||||||
Asg->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
Asg->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||||
|
|
||||||
/* Get start and end dates (row[3] and row[4] hold the start UTC time) */
|
/* Get start and end dates (row[3] and row[4] hold the start UTC time) */
|
||||||
Asg->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
Asg->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
||||||
Asg->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
Asg->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||||
|
|
||||||
/* Get whether the assignment is open or closed (row(5)) */
|
/* Get whether the assignment is open or closed (row(5)) */
|
||||||
|
@ -836,7 +836,7 @@ static void Asg_ResetAssignment (struct Asg_Assignment *Asg)
|
||||||
Asg->AsgCod = -1L;
|
Asg->AsgCod = -1L;
|
||||||
Asg->Hidden = false;
|
Asg->Hidden = false;
|
||||||
Asg->UsrCod = -1L;
|
Asg->UsrCod = -1L;
|
||||||
Asg->TimeUTC[Dat_START_TIME] =
|
Asg->TimeUTC[Dat_STR_TIME] =
|
||||||
Asg->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
Asg->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
Asg->Open = false;
|
Asg->Open = false;
|
||||||
Asg->Title[0] = '\0';
|
Asg->Title[0] = '\0';
|
||||||
|
@ -1087,12 +1087,12 @@ void Asg_RequestCreatOrEditAsg (void)
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||||
static const Dat_SetHMS SetHMSDontSet[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMSDontSet[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
static const Dat_SetHMS SetHMSAllDay[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMSAllDay[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_TO_000000,
|
[Dat_STR_TIME] = Dat_HMS_TO_000000,
|
||||||
[Dat_END_TIME] = Dat_HMS_TO_235959
|
[Dat_END_TIME] = Dat_HMS_TO_235959
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1112,7 +1112,7 @@ void Asg_RequestCreatOrEditAsg (void)
|
||||||
{
|
{
|
||||||
/* Initialize to empty assignment */
|
/* Initialize to empty assignment */
|
||||||
Asg.AsgCod = -1L;
|
Asg.AsgCod = -1L;
|
||||||
Asg.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
|
Asg.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
Asg.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
Asg.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
||||||
Asg.Open = true;
|
Asg.Open = true;
|
||||||
Asg.Title[0] = '\0';
|
Asg.Title[0] = '\0';
|
||||||
|
@ -1338,7 +1338,7 @@ void Asg_ReceiveFormAssignment (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Get start/end date-times *****/
|
/***** Get start/end date-times *****/
|
||||||
NewAsg.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
NewAsg.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||||
NewAsg.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
NewAsg.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||||
|
|
||||||
/***** Get assignment title *****/
|
/***** Get assignment title *****/
|
||||||
|
@ -1353,10 +1353,10 @@ void Asg_ReceiveFormAssignment (void)
|
||||||
Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||||
|
|
||||||
/***** Adjust dates *****/
|
/***** Adjust dates *****/
|
||||||
if (NewAsg.TimeUTC[Dat_START_TIME] == 0)
|
if (NewAsg.TimeUTC[Dat_STR_TIME] == 0)
|
||||||
NewAsg.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
|
NewAsg.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
if (NewAsg.TimeUTC[Dat_END_TIME] == 0)
|
if (NewAsg.TimeUTC[Dat_END_TIME] == 0)
|
||||||
NewAsg.TimeUTC[Dat_END_TIME] = NewAsg.TimeUTC[Dat_START_TIME] + 2 * 60 * 60; // +2 hours
|
NewAsg.TimeUTC[Dat_END_TIME] = NewAsg.TimeUTC[Dat_STR_TIME] + 2 * 60 * 60; // +2 hours
|
||||||
|
|
||||||
/***** Check if title is correct *****/
|
/***** Check if title is correct *****/
|
||||||
if (NewAsg.Title[0]) // If there's an assignment title
|
if (NewAsg.Title[0]) // If there's an assignment title
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct Asg_Assignment
|
||||||
// I belong to any of the groups)
|
// I belong to any of the groups)
|
||||||
};
|
};
|
||||||
|
|
||||||
#define Asg_ORDER_DEFAULT Dat_START_TIME
|
#define Asg_ORDER_DEFAULT Dat_STR_TIME
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Public prototypes *****************************/
|
/***************************** Public prototypes *****************************/
|
||||||
|
|
|
@ -69,7 +69,7 @@ static const char *Asg_DB_HiddenSubQuery[Rol_NUM_ROLES] =
|
||||||
};
|
};
|
||||||
static const char *Asg_DB_OrderSubQuery[Dat_NUM_START_END_TIME] =
|
static const char *Asg_DB_OrderSubQuery[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = "StartTime DESC,"
|
[Dat_STR_TIME] = "StartTime DESC,"
|
||||||
"EndTime DESC,"
|
"EndTime DESC,"
|
||||||
"Title DESC",
|
"Title DESC",
|
||||||
[Dat_END_TIME] = "EndTime DESC,"
|
[Dat_END_TIME] = "EndTime DESC,"
|
||||||
|
@ -245,7 +245,7 @@ long Asg_DB_CreateAssignment (const struct Asg_Assignment *Asg,const char *Txt)
|
||||||
"'%s','%s','%s')",
|
"'%s','%s','%s')",
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Asg->TimeUTC[Dat_START_TIME],
|
Asg->TimeUTC[Dat_STR_TIME],
|
||||||
Asg->TimeUTC[Dat_END_TIME],
|
Asg->TimeUTC[Dat_END_TIME],
|
||||||
Asg->Title,
|
Asg->Title,
|
||||||
Asg->Folder,
|
Asg->Folder,
|
||||||
|
@ -268,7 +268,7 @@ void Asg_DB_UpdateAssignment (const struct Asg_Assignment *Asg,const char *Txt)
|
||||||
"Txt='%s'"
|
"Txt='%s'"
|
||||||
" WHERE AsgCod=%ld"
|
" WHERE AsgCod=%ld"
|
||||||
" AND CrsCod=%ld", // Extra check
|
" AND CrsCod=%ld", // Extra check
|
||||||
Asg->TimeUTC[Dat_START_TIME],
|
Asg->TimeUTC[Dat_STR_TIME],
|
||||||
Asg->TimeUTC[Dat_END_TIME],
|
Asg->TimeUTC[Dat_END_TIME],
|
||||||
Asg->Title,
|
Asg->Title,
|
||||||
Asg->Folder,
|
Asg->Folder,
|
||||||
|
|
|
@ -261,7 +261,7 @@ static void Att_ShowAllAttEvents (struct Att_Events *Events)
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
||||||
for (Order = Dat_START_TIME;
|
for (Order = Dat_STR_TIME;
|
||||||
Order <= Dat_END_TIME;
|
Order <= Dat_END_TIME;
|
||||||
Order++)
|
Order++)
|
||||||
{
|
{
|
||||||
|
@ -984,7 +984,7 @@ void Att_RequestCreatOrEditAttEvent (void)
|
||||||
char Description[Cns_MAX_BYTES_TEXT + 1];
|
char Description[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] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ typedef enum
|
||||||
Att_OLDEST_FIRST,
|
Att_OLDEST_FIRST,
|
||||||
} Att_OrderNewestOldest_t;
|
} Att_OrderNewestOldest_t;
|
||||||
|
|
||||||
#define Att_ORDER_DEFAULT Dat_START_TIME
|
#define Att_ORDER_DEFAULT Dat_STR_TIME
|
||||||
|
|
||||||
struct Att_Event
|
struct Att_Event
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,10 +71,10 @@ static const char *Att_DB_HiddenSubQuery[Rol_NUM_ROLES] =
|
||||||
};
|
};
|
||||||
static const char *Att_DB_OrderBySubQuery[Dat_NUM_START_END_TIME][Att_NUM_ORDERS_NEWEST_OLDEST] =
|
static const char *Att_DB_OrderBySubQuery[Dat_NUM_START_END_TIME][Att_NUM_ORDERS_NEWEST_OLDEST] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME][Att_NEWEST_FIRST] = "StartTime DESC,"
|
[Dat_STR_TIME][Att_NEWEST_FIRST] = "StartTime DESC,"
|
||||||
"EndTime DESC,"
|
"EndTime DESC,"
|
||||||
"Title DESC",
|
"Title DESC",
|
||||||
[Dat_START_TIME][Att_OLDEST_FIRST] = "StartTime,"
|
[Dat_STR_TIME][Att_OLDEST_FIRST] = "StartTime,"
|
||||||
"EndTime,"
|
"EndTime,"
|
||||||
"Title",
|
"Title",
|
||||||
|
|
||||||
|
|
|
@ -5370,7 +5370,7 @@ static void Brw_WriteDatesAssignment (void)
|
||||||
if (asprintf (&Id,"asg_start_date_%u",UniqueId) < 0)
|
if (asprintf (&Id,"asg_start_date_%u",UniqueId) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
HTM_SPAN_Begin ("id=\"%s\"",Id);
|
HTM_SPAN_Begin ("id=\"%s\"",Id);
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Gbl.FileBrowser.Asg.TimeUTC[Dat_START_TIME],
|
Dat_WriteLocalDateHMSFromUTC (Id,Gbl.FileBrowser.Asg.TimeUTC[Dat_STR_TIME],
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
||||||
true,true,false,0x7);
|
true,true,false,0x7);
|
||||||
HTM_SPAN_End ();
|
HTM_SPAN_End ();
|
||||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 21.6 (2021-09-18)"
|
#define Log_PLATFORM_VERSION "SWAD 21.6.1 (2021-09-18)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.69.1.js"
|
#define JS_FILE "swad20.69.1.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 21.6.1: Sep 18, 2021 Queries moved to module swad_game_database. (315571 lines)
|
||||||
Version 21.6: Sep 18, 2021 New module swad_game_database for database queries related to games. (315565 lines)
|
Version 21.6: Sep 18, 2021 New module swad_game_database for database queries related to games. (315565 lines)
|
||||||
Version 21.5.3: Sep 16, 2021 Queries moved to module swad_forum_database. (315431 lines)
|
Version 21.5.3: Sep 16, 2021 Queries moved to module swad_forum_database. (315431 lines)
|
||||||
Version 21.5.2: Sep 16, 2021 Queries moved to module swad_forum_database. (315403 lines)
|
Version 21.5.2: Sep 16, 2021 Queries moved to module swad_forum_database. (315403 lines)
|
||||||
|
|
26
swad_date.c
26
swad_date.c
|
@ -448,17 +448,17 @@ void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (const Dat_SetHMS
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
Frm_LabelColumn ("RM","",Txt_START_END_TIME[Dat_START_TIME]);
|
Frm_LabelColumn ("RM","",Txt_START_END_TIME[Dat_STR_TIME]);
|
||||||
|
|
||||||
/* Data (date-time) */
|
/* Data (date-time) */
|
||||||
HTM_TD_Begin ("class=\"LM\"");
|
HTM_TD_Begin ("class=\"LM\"");
|
||||||
Dat_WriteFormClientLocalDateTimeFromTimeUTC ("Start",
|
Dat_WriteFormClientLocalDateTimeFromTimeUTC ("Start",
|
||||||
"Start",
|
"Start",
|
||||||
Gbl.DateRange.TimeUTC[Dat_START_TIME],
|
Gbl.DateRange.TimeUTC[Dat_STR_TIME],
|
||||||
Cfg_LOG_START_YEAR,
|
Cfg_LOG_START_YEAR,
|
||||||
Gbl.Now.Date.Year,
|
Gbl.Now.Date.Year,
|
||||||
Dat_FORM_SECONDS_ON,
|
Dat_FORM_SECONDS_ON,
|
||||||
SetHMS[Dat_START_TIME],
|
SetHMS[Dat_STR_TIME],
|
||||||
false); // Don't submit on change
|
false); // Don't submit on change
|
||||||
|
|
||||||
/* "Yesterday" and "Today" buttons */
|
/* "Yesterday" and "Today" buttons */
|
||||||
|
@ -504,11 +504,11 @@ void Dat_PutFormStartEndClientLocalDateTimes (const time_t TimeUTC[Dat_NUM_START
|
||||||
Dat_StartEndTime_t StartEndTime;
|
Dat_StartEndTime_t StartEndTime;
|
||||||
const char *Id[Dat_NUM_START_END_TIME] =
|
const char *Id[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = "Start",
|
[Dat_STR_TIME] = "Start",
|
||||||
[Dat_END_TIME] = "End",
|
[Dat_END_TIME] = "End",
|
||||||
};
|
};
|
||||||
|
|
||||||
for (StartEndTime = Dat_START_TIME;
|
for (StartEndTime = Dat_STR_TIME;
|
||||||
StartEndTime <= Dat_END_TIME;
|
StartEndTime <= Dat_END_TIME;
|
||||||
StartEndTime++)
|
StartEndTime++)
|
||||||
{
|
{
|
||||||
|
@ -972,7 +972,7 @@ void Dat_GetDateFromForm (const char *ParamNameDay,const char *ParamNameMonth,co
|
||||||
|
|
||||||
void Dat_SetIniEndDates (void)
|
void Dat_SetIniEndDates (void)
|
||||||
{
|
{
|
||||||
Gbl.DateRange.TimeUTC[Dat_START_TIME] = (time_t) 0;
|
Gbl.DateRange.TimeUTC[Dat_STR_TIME] = (time_t) 0;
|
||||||
Gbl.DateRange.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC;
|
Gbl.DateRange.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -982,7 +982,7 @@ void Dat_SetIniEndDates (void)
|
||||||
|
|
||||||
void Dat_WriteParamsIniEndDates (void)
|
void Dat_WriteParamsIniEndDates (void)
|
||||||
{
|
{
|
||||||
Par_PutHiddenParamUnsigned (NULL,"StartTimeUTC",Gbl.DateRange.TimeUTC[Dat_START_TIME]);
|
Par_PutHiddenParamUnsigned (NULL,"StartTimeUTC",Gbl.DateRange.TimeUTC[Dat_STR_TIME]);
|
||||||
Par_PutHiddenParamUnsigned (NULL,"EndTimeUTC" ,Gbl.DateRange.TimeUTC[Dat_END_TIME]);
|
Par_PutHiddenParamUnsigned (NULL,"EndTimeUTC" ,Gbl.DateRange.TimeUTC[Dat_END_TIME]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,11 +996,11 @@ void Dat_GetIniEndDatesFromForm (void)
|
||||||
struct tm *tm_ptr;
|
struct tm *tm_ptr;
|
||||||
|
|
||||||
/***** Get initial date *****/
|
/***** Get initial date *****/
|
||||||
Gbl.DateRange.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
Gbl.DateRange.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||||
if (Gbl.DateRange.TimeUTC[Dat_START_TIME])
|
if (Gbl.DateRange.TimeUTC[Dat_STR_TIME])
|
||||||
/* Convert time UTC to a local date */
|
/* Convert time UTC to a local date */
|
||||||
tm_ptr = Dat_GetLocalTimeFromClock (&Gbl.DateRange.TimeUTC[Dat_START_TIME]);
|
tm_ptr = Dat_GetLocalTimeFromClock (&Gbl.DateRange.TimeUTC[Dat_STR_TIME]);
|
||||||
else // Gbl.DateRange.TimeUTC[Dat_START_TIME] == 0 ==> initial date not specified
|
else // Gbl.DateRange.TimeUTC[Dat_STR_TIME] == 0 ==> initial date not specified
|
||||||
{
|
{
|
||||||
tm.tm_year = Cfg_LOG_START_YEAR - 1900;
|
tm.tm_year = Cfg_LOG_START_YEAR - 1900;
|
||||||
tm.tm_mon = 0; // January
|
tm.tm_mon = 0; // January
|
||||||
|
@ -1012,8 +1012,8 @@ void Dat_GetIniEndDatesFromForm (void)
|
||||||
// (use timezone information and system databases to)
|
// (use timezone information and system databases to)
|
||||||
// attempt to determine whether DST
|
// attempt to determine whether DST
|
||||||
// is in effect at the specified time.
|
// is in effect at the specified time.
|
||||||
if ((Gbl.DateRange.TimeUTC[Dat_START_TIME] = mktime (&tm)) < 0)
|
if ((Gbl.DateRange.TimeUTC[Dat_STR_TIME] = mktime (&tm)) < 0)
|
||||||
Gbl.DateRange.TimeUTC[Dat_START_TIME] = (time_t) 0;
|
Gbl.DateRange.TimeUTC[Dat_STR_TIME] = (time_t) 0;
|
||||||
tm_ptr = &tm;
|
tm_ptr = &tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ typedef enum
|
||||||
#define Dat_NUM_START_END_TIME 2
|
#define Dat_NUM_START_END_TIME 2
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Dat_START_TIME = 0,
|
Dat_STR_TIME = 0,
|
||||||
Dat_END_TIME = 1,
|
Dat_END_TIME = 1,
|
||||||
} Dat_StartEndTime_t;
|
} Dat_StartEndTime_t;
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ void Exa_ResetExam (struct Exa_Exam *Exam)
|
||||||
Exam->UsrCod = -1L;
|
Exam->UsrCod = -1L;
|
||||||
Exam->MaxGrade = Exa_MAX_GRADE_DEFAULT;
|
Exam->MaxGrade = Exa_MAX_GRADE_DEFAULT;
|
||||||
Exam->Visibility = TstVis_VISIBILITY_DEFAULT;
|
Exam->Visibility = TstVis_VISIBILITY_DEFAULT;
|
||||||
Exam->TimeUTC[Dat_START_TIME] = (time_t) 0;
|
Exam->TimeUTC[Dat_STR_TIME] = (time_t) 0;
|
||||||
Exam->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
Exam->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
Exam->Title[0] = '\0';
|
Exam->Title[0] = '\0';
|
||||||
Exam->Hidden = false;
|
Exam->Hidden = false;
|
||||||
|
@ -541,7 +541,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
||||||
Id,Color,Gbl.RowEvenOdd);
|
Id,Color,Gbl.RowEvenOdd);
|
||||||
if (Exam->TimeUTC[Dat_START_TIME])
|
if (Exam->TimeUTC[Dat_STR_TIME])
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Exam->TimeUTC[StartEndTime],
|
Dat_WriteLocalDateHMSFromUTC (Id,Exam->TimeUTC[StartEndTime],
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||||
true,true,true,0x6);
|
true,true,true,0x6);
|
||||||
|
@ -964,7 +964,7 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam)
|
||||||
|
|
||||||
/* Get start date (row[0] holds the start UTC time)
|
/* Get start date (row[0] holds the start UTC time)
|
||||||
and end date (row[1] holds the end UTC time) */
|
and end date (row[1] holds the end UTC time) */
|
||||||
Exam->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[0]);
|
Exam->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[0]);
|
||||||
Exam->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[1]);
|
Exam->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Exam->TimeUTC[Dat_START_TIME] =
|
Exam->TimeUTC[Dat_STR_TIME] =
|
||||||
Exam->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
Exam->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1329,7 +1329,7 @@ long Exa_DB_CreateSession (const struct ExaSes_Session *Session)
|
||||||
Session->Hidden ? 'Y' :
|
Session->Hidden ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod, // Session creator
|
Gbl.Usrs.Me.UsrDat.UsrCod, // Session creator
|
||||||
Session->TimeUTC[Dat_START_TIME], // Start time
|
Session->TimeUTC[Dat_STR_TIME], // Start time
|
||||||
Session->TimeUTC[Dat_END_TIME], // End time
|
Session->TimeUTC[Dat_END_TIME], // End time
|
||||||
Session->Title);
|
Session->Title);
|
||||||
}
|
}
|
||||||
|
@ -1355,7 +1355,7 @@ void Exa_DB_UpdateSession (const struct ExaSes_Session *Session)
|
||||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||||
Session->Hidden ? 'Y' :
|
Session->Hidden ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Session->TimeUTC[Dat_START_TIME], // Start time
|
Session->TimeUTC[Dat_STR_TIME], // Start time
|
||||||
Session->TimeUTC[Dat_END_TIME], // End time
|
Session->TimeUTC[Dat_END_TIME], // End time
|
||||||
Session->Title,
|
Session->Title,
|
||||||
Session->ShowUsrResults ? 'Y' :
|
Session->ShowUsrResults ? 'Y' :
|
||||||
|
|
|
@ -151,7 +151,7 @@ void ExaPrn_ResetPrint (struct ExaPrn_Print *Print)
|
||||||
Print->PrnCod = -1L;
|
Print->PrnCod = -1L;
|
||||||
Print->SesCod = -1L;
|
Print->SesCod = -1L;
|
||||||
Print->UsrCod = -1L;
|
Print->UsrCod = -1L;
|
||||||
Print->TimeUTC[Dat_START_TIME] =
|
Print->TimeUTC[Dat_STR_TIME] =
|
||||||
Print->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
Print->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
Print->Sent = false; // After creating an exam print, it's not sent
|
Print->Sent = false; // After creating an exam print, it's not sent
|
||||||
Print->NumQsts.All =
|
Print->NumQsts.All =
|
||||||
|
@ -296,7 +296,7 @@ static void ExaPrn_GetDataOfPrint (struct ExaPrn_Print *Print,
|
||||||
Print->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
Print->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||||
|
|
||||||
/* Get date-time (row[3] and row[4] hold UTC date-time) */
|
/* Get date-time (row[3] and row[4] hold UTC date-time) */
|
||||||
Print->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
Print->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
||||||
Print->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
Print->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||||
|
|
||||||
/* Get number of questions (row[5]) */
|
/* Get number of questions (row[5]) */
|
||||||
|
|
|
@ -700,7 +700,7 @@ static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther)
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
HTM_TH (3,2,"CT LINE_BOTTOM",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex :
|
HTM_TH (3,2,"CT LINE_BOTTOM",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex :
|
||||||
Usr_SEX_UNKNOWN]);
|
Usr_SEX_UNKNOWN]);
|
||||||
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_START_TIME]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_STR_TIME]);
|
||||||
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_END_TIME]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_END_TIME]);
|
||||||
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_Session);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_Session);
|
||||||
HTM_TH (1,3,"CT LINE_LEFT",Txt_Questions);
|
HTM_TH (1,3,"CT LINE_LEFT",Txt_Questions);
|
||||||
|
|
|
@ -200,7 +200,7 @@ void ExaSes_ListSessions (struct Exa_Exams *Exams,
|
||||||
/* Reset session */
|
/* Reset session */
|
||||||
ExaSes_ResetSession (Session);
|
ExaSes_ResetSession (Session);
|
||||||
Session->ExaCod = Exam->ExaCod;
|
Session->ExaCod = Exam->ExaCod;
|
||||||
Session->TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC; // Now
|
Session->TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC; // Now
|
||||||
Session->TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (1 * 60 * 60); // Now + 1 hour
|
Session->TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (1 * 60 * 60); // Now + 1 hour
|
||||||
Str_Copy (Session->Title,Exam->Title,sizeof (Session->Title) - 1);
|
Str_Copy (Session->Title,Exam->Title,sizeof (Session->Title) - 1);
|
||||||
|
|
||||||
|
@ -1012,7 +1012,7 @@ static void ExaSes_PutFormSession (const struct ExaSes_Session *Session)
|
||||||
extern const char *Txt_Save_changes;
|
extern const char *Txt_Save_changes;
|
||||||
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
bool ItsANewSession = Session->SesCod <= 0;
|
bool ItsANewSession = Session->SesCod <= 0;
|
||||||
|
@ -1249,7 +1249,7 @@ void ExaSes_ReceiveFormSession (void)
|
||||||
Par_GetParToText ("Title",Session.Title,ExaSes_MAX_BYTES_TITLE);
|
Par_GetParToText ("Title",Session.Title,ExaSes_MAX_BYTES_TITLE);
|
||||||
|
|
||||||
/* Get start/end date-times */
|
/* Get start/end date-times */
|
||||||
Session.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
Session.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||||
Session.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
Session.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||||
|
|
||||||
/* Get groups associated to the session */
|
/* Get groups associated to the session */
|
||||||
|
|
18
swad_forum.c
18
swad_forum.c
|
@ -2037,7 +2037,7 @@ static void For_ShowForumThreadsHighlightingOneThread (struct For_Forums *Forums
|
||||||
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
||||||
HTM_TH (1,1,"LM",Txt_MSG_Subject);
|
HTM_TH (1,1,"LM",Txt_MSG_Subject);
|
||||||
|
|
||||||
for (Order = Dat_START_TIME;
|
for (Order = Dat_STR_TIME;
|
||||||
Order <= Dat_END_TIME;
|
Order <= Dat_END_TIME;
|
||||||
Order++)
|
Order++)
|
||||||
{
|
{
|
||||||
|
@ -2229,7 +2229,7 @@ static void For_ListForumThrs (struct For_Forums *Forums,
|
||||||
Pag_WriteLinksToPages (Pag_POSTS_FORUM,
|
Pag_WriteLinksToPages (Pag_POSTS_FORUM,
|
||||||
&PaginationPsts,
|
&PaginationPsts,
|
||||||
Forums,Thr.ThrCod,
|
Forums,Thr.ThrCod,
|
||||||
Thr.Enabled[Dat_START_TIME],
|
Thr.Enabled[Dat_STR_TIME],
|
||||||
Thr.Subject,
|
Thr.Subject,
|
||||||
Thr.NumUnreadPosts ? The_ClassFormInBoxBold[Gbl.Prefs.Theme] :
|
Thr.NumUnreadPosts ? The_ClassFormInBoxBold[Gbl.Prefs.Theme] :
|
||||||
The_ClassFormInBox[Gbl.Prefs.Theme],
|
The_ClassFormInBox[Gbl.Prefs.Theme],
|
||||||
|
@ -2237,11 +2237,11 @@ static void For_ListForumThrs (struct For_Forums *Forums,
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write the authors and date-times of first and last posts *****/
|
/***** Write the authors and date-times of first and last posts *****/
|
||||||
for (Order = Dat_START_TIME;
|
for (Order = Dat_STR_TIME;
|
||||||
Order <= Dat_END_TIME;
|
Order <= Dat_END_TIME;
|
||||||
Order++)
|
Order++)
|
||||||
{
|
{
|
||||||
if (Order == Dat_START_TIME || Thr.NumPosts > 1) // Don't write twice the same author when thread has only one thread
|
if (Order == Dat_STR_TIME || Thr.NumPosts > 1) // Don't write twice the same author when thread has only one thread
|
||||||
{
|
{
|
||||||
/* Write the author of first or last message */
|
/* Write the author of first or last message */
|
||||||
UsrDat.UsrCod = Thr.UsrCod[Order];
|
UsrDat.UsrCod = Thr.UsrCod[Order];
|
||||||
|
@ -2319,24 +2319,24 @@ static void For_GetThreadData (struct For_Thread *Thr)
|
||||||
|
|
||||||
/***** Get the codes of the first (row[0])
|
/***** Get the codes of the first (row[0])
|
||||||
and the last post (row[1]) in this thread *****/
|
and the last post (row[1]) in this thread *****/
|
||||||
Thr->PstCod[Dat_START_TIME] = Str_ConvertStrCodToLongCod (row[0]);
|
Thr->PstCod[Dat_STR_TIME] = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
Thr->PstCod[Dat_END_TIME] = Str_ConvertStrCodToLongCod (row[1]);
|
Thr->PstCod[Dat_END_TIME] = Str_ConvertStrCodToLongCod (row[1]);
|
||||||
|
|
||||||
/***** Get the code of the first message (row[0])
|
/***** Get the code of the first message (row[0])
|
||||||
and the last message (row[1]) in this thread *****/
|
and the last message (row[1]) in this thread *****/
|
||||||
if (sscanf (row[0],"%ld",&(Thr->PstCod[Dat_START_TIME])) != 1)
|
if (sscanf (row[0],"%ld",&(Thr->PstCod[Dat_STR_TIME])) != 1)
|
||||||
Err_WrongPostExit ();
|
Err_WrongPostExit ();
|
||||||
if (sscanf (row[1],"%ld",&(Thr->PstCod[Dat_END_TIME])) != 1)
|
if (sscanf (row[1],"%ld",&(Thr->PstCod[Dat_END_TIME])) != 1)
|
||||||
Err_WrongPostExit ();
|
Err_WrongPostExit ();
|
||||||
|
|
||||||
/***** Get the author of the first post in this thread (row[2])
|
/***** Get the author of the first post in this thread (row[2])
|
||||||
and the author of the last post in this thread (row[3]) *****/
|
and the author of the last post in this thread (row[3]) *****/
|
||||||
Thr->UsrCod[Dat_START_TIME] = Str_ConvertStrCodToLongCod (row[2]);
|
Thr->UsrCod[Dat_STR_TIME] = Str_ConvertStrCodToLongCod (row[2]);
|
||||||
Thr->UsrCod[Dat_END_TIME] = Str_ConvertStrCodToLongCod (row[3]);
|
Thr->UsrCod[Dat_END_TIME] = Str_ConvertStrCodToLongCod (row[3]);
|
||||||
|
|
||||||
/***** Get the date of the first post in this thread (row[4])
|
/***** Get the date of the first post in this thread (row[4])
|
||||||
and the date of the last post in this thread (row[5]) *****/
|
and the date of the last post in this thread (row[5]) *****/
|
||||||
Thr->WriteTime[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
Thr->WriteTime[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||||
Thr->WriteTime[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[5]);
|
Thr->WriteTime[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||||
|
|
||||||
/***** Get the subject of this thread (row[6]) *****/
|
/***** Get the subject of this thread (row[6]) *****/
|
||||||
|
@ -2348,7 +2348,7 @@ static void For_GetThreadData (struct For_Thread *Thr)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
/***** Get if first or last message are enabled *****/
|
/***** Get if first or last message are enabled *****/
|
||||||
for (Order = Dat_START_TIME;
|
for (Order = Dat_STR_TIME;
|
||||||
Order <= Dat_END_TIME;
|
Order <= Dat_END_TIME;
|
||||||
Order++)
|
Order++)
|
||||||
Thr->Enabled[Order] = For_DB_GetIfPstIsEnabled (Thr->PstCod[Order]);
|
Thr->Enabled[Order] = For_DB_GetIfPstIsEnabled (Thr->PstCod[Order]);
|
||||||
|
|
|
@ -457,7 +457,7 @@ unsigned For_DB_GetForumThreads (MYSQL_RES **mysql_res,
|
||||||
|
|
||||||
switch (Forums->ThreadsOrder)
|
switch (Forums->ThreadsOrder)
|
||||||
{
|
{
|
||||||
case Dat_START_TIME: // First post time
|
case Dat_STR_TIME: // First post time
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get thread of a forum",
|
DB_QuerySELECT (mysql_res,"can not get thread of a forum",
|
||||||
"SELECT for_threads.ThrCod" // row[0]
|
"SELECT for_threads.ThrCod" // row[0]
|
||||||
|
|
102
swad_game.c
102
swad_game.c
|
@ -135,12 +135,8 @@ static void Gam_PutParamsOneQst (void *Games);
|
||||||
static void Gam_PutHiddenParamOrder (Gam_Order_t SelectedOrder);
|
static void Gam_PutHiddenParamOrder (Gam_Order_t SelectedOrder);
|
||||||
static Gam_Order_t Gam_GetParamOrder (void);
|
static Gam_Order_t Gam_GetParamOrder (void);
|
||||||
|
|
||||||
static void Gam_DB_GetGameTxt (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
|
||||||
|
|
||||||
static void Gam_RemoveGameFromAllTables (long GamCod);
|
static void Gam_RemoveGameFromAllTables (long GamCod);
|
||||||
|
|
||||||
static bool Gam_DB_CheckIfSimilarGameExists (const struct Gam_Game *Game);
|
|
||||||
|
|
||||||
static void Gam_PutFormsEditionGame (struct Gam_Games *Games,
|
static void Gam_PutFormsEditionGame (struct Gam_Games *Games,
|
||||||
struct Gam_Game *Game,
|
struct Gam_Game *Game,
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1],
|
char Txt[Cns_MAX_BYTES_TEXT + 1],
|
||||||
|
@ -152,11 +148,6 @@ static bool Gam_CheckGameFieldsReceivedFromForm (const struct Gam_Game *Game);
|
||||||
static void Gam_CreateGame (struct Gam_Game *Game,const char *Txt);
|
static void Gam_CreateGame (struct Gam_Game *Game,const char *Txt);
|
||||||
static void Gam_UpdateGame (struct Gam_Game *Game,const char *Txt);
|
static void Gam_UpdateGame (struct Gam_Game *Game,const char *Txt);
|
||||||
|
|
||||||
static void Gam_DB_RemAnswersOfAQuestion (long GamCod,unsigned QstInd);
|
|
||||||
|
|
||||||
static unsigned Gam_DB_GetQstIndFromQstCod (long GamCod,long QstCod);
|
|
||||||
|
|
||||||
static unsigned Gam_DB_GetMaxQuestionIndexInGame (long GamCod);
|
|
||||||
static void Gam_ListGameQuestions (struct Gam_Games *Games,struct Gam_Game *Game);
|
static void Gam_ListGameQuestions (struct Gam_Games *Games,struct Gam_Game *Game);
|
||||||
static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games,
|
static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games,
|
||||||
long GamCod,unsigned NumQsts,
|
long GamCod,unsigned NumQsts,
|
||||||
|
@ -206,7 +197,7 @@ void Gam_ResetGame (struct Gam_Game *Game)
|
||||||
Game->UsrCod = -1L;
|
Game->UsrCod = -1L;
|
||||||
Game->MaxGrade = Gam_MAX_GRADE_DEFAULT;
|
Game->MaxGrade = Gam_MAX_GRADE_DEFAULT;
|
||||||
Game->Visibility = TstVis_VISIBILITY_DEFAULT;
|
Game->Visibility = TstVis_VISIBILITY_DEFAULT;
|
||||||
Game->TimeUTC[Dat_START_TIME] = (time_t) 0;
|
Game->TimeUTC[Dat_STR_TIME] = (time_t) 0;
|
||||||
Game->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
Game->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
Game->Title[0] = '\0';
|
Game->Title[0] = '\0';
|
||||||
Game->NumQsts = 0;
|
Game->NumQsts = 0;
|
||||||
|
@ -601,7 +592,7 @@ static void Gam_ShowOneGame (struct Gam_Games *Games,
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
||||||
Id,Color,Gbl.RowEvenOdd);
|
Id,Color,Gbl.RowEvenOdd);
|
||||||
if (Game->TimeUTC[Dat_START_TIME])
|
if (Game->TimeUTC[Dat_STR_TIME])
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Game->TimeUTC[StartEndTime],
|
Dat_WriteLocalDateHMSFromUTC (Id,Game->TimeUTC[StartEndTime],
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||||
true,true,true,0x7);
|
true,true,true,0x7);
|
||||||
|
@ -1034,7 +1025,7 @@ void Gam_GetDataOfGameByCod (struct Gam_Game *Game)
|
||||||
|
|
||||||
/* Get start date (row[0] holds the start UTC time)
|
/* Get start date (row[0] holds the start UTC time)
|
||||||
and end date (row[1] holds the end UTC time) */
|
and end date (row[1] holds the end UTC time) */
|
||||||
Game->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[0]);
|
Game->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[0]);
|
||||||
Game->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[1]);
|
Game->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,7 +1034,7 @@ void Gam_GetDataOfGameByCod (struct Gam_Game *Game)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Game->TimeUTC[Dat_START_TIME] =
|
Game->TimeUTC[Dat_STR_TIME] =
|
||||||
Game->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
Game->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1064,20 +1055,6 @@ void Gam_FreeListGames (struct Gam_Games *Games)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********************** Get game text from database ************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Gam_DB_GetGameTxt (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1])
|
|
||||||
{
|
|
||||||
/***** Get text of game from database *****/
|
|
||||||
DB_QuerySELECTString (Txt,Cns_MAX_BYTES_TEXT,"can not get game text",
|
|
||||||
"SELECT Txt" // row[0]
|
|
||||||
" FROM gam_games"
|
|
||||||
" WHERE GamCod=%ld",
|
|
||||||
GamCod);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************** Ask for confirmation of removing of a game ******************/
|
/*************** Ask for confirmation of removing of a game ******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1269,24 +1246,6 @@ void Gam_UnhideGame (void)
|
||||||
Gam_ListAllGames (&Games);
|
Gam_ListAllGames (&Games);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******************* Check if the title of a game exists *******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static bool Gam_DB_CheckIfSimilarGameExists (const struct Gam_Game *Game)
|
|
||||||
{
|
|
||||||
/***** Get number of games with a field value from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not get similar games",
|
|
||||||
"SELECT COUNT(*)"
|
|
||||||
" FROM gam_games"
|
|
||||||
" WHERE CrsCod=%ld"
|
|
||||||
" AND Title='%s'"
|
|
||||||
" AND GamCod<>%ld",
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
|
||||||
Game->Title,
|
|
||||||
Game->GamCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************* List the questions in a game **********************/
|
/************************* List the questions in a game **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1735,41 +1694,6 @@ unsigned Gam_GetParamQstInd (void)
|
||||||
return (unsigned) QstInd;
|
return (unsigned) QstInd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********************** Remove answers of a game question ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Gam_DB_RemAnswersOfAQuestion (long GamCod,unsigned QstInd)
|
|
||||||
{
|
|
||||||
/***** Remove answers from all matches of this game *****/
|
|
||||||
DB_QueryDELETE ("can not remove the answers of a question",
|
|
||||||
"DELETE FROM mch_answers"
|
|
||||||
" USING mch_matches,"
|
|
||||||
"mch_answers"
|
|
||||||
" WHERE mch_matches.GamCod=%ld" // From all matches of this game...
|
|
||||||
" AND mch_matches.MchCod=mch_answers.MchCod"
|
|
||||||
" AND mch_answers.QstInd=%u", // ...remove only answers to this question
|
|
||||||
GamCod,
|
|
||||||
QstInd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Get question index given game and code of question *************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
// Return 0 is question is not present in game
|
|
||||||
|
|
||||||
static unsigned Gam_DB_GetQstIndFromQstCod (long GamCod,long QstCod)
|
|
||||||
{
|
|
||||||
/***** Get question index in a game given the question code *****/
|
|
||||||
return DB_QuerySELECTUnsigned ("can not get question index",
|
|
||||||
"SELECT QstInd"
|
|
||||||
" FROM gam_questions"
|
|
||||||
" WHERE GamCod=%ld"
|
|
||||||
" AND QstCod=%ld",
|
|
||||||
GamCod,
|
|
||||||
QstCod);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************ Get question code given game and index of question *************/
|
/************ Get question code given game and index of question *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1792,22 +1716,6 @@ long Gam_GetQstCodFromQstInd (long GamCod,unsigned QstInd)
|
||||||
return QstCod;
|
return QstCod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************** Get maximum question index in a game *********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
// Question index can be 1, 2, 3...
|
|
||||||
// Return 0 if no questions
|
|
||||||
|
|
||||||
static unsigned Gam_DB_GetMaxQuestionIndexInGame (long GamCod)
|
|
||||||
{
|
|
||||||
/***** Get maximum question index in a game from database *****/
|
|
||||||
return DB_QuerySELECTUnsigned ("can not get last question index",
|
|
||||||
"SELECT MAX(QstInd)"
|
|
||||||
" FROM gam_questions"
|
|
||||||
" WHERE GamCod=%ld",
|
|
||||||
GamCod);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************ List the questions of a game ***********************/
|
/************************ List the questions of a game ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2223,7 +2131,7 @@ void Gam_RemoveQstFromGame (void)
|
||||||
|
|
||||||
/***** Remove the question from all the tables *****/
|
/***** Remove the question from all the tables *****/
|
||||||
/* Remove answers from this test question */
|
/* Remove answers from this test question */
|
||||||
Gam_DB_RemAnswersOfAQuestion (Game.GamCod,QstInd);
|
Mch_DB_RemAnswersOfAQuestion (Game.GamCod,QstInd);
|
||||||
|
|
||||||
/* Remove the question itself */
|
/* Remove the question itself */
|
||||||
DB_QueryDELETE ("can not remove a question",
|
DB_QueryDELETE ("can not remove a question",
|
||||||
|
|
|
@ -159,6 +159,37 @@ unsigned Gam_DB_GetDataOfGameByCod (MYSQL_RES **mysql_res,long GamCod)
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************** Get game text from database ************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Gam_DB_GetGameTxt (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1])
|
||||||
|
{
|
||||||
|
/***** Get text of game from database *****/
|
||||||
|
DB_QuerySELECTString (Txt,Cns_MAX_BYTES_TEXT,"can not get game text",
|
||||||
|
"SELECT Txt" // row[0]
|
||||||
|
" FROM gam_games"
|
||||||
|
" WHERE GamCod=%ld",
|
||||||
|
GamCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************* Check if the title of a game exists *******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
bool Gam_DB_CheckIfSimilarGameExists (const struct Gam_Game *Game)
|
||||||
|
{
|
||||||
|
return (DB_QueryCOUNT ("can not get similar games",
|
||||||
|
"SELECT COUNT(*)"
|
||||||
|
" FROM gam_games"
|
||||||
|
" WHERE CrsCod=%ld"
|
||||||
|
" AND Title='%s'"
|
||||||
|
" AND GamCod<>%ld",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
|
Game->Title,
|
||||||
|
Game->GamCod) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Get number of questions of a game *********************/
|
/******************* Get number of questions of a game *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -174,6 +205,39 @@ unsigned Gam_DB_GetNumQstsGame (long GamCod)
|
||||||
GamCod);
|
GamCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Get question index given game and code of question *************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// Return 0 is question is not present in game
|
||||||
|
|
||||||
|
unsigned Gam_DB_GetQstIndFromQstCod (long GamCod,long QstCod)
|
||||||
|
{
|
||||||
|
/***** Get question index in a game given the question code *****/
|
||||||
|
return DB_QuerySELECTUnsigned ("can not get question index",
|
||||||
|
"SELECT QstInd"
|
||||||
|
" FROM gam_questions"
|
||||||
|
" WHERE GamCod=%ld"
|
||||||
|
" AND QstCod=%ld",
|
||||||
|
GamCod,
|
||||||
|
QstCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****************** Get maximum question index in a game *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// Question index can be 1, 2, 3...
|
||||||
|
// Return 0 if no questions
|
||||||
|
|
||||||
|
unsigned Gam_DB_GetMaxQuestionIndexInGame (long GamCod)
|
||||||
|
{
|
||||||
|
/***** Get maximum question index in a game from database *****/
|
||||||
|
return DB_QuerySELECTUnsigned ("can not get last question index",
|
||||||
|
"SELECT MAX(QstInd)"
|
||||||
|
" FROM gam_questions"
|
||||||
|
" WHERE GamCod=%ld",
|
||||||
|
GamCod);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********** Get previous question index to a given index in a game **********/
|
/*********** Get previous question index to a given index in a game **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -41,7 +41,12 @@
|
||||||
|
|
||||||
unsigned Gam_DB_GetListGames (MYSQL_RES **mysql_res,Gam_Order_t SelectedOrder);
|
unsigned Gam_DB_GetListGames (MYSQL_RES **mysql_res,Gam_Order_t SelectedOrder);
|
||||||
unsigned Gam_DB_GetDataOfGameByCod (MYSQL_RES **mysql_res,long GamCod);
|
unsigned Gam_DB_GetDataOfGameByCod (MYSQL_RES **mysql_res,long GamCod);
|
||||||
|
void Gam_DB_GetGameTxt (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||||
|
bool Gam_DB_CheckIfSimilarGameExists (const struct Gam_Game *Game);
|
||||||
|
|
||||||
unsigned Gam_DB_GetNumQstsGame (long GamCod);
|
unsigned Gam_DB_GetNumQstsGame (long GamCod);
|
||||||
|
unsigned Gam_DB_GetQstIndFromQstCod (long GamCod,long QstCod);
|
||||||
|
unsigned Gam_DB_GetMaxQuestionIndexInGame (long GamCod);
|
||||||
|
|
||||||
unsigned Gam_DB_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd);
|
unsigned Gam_DB_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd);
|
||||||
unsigned Gam_DB_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd);
|
unsigned Gam_DB_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd);
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ static void Hld_PutFormToCreateHoliday (const struct Plc_Places *Places)
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
HTM_TH (1,1,"LM",Txt_Place);
|
HTM_TH (1,1,"LM",Txt_Place);
|
||||||
HTM_TH (1,1,"LM",Txt_Type);
|
HTM_TH (1,1,"LM",Txt_Type);
|
||||||
HTM_TH (1,1,"LM",Txt_START_END_TIME[Dat_START_TIME]);
|
HTM_TH (1,1,"LM",Txt_START_END_TIME[Dat_STR_TIME]);
|
||||||
HTM_TH (1,1,"LM",Txt_START_END_TIME[Dat_END_TIME]);
|
HTM_TH (1,1,"LM",Txt_START_END_TIME[Dat_END_TIME]);
|
||||||
HTM_TH (1,1,"LM",Txt_Holiday);
|
HTM_TH (1,1,"LM",Txt_Holiday);
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -1105,7 +1105,7 @@ static void Hld_PutHeadHolidays (void)
|
||||||
HTM_TH (1,1,"RM",Txt_Code);
|
HTM_TH (1,1,"RM",Txt_Code);
|
||||||
HTM_TH (1,1,"LM",Txt_Place);
|
HTM_TH (1,1,"LM",Txt_Place);
|
||||||
HTM_TH (1,1,"LM",Txt_Type);
|
HTM_TH (1,1,"LM",Txt_Type);
|
||||||
HTM_TH (1,1,"LM",Txt_START_END_TIME[Dat_START_TIME]);
|
HTM_TH (1,1,"LM",Txt_START_END_TIME[Dat_STR_TIME]);
|
||||||
HTM_TH (1,1,"LM",Txt_START_END_TIME[Dat_END_TIME]);
|
HTM_TH (1,1,"LM",Txt_START_END_TIME[Dat_END_TIME]);
|
||||||
HTM_TH (1,1,"LM",Txt_Holiday);
|
HTM_TH (1,1,"LM",Txt_Holiday);
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
18
swad_match.c
18
swad_match.c
|
@ -4499,3 +4499,21 @@ unsigned Mch_DB_GetStartEndMatchesInGame (MYSQL_RES **mysql_res,long GamCod)
|
||||||
" WHERE GamCod=%ld",
|
" WHERE GamCod=%ld",
|
||||||
GamCod);
|
GamCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************** Remove answers of a game question ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Mch_DB_RemAnswersOfAQuestion (long GamCod,unsigned QstInd)
|
||||||
|
{
|
||||||
|
/***** Remove answers from all matches of this game *****/
|
||||||
|
DB_QueryDELETE ("can not remove the answers of a question",
|
||||||
|
"DELETE FROM mch_answers"
|
||||||
|
" USING mch_matches,"
|
||||||
|
"mch_answers"
|
||||||
|
" WHERE mch_matches.GamCod=%ld" // From all matches of this game...
|
||||||
|
" AND mch_matches.MchCod=mch_answers.MchCod"
|
||||||
|
" AND mch_answers.QstInd=%u", // ...remove only answers to this question
|
||||||
|
GamCod,
|
||||||
|
QstInd);
|
||||||
|
}
|
||||||
|
|
|
@ -159,5 +159,6 @@ unsigned Mch_DB_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsigned
|
||||||
void Mch_DrawBarNumUsrs (unsigned NumRespondersAns,unsigned NumRespondersQst,bool Correct);
|
void Mch_DrawBarNumUsrs (unsigned NumRespondersAns,unsigned NumRespondersQst,bool Correct);
|
||||||
|
|
||||||
unsigned Mch_DB_GetStartEndMatchesInGame (MYSQL_RES **mysql_res,long GamCod);
|
unsigned Mch_DB_GetStartEndMatchesInGame (MYSQL_RES **mysql_res,long GamCod);
|
||||||
|
void Mch_DB_RemAnswersOfAQuestion (long GamCod,unsigned QstInd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -67,7 +67,7 @@ void MchPrn_ResetPrint (struct MchPrn_Print *Print)
|
||||||
{
|
{
|
||||||
Print->MchCod = -1L;
|
Print->MchCod = -1L;
|
||||||
Print->UsrCod = -1L;
|
Print->UsrCod = -1L;
|
||||||
Print->TimeUTC[Dat_START_TIME] =
|
Print->TimeUTC[Dat_STR_TIME] =
|
||||||
Print->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
Print->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
Print->NumQsts.All =
|
Print->NumQsts.All =
|
||||||
Print->NumQsts.NotBlank = 0;
|
Print->NumQsts.NotBlank = 0;
|
||||||
|
|
|
@ -688,7 +688,7 @@ static void MchRes_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther)
|
||||||
|
|
||||||
HTM_TH (3,2,"CT LINE_BOTTOM",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex :
|
HTM_TH (3,2,"CT LINE_BOTTOM",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex :
|
||||||
Usr_SEX_UNKNOWN]);
|
Usr_SEX_UNKNOWN]);
|
||||||
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_START_TIME]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_STR_TIME]);
|
||||||
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_END_TIME]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_END_TIME]);
|
||||||
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_Match);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_Match);
|
||||||
HTM_TH (3,1,"RT LINE_BOTTOM LINE_LEFT",Txt_Questions);
|
HTM_TH (3,1,"RT LINE_BOTTOM LINE_LEFT",Txt_Questions);
|
||||||
|
|
|
@ -1109,7 +1109,7 @@ static void Prg_GetDataOfItem (struct ProgramItem *Item,
|
||||||
|
|
||||||
/* Get start date (row[5] holds the start UTC time)
|
/* Get start date (row[5] holds the start UTC time)
|
||||||
and end date (row[6] holds the end UTC time) */
|
and end date (row[6] holds the end UTC time) */
|
||||||
Item->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[5]);
|
Item->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||||
Item->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[6]);
|
Item->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[6]);
|
||||||
|
|
||||||
/* Get whether the program item is open or closed (row(7)) */
|
/* Get whether the program item is open or closed (row(7)) */
|
||||||
|
@ -1134,7 +1134,7 @@ static void Prg_ResetItem (struct ProgramItem *Item)
|
||||||
Item->Hierarchy.Level = 0;
|
Item->Hierarchy.Level = 0;
|
||||||
Item->Hierarchy.Hidden = false;
|
Item->Hierarchy.Hidden = false;
|
||||||
Item->UsrCod = -1L;
|
Item->UsrCod = -1L;
|
||||||
Item->TimeUTC[Dat_START_TIME] =
|
Item->TimeUTC[Dat_STR_TIME] =
|
||||||
Item->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
Item->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
Item->Open = false;
|
Item->Open = false;
|
||||||
Item->Title[0] = '\0';
|
Item->Title[0] = '\0';
|
||||||
|
@ -1808,7 +1808,7 @@ static void Prg_ShowFormToCreateItem (long ParentItmCod)
|
||||||
struct ProgramItem Item;
|
struct ProgramItem Item;
|
||||||
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_TO_000000,
|
[Dat_STR_TIME] = Dat_HMS_TO_000000,
|
||||||
[Dat_END_TIME] = Dat_HMS_TO_235959
|
[Dat_END_TIME] = Dat_HMS_TO_235959
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1818,7 +1818,7 @@ static void Prg_ShowFormToCreateItem (long ParentItmCod)
|
||||||
|
|
||||||
/***** Initialize to empty program item *****/
|
/***** Initialize to empty program item *****/
|
||||||
Prg_ResetItem (&Item);
|
Prg_ResetItem (&Item);
|
||||||
Item.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
|
Item.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
Item.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
Item.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
||||||
Item.Open = true;
|
Item.Open = true;
|
||||||
|
|
||||||
|
@ -1857,7 +1857,7 @@ static void Prg_ShowFormToChangeItem (long ItmCod)
|
||||||
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] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1965,7 +1965,7 @@ void Prg_ReceiveFormNewItem (void)
|
||||||
NewItem.Hierarchy.Level = ParentItem.Hierarchy.Level + 1; // Create as child
|
NewItem.Hierarchy.Level = ParentItem.Hierarchy.Level + 1; // Create as child
|
||||||
|
|
||||||
/***** Get start/end date-times *****/
|
/***** Get start/end date-times *****/
|
||||||
NewItem.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
NewItem.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||||
NewItem.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
NewItem.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||||
|
|
||||||
/***** Get program item title *****/
|
/***** Get program item title *****/
|
||||||
|
@ -1975,10 +1975,10 @@ void Prg_ReceiveFormNewItem (void)
|
||||||
Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||||
|
|
||||||
/***** Adjust dates *****/
|
/***** Adjust dates *****/
|
||||||
if (NewItem.TimeUTC[Dat_START_TIME] == 0)
|
if (NewItem.TimeUTC[Dat_STR_TIME] == 0)
|
||||||
NewItem.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
|
NewItem.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
if (NewItem.TimeUTC[Dat_END_TIME] == 0)
|
if (NewItem.TimeUTC[Dat_END_TIME] == 0)
|
||||||
NewItem.TimeUTC[Dat_END_TIME] = NewItem.TimeUTC[Dat_START_TIME] + 2 * 60 * 60; // +2 hours
|
NewItem.TimeUTC[Dat_END_TIME] = NewItem.TimeUTC[Dat_STR_TIME] + 2 * 60 * 60; // +2 hours
|
||||||
|
|
||||||
/***** Create a new program item *****/
|
/***** Create a new program item *****/
|
||||||
Prg_InsertItem (&ParentItem,&NewItem,Description);
|
Prg_InsertItem (&ParentItem,&NewItem,Description);
|
||||||
|
@ -2020,7 +2020,7 @@ void Prg_ReceiveFormChgItem (void)
|
||||||
Prg_GetDataOfItemByCod (&OldItem);
|
Prg_GetDataOfItemByCod (&OldItem);
|
||||||
|
|
||||||
/***** Get start/end date-times *****/
|
/***** Get start/end date-times *****/
|
||||||
NewItem.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
NewItem.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||||
NewItem.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
NewItem.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||||
|
|
||||||
/***** Get program item title *****/
|
/***** Get program item title *****/
|
||||||
|
@ -2030,10 +2030,10 @@ void Prg_ReceiveFormChgItem (void)
|
||||||
Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||||
|
|
||||||
/***** Adjust dates *****/
|
/***** Adjust dates *****/
|
||||||
if (NewItem.TimeUTC[Dat_START_TIME] == 0)
|
if (NewItem.TimeUTC[Dat_STR_TIME] == 0)
|
||||||
NewItem.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
|
NewItem.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
if (NewItem.TimeUTC[Dat_END_TIME] == 0)
|
if (NewItem.TimeUTC[Dat_END_TIME] == 0)
|
||||||
NewItem.TimeUTC[Dat_END_TIME] = NewItem.TimeUTC[Dat_START_TIME] + 2 * 60 * 60; // +2 hours
|
NewItem.TimeUTC[Dat_END_TIME] = NewItem.TimeUTC[Dat_STR_TIME] + 2 * 60 * 60; // +2 hours
|
||||||
|
|
||||||
/***** Update existing item *****/
|
/***** Update existing item *****/
|
||||||
Prg_DB_UpdateItem (&NewItem,Description);
|
Prg_DB_UpdateItem (&NewItem,Description);
|
||||||
|
@ -2141,7 +2141,7 @@ static long Prg_DB_InsertItem (struct ProgramItem *Item,const char *Txt)
|
||||||
Item->Hierarchy.Index,
|
Item->Hierarchy.Index,
|
||||||
Item->Hierarchy.Level,
|
Item->Hierarchy.Level,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Item->TimeUTC[Dat_START_TIME],
|
Item->TimeUTC[Dat_STR_TIME],
|
||||||
Item->TimeUTC[Dat_END_TIME],
|
Item->TimeUTC[Dat_END_TIME],
|
||||||
Item->Title,
|
Item->Title,
|
||||||
Txt);
|
Txt);
|
||||||
|
@ -2162,7 +2162,7 @@ static void Prg_DB_UpdateItem (struct ProgramItem *Item,const char *Txt)
|
||||||
"Txt='%s'"
|
"Txt='%s'"
|
||||||
" WHERE ItmCod=%ld"
|
" WHERE ItmCod=%ld"
|
||||||
" AND CrsCod=%ld", // Extra check
|
" AND CrsCod=%ld", // Extra check
|
||||||
Item->TimeUTC[Dat_START_TIME],
|
Item->TimeUTC[Dat_STR_TIME],
|
||||||
Item->TimeUTC[Dat_END_TIME],
|
Item->TimeUTC[Dat_END_TIME],
|
||||||
Item->Title,
|
Item->Title,
|
||||||
Txt,
|
Txt,
|
||||||
|
|
|
@ -337,12 +337,12 @@ static void Sta_PutFormCrsHits (struct Sta_Stats *Stats)
|
||||||
/***** Initial and final dates of the search *****/
|
/***** Initial and final dates of the search *****/
|
||||||
if (Gbl.Action.Act == ActReqAccCrs)
|
if (Gbl.Action.Act == ActReqAccCrs)
|
||||||
{
|
{
|
||||||
SetHMS[Dat_START_TIME] = Dat_HMS_TO_000000;
|
SetHMS[Dat_STR_TIME] = Dat_HMS_TO_000000;
|
||||||
SetHMS[Dat_END_TIME] = Dat_HMS_TO_235959;
|
SetHMS[Dat_END_TIME] = Dat_HMS_TO_235959;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetHMS[Dat_START_TIME] = Dat_HMS_DO_NOT_SET;
|
SetHMS[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET;
|
||||||
SetHMS[Dat_END_TIME] = Dat_HMS_DO_NOT_SET;
|
SetHMS[Dat_END_TIME] = Dat_HMS_DO_NOT_SET;
|
||||||
}
|
}
|
||||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (SetHMS);
|
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (SetHMS);
|
||||||
|
@ -486,7 +486,7 @@ static void Sta_PutFormGblHits (struct Sta_Stats *Stats)
|
||||||
extern const char *Txt_Show_hits;
|
extern const char *Txt_Show_hits;
|
||||||
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_TO_000000,
|
[Dat_STR_TIME] = Dat_HMS_TO_000000,
|
||||||
[Dat_END_TIME] = Dat_HMS_TO_235959
|
[Dat_END_TIME] = Dat_HMS_TO_235959
|
||||||
};
|
};
|
||||||
Sta_Role_t RoleStat;
|
Sta_Role_t RoleStat;
|
||||||
|
@ -719,7 +719,7 @@ static void Sta_WriteSelectorAction (const struct Sta_Stats *Stats)
|
||||||
|
|
||||||
void Sta_SetIniEndDates (void)
|
void Sta_SetIniEndDates (void)
|
||||||
{
|
{
|
||||||
Gbl.DateRange.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC - ((Cfg_DAYS_IN_RECENT_LOG - 1) * 24 * 60 * 60);
|
Gbl.DateRange.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC - ((Cfg_DAYS_IN_RECENT_LOG - 1) * 24 * 60 * 60);
|
||||||
Gbl.DateRange.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC;
|
Gbl.DateRange.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1127,7 +1127,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
|
||||||
" BETWEEN FROM_UNIXTIME(%ld)"
|
" BETWEEN FROM_UNIXTIME(%ld)"
|
||||||
" AND FROM_UNIXTIME(%ld)",
|
" AND FROM_UNIXTIME(%ld)",
|
||||||
LogTable,
|
LogTable,
|
||||||
(long) Gbl.DateRange.TimeUTC[Dat_START_TIME],
|
(long) Gbl.DateRange.TimeUTC[Dat_STR_TIME],
|
||||||
(long) Gbl.DateRange.TimeUTC[Dat_END_TIME]);
|
(long) Gbl.DateRange.TimeUTC[Dat_END_TIME]);
|
||||||
Str_Concat (Query,QueryAux,Sta_MAX_BYTES_QUERY_ACCESS);
|
Str_Concat (Query,QueryAux,Sta_MAX_BYTES_QUERY_ACCESS);
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ static void Svy_ListAllSurveys (struct Svy_Surveys *Surveys)
|
||||||
|
|
||||||
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
||||||
|
|
||||||
for (Order = Dat_START_TIME;
|
for (Order = Dat_STR_TIME;
|
||||||
Order <= Dat_END_TIME;
|
Order <= Dat_END_TIME;
|
||||||
Order++)
|
Order++)
|
||||||
{
|
{
|
||||||
|
@ -935,7 +935,7 @@ static void Svy_GetListSurveys (struct Svy_Surveys *Surveys)
|
||||||
char *SubQuery[HieLvl_NUM_LEVELS];
|
char *SubQuery[HieLvl_NUM_LEVELS];
|
||||||
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
|
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = "StartTime DESC,EndTime DESC,Title DESC",
|
[Dat_STR_TIME] = "StartTime DESC,EndTime DESC,Title DESC",
|
||||||
[Dat_END_TIME] = "EndTime DESC,StartTime DESC,Title DESC",
|
[Dat_END_TIME] = "EndTime DESC,StartTime DESC,Title DESC",
|
||||||
};
|
};
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
@ -1883,7 +1883,7 @@ void Svy_RequestCreatOrEditSvy (void)
|
||||||
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] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_TO_000000,
|
[Dat_STR_TIME] = Dat_HMS_TO_000000,
|
||||||
[Dat_END_TIME] = Dat_HMS_TO_235959
|
[Dat_END_TIME] = Dat_HMS_TO_235959
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2272,7 +2272,7 @@ void Svy_ReceiveFormSurvey (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Get start/end date-times *****/
|
/***** Get start/end date-times *****/
|
||||||
NewSvy.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
NewSvy.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||||
NewSvy.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
NewSvy.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||||
|
|
||||||
/***** Get survey title *****/
|
/***** Get survey title *****/
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef enum
|
||||||
Svy_START_TIME = 0,
|
Svy_START_TIME = 0,
|
||||||
Svy_END_TIME = 1,
|
Svy_END_TIME = 1,
|
||||||
} Svy_StartOrEndTime_t;
|
} Svy_StartOrEndTime_t;
|
||||||
#define Svy_ORDER_DEFAULT Dat_START_TIME
|
#define Svy_ORDER_DEFAULT Dat_STR_TIME
|
||||||
|
|
||||||
struct Svy_Surveys
|
struct Svy_Surveys
|
||||||
{
|
{
|
||||||
|
|
|
@ -1003,7 +1003,7 @@ static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test)
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1101,7 +1101,7 @@ static void Tst_ShowFormRequestSelectTestsForSet (struct Exa_Exams *Exams,
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1163,7 +1163,7 @@ static void Tst_ShowFormRequestSelectTestsForGame (struct Gam_Games *Games,
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1770,7 +1770,7 @@ static void Tst_GetQuestions (struct Tst_Test *Test,MYSQL_RES **mysql_res)
|
||||||
Str_Concat (Query,"' AND tst_questions.EditTime>=FROM_UNIXTIME('",
|
Str_Concat (Query,"' AND tst_questions.EditTime>=FROM_UNIXTIME('",
|
||||||
Tst_MAX_BYTES_QUERY_TEST);
|
Tst_MAX_BYTES_QUERY_TEST);
|
||||||
snprintf (LongStr,sizeof (LongStr),"%ld",
|
snprintf (LongStr,sizeof (LongStr),"%ld",
|
||||||
(long) Gbl.DateRange.TimeUTC[Dat_START_TIME]);
|
(long) Gbl.DateRange.TimeUTC[Dat_STR_TIME]);
|
||||||
Str_Concat (Query,LongStr,Tst_MAX_BYTES_QUERY_TEST);
|
Str_Concat (Query,LongStr,Tst_MAX_BYTES_QUERY_TEST);
|
||||||
Str_Concat (Query,"') AND tst_questions.EditTime<=FROM_UNIXTIME('",
|
Str_Concat (Query,"') AND tst_questions.EditTime<=FROM_UNIXTIME('",
|
||||||
Tst_MAX_BYTES_QUERY_TEST);
|
Tst_MAX_BYTES_QUERY_TEST);
|
||||||
|
|
|
@ -197,7 +197,7 @@ void TstPrn_ResetPrint (struct TstPrn_Print *Print)
|
||||||
|
|
||||||
static void TstPrn_ResetPrintExceptPrnCod (struct TstPrn_Print *Print)
|
static void TstPrn_ResetPrintExceptPrnCod (struct TstPrn_Print *Print)
|
||||||
{
|
{
|
||||||
Print->TimeUTC[Dat_START_TIME] =
|
Print->TimeUTC[Dat_STR_TIME] =
|
||||||
Print->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
Print->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
Print->NumQsts.All =
|
Print->NumQsts.All =
|
||||||
Print->NumQsts.NotBlank = 0;
|
Print->NumQsts.NotBlank = 0;
|
||||||
|
@ -692,7 +692,7 @@ static void TstPrn_WriteQstAndAnsExam (struct UsrData *UsrDat,
|
||||||
/***** If this question has been edited later than test time
|
/***** If this question has been edited later than test time
|
||||||
==> don't show question ****/
|
==> don't show question ****/
|
||||||
if (QuestionExists)
|
if (QuestionExists)
|
||||||
QuestionUneditedAfterExam = (Question->EditTime < TimeUTC[Dat_START_TIME]);
|
QuestionUneditedAfterExam = (Question->EditTime < TimeUTC[Dat_STR_TIME]);
|
||||||
else
|
else
|
||||||
QuestionUneditedAfterExam = false;
|
QuestionUneditedAfterExam = false;
|
||||||
|
|
||||||
|
@ -1885,7 +1885,7 @@ void TstPrn_SelDatesToSeeMyPrints (void)
|
||||||
extern const char *Txt_View_results;
|
extern const char *Txt_View_results;
|
||||||
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2009,7 +2009,7 @@ static void TstPrn_ShowHeaderPrints (Usr_MeOrOther_t MeOrOther)
|
||||||
|
|
||||||
HTM_TH (3,2,"CT LINE_BOTTOM",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex :
|
HTM_TH (3,2,"CT LINE_BOTTOM",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex :
|
||||||
Usr_SEX_UNKNOWN]);
|
Usr_SEX_UNKNOWN]);
|
||||||
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_START_TIME]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_STR_TIME]);
|
||||||
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_END_TIME]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_END_TIME]);
|
||||||
HTM_TH (3,1,"RT LINE_BOTTOM LINE_LEFT",Txt_Questions);
|
HTM_TH (3,1,"RT LINE_BOTTOM LINE_LEFT",Txt_Questions);
|
||||||
HTM_TH (1,2,"CT LINE_LEFT",Txt_Answers);
|
HTM_TH (1,2,"CT LINE_LEFT",Txt_Answers);
|
||||||
|
@ -2085,7 +2085,7 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
" ORDER BY ExaCod",
|
" ORDER BY ExaCod",
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
UsrDat->UsrCod,
|
UsrDat->UsrCod,
|
||||||
(long) Gbl.DateRange.TimeUTC[Dat_START_TIME],
|
(long) Gbl.DateRange.TimeUTC[Dat_STR_TIME],
|
||||||
(long) Gbl.DateRange.TimeUTC[Dat_END_TIME]);
|
(long) Gbl.DateRange.TimeUTC[Dat_END_TIME]);
|
||||||
|
|
||||||
/***** Show user's data *****/
|
/***** Show user's data *****/
|
||||||
|
@ -2718,7 +2718,7 @@ void TstPrn_GetPrintDataByPrnCod (struct TstPrn_Print *Print)
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
|
||||||
/* Get date-time (row[1] and row[2] hold UTC date-time) */
|
/* Get date-time (row[1] and row[2] hold UTC date-time) */
|
||||||
Print->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[1]);
|
Print->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[1]);
|
||||||
Print->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[2]);
|
Print->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[2]);
|
||||||
|
|
||||||
/* Get number of questions (row[3]) */
|
/* Get number of questions (row[3]) */
|
||||||
|
|
|
@ -2372,7 +2372,7 @@ const char *Txt_Assignments_and_other_works =
|
||||||
|
|
||||||
const char *Txt_START_END_TIME_HELP[Dat_NUM_START_END_TIME] =
|
const char *Txt_START_END_TIME_HELP[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] =
|
[Dat_STR_TIME] =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Ordenar per data de començament"
|
"Ordenar per data de començament"
|
||||||
#elif L==2 // de
|
#elif L==2 // de
|
||||||
|
@ -2417,7 +2417,7 @@ const char *Txt_START_END_TIME_HELP[Dat_NUM_START_END_TIME] =
|
||||||
|
|
||||||
const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME] =
|
const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] =
|
[Dat_STR_TIME] =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Inici"
|
"Inici"
|
||||||
#elif L==2 // de
|
#elif L==2 // de
|
||||||
|
@ -14159,7 +14159,7 @@ const char *Txt_Forum_threads =
|
||||||
|
|
||||||
const char *Txt_FORUM_THREAD_HELP_ORDER[Dat_NUM_START_END_TIME] =
|
const char *Txt_FORUM_THREAD_HELP_ORDER[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] =
|
[Dat_STR_TIME] =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Ordenar por fecha del primer mensaje" // Necessita traduccio
|
"Ordenar por fecha del primer mensaje" // Necessita traduccio
|
||||||
#elif L==2 // de
|
#elif L==2 // de
|
||||||
|
@ -14204,7 +14204,7 @@ const char *Txt_FORUM_THREAD_HELP_ORDER[Dat_NUM_START_END_TIME] =
|
||||||
|
|
||||||
const char *Txt_FORUM_THREAD_ORDER[Dat_NUM_START_END_TIME] =
|
const char *Txt_FORUM_THREAD_ORDER[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] =
|
[Dat_STR_TIME] =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Primer comentari"
|
"Primer comentari"
|
||||||
#elif L==2 // de
|
#elif L==2 // de
|
||||||
|
|
|
@ -6473,7 +6473,7 @@ void Usr_PutFormToSelectUsrsToGoToAct (struct SelectedUsrs *SelectedUsrs,
|
||||||
unsigned NumTotalUsrs;
|
unsigned NumTotalUsrs;
|
||||||
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user