mirror of https://github.com/acanas/swad-core.git
Version 20.73: May 10, 2021 New module swad_agenda_database for database queries related to agenda.
This commit is contained in:
parent
39dc3d39a3
commit
701a479e04
4
Makefile
4
Makefile
|
@ -27,8 +27,8 @@
|
|||
###############################################################################
|
||||
|
||||
OBJS = swad_account.o swad_account_database.o swad_action.o swad_agenda.o \
|
||||
swad_alert.o swad_announcement.o swad_API.o swad_assignment.o \
|
||||
swad_attendance.o \
|
||||
swad_agenda_database.o swad_alert.o swad_announcement.o swad_API.o \
|
||||
swad_assignment.o swad_attendance.o \
|
||||
swad_banner.o swad_box.o swad_building.o swad_button.o \
|
||||
swad_calendar.o swad_call_for_exam.o swad_center.o \
|
||||
swad_center_config.o swad_chat.o swad_config.o swad_connected.o \
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include "swad_account.h"
|
||||
#include "swad_account_database.h"
|
||||
#include "swad_agenda.h"
|
||||
#include "swad_agenda_database.h"
|
||||
#include "swad_announcement.h"
|
||||
#include "swad_attendance.h"
|
||||
#include "swad_box.h"
|
||||
|
@ -375,11 +375,7 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutAr
|
|||
Hlp_PROFILE_SignUp,Box_NOT_CLOSABLE,2);
|
||||
|
||||
/***** Nickname *****/
|
||||
if (NewNickWithoutArr[0])
|
||||
snprintf (NewNickWithArr,sizeof (NewNickWithArr),"@%s",
|
||||
NewNickWithoutArr);
|
||||
else
|
||||
NewNickWithArr[0] = '\0';
|
||||
/* Begin table row */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Label */
|
||||
|
@ -387,6 +383,11 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutAr
|
|||
|
||||
/* Data */
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
if (NewNickWithoutArr[0])
|
||||
snprintf (NewNickWithArr,sizeof (NewNickWithArr),"@%s",
|
||||
NewNickWithoutArr);
|
||||
else
|
||||
NewNickWithArr[0] = '\0';
|
||||
HTM_INPUT_TEXT ("NewNick",1 + Nck_MAX_CHARS_NICK_WITHOUT_ARROBA,
|
||||
NewNickWithArr,HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"NewNick\" size=\"18\" placeholder=\"%s\""
|
||||
|
@ -394,9 +395,11 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutAr
|
|||
Txt_HELP_nickname);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* End table row */
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Email *****/
|
||||
/* Begin table row */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Label */
|
||||
|
@ -410,6 +413,7 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutAr
|
|||
Txt_HELP_email);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* End table row */
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Password *****/
|
||||
|
|
|
@ -25,37 +25,10 @@
|
|||
/*********************************** Headers *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// #include <string.h> // For string functions
|
||||
|
||||
#include "swad_account.h"
|
||||
#include "swad_account_database.h"
|
||||
// #include "swad_agenda.h"
|
||||
// #include "swad_announcement.h"
|
||||
// #include "swad_attendance.h"
|
||||
// #include "swad_box.h"
|
||||
#include "swad_calendar.h"
|
||||
// #include "swad_database.h"
|
||||
// #include "swad_duplicate.h"
|
||||
// #include "swad_enrolment.h"
|
||||
// #include "swad_error.h"
|
||||
// #include "swad_exam_print.h"
|
||||
// #include "swad_follow.h"
|
||||
// #include "swad_form.h"
|
||||
// #include "swad_forum.h"
|
||||
#include "swad_global.h"
|
||||
// #include "swad_HTML.h"
|
||||
// #include "swad_ID.h"
|
||||
// #include "swad_language.h"
|
||||
// #include "swad_match.h"
|
||||
// #include "swad_message.h"
|
||||
// #include "swad_nickname.h"
|
||||
// #include "swad_notification.h"
|
||||
// #include "swad_parameter.h"
|
||||
// #include "swad_profile.h"
|
||||
// #include "swad_project.h"
|
||||
// #include "swad_report.h"
|
||||
// #include "swad_test_print.h"
|
||||
// #include "swad_timeline.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public constants *****************************/
|
||||
|
@ -131,7 +104,6 @@ bool Acc_DB_CheckIfEmailAlreadyExists (const char NewEmail[Cns_MAX_BYTES_EMAIL_A
|
|||
NewEmail) != 0); // An email of another user is the same that my email
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Create new user ******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -145,10 +117,8 @@ void Acc_DB_CreateNewUsr (struct UsrData *UsrDat)
|
|||
extern const char *Usr_StringsSexDB[Usr_NUM_SEXS];
|
||||
char BirthdayStrDB[Usr_BIRTHDAY_STR_DB_LENGTH + 1];
|
||||
|
||||
/***** Create birthday string *****/
|
||||
Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB); // It can include start and ending apostrophes
|
||||
|
||||
/***** Create new user *****/
|
||||
Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB); // It can include start and ending apostrophes
|
||||
UsrDat->UsrCod =
|
||||
DB_QueryINSERTandReturnCode ("can not create user",
|
||||
"INSERT INTO usr_data"
|
||||
|
|
479
swad_agenda.c
479
swad_agenda.c
|
@ -33,6 +33,7 @@
|
|||
#include <string.h> // For string functions
|
||||
|
||||
#include "swad_agenda.h"
|
||||
#include "swad_agenda_database.h"
|
||||
#include "swad_box.h"
|
||||
#include "swad_database.h"
|
||||
#include "swad_date.h"
|
||||
|
@ -68,15 +69,6 @@ static const char *ParamHiddenVisiblName = "HiddenVisibl";
|
|||
/******************************* Private types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Agd_NUM_AGENDA_TYPES 4
|
||||
typedef enum
|
||||
{
|
||||
Agd_MY_AGENDA_TODAY,
|
||||
Agd_MY_AGENDA,
|
||||
Agd_ANOTHER_AGENDA_TODAY,
|
||||
Agd_ANOTHER_AGENDA,
|
||||
} Agd_AgendaType_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private variables *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -132,11 +124,6 @@ static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent);
|
|||
|
||||
static void Agd_FreeListEvents (struct Agd_Agenda *Agenda);
|
||||
|
||||
static void Agd_GetEventTxtFromDB (struct Agd_Event *AgdEvent,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
static void Agd_CreateEvent (struct Agd_Event *AgdEvent,const char *Txt);
|
||||
static void Agd_UpdateEvent (struct Agd_Event *AgdEvent,const char *Txt);
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Reset agenda context ****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -665,7 +652,9 @@ static void Agd_WriteHeaderListEvents (const struct Agd_Agenda *Agenda,
|
|||
HTM_BUTTON_SUBMIT_Begin (Txt_START_END_TIME_HELP[Order],"BT_LINK TIT_TBL",NULL);
|
||||
if (Order == Agenda->SelectedOrder)
|
||||
HTM_U_Begin ();
|
||||
|
||||
HTM_Txt (Txt_START_END_TIME[Order]);
|
||||
|
||||
if (Order == Agenda->SelectedOrder)
|
||||
HTM_U_End ();
|
||||
HTM_BUTTON_End ();
|
||||
|
@ -767,6 +756,7 @@ static void Agd_PutButtonToCreateNewEvent (const struct Agd_Agenda *Agenda)
|
|||
{
|
||||
extern const char *Txt_New_event;
|
||||
|
||||
/***** Begin form *****/
|
||||
Frm_BeginForm (ActFrmNewEvtMyAgd);
|
||||
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents,
|
||||
Agenda->PrivatPublicEvents,
|
||||
|
@ -774,7 +764,11 @@ static void Agd_PutButtonToCreateNewEvent (const struct Agd_Agenda *Agenda)
|
|||
Agenda->SelectedOrder,
|
||||
Agenda->CurrentPage,
|
||||
-1L);
|
||||
|
||||
/***** Confirm button *****/
|
||||
Btn_PutConfirmButton (Txt_New_event);
|
||||
|
||||
/***** End form *****/
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
|
@ -872,14 +866,13 @@ static void Agd_ShowOneEvent (struct Agd_Agenda *Agenda,
|
|||
HTM_TD_End ();
|
||||
|
||||
/* Text of the event */
|
||||
Agd_GetEventTxtFromDB (&AgdEvent,Txt);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
||||
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
HTM_DIV_Begin ("class=\"PAR %s\"",AgdEvent.Hidden ? "DAT_LIGHT" :
|
||||
"DAT");
|
||||
Agd_DB_GetEventTxt (&AgdEvent,Txt);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
||||
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
HTM_Txt (Txt);
|
||||
HTM_DIV_End ();
|
||||
HTM_TD_End ();
|
||||
|
@ -1045,24 +1038,13 @@ static void Agd_GetParamEventOrder (struct Agd_Agenda *Agenda)
|
|||
static void Agd_GetListEvents (struct Agd_Agenda *Agenda,
|
||||
Agd_AgendaType_t AgendaType)
|
||||
{
|
||||
char *UsrSubQuery;
|
||||
char Past__FutureEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
|
||||
char PrivatPublicEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
|
||||
char HiddenVisiblEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
|
||||
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
|
||||
{
|
||||
[Dat_START_TIME] = "StartTime,EndTime,Event,Location",
|
||||
[Dat_END_TIME ] = "EndTime,StartTime,Event,Location",
|
||||
};
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumEvent;
|
||||
bool DoQuery = true;
|
||||
|
||||
/***** Initialize list of events *****/
|
||||
Agd_FreeListEvents (Agenda);
|
||||
|
||||
/***** Get list of events from database *****/
|
||||
/* Build events subqueries */
|
||||
/***** Trivial check: anything to get from database? *****/
|
||||
switch (AgendaType)
|
||||
{
|
||||
case Agd_MY_AGENDA_TODAY:
|
||||
|
@ -1070,103 +1052,18 @@ static void Agd_GetListEvents (struct Agd_Agenda *Agenda,
|
|||
if (Agenda->Past__FutureEvents == 0 ||
|
||||
Agenda->PrivatPublicEvents == 0 ||
|
||||
Agenda->HiddenVisiblEvents == 0) // All selectors are off
|
||||
DoQuery = false; // Nothing to get from database
|
||||
else
|
||||
{
|
||||
if (asprintf (&UsrSubQuery,"UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
if (AgendaType == Agd_MY_AGENDA_TODAY)
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(StartTime)<=CURDATE()"
|
||||
" AND DATE(EndTime)>=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Today events
|
||||
else
|
||||
switch (Agenda->Past__FutureEvents)
|
||||
{
|
||||
case (1 << Agd_PAST___EVENTS):
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(StartTime)<=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Past and today events
|
||||
break;
|
||||
case (1 << Agd_FUTURE_EVENTS):
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(EndTime)>=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Today and future events
|
||||
// Nothing to get from database
|
||||
Agenda->LstIsRead = true;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Past__FutureEventsSubQuery[0] = '\0'; // All events
|
||||
break;
|
||||
}
|
||||
switch (Agenda->PrivatPublicEvents)
|
||||
{
|
||||
case (1 << Agd_PRIVAT_EVENTS):
|
||||
Str_Copy (PrivatPublicEventsSubQuery," AND Public='N'",
|
||||
sizeof (PrivatPublicEventsSubQuery) - 1); // Private events
|
||||
break;
|
||||
case (1 << Agd_PUBLIC_EVENTS):
|
||||
Str_Copy (PrivatPublicEventsSubQuery," AND Public='Y'",
|
||||
sizeof (PrivatPublicEventsSubQuery) - 1); // Public events
|
||||
break;
|
||||
default:
|
||||
PrivatPublicEventsSubQuery[0] = '\0'; // All events
|
||||
break;
|
||||
}
|
||||
switch (Agenda->HiddenVisiblEvents)
|
||||
{
|
||||
case (1 << Agd_HIDDEN_EVENTS):
|
||||
Str_Copy (HiddenVisiblEventsSubQuery," AND Hidden='Y'",
|
||||
sizeof (HiddenVisiblEventsSubQuery) - 1); // Hidden events
|
||||
break;
|
||||
case (1 << Agd_VISIBL_EVENTS):
|
||||
Str_Copy (HiddenVisiblEventsSubQuery," AND Hidden='N'",
|
||||
sizeof (HiddenVisiblEventsSubQuery) - 1); // Visible events
|
||||
break;
|
||||
default:
|
||||
HiddenVisiblEventsSubQuery[0] = '\0'; // All events
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Agd_ANOTHER_AGENDA_TODAY:
|
||||
case Agd_ANOTHER_AGENDA:
|
||||
if (asprintf (&UsrSubQuery,"UsrCod=%ld",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
if (AgendaType == Agd_ANOTHER_AGENDA_TODAY)
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(StartTime)<=CURDATE()"
|
||||
" AND DATE(EndTime)>=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Today events
|
||||
else
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(EndTime)>=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Today and future events
|
||||
Str_Copy (PrivatPublicEventsSubQuery," AND Public='Y'",
|
||||
sizeof (PrivatPublicEventsSubQuery) - 1); // Public events
|
||||
Str_Copy (HiddenVisiblEventsSubQuery," AND Hidden='N'",
|
||||
sizeof (HiddenVisiblEventsSubQuery) - 1); // Visible events
|
||||
}
|
||||
|
||||
if (DoQuery)
|
||||
{
|
||||
/* Make query */
|
||||
Agenda->Num = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get agenda events",
|
||||
"SELECT AgdCod" // row[0]
|
||||
" FROM agd_agendas"
|
||||
" WHERE %s%s%s%s"
|
||||
" ORDER BY %s",
|
||||
UsrSubQuery,
|
||||
Past__FutureEventsSubQuery,
|
||||
PrivatPublicEventsSubQuery,
|
||||
HiddenVisiblEventsSubQuery,
|
||||
OrderBySubQuery[Agenda->SelectedOrder]);
|
||||
|
||||
/* Free allocated memory for subquery */
|
||||
free (UsrSubQuery);
|
||||
|
||||
if (Agenda->Num) // Events found...
|
||||
/***** Get list of events from database *****/
|
||||
if ((Agenda->Num = Agd_DB_GetListEvents (&mysql_res,Agenda,AgendaType))) // Events found...
|
||||
{
|
||||
/***** Create list of events *****/
|
||||
if ((Agenda->LstAgdCods = calloc ((size_t) Agenda->Num,
|
||||
|
@ -1184,7 +1081,6 @@ static void Agd_GetListEvents (struct Agd_Agenda *Agenda,
|
|||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
Agenda->LstIsRead = true;
|
||||
}
|
||||
|
@ -1199,21 +1095,7 @@ static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
|
|||
MYSQL_ROW row;
|
||||
|
||||
/***** Get data of event from database *****/
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get agenda event data",
|
||||
"SELECT AgdCod," // row[0]
|
||||
"Public," // row[1]
|
||||
"Hidden," // row[2]
|
||||
"UNIX_TIMESTAMP(StartTime)," // row[3]
|
||||
"UNIX_TIMESTAMP(EndTime)," // row[4]
|
||||
"NOW()>EndTime," // row[5] Past event?
|
||||
"NOW()<StartTime," // row[6] Future event?
|
||||
"Event," // row[7]
|
||||
"Location" // row[8]
|
||||
" FROM agd_agendas"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod)) // Event found...
|
||||
if (Agd_DB_GetDataOfEventByCod (&mysql_res,AgdEvent)) // Event found...
|
||||
{
|
||||
/* Get row:
|
||||
row[0] AgdCod
|
||||
|
@ -1282,23 +1164,6 @@ static void Agd_FreeListEvents (struct Agd_Agenda *Agenda)
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Get event text from database ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Agd_GetEventTxtFromDB (struct Agd_Event *AgdEvent,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1])
|
||||
{
|
||||
/***** Get text of event from database *****/
|
||||
DB_QuerySELECTString (Txt,Cns_MAX_BYTES_TEXT,"can not get event text",
|
||||
"SELECT Txt"
|
||||
" FROM agd_agendas"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Get parameter with code of event ***********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1371,12 +1236,7 @@ void Agd_RemoveEvent (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Remove event *****/
|
||||
DB_QueryDELETE ("can not remove event",
|
||||
"DELETE FROM agd_agendas"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,
|
||||
AgdEvent.UsrCod);
|
||||
Agd_DB_RemoveEvent (&AgdEvent);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_removed,
|
||||
|
@ -1410,13 +1270,7 @@ void Agd_HideEvent (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Set event private *****/
|
||||
DB_QueryUPDATE ("can not hide event",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Hidden='Y'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,
|
||||
AgdEvent.UsrCod);
|
||||
Agd_DB_HideEvent (&AgdEvent);
|
||||
|
||||
/***** Show events again *****/
|
||||
Agd_ShowMyAgenda (&Agenda);
|
||||
|
@ -1446,13 +1300,7 @@ void Agd_UnhideEvent (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Set event public *****/
|
||||
DB_QueryUPDATE ("can not show event",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Hidden='N'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,
|
||||
AgdEvent.UsrCod);
|
||||
Agd_DB_UnhideEvent (&AgdEvent);
|
||||
|
||||
/***** Show events again *****/
|
||||
Agd_ShowMyAgenda (&Agenda);
|
||||
|
@ -1483,13 +1331,7 @@ void Agd_MakeEventPrivate (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Make event private *****/
|
||||
DB_QueryUPDATE ("can not make event private",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Public='N'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,
|
||||
AgdEvent.UsrCod);
|
||||
Agd_DB_MakeEventPrivate (&AgdEvent);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_is_now_private,
|
||||
|
@ -1524,13 +1366,7 @@ void Agd_MakeEventPublic (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Make event public *****/
|
||||
DB_QueryUPDATE ("can not make event public",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Public='Y'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,
|
||||
AgdEvent.UsrCod);
|
||||
Agd_DB_MakeEventPublic (&AgdEvent);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_is_now_visible_to_users_of_your_courses,
|
||||
|
@ -1592,7 +1428,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/* Get text of the event from database */
|
||||
Agd_GetEventTxtFromDB (&AgdEvent,Txt);
|
||||
Agd_DB_GetEventTxt (&AgdEvent,Txt);
|
||||
}
|
||||
|
||||
/***** Begin form *****/
|
||||
|
@ -1619,6 +1455,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
Hlp_PROFILE_Agenda_edit_event,Box_NOT_CLOSABLE,2);
|
||||
|
||||
/***** Event *****/
|
||||
/* Begin table row */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Label */
|
||||
|
@ -1632,9 +1469,11 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
||||
HTM_TD_End ();
|
||||
|
||||
/* End table row */
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Location *****/
|
||||
/* Begin table row */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Label */
|
||||
|
@ -1648,6 +1487,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
" class=\"TITLE_DESCRIPTION_WIDTH\"");
|
||||
HTM_TD_End ();
|
||||
|
||||
/* End table row */
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Start and end dates *****/
|
||||
|
@ -1656,6 +1496,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
SetHMS);
|
||||
|
||||
/***** Text *****/
|
||||
/* Begin table row */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Label */
|
||||
|
@ -1670,6 +1511,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
HTM_TEXTAREA_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* End table row */
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** End table, send button and end box *****/
|
||||
|
@ -1750,7 +1592,7 @@ void Agd_ReceiveFormEvent (void)
|
|||
{
|
||||
if (ItsANewEvent)
|
||||
{
|
||||
Agd_CreateEvent (&AgdEvent,EventTxt); // Add new event to database
|
||||
AgdEvent.AgdCod = Agd_DB_CreateEvent (&AgdEvent,EventTxt); // Add new event to database
|
||||
|
||||
/***** Write success message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_event_X,
|
||||
|
@ -1758,7 +1600,7 @@ void Agd_ReceiveFormEvent (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
Agd_UpdateEvent (&AgdEvent,EventTxt);
|
||||
Agd_DB_UpdateEvent (&AgdEvent,EventTxt);
|
||||
|
||||
/***** Write success message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_event_has_been_modified);
|
||||
|
@ -1775,259 +1617,6 @@ void Agd_ReceiveFormEvent (void)
|
|||
Agd_RequestCreatOrEditEvent ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Create a new event *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Agd_CreateEvent (struct Agd_Event *AgdEvent,const char *Txt)
|
||||
{
|
||||
/***** Create a new event *****/
|
||||
AgdEvent->AgdCod =
|
||||
DB_QueryINSERTandReturnCode ("can not create new event",
|
||||
"INSERT INTO agd_agendas"
|
||||
" (UsrCod,StartTime,EndTime,"
|
||||
"Event,Location,Txt)"
|
||||
" VALUES"
|
||||
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
|
||||
"'%s','%s','%s')",
|
||||
AgdEvent->UsrCod,
|
||||
AgdEvent->TimeUTC[Dat_START_TIME],
|
||||
AgdEvent->TimeUTC[Dat_END_TIME ],
|
||||
AgdEvent->Event,
|
||||
AgdEvent->Location,
|
||||
Txt);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Update an existing event ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Agd_UpdateEvent (struct Agd_Event *AgdEvent,const char *Txt)
|
||||
{
|
||||
/***** Update the data of the event *****/
|
||||
DB_QueryUPDATE ("can not update event",
|
||||
"UPDATE agd_agendas"
|
||||
" SET StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Event='%s',"
|
||||
"Location='%s',"
|
||||
"Txt='%s'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->TimeUTC[Dat_START_TIME],
|
||||
AgdEvent->TimeUTC[Dat_END_TIME ],
|
||||
AgdEvent->Event,
|
||||
AgdEvent->Location,
|
||||
Txt,
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Remove all the events of a user **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Agd_DB_RemoveUsrEvents (long UsrCod)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove all the events of a user",
|
||||
"DELETE FROM agd_agendas"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get number of events from a user **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Agd_GetNumEventsFromUsr (long UsrCod)
|
||||
{
|
||||
/***** Get number of events in a course from database *****/
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events from user",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM agd_agendas"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Get number of users with events **********************/
|
||||
/*****************************************************************************/
|
||||
// Returns the number of users with events in a given scope
|
||||
|
||||
unsigned Agd_GetNumUsrsWithEvents (Hie_Lvl_Level_t Scope)
|
||||
{
|
||||
/***** Get number of users with events from database *****/
|
||||
switch (Scope)
|
||||
{
|
||||
case Hie_Lvl_SYS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT UsrCod)"
|
||||
" FROM agd_agendas"
|
||||
" WHERE UsrCod>0");
|
||||
case Hie_Lvl_CTY:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
case Hie_Lvl_INS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE ctr_centers.InsCod=%ld"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Ins.InsCod);
|
||||
case Hie_Lvl_CTR:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE deg_degrees.CtrCod=%ld"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Ctr.CtrCod);
|
||||
case Hie_Lvl_DEG:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM crs_courses,"
|
||||
"crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE crs_courses.DegCod=%ld"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Deg.DegCod);
|
||||
case Hie_Lvl_CRS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE crs_users.CrsCod=%ld"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
default:
|
||||
Err_WrongScopeExit ();
|
||||
return 0; // Not reached
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Get number of events ****************************/
|
||||
/*****************************************************************************/
|
||||
// Returns the number of events in a given scope
|
||||
|
||||
unsigned Agd_GetNumEvents (Hie_Lvl_Level_t Scope)
|
||||
{
|
||||
/***** Get number of events from database *****/
|
||||
switch (Scope)
|
||||
{
|
||||
case Hie_Lvl_SYS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM agd_agendas"
|
||||
" WHERE UsrCod>0");
|
||||
case Hie_Lvl_CTY:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM (SELECT DISTINCT crs_users.UsrCod"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod) AS users,"
|
||||
"agd_agendas"
|
||||
" WHERE users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
case Hie_Lvl_INS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM (SELECT DISTINCT crs_users.UsrCod"
|
||||
" FROM ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users"
|
||||
" WHERE ctr_centers.InsCod=%ld"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod) AS users,"
|
||||
"agd_agendas"
|
||||
" WHERE users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Ins.InsCod);
|
||||
case Hie_Lvl_CTR:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM (SELECT DISTINCT crs_users.UsrCod"
|
||||
" FROM deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users"
|
||||
" WHERE deg_degrees.CtrCod=%ld"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod) AS users,"
|
||||
"agd_agendas"
|
||||
" WHERE users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Ctr.CtrCod);
|
||||
case Hie_Lvl_DEG:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM (SELECT DISTINCT crs_users.UsrCod"
|
||||
" FROM crs_courses,"
|
||||
"crs_users"
|
||||
" WHERE crs_courses.DegCod=%ld"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod) AS users,"
|
||||
"agd_agendas"
|
||||
" WHERE users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Deg.DegCod);
|
||||
case Hie_Lvl_CRS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE crs_users.CrsCod=%ld"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
default:
|
||||
Err_WrongScopeExit ();
|
||||
return 0; // Not reached
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Show an agenda QR code ***************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -91,6 +91,15 @@ struct Agd_Agenda
|
|||
unsigned CurrentPage;
|
||||
};
|
||||
|
||||
#define Agd_NUM_AGENDA_TYPES 4
|
||||
typedef enum
|
||||
{
|
||||
Agd_MY_AGENDA_TODAY,
|
||||
Agd_MY_AGENDA,
|
||||
Agd_ANOTHER_AGENDA_TODAY,
|
||||
Agd_ANOTHER_AGENDA,
|
||||
} Agd_AgendaType_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -125,12 +134,6 @@ void Agd_MakeEventPublic (void);
|
|||
|
||||
void Agd_ReceiveFormEvent (void);
|
||||
|
||||
void Agd_DB_RemoveUsrEvents (long UsrCod);
|
||||
unsigned Agd_GetNumEventsFromUsr (long UsrCod);
|
||||
|
||||
unsigned Agd_GetNumUsrsWithEvents (Hie_Lvl_Level_t Scope);
|
||||
unsigned Agd_GetNumEvents (Hie_Lvl_Level_t Scope);
|
||||
|
||||
void Agd_PrintAgdQRCode (void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,555 @@
|
|||
// swad_agenda_database.c: user's agenda (personal organizer) operations with database
|
||||
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance),
|
||||
is a web platform developed at the University of Granada (Spain),
|
||||
and used to support university teaching.
|
||||
|
||||
This file is part of SWAD core.
|
||||
Copyright (C) 1999-2021 Antonio Cañas Vargas
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General 3 License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
// #include <linux/limits.h> // For PATH_MAX
|
||||
// #include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For asprintf
|
||||
// #include <stdlib.h> // For calloc
|
||||
// #include <string.h> // For string functions
|
||||
|
||||
#include "swad_agenda.h"
|
||||
#include "swad_agenda_database.h"
|
||||
// #include "swad_box.h"
|
||||
#include "swad_database.h"
|
||||
// #include "swad_date.h"
|
||||
#include "swad_error.h"
|
||||
// #include "swad_form.h"
|
||||
#include "swad_global.h"
|
||||
// #include "swad_group.h"
|
||||
// #include "swad_HTML.h"
|
||||
// #include "swad_notification.h"
|
||||
// #include "swad_pagination.h"
|
||||
// #include "swad_parameter.h"
|
||||
// #include "swad_photo.h"
|
||||
// #include "swad_privacy.h"
|
||||
// #include "swad_QR.h"
|
||||
// #include "swad_setting.h"
|
||||
// #include "swad_string.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** External global variables from others modules ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
extern struct Globals Gbl;
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Private types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private variables *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Get list of agenda events *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Agd_MAX_BYTES_SUBQUERY 128
|
||||
|
||||
unsigned Agd_DB_GetListEvents (MYSQL_RES **mysql_res,
|
||||
const struct Agd_Agenda *Agenda,
|
||||
Agd_AgendaType_t AgendaType)
|
||||
{
|
||||
char *UsrSubQuery;
|
||||
char Past__FutureEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
|
||||
char PrivatPublicEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
|
||||
char HiddenVisiblEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
|
||||
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
|
||||
{
|
||||
[Dat_START_TIME] = "StartTime,EndTime,Event,Location",
|
||||
[Dat_END_TIME ] = "EndTime,StartTime,Event,Location",
|
||||
};
|
||||
unsigned NumEvents;
|
||||
|
||||
/***** Get list of events from database *****/
|
||||
/* Build events subqueries */
|
||||
switch (AgendaType)
|
||||
{
|
||||
case Agd_MY_AGENDA_TODAY:
|
||||
case Agd_MY_AGENDA:
|
||||
if (asprintf (&UsrSubQuery,"UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
if (AgendaType == Agd_MY_AGENDA_TODAY)
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(StartTime)<=CURDATE()"
|
||||
" AND DATE(EndTime)>=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Today events
|
||||
else
|
||||
switch (Agenda->Past__FutureEvents)
|
||||
{
|
||||
case (1 << Agd_PAST___EVENTS):
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(StartTime)<=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Past and today events
|
||||
break;
|
||||
case (1 << Agd_FUTURE_EVENTS):
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(EndTime)>=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Today and future events
|
||||
break;
|
||||
default:
|
||||
Past__FutureEventsSubQuery[0] = '\0'; // All events
|
||||
break;
|
||||
}
|
||||
switch (Agenda->PrivatPublicEvents)
|
||||
{
|
||||
case (1 << Agd_PRIVAT_EVENTS):
|
||||
Str_Copy (PrivatPublicEventsSubQuery," AND Public='N'",
|
||||
sizeof (PrivatPublicEventsSubQuery) - 1); // Private events
|
||||
break;
|
||||
case (1 << Agd_PUBLIC_EVENTS):
|
||||
Str_Copy (PrivatPublicEventsSubQuery," AND Public='Y'",
|
||||
sizeof (PrivatPublicEventsSubQuery) - 1); // Public events
|
||||
break;
|
||||
default:
|
||||
PrivatPublicEventsSubQuery[0] = '\0'; // All events
|
||||
break;
|
||||
}
|
||||
switch (Agenda->HiddenVisiblEvents)
|
||||
{
|
||||
case (1 << Agd_HIDDEN_EVENTS):
|
||||
Str_Copy (HiddenVisiblEventsSubQuery," AND Hidden='Y'",
|
||||
sizeof (HiddenVisiblEventsSubQuery) - 1); // Hidden events
|
||||
break;
|
||||
case (1 << Agd_VISIBL_EVENTS):
|
||||
Str_Copy (HiddenVisiblEventsSubQuery," AND Hidden='N'",
|
||||
sizeof (HiddenVisiblEventsSubQuery) - 1); // Visible events
|
||||
break;
|
||||
default:
|
||||
HiddenVisiblEventsSubQuery[0] = '\0'; // All events
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Agd_ANOTHER_AGENDA_TODAY:
|
||||
case Agd_ANOTHER_AGENDA:
|
||||
if (asprintf (&UsrSubQuery,"UsrCod=%ld",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
if (AgendaType == Agd_ANOTHER_AGENDA_TODAY)
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(StartTime)<=CURDATE()"
|
||||
" AND DATE(EndTime)>=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Today events
|
||||
else
|
||||
Str_Copy (Past__FutureEventsSubQuery,
|
||||
" AND DATE(EndTime)>=CURDATE()",
|
||||
sizeof (Past__FutureEventsSubQuery) - 1); // Today and future events
|
||||
Str_Copy (PrivatPublicEventsSubQuery," AND Public='Y'",
|
||||
sizeof (PrivatPublicEventsSubQuery) - 1); // Public events
|
||||
Str_Copy (HiddenVisiblEventsSubQuery," AND Hidden='N'",
|
||||
sizeof (HiddenVisiblEventsSubQuery) - 1); // Visible events
|
||||
}
|
||||
|
||||
/* Make query */
|
||||
NumEvents = (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get agenda events",
|
||||
"SELECT AgdCod" // row[0]
|
||||
" FROM agd_agendas"
|
||||
" WHERE %s%s%s%s"
|
||||
" ORDER BY %s",
|
||||
UsrSubQuery,
|
||||
Past__FutureEventsSubQuery,
|
||||
PrivatPublicEventsSubQuery,
|
||||
HiddenVisiblEventsSubQuery,
|
||||
OrderBySubQuery[Agenda->SelectedOrder]);
|
||||
|
||||
/* Free allocated memory for subquery */
|
||||
free (UsrSubQuery);
|
||||
|
||||
return NumEvents;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Get event data using its code ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Agd_DB_GetDataOfEventByCod (MYSQL_RES **mysql_res,
|
||||
const struct Agd_Event *AgdEvent)
|
||||
{
|
||||
/***** Get data of event from database *****/
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get agenda event data",
|
||||
"SELECT AgdCod," // row[0]
|
||||
"Public," // row[1]
|
||||
"Hidden," // row[2]
|
||||
"UNIX_TIMESTAMP(StartTime)," // row[3]
|
||||
"UNIX_TIMESTAMP(EndTime)," // row[4]
|
||||
"NOW()>EndTime," // row[5] Past event?
|
||||
"NOW()<StartTime," // row[6] Future event?
|
||||
"Event," // row[7]
|
||||
"Location" // row[8]
|
||||
" FROM agd_agendas"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Get event text from database ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Agd_DB_GetEventTxt (const struct Agd_Event *AgdEvent,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1])
|
||||
{
|
||||
DB_QuerySELECTString (Txt,Cns_MAX_BYTES_TEXT,"can not get event text",
|
||||
"SELECT Txt"
|
||||
" FROM agd_agendas"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Remove event from database ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Agd_DB_RemoveEvent (const struct Agd_Event *AgdEvent)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove event",
|
||||
"DELETE FROM agd_agendas"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Create a new event *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
long Agd_DB_CreateEvent (const struct Agd_Event *AgdEvent,const char *Txt)
|
||||
{
|
||||
/***** Create a new event *****/
|
||||
return
|
||||
DB_QueryINSERTandReturnCode ("can not create new event",
|
||||
"INSERT INTO agd_agendas"
|
||||
" (UsrCod,StartTime,EndTime,"
|
||||
"Event,Location,Txt)"
|
||||
" VALUES"
|
||||
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
|
||||
"'%s','%s','%s')",
|
||||
AgdEvent->UsrCod,
|
||||
AgdEvent->TimeUTC[Dat_START_TIME],
|
||||
AgdEvent->TimeUTC[Dat_END_TIME ],
|
||||
AgdEvent->Event,
|
||||
AgdEvent->Location,
|
||||
Txt);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Update an existing event ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Agd_DB_UpdateEvent (const struct Agd_Event *AgdEvent,const char *Txt)
|
||||
{
|
||||
/***** Update the data of the event *****/
|
||||
DB_QueryUPDATE ("can not update event",
|
||||
"UPDATE agd_agendas"
|
||||
" SET StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Event='%s',"
|
||||
"Location='%s',"
|
||||
"Txt='%s'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->TimeUTC[Dat_START_TIME],
|
||||
AgdEvent->TimeUTC[Dat_END_TIME ],
|
||||
AgdEvent->Event,
|
||||
AgdEvent->Location,
|
||||
Txt,
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Set an existing event as hidden/not hidden *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Agd_DB_HideEvent (const struct Agd_Event *AgdEvent)
|
||||
{
|
||||
DB_QueryUPDATE ("can not hide event",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Hidden='Y'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
void Agd_DB_UnhideEvent (const struct Agd_Event *AgdEvent)
|
||||
{
|
||||
DB_QueryUPDATE ("can not unhide event",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Hidden='N'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Set an existing event as public/private *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Agd_DB_MakeEventPublic (const struct Agd_Event *AgdEvent)
|
||||
{
|
||||
DB_QueryUPDATE ("can not make event public",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Public='Y'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
void Agd_DB_MakeEventPrivate (const struct Agd_Event *AgdEvent)
|
||||
{
|
||||
DB_QueryUPDATE ("can not make event private",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Public='N'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Remove all the events of a user **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Agd_DB_RemoveUsrEvents (long UsrCod)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove all the events of a user",
|
||||
"DELETE FROM agd_agendas"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get number of events from a user **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Agd_DB_GetNumEventsFromUsr (long UsrCod)
|
||||
{
|
||||
/***** Get number of events in a course from database *****/
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events from user",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM agd_agendas"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Get number of users with events **********************/
|
||||
/*****************************************************************************/
|
||||
// Returns the number of users with events in a given scope
|
||||
|
||||
unsigned Agd_DB_GetNumUsrsWithEvents (Hie_Lvl_Level_t Scope)
|
||||
{
|
||||
/***** Get number of users with events from database *****/
|
||||
switch (Scope)
|
||||
{
|
||||
case Hie_Lvl_SYS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT UsrCod)"
|
||||
" FROM agd_agendas"
|
||||
" WHERE UsrCod>0");
|
||||
case Hie_Lvl_CTY:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
case Hie_Lvl_INS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE ctr_centers.InsCod=%ld"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Ins.InsCod);
|
||||
case Hie_Lvl_CTR:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE deg_degrees.CtrCod=%ld"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Ctr.CtrCod);
|
||||
case Hie_Lvl_DEG:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM crs_courses,"
|
||||
"crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE crs_courses.DegCod=%ld"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Deg.DegCod);
|
||||
case Hie_Lvl_CRS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agd_agendas.UsrCod)"
|
||||
" FROM crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE crs_users.CrsCod=%ld"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
default:
|
||||
Err_WrongScopeExit ();
|
||||
return 0; // Not reached
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Get number of events ****************************/
|
||||
/*****************************************************************************/
|
||||
// Returns the number of events in a given scope
|
||||
|
||||
unsigned Agd_DB_GetNumEvents (Hie_Lvl_Level_t Scope)
|
||||
{
|
||||
/***** Get number of events from database *****/
|
||||
switch (Scope)
|
||||
{
|
||||
case Hie_Lvl_SYS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM agd_agendas"
|
||||
" WHERE UsrCod>0");
|
||||
case Hie_Lvl_CTY:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM (SELECT DISTINCT crs_users.UsrCod"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod) AS users,"
|
||||
"agd_agendas"
|
||||
" WHERE users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
case Hie_Lvl_INS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM (SELECT DISTINCT crs_users.UsrCod"
|
||||
" FROM ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users"
|
||||
" WHERE ctr_centers.InsCod=%ld"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod) AS users,"
|
||||
"agd_agendas"
|
||||
" WHERE users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Ins.InsCod);
|
||||
case Hie_Lvl_CTR:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM (SELECT DISTINCT crs_users.UsrCod"
|
||||
" FROM deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users"
|
||||
" WHERE deg_degrees.CtrCod=%ld"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod) AS users,"
|
||||
"agd_agendas"
|
||||
" WHERE users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Ctr.CtrCod);
|
||||
case Hie_Lvl_DEG:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM (SELECT DISTINCT crs_users.UsrCod"
|
||||
" FROM crs_courses,"
|
||||
"crs_users"
|
||||
" WHERE crs_courses.DegCod=%ld"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod) AS users,"
|
||||
"agd_agendas"
|
||||
" WHERE users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Deg.DegCod);
|
||||
case Hie_Lvl_CRS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM crs_users,"
|
||||
"agd_agendas"
|
||||
" WHERE crs_users.CrsCod=%ld"
|
||||
" AND crs_users.UsrCod=agd_agendas.UsrCod",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
default:
|
||||
Err_WrongScopeExit ();
|
||||
return 0; // Not reached
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
// swad_agenda_database.h: user's agenda (personal organizer) operations with database
|
||||
|
||||
#ifndef _SWAD_AGD_DB
|
||||
#define _SWAD_AGD_DB
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance in Spanish),
|
||||
is a web platform developed at the University of Granada (Spain),
|
||||
and used to support university teaching.
|
||||
|
||||
This file is part of SWAD core.
|
||||
Copyright (C) 1999-2021 Antonio Cañas Vargas
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_agenda.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Agd_DB_GetListEvents (MYSQL_RES **mysql_res,
|
||||
const struct Agd_Agenda *Agenda,
|
||||
Agd_AgendaType_t AgendaType);
|
||||
|
||||
unsigned Agd_DB_GetDataOfEventByCod (MYSQL_RES **mysql_res,
|
||||
const struct Agd_Event *AgdEvent);
|
||||
void Agd_DB_GetEventTxt (const struct Agd_Event *AgdEvent,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
|
||||
void Agd_DB_RemoveEvent (const struct Agd_Event *AgdEvent);
|
||||
|
||||
long Agd_DB_CreateEvent (const struct Agd_Event *AgdEvent,const char *Txt);
|
||||
void Agd_DB_UpdateEvent (const struct Agd_Event *AgdEvent,const char *Txt);
|
||||
void Agd_DB_HideEvent (const struct Agd_Event *AgdEvent);
|
||||
void Agd_DB_UnhideEvent (const struct Agd_Event *AgdEvent);
|
||||
void Agd_DB_MakeEventPublic (const struct Agd_Event *AgdEvent);
|
||||
void Agd_DB_MakeEventPrivate (const struct Agd_Event *AgdEvent);
|
||||
|
||||
void Agd_DB_RemoveUsrEvents (long UsrCod);
|
||||
|
||||
unsigned Agd_DB_GetNumEventsFromUsr (long UsrCod);
|
||||
|
||||
unsigned Agd_DB_GetNumUsrsWithEvents (Hie_Lvl_Level_t Scope);
|
||||
|
||||
unsigned Agd_DB_GetNumEvents (Hie_Lvl_Level_t Scope);
|
||||
|
||||
#endif
|
|
@ -600,13 +600,14 @@ TODO: Salvador Romero Cort
|
|||
|
||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.72 (2021-05-10)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.73 (2021-05-10)"
|
||||
#define CSS_FILE "swad20.45.css"
|
||||
#define JS_FILE "swad20.69.1.js"
|
||||
/*
|
||||
TODO: Rename CENTRE to CENTER in help wiki.
|
||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||
|
||||
Version 20.73: May 10, 2021 New module swad_agenda_database for database queries related to agenda. (310474 lines)
|
||||
Version 20.72: May 10, 2021 New module swad_account_database for database queries related to user's account. (310328 lines)
|
||||
Version 20.71: May 10, 2021 New module swad_media_database for database queries related to media. (310080 lines)
|
||||
Version 20.70: May 07, 2021 New module swad_follow_database for database queries related to following/followers. (309943 lines)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <string.h> // For string functions
|
||||
|
||||
#include "swad_action.h"
|
||||
#include "swad_agenda.h"
|
||||
#include "swad_agenda_database.h"
|
||||
#include "swad_box.h"
|
||||
#include "swad_database.h"
|
||||
#include "swad_error.h"
|
||||
|
@ -4968,10 +4968,10 @@ static void Fig_GetAndShowAgendasStats (void)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Number of agenda events *****/
|
||||
NumEvents = Agd_GetNumEvents (Gbl.Scope.Current);
|
||||
NumEvents = Agd_DB_GetNumEvents (Gbl.Scope.Current);
|
||||
|
||||
/***** Number of users with agenda events *****/
|
||||
NumUsrs = Agd_GetNumUsrsWithEvents (Gbl.Scope.Current);
|
||||
NumUsrs = Agd_DB_GetNumUsrsWithEvents (Gbl.Scope.Current);
|
||||
|
||||
/***** Get total number of users in current scope *****/
|
||||
NumUsrsTotal = Usr_GetTotalNumberOfUsers ();
|
||||
|
|
Loading…
Reference in New Issue