swad-core/swad_holiday.h

103 lines
3.3 KiB
C
Raw Permalink Normal View History

2014-12-01 23:55:08 +01:00
// swad_holiday.h: holidays
#ifndef _SWAD_HLD
#define _SWAD_HLD
/*
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
2014-12-01 23:55:08 +01: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/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include "swad_date.h"
#include "swad_place.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
2017-03-08 14:12:33 +01:00
#define Hld_MAX_CHARS_HOLIDAY_NAME (128 - 1) // 127
#define Hld_MAX_BYTES_HOLIDAY_NAME ((Hld_MAX_CHARS_HOLIDAY_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
2014-12-01 23:55:08 +01:00
#define Hld_NUM_TYPES_HOLIDAY 2
typedef enum
{
Hld_HOLIDAY = 0,
Hld_NON_SCHOOL_PERIOD = 1,
} Hld_HolidayType_t;
2017-01-29 12:42:19 +01:00
#define Hld_HOLIDAY_TYPE_DEFAULT Hld_HOLIDAY
2014-12-01 23:55:08 +01:00
typedef enum
{
2019-12-15 20:02:34 +01:00
Hld_START_DATE,
Hld_END_DATE
2014-12-01 23:55:08 +01:00
} Hld_StartOrEndDate_t;
2020-04-13 22:04:46 +02:00
struct Hld_Holiday
2014-12-01 23:55:08 +01:00
{
long HldCod;
long PlcCod;
char PlaceFullName[Nam_MAX_BYTES_FULL_NAME + 1];
2014-12-01 23:55:08 +01:00
Hld_HolidayType_t HldTyp;
struct Dat_Date StartDate;
struct Dat_Date EndDate;
2017-03-07 19:55:29 +01:00
char Name[Hld_MAX_BYTES_HOLIDAY_NAME + 1];
2014-12-01 23:55:08 +01:00
};
2017-01-29 21:41:08 +01:00
#define Hld_NUM_ORDERS 2
2014-12-01 23:55:08 +01:00
typedef enum
{
Hld_ORDER_BY_PLACE = 0,
Hld_ORDER_BY_START_DATE = 1,
2017-01-29 12:42:19 +01:00
} Hld_Order_t;
2014-12-01 23:55:08 +01:00
#define Hld_DEFAULT_ORDER_TYPE Hld_ORDER_BY_START_DATE
2020-04-13 22:04:46 +02:00
struct Hld_Holidays
{
bool LstIsRead; // Is the list already read from database, or it needs to be read?
unsigned Num; // Number of holidays
struct Hld_Holiday *Lst; // List of holidays
Hld_Order_t SelectedOrder;
};
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
2020-04-13 22:04:46 +02:00
void Hld_ResetHolidays (struct Hld_Holidays *Holidays);
void Hld_SeeAllHolidays (void);
2019-02-15 13:39:37 +01:00
void Hld_PutIconToSeeHlds (void);
2014-12-01 23:55:08 +01:00
void Hld_EditHolidays (void);
2020-04-13 22:04:46 +02:00
void Hld_GetListHolidays (struct Hld_Holidays *Holidays);
void Hld_FreeListHolidays (struct Hld_Holidays *Holidays);
2016-11-28 14:48:16 +01:00
2019-04-09 13:44:57 +02:00
void Hld_RemoveHoliday (void);
void Hld_ChangeHolidayPlace (void);
void Hld_ChangeHolidayType (void);
void Hld_ChangeStartDate (void);
void Hld_ChangeEndDate (void);
void Hld_RenameHoliday (void);
void Hld_ContEditAfterChgHld (void);
void Hld_ReceiveNewHoliday (void);
2014-12-01 23:55:08 +01:00
#endif