swad-core/swad_agenda.c

2052 lines
70 KiB
C
Raw Normal View History

2016-07-07 00:21:10 +02:00
// swad_agenda.c: user's agenda (personal organizer)
/*
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.
2021-02-09 12:43:45 +01:00
Copyright (C) 1999-2021 Antonio Ca<EFBFBD>as Vargas
2016-07-07 00:21:10 +02:00
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/>.
*/
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
/********************************* Headers ***********************************/
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2018-10-18 21:32:06 +02:00
#define _GNU_SOURCE // For asprintf
2016-11-30 22:49:48 +01:00
#include <linux/limits.h> // For PATH_MAX
2019-12-29 12:39:00 +01:00
#include <stddef.h> // For NULL
2018-10-18 21:32:06 +02:00
#include <stdio.h> // For asprintf
2016-11-30 22:49:48 +01:00
#include <stdlib.h> // For calloc
#include <string.h> // For string functions
2016-07-07 00:21:10 +02:00
2016-11-30 22:49:48 +01:00
#include "swad_agenda.h"
2017-06-10 21:38:10 +02:00
#include "swad_box.h"
2016-11-30 22:49:48 +01:00
#include "swad_database.h"
2020-04-28 13:12:18 +02:00
#include "swad_date.h"
#include "swad_error.h"
2018-11-09 20:47:39 +01:00
#include "swad_form.h"
2016-11-30 22:49:48 +01:00
#include "swad_global.h"
#include "swad_group.h"
2019-10-23 19:05:05 +02:00
#include "swad_HTML.h"
2016-11-30 22:49:48 +01:00
#include "swad_notification.h"
#include "swad_pagination.h"
#include "swad_parameter.h"
#include "swad_photo.h"
2016-12-09 14:50:21 +01:00
#include "swad_privacy.h"
2016-12-05 09:50:35 +01:00
#include "swad_QR.h"
2019-03-26 11:53:21 +01:00
#include "swad_setting.h"
2016-11-30 22:49:48 +01:00
#include "swad_string.h"
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
/************** External global variables from others modules ****************/
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
extern struct Globals Gbl;
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
/***************************** Private constants *****************************/
/*****************************************************************************/
2017-03-21 14:36:22 +01:00
static const char *ParamPast__FutureName = "Past__Future";
static const char *ParamPrivatPublicName = "PrivatPublic";
static const char *ParamHiddenVisiblName = "HiddenVisibl";
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
/******************************* Private types *******************************/
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2017-03-21 14:52:07 +01:00
#define Agd_NUM_AGENDA_TYPES 4
2016-12-02 00:24:16 +01:00
typedef enum
{
2017-03-21 14:52:07 +01:00
Agd_MY_AGENDA_TODAY,
Agd_MY_AGENDA,
Agd_ANOTHER_AGENDA_TODAY,
Agd_ANOTHER_AGENDA,
2016-12-02 00:24:16 +01:00
} Agd_AgendaType_t;
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
/***************************** Private variables *****************************/
/*****************************************************************************/
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
/***************************** Private prototypes ****************************/
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_ResetAgenda (struct Agd_Agenda *Agenda);
static void Agd_ShowMyAgenda (struct Agd_Agenda *Agenda);
static void Agd_ShowFormToSelPast__FutureEvents (const struct Agd_Agenda *Agenda);
static void Agd_ShowFormToSelPrivatPublicEvents (const struct Agd_Agenda *Agenda);
static void Agd_ShowFormToSelHiddenVisiblEvents (const struct Agd_Agenda *Agenda);
2017-03-21 14:36:22 +01:00
static void Agd_PutHiddenParamPast__FutureEvents (unsigned Past__FutureEvents);
static void Agd_PutHiddenParamPrivatPublicEvents (unsigned PrivatPublicEvents);
static void Agd_PutHiddenParamHiddenVisiblEvents (unsigned HiddenVisiblEvents);
2020-04-12 14:42:32 +02:00
static unsigned Agd_GetParamsPast__FutureEvents (void);
static unsigned Agd_GetParamsPrivatPublicEvents (void);
static unsigned Agd_GetParamsHiddenVisiblEvents (void);
2017-03-21 00:57:11 +01:00
2020-04-12 14:42:32 +02:00
static void Agd_ShowEvents (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType);
static void Agd_ShowEventsToday (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType);
static void Agd_WriteHeaderListEvents (const struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType);
2016-12-02 00:24:16 +01:00
2020-03-26 02:54:30 +01:00
static void Agd_PutIconsMyFullAgenda (void *Agenda);
static void Agd_PutIconsMyPublicAgenda (void *EncryptedUsrCod);
static void Agd_PutIconToCreateNewEvent (void *Agenda);
static void Agd_PutIconToViewEditMyFullAgenda (void *EncryptedUsrCod);
2016-12-05 03:16:25 +01:00
static void Agd_PutIconToShowQR (void);
2020-03-26 02:54:30 +01:00
static void Agd_PutIconsOtherPublicAgenda (void *EncryptedUsrCod);
2016-12-06 21:08:28 +01:00
2020-04-12 14:42:32 +02:00
static void Agd_PutButtonToCreateNewEvent (const struct Agd_Agenda *Agenda);
static void Agd_ShowOneEvent (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType,long AgdCod);
static void Agd_GetParamEventOrder (struct Agd_Agenda *Agenda);
static void Agd_PutFormsToRemEditOneEvent (struct Agd_Agenda *Agenda,
struct Agd_Event *AgdEvent,
2019-04-20 19:04:05 +02:00
const char *Anchor);
2017-03-21 14:36:22 +01:00
2020-03-26 02:54:30 +01:00
static void Agd_PutCurrentParamsMyAgenda (void *Agenda);
2020-04-12 14:42:32 +02:00
static void Agd_GetParams (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType);
2017-03-21 14:36:22 +01:00
2020-04-12 14:42:32 +02:00
static void Agd_GetListEvents (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType);
2020-04-08 03:06:45 +02:00
static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent);
2020-04-12 14:42:32 +02:00
static void Agd_FreeListEvents (struct Agd_Agenda *Agenda);
2020-04-08 03:06:45 +02:00
static void Agd_GetEventTxtFromDB (struct Agd_Event *AgdEvent,
2017-01-17 03:10:43 +01:00
char Txt[Cns_MAX_BYTES_TEXT + 1]);
2020-04-08 03:06:45 +02:00
static void Agd_CreateEvent (struct Agd_Event *AgdEvent,const char *Txt);
static void Agd_UpdateEvent (struct Agd_Event *AgdEvent,const char *Txt);
2016-12-01 00:53:50 +01:00
2020-04-12 14:42:32 +02:00
/*****************************************************************************/
/*************************** Reset agenda context ****************************/
/*****************************************************************************/
static void Agd_ResetAgenda (struct Agd_Agenda *Agenda)
{
Agenda->LstIsRead = false;
Agenda->Num = 0;
Agenda->LstAgdCods = NULL;
Agenda->Past__FutureEvents = Agd_DEFAULT_PAST___EVENTS |
Agd_DEFAULT_FUTURE_EVENTS;
Agenda->PrivatPublicEvents = Agd_DEFAULT_PRIVAT_EVENTS |
Agd_DEFAULT_PUBLIC_EVENTS;
Agenda->HiddenVisiblEvents = Agd_DEFAULT_HIDDEN_EVENTS |
Agd_DEFAULT_VISIBL_EVENTS;
Agenda->SelectedOrder = Agd_ORDER_DEFAULT;
Agenda->AgdCodToEdit = -1L;
Agenda->CurrentPage = 0;
}
2016-12-01 00:53:50 +01:00
/*****************************************************************************/
2016-12-04 04:22:36 +01:00
/********** Put form to log in and then show another user's agenda ***********/
2016-12-01 00:53:50 +01:00
/*****************************************************************************/
2016-12-04 04:22:36 +01:00
void Agd_PutFormLogInToShowUsrAgenda (void)
2016-12-04 03:50:25 +01:00
{
/***** Form to log in *****/
2016-12-05 13:26:12 +01:00
Usr_WriteFormLogin (ActLogInUsrAgd,Agd_PutParamAgd);
}
void Agd_PutParamAgd (void)
{
char Nickname[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
2016-12-05 13:26:12 +01:00
snprintf (Nickname,sizeof (Nickname),"@%s",Gbl.Usrs.Other.UsrDat.Nickname);
2019-11-03 13:19:32 +01:00
Par_PutHiddenParamString (NULL,"agd",Nickname);
2016-12-04 04:22:36 +01:00
}
/*****************************************************************************/
2016-12-06 21:26:02 +01:00
/******************************* Show my agenda ******************************/
2016-12-04 04:22:36 +01:00
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
void Agd_GetParamsAndShowMyAgenda (void)
2016-12-04 04:22:36 +01:00
{
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
2016-12-06 21:26:02 +01:00
2017-03-21 14:36:22 +01:00
/***** Get parameters *****/
2020-04-12 14:42:32 +02:00
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
/***** Show my agenda *****/
Agd_ShowMyAgenda (&Agenda);
}
static void Agd_ShowMyAgenda (struct Agd_Agenda *Agenda)
{
extern const char *Hlp_PROFILE_Agenda;
extern const char *Txt_My_agenda;
2017-03-21 14:36:22 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box *****/
2020-03-26 02:54:30 +01:00
Box_BoxBegin ("100%",Txt_My_agenda,
2020-04-12 14:42:32 +02:00
Agd_PutIconsMyFullAgenda,Agenda,
2017-06-12 15:03:29 +02:00
Hlp_PROFILE_Agenda,Box_NOT_CLOSABLE);
2016-12-06 21:26:02 +01:00
2017-03-21 00:57:11 +01:00
/***** Put forms to choice which events to show *****/
Set_BeginSettingsHead ();
2020-04-12 14:42:32 +02:00
Agd_ShowFormToSelPast__FutureEvents (Agenda);
Agd_ShowFormToSelPrivatPublicEvents (Agenda);
Agd_ShowFormToSelHiddenVisiblEvents (Agenda);
2019-03-26 11:53:21 +01:00
Set_EndSettingsHead ();
2017-03-21 00:57:11 +01:00
2016-12-06 21:26:02 +01:00
/***** Show the current events in the user's agenda *****/
2020-04-12 14:42:32 +02:00
Agd_ShowEventsToday (Agenda,Agd_MY_AGENDA_TODAY);
2016-12-06 21:26:02 +01:00
/***** Show all my events *****/
2020-04-12 14:42:32 +02:00
Agd_ShowEvents (Agenda,Agd_MY_AGENDA);
2016-12-06 21:26:02 +01:00
2017-06-12 14:16:33 +02:00
/***** End box *****/
2019-10-25 22:48:34 +02:00
Box_BoxEnd ();
2016-12-06 21:26:02 +01:00
}
2017-03-21 00:57:11 +01:00
/*****************************************************************************/
/*************** Show form to select past / future events ********************/
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_ShowFormToSelPast__FutureEvents (const struct Agd_Agenda *Agenda)
2017-03-21 00:57:11 +01:00
{
2017-03-21 14:36:22 +01:00
extern const char *Txt_AGENDA_PAST___FUTURE_EVENTS[2];
Agd_Past__FutureEvents_t PstFut;
2019-02-21 21:12:04 +01:00
static const char *Icon[2] =
2017-03-21 00:57:11 +01:00
{
2019-11-20 17:53:51 +01:00
[Agd_PAST___EVENTS] = "calendar-minus.svg",
[Agd_FUTURE_EVENTS] = "calendar-plus.svg",
2017-03-21 00:57:11 +01:00
};
Set_BeginOneSettingSelector ();
2017-03-21 14:36:22 +01:00
for (PstFut = Agd_PAST___EVENTS;
2017-03-21 00:57:11 +01:00
PstFut <= Agd_FUTURE_EVENTS;
PstFut++)
{
2019-10-23 21:37:01 +02:00
HTM_DIV_Begin ("class=\"%s\"",
2020-04-12 14:42:32 +02:00
(Agenda->Past__FutureEvents & (1 << PstFut)) ? "PREF_ON" :
"PREF_OFF");
Frm_BeginForm (ActSeeMyAgd);
2020-04-12 14:42:32 +02:00
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents ^ (1 << PstFut), // Toggle
Agenda->PrivatPublicEvents,
Agenda->HiddenVisiblEvents,
Agenda->SelectedOrder,
Agenda->CurrentPage,
2017-04-13 20:09:22 +02:00
-1L);
2019-03-26 11:53:21 +01:00
Ico_PutSettingIconLink (Icon[PstFut],
2019-11-18 09:20:44 +01:00
Txt_AGENDA_PAST___FUTURE_EVENTS[PstFut]);
2018-11-09 20:47:39 +01:00
Frm_EndForm ();
2019-10-23 20:07:56 +02:00
HTM_DIV_End ();
2017-03-21 00:57:11 +01:00
}
2019-03-26 11:53:21 +01:00
Set_EndOneSettingSelector ();
2017-03-21 00:57:11 +01:00
}
/*****************************************************************************/
/************** Show form to select private / public events ******************/
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_ShowFormToSelPrivatPublicEvents (const struct Agd_Agenda *Agenda)
2017-03-21 00:57:11 +01:00
{
2017-03-21 14:36:22 +01:00
extern const char *Txt_AGENDA_PRIVAT_PUBLIC_EVENTS[2];
Agd_PrivatPublicEvents_t PrvPub;
2019-02-21 21:12:04 +01:00
static const char *Icon[2] =
2017-03-21 00:57:11 +01:00
{
2019-11-20 17:53:51 +01:00
[Agd_PRIVAT_EVENTS] = "lock.svg",
[Agd_PUBLIC_EVENTS] = "unlock.svg",
2017-03-21 00:57:11 +01:00
};
Set_BeginOneSettingSelector ();
2017-03-21 14:36:22 +01:00
for (PrvPub = Agd_PRIVAT_EVENTS;
PrvPub <= Agd_PUBLIC_EVENTS;
2017-03-21 00:57:11 +01:00
PrvPub++)
{
2019-10-23 21:37:01 +02:00
HTM_DIV_Begin ("class=\"%s\"",
2020-04-12 14:42:32 +02:00
(Agenda->PrivatPublicEvents & (1 << PrvPub)) ? "PREF_ON" :
"PREF_OFF");
Frm_BeginForm (ActSeeMyAgd);
2020-04-12 14:42:32 +02:00
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents,
Agenda->PrivatPublicEvents ^ (1 << PrvPub), // Toggle
Agenda->HiddenVisiblEvents,
Agenda->SelectedOrder,
Agenda->CurrentPage,
2017-04-13 20:09:22 +02:00
-1L);
2019-03-26 11:53:21 +01:00
Ico_PutSettingIconLink (Icon[PrvPub],
2019-11-18 09:20:44 +01:00
Txt_AGENDA_PRIVAT_PUBLIC_EVENTS[PrvPub]);
2018-11-09 20:47:39 +01:00
Frm_EndForm ();
2019-10-23 20:07:56 +02:00
HTM_DIV_End ();
2017-03-21 00:57:11 +01:00
}
2019-03-26 11:53:21 +01:00
Set_EndOneSettingSelector ();
2017-03-21 00:57:11 +01:00
}
/*****************************************************************************/
/************* Show form to select hidden / visible events *******************/
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_ShowFormToSelHiddenVisiblEvents (const struct Agd_Agenda *Agenda)
2017-03-21 00:57:11 +01:00
{
2017-03-21 14:36:22 +01:00
extern const char *Txt_AGENDA_HIDDEN_VISIBL_EVENTS[2];
Agd_HiddenVisiblEvents_t HidVis;
2019-02-21 21:12:04 +01:00
static const char *Icon[2] =
2017-03-21 00:57:11 +01:00
{
2020-02-19 00:45:26 +01:00
[Agd_HIDDEN_EVENTS] = "eye-slash-red.svg",
[Agd_VISIBL_EVENTS] = "eye-green.svg",
2017-03-21 00:57:11 +01:00
};
Set_BeginOneSettingSelector ();
2017-03-21 14:36:22 +01:00
for (HidVis = Agd_HIDDEN_EVENTS;
HidVis <= Agd_VISIBL_EVENTS;
2017-03-21 00:57:11 +01:00
HidVis++)
{
2019-10-23 21:37:01 +02:00
HTM_DIV_Begin ("class=\"%s\"",
2020-04-12 14:42:32 +02:00
(Agenda->HiddenVisiblEvents & (1 << HidVis)) ? "PREF_ON" :
"PREF_OFF");
Frm_BeginForm (ActSeeMyAgd);
2020-04-12 14:42:32 +02:00
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents,
Agenda->PrivatPublicEvents,
Agenda->HiddenVisiblEvents ^ (1 << HidVis), // Toggle
Agenda->SelectedOrder,
Agenda->CurrentPage,
2017-04-13 20:09:22 +02:00
-1L);
2019-03-26 11:53:21 +01:00
Ico_PutSettingIconLink (Icon[HidVis],
2019-11-18 09:20:44 +01:00
Txt_AGENDA_HIDDEN_VISIBL_EVENTS[HidVis]);
2018-11-09 20:47:39 +01:00
Frm_EndForm ();
2019-10-23 20:07:56 +02:00
HTM_DIV_End ();
2017-03-21 00:57:11 +01:00
}
2019-03-26 11:53:21 +01:00
Set_EndOneSettingSelector ();
2017-03-21 00:57:11 +01:00
}
/*****************************************************************************/
2017-03-21 14:36:22 +01:00
/************************ Put hidden params for events ***********************/
2017-03-21 00:57:11 +01:00
/*****************************************************************************/
2017-03-21 14:36:22 +01:00
static void Agd_PutHiddenParamPast__FutureEvents (unsigned Past__FutureEvents)
2017-03-21 00:57:11 +01:00
{
2019-11-03 13:19:32 +01:00
Par_PutHiddenParamUnsigned (NULL,ParamPast__FutureName,Past__FutureEvents);
2017-03-21 00:57:11 +01:00
}
2017-03-21 14:36:22 +01:00
static void Agd_PutHiddenParamPrivatPublicEvents (unsigned PrivatPublicEvents)
2017-03-21 00:57:11 +01:00
{
2019-11-03 13:19:32 +01:00
Par_PutHiddenParamUnsigned (NULL,ParamPrivatPublicName,PrivatPublicEvents);
2017-03-21 14:36:22 +01:00
}
2017-03-21 00:57:11 +01:00
2017-03-21 14:36:22 +01:00
static void Agd_PutHiddenParamHiddenVisiblEvents (unsigned HiddenVisiblEvents)
{
2019-11-03 13:19:32 +01:00
Par_PutHiddenParamUnsigned (NULL,ParamHiddenVisiblName,HiddenVisiblEvents);
2017-03-21 00:57:11 +01:00
}
/*****************************************************************************/
2017-03-21 14:36:22 +01:00
/************************ Get hidden params for events ***********************/
2017-03-21 00:57:11 +01:00
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static unsigned Agd_GetParamsPast__FutureEvents (void)
2017-03-21 00:57:11 +01:00
{
2020-04-12 14:42:32 +02:00
return (unsigned) Par_GetParToUnsignedLong (ParamPast__FutureName,
0,
(1 << Agd_PAST___EVENTS) |
(1 << Agd_FUTURE_EVENTS),
Agd_DEFAULT_PAST___EVENTS |
Agd_DEFAULT_FUTURE_EVENTS);
2017-03-21 14:36:22 +01:00
}
2017-03-21 00:57:11 +01:00
2020-04-12 14:42:32 +02:00
static unsigned Agd_GetParamsPrivatPublicEvents (void)
2017-03-21 14:36:22 +01:00
{
2020-04-12 14:42:32 +02:00
return (unsigned) Par_GetParToUnsignedLong (ParamPrivatPublicName,
0,
(1 << Agd_PRIVAT_EVENTS) |
(1 << Agd_PUBLIC_EVENTS),
Agd_DEFAULT_PRIVAT_EVENTS |
Agd_DEFAULT_PUBLIC_EVENTS);
2017-03-21 14:36:22 +01:00
}
2020-04-12 14:42:32 +02:00
static unsigned Agd_GetParamsHiddenVisiblEvents (void)
2017-03-21 14:36:22 +01:00
{
2020-04-12 14:42:32 +02:00
return (unsigned) Par_GetParToUnsignedLong (ParamHiddenVisiblName,
0,
(1 << Agd_HIDDEN_EVENTS) |
(1 << Agd_VISIBL_EVENTS),
Agd_DEFAULT_HIDDEN_EVENTS |
Agd_DEFAULT_VISIBL_EVENTS);
2017-03-21 00:57:11 +01:00
}
2016-12-04 03:50:25 +01:00
/*****************************************************************************/
/************************ Show another user's agenda *************************/
/*****************************************************************************/
2016-12-02 00:24:16 +01:00
void Agd_ShowUsrAgenda (void)
2016-11-30 22:49:48 +01:00
{
2016-12-07 10:16:39 +01:00
extern const char *Hlp_PROFILE_Agenda_public_agenda;
2016-12-06 03:10:06 +01:00
extern const char *Txt_Public_agenda_USER;
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2016-12-06 03:10:06 +01:00
bool ItsMe;
2016-12-09 13:59:33 +01:00
bool Error = true;
2016-11-30 22:49:48 +01:00
2016-12-02 00:24:16 +01:00
/***** Get user *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
2016-12-09 13:59:33 +01:00
if (Usr_CheckIfICanViewUsrAgenda (&Gbl.Usrs.Other.UsrDat))
{
Error = false;
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
2019-10-26 02:19:42 +02:00
/***** Begin box *****/
2018-10-10 23:56:42 +02:00
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
2020-03-26 02:54:30 +01:00
if (ItsMe)
Box_BoxBegin ("100%",Str_BuildStringStr (Txt_Public_agenda_USER,
Gbl.Usrs.Me.UsrDat.FullName),
Agd_PutIconsMyPublicAgenda,Gbl.Usrs.Me.UsrDat.EnUsrCod,
2020-03-26 02:54:30 +01:00
Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE);
else
Box_BoxBegin ("100%",Str_BuildStringStr (Txt_Public_agenda_USER,
Gbl.Usrs.Other.UsrDat.FullName),
Agd_PutIconsOtherPublicAgenda,Gbl.Usrs.Other.UsrDat.EnUsrCod,
2020-03-26 02:54:30 +01:00
Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE);
2019-12-30 21:47:07 +01:00
Str_FreeString ();
2016-12-09 13:59:33 +01:00
/***** Show the current events in the user's agenda *****/
2020-04-12 14:42:32 +02:00
Agd_ShowEventsToday (&Agenda,Agd_ANOTHER_AGENDA_TODAY);
2016-12-09 13:59:33 +01:00
/***** Show all the visible events in the user's agenda *****/
2020-04-12 14:42:32 +02:00
Agd_ShowEvents (&Agenda,Agd_ANOTHER_AGENDA);
2016-12-09 13:59:33 +01:00
2017-06-12 14:16:33 +02:00
/***** End box *****/
2019-10-25 22:48:34 +02:00
Box_BoxEnd ();
2016-12-09 13:59:33 +01:00
}
if (Error)
2019-03-09 20:12:44 +01:00
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
2016-11-30 22:49:48 +01:00
}
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-12-06 21:26:02 +01:00
/***************** Show another user's agenda after log in *******************/
2016-12-06 21:08:28 +01:00
/*****************************************************************************/
2016-12-06 21:26:02 +01:00
void Agd_ShowOtherAgendaAfterLogIn (void)
2016-12-06 21:08:28 +01:00
{
2016-12-07 10:16:39 +01:00
extern const char *Hlp_PROFILE_Agenda_public_agenda;
2018-12-09 10:46:57 +01:00
extern const unsigned Txt_Current_CGI_SWAD_Language;
2016-12-06 21:08:28 +01:00
extern const char *Txt_Public_agenda_USER;
2018-12-08 16:43:13 +01:00
extern const char *Txt_Switching_to_LANGUAGE[1 + Lan_NUM_LANGUAGES];
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2016-12-06 21:26:02 +01:00
bool ItsMe;
2016-12-06 21:08:28 +01:00
2016-12-06 21:26:02 +01:00
if (Gbl.Usrs.Me.Logged)
{
2018-12-09 10:46:57 +01:00
if (Gbl.Usrs.Me.UsrDat.Prefs.Language == Txt_Current_CGI_SWAD_Language)
2016-12-06 21:26:02 +01:00
{
/***** Get user *****/
/* If nickname is correct, user code is already got from nickname */
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Existing user
Usr_DONT_GET_PREFS,
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
2016-12-06 21:26:02 +01:00
{
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
2019-10-26 02:19:42 +02:00
/***** Begin box *****/
2018-10-10 23:56:42 +02:00
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
2020-03-26 02:54:30 +01:00
if (ItsMe)
Box_BoxBegin ("100%",Str_BuildStringStr (Txt_Public_agenda_USER,
Gbl.Usrs.Me.UsrDat.FullName),
Agd_PutIconToViewEditMyFullAgenda,Gbl.Usrs.Me.UsrDat.EnUsrCod,
2020-03-26 02:54:30 +01:00
Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE);
else
Box_BoxBegin ("100%",Str_BuildStringStr (Txt_Public_agenda_USER,
Gbl.Usrs.Other.UsrDat.FullName),
Agd_PutIconsOtherPublicAgenda,Gbl.Usrs.Other.UsrDat.EnUsrCod,
2020-03-26 02:54:30 +01:00
Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE);
2019-12-30 21:47:07 +01:00
Str_FreeString ();
2016-12-06 03:10:06 +01:00
2016-12-06 21:26:02 +01:00
/***** Show the current events in the user's agenda *****/
2020-04-12 14:42:32 +02:00
Agd_ShowEventsToday (&Agenda,Agd_ANOTHER_AGENDA_TODAY);
2016-12-06 03:10:06 +01:00
2016-12-06 21:26:02 +01:00
/***** Show all the visible events in the user's agenda *****/
2020-04-12 14:42:32 +02:00
Agd_ShowEvents (&Agenda,Agd_ANOTHER_AGENDA);
2016-12-06 03:10:06 +01:00
2017-06-12 14:16:33 +02:00
/***** End box *****/
2019-10-25 22:48:34 +02:00
Box_BoxEnd ();
2016-12-06 21:26:02 +01:00
}
else
2019-03-09 20:12:44 +01:00
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
2016-12-06 21:26:02 +01:00
}
else
/* The current language is not my preferred language
==> change automatically to my language */
2019-02-16 14:37:34 +01:00
Ale_ShowAlert (Ale_INFO,Txt_Switching_to_LANGUAGE[Gbl.Usrs.Me.UsrDat.Prefs.Language]);
2016-12-06 21:26:02 +01:00
}
2016-12-02 00:24:16 +01:00
}
/*****************************************************************************/
/*************************** Show events in agenda ***************************/
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_ShowEvents (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
extern const char *Hlp_PROFILE_Agenda;
2016-12-03 23:48:03 +01:00
extern const char *Txt_Public_agenda_USER;
2016-12-02 00:24:16 +01:00
extern const char *Txt_My_agenda;
2016-12-01 00:53:50 +01:00
extern const char *Txt_No_events;
2016-11-30 22:49:48 +01:00
struct Pagination Pagination;
2016-12-02 00:24:16 +01:00
unsigned NumEvent;
2019-11-21 11:39:30 +01:00
static const Pag_WhatPaginate_t WhatPaginate[Agd_NUM_AGENDA_TYPES] =
2016-12-02 00:24:16 +01:00
{
2019-11-20 17:53:51 +01:00
[Agd_MY_AGENDA_TODAY ] = Pag_MY_AGENDA, // not used
[Agd_MY_AGENDA ] = Pag_MY_AGENDA,
[Agd_ANOTHER_AGENDA_TODAY] = Pag_ANOTHER_AGENDA, // not used
[Agd_ANOTHER_AGENDA ] = Pag_ANOTHER_AGENDA,
2016-12-02 00:24:16 +01:00
};
/***** Get parameters *****/
2020-04-12 14:42:32 +02:00
Agd_GetParams (Agenda,AgendaType);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get list of events *****/
2020-04-12 14:42:32 +02:00
Agd_GetListEvents (Agenda,AgendaType);
2016-11-30 22:49:48 +01:00
/***** Compute variables related to pagination *****/
2020-04-12 14:42:32 +02:00
Pagination.NumItems = Agenda->Num;
Pagination.CurrentPage = (int) Agenda->CurrentPage;
2016-11-30 22:49:48 +01:00
Pag_CalculatePagination (&Pagination);
2020-04-12 14:42:32 +02:00
Agenda->CurrentPage = (unsigned) Pagination.CurrentPage;
2016-11-30 22:49:48 +01:00
/***** Write links to pages *****/
2020-04-10 19:14:08 +02:00
Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType],&Pagination,
2020-04-12 14:42:32 +02:00
Agenda,-1L);
2016-11-30 22:49:48 +01:00
2020-04-12 14:42:32 +02:00
if (Agenda->Num)
2016-11-30 22:49:48 +01:00
{
2019-10-20 22:00:28 +02:00
/***** Begin table *****/
2019-10-23 19:05:05 +02:00
HTM_TABLE_BeginWideMarginPadding (2);
2016-12-06 03:10:06 +01:00
2016-11-30 22:49:48 +01:00
/***** Table head *****/
2020-04-12 14:42:32 +02:00
Agd_WriteHeaderListEvents (Agenda,AgendaType);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Write all the events *****/
2016-12-02 00:24:16 +01:00
for (NumEvent = Pagination.FirstItemVisible;
NumEvent <= Pagination.LastItemVisible;
NumEvent++)
2020-04-12 14:42:32 +02:00
Agd_ShowOneEvent (Agenda,AgendaType,Agenda->LstAgdCods[NumEvent - 1]);
2016-11-30 22:49:48 +01:00
/***** End table *****/
2019-10-23 19:05:05 +02:00
HTM_TABLE_End ();
2016-11-30 22:49:48 +01:00
}
2016-12-06 03:10:06 +01:00
else
2019-02-16 14:37:34 +01:00
Ale_ShowAlert (Ale_INFO,Txt_No_events);
2016-11-30 22:49:48 +01:00
2016-12-06 03:10:06 +01:00
/***** Write again links to pages *****/
2020-04-10 19:14:08 +02:00
Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType],&Pagination,
2020-04-12 14:42:32 +02:00
Agenda,-1L);
2016-12-06 03:10:06 +01:00
2016-12-01 00:53:50 +01:00
/***** Button to create a new event *****/
2017-03-21 14:52:07 +01:00
if (AgendaType == Agd_MY_AGENDA)
2020-04-12 14:42:32 +02:00
Agd_PutButtonToCreateNewEvent (Agenda);
2016-11-30 22:49:48 +01:00
2016-12-06 03:10:06 +01:00
/***** Free list of events *****/
2020-04-12 14:42:32 +02:00
Agd_FreeListEvents (Agenda);
2016-12-06 03:10:06 +01:00
}
2016-11-30 22:49:48 +01:00
2016-12-06 03:10:06 +01:00
/*****************************************************************************/
2016-12-06 21:08:28 +01:00
/************************ Show today events in agenda ************************/
2016-12-06 03:10:06 +01:00
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_ShowEventsToday (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType)
2016-12-06 03:10:06 +01:00
{
extern const char *Hlp_PROFILE_Agenda;
2016-12-07 10:16:39 +01:00
extern const char *Hlp_PROFILE_Agenda_public_agenda;
2016-12-06 18:04:12 +01:00
extern const char *Txt_Today;
2016-12-06 03:10:06 +01:00
extern const char *Txt_Public_agenda_USER;
extern const char *Txt_My_agenda;
extern const char *Txt_No_events;
unsigned NumEvent;
/***** Get parameters *****/
2020-04-12 14:42:32 +02:00
Agd_GetParams (Agenda,AgendaType);
2016-12-06 03:10:06 +01:00
/***** Get list of events *****/
2020-04-12 14:42:32 +02:00
Agd_GetListEvents (Agenda,AgendaType);
2016-12-06 03:10:06 +01:00
2020-04-12 14:42:32 +02:00
if (Agenda->Num)
2016-12-06 03:10:06 +01:00
{
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2016-12-06 19:14:58 +01:00
switch (AgendaType)
{
2017-03-21 14:52:07 +01:00
case Agd_MY_AGENDA_TODAY:
2020-03-26 02:54:30 +01:00
Box_BoxTableShadowBegin (NULL,Txt_Today,
NULL,NULL,
2017-06-11 22:26:40 +02:00
Hlp_PROFILE_Agenda,
2);
2016-12-06 19:14:58 +01:00
break;
2017-03-21 14:52:07 +01:00
case Agd_ANOTHER_AGENDA_TODAY:
2020-03-26 02:54:30 +01:00
Box_BoxTableShadowBegin (NULL,Txt_Today,
NULL,NULL,
2017-06-11 22:26:40 +02:00
Hlp_PROFILE_Agenda_public_agenda,
2);
2016-12-06 21:26:02 +01:00
break;
2016-12-06 21:08:28 +01:00
default:
2016-12-06 19:14:58 +01:00
break;
}
2016-12-06 03:10:06 +01:00
/***** Table head *****/
2020-04-12 14:42:32 +02:00
Agd_WriteHeaderListEvents (Agenda,AgendaType);
2016-12-06 03:10:06 +01:00
/***** Write all the events *****/
for (NumEvent = 0;
2020-04-12 14:42:32 +02:00
NumEvent < Agenda->Num;
2016-12-06 03:10:06 +01:00
NumEvent++)
2020-04-12 14:42:32 +02:00
Agd_ShowOneEvent (Agenda,AgendaType,Agenda->LstAgdCods[NumEvent]);
2016-12-06 03:10:06 +01:00
2017-06-12 14:16:33 +02:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2016-12-06 03:10:06 +01:00
}
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Free list of events *****/
2020-04-12 14:42:32 +02:00
Agd_FreeListEvents (Agenda);
2016-11-30 22:49:48 +01:00
}
2016-12-05 23:13:58 +01:00
/*****************************************************************************/
/*************** Put contextual icon to view/edit my agenda ******************/
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_WriteHeaderListEvents (const struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType)
2016-12-06 03:10:06 +01:00
{
2016-12-15 00:39:52 +01:00
extern const char *Txt_START_END_TIME_HELP[2];
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
2016-12-06 03:10:06 +01:00
extern const char *Txt_Event;
extern const char *Txt_Location;
2020-04-05 22:53:58 +02:00
Dat_StartEndTime_t Order;
2016-12-06 03:10:06 +01:00
/***** Table head *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-11 01:02:51 +02:00
2020-04-05 22:53:58 +02:00
for (Order = Dat_START_TIME;
Order <= Dat_END_TIME;
2016-12-06 03:10:06 +01:00
Order++)
{
2019-10-23 19:05:05 +02:00
HTM_TH_Begin (1,1,"LM");
2016-12-06 03:10:06 +01:00
switch (AgendaType)
{
2017-03-21 14:52:07 +01:00
case Agd_MY_AGENDA_TODAY:
case Agd_MY_AGENDA:
Frm_BeginForm (ActSeeMyAgd);
2020-04-12 14:42:32 +02:00
Pag_PutHiddenParamPagNum (Pag_MY_AGENDA,Agenda->CurrentPage);
2016-12-06 03:10:06 +01:00
break;
2017-03-21 14:52:07 +01:00
case Agd_ANOTHER_AGENDA_TODAY:
case Agd_ANOTHER_AGENDA:
Frm_BeginForm (ActSeeUsrAgd);
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
2020-04-12 14:42:32 +02:00
Pag_PutHiddenParamPagNum (Pag_ANOTHER_AGENDA,Agenda->CurrentPage);
2016-12-06 21:26:02 +01:00
break;
2016-12-06 03:10:06 +01:00
}
2020-04-12 14:42:32 +02:00
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents,
Agenda->PrivatPublicEvents,
Agenda->HiddenVisiblEvents,
2019-11-18 09:20:44 +01:00
Order,
2020-04-12 14:42:32 +02:00
Agenda->CurrentPage,
2019-11-18 09:20:44 +01:00
-1L);
2019-10-27 09:28:51 +01:00
2019-11-20 10:17:42 +01:00
HTM_BUTTON_SUBMIT_Begin (Txt_START_END_TIME_HELP[Order],"BT_LINK TIT_TBL",NULL);
2020-04-12 14:42:32 +02:00
if (Order == Agenda->SelectedOrder)
2019-11-10 16:41:47 +01:00
HTM_U_Begin ();
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_START_END_TIME[Order]);
2020-04-12 14:42:32 +02:00
if (Order == Agenda->SelectedOrder)
2019-11-10 16:41:47 +01:00
HTM_U_End ();
2019-11-18 09:20:44 +01:00
HTM_BUTTON_End ();
2019-10-27 09:28:51 +01:00
2018-11-09 20:47:39 +01:00
Frm_EndForm ();
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
2016-12-06 03:10:06 +01:00
}
2019-10-11 01:02:51 +02:00
2019-10-23 19:05:05 +02:00
HTM_TH (1,1,"LM",Txt_Event);
HTM_TH (1,1,"LM",Txt_Location);
2019-10-11 01:02:51 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2016-12-06 03:10:06 +01:00
}
/*****************************************************************************/
2016-12-06 21:08:28 +01:00
/********************** Put contextual icons in agenda ***********************/
2016-12-06 03:10:06 +01:00
/*****************************************************************************/
2020-03-26 02:54:30 +01:00
static void Agd_PutIconsMyFullAgenda (void *Agenda)
2016-12-05 23:13:58 +01:00
{
2016-12-06 21:08:28 +01:00
/***** Put icon to create a new event *****/
2020-03-26 02:54:30 +01:00
Agd_PutIconToCreateNewEvent (Agenda);
2016-12-05 23:13:58 +01:00
2016-12-06 21:08:28 +01:00
/***** Put icon to show QR code *****/
Agd_PutIconToShowQR ();
}
2016-12-05 03:16:25 +01:00
2020-03-26 02:54:30 +01:00
static void Agd_PutIconsMyPublicAgenda (void *EncryptedUsrCod)
2016-12-05 03:16:25 +01:00
{
2016-12-06 21:08:28 +01:00
/***** Put icon to view/edit my full agenda *****/
2020-03-26 02:54:30 +01:00
Agd_PutIconToViewEditMyFullAgenda (EncryptedUsrCod);
2016-12-05 03:16:25 +01:00
/***** Put icon to show QR code *****/
Agd_PutIconToShowQR ();
}
2020-03-26 02:54:30 +01:00
static void Agd_PutIconToCreateNewEvent (void *Agenda)
2016-11-30 22:49:48 +01:00
{
extern const char *Txt_New_event;
2016-12-01 00:53:50 +01:00
/***** Put form to create a new event *****/
2020-04-12 14:42:32 +02:00
((struct Agd_Agenda *) Agenda)->AgdCodToEdit = -1L;
2019-01-10 15:26:33 +01:00
Ico_PutContextualIconToAdd (ActFrmNewEvtMyAgd,NULL,
2020-04-12 14:42:32 +02:00
Agd_PutCurrentParamsMyAgenda,Agenda,
2019-01-10 15:26:33 +01:00
Txt_New_event);
2016-11-30 22:49:48 +01:00
}
2020-03-26 02:54:30 +01:00
static void Agd_PutIconToViewEditMyFullAgenda (void *EncryptedUsrCod)
2016-12-06 21:08:28 +01:00
{
2020-03-26 02:54:30 +01:00
Ico_PutContextualIconToEdit (ActSeeMyAgd,NULL,
NULL,EncryptedUsrCod);
2016-12-06 21:08:28 +01:00
}
2016-12-05 03:16:25 +01:00
static void Agd_PutIconToShowQR (void)
{
2017-03-07 01:56:41 +01:00
char URL[Cns_MAX_BYTES_WWW + 1];
2018-12-08 16:43:13 +01:00
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
2016-12-05 09:50:35 +01:00
snprintf (URL,sizeof (URL),"%s/%s?agd=@%s",
Cfg_URL_SWAD_CGI,Lan_STR_LANG_ID[Gbl.Prefs.Language],
2018-10-17 01:08:42 +02:00
Gbl.Usrs.Me.UsrDat.Nickname);
2020-03-26 02:54:30 +01:00
QR_PutLinkToPrintQRCode (ActPrnAgdQR,
2020-03-27 14:56:54 +01:00
QR_PutParamQRString,URL);
2016-12-05 03:16:25 +01:00
}
2020-03-26 02:54:30 +01:00
static void Agd_PutIconsOtherPublicAgenda (void *EncryptedUsrCod)
2016-12-09 14:50:21 +01:00
{
2017-02-17 01:59:58 +01:00
extern const char *Txt_Another_user_s_profile;
2016-12-09 14:50:21 +01:00
extern const char *Txt_View_record_for_this_course;
extern const char *Txt_View_record_and_office_hours;
/***** Button to view user's public profile *****/
2019-03-22 15:21:46 +01:00
if (Pri_ShowingIsAllowed (Gbl.Usrs.Other.UsrDat.BaPrfVisibility,
2017-02-17 01:59:58 +01:00
&Gbl.Usrs.Other.UsrDat))
2019-01-12 03:00:59 +01:00
Lay_PutContextualLinkOnlyIcon (ActSeeOthPubPrf,NULL,
2020-03-26 02:54:30 +01:00
Usr_PutParamOtherUsrCodEncrypted,EncryptedUsrCod,
2019-01-12 03:00:59 +01:00
"user.svg",
Txt_Another_user_s_profile);
2016-12-09 14:50:21 +01:00
/***** Button to view user's record card *****/
if (Usr_CheckIfICanViewRecordStd (&Gbl.Usrs.Other.UsrDat))
/* View student's records: common record card and course record card */
2019-01-12 03:00:59 +01:00
Lay_PutContextualLinkOnlyIcon (ActSeeRecOneStd,NULL,
2020-03-26 02:54:30 +01:00
Usr_PutParamOtherUsrCodEncrypted,EncryptedUsrCod,
2020-04-16 02:39:26 +02:00
"address-card.svg",
2019-01-12 03:00:59 +01:00
Txt_View_record_for_this_course);
2016-12-09 14:50:21 +01:00
else if (Usr_CheckIfICanViewRecordTch (&Gbl.Usrs.Other.UsrDat))
2019-01-12 03:00:59 +01:00
Lay_PutContextualLinkOnlyIcon (ActSeeRecOneTch,NULL,
2020-03-26 02:54:30 +01:00
Usr_PutParamOtherUsrCodEncrypted,EncryptedUsrCod,
2020-04-16 02:39:26 +02:00
"address-card.svg",
2019-01-12 03:00:59 +01:00
Txt_View_record_and_office_hours);
2016-12-09 14:50:21 +01:00
}
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/********************* Put button to create a new event **********************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_PutButtonToCreateNewEvent (const struct Agd_Agenda *Agenda)
2016-11-30 22:49:48 +01:00
{
extern const char *Txt_New_event;
Frm_BeginForm (ActFrmNewEvtMyAgd);
2020-04-12 14:42:32 +02:00
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents,
Agenda->PrivatPublicEvents,
Agenda->HiddenVisiblEvents,
Agenda->SelectedOrder,
Agenda->CurrentPage,
2017-04-13 20:09:22 +02:00
-1L);
2017-06-11 19:02:40 +02:00
Btn_PutConfirmButton (Txt_New_event);
2018-11-09 20:47:39 +01:00
Frm_EndForm ();
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/******************************* Show one event ******************************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_ShowOneEvent (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType,long AgdCod)
2016-11-30 22:49:48 +01:00
{
2016-12-02 10:45:53 +01:00
extern const char *Dat_TimeStatusClassVisible[Dat_NUM_TIME_STATUS];
extern const char *Dat_TimeStatusClassHidden[Dat_NUM_TIME_STATUS];
2019-04-20 19:04:05 +02:00
char *Anchor = NULL;
2016-11-30 22:49:48 +01:00
static unsigned UniqueId = 0;
2019-11-01 22:53:39 +01:00
char *Id;
2020-04-08 03:06:45 +02:00
struct Agd_Event AgdEvent;
2019-09-27 00:30:05 +02:00
Dat_StartEndTime_t StartEndTime;
2017-01-28 15:58:46 +01:00
char Txt[Cns_MAX_BYTES_TEXT + 1];
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get data of this event *****/
AgdEvent.AgdCod = AgdCod;
2016-12-02 00:24:16 +01:00
switch (AgendaType)
{
2017-03-21 14:52:07 +01:00
case Agd_MY_AGENDA_TODAY:
case Agd_MY_AGENDA:
2016-12-02 00:24:16 +01:00
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
break;
2017-03-21 14:52:07 +01:00
case Agd_ANOTHER_AGENDA_TODAY:
case Agd_ANOTHER_AGENDA:
2016-12-06 21:26:02 +01:00
AgdEvent.UsrCod = Gbl.Usrs.Other.UsrDat.UsrCod;
break;
2016-12-02 00:24:16 +01:00
}
2016-12-01 00:53:50 +01:00
Agd_GetDataOfEventByCod (&AgdEvent);
2016-11-30 22:49:48 +01:00
2019-04-20 19:04:05 +02:00
/***** Set anchor string *****/
2019-04-20 21:11:44 +02:00
Frm_SetAnchorStr (AgdEvent.AgdCod,&Anchor);
2019-04-20 19:04:05 +02:00
2016-12-01 00:53:50 +01:00
/***** Write first row of data of this event *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2016-11-30 22:49:48 +01:00
2019-09-27 00:30:05 +02:00
/* Start/end date/time */
2016-11-30 22:49:48 +01:00
UniqueId++;
2019-12-15 01:10:36 +01:00
for (StartEndTime = (Dat_StartEndTime_t) 0;
2019-09-27 00:30:05 +02:00
StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1);
StartEndTime++)
2019-10-06 12:00:55 +02:00
{
2019-11-01 22:53:39 +01:00
if (asprintf (&Id,"agd_date_%u_%u",(unsigned) StartEndTime,UniqueId) < 0)
Err_NotEnoughMemoryExit ();
2019-11-01 22:53:39 +01:00
HTM_TD_Begin ("id=\"%s\" class=\"%s LB COLOR%u\"",
Id,
2019-10-10 23:14:13 +02:00
AgdEvent.Hidden ? Dat_TimeStatusClassHidden[AgdEvent.TimeStatus] :
Dat_TimeStatusClassVisible[AgdEvent.TimeStatus],
Gbl.RowEvenOdd);
2019-11-01 23:35:55 +01:00
Dat_WriteLocalDateHMSFromUTC (Id,AgdEvent.TimeUTC[StartEndTime],
2019-11-02 12:10:58 +01:00
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
2019-11-02 11:45:41 +01:00
true,true,true,0x6);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-11-06 19:45:20 +01:00
free (Id);
2019-10-06 12:00:55 +02:00
}
2016-11-30 22:49:48 +01:00
2016-11-30 22:59:02 +01:00
/* Event */
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LT COLOR%u\"",
2019-10-10 23:14:13 +02:00
AgdEvent.Hidden ? "ASG_TITLE_LIGHT" :
"ASG_TITLE",
Gbl.RowEvenOdd);
2019-10-26 01:56:36 +02:00
HTM_ARTICLE_Begin (Anchor);
2019-11-10 12:36:37 +01:00
HTM_Txt (AgdEvent.Event);
2019-10-26 01:56:36 +02:00
HTM_ARTICLE_End ();
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-11-30 22:49:48 +01:00
2016-12-12 19:29:16 +01:00
/* Location */
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
2019-10-23 21:37:01 +02:00
HTM_DIV_Begin ("class=\"%s\"",AgdEvent.Hidden ? "ASG_TITLE_LIGHT" :
"ASG_TITLE");
2019-11-10 12:36:37 +01:00
HTM_Txt (AgdEvent.Location);
2019-10-23 20:07:56 +02:00
HTM_DIV_End ();
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-11-30 22:49:48 +01:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-09-27 00:30:05 +02:00
2016-12-01 00:53:50 +01:00
/***** Write second row of data of this event *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2016-11-30 22:49:48 +01:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
2016-12-06 19:14:58 +01:00
switch (AgendaType)
{
2017-03-21 14:52:07 +01:00
case Agd_MY_AGENDA_TODAY:
case Agd_MY_AGENDA:
2019-10-07 22:28:16 +02:00
/* Forms to remove/edit this event */
2020-04-12 14:42:32 +02:00
Agd_PutFormsToRemEditOneEvent (Agenda,&AgdEvent,Anchor);
2016-12-06 19:14:58 +01:00
break;
2016-12-06 21:08:28 +01:00
default:
break;
2016-12-06 19:14:58 +01:00
}
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/* Text of the event */
2016-12-02 00:24:16 +01:00
Agd_GetEventTxtFromDB (&AgdEvent,Txt);
2016-11-30 22:49:48 +01:00
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
2019-10-07 22:28:16 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
2019-10-23 21:37:01 +02:00
HTM_DIV_Begin ("class=\"PAR %s\"",AgdEvent.Hidden ? "DAT_LIGHT" :
"DAT");
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt);
2019-10-23 20:07:56 +02:00
HTM_DIV_End ();
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 22:28:16 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2016-11-30 22:49:48 +01:00
2019-04-20 19:04:05 +02:00
/***** Free anchor string *****/
2019-04-20 21:11:44 +02:00
Frm_FreeAnchorStr (Anchor);
2019-04-20 19:04:05 +02:00
2016-11-30 22:49:48 +01:00
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/******************* Put a link (form) to edit one event *********************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_PutFormsToRemEditOneEvent (struct Agd_Agenda *Agenda,
struct Agd_Event *AgdEvent,
2019-04-20 19:04:05 +02:00
const char *Anchor)
2016-11-30 22:49:48 +01:00
{
2016-12-01 19:28:52 +01:00
extern const char *Txt_Event_private_click_to_make_it_visible_to_the_users_of_your_courses;
extern const char *Txt_Event_visible_to_the_users_of_your_courses_click_to_make_it_private;
2016-11-30 22:49:48 +01:00
2020-04-12 14:42:32 +02:00
Agenda->AgdCodToEdit = AgdEvent->AgdCod; // Used as parameter in contextual links
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Put form to remove event *****/
2020-10-13 22:34:31 +02:00
Ico_PutContextualIconToRemove (ActReqRemEvtMyAgd,NULL,
2020-04-12 14:42:32 +02:00
Agd_PutCurrentParamsMyAgenda,Agenda);
2016-11-30 22:49:48 +01:00
2016-12-03 19:22:06 +01:00
/***** Put form to hide/show event *****/
if (AgdEvent->Hidden)
2020-03-26 02:54:30 +01:00
Ico_PutContextualIconToUnhide (ActShoEvtMyAgd,Anchor,
2020-04-12 14:42:32 +02:00
Agd_PutCurrentParamsMyAgenda,Agenda);
2016-12-03 19:22:06 +01:00
else
2020-03-26 02:54:30 +01:00
Ico_PutContextualIconToHide (ActHidEvtMyAgd,Anchor,
2020-04-12 14:42:32 +02:00
Agd_PutCurrentParamsMyAgenda,Agenda);
2016-12-03 19:22:06 +01:00
2016-12-01 00:53:50 +01:00
/***** Put form to edit event *****/
2020-03-26 02:54:30 +01:00
Ico_PutContextualIconToEdit (ActEdiOneEvtMyAgd,NULL,
2020-04-12 14:42:32 +02:00
Agd_PutCurrentParamsMyAgenda,Agenda);
2016-11-30 22:49:48 +01:00
2016-12-03 19:22:06 +01:00
/***** Put form to make event public/private *****/
2016-12-06 19:50:32 +01:00
if (AgdEvent->Public)
2019-01-12 03:00:59 +01:00
Lay_PutContextualLinkOnlyIcon (ActPrvEvtMyAgd,NULL,
2020-04-12 14:42:32 +02:00
Agd_PutCurrentParamsMyAgenda,Agenda,
2019-01-12 19:46:33 +01:00
"unlock.svg",
2019-01-12 03:00:59 +01:00
Txt_Event_visible_to_the_users_of_your_courses_click_to_make_it_private);
2016-12-06 19:50:32 +01:00
else
2019-01-12 03:00:59 +01:00
Lay_PutContextualLinkOnlyIcon (ActPubEvtMyAgd,NULL,
2020-04-12 14:42:32 +02:00
Agd_PutCurrentParamsMyAgenda,Agenda,
2019-01-12 03:00:59 +01:00
"lock.svg",
Txt_Event_private_click_to_make_it_visible_to_the_users_of_your_courses);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2017-04-13 20:09:22 +02:00
/****************** Parameters passed in my agenda forms *********************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-03-26 02:54:30 +01:00
static void Agd_PutCurrentParamsMyAgenda (void *Agenda)
2016-11-30 22:49:48 +01:00
{
2020-03-26 02:54:30 +01:00
if (Agenda)
Agd_PutParamsMyAgenda (((struct Agd_Agenda *) Agenda)->Past__FutureEvents,
((struct Agd_Agenda *) Agenda)->PrivatPublicEvents,
((struct Agd_Agenda *) Agenda)->HiddenVisiblEvents,
((struct Agd_Agenda *) Agenda)->SelectedOrder,
((struct Agd_Agenda *) Agenda)->CurrentPage,
((struct Agd_Agenda *) Agenda)->AgdCodToEdit);
2017-03-21 14:36:22 +01:00
}
/* The following function is called
when one or more parameters must be passed explicitely.
Each parameter is passed only if its value is distinct to default. */
2017-04-13 20:09:22 +02:00
void Agd_PutParamsMyAgenda (unsigned Past__FutureEvents,
unsigned PrivatPublicEvents,
unsigned HiddenVisiblEvents,
2020-04-05 22:53:58 +02:00
Dat_StartEndTime_t Order,
2017-04-13 20:09:22 +02:00
unsigned NumPage,
long AgdCodToEdit)
2017-03-21 14:36:22 +01:00
{
if (Past__FutureEvents != (Agd_DEFAULT_PAST___EVENTS |
Agd_DEFAULT_FUTURE_EVENTS))
Agd_PutHiddenParamPast__FutureEvents (Past__FutureEvents);
if (PrivatPublicEvents != (Agd_DEFAULT_PRIVAT_EVENTS |
Agd_DEFAULT_PUBLIC_EVENTS))
Agd_PutHiddenParamPrivatPublicEvents (PrivatPublicEvents);
if (HiddenVisiblEvents != (Agd_DEFAULT_HIDDEN_EVENTS |
Agd_DEFAULT_VISIBL_EVENTS))
Agd_PutHiddenParamHiddenVisiblEvents (HiddenVisiblEvents);
2019-11-18 09:20:44 +01:00
if (Order != Agd_ORDER_DEFAULT)
2020-04-05 22:53:58 +02:00
Dat_PutHiddenParamOrder (Order);
2017-04-13 20:09:22 +02:00
if (NumPage > 1)
Pag_PutHiddenParamPagNum (Pag_MY_AGENDA,NumPage);
2017-03-21 14:36:22 +01:00
if (AgdCodToEdit > 0)
2019-11-03 13:19:32 +01:00
Par_PutHiddenParamLong (NULL,"AgdCod",AgdCodToEdit);
2017-03-21 14:36:22 +01:00
}
/*****************************************************************************/
/********** Get parameter with the type or order in list of events ***********/
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_GetParams (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType)
2017-03-21 14:36:22 +01:00
{
2019-11-21 11:39:30 +01:00
static const Pag_WhatPaginate_t WhatPaginate[Agd_NUM_AGENDA_TYPES] =
2017-03-21 14:36:22 +01:00
{
2019-11-20 17:53:51 +01:00
[Agd_MY_AGENDA_TODAY ] = Pag_MY_AGENDA, // not used
[Agd_MY_AGENDA ] = Pag_MY_AGENDA,
[Agd_ANOTHER_AGENDA_TODAY] = Pag_ANOTHER_AGENDA, // not used
[Agd_ANOTHER_AGENDA ] = Pag_ANOTHER_AGENDA,
2017-03-21 14:36:22 +01:00
};
2017-03-21 14:52:07 +01:00
if (AgendaType == Agd_MY_AGENDA)
2017-03-21 14:36:22 +01:00
{
2020-04-12 14:42:32 +02:00
Agenda->Past__FutureEvents = Agd_GetParamsPast__FutureEvents ();
Agenda->PrivatPublicEvents = Agd_GetParamsPrivatPublicEvents ();
Agenda->HiddenVisiblEvents = Agd_GetParamsHiddenVisiblEvents ();
2017-03-21 14:36:22 +01:00
}
2020-04-12 14:42:32 +02:00
Agd_GetParamEventOrder (Agenda);
Agenda->CurrentPage = Pag_GetParamPagNum (WhatPaginate[AgendaType]);
2017-03-21 14:36:22 +01:00
}
/*****************************************************************************/
/****** Put a hidden parameter with the type of order in list of events ******/
/*****************************************************************************/
2020-04-05 22:53:58 +02:00
void Agd_PutHiddenParamEventsOrder (Dat_StartEndTime_t SelectedOrder)
2017-03-21 14:36:22 +01:00
{
2020-04-12 14:42:32 +02:00
if (SelectedOrder != Agd_ORDER_DEFAULT)
2020-04-05 22:53:58 +02:00
Dat_PutHiddenParamOrder (SelectedOrder);
2017-03-21 14:36:22 +01:00
}
/*****************************************************************************/
/********** Get parameter with the type or order in list of events ***********/
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_GetParamEventOrder (struct Agd_Agenda *Agenda)
2017-03-21 14:36:22 +01:00
{
static bool AlreadyGot = false;
if (!AlreadyGot)
{
2020-04-12 14:42:32 +02:00
Agenda->SelectedOrder = (Dat_StartEndTime_t)
Par_GetParToUnsignedLong ("Order",
0,
Dat_NUM_START_END_TIME - 1,
(unsigned long) Agd_ORDER_DEFAULT);
2017-03-21 14:36:22 +01:00
AlreadyGot = true;
}
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-02 00:24:16 +01:00
/************************* Get list of agenda events *************************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2017-03-22 01:14:48 +01:00
#define Agd_MAX_BYTES_SUBQUERY 128
2020-04-12 14:42:32 +02:00
static void Agd_GetListEvents (struct Agd_Agenda *Agenda,
Agd_AgendaType_t AgendaType)
2016-11-30 22:49:48 +01:00
{
2018-10-30 01:00:46 +01:00
char *UsrSubQuery;
char Past__FutureEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
char PrivatPublicEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
char HiddenVisiblEventsSubQuery[Agd_MAX_BYTES_SUBQUERY + 1];
2020-04-05 22:53:58 +02:00
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
2019-01-03 15:25:18 +01:00
{
2020-04-05 22:53:58 +02:00
[Dat_START_TIME] = "StartTime,EndTime,Event,Location",
[Dat_END_TIME ] = "EndTime,StartTime,Event,Location",
2019-01-03 15:25:18 +01:00
};
2016-11-30 22:49:48 +01:00
MYSQL_RES *mysql_res;
2016-12-02 00:24:16 +01:00
unsigned NumEvent;
2017-03-22 01:14:48 +01:00
bool DoQuery = true;
2016-11-30 22:49:48 +01:00
2017-03-22 01:14:48 +01:00
/***** Initialize list of events *****/
2020-04-12 14:42:32 +02:00
Agd_FreeListEvents (Agenda);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get list of events from database *****/
2017-03-22 01:14:48 +01:00
/* Build events subqueries */
2016-12-02 00:24:16 +01:00
switch (AgendaType)
{
2017-03-21 14:52:07 +01:00
case Agd_MY_AGENDA_TODAY:
case Agd_MY_AGENDA:
2020-04-12 14:42:32 +02:00
if (Agenda->Past__FutureEvents == 0 ||
Agenda->PrivatPublicEvents == 0 ||
Agenda->HiddenVisiblEvents == 0) // All selectors are off
DoQuery = false; // Nothing to get from database
2017-03-22 01:14:48 +01:00
else
2017-03-21 16:45:26 +01:00
{
2018-10-30 01:00:46 +01:00
if (asprintf (&UsrSubQuery,"UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
Err_NotEnoughMemoryExit ();
2017-03-22 01:14:48 +01:00
if (AgendaType == Agd_MY_AGENDA_TODAY)
Str_Copy (Past__FutureEventsSubQuery,
" AND DATE(StartTime)<=CURDATE()"
" AND DATE(EndTime)>=CURDATE()",
sizeof (Past__FutureEventsSubQuery) - 1); // Today events
2017-03-22 01:14:48 +01:00
else
2020-04-12 14:42:32 +02:00
switch (Agenda->Past__FutureEvents)
2017-03-22 01:14:48 +01:00
{
case (1 << Agd_PAST___EVENTS):
Str_Copy (Past__FutureEventsSubQuery,
" AND DATE(StartTime)<=CURDATE()",
sizeof (Past__FutureEventsSubQuery) - 1); // Past and today events
2017-03-22 01:14:48 +01:00
break;
case (1 << Agd_FUTURE_EVENTS):
Str_Copy (Past__FutureEventsSubQuery,
" AND DATE(EndTime)>=CURDATE()",
sizeof (Past__FutureEventsSubQuery) - 1); // Today and future events
2017-03-22 01:14:48 +01:00
break;
default:
Past__FutureEventsSubQuery[0] = '\0'; // All events
break;
}
2020-04-12 14:42:32 +02:00
switch (Agenda->PrivatPublicEvents)
2017-03-22 01:14:48 +01:00
{
case (1 << Agd_PRIVAT_EVENTS):
Str_Copy (PrivatPublicEventsSubQuery," AND Public='N'",
sizeof (PrivatPublicEventsSubQuery) - 1); // Private events
2017-03-22 01:14:48 +01:00
break;
case (1 << Agd_PUBLIC_EVENTS):
Str_Copy (PrivatPublicEventsSubQuery," AND Public='Y'",
sizeof (PrivatPublicEventsSubQuery) - 1); // Public events
2017-03-22 01:14:48 +01:00
break;
default:
PrivatPublicEventsSubQuery[0] = '\0'; // All events
break;
}
2020-04-12 14:42:32 +02:00
switch (Agenda->HiddenVisiblEvents)
2017-03-22 01:14:48 +01:00
{
case (1 << Agd_HIDDEN_EVENTS):
Str_Copy (HiddenVisiblEventsSubQuery," AND Hidden='Y'",
sizeof (HiddenVisiblEventsSubQuery) - 1); // Hidden events
2017-03-22 01:14:48 +01:00
break;
case (1 << Agd_VISIBL_EVENTS):
Str_Copy (HiddenVisiblEventsSubQuery," AND Hidden='N'",
sizeof (HiddenVisiblEventsSubQuery) - 1); // Visible events
2017-03-22 01:14:48 +01:00
break;
default:
HiddenVisiblEventsSubQuery[0] = '\0'; // All events
break;
}
2017-03-21 16:45:26 +01:00
}
2016-12-06 21:26:02 +01:00
break;
2017-03-21 14:52:07 +01:00
case Agd_ANOTHER_AGENDA_TODAY:
case Agd_ANOTHER_AGENDA:
2018-10-30 01:00:46 +01:00
if (asprintf (&UsrSubQuery,"UsrCod=%ld",
Gbl.Usrs.Other.UsrDat.UsrCod) < 0)
Err_NotEnoughMemoryExit ();
2017-03-22 01:14:48 +01:00
if (AgendaType == Agd_ANOTHER_AGENDA_TODAY)
Str_Copy (Past__FutureEventsSubQuery,
" AND DATE(StartTime)<=CURDATE()"
" AND DATE(EndTime)>=CURDATE()",
sizeof (Past__FutureEventsSubQuery) - 1); // Today events
2017-03-22 01:14:48 +01:00
else
Str_Copy (Past__FutureEventsSubQuery,
" AND DATE(EndTime)>=CURDATE()",
sizeof (Past__FutureEventsSubQuery) - 1); // Today and future events
2017-03-22 01:14:48 +01:00
Str_Copy (PrivatPublicEventsSubQuery," AND Public='Y'",
sizeof (PrivatPublicEventsSubQuery) - 1); // Public events
2017-03-22 01:14:48 +01:00
Str_Copy (HiddenVisiblEventsSubQuery," AND Hidden='N'",
sizeof (HiddenVisiblEventsSubQuery) - 1); // Visible events
2016-12-02 00:24:16 +01:00
}
2016-11-30 22:49:48 +01:00
2017-03-22 01:14:48 +01:00
if (DoQuery)
2016-11-30 22:49:48 +01:00
{
2019-01-03 15:25:18 +01:00
/* 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]);
2017-03-22 01:14:48 +01:00
2019-01-03 15:25:18 +01:00
/* Free allocated memory for subquery */
2019-11-06 19:45:20 +01:00
free (UsrSubQuery);
2018-10-30 01:00:46 +01:00
if (Agenda->Num) // Events found...
2017-03-22 01:14:48 +01:00
{
/***** Create list of events *****/
if ((Agenda->LstAgdCods = calloc ((size_t) Agenda->Num,
sizeof (*Agenda->LstAgdCods))) == NULL)
Err_NotEnoughMemoryExit ();
2017-03-22 01:14:48 +01:00
/***** Get the events codes *****/
for (NumEvent = 0;
2020-04-12 14:42:32 +02:00
NumEvent < Agenda->Num;
2017-03-22 01:14:48 +01:00
NumEvent++)
/* Get next event code */
if ((Agenda->LstAgdCods[NumEvent] = DB_GetNextCode (mysql_res)) < 0)
Err_WrongEventExit ();
2017-03-22 01:14:48 +01:00
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
2016-11-30 22:49:48 +01:00
}
2020-04-12 14:42:32 +02:00
Agenda->LstIsRead = true;
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/*********************** Get event data using its code ***********************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-04-08 03:06:45 +02:00
static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
2016-11-30 22:49:48 +01:00
{
2016-12-09 00:44:15 +01:00
MYSQL_RES *mysql_res;
MYSQL_ROW row;
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get data of event from database *****/
2018-10-30 09:02:14 +01:00
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...
2016-11-30 22:49:48 +01:00
{
2016-12-02 10:45:53 +01:00
/* Get row:
row[0] AgdCod
2016-12-09 00:44:15 +01:00
row[1] Public
row[2] Hidden
row[3] UNIX_TIMESTAMP(StartTime)
row[4] UNIX_TIMESTAMP(EndTime)
row[5] NOW()>EndTime // Past event?
row[6] NOW()<StartTime // Future event?
row[7] Event
row[8] Location
2016-12-02 10:45:53 +01:00
*/
2016-11-30 22:49:48 +01:00
row = mysql_fetch_row (mysql_res);
2016-12-01 00:53:50 +01:00
/* Get code of the event (row[0]) */
AgdEvent->AgdCod = Str_ConvertStrCodToLongCod (row[0]);
2016-11-30 22:49:48 +01:00
/* Get whether the event is public or not (row[1])
and whether it is hidden or not (row[2]) */
2016-12-09 00:44:15 +01:00
AgdEvent->Public = (row[1][0] == 'Y');
AgdEvent->Hidden = (row[2][0] == 'Y');
2016-11-30 22:49:48 +01:00
/* Get start date (row[3]) and end date (row[4]) in UTC time */
2020-04-28 13:12:18 +02:00
AgdEvent->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
AgdEvent->TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[4]);
2016-11-30 22:49:48 +01:00
2016-12-09 00:44:15 +01:00
/* Get whether the event is past, present or future (row(5), row[6]) */
AgdEvent->TimeStatus = ((row[5][0] == '1') ? Dat_PAST :
((row[6][0] == '1') ? Dat_FUTURE :
2016-12-03 19:22:06 +01:00
Dat_PRESENT));
2016-12-02 10:45:53 +01:00
/* Get the event (row[7]) and its location (row[8]) */
Str_Copy (AgdEvent->Event ,row[7],sizeof (AgdEvent->Event ) - 1);
Str_Copy (AgdEvent->Location,row[8],sizeof (AgdEvent->Location) - 1);
2016-12-09 00:44:15 +01:00
}
else
{
/***** Clear all event data *****/
AgdEvent->AgdCod = -1L;
AgdEvent->Public = false;
AgdEvent->Hidden = false;
2020-04-28 13:12:18 +02:00
AgdEvent->TimeUTC[Dat_START_TIME] =
AgdEvent->TimeUTC[Dat_END_TIME ] = (time_t) 0;
2016-12-09 00:44:15 +01:00
AgdEvent->TimeStatus = Dat_FUTURE;
AgdEvent->Event[0] = '\0';
AgdEvent->Location[0] = '\0';
2016-11-30 22:49:48 +01:00
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/*************************** Free list of events *****************************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-04-12 14:42:32 +02:00
static void Agd_FreeListEvents (struct Agd_Agenda *Agenda)
2016-11-30 22:49:48 +01:00
{
2020-04-12 14:42:32 +02:00
if (Agenda->LstIsRead && Agenda->LstAgdCods)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
/***** Free memory used by the list of events *****/
2020-04-12 14:42:32 +02:00
free (Agenda->LstAgdCods);
Agenda->LstAgdCods = NULL;
Agenda->Num = 0;
Agenda->LstIsRead = false;
2016-11-30 22:49:48 +01:00
}
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/*********************** Get event text from database ************************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-04-08 03:06:45 +02:00
static void Agd_GetEventTxtFromDB (struct Agd_Event *AgdEvent,
2017-01-17 03:10:43 +01:00
char Txt[Cns_MAX_BYTES_TEXT + 1])
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
/***** 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);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/******************** Get parameter with code of event ***********************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
long Agd_GetParamAgdCod (void)
2016-11-30 22:49:48 +01:00
{
2017-01-28 20:32:50 +01:00
/***** Get code of event *****/
return Par_GetParToLong ("AgdCod");
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/************** Ask for confirmation of removing of an event *****************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
void Agd_AskRemEvent (void)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
extern const char *Txt_Do_you_really_want_to_remove_the_event_X;
extern const char *Txt_Remove_event;
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2020-04-08 03:06:45 +02:00
struct Agd_Event AgdEvent;
2016-11-30 22:49:48 +01:00
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
2016-11-30 22:49:48 +01:00
/***** Get parameters *****/
2020-04-12 14:42:32 +02:00
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
Err_WrongEventExit ();
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get data of the event from database *****/
2016-12-02 00:24:16 +01:00
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
2016-12-01 00:53:50 +01:00
Agd_GetDataOfEventByCod (&AgdEvent);
2016-11-30 22:49:48 +01:00
2017-04-28 10:44:28 +02:00
/***** Show question and button to remove event *****/
2020-04-12 14:42:32 +02:00
Agenda.AgdCodToEdit = AgdEvent.AgdCod;
2019-02-17 01:14:55 +01:00
Ale_ShowAlertAndButton (ActRemEvtMyAgd,NULL,NULL,
2020-04-12 14:42:32 +02:00
Agd_PutCurrentParamsMyAgenda,&Agenda,
2019-02-17 01:14:55 +01:00
Btn_REMOVE_BUTTON,Txt_Remove_event,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_event_X,
AgdEvent.Event);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Show events again *****/
2020-04-12 14:42:32 +02:00
Agd_ShowMyAgenda (&Agenda);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/****************************** Remove an event ******************************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
void Agd_RemoveEvent (void)
2016-11-30 22:49:48 +01:00
{
2016-12-01 01:39:06 +01:00
extern const char *Txt_Event_X_removed;
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2020-04-08 03:06:45 +02:00
struct Agd_Event AgdEvent;
2016-11-30 22:49:48 +01:00
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
/***** Get parameters *****/
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
2016-12-01 00:53:50 +01:00
/***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
Err_WrongEventExit ();
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get data of the event from database *****/
2016-12-02 00:24:16 +01:00
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
2016-12-09 00:44:15 +01:00
Agd_GetDataOfEventByCod (&AgdEvent);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Remove event *****/
2018-11-02 22:00:31 +01:00
DB_QueryDELETE ("can not remove event",
"DELETE FROM agd_agendas"
" WHERE AgdCod=%ld"
" AND UsrCod=%ld",
AgdEvent.AgdCod,
AgdEvent.UsrCod);
2016-11-30 22:49:48 +01:00
/***** Write message to show the change made *****/
2019-02-16 14:37:34 +01:00
Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_removed,
2019-02-15 23:38:44 +01:00
AgdEvent.Event);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Show events again *****/
2020-04-12 14:42:32 +02:00
Agd_ShowMyAgenda (&Agenda);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-03 19:22:06 +01:00
/********************************* Hide event ********************************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2016-12-03 19:22:06 +01:00
void Agd_HideEvent (void)
2016-11-30 22:49:48 +01:00
{
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2020-04-08 03:06:45 +02:00
struct Agd_Event AgdEvent;
2016-11-30 22:49:48 +01:00
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
/***** Get parameters *****/
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
2016-12-01 00:53:50 +01:00
/***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
Err_WrongEventExit ();
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get data of the event from database *****/
2016-12-02 00:24:16 +01:00
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
2016-12-01 00:53:50 +01:00
Agd_GetDataOfEventByCod (&AgdEvent);
2016-11-30 22:49:48 +01:00
2016-12-03 17:34:07 +01:00
/***** Set event private *****/
2018-11-03 12:16:40 +01:00
DB_QueryUPDATE ("can not hide event",
"UPDATE agd_agendas"
" SET Hidden='Y'"
" WHERE AgdCod=%ld"
" AND UsrCod=%ld",
AgdEvent.AgdCod,
AgdEvent.UsrCod);
2016-12-03 19:22:06 +01:00
/***** Show events again *****/
2020-04-12 14:42:32 +02:00
Agd_ShowMyAgenda (&Agenda);
2016-12-03 19:22:06 +01:00
}
/*****************************************************************************/
2016-12-06 19:14:58 +01:00
/****************************** Unhide event *********************************/
2016-12-03 19:22:06 +01:00
/*****************************************************************************/
2016-12-06 19:14:58 +01:00
void Agd_UnhideEvent (void)
2016-12-03 19:22:06 +01:00
{
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2020-04-08 03:06:45 +02:00
struct Agd_Event AgdEvent;
2016-12-03 19:22:06 +01:00
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
/***** Get parameters *****/
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
2016-12-03 19:22:06 +01:00
/***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
Err_WrongEventExit ();
2016-12-03 19:22:06 +01:00
/***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Agd_GetDataOfEventByCod (&AgdEvent);
/***** Set event public *****/
2018-11-03 12:16:40 +01:00
DB_QueryUPDATE ("can not show event",
"UPDATE agd_agendas"
" SET Hidden='N'"
" WHERE AgdCod=%ld"
" AND UsrCod=%ld",
AgdEvent.AgdCod,
AgdEvent.UsrCod);
2016-12-03 19:22:06 +01:00
/***** Show events again *****/
2020-04-12 14:42:32 +02:00
Agd_ShowMyAgenda (&Agenda);
2016-12-03 19:22:06 +01:00
}
/*****************************************************************************/
/****************************** Make event private ***************************/
/*****************************************************************************/
void Agd_MakeEventPrivate (void)
{
extern const char *Txt_Event_X_is_now_private;
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2020-04-08 03:06:45 +02:00
struct Agd_Event AgdEvent;
2016-12-03 19:22:06 +01:00
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
/***** Get parameters *****/
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
2016-12-03 19:22:06 +01:00
/***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
Err_WrongEventExit ();
2016-12-03 19:22:06 +01:00
/***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Agd_GetDataOfEventByCod (&AgdEvent);
/***** Make event private *****/
2018-11-03 12:16:40 +01:00
DB_QueryUPDATE ("can not make event private",
"UPDATE agd_agendas"
" SET Public='N'"
" WHERE AgdCod=%ld"
" AND UsrCod=%ld",
AgdEvent.AgdCod,
AgdEvent.UsrCod);
2016-11-30 22:49:48 +01:00
/***** Write message to show the change made *****/
2019-02-16 14:37:34 +01:00
Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_is_now_private,
2019-02-15 23:38:44 +01:00
AgdEvent.Event);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Show events again *****/
2020-04-12 14:42:32 +02:00
Agd_ShowMyAgenda (&Agenda);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-03 19:22:06 +01:00
/******** Make event public (make it visible to users of my courses) *********/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2016-12-03 19:22:06 +01:00
void Agd_MakeEventPublic (void)
2016-11-30 22:49:48 +01:00
{
2016-12-01 19:28:52 +01:00
extern const char *Txt_Event_X_is_now_visible_to_users_of_your_courses;
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2020-04-08 03:06:45 +02:00
struct Agd_Event AgdEvent;
2016-11-30 22:49:48 +01:00
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
/***** Get parameters *****/
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
2016-12-01 00:53:50 +01:00
/***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
Err_WrongEventExit ();
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get data of the event from database *****/
2016-12-02 00:24:16 +01:00
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
2016-12-01 00:53:50 +01:00
Agd_GetDataOfEventByCod (&AgdEvent);
2016-11-30 22:49:48 +01:00
2016-12-03 19:22:06 +01:00
/***** Make event public *****/
2018-11-03 12:16:40 +01:00
DB_QueryUPDATE ("can not make event public",
"UPDATE agd_agendas"
" SET Public='Y'"
" WHERE AgdCod=%ld"
" AND UsrCod=%ld",
AgdEvent.AgdCod,
AgdEvent.UsrCod);
2016-11-30 22:49:48 +01:00
/***** Write message to show the change made *****/
2019-02-16 14:37:34 +01:00
Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_is_now_visible_to_users_of_your_courses,
2019-02-15 23:38:44 +01:00
AgdEvent.Event);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Show events again *****/
2020-04-12 14:42:32 +02:00
Agd_ShowMyAgenda (&Agenda);
2016-11-30 22:49:48 +01:00
}
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/******************** Put a form to create a new event ***********************/
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
void Agd_RequestCreatOrEditEvent (void)
2016-07-07 00:21:10 +02:00
{
2016-12-01 00:53:50 +01:00
extern const char *Hlp_PROFILE_Agenda_new_event;
extern const char *Hlp_PROFILE_Agenda_edit_event;
2016-11-30 22:49:48 +01:00
extern const char *Txt_New_event;
2016-12-01 00:53:50 +01:00
extern const char *Txt_Edit_event;
2016-11-30 22:49:48 +01:00
extern const char *Txt_Location;
extern const char *Txt_Event;
extern const char *Txt_Description;
extern const char *Txt_Create_event;
2019-02-18 18:27:45 +01:00
extern const char *Txt_Save_changes;
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2020-04-08 03:06:45 +02:00
struct Agd_Event AgdEvent;
2016-12-01 00:53:50 +01:00
bool ItsANewEvent;
2017-01-17 03:10:43 +01:00
char Txt[Cns_MAX_BYTES_TEXT + 1];
2020-02-26 19:35:33 +01:00
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
{
2020-04-13 16:39:15 +02:00
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
[Dat_END_TIME ] = Dat_HMS_DO_NOT_SET
2020-02-26 19:35:33 +01:00
};
2016-11-30 22:49:48 +01:00
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
2016-11-30 22:49:48 +01:00
/***** Get parameters *****/
2020-04-12 14:42:32 +02:00
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get the code of the event *****/
ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) <= 0);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Get from the database the data of the event *****/
2016-12-09 00:44:15 +01:00
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
2016-12-01 00:53:50 +01:00
if (ItsANewEvent)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
/* Initialize to empty event */
AgdEvent.AgdCod = -1L;
2020-04-28 13:12:18 +02:00
AgdEvent.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
AgdEvent.TimeUTC[Dat_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
2016-12-02 10:45:53 +01:00
AgdEvent.TimeStatus = Dat_FUTURE;
2016-12-01 00:53:50 +01:00
AgdEvent.Event[0] = '\0';
AgdEvent.Location[0] = '\0';
2016-11-30 22:49:48 +01:00
}
else
{
2016-12-01 00:53:50 +01:00
/* Get data of the event from database */
Agd_GetDataOfEventByCod (&AgdEvent);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/* Get text of the event from database */
2016-12-02 00:24:16 +01:00
Agd_GetEventTxtFromDB (&AgdEvent,Txt);
2016-11-30 22:49:48 +01:00
}
2019-10-20 22:00:28 +02:00
/***** Begin form *****/
2016-12-01 00:53:50 +01:00
if (ItsANewEvent)
2017-03-21 14:36:22 +01:00
{
Frm_BeginForm (ActNewEvtMyAgd);
2020-04-12 14:42:32 +02:00
Agenda.AgdCodToEdit = -1L;
2017-03-21 14:36:22 +01:00
}
2016-11-30 22:49:48 +01:00
else
{
Frm_BeginForm (ActChgEvtMyAgd);
2020-04-12 14:42:32 +02:00
Agenda.AgdCodToEdit = AgdEvent.AgdCod;
2016-11-30 22:49:48 +01:00
}
2020-04-12 14:42:32 +02:00
Agd_PutCurrentParamsMyAgenda (&Agenda);
2016-11-30 22:49:48 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2017-06-11 22:26:40 +02:00
if (ItsANewEvent)
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_New_event,
NULL,NULL,
2017-06-12 15:03:29 +02:00
Hlp_PROFILE_Agenda_new_event,Box_NOT_CLOSABLE,2);
2017-06-11 22:26:40 +02:00
else
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_Edit_event,
NULL,NULL,
2017-06-12 15:03:29 +02:00
Hlp_PROFILE_Agenda_edit_event,Box_NOT_CLOSABLE,2);
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Event *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 22:28:16 +02:00
2019-12-27 21:10:39 +01:00
/* Label */
2019-12-27 15:45:19 +01:00
Frm_LabelColumn ("RT","Event",Txt_Event);
2019-10-07 22:28:16 +02:00
2019-12-27 21:10:39 +01:00
/* Data */
2019-12-26 22:29:04 +01:00
HTM_TD_Begin ("class=\"LT\"");
2020-04-27 03:16:55 +02:00
HTM_INPUT_TEXT ("Event",Agd_MAX_CHARS_EVENT,AgdEvent.Event,
HTM_DONT_SUBMIT_ON_CHANGE,
2019-11-27 00:27:42 +01:00
"id=\"Event\" required=\"required\""
" class=\"TITLE_DESCRIPTION_WIDTH\"");
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 22:28:16 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Location *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 22:28:16 +02:00
2019-12-27 21:10:39 +01:00
/* Label */
2019-12-27 15:45:19 +01:00
Frm_LabelColumn ("RT","Location",Txt_Location);
2019-10-07 22:28:16 +02:00
2019-12-27 21:10:39 +01:00
/* Data */
2019-12-26 22:29:04 +01:00
HTM_TD_Begin ("class=\"LT\"");
2020-04-27 03:16:55 +02:00
HTM_INPUT_TEXT ("Location",Agd_MAX_CHARS_LOCATION,AgdEvent.Location,
HTM_DONT_SUBMIT_ON_CHANGE,
2019-11-27 00:27:42 +01:00
"id=\"Location\" required=\"required\""
" class=\"TITLE_DESCRIPTION_WIDTH\"");
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 22:28:16 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2016-11-30 22:49:48 +01:00
/***** Start and end dates *****/
2016-12-03 20:08:01 +01:00
Dat_PutFormStartEndClientLocalDateTimes (AgdEvent.TimeUTC,
2020-02-26 19:35:33 +01:00
Dat_FORM_SECONDS_OFF,
SetHMS);
2016-11-30 22:49:48 +01:00
/***** Text *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 22:28:16 +02:00
2019-12-27 21:10:39 +01:00
/* Label */
2019-12-27 15:45:19 +01:00
Frm_LabelColumn ("RT","Txt",Txt_Description);
2019-10-07 22:28:16 +02:00
2019-12-27 21:10:39 +01:00
/* Data */
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"LT\"");
2019-11-27 00:27:42 +01:00
HTM_TEXTAREA_Begin ("id=\"Txt\" name=\"Txt\" rows=\"5\""
" class=\"TITLE_DESCRIPTION_WIDTH\"");
2016-12-01 00:53:50 +01:00
if (!ItsANewEvent)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt);
2019-10-31 17:42:05 +01:00
HTM_TEXTAREA_End ();
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 22:28:16 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2016-11-30 22:49:48 +01:00
2017-06-12 14:16:33 +02:00
/***** End table, send button and end box *****/
2016-12-01 00:53:50 +01:00
if (ItsANewEvent)
2019-11-25 23:18:08 +01:00
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_event);
2016-11-30 22:49:48 +01:00
else
2019-11-25 23:18:08 +01:00
Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Save_changes);
2017-06-12 14:16:33 +02:00
/***** End form *****/
2018-11-09 20:47:39 +01:00
Frm_EndForm ();
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Show current events, if any *****/
2020-04-12 14:42:32 +02:00
Agd_ShowMyAgenda (&Agenda);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/********************* Receive form to create a new event ********************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-05-05 21:49:00 +02:00
void Agd_ReceiveFormEvent (void)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
extern const char *Txt_You_must_specify_the_title_of_the_event;
extern const char *Txt_Created_new_event_X;
2016-11-30 22:49:48 +01:00
extern const char *Txt_The_event_has_been_modified;
2020-04-12 14:42:32 +02:00
struct Agd_Agenda Agenda;
2020-04-08 03:06:45 +02:00
struct Agd_Event AgdEvent;
2016-12-01 00:53:50 +01:00
bool ItsANewEvent;
bool NewEventIsCorrect = true;
2019-02-15 21:09:18 +01:00
char EventTxt[Cns_MAX_BYTES_TEXT + 1];
2016-11-30 22:49:48 +01:00
2020-04-12 14:42:32 +02:00
/***** Reset agenda context *****/
Agd_ResetAgenda (&Agenda);
/***** Get parameters *****/
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
2016-12-09 18:22:25 +01:00
/***** Set author of the event *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
2016-12-01 00:53:50 +01:00
/***** Get the code of the event *****/
ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) <= 0);
2016-11-30 22:49:48 +01:00
/***** Get start/end date-times *****/
2020-04-28 13:12:18 +02:00
AgdEvent.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
AgdEvent.TimeUTC[Dat_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
2016-11-30 22:49:48 +01:00
2020-04-28 13:12:18 +02:00
/***** Get event location *****/
2017-03-07 01:56:41 +01:00
Par_GetParToText ("Location",AgdEvent.Location,Agd_MAX_BYTES_LOCATION);
2016-11-30 22:49:48 +01:00
2020-04-28 13:12:18 +02:00
/***** Get event title *****/
2017-03-07 01:56:41 +01:00
Par_GetParToText ("Event",AgdEvent.Event,Agd_MAX_BYTES_EVENT);
2016-11-30 22:49:48 +01:00
2020-04-28 13:12:18 +02:00
/***** Get event description *****/
2019-02-15 21:09:18 +01:00
Par_GetParToHTML ("Txt",EventTxt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
2016-11-30 22:49:48 +01:00
/***** Adjust dates *****/
2020-04-28 13:12:18 +02:00
if (AgdEvent.TimeUTC[Dat_START_TIME] == 0)
AgdEvent.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
if (AgdEvent.TimeUTC[Dat_END_TIME] == 0)
AgdEvent.TimeUTC[Dat_END_TIME] = AgdEvent.TimeUTC[Dat_START_TIME] + 2 * 60 * 60; // +2 hours
2016-11-30 22:49:48 +01:00
2016-12-01 00:53:50 +01:00
/***** Check if event is correct *****/
2016-12-09 00:44:15 +01:00
if (!AgdEvent.Location[0]) // If there is no event
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
NewEventIsCorrect = false;
2019-02-16 14:37:34 +01:00
Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_title_of_the_event);
2016-11-30 22:49:48 +01:00
}
/***** Check if event is correct *****/
2017-03-22 01:39:43 +01:00
if (!AgdEvent.Event[0]) // If there is no event
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
NewEventIsCorrect = false;
2019-02-16 14:37:34 +01:00
Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_title_of_the_event);
2016-11-30 22:49:48 +01:00
}
2016-12-01 00:53:50 +01:00
/***** Create a new event or update an existing one *****/
if (NewEventIsCorrect)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
if (ItsANewEvent)
2016-11-30 22:49:48 +01:00
{
2019-02-15 21:09:18 +01:00
Agd_CreateEvent (&AgdEvent,EventTxt); // Add new event to database
2016-11-30 22:49:48 +01:00
/***** Write success message *****/
2019-02-16 14:37:34 +01:00
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_event_X,
2019-02-15 23:38:44 +01:00
AgdEvent.Event);
2016-11-30 22:49:48 +01:00
}
else
{
2019-02-15 21:09:18 +01:00
Agd_UpdateEvent (&AgdEvent,EventTxt);
2016-11-30 22:49:48 +01:00
/***** Write success message *****/
2019-02-16 14:37:34 +01:00
Ale_ShowAlert (Ale_SUCCESS,Txt_The_event_has_been_modified);
2016-11-30 22:49:48 +01:00
}
/* Free memory for list of selected groups */
Grp_FreeListCodSelectedGrps ();
2016-12-01 00:53:50 +01:00
/***** Show events again *****/
2020-04-12 14:42:32 +02:00
Agd_ShowMyAgenda (&Agenda);
2016-11-30 22:49:48 +01:00
}
else
// TODO: The form should be filled with partial data, now is always empty
2016-12-01 00:53:50 +01:00
Agd_RequestCreatOrEditEvent ();
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/************************** Create a new event *******************************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-04-08 03:06:45 +02:00
static void Agd_CreateEvent (struct Agd_Event *AgdEvent,const char *Txt)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
/***** Create a new event *****/
2018-11-03 01:45:36 +01:00
AgdEvent->AgdCod =
DB_QueryINSERTandReturnCode ("can not create new event",
"INSERT INTO agd_agendas"
" (UsrCod,StartTime,EndTime,"
"Event,Location,Txt)"
2018-11-03 01:45:36 +01:00
" VALUES"
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s')",
2018-11-03 01:45:36 +01:00
AgdEvent->UsrCod,
2020-04-28 13:12:18 +02:00
AgdEvent->TimeUTC[Dat_START_TIME],
AgdEvent->TimeUTC[Dat_END_TIME ],
2018-11-03 01:45:36 +01:00
AgdEvent->Event,
AgdEvent->Location,
Txt);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/************************ Update an existing event ***************************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2020-04-08 03:06:45 +02:00
static void Agd_UpdateEvent (struct Agd_Event *AgdEvent,const char *Txt)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
/***** Update the data of the event *****/
2018-11-03 12:16:40 +01:00
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",
2020-04-28 13:12:18 +02:00
AgdEvent->TimeUTC[Dat_START_TIME],
AgdEvent->TimeUTC[Dat_END_TIME ],
AgdEvent->Event,
AgdEvent->Location,
Txt,
AgdEvent->AgdCod,
AgdEvent->UsrCod);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/********************** Remove all the events of a user **********************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
void Agd_DB_RemoveUsrEvents (long UsrCod)
2016-11-30 22:49:48 +01:00
{
2018-11-02 22:00:31 +01:00
DB_QueryDELETE ("can not remove all the events of a user",
"DELETE FROM agd_agendas"
" WHERE UsrCod=%ld",
2018-11-02 22:00:31 +01:00
UsrCod);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/********************* Get number of events from a user **********************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
unsigned Agd_GetNumEventsFromUsr (long UsrCod)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
/***** 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);
2016-11-30 22:49:48 +01:00
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/********************** Get number of users with events **********************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
// Returns the number of users with events in a given scope
2016-11-30 22:49:48 +01:00
2021-02-11 22:57:09 +01:00
unsigned Agd_GetNumUsrsWithEvents (Hie_Lvl_Level_t Scope)
2016-11-30 22:49:48 +01:00
{
/***** Get number of users with events from database *****/
2016-11-30 22:49:48 +01:00
switch (Scope)
{
2021-02-11 22:57:09 +01:00
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");
2021-02-11 22:57:09 +01:00
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);
2021-02-11 22:57:09 +01:00
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);
2021-02-11 22:57:09 +01:00
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);
2021-02-11 22:57:09 +01:00
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);
2021-02-11 22:57:09 +01:00
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);
2016-11-30 22:49:48 +01:00
default:
Err_WrongScopeExit ();
return 0; // Not reached
2016-11-30 22:49:48 +01:00
}
}
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
/*************************** Get number of events ****************************/
2016-11-30 22:49:48 +01:00
/*****************************************************************************/
2016-12-01 00:53:50 +01:00
// Returns the number of events in a given scope
2016-11-30 22:49:48 +01:00
2021-02-11 22:57:09 +01:00
unsigned Agd_GetNumEvents (Hie_Lvl_Level_t Scope)
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
/***** Get number of events from database *****/
2016-11-30 22:49:48 +01:00
switch (Scope)
{
2021-02-11 22:57:09 +01:00
case Hie_Lvl_SYS:
return (unsigned)
DB_QueryCOUNT ("can not get number of events",
"SELECT COUNT(*)"
" FROM agd_agendas"
" WHERE UsrCod>0");
2021-02-11 22:57:09 +01:00
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);
2021-02-11 22:57:09 +01:00
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);
2021-02-11 22:57:09 +01:00
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);
2021-02-11 22:57:09 +01:00
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);
2021-02-11 22:57:09 +01:00
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);
2016-11-30 22:49:48 +01:00
default:
Err_WrongScopeExit ();
return 0; // Not reached
2016-11-30 22:49:48 +01:00
}
2016-07-07 00:21:10 +02:00
}
2016-12-07 00:41:36 +01:00
/*****************************************************************************/
/************************** Show an agenda QR code ***************************/
/*****************************************************************************/
void Agd_PrintAgdQRCode (void)
{
extern const char *Txt_Where_s_USER;
2019-10-26 02:19:42 +02:00
/***** Begin box *****/
2019-12-30 21:47:07 +01:00
Box_BoxBegin (NULL,Str_BuildStringStr (Txt_Where_s_USER,
2020-03-26 02:54:30 +01:00
Gbl.Usrs.Me.UsrDat.FullName),
NULL,NULL,
2017-06-12 15:03:29 +02:00
NULL,Box_NOT_CLOSABLE);
2019-12-30 21:47:07 +01:00
Str_FreeString ();
2016-12-07 00:41:36 +01:00
/***** Print QR code ****/
QR_PrintQRCode ();
2017-06-12 14:16:33 +02:00
/***** End box *****/
2019-10-25 22:48:34 +02:00
Box_BoxEnd ();
2016-12-07 00:41:36 +01:00
}