2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_centre.h: centres
|
|
|
|
|
|
|
|
|
|
#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.
|
2020-01-01 14:53:57 +01:00
|
|
|
|
Copyright (C) 1999-2020 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 ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Ctr_STATUS_BIT_PENDING = (1 << 0), // Centre is requested, but not yet activated
|
|
|
|
|
Ctr_STATUS_BIT_REMOVED = (1 << 1), // Centre has been removed
|
|
|
|
|
} Ctr_Status_Bits_t;
|
2017-01-29 12:42:19 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef unsigned Ctr_Status_t;
|
2017-01-29 21:41:08 +01:00
|
|
|
|
#define Ctr_MAX_STATUS ((Ctr_Status_t) 3)
|
|
|
|
|
#define Ctr_WRONG_STATUS ((Ctr_Status_t) (Ctr_MAX_STATUS + 1))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#define Ctr_NUM_STATUS_TXT 4
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Ctr_STATUS_UNKNOWN = 0, // Other
|
|
|
|
|
Ctr_STATUS_ACTIVE = 1, // 00 (Status == 0)
|
|
|
|
|
Ctr_STATUS_PENDING = 2, // 01 (Status == Ctr_STATUS_BIT_PENDING)
|
|
|
|
|
Ctr_STATUS_REMOVED = 3, // 1- (Status & Ctr_STATUS_BIT_REMOVED)
|
|
|
|
|
} Ctr_StatusTxt_t;
|
|
|
|
|
|
|
|
|
|
#define Ctr_MAX_CENTRES_PER_USR 10 // Used in list of my centres
|
|
|
|
|
|
|
|
|
|
struct Centre
|
|
|
|
|
{
|
|
|
|
|
long CtrCod; // Centre code
|
|
|
|
|
long InsCod; // Institution code
|
|
|
|
|
long PlcCod; // Place code
|
|
|
|
|
Ctr_Status_t Status; // Centre status
|
|
|
|
|
long RequesterUsrCod; // User code of the person who requested the creation of this centre
|
2019-12-19 11:00:14 +01:00
|
|
|
|
struct Coordinates Coord; // Geographical coordinates
|
2017-03-08 14:12:33 +01:00
|
|
|
|
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
|
|
|
|
|
char FullName[Hie_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
|
|
|
|
|
{
|
|
|
|
|
Ctr_ORDER_BY_CENTRE = 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;
|
|
|
|
|
#define Ctr_ORDER_DEFAULT Ctr_ORDER_BY_CENTRE
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-01-08 14:04:25 +01:00
|
|
|
|
struct ListCentres
|
|
|
|
|
{
|
|
|
|
|
unsigned Num; // Number of centres
|
|
|
|
|
struct Centre *Lst; // List of centres
|
|
|
|
|
Ctr_Order_t SelectedOrder; // Order of centres
|
|
|
|
|
};
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Public prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Ctr_SeeCtrWithPendingDegs (void);
|
|
|
|
|
|
2015-11-19 19:37:44 +01:00
|
|
|
|
void Ctr_DrawCentreLogoAndNameWithLink (struct Centre *Ctr,Act_Action_t Action,
|
|
|
|
|
const char *ClassLink,const char *ClassLogo);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_ShowCtrsOfCurrentIns (void);
|
|
|
|
|
void Ctr_EditCentres (void);
|
2018-11-15 10:13:53 +01:00
|
|
|
|
|
|
|
|
|
void Ctr_PutIconToViewCentres (void);
|
|
|
|
|
|
2020-01-08 00:47:10 +01:00
|
|
|
|
void Ctr_GetBasicListOfCentres (long InsCod);
|
|
|
|
|
void Ctr_GetFullListOfCentres (long InsCod);
|
2020-01-05 02:18:20 +01:00
|
|
|
|
bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr);
|
2015-02-03 11:34:59 +01:00
|
|
|
|
long Ctr_GetInsCodOfCentreByCod (long CtrCod);
|
2015-10-10 22:16:46 +02:00
|
|
|
|
void Ctr_GetShortNameOfCentreByCod (struct Centre *Ctr);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_FreeListCentres (void);
|
2015-07-25 20:20:07 +02:00
|
|
|
|
void Ctr_WriteSelectorOfCentre (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_PutParamCtrCod (long CtrCod);
|
2017-05-31 21:05:59 +02:00
|
|
|
|
long Ctr_GetAndCheckParamOtherCtrCod (long MinCodAllowed);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_RemoveCentre (void);
|
2017-06-12 19:14:05 +02:00
|
|
|
|
void Ctr_ChangeCtrPlc (void);
|
2019-12-29 14:02:58 +01:00
|
|
|
|
void Ctr_UpdateCtrPlcDB (long CtrCod,long NewPlcCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_RenameCentreShort (void);
|
|
|
|
|
void Ctr_RenameCentreFull (void);
|
2019-12-29 14:02:58 +01:00
|
|
|
|
void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName);
|
|
|
|
|
bool Ctr_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Name,
|
|
|
|
|
long CtrCod,long InsCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_ChangeCtrWWW (void);
|
2019-12-29 14:02:58 +01:00
|
|
|
|
void Ctr_UpdateCtrWWWDB (long CtrCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_ChangeCtrStatus (void);
|
2016-03-01 19:23:02 +01:00
|
|
|
|
void Ctr_ContEditAfterChgCtr (void);
|
2015-01-17 13:31:25 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ctr_RecFormReqCtr (void);
|
|
|
|
|
void Ctr_RecFormNewCtr (void);
|
|
|
|
|
|
2020-01-25 22:18:01 +01:00
|
|
|
|
unsigned Ctr_GetNumCtrsInSys (void);
|
2020-01-07 16:37:46 +01:00
|
|
|
|
void Ctr_FlushCacheNumCtrsInCty (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned Ctr_GetNumCtrsInCty (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-01-26 14:10:27 +01:00
|
|
|
|
unsigned Ctr_GetNumCtrsWithMapInSys (void);
|
|
|
|
|
unsigned Ctr_GetNumCtrsWithMapInCty (long CtyCod);
|
|
|
|
|
unsigned Ctr_GetNumCtrsWithMapInIns (long InsCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned Ctr_GetNumCtrsInPlc (long PlcCod);
|
|
|
|
|
unsigned Ctr_GetNumCtrsWithDegs (const char *SubQuery);
|
|
|
|
|
unsigned Ctr_GetNumCtrsWithCrss (const char *SubQuery);
|
|
|
|
|
unsigned Ctr_GetNumCtrsWithUsrs (Rol_Role_t Role,const char *SubQuery);
|
|
|
|
|
|
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
|
|
|
|
|
2020-01-09 15:36:12 +01:00
|
|
|
|
bool Ctr_GetIfMapIsAvailable (const struct Centre *Ctr);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#endif
|