2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_degree.c: degrees
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
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.
|
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 ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-10-16 02:24:29 +02:00
|
|
|
|
#include <stdbool.h> // For boolean type
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include <stddef.h> // For NULL
|
2020-01-03 22:16:51 +01:00
|
|
|
|
#include <stdlib.h> // For free
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <string.h> // For string functions
|
|
|
|
|
|
2021-06-11 11:36:34 +02:00
|
|
|
|
#include "swad_admin_database.h"
|
2021-09-14 20:28:07 +02:00
|
|
|
|
#include "swad_browser_database.h"
|
2021-05-28 19:59:55 +02:00
|
|
|
|
#include "swad_course_database.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_database.h"
|
|
|
|
|
#include "swad_degree.h"
|
2019-12-29 13:13:09 +01:00
|
|
|
|
#include "swad_degree_config.h"
|
2021-05-27 23:30:16 +02:00
|
|
|
|
#include "swad_degree_database.h"
|
2021-06-09 20:27:57 +02:00
|
|
|
|
#include "swad_enrolment_database.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_figure.h"
|
2020-05-02 13:39:59 +02:00
|
|
|
|
#include "swad_figure_cache.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2021-09-15 20:21:02 +02:00
|
|
|
|
#include "swad_forum_database.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_global.h"
|
2021-02-11 22:57:09 +01:00
|
|
|
|
#include "swad_hierarchy.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2015-01-17 13:31:25 +01:00
|
|
|
|
#include "swad_logo.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_message.h"
|
2021-10-05 00:54:19 +02:00
|
|
|
|
#include "swad_photo_database.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_survey.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Public constants ********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private types *********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Deg_FIRST_YEAR,
|
|
|
|
|
Deg_LAST_YEAR,
|
|
|
|
|
} Deg_FirstOrLastYear_t;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/**************************** Private variables ******************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static struct Deg_Degree *Deg_EditingDeg = NULL; // Static variable to keep the degree being edited
|
2019-04-07 12:17:10 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Private prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Deg_ListDegreesForEdition (void);
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static bool Deg_CheckIfICanEditADegree (struct Deg_Degree *Deg);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static Deg_StatusTxt_t Deg_GetStatusTxtFromStatusBits (Deg_Status_t Status);
|
|
|
|
|
static Deg_Status_t Deg_GetStatusBitsFromStatusTxt (Deg_StatusTxt_t StatusTxt);
|
|
|
|
|
static void Deg_PutFormToCreateDegree (void);
|
|
|
|
|
static void Deg_PutHeadDegreesForSeeing (void);
|
|
|
|
|
static void Deg_PutHeadDegreesForEdition (void);
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static void Deg_ListDegrees (void);
|
2016-11-07 00:03:50 +01:00
|
|
|
|
static bool Deg_CheckIfICanCreateDegrees (void);
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Deg_PutIconsListingDegrees (__attribute__((unused)) void *Args);
|
2016-03-20 13:18:56 +01:00
|
|
|
|
static void Deg_PutIconToEditDegrees (void);
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Deg_ListOneDegreeForSeeing (struct Deg_Degree *Deg,unsigned NumDeg);
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
2019-04-07 12:17:10 +02:00
|
|
|
|
static void Deg_EditDegreesInternal (void);
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Deg_PutIconsEditingDegrees (__attribute__((unused)) void *Args);
|
2017-04-30 02:56:25 +02:00
|
|
|
|
|
2020-05-05 21:49:00 +02:00
|
|
|
|
static void Deg_ReceiveFormRequestOrCreateDeg (unsigned Status);
|
2020-10-13 22:34:31 +02:00
|
|
|
|
static void Deg_PutParamOtherDegCod (void *DegCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Deg_GetDataOfDegreeFromRow (struct Deg_Degree *Deg,MYSQL_ROW row);
|
2017-03-09 11:16:17 +01:00
|
|
|
|
|
2019-04-08 14:52:13 +02:00
|
|
|
|
static void Deg_ShowAlertAndButtonToGoToDeg (void);
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Deg_PutParamGoToDeg (void *DegCod);
|
2017-05-11 20:04:38 +02:00
|
|
|
|
|
2019-04-07 12:17:10 +02:00
|
|
|
|
static void Deg_EditingDegreeConstructor (void);
|
|
|
|
|
static void Deg_EditingDegreeDestructor (void);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* List degrees with pending courses ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_SeeDegWithPendingCrss (void)
|
|
|
|
|
{
|
2020-01-30 20:47:00 +01:00
|
|
|
|
extern const char *Hlp_SYSTEM_Pending;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Degrees_with_pending_courses;
|
|
|
|
|
extern const char *Txt_Degree;
|
|
|
|
|
extern const char *Txt_Courses_ABBREVIATION;
|
|
|
|
|
extern const char *Txt_There_are_no_degrees_with_requests_for_courses_to_be_confirmed;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned NumDegs;
|
|
|
|
|
unsigned NumDeg;
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Deg_Degree Deg;
|
2015-09-04 19:26:08 +02:00
|
|
|
|
const char *BgColor;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get degrees with pending courses *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if ((NumDegs = Deg_DB_GetDegsWithPendingCrss (&mysql_res)))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableBegin (NULL,Txt_Degrees_with_pending_courses,
|
|
|
|
|
NULL,NULL,
|
2020-01-30 20:47:00 +01:00
|
|
|
|
Hlp_SYSTEM_Pending,Box_NOT_CLOSABLE,2);
|
2017-06-12 14:16:33 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Write heading *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-11 15:36:50 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HTM_TH (1,1,"LM",Txt_Degree);
|
|
|
|
|
HTM_TH (1,1,"RM",Txt_Courses_ABBREVIATION);
|
2019-10-11 15:36:50 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** List the degrees *****/
|
|
|
|
|
for (NumDeg = 0;
|
|
|
|
|
NumDeg < NumDegs;
|
|
|
|
|
NumDeg++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
|
|
|
|
|
{
|
|
|
|
|
/* Get next degree */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Get degree code (row[0]) */
|
|
|
|
|
Deg.DegCod = Str_ConvertStrCodToLongCod (row[0]);
|
|
|
|
|
BgColor = (Deg.DegCod == Gbl.Hierarchy.Deg.DegCod) ? "LIGHT_BLUE" :
|
|
|
|
|
Gbl.ColorRows[Gbl.RowEvenOdd];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Get data of degree */
|
|
|
|
|
Deg_GetDataOfDegreeByCod (&Deg);
|
2019-10-07 00:05:24 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Begin table row */
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Degree logo and full name */
|
|
|
|
|
HTM_TD_Begin ("class=\"LM %s\"",BgColor);
|
|
|
|
|
Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeCrs,
|
|
|
|
|
"BT_LINK DAT_NOBR","CM");
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 00:05:24 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Number of pending courses (row[1]) */
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM %s\"",BgColor);
|
|
|
|
|
HTM_Txt (row[1]);
|
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* End table row */
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table and box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-02-16 14:37:34 +01:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_There_are_no_degrees_with_requests_for_courses_to_be_confirmed);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-19 20:04:41 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Draw degree logo and name with link ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
void Deg_DrawDegreeLogoAndNameWithLink (struct Deg_Degree *Deg,Act_Action_t Action,
|
2015-11-19 20:04:41 +01:00
|
|
|
|
const char *ClassLink,const char *ClassLogo)
|
|
|
|
|
{
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin form *****/
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginFormGoTo (Action);
|
2015-11-19 20:04:41 +01:00
|
|
|
|
Deg_PutParamDegCod (Deg->DegCod);
|
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Link to action *****/
|
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Hie_BuildGoToMsg (Deg->FullName),ClassLink,NULL);
|
|
|
|
|
Hie_FreeGoToMsg ();
|
2015-11-19 20:04:41 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Degree logo and name *****/
|
|
|
|
|
Lgo_DrawLogo (HieLvl_DEG,Deg->DegCod,Deg->ShrtName,16,ClassLogo,true);
|
|
|
|
|
HTM_TxtF (" %s",Deg->FullName);
|
2015-11-19 20:04:41 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** End link *****/
|
|
|
|
|
HTM_BUTTON_End ();
|
2015-11-19 20:04:41 +01:00
|
|
|
|
|
|
|
|
|
/***** End form *****/
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2015-11-19 20:04:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Write selector of degree ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-11-14 16:47:46 +01:00
|
|
|
|
void Deg_WriteSelectorOfDegree (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Degree;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned NumDegs;
|
|
|
|
|
unsigned NumDeg;
|
|
|
|
|
long DegCod;
|
|
|
|
|
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin form *****/
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginFormGoTo (ActSeeCrs);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Begin selector of degree *****/
|
|
|
|
|
if (Gbl.Hierarchy.Ctr.CtrCod > 0)
|
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"deg\" name=\"deg\" class=\"HIE_SEL\"");
|
|
|
|
|
else
|
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"deg\" name=\"deg\" class=\"HIE_SEL\""
|
|
|
|
|
" disabled=\"disabled\"");
|
|
|
|
|
HTM_OPTION (HTM_Type_STRING,"",
|
|
|
|
|
Gbl.Hierarchy.Deg.DegCod < 0,true,
|
|
|
|
|
"[%s]",Txt_Degree);
|
|
|
|
|
|
|
|
|
|
if (Gbl.Hierarchy.Ctr.CtrCod > 0)
|
|
|
|
|
{
|
|
|
|
|
/***** Get degrees belonging to the current center from database *****/
|
2021-05-28 19:59:55 +02:00
|
|
|
|
NumDegs = Deg_DB_GetDegsOfCurrentCtrBasic (&mysql_res);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Get degrees of this center *****/
|
|
|
|
|
for (NumDeg = 0;
|
|
|
|
|
NumDeg < NumDegs;
|
|
|
|
|
NumDeg++)
|
|
|
|
|
{
|
|
|
|
|
/* Get next degree */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
|
|
|
|
/* Get degree code (row[0]) */
|
|
|
|
|
if ((DegCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
|
|
|
|
Err_WrongDegreeExit ();
|
|
|
|
|
|
|
|
|
|
/* Write option */
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&DegCod,
|
|
|
|
|
Gbl.Hierarchy.Deg.DegCod > 0 &&
|
|
|
|
|
DegCod == Gbl.Hierarchy.Deg.DegCod,false,
|
|
|
|
|
"%s",row[1]);
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** End selector of degree *****/
|
|
|
|
|
HTM_SELECT_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** End form *****/
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/************* Show the degrees belonging to the current center **************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_ShowDegsOfCurrentCtr (void)
|
|
|
|
|
{
|
2019-04-03 20:57:04 +02:00
|
|
|
|
/***** Trivial check *****/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
if (Gbl.Hierarchy.Ctr.CtrCod <= 0) // No center selected
|
2019-04-03 20:57:04 +02:00
|
|
|
|
return;
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Get list of centers and degrees *****/
|
|
|
|
|
Ctr_GetBasicListOfCenters (Gbl.Hierarchy.Ins.InsCod);
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg_GetListDegsInCurrentCtr ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Write menu to select country, institution and center *****/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Hie_WriteMenuHierarchy ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
/***** Show list of degrees *****/
|
|
|
|
|
Deg_ListDegrees ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Free list of degrees and centers *****/
|
2020-01-08 14:04:25 +01:00
|
|
|
|
Deg_FreeListDegs (&Gbl.Hierarchy.Degs);
|
2021-03-07 21:21:04 +01:00
|
|
|
|
Ctr_FreeListCenters ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* List current degrees for edition **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Deg_ListDegreesForEdition (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_DEGREE_STATUS[Deg_NUM_STATUS_TXT];
|
|
|
|
|
unsigned NumDeg;
|
|
|
|
|
struct DegreeType *DegTyp;
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Deg_Degree *Deg;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumDegTyp;
|
2017-03-07 01:56:41 +01:00
|
|
|
|
char WWW[Cns_MAX_BYTES_WWW + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
struct UsrData UsrDat;
|
|
|
|
|
bool ICanEdit;
|
2020-05-02 13:39:59 +02:00
|
|
|
|
unsigned NumCrss;
|
|
|
|
|
unsigned NumUsrsInCrssOfDeg;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Deg_StatusTxt_t StatusTxt;
|
2019-11-06 19:45:20 +01:00
|
|
|
|
unsigned StatusUnsigned;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&UsrDat);
|
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Begin table of degrees *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_BeginWidePadding (2);
|
2019-10-08 15:49:01 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Write heading *****/
|
|
|
|
|
Deg_PutHeadDegreesForEdition ();
|
2017-03-17 00:46:28 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** List the degrees *****/
|
|
|
|
|
for (NumDeg = 0;
|
|
|
|
|
NumDeg < Gbl.Hierarchy.Degs.Num;
|
|
|
|
|
NumDeg++)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Deg = &(Gbl.Hierarchy.Degs.Lst[NumDeg]);
|
|
|
|
|
|
|
|
|
|
ICanEdit = Deg_CheckIfICanEditADegree (Deg);
|
|
|
|
|
NumCrss = Crs_GetNumCrssInDeg (Deg->DegCod);
|
|
|
|
|
NumUsrsInCrssOfDeg = Usr_GetNumUsrsInCrss (HieLvl_DEG,Deg->DegCod,
|
|
|
|
|
1 << Rol_STD |
|
|
|
|
|
1 << Rol_NET |
|
|
|
|
|
1 << Rol_TCH); // Any user
|
|
|
|
|
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Put icon to remove degree */
|
|
|
|
|
HTM_TD_Begin ("class=\"BM\"");
|
|
|
|
|
if (!ICanEdit ||
|
|
|
|
|
NumCrss || // Degree has courses ==> deletion forbidden
|
|
|
|
|
NumUsrsInCrssOfDeg)
|
|
|
|
|
Ico_PutIconRemovalNotAllowed ();
|
|
|
|
|
else
|
|
|
|
|
Ico_PutContextualIconToRemove (ActRemDeg,NULL,
|
|
|
|
|
Deg_PutParamOtherDegCod,&Deg->DegCod);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Degree code */
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT CODE\"");
|
|
|
|
|
HTM_Long (Deg->DegCod);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Degree logo */
|
|
|
|
|
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Deg->FullName);
|
|
|
|
|
Lgo_DrawLogo (HieLvl_DEG,Deg->DegCod,Deg->ShrtName,20,NULL,true);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Degree short name */
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
|
|
|
|
if (ICanEdit)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (ActRenDegSho);
|
|
|
|
|
Deg_PutParamOtherDegCod (&Deg->DegCod);
|
|
|
|
|
HTM_INPUT_TEXT ("ShortName",Cns_HIERARCHY_MAX_CHARS_SHRT_NAME,Deg->ShrtName,
|
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"class=\"INPUT_SHORT_NAME\"");
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
HTM_Txt (Deg->ShrtName);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Degree full name */
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
|
|
|
|
if (ICanEdit)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (ActRenDegFul);
|
|
|
|
|
Deg_PutParamOtherDegCod (&Deg->DegCod);
|
|
|
|
|
HTM_INPUT_TEXT ("FullName",Cns_HIERARCHY_MAX_CHARS_FULL_NAME,Deg->FullName,
|
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"class=\"INPUT_FULL_NAME\"");
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
HTM_Txt (Deg->FullName);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Degree type */
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
|
|
|
|
if (ICanEdit)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (ActChgDegTyp);
|
|
|
|
|
Deg_PutParamOtherDegCod (&Deg->DegCod);
|
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"name=\"OthDegTypCod\" class=\"HIE_SEL_NARROW\"");
|
|
|
|
|
for (NumDegTyp = 0;
|
|
|
|
|
NumDegTyp < Gbl.DegTypes.Num;
|
|
|
|
|
NumDegTyp++)
|
|
|
|
|
{
|
|
|
|
|
DegTyp = &Gbl.DegTypes.Lst[NumDegTyp];
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&DegTyp->DegTypCod,
|
|
|
|
|
// Gbl.Hierarchy.Deg.DegCod > 0 &&
|
|
|
|
|
DegTyp->DegTypCod == Deg->DegTypCod,false,
|
|
|
|
|
"%s",DegTyp->DegTypName);
|
|
|
|
|
}
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
for (NumDegTyp = 0;
|
|
|
|
|
NumDegTyp < Gbl.DegTypes.Num;
|
|
|
|
|
NumDegTyp++)
|
|
|
|
|
if (Gbl.DegTypes.Lst[NumDegTyp].DegTypCod == Deg->DegTypCod)
|
|
|
|
|
HTM_Txt (Gbl.DegTypes.Lst[NumDegTyp].DegTypName);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Degree WWW */
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
|
|
|
|
if (ICanEdit)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (ActChgDegWWW);
|
|
|
|
|
Deg_PutParamOtherDegCod (&Deg->DegCod);
|
|
|
|
|
HTM_INPUT_URL ("WWW",Deg->WWW,HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"class=\"INPUT_WWW_NARROW\" required=\"required\"");
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Str_Copy (WWW,Deg->WWW,sizeof (WWW) - 1);
|
|
|
|
|
HTM_DIV_Begin ("class=\"EXTERNAL_WWW_SHORT\"");
|
|
|
|
|
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT\" title=\"%s\"",
|
|
|
|
|
Deg->WWW,Deg->WWW);
|
|
|
|
|
HTM_Txt (WWW);
|
|
|
|
|
HTM_A_End ();
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Number of courses in this degree */
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
|
|
|
|
HTM_Unsigned (NumCrss);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Number of users in courses of this degree */
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
|
|
|
|
HTM_Unsigned (NumUsrsInCrssOfDeg);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Degree requester */
|
|
|
|
|
UsrDat.UsrCod = Deg->RequesterUsrCod;
|
|
|
|
|
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT INPUT_REQUESTER LT\"");
|
|
|
|
|
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Degree status */
|
|
|
|
|
StatusTxt = Deg_GetStatusTxtFromStatusBits (Deg->Status);
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
|
|
|
|
if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM &&
|
|
|
|
|
StatusTxt == Deg_STATUS_PENDING)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (ActChgDegSta);
|
|
|
|
|
Deg_PutParamOtherDegCod (&Deg->DegCod);
|
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"name=\"Status\" class=\"INPUT_STATUS\"");
|
|
|
|
|
StatusUnsigned = (unsigned) Deg_GetStatusBitsFromStatusTxt (Deg_STATUS_PENDING);
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,true,false,
|
|
|
|
|
"%s",Txt_DEGREE_STATUS[Deg_STATUS_PENDING]);
|
|
|
|
|
StatusUnsigned = (unsigned) Deg_GetStatusBitsFromStatusTxt (Deg_STATUS_ACTIVE);
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,false,false,
|
|
|
|
|
"%s",Txt_DEGREE_STATUS[Deg_STATUS_ACTIVE]);
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
else if (StatusTxt != Deg_STATUS_ACTIVE) // If active ==> do not show anything
|
|
|
|
|
HTM_Txt (Txt_DEGREE_STATUS[StatusTxt]);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** End table of degrees *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&UsrDat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Check if I can edit, remove, etc. a degree *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static bool Deg_CheckIfICanEditADegree (struct Deg_Degree *Deg)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM || // I am a center administrator or higher
|
2020-01-11 13:52:56 +01:00
|
|
|
|
((Deg->Status & Deg_STATUS_BIT_PENDING) != 0 && // Degree is not yet activated
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod == Deg->RequesterUsrCod)); // I am the requester
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Set StatusTxt depending on status bits ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// 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)
|
|
|
|
|
|
|
|
|
|
static Deg_StatusTxt_t Deg_GetStatusTxtFromStatusBits (Deg_Status_t Status)
|
|
|
|
|
{
|
|
|
|
|
if (Status == 0)
|
|
|
|
|
return Deg_STATUS_ACTIVE;
|
|
|
|
|
if (Status == Deg_STATUS_BIT_PENDING)
|
|
|
|
|
return Deg_STATUS_PENDING;
|
|
|
|
|
if (Status & Deg_STATUS_BIT_REMOVED)
|
|
|
|
|
return Deg_STATUS_REMOVED;
|
|
|
|
|
return Deg_STATUS_UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Set status bits depending on StatusTxt ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// 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)
|
|
|
|
|
|
|
|
|
|
static Deg_Status_t Deg_GetStatusBitsFromStatusTxt (Deg_StatusTxt_t StatusTxt)
|
|
|
|
|
{
|
|
|
|
|
switch (StatusTxt)
|
|
|
|
|
{
|
|
|
|
|
case Deg_STATUS_UNKNOWN:
|
|
|
|
|
case Deg_STATUS_ACTIVE:
|
|
|
|
|
return (Deg_Status_t) 0;
|
|
|
|
|
case Deg_STATUS_PENDING:
|
|
|
|
|
return Deg_STATUS_BIT_PENDING;
|
|
|
|
|
case Deg_STATUS_REMOVED:
|
|
|
|
|
return Deg_STATUS_BIT_REMOVED;
|
|
|
|
|
}
|
|
|
|
|
return (Deg_Status_t) 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Put a form to create a new degree *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Deg_PutFormToCreateDegree (void)
|
|
|
|
|
{
|
2017-04-30 02:56:25 +02:00
|
|
|
|
extern const char *Txt_New_degree;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Create_degree;
|
|
|
|
|
struct DegreeType *DegTyp;
|
|
|
|
|
unsigned NumDegTyp;
|
|
|
|
|
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin form *****/
|
2017-06-04 18:18:54 +02:00
|
|
|
|
if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM)
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActNewDeg);
|
2017-06-04 18:18:54 +02:00
|
|
|
|
else if (Gbl.Usrs.Me.Role.Max >= Rol_GST)
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActReqDeg);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NoPermissionExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableBegin (NULL,Txt_New_degree,
|
|
|
|
|
NULL,NULL,
|
2017-06-12 15:03:29 +02:00
|
|
|
|
NULL,Box_NOT_CLOSABLE,2);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Write heading *****/
|
|
|
|
|
Deg_PutHeadDegreesForEdition ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 00:05:24 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Column to remove degree, disabled here *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"BM\"");
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree code *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"CODE\"");
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree logo *****/
|
|
|
|
|
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Deg_EditingDeg->FullName);
|
|
|
|
|
Lgo_DrawLogo (HieLvl_DEG,-1L,"",20,NULL,true);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree short name *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
|
|
|
|
HTM_INPUT_TEXT ("ShortName",Cns_HIERARCHY_MAX_CHARS_SHRT_NAME,Deg_EditingDeg->ShrtName,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"class=\"INPUT_SHORT_NAME\" required=\"required\"");
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree full name *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
|
|
|
|
HTM_INPUT_TEXT ("FullName",Cns_HIERARCHY_MAX_CHARS_FULL_NAME,Deg_EditingDeg->FullName,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"class=\"INPUT_FULL_NAME\" required=\"required\"");
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree type *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"name=\"OthDegTypCod\" class=\"HIE_SEL_NARROW\"");
|
|
|
|
|
for (NumDegTyp = 0;
|
|
|
|
|
NumDegTyp < Gbl.DegTypes.Num;
|
|
|
|
|
NumDegTyp++)
|
|
|
|
|
{
|
|
|
|
|
DegTyp = &Gbl.DegTypes.Lst[NumDegTyp];
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&DegTyp->DegTypCod,
|
|
|
|
|
DegTyp->DegTypCod == Deg_EditingDeg->DegTypCod,false,
|
|
|
|
|
"%s",DegTyp->DegTypName);
|
|
|
|
|
}
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree WWW *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
|
|
|
|
HTM_INPUT_URL ("WWW",Deg_EditingDeg->WWW,HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"class=\"INPUT_WWW_NARROW\" required=\"required\"");
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Number of courses in this degree *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
|
|
|
|
HTM_Unsigned (0);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Number of users in courses of this degree *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT RM\"");
|
|
|
|
|
HTM_Unsigned (0);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree requester *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT INPUT_REQUESTER LT\"");
|
|
|
|
|
Msg_WriteMsgAuthor (&Gbl.Usrs.Me.UsrDat,true,NULL);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree status *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 00:05:24 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table, send button and end box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_degree);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2015-04-11 23:46:21 +02:00
|
|
|
|
/***** End form *****/
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Write header with fields of a degree *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Deg_PutHeadDegreesForSeeing (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Degree;
|
2015-12-05 21:15:30 +01:00
|
|
|
|
extern const char *Txt_Type;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Courses_ABBREVIATION;
|
2020-05-02 13:39:59 +02:00
|
|
|
|
extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-11 15:36:50 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HTM_TH (1,1,"BM",NULL);
|
|
|
|
|
HTM_TH_Empty (1);
|
|
|
|
|
HTM_TH (1,1,"LM",Txt_Degree);
|
|
|
|
|
HTM_TH (1,1,"LM",Txt_Type);
|
|
|
|
|
HTM_TH (1,1,"RM",Txt_Courses_ABBREVIATION);
|
|
|
|
|
HTM_TH_Begin (1,1,"RM");
|
|
|
|
|
HTM_TxtF ("%s+",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH]);
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD]);
|
|
|
|
|
HTM_TH_End ();
|
|
|
|
|
HTM_TH_Empty (1);
|
2019-10-11 15:36:50 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Write header with fields of a degree *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Deg_PutHeadDegreesForEdition (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Code;
|
2016-03-02 19:29:56 +01:00
|
|
|
|
extern const char *Txt_Short_name_of_the_degree;
|
|
|
|
|
extern const char *Txt_Full_name_of_the_degree;
|
2015-12-05 21:15:30 +01:00
|
|
|
|
extern const char *Txt_Type;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_WWW;
|
|
|
|
|
extern const char *Txt_Courses_ABBREVIATION;
|
2020-05-02 13:39:59 +02:00
|
|
|
|
extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Requester;
|
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-11 15:36:50 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HTM_TH (1,1,"BM",NULL);
|
|
|
|
|
HTM_TH (1,1,"RM",Txt_Code);
|
|
|
|
|
HTM_TH_Empty (1);
|
|
|
|
|
HTM_TH (1,1,"LM",Txt_Short_name_of_the_degree);
|
|
|
|
|
HTM_TH (1,1,"LM",Txt_Full_name_of_the_degree);
|
|
|
|
|
HTM_TH (1,1,"LM",Txt_Type);
|
|
|
|
|
HTM_TH (1,1,"LM",Txt_WWW);
|
|
|
|
|
HTM_TH (1,1,"RM",Txt_Courses_ABBREVIATION);
|
|
|
|
|
HTM_TH_Begin (1,1,"RM");
|
|
|
|
|
HTM_TxtF ("%s+",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH]);
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD]);
|
|
|
|
|
HTM_TH_End ();
|
|
|
|
|
HTM_TH (1,1,"LM",Txt_Requester);
|
|
|
|
|
HTM_TH_Empty (1);
|
2019-10-11 15:36:50 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Convert string to year of a degree *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
unsigned Deg_ConvStrToYear (const char *StrYear)
|
|
|
|
|
{
|
|
|
|
|
int Year;
|
|
|
|
|
|
|
|
|
|
if (sscanf (StrYear,"%d",&Year) != 1)
|
|
|
|
|
return 0;
|
|
|
|
|
if (Year < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
if (Year > Deg_MAX_YEARS_PER_DEGREE)
|
|
|
|
|
return Deg_MAX_YEARS_PER_DEGREE;
|
|
|
|
|
return (unsigned) Year;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/************** List degrees belonging to the current center *****************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Deg_ListDegrees (void)
|
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
extern const char *Hlp_CENTER_Degrees;
|
|
|
|
|
extern const char *Txt_Degrees_of_CENTER_X;
|
2016-03-20 13:18:56 +01:00
|
|
|
|
extern const char *Txt_No_degrees;
|
2016-03-16 13:23:10 +01:00
|
|
|
|
extern const char *Txt_Create_another_degree;
|
2015-10-06 01:19:21 +02:00
|
|
|
|
extern const char *Txt_Create_degree;
|
2016-03-20 13:18:56 +01:00
|
|
|
|
unsigned NumDeg;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box *****/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
Box_BoxBegin (NULL,Str_BuildStringStr (Txt_Degrees_of_CENTER_X,
|
2019-12-30 21:47:07 +01:00
|
|
|
|
Gbl.Hierarchy.Ctr.ShrtName),
|
2020-04-08 18:18:46 +02:00
|
|
|
|
Deg_PutIconsListingDegrees,NULL,
|
2021-03-07 21:21:04 +01:00
|
|
|
|
Hlp_CENTER_Degrees,Box_NOT_CLOSABLE);
|
2019-12-30 21:47:07 +01:00
|
|
|
|
Str_FreeString ();
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (Gbl.Hierarchy.Degs.Num) // There are degrees in the current center
|
|
|
|
|
{
|
|
|
|
|
/***** Begin table *****/
|
|
|
|
|
HTM_TABLE_BeginWideMarginPadding (2);
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Write heading *****/
|
|
|
|
|
Deg_PutHeadDegreesForSeeing ();
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** List the degrees *****/
|
|
|
|
|
for (NumDeg = 0;
|
|
|
|
|
NumDeg < Gbl.Hierarchy.Degs.Num;
|
|
|
|
|
NumDeg++)
|
|
|
|
|
Deg_ListOneDegreeForSeeing (&(Gbl.Hierarchy.Degs.Lst[NumDeg]),NumDeg + 1);
|
2016-03-16 12:59:57 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** End table *****/
|
|
|
|
|
HTM_TABLE_End ();
|
|
|
|
|
}
|
|
|
|
|
else // No degrees created in the current center
|
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_No_degrees);
|
|
|
|
|
|
|
|
|
|
/***** Button to create degree *****/
|
|
|
|
|
if (Deg_CheckIfICanCreateDegrees ())
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (ActEdiDeg);
|
|
|
|
|
Btn_PutConfirmButton (Gbl.Hierarchy.Degs.Num ? Txt_Create_another_degree :
|
|
|
|
|
Txt_Create_degree);
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End box *****/
|
2019-10-25 22:48:34 +02:00
|
|
|
|
Box_BoxEnd ();
|
2016-03-20 13:18:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-06 23:56:43 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-11-07 00:03:50 +01:00
|
|
|
|
/********************** Check if I can create degrees ************************/
|
2016-11-06 23:56:43 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-11-07 00:03:50 +01:00
|
|
|
|
static bool Deg_CheckIfICanCreateDegrees (void)
|
2016-11-06 23:56:43 +01:00
|
|
|
|
{
|
2017-06-04 18:18:54 +02:00
|
|
|
|
return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_GST);
|
2016-11-06 23:56:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Put contextual icons in list of degrees *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Deg_PutIconsListingDegrees (__attribute__((unused)) void *Args)
|
2016-11-06 23:56:43 +01:00
|
|
|
|
{
|
2020-04-08 18:18:46 +02:00
|
|
|
|
/***** Put icon to edit degrees *****/
|
|
|
|
|
if (Deg_CheckIfICanCreateDegrees ())
|
|
|
|
|
Deg_PutIconToEditDegrees ();
|
2016-11-06 23:56:43 +01:00
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
/***** Put icon to view degree types *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
DegTyp_PutIconToViewDegreeTypes ();
|
2017-03-26 16:47:02 +02:00
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
/***** Put icon to show a figure *****/
|
|
|
|
|
Fig_PutIconToShowFigure (Fig_HIERARCHY);
|
2016-11-06 23:56:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-20 13:18:56 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Put link (form) to edit degrees **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Deg_PutIconToEditDegrees (void)
|
|
|
|
|
{
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Ico_PutContextualIconToEdit (ActEdiDeg,NULL,
|
|
|
|
|
NULL,NULL);
|
2016-03-20 13:18:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ List one degree for seeing *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Deg_ListOneDegreeForSeeing (struct Deg_Degree *Deg,unsigned NumDeg)
|
2016-03-20 13:18:56 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_DEGREE_With_courses;
|
|
|
|
|
extern const char *Txt_DEGREE_Without_courses;
|
|
|
|
|
extern const char *Txt_DEGREE_STATUS[Deg_NUM_STATUS_TXT];
|
|
|
|
|
struct DegreeType DegTyp;
|
|
|
|
|
const char *TxtClassNormal;
|
|
|
|
|
const char *TxtClassStrong;
|
|
|
|
|
const char *BgColor;
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned NumCrss = Crs_GetCachedNumCrssInDeg (Deg->DegCod);
|
2017-03-17 00:46:28 +01:00
|
|
|
|
Deg_StatusTxt_t StatusTxt;
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
|
|
|
|
/***** Get data of type of degree of this degree *****/
|
|
|
|
|
DegTyp.DegTypCod = Deg->DegTypCod;
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (!DegTyp_GetDataOfDegreeTypeByCod (&DegTyp))
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongDegTypExit ();
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
|
|
|
|
if (Deg->Status & Deg_STATUS_BIT_PENDING)
|
|
|
|
|
{
|
|
|
|
|
TxtClassNormal = "DAT_LIGHT";
|
2019-11-18 15:48:46 +01:00
|
|
|
|
TxtClassStrong = "BT_LINK LT DAT_LIGHT";
|
2016-03-20 13:18:56 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TxtClassNormal = "DAT";
|
2019-11-18 15:48:46 +01:00
|
|
|
|
TxtClassStrong = "BT_LINK LT DAT_N";
|
2016-03-20 13:18:56 +01:00
|
|
|
|
}
|
2019-04-03 20:57:04 +02:00
|
|
|
|
BgColor = (Deg->DegCod == Gbl.Hierarchy.Deg.DegCod) ? "LIGHT_BLUE" :
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Gbl.ColorRows[Gbl.RowEvenOdd];
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Begin table row *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 00:05:24 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Put tip if degree has courses *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"%s CM %s\" title=\"%s\"",
|
|
|
|
|
TxtClassNormal,BgColor,
|
|
|
|
|
NumCrss ? Txt_DEGREE_With_courses :
|
|
|
|
|
Txt_DEGREE_Without_courses);
|
|
|
|
|
HTM_Txt (NumCrss ? "✓" :
|
|
|
|
|
" ");
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Number of degree in this list *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"%s RM %s\"",TxtClassNormal,BgColor);
|
|
|
|
|
HTM_Unsigned (NumDeg);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree logo and name *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"LM %s\"",BgColor);
|
|
|
|
|
Deg_DrawDegreeLogoAndNameWithLink (Deg,ActSeeCrs,
|
|
|
|
|
TxtClassStrong,"CM");
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Type of degree *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"%s LM %s\"",TxtClassNormal,BgColor);
|
|
|
|
|
HTM_Txt (DegTyp.DegTypName);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Current number of courses in this degree *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"%s RM %s\"",TxtClassNormal,BgColor);
|
|
|
|
|
HTM_Unsigned (NumCrss);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Number of users in courses of this degree *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"%s RM %s\"",TxtClassNormal,BgColor);
|
|
|
|
|
HTM_Unsigned (Usr_GetCachedNumUsrsInCrss (HieLvl_DEG,Deg->DegCod,
|
|
|
|
|
1 << Rol_STD |
|
|
|
|
|
1 << Rol_NET |
|
|
|
|
|
1 << Rol_TCH)); // Any user
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Degree status *****/
|
|
|
|
|
StatusTxt = Deg_GetStatusTxtFromStatusBits (Deg->Status);
|
|
|
|
|
HTM_TD_Begin ("class=\"%s LM %s\"",TxtClassNormal,BgColor);
|
|
|
|
|
if (StatusTxt != Deg_STATUS_ACTIVE) // If active ==> do not show anything
|
|
|
|
|
HTM_Txt (Txt_DEGREE_STATUS[StatusTxt]);
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 00:05:24 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** End table row *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-03-20 13:18:56 +01:00
|
|
|
|
|
|
|
|
|
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Put forms to edit degrees ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_EditDegrees (void)
|
2019-04-07 12:17:10 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Degree constructor *****/
|
|
|
|
|
Deg_EditingDegreeConstructor ();
|
|
|
|
|
|
|
|
|
|
/***** Edit degrees *****/
|
|
|
|
|
Deg_EditDegreesInternal ();
|
|
|
|
|
|
|
|
|
|
/***** Degree destructor *****/
|
|
|
|
|
Deg_EditingDegreeDestructor ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Deg_EditDegreesInternal (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
extern const char *Hlp_CENTER_Degrees;
|
|
|
|
|
extern const char *Txt_Degrees_of_CENTER_X;
|
2017-04-30 14:03:45 +02:00
|
|
|
|
extern const char *Txt_No_types_of_degree;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Get list of degrees in the current center *****/
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg_GetListDegsInCurrentCtr ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-10-20 21:09:01 +02:00
|
|
|
|
/***** Get list of degree types *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
DegTyp_GetListDegreeTypes (HieLvl_SYS,DegTyp_ORDER_BY_DEGREE_TYPE);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Write menu to select country, institution and center *****/
|
2018-11-15 12:52:56 +01:00
|
|
|
|
Hie_WriteMenuHierarchy ();
|
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box *****/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
Box_BoxBegin (NULL,Str_BuildStringStr (Txt_Degrees_of_CENTER_X,
|
2019-12-30 21:47:07 +01:00
|
|
|
|
Gbl.Hierarchy.Ctr.ShrtName),
|
2020-04-08 18:18:46 +02:00
|
|
|
|
Deg_PutIconsEditingDegrees,NULL,
|
2021-03-07 21:21:04 +01:00
|
|
|
|
Hlp_CENTER_Degrees,Box_NOT_CLOSABLE);
|
2019-12-30 21:47:07 +01:00
|
|
|
|
Str_FreeString ();
|
2017-04-30 02:56:25 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (Gbl.DegTypes.Num)
|
|
|
|
|
{
|
|
|
|
|
/***** Put a form to create a new degree *****/
|
|
|
|
|
Deg_PutFormToCreateDegree ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Forms to edit current degrees *****/
|
|
|
|
|
if (Gbl.Hierarchy.Degs.Num)
|
|
|
|
|
Deg_ListDegreesForEdition ();
|
|
|
|
|
}
|
|
|
|
|
else // No degree types
|
|
|
|
|
{
|
|
|
|
|
/***** Warning message *****/
|
|
|
|
|
Ale_ShowAlert (Ale_WARNING,Txt_No_types_of_degree);
|
2017-03-26 17:32:19 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Form to create the first degree type *****/
|
|
|
|
|
if (DegTyp_CheckIfICanCreateDegreeTypes ())
|
|
|
|
|
DegTyp_EditDegreeTypes ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End box *****/
|
2019-10-25 22:48:34 +02:00
|
|
|
|
Box_BoxEnd ();
|
2017-04-30 02:56:25 +02:00
|
|
|
|
|
2016-10-20 21:09:01 +02:00
|
|
|
|
/***** Free list of degree types *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
DegTyp_FreeListDegreeTypes ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Free list of degrees in the current center *****/
|
2020-01-08 14:04:25 +01:00
|
|
|
|
Deg_FreeListDegs (&Gbl.Hierarchy.Degs);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-30 02:56:25 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Put contextual icons in edition of degrees *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Deg_PutIconsEditingDegrees (__attribute__((unused)) void *Args)
|
2017-04-30 02:56:25 +02:00
|
|
|
|
{
|
2020-04-08 18:18:46 +02:00
|
|
|
|
/***** Put icon to view degrees *****/
|
|
|
|
|
Deg_PutIconToViewDegrees ();
|
2017-04-30 02:56:25 +02:00
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
/***** Put icon to view types of degree *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
DegTyp_PutIconToViewDegreeTypes ();
|
2018-11-15 12:52:56 +01:00
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
/***** Put icon to show a figure *****/
|
|
|
|
|
Fig_PutIconToShowFigure (Fig_HIERARCHY);
|
2017-04-30 02:56:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-15 18:51:13 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Put icon to view degrees ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2018-11-15 12:52:56 +01:00
|
|
|
|
void Deg_PutIconToViewDegrees (void)
|
2017-04-30 02:56:25 +02:00
|
|
|
|
{
|
2018-11-15 12:52:56 +01:00
|
|
|
|
extern const char *Txt_Degrees;
|
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeDeg,NULL,
|
|
|
|
|
NULL,NULL,
|
2019-01-12 03:00:59 +01:00
|
|
|
|
"graduation-cap.svg",
|
|
|
|
|
Txt_Degrees);
|
2017-04-30 02:56:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-04-16 15:05:18 +02:00
|
|
|
|
/********** Create a list with all the degrees that have students ************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-04-16 15:05:18 +02:00
|
|
|
|
void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned NumDeg;
|
|
|
|
|
|
|
|
|
|
/***** Get degrees admin by me from database *****/
|
2021-05-28 19:59:55 +02:00
|
|
|
|
if ((Degs->Num = Deg_DB_GetDegsWithStds (&mysql_res))) // Degrees found...
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Create list with degrees *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
if ((Degs->Lst = calloc (Degs->Num,sizeof (*Degs->Lst))) == NULL)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get the degrees *****/
|
|
|
|
|
for (NumDeg = 0;
|
2016-04-16 15:05:18 +02:00
|
|
|
|
NumDeg < Degs->Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumDeg++)
|
|
|
|
|
{
|
|
|
|
|
/* Get next degree */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
2016-04-16 15:05:18 +02:00
|
|
|
|
Deg_GetDataOfDegreeFromRow (&(Degs->Lst[NumDeg]),row);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2016-04-16 15:05:18 +02:00
|
|
|
|
Degs->Lst = NULL;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/************ Get a list with the degrees of the current center **************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-01-05 12:52:03 +01:00
|
|
|
|
void Deg_GetListDegsInCurrentCtr (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned NumDeg;
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Deg_Degree *Deg;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Get degrees of the current center from database *****/
|
2021-05-28 19:59:55 +02:00
|
|
|
|
Gbl.Hierarchy.Degs.Num = Deg_DB_GetDegsOfCurrentCtrFull (&mysql_res);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Count number of rows in result *****/
|
2021-04-16 13:51:12 +02:00
|
|
|
|
if (Gbl.Hierarchy.Degs.Num) // Degrees found...
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Create list with degrees of this center *****/
|
2021-04-16 13:51:12 +02:00
|
|
|
|
if ((Gbl.Hierarchy.Degs.Lst = calloc ((size_t) Gbl.Hierarchy.Degs.Num,
|
2021-02-15 16:25:55 +01:00
|
|
|
|
sizeof (*Gbl.Hierarchy.Degs.Lst))) == NULL)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Get the degrees of this center *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
for (NumDeg = 0;
|
2020-01-08 14:04:25 +01:00
|
|
|
|
NumDeg < Gbl.Hierarchy.Degs.Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumDeg++)
|
|
|
|
|
{
|
2020-01-08 14:04:25 +01:00
|
|
|
|
Deg = &Gbl.Hierarchy.Degs.Lst[NumDeg];
|
2019-12-17 00:50:14 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/* Get next degree */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
2019-12-17 00:50:14 +01:00
|
|
|
|
Deg_GetDataOfDegreeFromRow (Deg,row);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-10-20 00:57:00 +02:00
|
|
|
|
/*************************** Free list of degrees ****************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-10-20 00:57:00 +02:00
|
|
|
|
void Deg_FreeListDegs (struct ListDegrees *Degs)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-10-20 00:57:00 +02:00
|
|
|
|
if (Degs->Lst)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-11-06 19:45:20 +01:00
|
|
|
|
free (Degs->Lst);
|
2016-10-20 00:57:00 +02:00
|
|
|
|
Degs->Lst = NULL;
|
|
|
|
|
Degs->Num = 0;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Receive form to request a new degree *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-05-05 21:49:00 +02:00
|
|
|
|
void Deg_ReceiveFormReqDeg (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/***** Degree constructor *****/
|
|
|
|
|
Deg_EditingDegreeConstructor ();
|
|
|
|
|
|
|
|
|
|
/***** Receive form to request a new degree *****/
|
2020-05-05 21:49:00 +02:00
|
|
|
|
Deg_ReceiveFormRequestOrCreateDeg ((unsigned) Deg_STATUS_BIT_PENDING);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Receive form to create a new degree *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-05-05 21:49:00 +02:00
|
|
|
|
void Deg_ReceiveFormNewDeg (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/***** Degree constructor *****/
|
|
|
|
|
Deg_EditingDegreeConstructor ();
|
|
|
|
|
|
2019-04-07 19:49:53 +02:00
|
|
|
|
/***** Receive form to create a new degree *****/
|
2020-05-05 21:49:00 +02:00
|
|
|
|
Deg_ReceiveFormRequestOrCreateDeg (0);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Receive form to create a new degree *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-05-05 21:49:00 +02:00
|
|
|
|
static void Deg_ReceiveFormRequestOrCreateDeg (unsigned Status)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_degree_X_already_exists;
|
2019-04-08 14:52:13 +02:00
|
|
|
|
extern const char *Txt_Created_new_degree_X;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_You_must_specify_the_web_address_of_the_new_degree;
|
|
|
|
|
extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree;
|
|
|
|
|
|
|
|
|
|
/***** Get parameters from form *****/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/* Set degree center */
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Deg_EditingDeg->CtrCod = Gbl.Hierarchy.Ctr.CtrCod;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-28 19:59:55 +02:00
|
|
|
|
/* Get degree short name and full name */
|
2021-02-11 22:57:09 +01:00
|
|
|
|
Par_GetParToText ("ShortName",Deg_EditingDeg->ShrtName,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
|
2021-05-28 19:59:55 +02:00
|
|
|
|
Par_GetParToText ("FullName" ,Deg_EditingDeg->FullName,Cns_HIERARCHY_MAX_BYTES_FULL_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get degree type */
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Deg_EditingDeg->DegTypCod = DegTyp_GetAndCheckParamOtherDegTypCod (1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get degree WWW */
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Par_GetParToText ("WWW",Deg_EditingDeg->WWW,Cns_MAX_BYTES_WWW);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-07 12:17:10 +02:00
|
|
|
|
if (Deg_EditingDeg->ShrtName[0] &&
|
|
|
|
|
Deg_EditingDeg->FullName[0]) // If there's a degree name
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-04-07 12:17:10 +02:00
|
|
|
|
if (Deg_EditingDeg->WWW[0])
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** If name of degree was in database... *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (Deg_DB_CheckIfDegNameExistsInCtr ("ShortName",Deg_EditingDeg->ShrtName,
|
|
|
|
|
-1L,Deg_EditingDeg->CtrCod))
|
2019-04-08 14:52:13 +02:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_The_degree_X_already_exists,
|
|
|
|
|
Deg_EditingDeg->ShrtName);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
else if (Deg_DB_CheckIfDegNameExistsInCtr ("FullName",Deg_EditingDeg->FullName,
|
|
|
|
|
-1L,Deg_EditingDeg->CtrCod))
|
2019-04-08 14:52:13 +02:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_The_degree_X_already_exists,
|
|
|
|
|
Deg_EditingDeg->FullName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else // Add new degree to database
|
2019-04-08 14:52:13 +02:00
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Deg_DB_CreateDegree (Deg_EditingDeg,Status);
|
2019-04-08 14:52:13 +02:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_Created_new_degree_X,
|
|
|
|
|
Deg_EditingDeg->FullName);
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else // If there is not a degree logo or web
|
2019-04-08 14:52:13 +02:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_You_must_specify_the_web_address_of_the_new_degree);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else // If there is not a degree name
|
2019-04-08 14:52:13 +02:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Request removing of a degree ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_RemoveDegree (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree;
|
|
|
|
|
extern const char *Txt_Degree_X_removed;
|
2019-04-07 12:17:10 +02:00
|
|
|
|
|
|
|
|
|
/***** Degree constructor *****/
|
|
|
|
|
Deg_EditingDegreeConstructor ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get degree code *****/
|
2021-09-13 23:11:15 +02:00
|
|
|
|
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-03-01 13:36:48 +01:00
|
|
|
|
/***** Get data of degree *****/
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if this degree has courses *****/
|
2020-01-05 12:52:03 +01:00
|
|
|
|
if (Crs_GetNumCrssInDeg (Deg_EditingDeg->DegCod)) // Degree has courses ==> don't remove
|
2019-04-08 14:52:13 +02:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else // Degree has no courses ==> remove it
|
|
|
|
|
{
|
|
|
|
|
/***** Remove degree *****/
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Deg_RemoveDegreeCompletely (Deg_EditingDeg->DegCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-04-08 14:52:13 +02:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_Degree_X_removed,
|
|
|
|
|
Deg_EditingDeg->FullName);
|
2019-06-13 10:14:05 +02:00
|
|
|
|
|
|
|
|
|
Deg_EditingDeg->DegCod = -1L; // To not showing button to go to degree
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Write parameter with code of degree ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_PutParamDegCod (long DegCod)
|
|
|
|
|
{
|
2019-11-03 13:19:32 +01:00
|
|
|
|
Par_PutHiddenParamLong (NULL,"deg",DegCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Write parameter with code of degree ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-10-13 22:34:31 +02:00
|
|
|
|
static void Deg_PutParamOtherDegCod (void *DegCod)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-10-13 22:34:31 +02:00
|
|
|
|
if (DegCod)
|
|
|
|
|
Par_PutHiddenParamLong (NULL,"OthDegCod",*((long *) DegCod));
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Get parameter with code of degree *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-05-31 21:05:59 +02:00
|
|
|
|
long Deg_GetAndCheckParamOtherDegCod (long MinCodAllowed)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-10-23 18:39:04 +02:00
|
|
|
|
long DegCod;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-10-23 19:40:14 +02:00
|
|
|
|
/***** Get and check parameter with code of degree *****/
|
2017-05-31 21:05:59 +02:00
|
|
|
|
if ((DegCod = Par_GetParToLong ("OthDegCod")) < MinCodAllowed)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongDegreeExit ();
|
2016-10-23 18:39:04 +02:00
|
|
|
|
|
|
|
|
|
return DegCod;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Get data of a degree from its code ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Returns true if degree found
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
bool Deg_GetDataOfDegreeByCod (struct Deg_Degree *Deg)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
bool DegFound = false;
|
|
|
|
|
|
2016-12-30 01:20:49 +01:00
|
|
|
|
/***** Clear data *****/
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg->CtrCod = -1L;
|
|
|
|
|
Deg->DegTypCod = -1L;
|
|
|
|
|
Deg->Status = (Deg_Status_t) 0;
|
2016-12-30 01:20:49 +01:00
|
|
|
|
Deg->RequesterUsrCod = -1L;
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg->ShrtName[0] = '\0';
|
|
|
|
|
Deg->FullName[0] = '\0';
|
|
|
|
|
Deg->WWW[0] = '\0';
|
2016-12-30 01:20:49 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if degree code is correct *****/
|
|
|
|
|
if (Deg->DegCod > 0)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-12-30 01:20:49 +01:00
|
|
|
|
/***** Get data of a degree from database *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (Deg_DB_GetDataOfDegreeByCod (&mysql_res,Deg->DegCod)) // Degree found...
|
2016-12-30 01:20:49 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get data of degree *****/
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
Deg_GetDataOfDegreeFromRow (Deg,row);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-12-30 01:20:49 +01:00
|
|
|
|
/* Set return value */
|
|
|
|
|
DegFound = true;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-12-30 01:20:49 +01:00
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DegFound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get data of a degree from a row resulting of a query *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Deg_GetDataOfDegreeFromRow (struct Deg_Degree *Deg,MYSQL_ROW row)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get degree code (row[0]) *****/
|
2021-04-29 19:52:35 +02:00
|
|
|
|
if ((Deg->DegCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongDegreeExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-28 19:59:55 +02:00
|
|
|
|
/***** Get center code (row[1]) and code of the degree type (row[2]) *****/
|
|
|
|
|
Deg->CtrCod = Str_ConvertStrCodToLongCod (row[1]);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Deg->DegTypCod = Str_ConvertStrCodToLongCod (row[2]);
|
|
|
|
|
|
|
|
|
|
/* Get course status (row[3]) */
|
|
|
|
|
if (sscanf (row[3],"%u",&(Deg->Status)) != 1)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongStatusExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get requester user's code (row[4]) */
|
|
|
|
|
Deg->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[4]);
|
|
|
|
|
|
2021-02-15 22:49:44 +01:00
|
|
|
|
/***** Get degree short name (row[5]), full name (row[6]) and WWW (row[7]) *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Str_Copy (Deg->ShrtName,row[5],sizeof (Deg->ShrtName) - 1);
|
|
|
|
|
Str_Copy (Deg->FullName,row[6],sizeof (Deg->FullName) - 1);
|
2021-02-15 22:49:44 +01:00
|
|
|
|
Str_Copy (Deg->WWW ,row[7],sizeof (Deg->WWW ) - 1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Remove a degree *******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-03-20 16:30:52 +01:00
|
|
|
|
void Deg_RemoveDegreeCompletely (long DegCod)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
2021-04-16 13:51:12 +02:00
|
|
|
|
unsigned NumCrss;
|
|
|
|
|
unsigned NumCrs;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
long CrsCod;
|
2017-01-28 15:58:46 +01:00
|
|
|
|
char PathDeg[PATH_MAX + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-28 19:59:55 +02:00
|
|
|
|
/***** Get courses of a degree and remove them *****/
|
|
|
|
|
NumCrss = Crs_DB_GetCrssInDeg (&mysql_res,DegCod);
|
2021-04-16 13:51:12 +02:00
|
|
|
|
for (NumCrs = 0;
|
|
|
|
|
NumCrs < NumCrss;
|
|
|
|
|
NumCrs++)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/* Get next course */
|
2021-04-04 19:57:17 +02:00
|
|
|
|
if ((CrsCod = DB_GetNextCode (mysql_res)) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongCourseExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Remove course */
|
|
|
|
|
Crs_RemoveCourseCompletely (CrsCod);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Free structure that stores the query result */
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
|
2016-10-27 23:38:53 +02:00
|
|
|
|
/***** Remove all the threads and posts in forums of the degree *****/
|
2021-09-15 20:21:02 +02:00
|
|
|
|
For_DB_RemoveForums (HieLvl_DEG,DegCod);
|
2016-10-28 00:23:02 +02:00
|
|
|
|
|
|
|
|
|
/***** Remove surveys of the degree *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Svy_RemoveSurveys (HieLvl_DEG,DegCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2015-01-20 02:00:42 +01:00
|
|
|
|
/***** Remove information related to files in degree *****/
|
2021-05-27 00:30:06 +02:00
|
|
|
|
Brw_DB_RemoveDegFiles (DegCod);
|
2015-01-25 18:50:43 +01:00
|
|
|
|
|
|
|
|
|
/***** Remove directories of the degree *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (PathDeg,sizeof (PathDeg),"%s/%02u/%u",
|
2019-03-20 01:36:36 +01:00
|
|
|
|
Cfg_PATH_DEG_PUBLIC,
|
2018-10-17 10:32:18 +02:00
|
|
|
|
(unsigned) (DegCod % 100),
|
2021-02-15 16:25:55 +01:00
|
|
|
|
(unsigned) DegCod);
|
2016-10-06 22:18:33 +02:00
|
|
|
|
Fil_RemoveTree (PathDeg);
|
2015-01-20 18:55:59 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Remove administrators of this degree *****/
|
2021-06-11 11:36:34 +02:00
|
|
|
|
Adm_DB_RemAdmins (HieLvl_DEG,DegCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Remove the degree *****/
|
2021-05-28 19:59:55 +02:00
|
|
|
|
Deg_DB_RemoveDeg (DegCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-01-05 12:52:03 +01:00
|
|
|
|
/***** Flush caches *****/
|
|
|
|
|
Crs_FlushCacheNumCrssInDeg ();
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Delete all the degrees in sta_degrees table not present in degrees table *****/
|
2021-07-08 15:00:17 +02:00
|
|
|
|
Pho_DB_RemoveObsoleteStatDegrees ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/************************ Change the name of a degree ************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_RenameDegreeShort (void)
|
|
|
|
|
{
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/***** Degree constructor *****/
|
|
|
|
|
Deg_EditingDegreeConstructor ();
|
|
|
|
|
|
2019-04-07 19:49:53 +02:00
|
|
|
|
/***** Rename degree *****/
|
2021-09-13 23:11:15 +02:00
|
|
|
|
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1L);
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Deg_RenameDegree (Deg_EditingDeg,Cns_SHRT_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-07 12:17:10 +02:00
|
|
|
|
void Deg_RenameDegreeFull (void)
|
2016-10-23 16:15:28 +02:00
|
|
|
|
{
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/***** Degree constructor *****/
|
|
|
|
|
Deg_EditingDegreeConstructor ();
|
|
|
|
|
|
2019-04-07 19:49:53 +02:00
|
|
|
|
/***** Rename degree *****/
|
2021-09-13 23:11:15 +02:00
|
|
|
|
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1L);
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Deg_RenameDegree (Deg_EditingDeg,Cns_FULL_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Change the name of a degree ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
void Deg_RenameDegree (struct Deg_Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_degree_X_already_exists;
|
|
|
|
|
extern const char *Txt_The_name_of_the_degree_X_has_changed_to_Y;
|
|
|
|
|
extern const char *Txt_The_name_of_the_degree_X_has_not_changed;
|
|
|
|
|
const char *ParamName = NULL; // Initialized to avoid warning
|
|
|
|
|
const char *FieldName = NULL; // Initialized to avoid warning
|
2017-03-07 11:03:05 +01:00
|
|
|
|
unsigned MaxBytes = 0; // Initialized to avoid warning
|
2014-12-01 23:55:08 +01:00
|
|
|
|
char *CurrentDegName = NULL; // Initialized to avoid warning
|
2021-02-11 22:57:09 +01:00
|
|
|
|
char NewDegName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-10-28 10:03:37 +02:00
|
|
|
|
switch (ShrtOrFullName)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-10-28 10:03:37 +02:00
|
|
|
|
case Cns_SHRT_NAME:
|
2014-12-01 23:55:08 +01:00
|
|
|
|
ParamName = "ShortName";
|
|
|
|
|
FieldName = "ShortName";
|
2021-02-11 22:57:09 +01:00
|
|
|
|
MaxBytes = Cns_HIERARCHY_MAX_BYTES_SHRT_NAME;
|
2016-10-28 10:03:37 +02:00
|
|
|
|
CurrentDegName = Deg->ShrtName;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
|
|
|
|
case Cns_FULL_NAME:
|
|
|
|
|
ParamName = "FullName";
|
|
|
|
|
FieldName = "FullName";
|
2021-02-11 22:57:09 +01:00
|
|
|
|
MaxBytes = Cns_HIERARCHY_MAX_BYTES_FULL_NAME;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
CurrentDegName = Deg->FullName;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Get parameters from form *****/
|
|
|
|
|
/* Get the new name for the degree */
|
2017-03-07 11:03:05 +01:00
|
|
|
|
Par_GetParToText (ParamName,NewDegName,MaxBytes);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-03-01 13:36:48 +01:00
|
|
|
|
/***** Get data of degree *****/
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg_GetDataOfDegreeByCod (Deg);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if new name is empty *****/
|
2019-12-20 00:30:54 +01:00
|
|
|
|
if (NewDegName[0])
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-01-02 15:10:51 +01:00
|
|
|
|
/***** Check if old and new names are the same
|
|
|
|
|
(this happens when return is pressed without changes) *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (strcmp (CurrentDegName,NewDegName)) // Different names
|
|
|
|
|
{
|
|
|
|
|
/***** If degree was in database... *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (Deg_DB_CheckIfDegNameExistsInCtr (ParamName,NewDegName,Deg->DegCod,Deg->CtrCod))
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_The_degree_X_already_exists,
|
|
|
|
|
NewDegName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Update the table changing old name by new name */
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Deg_DB_UpdateDegNameDB (Deg->DegCod,FieldName,NewDegName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-03-01 13:36:48 +01:00
|
|
|
|
/* Write message to show the change made */
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_The_name_of_the_degree_X_has_changed_to_Y,
|
|
|
|
|
CurrentDegName,NewDegName);
|
2016-03-01 13:36:48 +01:00
|
|
|
|
|
|
|
|
|
/* Change current degree name in order to display it properly */
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Str_Copy (CurrentDegName,NewDegName,MaxBytes);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else // The same name
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlert (Ale_INFO,NULL,
|
|
|
|
|
Txt_The_name_of_the_degree_X_has_not_changed,
|
|
|
|
|
CurrentDegName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2019-12-20 00:30:54 +01:00
|
|
|
|
else
|
|
|
|
|
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Change the type of a degree ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_ChangeDegreeType (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_type_of_degree_of_the_degree_X_has_changed;
|
|
|
|
|
long NewDegTypCod;
|
|
|
|
|
|
|
|
|
|
/***** Degree constructor *****/
|
|
|
|
|
Deg_EditingDegreeConstructor ();
|
|
|
|
|
|
|
|
|
|
/***** Get parameters from form *****/
|
|
|
|
|
/* Get degree code */
|
2021-09-13 23:11:15 +02:00
|
|
|
|
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1L);
|
2019-04-07 12:17:10 +02:00
|
|
|
|
|
|
|
|
|
/* Get the new degree type */
|
2021-05-27 23:30:16 +02:00
|
|
|
|
NewDegTypCod = DegTyp_GetAndCheckParamOtherDegTypCod (1);
|
2019-04-07 12:17:10 +02:00
|
|
|
|
|
|
|
|
|
/***** Get data of degree *****/
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
|
2019-04-07 12:17:10 +02:00
|
|
|
|
|
|
|
|
|
/***** Update the table of degrees changing old type by new type *****/
|
2021-05-28 19:59:55 +02:00
|
|
|
|
Deg_DB_UpdateDegTyp (Deg_EditingDeg->DegCod,NewDegTypCod);
|
2019-04-08 12:01:08 +02:00
|
|
|
|
Deg_EditingDeg->DegTypCod = NewDegTypCod;
|
2019-04-07 12:17:10 +02:00
|
|
|
|
|
2019-04-08 14:52:13 +02:00
|
|
|
|
/***** Create alert to show the change made
|
2019-04-07 12:17:10 +02:00
|
|
|
|
and put button to go to degree changed *****/
|
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_The_type_of_degree_of_the_degree_X_has_changed,
|
|
|
|
|
Deg_EditingDeg->FullName);
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Change the WWW of a degree ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_ChangeDegWWW (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_new_web_address_is_X;
|
2017-03-07 01:56:41 +01:00
|
|
|
|
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/***** Degree constructor *****/
|
|
|
|
|
Deg_EditingDegreeConstructor ();
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Get parameters from form *****/
|
|
|
|
|
/* Get the code of the degree */
|
2021-09-13 23:11:15 +02:00
|
|
|
|
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the new WWW for the degree */
|
2017-03-07 01:56:41 +01:00
|
|
|
|
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-03-01 13:36:48 +01:00
|
|
|
|
/***** Get data of degree *****/
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
|
2016-03-01 13:36:48 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Check if new WWW is empty *****/
|
|
|
|
|
if (NewWWW[0])
|
|
|
|
|
{
|
2016-03-01 13:36:48 +01:00
|
|
|
|
/***** Update the table changing old WWW by new WWW *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Deg_DB_UpdateDegWWW (Deg_EditingDeg->DegCod,NewWWW);
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Str_Copy (Deg_EditingDeg->WWW,NewWWW,sizeof (Deg_EditingDeg->WWW) - 1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-03-09 20:12:44 +01:00
|
|
|
|
/***** Write alert to show the change made
|
2017-05-11 20:04:38 +02:00
|
|
|
|
and put button to go to degree changed *****/
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_The_new_web_address_is_X,
|
|
|
|
|
NewWWW);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-12-20 00:30:54 +01:00
|
|
|
|
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
2016-10-23 16:37:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Change the status of a degree ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_ChangeDegStatus (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_status_of_the_degree_X_has_changed;
|
|
|
|
|
Deg_Status_t Status;
|
|
|
|
|
Deg_StatusTxt_t StatusTxt;
|
|
|
|
|
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/***** Degree constructor *****/
|
|
|
|
|
Deg_EditingDegreeConstructor ();
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Get parameters from form *****/
|
|
|
|
|
/* Get degree code */
|
2021-09-13 23:11:15 +02:00
|
|
|
|
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get parameter with status */
|
2017-01-29 21:41:08 +01:00
|
|
|
|
Status = (Deg_Status_t)
|
|
|
|
|
Par_GetParToUnsignedLong ("Status",
|
|
|
|
|
0,
|
|
|
|
|
(unsigned long) Deg_MAX_STATUS,
|
|
|
|
|
(unsigned long) Deg_WRONG_STATUS);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
if (Status == Deg_WRONG_STATUS)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongStatusExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
StatusTxt = Deg_GetStatusTxtFromStatusBits (Status);
|
|
|
|
|
Status = Deg_GetStatusBitsFromStatusTxt (StatusTxt); // New status
|
|
|
|
|
|
|
|
|
|
/***** Get data of degree *****/
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Update status in table of degrees *****/
|
2021-05-28 19:59:55 +02:00
|
|
|
|
Deg_DB_UpdateDegStatus (Deg_EditingDeg->DegCod,Status);
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Deg_EditingDeg->Status = Status;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-03-09 20:12:44 +01:00
|
|
|
|
/***** Write alert to show the change made
|
2017-05-11 20:04:38 +02:00
|
|
|
|
and put button to go to degree changed *****/
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_The_status_of_the_degree_X_has_changed,
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Deg_EditingDeg->ShrtName);
|
2019-04-08 14:52:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2019-04-08 15:33:29 +02:00
|
|
|
|
/********* Show alerts after changing a degree and continue editing **********/
|
2019-04-08 14:52:13 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_ContEditAfterChgDeg (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Write message to show the change made
|
|
|
|
|
and put button to go to degree changed *****/
|
2017-05-11 20:04:38 +02:00
|
|
|
|
Deg_ShowAlertAndButtonToGoToDeg ();
|
2016-03-01 13:36:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Deg_EditDegreesInternal ();
|
2016-03-01 13:36:48 +01:00
|
|
|
|
|
2019-04-07 12:17:10 +02:00
|
|
|
|
/***** Degree destructor *****/
|
|
|
|
|
Deg_EditingDegreeDestructor ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-01 13:36:48 +01:00
|
|
|
|
/*****************************************************************************/
|
2017-05-11 20:55:04 +02:00
|
|
|
|
/***************** Write message to show the change made ********************/
|
|
|
|
|
/***************** and put button to go to degree changed ********************/
|
2016-03-01 13:36:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-04-08 14:52:13 +02:00
|
|
|
|
static void Deg_ShowAlertAndButtonToGoToDeg (void)
|
2016-03-01 13:36:48 +01:00
|
|
|
|
{
|
2017-05-11 20:04:38 +02:00
|
|
|
|
// If the degree being edited is different to the current one...
|
2019-04-07 12:17:10 +02:00
|
|
|
|
if (Deg_EditingDeg->DegCod != Gbl.Hierarchy.Deg.DegCod)
|
2016-03-01 23:58:48 +01:00
|
|
|
|
{
|
2017-05-11 21:53:37 +02:00
|
|
|
|
/***** Alert with button to go to degree *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Ale_ShowLastAlertAndButton (ActSeeCrs,NULL,NULL,
|
2020-04-08 18:18:46 +02:00
|
|
|
|
Deg_PutParamGoToDeg,&Deg_EditingDeg->DegCod,
|
2019-12-30 12:25:45 +01:00
|
|
|
|
Btn_CONFIRM_BUTTON,
|
|
|
|
|
Hie_BuildGoToMsg (Deg_EditingDeg->ShrtName));
|
|
|
|
|
Hie_FreeGoToMsg ();
|
2016-03-01 23:58:48 +01:00
|
|
|
|
}
|
2017-05-11 20:04:38 +02:00
|
|
|
|
else
|
2017-05-11 21:53:37 +02:00
|
|
|
|
/***** Alert *****/
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlerts (NULL);
|
2017-05-11 20:04:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Deg_PutParamGoToDeg (void *DegCod)
|
2017-05-11 20:04:38 +02:00
|
|
|
|
{
|
2020-04-08 18:18:46 +02:00
|
|
|
|
if (DegCod)
|
|
|
|
|
Deg_PutParamDegCod (*((long *) DegCod));
|
2016-03-01 13:36:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-17 19:31:21 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********** Show a form for sending a logo of the current degree ************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_RequestLogo (void)
|
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Lgo_RequestLogo (HieLvl_DEG);
|
2015-01-17 19:31:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Receive the logo of the current degree ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_ReceiveLogo (void)
|
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Lgo_ReceiveLogo (HieLvl_DEG);
|
2015-01-17 19:31:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-02-03 18:43:55 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Remove the logo of the current degree ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Deg_RemoveLogo (void)
|
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Lgo_RemoveLogo (HieLvl_DEG);
|
2015-02-03 18:43:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Get total number of degrees *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned Deg_GetCachedNumDegsInSys (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned NumDegs;
|
|
|
|
|
|
|
|
|
|
/***** Get number of degrees from cache *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (!FigCch_GetFigureFromCache (FigCch_NUM_DEGS,HieLvl_SYS,-1L,
|
2020-05-03 20:58:03 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumDegs))
|
|
|
|
|
{
|
|
|
|
|
/***** Get current number of degrees from database and update cache *****/
|
2021-03-06 00:38:52 +01:00
|
|
|
|
NumDegs = (unsigned) DB_GetNumRowsTable ("deg_degrees");
|
2021-05-27 23:30:16 +02:00
|
|
|
|
FigCch_UpdateFigureIntoCache (FigCch_NUM_DEGS,HieLvl_SYS,-1L,
|
2020-05-03 20:58:03 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumDegs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NumDegs;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Get number of degrees in a country ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-01-07 16:08:13 +01:00
|
|
|
|
void Deg_FlushCacheNumDegsInCty (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-01-07 16:08:13 +01:00
|
|
|
|
Gbl.Cache.NumDegsInCty.CtyCod = -1L;
|
|
|
|
|
Gbl.Cache.NumDegsInCty.NumDegs = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Deg_GetNumDegsInCty (long CtyCod)
|
|
|
|
|
{
|
|
|
|
|
/***** 1. Fast check: Trivial case *****/
|
|
|
|
|
if (CtyCod <= 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/***** 2. Fast check: If cached... *****/
|
|
|
|
|
if (CtyCod == Gbl.Cache.NumDegsInCty.CtyCod)
|
|
|
|
|
return Gbl.Cache.NumDegsInCty.NumDegs;
|
|
|
|
|
|
|
|
|
|
/***** 3. Slow: number of degrees in a country from database *****/
|
|
|
|
|
Gbl.Cache.NumDegsInCty.CtyCod = CtyCod;
|
2021-05-28 19:59:55 +02:00
|
|
|
|
Gbl.Cache.NumDegsInCty.NumDegs = Deg_DB_GetNumDegsInCty (CtyCod);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
FigCch_UpdateFigureIntoCache (FigCch_NUM_DEGS,HieLvl_CTY,Gbl.Cache.NumDegsInCty.CtyCod,
|
2020-05-03 21:56:55 +02:00
|
|
|
|
FigCch_UNSIGNED,&Gbl.Cache.NumDegsInCty.NumDegs);
|
2020-01-07 16:08:13 +01:00
|
|
|
|
return Gbl.Cache.NumDegsInCty.NumDegs;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned Deg_GetCachedNumDegsInCty (long CtyCod)
|
|
|
|
|
{
|
|
|
|
|
unsigned NumDegs;
|
|
|
|
|
|
|
|
|
|
/***** Get number of degrees from cache *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (!FigCch_GetFigureFromCache (FigCch_NUM_DEGS,HieLvl_CTY,CtyCod,
|
2020-05-03 20:58:03 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumDegs))
|
|
|
|
|
/***** Get current number of degrees from database and update cache *****/
|
|
|
|
|
NumDegs = Deg_GetNumDegsInCty (CtyCod);
|
|
|
|
|
|
|
|
|
|
return NumDegs;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Get number of degrees in an institution ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-01-06 18:43:48 +01:00
|
|
|
|
void Deg_FlushCacheNumDegsInIns (void)
|
|
|
|
|
{
|
|
|
|
|
Gbl.Cache.NumDegsInIns.InsCod = -1L;
|
|
|
|
|
Gbl.Cache.NumDegsInIns.NumDegs = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned Deg_GetNumDegsInIns (long InsCod)
|
|
|
|
|
{
|
2020-01-06 18:43:48 +01:00
|
|
|
|
/***** 1. Fast check: Trivial case *****/
|
|
|
|
|
if (InsCod <= 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/***** 2. Fast check: If cached... *****/
|
|
|
|
|
if (InsCod == Gbl.Cache.NumDegsInIns.InsCod)
|
|
|
|
|
return Gbl.Cache.NumDegsInIns.NumDegs;
|
|
|
|
|
|
|
|
|
|
/***** 3. Slow: number of degrees in an institution from database *****/
|
|
|
|
|
Gbl.Cache.NumDegsInIns.InsCod = InsCod;
|
2021-05-28 19:59:55 +02:00
|
|
|
|
Gbl.Cache.NumDegsInIns.NumDegs = Deg_DB_GetNumDegsInIns (InsCod);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
FigCch_UpdateFigureIntoCache (FigCch_NUM_DEGS,HieLvl_INS,Gbl.Cache.NumDegsInIns.InsCod,
|
2020-05-03 21:56:55 +02:00
|
|
|
|
FigCch_UNSIGNED,&Gbl.Cache.NumDegsInIns.NumDegs);
|
2020-01-06 18:43:48 +01:00
|
|
|
|
return Gbl.Cache.NumDegsInIns.NumDegs;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned Deg_GetCachedNumDegsInIns (long InsCod)
|
|
|
|
|
{
|
|
|
|
|
unsigned NumDegs;
|
|
|
|
|
|
|
|
|
|
/***** Get number of degrees from cache *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (!FigCch_GetFigureFromCache (FigCch_NUM_DEGS,HieLvl_INS,InsCod,
|
2020-05-03 20:58:03 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumDegs))
|
|
|
|
|
/***** Get current number of degrees from database and update cache *****/
|
|
|
|
|
NumDegs = Deg_GetNumDegsInIns (InsCod);
|
|
|
|
|
|
|
|
|
|
return NumDegs;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/******************** Get number of degrees in a center **********************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-01-05 02:18:20 +01:00
|
|
|
|
void Deg_FlushCacheNumDegsInCtr (void)
|
|
|
|
|
{
|
|
|
|
|
Gbl.Cache.NumDegsInCtr.CtrCod = -1L;
|
|
|
|
|
Gbl.Cache.NumDegsInCtr.NumDegs = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned Deg_GetNumDegsInCtr (long CtrCod)
|
|
|
|
|
{
|
2020-01-05 02:18:20 +01:00
|
|
|
|
/***** 1. Fast check: Trivial case *****/
|
|
|
|
|
if (CtrCod <= 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/***** 2. Fast check: If cached... *****/
|
|
|
|
|
if (CtrCod == Gbl.Cache.NumDegsInCtr.CtrCod)
|
|
|
|
|
return Gbl.Cache.NumDegsInCtr.NumDegs;
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** 3. Slow: number of degrees in a center from database *****/
|
2020-01-05 02:18:20 +01:00
|
|
|
|
Gbl.Cache.NumDegsInCtr.CtrCod = CtrCod;
|
2021-05-28 19:59:55 +02:00
|
|
|
|
Gbl.Cache.NumDegsInCtr.NumDegs = Deg_DB_GetNumDegsInCtr (CtrCod);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
FigCch_UpdateFigureIntoCache (FigCch_NUM_DEGS,HieLvl_CTR,Gbl.Cache.NumDegsInCtr.CtrCod,
|
2020-05-03 21:56:55 +02:00
|
|
|
|
FigCch_UNSIGNED,&Gbl.Cache.NumDegsInCtr.NumDegs);
|
2020-01-05 02:18:20 +01:00
|
|
|
|
return Gbl.Cache.NumDegsInCtr.NumDegs;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned Deg_GetCachedNumDegsInCtr (long CtrCod)
|
|
|
|
|
{
|
|
|
|
|
unsigned NumDegs;
|
|
|
|
|
|
|
|
|
|
/***** Get number of degrees from cache *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (!FigCch_GetFigureFromCache (FigCch_NUM_DEGS,HieLvl_CTR,CtrCod,
|
2020-05-03 20:58:03 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumDegs))
|
|
|
|
|
/***** Get current number of degrees from database and update cache *****/
|
|
|
|
|
NumDegs = Deg_GetNumDegsInCtr (CtrCod);
|
|
|
|
|
|
|
|
|
|
return NumDegs;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/********************* Get number of centers with courses ********************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-09-10 10:19:46 +02:00
|
|
|
|
unsigned Deg_GetCachedNumDegsWithCrss (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-05-03 20:58:03 +02:00
|
|
|
|
unsigned NumDegsWithCrss;
|
2021-09-10 10:19:46 +02:00
|
|
|
|
long Cod = Sco_GetCurrentCod ();
|
2020-05-03 20:58:03 +02:00
|
|
|
|
|
|
|
|
|
/***** Get number of degrees with courses from cache *****/
|
2021-09-10 10:19:46 +02:00
|
|
|
|
if (!FigCch_GetFigureFromCache (FigCch_NUM_DEGS_WITH_CRSS,Gbl.Scope.Current,Cod,
|
2020-05-03 20:58:03 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumDegsWithCrss))
|
|
|
|
|
{
|
|
|
|
|
/***** Get current number of degrees with courses from database and update cache *****/
|
2021-09-10 10:19:46 +02:00
|
|
|
|
NumDegsWithCrss = Deg_DB_GetNumDegsWithCrss (Gbl.Scope.Current,Cod);
|
|
|
|
|
FigCch_UpdateFigureIntoCache (FigCch_NUM_DEGS_WITH_CRSS,Gbl.Scope.Current,Cod,
|
2020-05-03 20:58:03 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumDegsWithCrss);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NumDegsWithCrss;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Get number of degrees with users **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-09-10 10:19:46 +02:00
|
|
|
|
unsigned Deg_GetCachedNumDegsWithUsrs (Rol_Role_t Role)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-05-03 20:58:03 +02:00
|
|
|
|
static const FigCch_FigureCached_t FigureDegs[Rol_NUM_ROLES] =
|
|
|
|
|
{
|
|
|
|
|
[Rol_STD] = FigCch_NUM_DEGS_WITH_STDS, // Students
|
|
|
|
|
[Rol_NET] = FigCch_NUM_DEGS_WITH_NETS, // Non-editing teachers
|
|
|
|
|
[Rol_TCH] = FigCch_NUM_DEGS_WITH_TCHS, // Teachers
|
|
|
|
|
};
|
|
|
|
|
unsigned NumDegsWithUsrs;
|
2021-09-10 10:19:46 +02:00
|
|
|
|
long Cod = Sco_GetCurrentCod ();
|
2020-05-03 20:58:03 +02:00
|
|
|
|
|
|
|
|
|
/***** Get number of degrees with users from cache *****/
|
2021-09-10 10:19:46 +02:00
|
|
|
|
if (!FigCch_GetFigureFromCache (FigureDegs[Role],Gbl.Scope.Current,Cod,
|
2020-05-03 20:58:03 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumDegsWithUsrs))
|
|
|
|
|
{
|
|
|
|
|
/***** Get current number of degrees with users from database and update cache *****/
|
2021-09-10 10:19:46 +02:00
|
|
|
|
NumDegsWithUsrs = Deg_DB_GetNumDegsWithUsrs (Role,Gbl.Scope.Current,Cod);
|
|
|
|
|
FigCch_UpdateFigureIntoCache (FigureDegs[Role],Gbl.Scope.Current,Cod,
|
2020-05-03 20:58:03 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumDegsWithUsrs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NumDegsWithUsrs;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2018-10-30 17:47:57 +01:00
|
|
|
|
/**************************** List degrees found *****************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2018-10-30 17:47:57 +01:00
|
|
|
|
void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumDegs)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_degree;
|
|
|
|
|
extern const char *Txt_degrees;
|
|
|
|
|
unsigned NumDeg;
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Deg_Degree Deg;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Query database *****/
|
2018-10-30 17:47:57 +01:00
|
|
|
|
if (NumDegs)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/* Number of degrees found */
|
2019-12-30 21:47:07 +01:00
|
|
|
|
Box_BoxTableBegin (NULL,Str_BuildStringLongStr ((long) NumDegs,
|
|
|
|
|
(NumDegs == 1) ? Txt_degree :
|
|
|
|
|
Txt_degrees),
|
2020-03-26 02:54:30 +01:00
|
|
|
|
NULL,NULL,
|
|
|
|
|
NULL,Box_NOT_CLOSABLE,2);
|
2019-12-30 21:47:07 +01:00
|
|
|
|
Str_FreeString ();
|
2017-06-12 14:16:33 +02:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Write heading *****/
|
|
|
|
|
Deg_PutHeadDegreesForSeeing ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** List the degrees (one row per degree) *****/
|
|
|
|
|
for (NumDeg = 1;
|
|
|
|
|
NumDeg <= NumDegs;
|
|
|
|
|
NumDeg++)
|
|
|
|
|
{
|
|
|
|
|
/* Get next degree */
|
|
|
|
|
Deg.DegCod = DB_GetNextCode (*mysql_res);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Get data of degree */
|
|
|
|
|
Deg_GetDataOfDegreeByCod (&Deg);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Write data of this degree */
|
|
|
|
|
Deg_ListOneDegreeForSeeing (&Deg,NumDeg);
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table and box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
2018-10-30 17:47:57 +01:00
|
|
|
|
DB_FreeMySQLResult (mysql_res);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2019-04-07 12:17:10 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Degree constructor/destructor **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Deg_EditingDegreeConstructor (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Pointer must be NULL *****/
|
|
|
|
|
if (Deg_EditingDeg != NULL)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongDegreeExit ();
|
2019-04-07 12:17:10 +02:00
|
|
|
|
|
|
|
|
|
/***** Allocate memory for degree *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
if ((Deg_EditingDeg = malloc (sizeof (*Deg_EditingDeg))) == NULL)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2019-04-07 12:17:10 +02:00
|
|
|
|
|
|
|
|
|
/***** Reset degree *****/
|
2019-06-13 10:14:05 +02:00
|
|
|
|
Deg_EditingDeg->DegCod = -1L;
|
|
|
|
|
Deg_EditingDeg->DegTypCod = -1L;
|
|
|
|
|
Deg_EditingDeg->CtrCod = -1L;
|
2020-01-05 12:52:03 +01:00
|
|
|
|
Deg_EditingDeg->Status = (Deg_Status_t) 0;
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Deg_EditingDeg->RequesterUsrCod = -1L;
|
2019-06-13 10:14:05 +02:00
|
|
|
|
Deg_EditingDeg->ShrtName[0] = '\0';
|
|
|
|
|
Deg_EditingDeg->FullName[0] = '\0';
|
|
|
|
|
Deg_EditingDeg->WWW[0] = '\0';
|
2019-04-07 12:17:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Deg_EditingDegreeDestructor (void)
|
|
|
|
|
{
|
2019-04-07 19:49:53 +02:00
|
|
|
|
/***** Free memory used for degree *****/
|
2019-04-07 12:17:10 +02:00
|
|
|
|
if (Deg_EditingDeg != NULL)
|
|
|
|
|
{
|
2019-11-06 19:45:20 +01:00
|
|
|
|
free (Deg_EditingDeg);
|
2019-04-07 12:17:10 +02:00
|
|
|
|
Deg_EditingDeg = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|