2021-06-02 00:08:30 +02:00
|
|
|
|
// swad_center_database.h: centers operations with database
|
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_CTR_DB
|
|
|
|
|
#define _SWAD_CTR_DB
|
|
|
|
|
/*
|
|
|
|
|
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
|
2021-06-02 00:08:30 +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/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-06-02 13:09:30 +02:00
|
|
|
|
#include <mysql/mysql.h> // To access MySQL databases
|
2021-06-02 00:08:30 +02:00
|
|
|
|
|
2021-06-02 13:09:30 +02:00
|
|
|
|
#include "swad_center.h"
|
|
|
|
|
#include "swad_constant.h"
|
2021-06-02 23:24:40 +02:00
|
|
|
|
#include "swad_media.h"
|
2021-10-15 01:39:56 +02:00
|
|
|
|
#include "swad_search.h"
|
2021-06-02 00:08:30 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Public prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-18 15:15:29 +02:00
|
|
|
|
long Ctr_DB_CreateCenter (const struct Hie_Node *Ctr,Hie_Status_t Status);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
|
|
|
|
|
unsigned Ctr_DB_GetListOfCtrsInCurrentIns (MYSQL_RES **mysql_res);
|
|
|
|
|
unsigned Ctr_DB_GetListOfCtrsFull (MYSQL_RES **mysql_res,long InsCod);
|
|
|
|
|
unsigned Ctr_DB_GetListOfCtrsFullWithNumUsrs (MYSQL_RES **mysql_res,
|
2023-09-18 15:15:29 +02:00
|
|
|
|
long InsCod,Hie_Order_t SelectedOrder);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
unsigned Ctr_DB_GetCtrsWithPendingDegs (MYSQL_RES **mysql_res);
|
2023-03-23 09:35:20 +01:00
|
|
|
|
unsigned Ctr_DB_GetCenterDataByCod (MYSQL_RES **mysql_res,long CtrCod);
|
2023-09-18 11:19:00 +02:00
|
|
|
|
unsigned Ctr_DB_GetCoordByCod (MYSQL_RES **mysql_res,long CtrCod);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
long Ctr_DB_GetInsCodOfCenterByCod (long CtrCod);
|
2023-10-10 10:51:21 +02:00
|
|
|
|
void Ctr_DB_GetShortNameOfCenterByCod (long CtrCod,char ShrtName[Nam_MAX_BYTES_SHRT_NAME + 1]);
|
2021-06-02 23:24:40 +02:00
|
|
|
|
unsigned Ctr_DB_GetPhotoAttribution (MYSQL_RES **mysql_res,long CtrCod);
|
2023-03-10 00:13:55 +01:00
|
|
|
|
bool Ctr_DB_CheckIfCtrNameExistsInIns (const char *FldName,const char *Name,
|
2023-10-10 14:42:33 +02:00
|
|
|
|
long Cod,long PrtCod,
|
|
|
|
|
__attribute__((unused)) unsigned Year);
|
2021-10-15 01:39:56 +02:00
|
|
|
|
|
|
|
|
|
unsigned Ctr_DB_SearchCtrs (MYSQL_RES **mysql_res,
|
|
|
|
|
const char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1],
|
|
|
|
|
const char *RangeQuery);
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Ctr_DB_GetNumCtrsInSys (__attribute__((unused)) long SysCod);
|
2021-06-02 20:47:31 +02:00
|
|
|
|
unsigned Ctr_DB_GetNumCtrsInCty (long CtyCod);
|
|
|
|
|
unsigned Ctr_DB_GetNumCtrsInIns (long InsCod);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
unsigned Ctr_DB_GetNumCtrsInPlc (long PlcCod);
|
2021-06-02 20:47:31 +02:00
|
|
|
|
unsigned Ctr_DB_GetNumCtrsWithMap (void);
|
|
|
|
|
unsigned Ctr_DB_GetNumCtrsWithMapInCty (long CtyCod);
|
|
|
|
|
unsigned Ctr_DB_GetNumCtrsWithMapInIns (long InsCod);
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Ctr_DB_GetNumCtrsWithDegs (Hie_Level_t Level,long Cod);
|
|
|
|
|
unsigned Ctr_DB_GetNumCtrsWithCrss (Hie_Level_t Level,long Cod);
|
2021-09-10 10:19:46 +02:00
|
|
|
|
unsigned Ctr_DB_GetNumCtrsWithUsrs (Rol_Role_t Role,
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Hie_Level_t Level,long Cod);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
|
2021-06-02 23:24:40 +02:00
|
|
|
|
void Ctr_DB_UpdateCtrIns (long CtrCod,long NewInsCod);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
void Ctr_DB_UpdateCtrPlc (long CtrCod,long NewPlcCod);
|
2023-10-11 09:55:06 +02:00
|
|
|
|
void Ctr_DB_UpdateCtrName (long CtrCod,
|
|
|
|
|
const char *FldName,const char *NewCtrName);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
void Ctr_DB_UpdateCtrWWW (long CtrCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
2021-06-02 23:24:40 +02:00
|
|
|
|
void Ctr_DB_UpdateCtrPhotoAttribution (long CtrCod,const char NewPhotoAttribution[Med_MAX_BYTES_ATTRIBUTION + 1]);
|
|
|
|
|
void Ctr_DB_UpdateCtrCoordinate (long CtrCod,
|
|
|
|
|
const char *CoordField,double NewCoord);
|
2021-11-10 10:53:08 +01:00
|
|
|
|
void Ctr_DB_UpdateCtrStatus (long CtrCod,Hie_Status_t NewStatus);
|
2021-06-02 13:09:30 +02:00
|
|
|
|
|
2021-10-24 18:16:12 +02:00
|
|
|
|
|
2021-11-05 23:41:26 +01:00
|
|
|
|
bool Ctr_DB_CheckIfMapIsAvailableInIns (long InsCod);
|
2023-09-18 11:19:00 +02:00
|
|
|
|
void Ctr_DB_GetAvgCoordAndZoom (struct Map_Coordinates *Coord,unsigned *Zoom);
|
|
|
|
|
void Ctr_DB_GetAvgCoordAndZoomInCurrentIns (struct Map_Coordinates *Coord,unsigned *Zoom);
|
2021-10-24 18:16:12 +02:00
|
|
|
|
unsigned Ctr_DB_GetCtrsWithCoords (MYSQL_RES **mysql_res);
|
|
|
|
|
unsigned Ctr_DB_GetCtrsWithCoordsInCurrentIns (MYSQL_RES **mysql_res);
|
|
|
|
|
|
2023-10-03 15:35:36 +02:00
|
|
|
|
unsigned Ctr_DB_GetMyCtrs (MYSQL_RES **mysql_res,long PrtCod);
|
2023-09-20 10:36:07 +02:00
|
|
|
|
bool Ctr_DB_CheckIfUsrBelongsToCtr (long UsrCod,long HieCod,
|
|
|
|
|
bool CountOnlyAcceptedCourses);
|
2021-11-03 23:37:01 +01:00
|
|
|
|
unsigned Ctr_DB_GetNumUsrsWhoClaimToBelongToCtr (long CtrCod);
|
2021-11-03 21:31:16 +01:00
|
|
|
|
|
2021-06-02 13:09:30 +02:00
|
|
|
|
void Ctr_DB_RemoveCenter (long CtrCod);
|
|
|
|
|
|
2021-06-02 00:08:30 +02:00
|
|
|
|
#endif
|