2021-03-07 21:21:04 +01:00
|
|
|
|
// swad_center.h: centers
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_CTR
|
|
|
|
|
#define _SWAD_CTR
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Copyright (C) 1999-2023 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 ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2018-10-30 13:59:37 +01:00
|
|
|
|
#include <mysql/mysql.h> // To access MySQL databases
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_action.h"
|
|
|
|
|
#include "swad_constant.h"
|
2016-10-20 00:57:00 +02:00
|
|
|
|
#include "swad_degree.h"
|
2019-12-18 20:55:56 +01:00
|
|
|
|
#include "swad_map.h"
|
2016-12-13 13:32:19 +01:00
|
|
|
|
#include "swad_role_type.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Public types and constants ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
#define Ctr_MAX_CENTERS_PER_USR 10 // Used in list of my centers
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
struct Ctr_Center
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
long CtrCod; // Center code
|
2014-12-01 23:55:08 +01:00
|
|
|
|
long InsCod; // Institution code
|
|
|
|
|
long PlcCod; // Place code
|
2021-11-10 10:53:08 +01:00
|
|
|
|
Hie_Status_t Status; // Center status
|
2021-03-07 21:21:04 +01:00
|
|
|
|
long RequesterUsrCod; // User code of the person who requested the creation of this center
|
2021-05-22 12:34:10 +02:00
|
|
|
|
struct Map_Coordinates Coord; // Geographical coordinates
|
2021-02-11 22:57:09 +01:00
|
|
|
|
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1];
|
|
|
|
|
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
|
2017-03-07 01:56:41 +01:00
|
|
|
|
char WWW[Cns_MAX_BYTES_WWW + 1];
|
2020-01-08 00:47:10 +01:00
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
bool Valid;
|
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
} NumUsrsWhoClaimToBelongToCtr;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
};
|
|
|
|
|
|
2017-01-29 21:41:08 +01:00
|
|
|
|
#define Ctr_NUM_ORDERS 2
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
Ctr_ORDER_BY_CENTER = 0,
|
2019-12-15 20:02:34 +01:00
|
|
|
|
Ctr_ORDER_BY_NUM_USRS = 1,
|
2017-01-29 12:42:19 +01:00
|
|
|
|
} Ctr_Order_t;
|
2021-03-07 21:21:04 +01:00
|
|
|
|
#define Ctr_ORDER_DEFAULT Ctr_ORDER_BY_CENTER
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2023-07-11 19:12:24 +02:00
|
|
|
|
struct Ctr_ListCtrs
|
2020-01-08 14:04:25 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
unsigned Num; // Number of centers
|
|
|
|
|
struct Ctr_Center *Lst; // List of centers
|
|
|
|
|
Ctr_Order_t SelectedOrder; // Order of centers
|
2020-01-08 14:04:25 +01:00
|
|
|
|
};
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Public prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Ctr_SeeCtrWithPendingDegs (void);
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
void Ctr_DrawCenterLogoAndNameWithLink (struct Ctr_Center *Ctr,Act_Action_t Action,
|
2021-12-26 22:39:16 +01:00
|
|
|
|
const char *ClassLogo);
|
2015-11-19 19:37:44 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_ShowCtrsOfCurrentIns (void);
|
2021-03-07 21:21:04 +01:00
|
|
|
|
void Ctr_EditCenters (void);
|
2018-11-15 10:13:53 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
void Ctr_GetBasicListOfCenters (long InsCod);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
void Ctr_GetFullListOfCenters (long InsCod,Ctr_Order_t SelectedOrder);
|
2023-03-23 09:35:20 +01:00
|
|
|
|
bool Ctr_GetCenterDataByCod (struct Ctr_Center *Ctr);
|
2021-03-07 21:21:04 +01:00
|
|
|
|
void Ctr_FreeListCenters (void);
|
|
|
|
|
void Ctr_WriteSelectorOfCenter (void);
|
|
|
|
|
void Ctr_RemoveCenter (void);
|
2017-06-12 19:14:05 +02:00
|
|
|
|
void Ctr_ChangeCtrPlc (void);
|
2021-03-07 21:21:04 +01:00
|
|
|
|
void Ctr_RenameCenterShort (void);
|
|
|
|
|
void Ctr_RenameCenterFull (void);
|
|
|
|
|
void Ctr_RenameCenter (struct Ctr_Center *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_ChangeCtrWWW (void);
|
|
|
|
|
void Ctr_ChangeCtrStatus (void);
|
2016-03-01 19:23:02 +01:00
|
|
|
|
void Ctr_ContEditAfterChgCtr (void);
|
2015-01-17 13:31:25 +01:00
|
|
|
|
|
2020-05-05 21:49:00 +02:00
|
|
|
|
void Ctr_ReceiveFormReqCtr (void);
|
|
|
|
|
void Ctr_ReceiveFormNewCtr (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned Ctr_GetCachedNumCtrsInSys (void);
|
|
|
|
|
|
2020-01-07 16:37:46 +01:00
|
|
|
|
void Ctr_FlushCacheNumCtrsInCty (void);
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned Ctr_GetCachedNumCtrsInCty (long CtyCod);
|
|
|
|
|
|
2020-01-07 00:09:30 +01:00
|
|
|
|
void Ctr_FlushCacheNumCtrsInIns (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned Ctr_GetNumCtrsInIns (long InsCod);
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned Ctr_GetCachedNumCtrsInIns (long InsCod);
|
|
|
|
|
|
|
|
|
|
unsigned Ctr_GetCachedNumCtrsWithMapInSys (void);
|
2020-05-03 21:56:55 +02:00
|
|
|
|
unsigned Ctr_GetCachedNumCtrsWithMapInCty (long CtyCod);
|
|
|
|
|
unsigned Ctr_GetCachedNumCtrsWithMapInIns (long InsCod);
|
|
|
|
|
|
2021-09-10 10:19:46 +02:00
|
|
|
|
unsigned Ctr_GetCachedNumCtrsWithDegs (void);
|
|
|
|
|
unsigned Ctr_GetCachedNumCtrsWithCrss (void);
|
|
|
|
|
unsigned Ctr_GetCachedNumCtrsWithUsrs (Rol_Role_t Role);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2018-10-30 13:59:37 +01:00
|
|
|
|
void Ctr_ListCtrsFound (MYSQL_RES **mysql_res,unsigned NumCtrs);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
bool Ctr_GetIfMapIsAvailable (const struct Ctr_Center *Ctr);
|
2020-01-09 15:36:12 +01:00
|
|
|
|
|
2021-11-03 21:31:16 +01:00
|
|
|
|
void Ctr_GetMyCenters (void);
|
|
|
|
|
void Ctr_FreeMyCenters (void);
|
|
|
|
|
bool Ctr_CheckIfIBelongToCtr (long CtrCod);
|
|
|
|
|
void Ctr_FlushCacheUsrBelongsToCtr (void);
|
|
|
|
|
bool Ctr_CheckIfUsrBelongsToCtr (long UsrCod,long CtrCod);
|
|
|
|
|
|
2021-11-03 23:37:01 +01:00
|
|
|
|
void Ctr_FlushCacheNumUsrsWhoClaimToBelongToCtr (void);
|
|
|
|
|
unsigned Ctr_GetNumUsrsWhoClaimToBelongToCtr (struct Ctr_Center *Ctr);
|
|
|
|
|
unsigned Ctr_GetCachedNumUsrsWhoClaimToBelongToCtr (struct Ctr_Center *Ctr);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#endif
|