swad-core/swad_country.h

121 lines
4.3 KiB
C
Raw Normal View History

2014-12-01 23:55:08 +01:00
// swad_country.h: countries
#ifndef _SWAD_CTY
#define _SWAD_CTY
/*
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.
2017-01-13 01:51:23 +01:00
Copyright (C) 1999-2017 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 ***********************************/
/*****************************************************************************/
2015-10-16 02:24:29 +02:00
#include <stdbool.h> // For boolean type
2014-12-01 23:55:08 +01:00
#include "swad_action.h"
2017-03-08 14:12:33 +01:00
#include "swad_hierarchy.h"
2016-12-13 13:32:19 +01:00
#include "swad_role_type.h"
2014-12-01 23:55:08 +01:00
#include "swad_text.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
2016-10-28 10:03:37 +02:00
#define Cty_MAX_COUNTRS_PER_USR 10 // Used in list of my countries
2016-10-27 01:30:14 +02:00
2017-03-10 02:40:01 +01:00
#define Cty_MAX_CHARS_NAME (48 - 1) // 47
#define Cty_MAX_BYTES_NAME ((Cty_MAX_CHARS_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 767
2014-12-01 23:55:08 +01:00
struct Country
{
long CtyCod;
2017-01-13 01:51:23 +01:00
char Alpha2[2 + 1];
2017-03-10 02:40:01 +01:00
char Name[1 + Txt_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1];
2017-03-07 01:56:41 +01:00
char WWW [1 + Txt_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1];
2015-12-09 19:51:17 +01:00
unsigned NumUsrsWhoClaimToBelongToCty;
2014-12-01 23:55:08 +01:00
unsigned NumInss;
2015-12-09 19:51:17 +01:00
unsigned NumCtrs;
unsigned NumDegs;
unsigned NumCrss;
unsigned NumUsrs; // Number of users in courses of the institution
2014-12-01 23:55:08 +01:00
};
2017-01-29 21:41:08 +01:00
#define Cty_NUM_ORDERS 2
2014-12-01 23:55:08 +01:00
typedef enum
{
Cty_ORDER_BY_COUNTRY = 0,
Cty_ORDER_BY_NUM_USRS = 1,
2017-01-29 12:42:19 +01:00
} Cty_Order_t;
#define Cty_ORDER_DEFAULT Cty_ORDER_BY_NUM_USRS
2014-12-01 23:55:08 +01:00
typedef enum
{
2015-12-09 19:51:17 +01:00
Cty_GET_BASIC_DATA,
2014-12-01 23:55:08 +01:00
Cty_GET_EXTRA_DATA,
} Cty_GetExtraData_t;
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Cty_SeeCtyWithPendingInss (void);
void Cty_ShowConfiguration (void);
void Cty_PrintConfiguration (void);
void Cty_ListCountries (void);
void Cty_ListCountries1 (void);
void Cty_ListCountries2 (void);
2015-11-11 21:14:33 +01:00
2015-11-19 18:33:16 +01:00
void Cty_DrawCountryMapAndNameWithLink (struct Country *Cty,Act_Action_t Action,
2017-03-04 19:46:46 +01:00
const char *ClassContainer,
const char *ClassMap,
const char *ClassLink);
2015-01-16 01:28:42 +01:00
void Cty_DrawCountryMap (struct Country *Cty,const char *Class);
2015-11-11 21:14:33 +01:00
bool Cty_CheckIfCountryMapExists (struct Country *Cty);
2014-12-01 23:55:08 +01:00
void Cty_WriteScriptGoogleGeochart (void);
2017-01-29 12:42:19 +01:00
void Cty_PutHiddenParamCtyOrder (void);
2014-12-01 23:55:08 +01:00
void Cty_EditCountries (void);
void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData);
void Cty_FreeListCountries (void);
2015-07-25 20:20:07 +02:00
void Cty_WriteSelectorOfCountry (void);
2017-03-01 14:53:18 +01:00
void Cty_WriteCountryName (long CtyCod,const char *ClassLink);
2015-12-09 19:51:17 +01:00
bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraData);
2017-03-10 02:40:01 +01:00
void Cty_GetCountryName (long CtyCod,char CtyName[Cty_MAX_BYTES_NAME + 1]);
2014-12-01 23:55:08 +01:00
void Cty_PutParamCtyCod (long CtyCod);
2017-05-31 21:05:59 +02:00
long Cty_GetAndCheckParamOtherCtyCod (long MinCodAllowed);
2014-12-01 23:55:08 +01:00
void Cty_RemoveCountry (void);
void Cty_RenameCountry (void);
void Cty_ChangeCtyWWW (void);
void Cty_ChangeCtyMapAttribution (void);
void Cty_RecFormNewCountry (void);
unsigned Cty_GetNumCtysTotal (void);
unsigned Cty_GetNumCtysWithInss (const char *SubQuery);
unsigned Cty_GetNumCtysWithCtrs (const char *SubQuery);
unsigned Cty_GetNumCtysWithDegs (const char *SubQuery);
unsigned Cty_GetNumCtysWithCrss (const char *SubQuery);
unsigned Cty_GetNumCtysWithUsrs (Rol_Role_t Role,const char *SubQuery);
2017-02-28 00:59:01 +01:00
unsigned Cty_ListCtysFound (const char *Query);
2014-12-01 23:55:08 +01:00
#endif