2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_institution.h: institutions
|
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_INS
|
|
|
|
|
#define _SWAD_INS
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2021-02-09 12:43:45 +01:00
|
|
|
|
Copyright (C) 1999-2021 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 **********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
#include "swad_center.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_constant.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
|
|
|
|
|
{
|
|
|
|
|
Ins_STATUS_BIT_PENDING = (1 << 0), // Institution is requested, but not yet activated
|
|
|
|
|
Ins_STATUS_BIT_REMOVED = (1 << 1), // Institution has been removed
|
|
|
|
|
} Ins_Status_Bits_t;
|
2017-01-29 12:42:19 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef unsigned Ins_Status_t;
|
2017-01-29 21:41:08 +01:00
|
|
|
|
#define Ins_MAX_STATUS ((Ins_Status_t) 3)
|
|
|
|
|
#define Ins_WRONG_STATUS ((Ins_Status_t) (Ins_MAX_STATUS + 1))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#define Ins_NUM_STATUS_TXT 4
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Ins_STATUS_UNKNOWN = 0, // Other
|
|
|
|
|
Ins_STATUS_ACTIVE = 1, // 00 (Status == 0)
|
|
|
|
|
Ins_STATUS_PENDING = 2, // 01 (Status == Ins_STATUS_BIT_PENDING)
|
|
|
|
|
Ins_STATUS_REMOVED = 3, // 1- (Status & Ins_STATUS_BIT_REMOVED)
|
|
|
|
|
} Ins_StatusTxt_t;
|
|
|
|
|
|
2016-10-28 10:03:37 +02:00
|
|
|
|
#define Ins_MAX_INSTITS_PER_USR 10 // Used in list of my institutions
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Ins_Instit
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
long InsCod;
|
|
|
|
|
long CtyCod;
|
|
|
|
|
Ins_Status_t Status; // Institution status
|
|
|
|
|
long RequesterUsrCod; // User code of the person who requested the creation of this institution
|
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-07 22:07:06 +01:00
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
bool Valid;
|
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
} NumUsrsWhoClaimToBelongToIns;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
};
|
|
|
|
|
|
2017-01-29 21:41:08 +01:00
|
|
|
|
#define Ins_NUM_ORDERS 2
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Ins_ORDER_BY_INSTITUTION = 0,
|
|
|
|
|
Ins_ORDER_BY_NUM_USRS = 1,
|
2017-01-29 12:42:19 +01:00
|
|
|
|
} Ins_Order_t;
|
|
|
|
|
#define Ins_ORDER_DEFAULT Ins_ORDER_BY_NUM_USRS
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-01-08 14:04:25 +01:00
|
|
|
|
struct ListInstits
|
|
|
|
|
{
|
|
|
|
|
unsigned Num; // Number of institutions
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Ins_Instit *Lst; // List of institutions
|
2020-01-08 14:04:25 +01:00
|
|
|
|
Ins_Order_t SelectedOrder; // Order of institutions
|
|
|
|
|
};
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Ins_SeeInsWithPendingCtrs (void);
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
void Ins_DrawInstitutionLogoWithLink (struct Ins_Instit *Ins,unsigned Size);
|
|
|
|
|
void Ins_DrawInstitutionLogoAndNameWithLink (struct Ins_Instit *Ins,Act_Action_t Action,
|
2015-11-19 18:33:16 +01:00
|
|
|
|
const char *ClassLink,const char *ClassLogo);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ins_ShowInssOfCurrentCty (void);
|
|
|
|
|
void Ins_EditInstitutions (void);
|
2020-01-07 22:07:06 +01:00
|
|
|
|
void Ins_GetBasicListOfInstitutions (long CtyCod);
|
|
|
|
|
void Ins_GetFullListOfInstitutions (long CtyCod);
|
2017-03-02 00:53:34 +01:00
|
|
|
|
|
|
|
|
|
void Ins_WriteInstitutionNameAndCty (long InsCod);
|
2021-02-11 00:58:53 +01:00
|
|
|
|
bool Ins_GetDataOfInstitutionByCod (struct Ins_Instit *Ins);
|
2017-06-20 14:43:26 +02:00
|
|
|
|
void Ins_FlushCacheFullNameAndCtyOfInstitution (void);
|
2017-03-02 00:53:34 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ins_FreeListInstitutions (void);
|
2015-07-25 20:20:07 +02:00
|
|
|
|
void Ins_WriteSelectorOfInstitution (void);
|
2020-04-08 18:18:46 +02:00
|
|
|
|
void Ins_PutParamCurrentInsCod (void *InsCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ins_PutParamInsCod (long InsCod);
|
2017-05-31 21:05:59 +02:00
|
|
|
|
long Ins_GetAndCheckParamOtherInsCod (long MinCodAllowed);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ins_RemoveInstitution (void);
|
|
|
|
|
void Ins_RenameInsShort (void);
|
|
|
|
|
void Ins_RenameInsFull (void);
|
2021-02-11 00:58:53 +01:00
|
|
|
|
void Ins_RenameInstitution (struct Ins_Instit *Ins,Cns_ShrtOrFullName_t ShrtOrFullName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Ins_ChangeInsWWW (void);
|
|
|
|
|
void Ins_ChangeInsStatus (void);
|
2016-03-01 23:58:48 +01:00
|
|
|
|
void Ins_ContEditAfterChgIns (void);
|
|
|
|
|
|
2020-05-05 21:49:00 +02:00
|
|
|
|
void Ins_ReceiveFormReqIns (void);
|
|
|
|
|
void Ins_ReceiveFormNewIns (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned Ins_GetCachedNumInssInSys (void);
|
|
|
|
|
|
2020-01-07 00:42:24 +01:00
|
|
|
|
void Ins_FlushCacheNumInssInCty (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned Ins_GetNumInssInCty (long CtyCod);
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned Ins_GetCachedNumInssInCty (long CtyCod);
|
|
|
|
|
|
2021-09-10 10:19:46 +02:00
|
|
|
|
unsigned Ins_GetCachedNumInssWithCtrs (void);
|
|
|
|
|
unsigned Ins_GetCachedNumInssWithDegs (void);
|
|
|
|
|
unsigned Ins_GetCachedNumInssWithCrss (void);
|
|
|
|
|
unsigned Ins_GetCachedNumInssWithUsrs (Rol_Role_t Role);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2018-10-31 16:16:57 +01:00
|
|
|
|
void Ins_ListInssFound (MYSQL_RES **mysql_res,unsigned NumInss);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#endif
|