swad-core/swad_agenda.h

140 lines
4.6 KiB
C
Raw Permalink Normal View History

2016-07-07 00:21:10 +02:00
// swad_agenda.h: user's agenda (personal organizer)
#ifndef _SWAD_AGD
#define _SWAD_AGD
/*
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-2024 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 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/>.
*/
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
/********************************* Headers ***********************************/
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
#include "swad_date.h"
#include "swad_user.h"
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
/************************** Public types and constants ***********************/
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2017-03-08 14:12:33 +01:00
#define Agd_MAX_CHARS_EVENT (128 - 1) // 127
#define Agd_MAX_BYTES_EVENT ((Agd_MAX_CHARS_EVENT + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
2016-11-30 22:49:48 +01:00
2017-03-08 20:31:49 +01:00
#define Agd_MAX_CHARS_LOCATION (128 - 1) // 127
#define Agd_MAX_BYTES_LOCATION ((Agd_MAX_CHARS_LOCATION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
2020-04-08 03:06:45 +02:00
struct Agd_Event
2016-11-30 22:49:48 +01:00
{
2016-12-01 00:53:50 +01:00
long AgdCod;
2016-11-30 22:49:48 +01:00
long UsrCod;
2016-12-03 19:22:06 +01:00
bool Public;
HidVis_HiddenOrVisible_t HiddenOrVisible;
2020-04-28 13:12:18 +02:00
time_t TimeUTC[Dat_NUM_START_END_TIME];
2016-12-02 10:45:53 +01:00
Dat_TimeStatus_t TimeStatus;
char Title[Agd_MAX_BYTES_EVENT + 1];
2017-03-07 01:56:41 +01:00
char Location[Agd_MAX_BYTES_LOCATION + 1];
2016-11-30 22:49:48 +01:00
};
2016-12-03 23:13:49 +01:00
#define Agd_NUM_PAST_FUTURE_EVENTS 2
2016-12-03 23:13:49 +01:00
typedef enum
{
2017-03-21 14:36:22 +01:00
Agd_PAST___EVENTS = 0, // Events until yesterday (included)
Agd_FUTURE_EVENTS = 1, // Events from today (included) onwards
} Agd_Past__FutureEvents_t;
#define Agd_DEFAULT_PAST___EVENTS (0 << Agd_PAST___EVENTS) // off
#define Agd_DEFAULT_FUTURE_EVENTS (1 << Agd_FUTURE_EVENTS) // on
#define Agd_NUM_PRIVAT_PUBLIC_EVENTS 2
2017-03-21 00:57:11 +01:00
typedef enum
{
2017-03-21 14:36:22 +01:00
Agd_PRIVAT_EVENTS = 0,
Agd_PUBLIC_EVENTS = 1,
} Agd_PrivatPublicEvents_t;
#define Agd_DEFAULT_PRIVAT_EVENTS (1 << Agd_PRIVAT_EVENTS) // on
#define Agd_DEFAULT_PUBLIC_EVENTS (1 << Agd_PUBLIC_EVENTS) // on
#define Agd_DEFAULT_HIDDEN_EVENTS (0 << HidVis_HIDDEN) // off
#define Agd_DEFAULT_VISIBL_EVENTS (1 << HidVis_VISIBLE) // on
2016-11-30 22:49:48 +01:00
#define Agd_ORDER_DEFAULT Dat_STR_TIME
2016-07-07 00:21:10 +02:00
2020-03-26 02:54:30 +01:00
struct Agd_Agenda
{
bool LstIsRead; // Is the list already read from database, or it needs to be read?
unsigned Num; // Number of events
long *LstAgdCods; // List of agenda codes
unsigned Past__FutureEvents;
unsigned PrivatPublicEvents;
unsigned HiddenVisiblEvents;
2020-04-05 22:53:58 +02:00
Dat_StartEndTime_t SelectedOrder;
2020-03-26 02:54:30 +01:00
long AgdCodToEdit; // Used as parameter in contextual links
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;
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
2016-11-30 22:49:48 +01:00
/***************************** Public prototypes *****************************/
2016-07-07 00:21:10 +02:00
/*****************************************************************************/
Usr_Can_t Agd_CheckIfICanViewUsrAgenda (struct Usr_Data *UsrDat);
2016-12-04 04:22:36 +01:00
void Agd_PutFormLogInToShowUsrAgenda (void);
void Agd_PutParAgd (void);
2016-12-05 13:26:12 +01:00
void Agd_GetParsAndShowMyAgenda (void);
2016-12-06 21:26:02 +01:00
void Agd_ShowUsrAgenda (void);
void Agd_ShowOtherAgendaAfterLogIn (void);
2016-12-02 00:24:16 +01:00
void Agd_ReqCreatOrEditEvent (void);
2017-03-21 14:36:22 +01:00
void Agd_PutParsMyAgenda (unsigned Past__FutureEvents,
2017-04-13 20:09:22 +02:00
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);
void Agd_PutParEventsOrder (Dat_StartEndTime_t SelectedOrder);
2017-03-21 14:36:22 +01:00
2016-12-01 00:53:50 +01:00
void Agd_AskRemEvent (void);
void Agd_RemoveEvent (void);
2016-12-03 19:22:06 +01:00
void Agd_HideEvent (void);
2016-12-06 19:14:58 +01:00
void Agd_UnhideEvent (void);
2016-12-03 19:22:06 +01:00
void Agd_MakeEventPrivate (void);
void Agd_MakeEventPublic (void);
void Agd_ReceiveEvent (void);
2016-12-03 19:22:06 +01:00
2016-12-07 00:41:36 +01:00
void Agd_PrintAgdQRCode (void);
//-------------------------------- Figures ------------------------------------
void Agd_GetAndShowAgendasStats (void);
2016-07-07 00:21:10 +02:00
#endif