swad-core/swad_degree.h

156 lines
5.4 KiB
C
Raw Normal View History

2014-12-01 23:55:08 +01:00
// swad_degree.h: degrees
#ifndef _SWAD_DEG
#define _SWAD_DEG
/*
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.
2019-01-07 21:52:19 +01:00
Copyright (C) 1999-2019 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-31 13:00:40 +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"
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_string.h"
/*****************************************************************************/
/***************************** Public constants ******************************/
/*****************************************************************************/
2017-01-13 01:51:23 +01:00
#define Deg_MAX_YEARS_PER_DEGREE 12 // Max number of academic years per degree
2014-12-01 23:55:08 +01:00
2017-01-13 01:51:23 +01:00
#define Deg_MAX_DEGREES_PER_USR 20 // Used in list of my degrees
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
typedef enum
{
Deg_STATUS_BIT_PENDING = (1 << 0), // Degree is requested, but not yet activated
Deg_STATUS_BIT_REMOVED = (1 << 1), // Degree has been removed
} Deg_Status_Bits_t;
2017-01-29 12:42:19 +01:00
2014-12-01 23:55:08 +01:00
typedef unsigned Deg_Status_t;
2017-01-29 21:41:08 +01:00
#define Deg_MAX_STATUS ((Deg_Status_t) 3)
#define Deg_WRONG_STATUS ((Deg_Status_t) (Deg_MAX_STATUS + 1))
2014-12-01 23:55:08 +01:00
#define Deg_NUM_STATUS_TXT 4
typedef enum
{
Deg_STATUS_UNKNOWN = 0, // Other
Deg_STATUS_ACTIVE = 1, // 00 (Status == 0)
Deg_STATUS_PENDING = 2, // 01 (Status == Deg_STATUS_BIT_PENDING)
Deg_STATUS_REMOVED = 3, // 1- (Status & Deg_STATUS_BIT_REMOVED)
} Deg_StatusTxt_t;
struct Degree
{
2017-03-11 20:59:09 +01:00
long DegCod; // Degree code
2019-04-07 12:17:10 +02:00
long DegTypCod; // Degree type code
2017-03-11 20:59:09 +01:00
long CtrCod; // Centre code
Deg_Status_t Status; // Degree status
long RequesterUsrCod; // User code of the person who requested the creation of this degree
2017-03-08 14:12:33 +01:00
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]; // Short name of degree
char FullName[Hie_MAX_BYTES_FULL_NAME + 1]; // Full name of degree
2017-03-07 01:56:41 +01:00
char WWW[Cns_MAX_BYTES_WWW + 1];
2019-04-04 10:45:15 +02:00
struct
{
unsigned Num; // Number of courses in this degree
struct Course *Lst; // List of courses in this degree
} Crss;
2014-12-01 23:55:08 +01:00
};
2016-04-16 15:05:18 +02:00
struct ListDegrees
{
2019-04-04 10:45:15 +02:00
unsigned Num; // Number of degrees
2016-04-16 15:05:18 +02:00
struct Degree *Lst; // List of degrees
};
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Deg_SeeDegWithPendingCrss (void);
2015-11-19 20:04:41 +01:00
void Deg_DrawDegreeLogoAndNameWithLink (struct Degree *Deg,Act_Action_t Action,
const char *ClassLink,const char *ClassLogo);
2014-12-01 23:55:08 +01:00
void Deg_ShowConfiguration (void);
void Deg_PrintConfiguration (void);
2016-11-14 16:47:46 +01:00
void Deg_WriteSelectorOfDegree (void);
2014-12-01 23:55:08 +01:00
void Deg_ShowDegsOfCurrentCtr (void);
unsigned Deg_ConvStrToYear (const char *StrYear);
void Deg_EditDegrees (void);
2018-11-15 12:52:56 +01:00
void Deg_PutIconToViewDegrees (void);
2016-04-16 15:05:18 +02:00
void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs);
2016-10-20 00:57:00 +02:00
void Deg_GetListDegsOfCurrentCtr (void);
2016-04-16 15:05:18 +02:00
void Deg_FreeListDegs (struct ListDegrees *Degs);
2014-12-01 23:55:08 +01:00
void Deg_RecFormReqDeg (void);
void Deg_RecFormNewDeg (void);
void Deg_RemoveDegree (void);
void Deg_PutParamDegCod (long DegCod);
2017-05-31 21:05:59 +02:00
long Deg_GetAndCheckParamOtherDegCod (long MinCodAllowed);
2014-12-01 23:55:08 +01:00
bool Deg_GetDataOfDegreeByCod (struct Degree *Deg);
void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg);
2015-02-03 11:34:59 +01:00
long Deg_GetCtrCodOfDegreeByCod (long DegCod);
2014-12-01 23:55:08 +01:00
long Deg_GetInsCodOfDegreeByCod (long DegCod);
2016-03-20 16:30:52 +01:00
void Deg_RemoveDegreeCompletely (long DegCod);
2014-12-01 23:55:08 +01:00
void Deg_RenameDegreeShort (void);
void Deg_RenameDegreeFull (void);
2019-04-07 12:17:10 +02:00
void Deg_RenameDegreeShortInConfig (void);
2016-10-23 16:04:36 +02:00
void Deg_RenameDegreeFullInConfig (void);
2016-10-20 16:49:42 +02:00
void Deg_ChangeDegCtrInConfig (void);
2016-10-19 20:43:26 +02:00
void Deg_ContEditAfterChgDegInConfig (void);
2019-04-07 12:17:10 +02:00
void Deg_ChangeDegreeType (void);
2014-12-01 23:55:08 +01:00
void Deg_ChangeDegWWW (void);
2016-10-23 16:37:45 +02:00
void Deg_ChangeDegWWWInConfig (void);
2014-12-01 23:55:08 +01:00
void Deg_ChangeDegStatus (void);
2019-04-08 14:52:13 +02:00
void Deg_ContEditAfterChgDeg (void);
2016-03-20 16:30:52 +01:00
2015-01-17 19:31:21 +01:00
void Deg_RequestLogo (void);
void Deg_ReceiveLogo (void);
2015-02-03 18:43:55 +01:00
void Deg_RemoveLogo (void);
2014-12-01 23:55:08 +01:00
unsigned Deg_GetNumDegsTotal (void);
unsigned Deg_GetNumDegsInCty (long InsCod);
unsigned Deg_GetNumDegsInIns (long InsCod);
unsigned Deg_GetNumDegsInCtr (long CtrCod);
unsigned Deg_GetNumDegsWithCrss (const char *SubQuery);
unsigned Deg_GetNumDegsWithUsrs (Rol_Role_t Role,const char *SubQuery);
2018-10-30 17:47:57 +01:00
void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumCrss);
2014-12-01 23:55:08 +01:00
#endif