2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_department.c: departments
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Copyright (C) 1999-2023 Antonio Ca<EFBFBD>as Vargas
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-12-29 23:41:26 +01:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
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
|
2021-12-29 23:41:26 +01:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <stdlib.h> // For calloc
|
|
|
|
|
#include <string.h> // For string functions
|
|
|
|
|
|
2022-11-06 18:11:10 +01:00
|
|
|
|
#include "swad_action_list.h"
|
2022-10-19 18:07:49 +02:00
|
|
|
|
#include "swad_alert.h"
|
2017-06-10 21:38:10 +02:00
|
|
|
|
#include "swad_box.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_constant.h"
|
|
|
|
|
#include "swad_database.h"
|
|
|
|
|
#include "swad_department.h"
|
2021-06-02 23:48:43 +02:00
|
|
|
|
#include "swad_department_database.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_global.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_institution.h"
|
2018-12-08 16:43:13 +01:00
|
|
|
|
#include "swad_language.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_parameter.h"
|
2023-03-10 17:21:04 +01:00
|
|
|
|
#include "swad_parameter_code.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_string.h"
|
|
|
|
|
|
2023-04-19 12:11:38 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Private constants ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static const bool Dpt_ICanEditDpts[Rol_NUM_ROLES] =
|
|
|
|
|
{
|
|
|
|
|
/* Users who can edit */
|
|
|
|
|
[Rol_INS_ADM] = true,
|
|
|
|
|
[Rol_SYS_ADM] = true,
|
|
|
|
|
};
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private variables *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 20:50:47 +02:00
|
|
|
|
static struct Dpt_Department *Dpt_EditingDpt = NULL; // Static variable to keep the department being edited
|
2019-04-08 23:34:58 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static void Dpt_ResetDepartments (struct Dpt_Departments *Departments);
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
static Dpt_Order_t Dpt_GetParDptOrder (void);
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Dpt_PutIconToEditDpts (__attribute__((unused)) void *Args);
|
2023-04-20 22:59:13 +02:00
|
|
|
|
static void Dpt_PutIconToViewDpts (__attribute__((unused)) void *Args);
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static void Dpt_EditDepartmentsInternal (void);
|
2020-04-13 20:50:47 +02:00
|
|
|
|
|
|
|
|
|
static void Dpt_GetListDepartments (struct Dpt_Departments *Departments,long InsCod);
|
|
|
|
|
|
2023-03-23 11:28:22 +01:00
|
|
|
|
static void Dpt_GetDepartmentDataFromRow (MYSQL_RES *mysql_res,
|
|
|
|
|
struct Dpt_Department *Dpt);
|
|
|
|
|
|
2020-04-13 20:50:47 +02:00
|
|
|
|
static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departments);
|
2023-03-10 00:13:55 +01:00
|
|
|
|
static void Dpt_PutParDptCod (void *DptCod);
|
2017-03-09 11:16:17 +01:00
|
|
|
|
|
2016-10-28 10:03:37 +02:00
|
|
|
|
static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName);
|
2017-03-09 11:16:17 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static void Dpt_PutFormToCreateDepartment (void);
|
|
|
|
|
static void Dpt_PutHeadDepartments (void);
|
|
|
|
|
|
2019-04-08 23:34:58 +02:00
|
|
|
|
static void Dpt_EditingDepartmentConstructor (void);
|
|
|
|
|
static void Dpt_EditingDepartmentDestructor (void);
|
|
|
|
|
|
2020-04-13 20:50:47 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Reset departments context *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static void Dpt_ResetDepartments (struct Dpt_Departments *Departments)
|
2020-04-13 20:50:47 +02:00
|
|
|
|
{
|
|
|
|
|
Departments->Num = 0;
|
|
|
|
|
Departments->Lst = NULL;
|
|
|
|
|
Departments->SelectedOrder = Dpt_ORDER_DEFAULT;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/*************************** List all departments ****************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-04-19 12:11:38 +02:00
|
|
|
|
void Dpt_SeeAllDepts (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-11-28 10:57:34 +01:00
|
|
|
|
extern const char *Hlp_INSTITUTION_Departments;
|
2019-04-08 23:34:58 +02:00
|
|
|
|
extern const char *Txt_Departments_of_INSTITUTION_X;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_DEPARTMENTS_HELP_ORDER[2];
|
|
|
|
|
extern const char *Txt_DEPARTMENTS_ORDER[2];
|
|
|
|
|
extern const char *Txt_Other_departments;
|
|
|
|
|
extern const char *Txt_Department_unspecified;
|
2020-04-13 20:50:47 +02:00
|
|
|
|
struct Dpt_Departments Departments;
|
2021-12-29 23:41:26 +01:00
|
|
|
|
char *Title;
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Dpt_Order_t Order;
|
2022-01-02 00:39:26 +01:00
|
|
|
|
static HTM_HeadAlign Align[Dpt_NUM_ORDERS] =
|
|
|
|
|
{
|
|
|
|
|
[Dpt_ORDER_BY_DEPARTMENT] = HTM_HEAD_LEFT,
|
|
|
|
|
[Dpt_ORDER_BY_NUM_TCHS ] = HTM_HEAD_RIGHT
|
|
|
|
|
};
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumDpt;
|
2020-02-14 10:02:58 +01:00
|
|
|
|
unsigned NumTchsInsInOtherDpts;
|
|
|
|
|
unsigned NumTchsInsWithNoDpt;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
/***** Trivial check *****/
|
|
|
|
|
if (Gbl.Hierarchy.Ins.InsCod <= 0) // No institution selected
|
|
|
|
|
return;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-04-13 20:50:47 +02:00
|
|
|
|
/***** Reset departments context *****/
|
|
|
|
|
Dpt_ResetDepartments (&Departments);
|
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
/***** Get parameter with the type of order in the list of departments *****/
|
2023-03-10 00:13:55 +01:00
|
|
|
|
Departments.SelectedOrder = Dpt_GetParDptOrder ();
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
|
|
|
|
/***** Get list of departments *****/
|
2020-04-13 20:50:47 +02:00
|
|
|
|
Dpt_GetListDepartments (&Departments,Gbl.Hierarchy.Ins.InsCod);
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2021-12-29 23:41:26 +01:00
|
|
|
|
if (asprintf (&Title,Txt_Departments_of_INSTITUTION_X,Gbl.Hierarchy.Ins.FullName) < 0)
|
|
|
|
|
Err_NotEnoughMemoryExit ();
|
|
|
|
|
Box_BoxTableBegin (NULL,Title,
|
2023-04-19 12:11:38 +02:00
|
|
|
|
Dpt_PutIconToEditDpts,NULL,
|
2021-12-29 23:41:26 +01:00
|
|
|
|
Hlp_INSTITUTION_Departments,Box_NOT_CLOSABLE,2);
|
|
|
|
|
free (Title);
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
/***** Write heading *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2022-01-02 00:39:26 +01:00
|
|
|
|
for (Order = (Dpt_Order_t) 0;
|
|
|
|
|
Order <= (Dpt_Order_t) (Dpt_NUM_ORDERS - 1);
|
2021-06-02 23:48:43 +02:00
|
|
|
|
Order++)
|
|
|
|
|
{
|
2022-01-02 15:17:30 +01:00
|
|
|
|
HTM_TH_Begin (Align[Order]);
|
2021-06-02 23:48:43 +02:00
|
|
|
|
|
|
|
|
|
Frm_BeginForm (ActSeeDpt);
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_PutParUnsigned (NULL,"Order",(unsigned) Order);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_DEPARTMENTS_HELP_ORDER[Order],
|
|
|
|
|
"class=\"BT_LINK\"");
|
2021-12-26 16:22:58 +01:00
|
|
|
|
if (Order == Departments.SelectedOrder)
|
|
|
|
|
HTM_U_Begin ();
|
|
|
|
|
HTM_Txt (Txt_DEPARTMENTS_ORDER[Order]);
|
|
|
|
|
if (Order == Departments.SelectedOrder)
|
|
|
|
|
HTM_U_End ();
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
|
|
|
|
|
HTM_TH_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TR_End ();
|
2019-10-07 08:55:06 +02:00
|
|
|
|
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/***** Write all departments and their number of teachers *****/
|
2021-06-02 23:48:43 +02:00
|
|
|
|
for (NumDpt = 0;
|
|
|
|
|
NumDpt < Departments.Num;
|
|
|
|
|
NumDpt++)
|
|
|
|
|
{
|
|
|
|
|
/* Write data of this department */
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 08:55:06 +02:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
2022-03-28 22:50:37 +02:00
|
|
|
|
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_%s\"",
|
2021-12-15 00:47:29 +01:00
|
|
|
|
Departments.Lst[NumDpt].WWW,
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_Txt (Departments.Lst[NumDpt].FullName);
|
|
|
|
|
HTM_A_End ();
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 08:55:06 +02:00
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_Unsigned (Departments.Lst[NumDpt].NumTchs);
|
|
|
|
|
HTM_TD_End ();
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
/***** Separation row *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2022-03-28 22:50:37 +02:00
|
|
|
|
HTM_TD_Begin ("colspan=\"3\" class=\"DAT_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_NBSP ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
HTM_TR_End ();
|
2020-02-14 10:02:58 +01:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
/***** Write teachers of this institution with other department *****/
|
2021-11-03 11:35:21 +01:00
|
|
|
|
NumTchsInsInOtherDpts = Dpt_DB_GetNumTchsCurrentInsInDepartment (0);
|
2019-10-07 08:55:06 +02:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 08:55:06 +02:00
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_Txt (Txt_Other_departments);
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 08:55:06 +02:00
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_Unsigned (NumTchsInsInOtherDpts);
|
|
|
|
|
HTM_TD_End ();
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_TR_End ();
|
2020-02-14 10:02:58 +01:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
/***** Write teachers with no department *****/
|
2021-11-03 11:35:21 +01:00
|
|
|
|
NumTchsInsWithNoDpt = Dpt_DB_GetNumTchsCurrentInsInDepartment (-1L);
|
2019-10-07 08:55:06 +02:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 08:55:06 +02:00
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_Txt (Txt_Department_unspecified);
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 08:55:06 +02:00
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_Unsigned (NumTchsInsWithNoDpt);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
|
|
|
|
/***** End table and box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
|
|
|
|
/***** Free list of departments *****/
|
2020-04-13 20:50:47 +02:00
|
|
|
|
Dpt_FreeListDepartments (&Departments);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******** Get parameter with the type or order in list of departments ********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
static Dpt_Order_t Dpt_GetParDptOrder (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2023-03-07 09:55:39 +01:00
|
|
|
|
return (Dpt_Order_t) Par_GetParUnsignedLong ("Order",
|
2023-03-10 00:13:55 +01:00
|
|
|
|
0,
|
|
|
|
|
Dpt_NUM_ORDERS - 1,
|
|
|
|
|
(unsigned long) Dpt_ORDER_DEFAULT);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-03-16 22:46:38 +01:00
|
|
|
|
/************************ Put icon to edit departments ***********************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void Dpt_PutIconToEditDpts (__attribute__((unused)) void *Args)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2023-04-19 12:11:38 +02:00
|
|
|
|
if (Dpt_ICanEditDpts[Gbl.Usrs.Me.Role.Logged])
|
|
|
|
|
Ico_PutContextualIconToEdit (ActEdiDpt,NULL,
|
|
|
|
|
NULL,NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-20 22:59:13 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Put icon to view departments ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Dpt_PutIconToViewDpts (__attribute__((unused)) void *Args)
|
|
|
|
|
{
|
|
|
|
|
Ico_PutContextualIconToView (ActSeeDpt,NULL,
|
|
|
|
|
NULL,NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******* Put forms to edit the departments of the current institution ********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Dpt_EditDepartments (void)
|
|
|
|
|
{
|
2019-04-08 23:34:58 +02:00
|
|
|
|
/***** Department constructor *****/
|
|
|
|
|
Dpt_EditingDepartmentConstructor ();
|
|
|
|
|
|
|
|
|
|
/***** Edit departments *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Dpt_EditDepartmentsInternal ();
|
2019-04-08 23:34:58 +02:00
|
|
|
|
|
|
|
|
|
/***** Department destructor *****/
|
|
|
|
|
Dpt_EditingDepartmentDestructor ();
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
static void Dpt_EditDepartmentsInternal (void)
|
2019-04-08 23:34:58 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_INSTITUTION_Departments_edit;
|
|
|
|
|
extern const char *Txt_Departments_of_INSTITUTION_X;
|
2020-04-13 21:26:47 +02:00
|
|
|
|
struct Dpt_Departments Departments;
|
2021-12-29 23:41:26 +01:00
|
|
|
|
char *Title;
|
2019-04-08 23:34:58 +02:00
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
/***** Trivial check *****/
|
2019-04-08 23:34:58 +02:00
|
|
|
|
if (Gbl.Hierarchy.Ins.InsCod <= 0) // An institution must be selected
|
2019-04-03 20:57:04 +02:00
|
|
|
|
return;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-04-13 21:26:47 +02:00
|
|
|
|
/***** Reset departments context *****/
|
|
|
|
|
Dpt_ResetDepartments (&Departments);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Get list of institutions *****/
|
2020-01-07 22:07:06 +01:00
|
|
|
|
Ins_GetBasicListOfInstitutions (Gbl.Hierarchy.Cty.CtyCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get list of departments *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Dpt_GetListDepartments (&Departments,Gbl.Hierarchy.Ins.InsCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box *****/
|
2021-12-29 23:41:26 +01:00
|
|
|
|
if (asprintf (&Title,Txt_Departments_of_INSTITUTION_X,Gbl.Hierarchy.Ins.FullName) < 0)
|
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2023-04-20 22:59:13 +02:00
|
|
|
|
Box_BoxBegin (NULL,Title,
|
|
|
|
|
Dpt_PutIconToViewDpts,NULL,
|
2019-04-08 23:34:58 +02:00
|
|
|
|
Hlp_INSTITUTION_Departments_edit,Box_NOT_CLOSABLE);
|
2021-12-29 23:41:26 +01:00
|
|
|
|
free (Title);
|
2019-04-08 23:34:58 +02:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
/***** Put a form to create a new department *****/
|
|
|
|
|
Dpt_PutFormToCreateDepartment ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
/***** Forms to edit current departments *****/
|
|
|
|
|
if (Departments.Num)
|
|
|
|
|
Dpt_ListDepartmentsForEdition (&Departments);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-08 23:34:58 +02:00
|
|
|
|
/***** End box *****/
|
2019-10-25 22:48:34 +02:00
|
|
|
|
Box_BoxEnd ();
|
2019-04-08 23:34:58 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Free list of departments *****/
|
2020-04-13 21:26:47 +02:00
|
|
|
|
Dpt_FreeListDepartments (&Departments);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Free list of institutions *****/
|
|
|
|
|
Ins_FreeListInstitutions ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Get list of departments **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// If InsCod > 0 ==> get departments of an institution
|
2017-10-10 10:46:35 +02:00
|
|
|
|
// If InsCod <= 0 ==> an empty list is returned
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-04-13 20:50:47 +02:00
|
|
|
|
static void Dpt_GetListDepartments (struct Dpt_Departments *Departments,long InsCod)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
unsigned NumDpt;
|
|
|
|
|
|
2017-10-10 10:46:35 +02:00
|
|
|
|
/***** Free list of departments *****/
|
2020-04-13 20:50:47 +02:00
|
|
|
|
Dpt_FreeListDepartments (Departments); // List is initialized to empty
|
2017-10-10 10:46:35 +02:00
|
|
|
|
|
|
|
|
|
if (InsCod > 0) // Institution specified
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-10-10 10:46:35 +02:00
|
|
|
|
/***** Get departments from database *****/
|
2021-06-05 12:21:14 +02:00
|
|
|
|
Departments->Num = Dpt_DB_GetListDepartments (&mysql_res,InsCod,
|
|
|
|
|
Departments->SelectedOrder);
|
2020-04-13 20:50:47 +02:00
|
|
|
|
if (Departments->Num) // Departments found...
|
2017-10-10 10:46:35 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Create list with courses in degree *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
if ((Departments->Lst = calloc (Departments->Num,
|
|
|
|
|
sizeof (*Departments->Lst))) == NULL)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2017-10-10 10:46:35 +02:00
|
|
|
|
|
|
|
|
|
/***** Get the departments *****/
|
|
|
|
|
for (NumDpt = 0;
|
2020-04-13 20:50:47 +02:00
|
|
|
|
NumDpt < Departments->Num;
|
2017-10-10 10:46:35 +02:00
|
|
|
|
NumDpt++)
|
2023-03-23 22:47:23 +01:00
|
|
|
|
Dpt_GetDepartmentDataFromRow (mysql_res,&Departments->Lst[NumDpt]);
|
2017-10-10 10:46:35 +02:00
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-10-10 10:46:35 +02:00
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-06-05 12:21:14 +02:00
|
|
|
|
/****************** Get data of department using its code ********************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-23 09:35:20 +01:00
|
|
|
|
void Dpt_GetDepartmentDataByCod (struct Dpt_Department *Dpt)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Another_department;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
|
|
|
|
|
/***** Clear data *****/
|
|
|
|
|
Dpt->InsCod = -1L;
|
2016-10-28 10:03:37 +02:00
|
|
|
|
Dpt->ShrtName[0] = Dpt->FullName[0] = Dpt->WWW[0] = '\0';
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Dpt->NumTchs = 0;
|
|
|
|
|
|
|
|
|
|
/***** Check if department code is correct *****/
|
|
|
|
|
if (Dpt->DptCod == 0)
|
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Str_Copy (Dpt->ShrtName,Txt_Another_department,sizeof (Dpt->ShrtName) - 1);
|
|
|
|
|
Str_Copy (Dpt->FullName,Txt_Another_department,sizeof (Dpt->FullName) - 1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else if (Dpt->DptCod > 0)
|
|
|
|
|
{
|
|
|
|
|
/***** Get data of a department from database *****/
|
2023-03-23 09:35:20 +01:00
|
|
|
|
if (Dpt_DB_GetDepartmentDataByCod (&mysql_res,Dpt->DptCod)) // Department found...
|
2023-03-23 11:28:22 +01:00
|
|
|
|
Dpt_GetDepartmentDataFromRow (mysql_res,Dpt);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Free list of departments *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 20:50:47 +02:00
|
|
|
|
void Dpt_FreeListDepartments (struct Dpt_Departments *Departments)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-04-13 20:50:47 +02:00
|
|
|
|
if (Departments->Lst)
|
2017-10-10 10:46:35 +02:00
|
|
|
|
/***** Free memory used by the list of departments *****/
|
2020-04-13 20:50:47 +02:00
|
|
|
|
free (Departments->Lst);
|
2017-10-10 10:46:35 +02:00
|
|
|
|
|
2020-04-13 20:50:47 +02:00
|
|
|
|
Departments->Lst = NULL;
|
|
|
|
|
Departments->Num = 0;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-23 11:28:22 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Get data of department from database row *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Dpt_GetDepartmentDataFromRow (MYSQL_RES *mysql_res,
|
|
|
|
|
struct Dpt_Department *Dpt)
|
|
|
|
|
{
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
|
2023-03-23 19:56:18 +01:00
|
|
|
|
/***** Get next row from result *****/
|
2023-03-23 11:28:22 +01:00
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
|
|
|
|
/***** Get department code (row[0]) *****/
|
|
|
|
|
if ((Dpt->DptCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
|
|
|
|
Err_WrongDepartmentExit ();
|
|
|
|
|
|
|
|
|
|
/***** Get institution code (row[1]) *****/
|
|
|
|
|
if ((Dpt->InsCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
|
|
|
|
Err_WrongInstitExit ();
|
|
|
|
|
|
|
|
|
|
/***** Get short name (row[2]), full name (row[3])
|
|
|
|
|
and URL (row[4]) of the department *****/
|
|
|
|
|
Str_Copy (Dpt->ShrtName,row[2],sizeof (Dpt->ShrtName) - 1);
|
|
|
|
|
Str_Copy (Dpt->FullName,row[3],sizeof (Dpt->FullName) - 1);
|
|
|
|
|
Str_Copy (Dpt->WWW ,row[4],sizeof (Dpt->WWW ) - 1);
|
|
|
|
|
|
|
|
|
|
/***** Get number of non-editing teachers and teachers
|
|
|
|
|
in this department (row[5]) *****/
|
|
|
|
|
if (sscanf (row[5],"%u",&Dpt->NumTchs) != 1)
|
|
|
|
|
Dpt->NumTchs = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/***************************** List all departments **************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-13 20:50:47 +02:00
|
|
|
|
static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departments)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Another_institution;
|
|
|
|
|
unsigned NumDpt;
|
2023-04-13 14:25:52 +02:00
|
|
|
|
struct Dpt_Department *DptInLst;
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Ins_Instit Ins;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumIns;
|
2023-04-13 14:25:52 +02:00
|
|
|
|
struct Ins_Instit *InsInLst;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin table *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_BeginPadding (2);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-06-02 23:48:43 +02:00
|
|
|
|
/***** Write heading *****/
|
|
|
|
|
Dpt_PutHeadDepartments ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/***** Write all departments *****/
|
2021-06-02 23:48:43 +02:00
|
|
|
|
for (NumDpt = 0;
|
|
|
|
|
NumDpt < Departments->Num;
|
|
|
|
|
NumDpt++)
|
|
|
|
|
{
|
2023-04-13 14:25:52 +02:00
|
|
|
|
DptInLst = &Departments->Lst[NumDpt];
|
2021-06-02 23:48:43 +02:00
|
|
|
|
|
|
|
|
|
/* Get data of institution of this department */
|
2023-04-13 14:25:52 +02:00
|
|
|
|
Ins.InsCod = DptInLst->InsCod;
|
2023-03-23 09:35:20 +01:00
|
|
|
|
Ins_GetInstitDataByCod (&Ins);
|
2021-06-02 23:48:43 +02:00
|
|
|
|
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2023-05-09 14:27:07 +02:00
|
|
|
|
/* Icon to remove department */
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"BM\"");
|
2023-04-13 14:25:52 +02:00
|
|
|
|
if (DptInLst->NumTchs) // Department has teachers ==> deletion forbidden
|
2021-06-02 23:48:43 +02:00
|
|
|
|
Ico_PutIconRemovalNotAllowed ();
|
|
|
|
|
else
|
|
|
|
|
Ico_PutContextualIconToRemove (ActRemDpt,NULL,
|
2023-04-13 14:25:52 +02:00
|
|
|
|
Dpt_PutParDptCod,&DptInLst->DptCod);
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Department code */
|
2023-05-09 14:27:07 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"DAT_%s CODE\"",The_GetSuffix ());
|
2023-04-13 14:25:52 +02:00
|
|
|
|
HTM_TxtF ("%ld ",DptInLst->DptCod);
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Institution */
|
2023-05-09 14:27:07 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
2021-06-02 23:48:43 +02:00
|
|
|
|
Frm_BeginForm (ActChgDptIns);
|
2023-04-13 14:25:52 +02:00
|
|
|
|
ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod);
|
2023-03-30 21:50:11 +02:00
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
|
2021-12-19 20:16:58 +01:00
|
|
|
|
"name=\"OthInsCod\""
|
2022-03-30 00:46:18 +02:00
|
|
|
|
" class=\"HIE_SEL_NARROW INPUT_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2023-04-13 14:25:52 +02:00
|
|
|
|
HTM_OPTION (HTM_Type_STRING,"0",
|
2023-05-18 12:54:43 +02:00
|
|
|
|
DptInLst->InsCod == 0 ? HTM_OPTION_SELECTED :
|
|
|
|
|
HTM_OPTION_UNSELECTED,
|
2023-04-14 00:07:06 +02:00
|
|
|
|
HTM_OPTION_ENABLED,
|
2021-06-02 23:48:43 +02:00
|
|
|
|
"%s",Txt_Another_institution);
|
|
|
|
|
for (NumIns = 0;
|
|
|
|
|
NumIns < Gbl.Hierarchy.Inss.Num;
|
|
|
|
|
NumIns++)
|
2023-04-13 14:25:52 +02:00
|
|
|
|
{
|
|
|
|
|
InsInLst = &Gbl.Hierarchy.Inss.Lst[NumIns];
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&InsInLst->InsCod,
|
2023-05-18 12:54:43 +02:00
|
|
|
|
InsInLst->InsCod == DptInLst->InsCod ? HTM_OPTION_SELECTED :
|
|
|
|
|
HTM_OPTION_UNSELECTED,
|
2023-04-14 00:07:06 +02:00
|
|
|
|
HTM_OPTION_ENABLED,
|
2023-04-13 14:25:52 +02:00
|
|
|
|
"%s",InsInLst->ShrtName);
|
|
|
|
|
}
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Department short name */
|
2023-05-09 14:27:07 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
2021-06-02 23:48:43 +02:00
|
|
|
|
Frm_BeginForm (ActRenDptSho);
|
2023-04-13 14:25:52 +02:00
|
|
|
|
ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod);
|
|
|
|
|
HTM_INPUT_TEXT ("ShortName",Cns_HIERARCHY_MAX_CHARS_SHRT_NAME,DptInLst->ShrtName,
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
2022-03-30 00:46:18 +02:00
|
|
|
|
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Department full name */
|
2023-05-09 14:27:07 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
2021-06-02 23:48:43 +02:00
|
|
|
|
Frm_BeginForm (ActRenDptFul);
|
2023-04-13 14:25:52 +02:00
|
|
|
|
ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod);
|
|
|
|
|
HTM_INPUT_TEXT ("FullName",Cns_HIERARCHY_MAX_CHARS_FULL_NAME,DptInLst->FullName,
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
2022-03-30 00:46:18 +02:00
|
|
|
|
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Department WWW */
|
2023-05-09 14:27:07 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
2021-06-02 23:48:43 +02:00
|
|
|
|
Frm_BeginForm (ActChgDptWWW);
|
2023-04-13 14:25:52 +02:00
|
|
|
|
ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod);
|
|
|
|
|
HTM_INPUT_URL ("WWW",DptInLst->WWW,HTM_SUBMIT_ON_CHANGE,
|
2022-03-30 00:46:18 +02:00
|
|
|
|
"class=\"INPUT_WWW_NARROW INPUT_%s\""
|
2021-12-20 09:24:49 +01:00
|
|
|
|
" required=\"required\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-06-02 23:48:43 +02:00
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Number of teachers */
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2023-04-13 14:25:52 +02:00
|
|
|
|
HTM_Unsigned (DptInLst->NumTchs);
|
2021-06-02 23:48:43 +02:00
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-08 23:34:58 +02:00
|
|
|
|
/***** End table *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Write parameter with code of department ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
static void Dpt_PutParDptCod (void *DptCod)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2023-03-06 23:53:45 +01:00
|
|
|
|
if (DptCod)
|
2023-03-10 17:21:04 +01:00
|
|
|
|
ParCod_PutPar (ParCod_Dpt,*((long *) DptCod));
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Remove a department ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Dpt_RemoveDepartment (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_To_remove_a_department_you_must_first_remove_all_teachers_in_the_department;
|
|
|
|
|
extern const char *Txt_Department_X_removed;
|
2019-04-08 23:34:58 +02:00
|
|
|
|
|
|
|
|
|
/***** Department constructor *****/
|
|
|
|
|
Dpt_EditingDepartmentConstructor ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get department code *****/
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Dpt_EditingDpt->DptCod = ParCod_GetAndCheckPar (ParCod_Dpt);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get data of the department from database *****/
|
2023-03-23 09:35:20 +01:00
|
|
|
|
Dpt_GetDepartmentDataByCod (Dpt_EditingDpt);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if this department has teachers *****/
|
2019-04-08 23:34:58 +02:00
|
|
|
|
if (Dpt_EditingDpt->NumTchs) // Department has teachers ==> don't remove
|
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_To_remove_a_department_you_must_first_remove_all_teachers_in_the_department);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else // Department has no teachers ==> remove it
|
|
|
|
|
{
|
|
|
|
|
/***** Remove department *****/
|
2021-06-05 12:21:14 +02:00
|
|
|
|
Dpt_DB_RemoveDepartment (Dpt_EditingDpt->DptCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-04-08 23:34:58 +02:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_Department_X_removed,
|
|
|
|
|
Dpt_EditingDpt->FullName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Change the institution of a department *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Dpt_ChangeDepartIns (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_institution_of_the_department_has_changed;
|
2019-04-08 23:34:58 +02:00
|
|
|
|
long NewInsCod;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-08 23:34:58 +02:00
|
|
|
|
/***** Department constructor *****/
|
|
|
|
|
Dpt_EditingDepartmentConstructor ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get parameters from form *****/
|
|
|
|
|
/* Get the code of the department */
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Dpt_EditingDpt->DptCod = ParCod_GetAndCheckPar (ParCod_Dpt);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get parameter with institution code */
|
2023-03-10 17:21:04 +01:00
|
|
|
|
NewInsCod = ParCod_GetAndCheckPar (ParCod_OthIns);
|
2019-04-08 23:34:58 +02:00
|
|
|
|
|
|
|
|
|
/***** Get data of the department from database *****/
|
2023-03-23 09:35:20 +01:00
|
|
|
|
Dpt_GetDepartmentDataByCod (Dpt_EditingDpt);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Update institution in table of departments *****/
|
2021-06-05 12:21:14 +02:00
|
|
|
|
Dpt_DB_UpdateDptIns (Dpt_EditingDpt->DptCod,NewInsCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-04-08 23:34:58 +02:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_The_institution_of_the_department_has_changed);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Change the short name of a department *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Dpt_RenameDepartShort (void)
|
|
|
|
|
{
|
2019-04-08 23:34:58 +02:00
|
|
|
|
/***** Department constructor *****/
|
|
|
|
|
Dpt_EditingDepartmentConstructor ();
|
|
|
|
|
|
|
|
|
|
/***** Rename department *****/
|
2016-10-28 10:03:37 +02:00
|
|
|
|
Dpt_RenameDepartment (Cns_SHRT_NAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Change the full name of a department ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Dpt_RenameDepartFull (void)
|
|
|
|
|
{
|
2019-04-08 23:34:58 +02:00
|
|
|
|
/***** Department constructor *****/
|
|
|
|
|
Dpt_EditingDepartmentConstructor ();
|
|
|
|
|
|
|
|
|
|
/***** Rename department *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Dpt_RenameDepartment (Cns_FULL_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Change the name of a degree ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-10-28 10:03:37 +02:00
|
|
|