2021-03-07 21:21:04 +01:00
|
|
|
|
// swad_hierarchy.c: hierarchy (system, institution, center, degree, course)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
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
|
2016-12-10 22:21:04 +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 ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-11-18 14:21:01 +01:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
2019-12-29 20:11:57 +01:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2020-01-03 22:16:51 +01:00
|
|
|
|
#include <stdlib.h> // For free
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2022-11-06 18:11:10 +01:00
|
|
|
|
#include "swad_action_list.h"
|
2023-02-08 14:25:42 +01:00
|
|
|
|
#include "swad_alert.h"
|
2022-10-19 18:07:49 +02:00
|
|
|
|
#include "swad_box.h"
|
2023-09-20 10:36:07 +02:00
|
|
|
|
#include "swad_center_database.h"
|
2023-09-21 18:54:59 +02:00
|
|
|
|
#include "swad_country_database.h"
|
2023-09-20 21:55:11 +02:00
|
|
|
|
#include "swad_course_database.h"
|
2019-12-30 12:25:45 +01:00
|
|
|
|
#include "swad_database.h"
|
2021-05-28 19:59:55 +02:00
|
|
|
|
#include "swad_degree_database.h"
|
2023-09-20 10:36:07 +02:00
|
|
|
|
#include "swad_enrolment_database.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2022-01-02 23:44:27 +01:00
|
|
|
|
#include "swad_figure.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2016-12-10 22:21:04 +01:00
|
|
|
|
#include "swad_global.h"
|
2021-06-17 13:55:45 +02:00
|
|
|
|
#include "swad_group_database.h"
|
2021-02-11 22:57:09 +01:00
|
|
|
|
#include "swad_hierarchy.h"
|
2021-09-20 14:06:42 +02:00
|
|
|
|
#include "swad_hierarchy_database.h"
|
2023-09-22 14:47:56 +02:00
|
|
|
|
#include "swad_hierarchy_type.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2023-09-20 10:36:07 +02:00
|
|
|
|
#include "swad_institution_database.h"
|
2016-12-10 22:21:04 +01:00
|
|
|
|
#include "swad_logo.h"
|
2023-03-10 17:21:04 +01:00
|
|
|
|
#include "swad_parameter_code.h"
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
2023-09-20 22:49:32 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Private constants ******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
static FigCch_FigureCached_t Hie_FiguresCached[Hie_NUM_LEVELS] =
|
2023-09-20 22:49:32 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_CTY] = FigCch_NUM_CTYS,
|
|
|
|
|
[Hie_INS] = FigCch_NUM_INSS,
|
|
|
|
|
[Hie_CTR] = FigCch_NUM_CTRS,
|
|
|
|
|
[Hie_DEG] = FigCch_NUM_DEGS,
|
|
|
|
|
[Hie_CRS] = FigCch_NUM_CRSS,
|
2023-09-20 22:49:32 +02:00
|
|
|
|
};
|
|
|
|
|
|
2023-10-09 17:07:19 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Public constants *******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern const char *Txt_System;
|
|
|
|
|
extern const char *Txt_Country;
|
|
|
|
|
extern const char *Txt_Institution;
|
|
|
|
|
extern const char *Txt_Center;
|
|
|
|
|
extern const char *Txt_Degree;
|
|
|
|
|
extern const char *Txt_Course;
|
|
|
|
|
|
|
|
|
|
const char **Hie_TxtLevel[Hie_NUM_LEVELS] =
|
|
|
|
|
{
|
|
|
|
|
[Hie_SYS] = &Txt_System,
|
|
|
|
|
[Hie_CTY] = &Txt_Country,
|
|
|
|
|
[Hie_INS] = &Txt_Institution,
|
|
|
|
|
[Hie_CTR] = &Txt_Center,
|
|
|
|
|
[Hie_DEG] = &Txt_Degree,
|
|
|
|
|
[Hie_CRS] = &Txt_Course,
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-10 10:53:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-19 22:27:20 +02:00
|
|
|
|
static void Hie_DrawLogo (void);
|
2022-10-05 01:32:04 +02:00
|
|
|
|
|
2021-11-10 10:53:08 +01:00
|
|
|
|
static Hie_StatusTxt_t Hie_GetStatusTxtFromStatusBits (Hie_Status_t Status);
|
|
|
|
|
static Hie_Status_t Hie_GetStatusBitsFromStatusTxt (Hie_StatusTxt_t StatusTxt);
|
|
|
|
|
|
2022-01-02 23:44:27 +01:00
|
|
|
|
static void Hie_WriteHeadHierarchy (void);
|
2023-09-25 21:14:05 +02:00
|
|
|
|
static void Hie_GetAndShowHierarchyWithNodes (Hie_Level_t HavingNodesOfLevel);
|
2022-01-02 23:44:27 +01:00
|
|
|
|
static void Hie_GetAndShowHierarchyWithUsrs (Rol_Role_t Role);
|
|
|
|
|
static void Hie_GetAndShowHierarchyTotal (void);
|
|
|
|
|
static void Hie_ShowHierarchyRow (const char *Text1,const char *Text2,
|
|
|
|
|
const char *ClassTxt,
|
2023-09-22 14:47:56 +02:00
|
|
|
|
int NumNodes[Hie_NUM_LEVELS]);
|
2022-01-02 23:44:27 +01:00
|
|
|
|
static void Hie_ShowHierarchyCell (const char *ClassTxt,int Num);
|
|
|
|
|
|
2017-03-27 01:14:38 +02:00
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/********** List pending institutions, centers, degrees and courses **********/
|
2017-03-27 01:14:38 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_SeePending (void)
|
|
|
|
|
{
|
|
|
|
|
/***** List countries with pending institutions *****/
|
|
|
|
|
Cty_SeeCtyWithPendingInss ();
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** List institutions with pending centers *****/
|
2017-03-27 01:14:38 +02:00
|
|
|
|
Ins_SeeInsWithPendingCtrs ();
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** List centers with pending degrees *****/
|
2017-03-27 01:14:38 +02:00
|
|
|
|
Ctr_SeeCtrWithPendingDegs ();
|
|
|
|
|
|
|
|
|
|
/***** List degrees with pending courses *****/
|
|
|
|
|
Deg_SeeDegWithPendingCrss ();
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-10 22:21:04 +01:00
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/*** Write menu to select country, institution, center, degree and course ****/
|
2016-12-10 22:21:04 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_WriteMenuHierarchy (void)
|
|
|
|
|
{
|
2023-03-10 00:13:55 +01:00
|
|
|
|
extern const char *Par_CodeStr[];
|
2016-12-10 22:21:04 +01:00
|
|
|
|
extern const char *Txt_Country;
|
|
|
|
|
extern const char *Txt_Institution;
|
2021-03-07 21:21:04 +01:00
|
|
|
|
extern const char *Txt_Center;
|
2016-12-10 22:21:04 +01:00
|
|
|
|
extern const char *Txt_Degree;
|
|
|
|
|
extern const char *Txt_Course;
|
|
|
|
|
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin table *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_BeginCenterPadding (2);
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/***** Write a 1st selector with all countries *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Label */
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Frm_LabelColumn ("RT",Par_CodeStr[ParCod_Cty],Txt_Country);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"LT\"");
|
|
|
|
|
Cty_WriteSelectorOfCountry ();
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0)
|
2021-05-22 12:34:10 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Write a 2nd selector
|
|
|
|
|
with the institutions of selected country *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Label */
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Frm_LabelColumn ("RT",Par_CodeStr[ParCod_Ins],Txt_Institution);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"LT\"");
|
|
|
|
|
Ins_WriteSelectorOfInstitution ();
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0)
|
2021-05-22 12:34:10 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Write a 3rd selector
|
|
|
|
|
with all the centers of selected institution *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Label */
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Frm_LabelColumn ("RT",Par_CodeStr[ParCod_Ctr],Txt_Center);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"LT\"");
|
|
|
|
|
Ctr_WriteSelectorOfCenter ();
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/***** Write a 4th selector
|
2021-10-30 13:28:48 +02:00
|
|
|
|
with all degrees of selected center *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Label */
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Frm_LabelColumn ("RT",Par_CodeStr[ParCod_Deg],Txt_Degree);
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"LT\"");
|
|
|
|
|
Deg_WriteSelectorOfDegree ();
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 15:15:55 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2021-05-22 12:34:10 +02:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0)
|
2021-05-22 12:34:10 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Write a 5th selector
|
2021-10-30 13:28:48 +02:00
|
|
|
|
with all courses of selected degree *****/
|
2021-05-22 12:34:10 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Frm_LabelColumn ("RT",Par_CodeStr[ParCod_Crs],Txt_Course);
|
2021-05-22 12:34:10 +02:00
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"LT\"");
|
|
|
|
|
Crs_WriteSelectorOfCourse ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
2021-05-22 12:34:10 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************* Write hierarchy breadcrumb in the top of the page *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2018-10-09 17:56:18 +02:00
|
|
|
|
void Hie_WriteHierarchyInBreadcrumb (void)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_System;
|
|
|
|
|
extern const char *Txt_Country;
|
|
|
|
|
extern const char *Txt_Institution;
|
2021-03-07 21:21:04 +01:00
|
|
|
|
extern const char *Txt_Center;
|
2016-12-10 22:21:04 +01:00
|
|
|
|
extern const char *Txt_Degree;
|
|
|
|
|
|
|
|
|
|
/***** Form to go to the system *****/
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_NBSP ();
|
|
|
|
|
|
|
|
|
|
Frm_BeginFormGoTo (ActMnu);
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_PutParUnsigned (NULL,"NxtTab",(unsigned) TabSys);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_System,"class=\"BT_LINK\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt (Txt_System);
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) // Country selected...
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Form to go to see institutions of this country *****/
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeIns);
|
2023-09-22 14:47:56 +02:00
|
|
|
|
ParCod_PutPar (ParCod_Cty,Gbl.Hierarchy.Node[Hie_CTY].HieCod);
|
|
|
|
|
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Node[Hie_CTY].FullName,
|
2022-04-01 01:06:44 +02:00
|
|
|
|
"class=\"BT_LINK\"");
|
2023-09-22 14:47:56 +02:00
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Node[Hie_CTY].FullName);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_SEMIOFF BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Form to go to select countries *****/
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeCty);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_Country,"class=\"BT_LINK\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt (Txt_Country);
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) // Institution selected...
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Form to see centers of this institution *****/
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeCtr);
|
2023-09-22 14:47:56 +02:00
|
|
|
|
ParCod_PutPar (ParCod_Ins,Gbl.Hierarchy.Node[Hie_INS].HieCod);
|
|
|
|
|
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Node[Hie_INS].FullName,
|
2022-04-01 01:06:44 +02:00
|
|
|
|
"class=\"BT_LINK\"");
|
2023-09-22 14:47:56 +02:00
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Node[Hie_INS].ShrtName);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
2023-09-22 14:47:56 +02:00
|
|
|
|
else if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_SEMIOFF BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Form to go to select institutions *****/
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeIns);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_Institution,"class=\"BT_LINK\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt (Txt_Institution);
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_OFF BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Hidden institution *****/
|
|
|
|
|
HTM_Txt (Txt_Institution);
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0) // Center selected...
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Form to see degrees of this center *****/
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeDeg);
|
2023-09-22 14:47:56 +02:00
|
|
|
|
ParCod_PutPar (ParCod_Ctr,Gbl.Hierarchy.Node[Hie_CTR].HieCod);
|
|
|
|
|
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Node[Hie_CTR].FullName,
|
2022-04-01 01:06:44 +02:00
|
|
|
|
"class=\"BT_LINK\"");
|
2023-09-22 14:47:56 +02:00
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Node[Hie_CTR].ShrtName);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
2023-09-22 14:47:56 +02:00
|
|
|
|
else if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_SEMIOFF BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Form to go to select centers *****/
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeCtr);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_Center,"class=\"BT_LINK\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt (Txt_Center);
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_OFF BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Hidden center *****/
|
|
|
|
|
HTM_Txt (Txt_Center);
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0) // Degree selected...
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Form to go to see courses of this degree *****/
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeCrs);
|
2023-09-22 14:47:56 +02:00
|
|
|
|
ParCod_PutPar (ParCod_Deg,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
|
|
|
|
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Node[Hie_DEG].FullName,
|
2022-04-01 01:06:44 +02:00
|
|
|
|
"class=\"BT_LINK\"");
|
2023-09-22 14:47:56 +02:00
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Node[Hie_DEG].ShrtName);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
2023-09-22 14:47:56 +02:00
|
|
|
|
else if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_SEMIOFF BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Form to go to select degrees *****/
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeDeg);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_Degree,"class=\"BT_LINK\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt (Txt_Degree);
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC BC_OFF BC_%s\"",The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Hidden degree *****/
|
|
|
|
|
HTM_Txt (Txt_Degree);
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-27 12:58:20 +01:00
|
|
|
|
HTM_DIV_Begin ("class=\"BC%s BC_%s\"",
|
2023-09-22 14:47:56 +02:00
|
|
|
|
(Gbl.Hierarchy.Level == Hie_CRS) ? "" :
|
|
|
|
|
((Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0) ? " BC_SEMIOFF" :
|
|
|
|
|
" BC_OFF"),
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Separator *****/
|
|
|
|
|
HTM_Txt (" > ");
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Write course full name in the top of the page ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_WriteBigNameCtyInsCtrDegCrs (void)
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
static Tab_Tab_t NextTab[Hie_NUM_LEVELS] =
|
2022-10-05 01:32:04 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_UNK] = TabUnk,
|
|
|
|
|
[Hie_SYS] = TabSys,
|
|
|
|
|
[Hie_CTY] = TabCty,
|
|
|
|
|
[Hie_INS] = TabIns,
|
|
|
|
|
[Hie_CTR] = TabCtr,
|
|
|
|
|
[Hie_DEG] = TabDeg,
|
|
|
|
|
[Hie_CRS] = TabCrs,
|
2022-10-05 01:32:04 +02:00
|
|
|
|
};
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2021-12-27 12:58:20 +01:00
|
|
|
|
HTM_TxtF ("<h1 id=\"main_title\" class=\"MAIN_TITLE_%s\">",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2022-10-05 01:32:04 +02:00
|
|
|
|
/***** Logo and text *****/
|
|
|
|
|
HTM_DIV_Begin ("id=\"big_name_container\"");
|
|
|
|
|
|
2022-10-07 00:18:32 +02:00
|
|
|
|
Frm_BeginForm (ActMnu);
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_PutParUnsigned (NULL,"NxtTab",(unsigned) NextTab[Gbl.Hierarchy.Level]);
|
2023-09-19 22:27:20 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName,
|
2022-10-05 01:32:04 +02:00
|
|
|
|
"class=\"BT_LINK ICO_HIGHLIGHT\"");
|
|
|
|
|
|
|
|
|
|
HTM_DIV_Begin ("id=\"big_full_name\""); // Full name
|
2023-09-19 22:27:20 +02:00
|
|
|
|
Hie_DrawLogo ();
|
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].FullName);
|
2022-10-05 01:32:04 +02:00
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
HTM_DIV_Begin ("id=\"big_short_name\""); // Short name
|
2023-09-19 22:27:20 +02:00
|
|
|
|
Hie_DrawLogo ();
|
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName);
|
2022-10-05 01:32:04 +02:00
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TxtF ("</h1>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Draw logo in the top of the page *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-19 22:27:20 +02:00
|
|
|
|
static void Hie_DrawLogo (void)
|
2022-10-05 01:32:04 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
static Hie_Level_t LogoScope[Hie_NUM_LEVELS] =
|
2022-10-05 01:32:04 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_INS] = Hie_INS,
|
|
|
|
|
[Hie_CTR] = Hie_CTR,
|
|
|
|
|
[Hie_DEG] = Hie_DEG,
|
|
|
|
|
[Hie_CRS] = Hie_DEG, // Draw logo of degree
|
2022-10-05 01:32:04 +02:00
|
|
|
|
};
|
2023-09-22 14:47:56 +02:00
|
|
|
|
static const long *LogoCode[Hie_NUM_LEVELS] =
|
2022-10-05 01:32:04 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_INS] = &Gbl.Hierarchy.Node[Hie_INS].HieCod,
|
|
|
|
|
[Hie_CTR] = &Gbl.Hierarchy.Node[Hie_CTR].HieCod,
|
|
|
|
|
[Hie_DEG] = &Gbl.Hierarchy.Node[Hie_DEG].HieCod,
|
|
|
|
|
[Hie_CRS] = &Gbl.Hierarchy.Node[Hie_DEG].HieCod, // Degree code
|
2022-10-05 01:32:04 +02:00
|
|
|
|
};
|
|
|
|
|
|
2016-12-10 22:21:04 +01:00
|
|
|
|
/***** Logo *****/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
switch (Gbl.Hierarchy.Level)
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
case Hie_SYS: // System
|
2023-09-19 22:27:20 +02:00
|
|
|
|
Ico_PutIcon ("swad64x64.png",Ico_UNCHANGED,
|
|
|
|
|
Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName,"TOP_LOGO");
|
2022-10-05 01:32:04 +02:00
|
|
|
|
break;
|
2023-09-22 14:47:56 +02:00
|
|
|
|
case Hie_CTY: // Country
|
|
|
|
|
Cty_DrawCountryMap (&Gbl.Hierarchy.Node[Hie_CTY],"TOP_LOGO");
|
2022-10-05 01:32:04 +02:00
|
|
|
|
break;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
default:
|
2022-10-05 01:32:04 +02:00
|
|
|
|
Lgo_DrawLogo (LogoScope[Gbl.Hierarchy.Level],
|
|
|
|
|
*LogoCode[Gbl.Hierarchy.Level],
|
2023-09-19 22:27:20 +02:00
|
|
|
|
Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName,
|
2023-09-19 10:28:52 +02:00
|
|
|
|
40,"TOP_LOGO");
|
2019-04-03 20:57:04 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-01 23:15:17 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Copy last hierarchy to current hierarchy *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_SetHierarchyFromUsrLastHierarchy (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Initialize all codes to -1 *****/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Hie_ResetHierarchy ();
|
2019-04-01 23:15:17 +02:00
|
|
|
|
|
2023-09-19 08:56:19 +02:00
|
|
|
|
/***** Copy last hierarchy code to current hierarchy *****/
|
2023-09-20 10:36:07 +02:00
|
|
|
|
Gbl.Hierarchy.Node[Gbl.Usrs.Me.UsrLast.LastHie.Level].HieCod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
|
2019-04-01 23:15:17 +02:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/****** Initialize again current course, degree, center... ******/
|
2019-04-01 23:15:17 +02:00
|
|
|
|
Hie_InitHierarchy ();
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-10 22:21:04 +01:00
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/**** Initialize current country, institution, center, degree and course *****/
|
2016-12-10 22:21:04 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_InitHierarchy (void)
|
|
|
|
|
{
|
|
|
|
|
/***** If course code is available, get course data *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_CRS].HieCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Crs_GetCourseDataByCod (&Gbl.Hierarchy.Node[Hie_CRS])) // Course found
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_DEG].HieCod = Gbl.Hierarchy.Node[Hie_CRS].PrtCod;
|
2016-12-10 22:21:04 +01:00
|
|
|
|
else
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Hie_ResetHierarchy ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** If degree code is available, get degree data *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Deg_GetDegreeDataByCod (&Gbl.Hierarchy.Node[Hie_DEG])) // Degree found
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Gbl.Hierarchy.Node[Hie_CTR].HieCod = Gbl.Hierarchy.Node[Hie_DEG].PrtCod;
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_INS].HieCod = Deg_DB_GetInsCodOfDegreeByCod (Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Hie_ResetHierarchy ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** If center code is available, get center data *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Ctr_GetCenterDataByCod (&Gbl.Hierarchy.Node[Hie_CTR])) // Center found
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_INS].HieCod = Gbl.Hierarchy.Node[Hie_CTR].PrtCod;
|
2016-12-10 22:21:04 +01:00
|
|
|
|
else
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Hie_ResetHierarchy ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** If institution code is available, get institution data *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Ins_GetInstitDataByCod (&Gbl.Hierarchy.Node[Hie_INS])) // Institution found
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_CTY].HieCod = Gbl.Hierarchy.Node[Hie_INS].PrtCod;
|
2016-12-10 22:21:04 +01:00
|
|
|
|
else
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Hie_ResetHierarchy ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** If country code is available, get country data *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0)
|
|
|
|
|
if (!Cty_GetBasicCountryDataByCod (&Gbl.Hierarchy.Node[Hie_CTY])) // Country not found
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Hie_ResetHierarchy ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2023-09-19 22:27:20 +02:00
|
|
|
|
/***** Set system data *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Str_Copy (Gbl.Hierarchy.Node[Hie_SYS].ShrtName,Cfg_PLATFORM_SHORT_NAME,
|
|
|
|
|
sizeof (Gbl.Hierarchy.Node[Hie_SYS].ShrtName) - 1);
|
|
|
|
|
Str_Copy (Gbl.Hierarchy.Node[Hie_SYS].FullName,Cfg_PLATFORM_FULL_NAME ,
|
|
|
|
|
sizeof (Gbl.Hierarchy.Node[Hie_SYS].FullName) - 1);
|
|
|
|
|
Str_Copy (Gbl.Hierarchy.Node[Hie_SYS].WWW ,Cfg_URL_SWAD_PUBLIC ,
|
|
|
|
|
sizeof (Gbl.Hierarchy.Node[Hie_SYS].WWW ) - 1);
|
|
|
|
|
|
|
|
|
|
/***** Set current hierarchy level *****/
|
|
|
|
|
Gbl.Hierarchy.Level = (Gbl.Hierarchy.Node[Hie_CRS].HieCod > 0) ? Hie_CRS : // Course selected
|
|
|
|
|
(Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0) ? Hie_DEG : // Degree selected
|
|
|
|
|
(Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0) ? Hie_CTR : // Center selected
|
|
|
|
|
(Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) ? Hie_INS : // Institution selected
|
|
|
|
|
(Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) ? Hie_CTY : // Country selected
|
|
|
|
|
Hie_SYS; // System/nothing selected
|
2019-04-01 23:15:17 +02:00
|
|
|
|
|
2016-12-10 22:21:04 +01:00
|
|
|
|
/***** Initialize paths *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Paths of course directories *****/
|
2023-10-03 23:18:13 +02:00
|
|
|
|
snprintf (Gbl.Crs.Path.AbsPriv,sizeof (Gbl.Crs.Path.AbsPriv),"%s/%ld",
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Cfg_PATH_CRS_PRIVATE,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
2023-10-03 23:18:13 +02:00
|
|
|
|
snprintf (Gbl.Crs.Path.RelPubl,sizeof (Gbl.Crs.Path.RelPubl),"%s/%ld",
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Cfg_PATH_CRS_PUBLIC ,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
2023-10-03 23:18:13 +02:00
|
|
|
|
snprintf (Gbl.Crs.Path.URLPubl,sizeof (Gbl.Crs.Path.URLPubl),"%s/%ld",
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Cfg_URL_CRS_PUBLIC ,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
|
|
|
|
/***** If any of the course directories does not exist, create it *****/
|
2023-10-03 23:18:13 +02:00
|
|
|
|
if (!Fil_CheckIfPathExists (Gbl.Crs.Path.AbsPriv))
|
|
|
|
|
Fil_CreateDirIfNotExists (Gbl.Crs.Path.AbsPriv);
|
|
|
|
|
if (!Fil_CheckIfPathExists (Gbl.Crs.Path.RelPubl))
|
|
|
|
|
Fil_CreateDirIfNotExists (Gbl.Crs.Path.RelPubl);
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
|
|
|
|
/***** Count number of groups in current course
|
|
|
|
|
(used in some actions) *****/
|
2021-06-17 13:26:25 +02:00
|
|
|
|
Gbl.Crs.Grps.NumGrps = Grp_DB_CountNumGrpsInCurrentCrs ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/******* Reset current country, institution, center, degree and course *******/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_ResetHierarchy (void)
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Hie_Level_t Level;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Gbl.Hierarchy.Level = Hie_UNK;
|
2023-09-19 08:56:19 +02:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
for (Level = (Hie_Level_t) 0;
|
|
|
|
|
Level <= (Hie_Level_t) Hie_NUM_LEVELS - 1;
|
2023-09-19 08:56:19 +02:00
|
|
|
|
Level++)
|
|
|
|
|
{
|
|
|
|
|
Gbl.Hierarchy.List[Level].Num = 0;
|
|
|
|
|
Gbl.Hierarchy.List[Level].Lst = NULL;
|
|
|
|
|
Gbl.Hierarchy.List[Level].SelectedOrder = Hie_ORDER_DEFAULT;
|
2023-09-20 20:07:04 +02:00
|
|
|
|
Gbl.Hierarchy.Node[Level].HieCod = -1L;
|
2023-09-19 08:56:19 +02:00
|
|
|
|
Gbl.Hierarchy.Node[Level].PrtCod = -1L;
|
|
|
|
|
Gbl.Hierarchy.Node[Level].ShrtName[0] =
|
|
|
|
|
Gbl.Hierarchy.Node[Level].FullName[0] = '\0';
|
|
|
|
|
Gbl.Hierarchy.Node[Level].WWW[0] = '\0';
|
2023-10-03 22:14:35 +02:00
|
|
|
|
|
|
|
|
|
Gbl.Usrs.Me.IBelongToCurrent[Level] = false;
|
2023-09-19 08:56:19 +02:00
|
|
|
|
}
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Gbl.Hierarchy.Node[Hie_CTR].Specific.PlcCod = -1L;
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_DEG].Specific.TypCod = -1L;
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_CRS].Specific.Year = 0;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
}
|
2019-12-30 12:25:45 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Write institutions, centers and degrees administrated by an admin *****/
|
2019-12-30 12:25:45 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_all_degrees;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned NumRow;
|
|
|
|
|
unsigned NumRows;
|
2023-09-22 14:47:56 +02:00
|
|
|
|
struct Hie_Node Hie[Hie_NUM_LEVELS];
|
2019-12-30 12:25:45 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Get institutions, centers, degrees admin by user from database *****/
|
2021-09-20 14:06:42 +02:00
|
|
|
|
NumRows = Hie_DB_GetInsCtrDegAdminBy (&mysql_res,UsrCod);
|
2019-12-30 12:25:45 +01:00
|
|
|
|
|
2021-09-20 14:06:42 +02:00
|
|
|
|
/***** Get the list of degrees *****/
|
|
|
|
|
for (NumRow = 1;
|
|
|
|
|
NumRow <= NumRows;
|
|
|
|
|
NumRow++)
|
|
|
|
|
{
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-12-30 12:25:45 +01:00
|
|
|
|
|
2021-09-20 14:06:42 +02:00
|
|
|
|
/***** Indent *****/
|
2022-03-19 02:05:53 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"RT %s\"",The_GetColorRows ());
|
2021-09-20 14:06:42 +02:00
|
|
|
|
Ico_PutIcon (NumRow == NumRows ? "subend20x20.gif" :
|
2021-12-22 00:20:06 +01:00
|
|
|
|
"submid20x20.gif",Ico_BLACK,
|
2021-09-20 14:06:42 +02:00
|
|
|
|
"","ICO25x25");
|
|
|
|
|
HTM_TD_End ();
|
2019-12-30 12:25:45 +01:00
|
|
|
|
|
2021-09-20 14:06:42 +02:00
|
|
|
|
/***** Write institution, center, degree *****/
|
2022-03-25 00:48:40 +01:00
|
|
|
|
HTM_TD_Begin ("colspan=\"%u\" class=\"LT DAT_SMALL_NOBR_%s %s\"",
|
2022-01-09 23:27:36 +01:00
|
|
|
|
ColSpan - 1,
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix (),
|
2022-03-19 02:05:53 +01:00
|
|
|
|
The_GetColorRows ());
|
2019-12-30 12:25:45 +01:00
|
|
|
|
|
2021-09-20 14:06:42 +02:00
|
|
|
|
/* Get next institution, center, degree */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
2019-12-30 12:25:45 +01:00
|
|
|
|
|
2021-09-20 14:06:42 +02:00
|
|
|
|
/* Get scope */
|
|
|
|
|
switch (Sco_GetScopeFromUnsignedStr (row[0]))
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
case Hie_SYS: // System
|
2021-12-22 18:54:43 +01:00
|
|
|
|
Ico_PutIcon ("swad64x64.png",Ico_UNCHANGED,
|
|
|
|
|
Txt_all_degrees,"ICO16x16");
|
2021-09-20 14:06:42 +02:00
|
|
|
|
HTM_TxtF (" %s",Txt_all_degrees);
|
|
|
|
|
break;
|
2023-09-22 14:47:56 +02:00
|
|
|
|
case Hie_INS: // Institution
|
|
|
|
|
if ((Hie[Hie_INS].HieCod = Str_ConvertStrCodToLongCod (row[1])) > 0)
|
2021-09-20 14:06:42 +02:00
|
|
|
|
{
|
|
|
|
|
/* Get data of institution */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
|
2021-09-20 14:06:42 +02:00
|
|
|
|
|
|
|
|
|
/* Write institution logo and name */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Ins_DrawInstitLogoAndNameWithLink (&Hie[Hie_INS],ActSeeInsInf,"LT");
|
2021-09-20 14:06:42 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
2023-09-22 14:47:56 +02:00
|
|
|
|
case Hie_CTR: // Center
|
|
|
|
|
if ((Hie[Hie_CTR].HieCod = Str_ConvertStrCodToLongCod (row[1])) > 0)
|
2021-09-20 14:06:42 +02:00
|
|
|
|
{
|
|
|
|
|
/* Get data of center */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Ctr_GetCenterDataByCod (&Hie[Hie_CTR]);
|
2021-09-20 14:06:42 +02:00
|
|
|
|
|
|
|
|
|
/* Write center logo and name */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Ctr_DrawCenterLogoAndNameWithLink (&Hie[Hie_CTR],ActSeeCtrInf,"LT");
|
2021-09-20 14:06:42 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
2023-09-22 14:47:56 +02:00
|
|
|
|
case Hie_DEG: // Degree
|
|
|
|
|
if ((Hie[Hie_DEG].HieCod = Str_ConvertStrCodToLongCod (row[1])) > 0)
|
2021-09-20 14:06:42 +02:00
|
|
|
|
{
|
|
|
|
|
/* Get data of degree */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
|
2021-09-20 14:06:42 +02:00
|
|
|
|
|
|
|
|
|
/* Write degree logo and name */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Deg_DrawDegreeLogoAndNameWithLink (&Hie[Hie_DEG],ActSeeDegInf,"LT");
|
2021-09-20 14:06:42 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default: // There are no administrators in other scopes
|
2023-07-11 19:12:24 +02:00
|
|
|
|
Err_WrongHierarchyLevelExit ();
|
2021-09-20 14:06:42 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2019-12-30 12:25:45 +01:00
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-19 13:09:52 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Check if I can edit hierarchy elements *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
bool Hie_CheckIfICanEdit (void)
|
|
|
|
|
{
|
|
|
|
|
// Some admins can edit all hierarchy elements.
|
|
|
|
|
// Any user can edit the elements he/she has created...
|
|
|
|
|
// ...as long as they are in pending status.
|
|
|
|
|
static const bool ICanEdit[Rol_NUM_ROLES] =
|
|
|
|
|
{
|
|
|
|
|
/* Users who can edit */
|
|
|
|
|
[Rol_GST ] = true,
|
|
|
|
|
[Rol_USR ] = true,
|
|
|
|
|
[Rol_STD ] = true,
|
|
|
|
|
[Rol_NET ] = true,
|
|
|
|
|
[Rol_TCH ] = true,
|
|
|
|
|
[Rol_DEG_ADM] = true,
|
|
|
|
|
[Rol_CTR_ADM] = true,
|
|
|
|
|
[Rol_INS_ADM] = true,
|
|
|
|
|
[Rol_SYS_ADM] = true,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return ICanEdit[Gbl.Usrs.Me.Role.Logged];
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-10 10:19:46 +02:00
|
|
|
|
/*****************************************************************************/
|
2021-11-10 10:53:08 +01:00
|
|
|
|
/*********************** Write status cell in table **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_WriteStatusCell (Hie_Status_t Status,
|
|
|
|
|
const char *Class,const char *BgColor,
|
|
|
|
|
const char *Txt[Hie_NUM_STATUS_TXT])
|
|
|
|
|
{
|
|
|
|
|
Hie_StatusTxt_t StatusTxt = Hie_GetStatusTxtFromStatusBits (Status);
|
|
|
|
|
|
2022-03-25 11:09:51 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"LM %s_%s %s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
Class,The_GetSuffix (),BgColor);
|
2021-11-10 10:53:08 +01:00
|
|
|
|
if (StatusTxt != Hie_STATUS_ACTIVE) // If active ==> do not show anything
|
|
|
|
|
HTM_Txt (Txt[StatusTxt]);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Hie_WriteStatusCellEditable (bool ICanEdit,Hie_Status_t Status,
|
|
|
|
|
Act_Action_t NextAction,long HieCod,
|
|
|
|
|
const char *Txt[Hie_NUM_STATUS_TXT])
|
|
|
|
|
{
|
|
|
|
|
Hie_StatusTxt_t StatusTxt = Hie_GetStatusTxtFromStatusBits (Status);
|
|
|
|
|
unsigned StatusUnsigned;
|
|
|
|
|
|
|
|
|
|
/***** Begin cell *****/
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
2021-11-10 10:53:08 +01:00
|
|
|
|
if (ICanEdit && StatusTxt == Hie_STATUS_PENDING)
|
|
|
|
|
{
|
|
|
|
|
/* Begin form */
|
|
|
|
|
Frm_BeginForm (NextAction);
|
2023-03-10 17:21:04 +01:00
|
|
|
|
ParCod_PutPar (ParCod_OthHie,HieCod);
|
2021-11-10 10:53:08 +01:00
|
|
|
|
|
|
|
|
|
/* Selector */
|
2023-03-30 21:50:11 +02:00
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
|
2021-11-10 10:53:08 +01:00
|
|
|
|
"name=\"Status\" class=\"INPUT_STATUS\"");
|
|
|
|
|
|
|
|
|
|
StatusUnsigned = (unsigned) Hie_GetStatusBitsFromStatusTxt (Hie_STATUS_PENDING);
|
2023-04-13 14:25:52 +02:00
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,
|
2023-05-18 12:54:43 +02:00
|
|
|
|
HTM_OPTION_SELECTED,
|
2023-04-14 00:07:06 +02:00
|
|
|
|
HTM_OPTION_ENABLED,
|
2021-11-10 10:53:08 +01:00
|
|
|
|
"%s",Txt[Hie_STATUS_PENDING]);
|
|
|
|
|
|
|
|
|
|
StatusUnsigned = (unsigned) Hie_GetStatusBitsFromStatusTxt (Hie_STATUS_ACTIVE);
|
2023-04-13 14:25:52 +02:00
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,
|
2023-05-18 12:54:43 +02:00
|
|
|
|
HTM_OPTION_UNSELECTED,
|
2023-04-14 00:07:06 +02:00
|
|
|
|
HTM_OPTION_ENABLED,
|
2021-11-10 10:53:08 +01:00
|
|
|
|
"%s",Txt[Hie_STATUS_ACTIVE]);
|
|
|
|
|
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
|
|
|
|
|
/* End form */
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
else if (StatusTxt != Hie_STATUS_ACTIVE) // If active ==> do not show anything
|
|
|
|
|
HTM_Txt (Txt[StatusTxt]);
|
|
|
|
|
|
|
|
|
|
/***** End cell *****/
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Get parameter status ***************************/
|
2021-09-10 10:19:46 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
Hie_Status_t Hie_GetParStatus (void)
|
2021-09-10 10:19:46 +02:00
|
|
|
|
{
|
2021-11-10 10:53:08 +01:00
|
|
|
|
Hie_Status_t Status;
|
|
|
|
|
Hie_StatusTxt_t StatusTxt;
|
|
|
|
|
|
|
|
|
|
/***** Get parameter with status *****/
|
|
|
|
|
Status = (Hie_Status_t)
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_GetParUnsignedLong ("Status",
|
2023-03-10 00:13:55 +01:00
|
|
|
|
0,
|
|
|
|
|
(unsigned long) Hie_MAX_STATUS,
|
|
|
|
|
(unsigned long) Hie_WRONG_STATUS);
|
2022-09-08 11:10:55 +02:00
|
|
|
|
|
2021-11-10 10:53:08 +01:00
|
|
|
|
if (Status == Hie_WRONG_STATUS)
|
|
|
|
|
Err_WrongStatusExit ();
|
|
|
|
|
|
|
|
|
|
StatusTxt = Hie_GetStatusTxtFromStatusBits (Status);
|
|
|
|
|
Status = Hie_GetStatusBitsFromStatusTxt (StatusTxt); // New status
|
|
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Set StatusTxt depending on status bits ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Hie_STATUS_UNKNOWN = 0 // Other
|
|
|
|
|
// Hie_STATUS_ACTIVE = 1 // 00 (Status == 0)
|
|
|
|
|
// Hie_STATUS_PENDING = 2 // 01 (Status == Hie_STATUS_BIT_PENDING)
|
|
|
|
|
// Hie_STATUS_REMOVED = 3 // 1- (Status & Hie_STATUS_BIT_REMOVED)
|
|
|
|
|
|
|
|
|
|
static Hie_StatusTxt_t Hie_GetStatusTxtFromStatusBits (Hie_Status_t Status)
|
|
|
|
|
{
|
|
|
|
|
if (Status == 0)
|
|
|
|
|
return Hie_STATUS_ACTIVE;
|
|
|
|
|
if (Status == Hie_STATUS_BIT_PENDING)
|
|
|
|
|
return Hie_STATUS_PENDING;
|
|
|
|
|
if (Status & Hie_STATUS_BIT_REMOVED)
|
|
|
|
|
return Hie_STATUS_REMOVED;
|
|
|
|
|
return Hie_STATUS_UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Set status bits depending on StatusTxt ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Hie_STATUS_UNKNOWN = 0 // Other
|
|
|
|
|
// Hie_STATUS_ACTIVE = 1 // 00 (Status == 0)
|
|
|
|
|
// Hie_STATUS_PENDING = 2 // 01 (Status == Hie_STATUS_BIT_PENDING)
|
|
|
|
|
// Hie_STATUS_REMOVED = 3 // 1- (Status & Hie_STATUS_BIT_REMOVED)
|
|
|
|
|
|
|
|
|
|
static Hie_Status_t Hie_GetStatusBitsFromStatusTxt (Hie_StatusTxt_t StatusTxt)
|
|
|
|
|
{
|
|
|
|
|
static const Hie_Status_t StatusBits[Hie_NUM_STATUS_TXT] =
|
2021-09-10 10:19:46 +02:00
|
|
|
|
{
|
2021-11-10 10:53:08 +01:00
|
|
|
|
[Hie_STATUS_UNKNOWN] = (Hie_Status_t) 0,
|
|
|
|
|
[Hie_STATUS_ACTIVE ] = (Hie_Status_t) 0,
|
|
|
|
|
[Hie_STATUS_PENDING] = Hie_STATUS_BIT_PENDING,
|
|
|
|
|
[Hie_STATUS_REMOVED] = Hie_STATUS_BIT_REMOVED,
|
2021-09-10 10:19:46 +02:00
|
|
|
|
};
|
|
|
|
|
|
2021-11-10 10:53:08 +01:00
|
|
|
|
return StatusBits[StatusTxt];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**** Write parameter with code of other institution/center/degree/course ****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
void Hie_PutParOtherHieCod (void *HieCod)
|
2021-11-10 10:53:08 +01:00
|
|
|
|
{
|
|
|
|
|
if (HieCod)
|
2023-03-10 17:21:04 +01:00
|
|
|
|
ParCod_PutPar (ParCod_OthHie,*((long *) HieCod));
|
2021-09-10 10:19:46 +02:00
|
|
|
|
}
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
2023-09-18 15:15:29 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****** Get parameter with the type or order in list of hierarchy nodes ******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-18 18:08:35 +02:00
|
|
|
|
Hie_Order_t Hie_GetParHieOrder (void)
|
2023-09-18 15:15:29 +02:00
|
|
|
|
{
|
2023-09-18 18:08:35 +02:00
|
|
|
|
return (Hie_Order_t) Par_GetParUnsignedLong ("Order",
|
|
|
|
|
0,
|
|
|
|
|
Hie_NUM_ORDERS - 1,
|
|
|
|
|
(unsigned long) Hie_ORDER_DEFAULT);
|
2023-09-18 15:15:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-19 19:38:03 +02:00
|
|
|
|
/*****************************************************************************/
|
2023-10-03 14:32:22 +02:00
|
|
|
|
/***************** Free list of courses/degrees/centers... *******************/
|
2023-09-19 19:38:03 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
void Hie_FreeList (Hie_Level_t Level)
|
2023-09-19 19:38:03 +02:00
|
|
|
|
{
|
|
|
|
|
if (Gbl.Hierarchy.List[Level].Lst)
|
|
|
|
|
{
|
|
|
|
|
/***** Free memory used by the list of child nodes *****/
|
|
|
|
|
free (Gbl.Hierarchy.List[Level].Lst);
|
|
|
|
|
Gbl.Hierarchy.List[Level].Lst = NULL;
|
|
|
|
|
Gbl.Hierarchy.List[Level].Num = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-03 14:32:22 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***** Reset lists of my courses/degrees/centers/institutions/countries ******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_ResetMyHierarchy (void)
|
|
|
|
|
{
|
|
|
|
|
Hie_Level_t Level;
|
|
|
|
|
|
|
|
|
|
for (Level = Hie_CTY;
|
|
|
|
|
Level <= Hie_CRS;
|
|
|
|
|
Level++)
|
|
|
|
|
{
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Nodes = NULL;
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Num = 0;
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Filled = false;
|
2023-10-03 22:14:35 +02:00
|
|
|
|
Gbl.Usrs.Me.IBelongToCurrent[Level] = false;
|
2023-10-03 14:32:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****** Free lists of my courses/degrees/centers/institutions/countries ******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_FreeMyHierarchy (void)
|
|
|
|
|
{
|
|
|
|
|
Hie_Level_t Level;
|
|
|
|
|
|
|
|
|
|
/***** Remove temporary table with my courses *****/
|
|
|
|
|
if (Gbl.Usrs.Me.Hierarchy[Hie_CRS].Filled)
|
|
|
|
|
Enr_DB_DropTmpTableMyCourses ();
|
|
|
|
|
|
|
|
|
|
/***** Free allocated memory
|
|
|
|
|
for my courses/degrees/centers/institutions/countries *****/
|
|
|
|
|
for (Level = Hie_CTY;
|
|
|
|
|
Level <= Hie_CRS;
|
|
|
|
|
Level++)
|
|
|
|
|
if (Gbl.Usrs.Me.Hierarchy[Level].Filled &&
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Num &&
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Nodes)
|
|
|
|
|
free (Gbl.Usrs.Me.Hierarchy[Level].Nodes);
|
|
|
|
|
|
|
|
|
|
Hie_ResetMyHierarchy ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* Get all my courses/degrees/centers/institutions/countries *********/
|
|
|
|
|
/********* and store them in a list *********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_GetMyHierarchy (Hie_Level_t Level)
|
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned NumNode;
|
|
|
|
|
unsigned NumNodes;
|
|
|
|
|
long HieCod;
|
|
|
|
|
static unsigned (*GetNodesFromDB[Hie_NUM_LEVELS]) (MYSQL_RES **mysql_res,
|
2023-10-03 15:35:36 +02:00
|
|
|
|
long PrtCod) =
|
2023-10-03 14:32:22 +02:00
|
|
|
|
{
|
2023-10-03 15:35:36 +02:00
|
|
|
|
[Hie_CTY] = Cty_DB_GetMyCtys,
|
|
|
|
|
[Hie_INS] = Ins_DB_GetMyInss,
|
|
|
|
|
[Hie_CTR] = Ctr_DB_GetMyCtrs,
|
|
|
|
|
[Hie_DEG] = Deg_DB_GetMyDegs,
|
|
|
|
|
[Hie_CRS] = Enr_DB_GetMyCrss,
|
2023-10-03 14:32:22 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/***** Trivial check 1: if list of nodes is already filled, there's nothing to do *****/
|
|
|
|
|
if (Gbl.Usrs.Me.Hierarchy[Level].Filled)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/***** Trivial check 2: if user's code is not set, don't query database *****/
|
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.UsrCod <= 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/***** If retrieving my list of courses, create a temporary table with them *****/
|
|
|
|
|
if (Level == Hie_CRS)
|
|
|
|
|
{
|
|
|
|
|
Enr_DB_DropTmpTableMyCourses ();
|
|
|
|
|
Enr_DB_CreateTmpTableMyCourses ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Set default values *****/
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Num = 0;
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Nodes = NULL;
|
|
|
|
|
|
|
|
|
|
/***** Get my courses/degrees/centers/institutions/countries from database *****/
|
2023-10-03 15:35:36 +02:00
|
|
|
|
if ((NumNodes = GetNodesFromDB[Level] (&mysql_res,-1L)))
|
2023-10-03 14:32:22 +02:00
|
|
|
|
{
|
|
|
|
|
if ((Gbl.Usrs.Me.Hierarchy[Level].Nodes = malloc (NumNodes *
|
|
|
|
|
sizeof (*Gbl.Usrs.Me.Hierarchy[Level].Nodes))) == NULL)
|
|
|
|
|
Err_NotEnoughMemoryExit ();
|
|
|
|
|
for (NumNode = 0;
|
|
|
|
|
NumNode < NumNodes;
|
|
|
|
|
NumNode++)
|
|
|
|
|
{
|
|
|
|
|
/* Get next course/degree/center/institution/country */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
|
|
|
|
/* Get hierarchy code (row[0]) */
|
|
|
|
|
if ((HieCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
|
|
|
|
|
{
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Nodes[Gbl.Usrs.Me.Hierarchy[Level].Num].HieCod = HieCod;
|
|
|
|
|
|
|
|
|
|
/* Get role or maximum role (row[1]) in this node */
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Nodes[Gbl.Usrs.Me.Hierarchy[Level].Num].MaxRole = Rol_ConvertUnsignedStrToRole (row[1]);
|
|
|
|
|
|
|
|
|
|
/* Get parent hierarchy code */
|
|
|
|
|
if (Level == Hie_CRS)
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Nodes[Gbl.Usrs.Me.Hierarchy[Level].Num].PrtCod = Str_ConvertStrCodToLongCod (row[2]);
|
|
|
|
|
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Num++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
|
|
|
|
|
/***** Set boolean that indicates that my institutions are yet filled *****/
|
|
|
|
|
Gbl.Usrs.Me.Hierarchy[Level].Filled = true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-03 18:36:48 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****** Check if I belong to a course/degree/center/institution/country ******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
bool Hie_CheckIfIBelongTo (Hie_Level_t Level,long HieCod)
|
|
|
|
|
{
|
|
|
|
|
unsigned NumMyNode;
|
|
|
|
|
|
2023-10-03 18:58:52 +02:00
|
|
|
|
/***** Fill the list with the nodes I belong to *****/
|
2023-10-03 18:36:48 +02:00
|
|
|
|
Hie_GetMyHierarchy (Level);
|
|
|
|
|
|
|
|
|
|
/***** Check if the node passed as parameter is any of my nodes *****/
|
|
|
|
|
for (NumMyNode = 0;
|
|
|
|
|
NumMyNode < Gbl.Usrs.Me.Hierarchy[Level].Num;
|
|
|
|
|
NumMyNode++)
|
|
|
|
|
if (Gbl.Usrs.Me.Hierarchy[Level].Nodes[NumMyNode].HieCod == HieCod)
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 10:36:07 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*** Flush cache that stores if a user belongs to a node of the hierarchy ****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
void Hie_FlushCacheUsrBelongsTo (Hie_Level_t Level)
|
2023-09-20 10:36:07 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Gbl.Cache.UsrBelongsTo[Level].Valid = false;
|
2023-09-20 10:36:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Check if a user belongs to a course ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
bool Hie_CheckIfUsrBelongsTo (Hie_Level_t Level,long UsrCod,long HieCod,
|
2023-09-20 10:36:07 +02:00
|
|
|
|
bool CountOnlyAcceptedCourses)
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
static bool (*FunctionToGetIfUsrBelongsToFromDB[Hie_NUM_LEVELS]) (long UsrCod,long HieCod,
|
2023-09-20 10:36:07 +02:00
|
|
|
|
bool CountOnlyAcceptedCourses) =
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_INS] = Ins_DB_CheckIfUsrBelongsToIns,
|
|
|
|
|
[Hie_CTR] = Ctr_DB_CheckIfUsrBelongsToCtr,
|
|
|
|
|
[Hie_DEG] = Deg_DB_CheckIfUsrBelongsToDeg,
|
|
|
|
|
[Hie_CRS] = Enr_DB_CheckIfUsrBelongsToCrs,
|
2023-09-20 10:36:07 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/***** Check if level is correct *****/
|
|
|
|
|
if (!FunctionToGetIfUsrBelongsToFromDB[Level])
|
|
|
|
|
Err_WrongHierarchyLevelExit ();
|
|
|
|
|
|
|
|
|
|
/***** 1. Fast check: Trivial cases *****/
|
|
|
|
|
if (UsrCod <= 0 ||
|
|
|
|
|
HieCod <= 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
/***** 2. Fast check: If cached... *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Cache.UsrBelongsTo[Level].Valid &&
|
|
|
|
|
UsrCod == Gbl.Cache.UsrBelongsTo[Level].UsrCod &&
|
2023-09-20 10:36:07 +02:00
|
|
|
|
HieCod == Gbl.Cache.UsrBelongsTo[Level].HieCod &&
|
|
|
|
|
CountOnlyAcceptedCourses == Gbl.Cache.UsrBelongsTo[Level].CountOnlyAcceptedCourses)
|
|
|
|
|
return Gbl.Cache.UsrBelongsTo[Level].Belongs;
|
|
|
|
|
|
|
|
|
|
/***** 3. Slow check: Get if user belongs to hierarchy node from database *****/
|
|
|
|
|
Gbl.Cache.UsrBelongsTo[Level].UsrCod = UsrCod;
|
|
|
|
|
Gbl.Cache.UsrBelongsTo[Level].HieCod = HieCod;
|
|
|
|
|
Gbl.Cache.UsrBelongsTo[Level].CountOnlyAcceptedCourses = CountOnlyAcceptedCourses;
|
|
|
|
|
Gbl.Cache.UsrBelongsTo[Level].Belongs = FunctionToGetIfUsrBelongsToFromDB[Level] (UsrCod,HieCod,
|
|
|
|
|
CountOnlyAcceptedCourses);
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Gbl.Cache.UsrBelongsTo[Level].Valid = true;
|
2023-09-20 10:36:07 +02:00
|
|
|
|
return Gbl.Cache.UsrBelongsTo[Level].Belongs;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-02 23:44:27 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* Get and show stats about hierarchy ***********/
|
|
|
|
|
/********* (countries, institutions, centers, degrees and courses) ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_GetAndShowHierarchyStats (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_ANALYTICS_Figures_hierarchy;
|
|
|
|
|
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
|
2023-09-25 21:14:05 +02:00
|
|
|
|
Hie_Level_t HavingNodesOfLevel;
|
2022-01-02 23:44:27 +01:00
|
|
|
|
Rol_Role_t Role;
|
|
|
|
|
|
|
|
|
|
/***** Begin box and table *****/
|
|
|
|
|
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_HIERARCHY],
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_ANALYTICS_Figures_hierarchy,Box_NOT_CLOSABLE,2);
|
|
|
|
|
|
2023-09-25 21:14:05 +02:00
|
|
|
|
/* Head row */
|
2022-01-02 23:44:27 +01:00
|
|
|
|
Hie_WriteHeadHierarchy ();
|
2023-09-25 21:14:05 +02:00
|
|
|
|
|
|
|
|
|
/* Rows with number of nodes having nodes of each level */
|
|
|
|
|
for (HavingNodesOfLevel = Hie_INS;
|
|
|
|
|
HavingNodesOfLevel <= Hie_CRS;
|
|
|
|
|
HavingNodesOfLevel++)
|
|
|
|
|
Hie_GetAndShowHierarchyWithNodes (HavingNodesOfLevel);
|
|
|
|
|
|
|
|
|
|
/* Rows with number of nodes having users of each role */
|
2022-01-02 23:44:27 +01:00
|
|
|
|
for (Role = Rol_TCH;
|
|
|
|
|
Role >= Rol_STD;
|
|
|
|
|
Role--)
|
|
|
|
|
Hie_GetAndShowHierarchyWithUsrs (Role);
|
2023-09-25 21:14:05 +02:00
|
|
|
|
|
|
|
|
|
/* Row with total nodes */
|
2022-01-02 23:44:27 +01:00
|
|
|
|
Hie_GetAndShowHierarchyTotal ();
|
|
|
|
|
|
|
|
|
|
/***** End table and box *****/
|
|
|
|
|
Box_BoxTableEnd ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Write head of hierarchy table **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_WriteHeadHierarchy (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Countries;
|
|
|
|
|
extern const char *Txt_Institutions;
|
|
|
|
|
extern const char *Txt_Centers;
|
|
|
|
|
extern const char *Txt_Degrees;
|
|
|
|
|
extern const char *Txt_Courses;
|
2023-09-25 23:25:39 +02:00
|
|
|
|
static const char *Icons[Hie_NUM_LEVELS] =
|
|
|
|
|
{
|
|
|
|
|
[Hie_CTY] = "globe-americas.svg",
|
|
|
|
|
[Hie_INS] = "university.svg",
|
|
|
|
|
[Hie_CTR] = "building.svg",
|
|
|
|
|
[Hie_DEG] = "graduation-cap.svg",
|
|
|
|
|
[Hie_CRS] = "chalkboard-teacher.svg",
|
|
|
|
|
};
|
|
|
|
|
static const char **Txt[Hie_NUM_LEVELS] =
|
|
|
|
|
{
|
|
|
|
|
[Hie_CTY] = &Txt_Countries,
|
|
|
|
|
[Hie_INS] = &Txt_Institutions,
|
|
|
|
|
[Hie_CTR] = &Txt_Centers,
|
|
|
|
|
[Hie_DEG] = &Txt_Degrees,
|
|
|
|
|
[Hie_CRS] = &Txt_Courses,
|
|
|
|
|
};
|
|
|
|
|
Hie_Level_t Level;
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
HTM_TH_Empty (1);
|
|
|
|
|
|
2023-09-25 23:25:39 +02:00
|
|
|
|
for (Level = Hie_CTY;
|
|
|
|
|
Level <= Hie_CRS;
|
|
|
|
|
Level++)
|
|
|
|
|
{
|
|
|
|
|
HTM_TH_Begin (HTM_HEAD_RIGHT);
|
|
|
|
|
Ico_PutIcon (Icons[Level],Ico_BLACK,*Txt[Level],"ICOx16");
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (*Txt[Level]);
|
|
|
|
|
HTM_TH_End ();
|
|
|
|
|
}
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2023-09-25 18:31:14 +02:00
|
|
|
|
/********* Get and show number of elements in hierarchy with nodes ***********/
|
2022-01-02 23:44:27 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-25 21:14:05 +02:00
|
|
|
|
static void Hie_GetAndShowHierarchyWithNodes (Hie_Level_t HavingNodesOfLevel)
|
2022-01-02 23:44:27 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_With_;
|
|
|
|
|
extern const char *Txt_institutions;
|
|
|
|
|
extern const char *Txt_centers;
|
|
|
|
|
extern const char *Txt_degrees;
|
|
|
|
|
extern const char *Txt_courses;
|
2023-09-25 18:31:14 +02:00
|
|
|
|
static const char **Txt[Hie_NUM_LEVELS] =
|
2023-09-22 14:47:56 +02:00
|
|
|
|
{
|
2023-09-25 18:31:14 +02:00
|
|
|
|
[Hie_INS] = &Txt_institutions, // Number of ... with institutions
|
|
|
|
|
[Hie_CTR] = &Txt_centers, // Number of ... with centers
|
|
|
|
|
[Hie_DEG] = &Txt_degrees, // Number of ... with degrees
|
|
|
|
|
[Hie_CRS] = &Txt_courses, // Number of ... with courses
|
2023-09-22 14:47:56 +02:00
|
|
|
|
};
|
2023-09-25 18:31:14 +02:00
|
|
|
|
int NumNodes[Hie_NUM_LEVELS];
|
|
|
|
|
Hie_Level_t LevelChildren;
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
|
|
|
|
/***** Get number of elements with courses *****/
|
2023-09-25 20:23:56 +02:00
|
|
|
|
// For each level country, institution, center, degree and course...
|
2023-09-25 18:31:14 +02:00
|
|
|
|
for (LevelChildren = Hie_CTY;
|
|
|
|
|
LevelChildren <= Hie_CRS;
|
|
|
|
|
LevelChildren++)
|
2023-09-25 23:25:39 +02:00
|
|
|
|
if (LevelChildren >= HavingNodesOfLevel) // Example: don't show number of centers with institutions
|
2023-09-25 18:31:14 +02:00
|
|
|
|
NumNodes[LevelChildren] = -1;
|
2023-09-25 23:25:39 +02:00
|
|
|
|
else if (HavingNodesOfLevel <= Gbl.Scope.Current) // Example: if scope is center (4)
|
|
|
|
|
// number of nodes with instit./countries/centers
|
|
|
|
|
NumNodes[LevelChildren] = 1; // in current center is 1
|
2023-09-25 20:23:56 +02:00
|
|
|
|
else
|
2023-09-25 21:14:05 +02:00
|
|
|
|
NumNodes[LevelChildren] = (int) Hie_GetCachedNumNodesInHieLvlWith (LevelChildren, // Child
|
2023-09-25 20:23:56 +02:00
|
|
|
|
Gbl.Scope.Current, // Parent
|
2023-09-25 21:14:05 +02:00
|
|
|
|
HavingNodesOfLevel);// Grand child
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
|
|
|
|
/***** Write number of elements with courses *****/
|
2023-09-25 21:14:05 +02:00
|
|
|
|
Hie_ShowHierarchyRow (Txt_With_,*Txt[HavingNodesOfLevel],"DAT",NumNodes);
|
2022-01-02 23:44:27 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get and show number of elements in hierarchy with users **********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_GetAndShowHierarchyWithUsrs (Rol_Role_t Role)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_With_;
|
|
|
|
|
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
2023-09-25 23:25:39 +02:00
|
|
|
|
static unsigned (*FunctionGetCachedNumNodesWithusrs[Hie_NUM_LEVELS]) (Rol_Role_t Role) =
|
|
|
|
|
{
|
|
|
|
|
[Hie_CTY] = Cty_GetCachedNumCtysWithUsrs,
|
|
|
|
|
[Hie_INS] = Ins_GetCachedNumInssWithUsrs,
|
|
|
|
|
[Hie_CTR] = Ctr_GetCachedNumCtrsWithUsrs,
|
|
|
|
|
[Hie_DEG] = Deg_GetCachedNumDegsWithUsrs,
|
|
|
|
|
[Hie_CRS] = Crs_GetCachedNumCrssWithUsrs,
|
|
|
|
|
};
|
2023-09-22 14:47:56 +02:00
|
|
|
|
int NumNodes[Hie_NUM_LEVELS];
|
2023-09-25 23:25:39 +02:00
|
|
|
|
Hie_Level_t Level;
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
2023-09-25 23:25:39 +02:00
|
|
|
|
/***** Get number of nodes with users *****/
|
|
|
|
|
for (Level = Hie_CTY;
|
|
|
|
|
Level <= Hie_CRS;
|
|
|
|
|
Level++)
|
|
|
|
|
NumNodes[Level] = FunctionGetCachedNumNodesWithusrs[Level] (Role);
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
/***** Write number of elements with users *****/
|
2022-01-02 23:44:27 +01:00
|
|
|
|
Hie_ShowHierarchyRow (Txt_With_,Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN],
|
2023-09-22 14:47:56 +02:00
|
|
|
|
"DAT",NumNodes);
|
2022-01-02 23:44:27 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************ Get and show total number of elements in hierarchy *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_GetAndShowHierarchyTotal (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Total;
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Hie_Level_t Level;
|
|
|
|
|
int NumNodes[Hie_NUM_LEVELS];
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
/***** Get total number of nodes of each level in current scope *****/
|
|
|
|
|
for (Level = Hie_CTY;
|
|
|
|
|
Level <= Hie_CRS;
|
|
|
|
|
Level++)
|
|
|
|
|
if (Level > Gbl.Scope.Current)
|
|
|
|
|
NumNodes[Level] = (int) Hie_GetCachedNumNodesInHieLvl (Level,Gbl.Scope.Current,
|
|
|
|
|
Gbl.Hierarchy.Node[Gbl.Scope.Current].HieCod);
|
|
|
|
|
else
|
|
|
|
|
NumNodes[Level] = 1;
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
|
|
|
|
/***** Write total number of elements *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Hie_ShowHierarchyRow ("",Txt_Total,"LINE_TOP DAT_STRONG",NumNodes);
|
2023-09-20 20:07:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**** Get total number of courses/degrees/centers/institutions in country ****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
void Hie_FlushCachedNumNodesInHieLvl (Hie_Level_t LevelChildren,
|
|
|
|
|
Hie_Level_t LevelParent)
|
2023-09-20 21:55:11 +02:00
|
|
|
|
{
|
2023-09-20 22:49:32 +02:00
|
|
|
|
Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].Valid = false;
|
2023-09-20 21:55:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Hie_GetCachedNumNodesInHieLvl (Hie_Level_t LevelChildren,
|
|
|
|
|
Hie_Level_t LevelParent,long HieCod)
|
2023-09-20 20:07:04 +02:00
|
|
|
|
{
|
|
|
|
|
unsigned NumNodes;
|
|
|
|
|
|
|
|
|
|
/***** Get number of nodes from cache *****/
|
2023-09-20 22:49:32 +02:00
|
|
|
|
if (!FigCch_GetFigureFromCache (Hie_FiguresCached[LevelChildren],LevelParent,HieCod,
|
2023-09-20 20:07:04 +02:00
|
|
|
|
FigCch_UNSIGNED,&NumNodes))
|
|
|
|
|
/***** Get current number of nodes from database and update cache *****/
|
2023-09-20 22:49:32 +02:00
|
|
|
|
NumNodes = Hie_GetNumNodesInHieLvl (LevelChildren,LevelParent,HieCod);
|
2023-09-20 20:07:04 +02:00
|
|
|
|
|
|
|
|
|
return NumNodes;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Hie_GetNumNodesInHieLvl (Hie_Level_t LevelChildren,
|
|
|
|
|
Hie_Level_t LevelParent,long HieCod)
|
2023-09-20 21:55:11 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
static unsigned (*FunctionGetFigure[Hie_NUM_LEVELS][Hie_NUM_LEVELS]) (long HieCod) =
|
2023-09-20 21:55:11 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
/* Number of nodes in system */
|
|
|
|
|
[Hie_CTY][Hie_SYS] = Cty_DB_GetNumCtysInSys,
|
|
|
|
|
[Hie_INS][Hie_SYS] = Ins_DB_GetNumInssInSys,
|
|
|
|
|
[Hie_CTR][Hie_SYS] = Ctr_DB_GetNumCtrsInSys,
|
|
|
|
|
[Hie_DEG][Hie_SYS] = Deg_DB_GetNumDegsInSys,
|
|
|
|
|
[Hie_CRS][Hie_SYS] = Crs_DB_GetNumCrssInSys,
|
2023-09-20 21:55:11 +02:00
|
|
|
|
/* Number of nodes in country */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_INS][Hie_CTY] = Ins_DB_GetNumInssInCty,
|
|
|
|
|
[Hie_CTR][Hie_CTY] = Ctr_DB_GetNumCtrsInCty,
|
|
|
|
|
[Hie_DEG][Hie_CTY] = Deg_DB_GetNumDegsInCty,
|
|
|
|
|
[Hie_CRS][Hie_CTY] = Crs_DB_GetNumCrssInCty,
|
2023-09-20 21:55:11 +02:00
|
|
|
|
/* Number of nodes in institution */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_CTR][Hie_INS] = Ctr_DB_GetNumCtrsInIns,
|
|
|
|
|
[Hie_DEG][Hie_INS] = Deg_DB_GetNumDegsInIns,
|
|
|
|
|
[Hie_CRS][Hie_INS] = Crs_DB_GetNumCrssInIns,
|
2023-09-20 21:55:11 +02:00
|
|
|
|
/* Number of nodes in center */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_DEG][Hie_CTR] = Deg_DB_GetNumDegsInCtr,
|
|
|
|
|
[Hie_CRS][Hie_CTR] = Crs_DB_GetNumCrssInCtr,
|
2023-09-20 21:55:11 +02:00
|
|
|
|
/* Number of nodes in degree */
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_CRS][Hie_DEG] = Crs_DB_GetNumCrssInDeg,
|
2023-09-20 21:55:11 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/***** 1. Fast check: If cached... *****/
|
2023-09-20 22:49:32 +02:00
|
|
|
|
if (Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].Valid &&
|
|
|
|
|
HieCod == Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].HieCod)
|
|
|
|
|
return Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].Num;
|
2023-09-20 21:55:11 +02:00
|
|
|
|
|
|
|
|
|
/***** 2. Slow: number of institutions in a country from database *****/
|
2023-09-20 22:49:32 +02:00
|
|
|
|
Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].HieCod = HieCod;
|
|
|
|
|
Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].Num = FunctionGetFigure[LevelChildren][LevelParent] (HieCod);
|
|
|
|
|
Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].Valid = true;
|
|
|
|
|
FigCch_UpdateFigureIntoCache (Hie_FiguresCached[LevelChildren],LevelParent,
|
|
|
|
|
Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].HieCod,
|
|
|
|
|
FigCch_UNSIGNED,&Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].Num);
|
|
|
|
|
return Gbl.Cache.NumNodesInHieLvl[LevelChildren][LevelParent].Num;
|
2023-09-20 21:55:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-22 18:24:12 +02:00
|
|
|
|
/*****************************************************************************/
|
2023-09-25 21:14:05 +02:00
|
|
|
|
/**** Get number of children nodes in parent node having nodes of a level ****/
|
2023-09-22 18:24:12 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
unsigned Hie_GetCachedNumNodesInHieLvlWith (Hie_Level_t LevelChildren,
|
|
|
|
|
Hie_Level_t LevelParent,
|
2023-09-25 21:14:05 +02:00
|
|
|
|
Hie_Level_t HavingNodesOfLevel)
|
2023-09-22 18:24:12 +02:00
|
|
|
|
{
|
2023-09-25 21:14:05 +02:00
|
|
|
|
// Example: number of centers with courses in current institution
|
|
|
|
|
// LevelChildren = center
|
|
|
|
|
// LevelParent = institution
|
|
|
|
|
// HavingNodesOfLevel = course
|
2023-09-22 18:24:12 +02:00
|
|
|
|
static FigCch_FigureCached_t Figure[Hie_NUM_LEVELS][Hie_NUM_LEVELS] =
|
|
|
|
|
{
|
2023-09-25 20:23:56 +02:00
|
|
|
|
// Child / Grandchild
|
2023-09-22 18:24:12 +02:00
|
|
|
|
[Hie_CTY][Hie_INS] = FigCch_NUM_CTYS_WITH_INSS,
|
|
|
|
|
[Hie_CTY][Hie_CTR] = FigCch_NUM_CTYS_WITH_CTRS,
|
|
|
|
|
[Hie_CTY][Hie_DEG] = FigCch_NUM_CTYS_WITH_DEGS,
|
|
|
|
|
[Hie_CTY][Hie_CRS] = FigCch_NUM_CTYS_WITH_CRSS,
|
|
|
|
|
|
|
|
|
|
[Hie_INS][Hie_CTR] = FigCch_NUM_INSS_WITH_CTRS,
|
|
|
|
|
[Hie_INS][Hie_DEG] = FigCch_NUM_INSS_WITH_DEGS,
|
|
|
|
|
[Hie_INS][Hie_CRS] = FigCch_NUM_INSS_WITH_CRSS,
|
|
|
|
|
|
|
|
|
|
[Hie_CTR][Hie_DEG] = FigCch_NUM_CTRS_WITH_DEGS,
|
|
|
|
|
[Hie_CTR][Hie_CRS] = FigCch_NUM_CTRS_WITH_CRSS,
|
|
|
|
|
|
|
|
|
|
[Hie_DEG][Hie_CRS] = FigCch_NUM_DEGS_WITH_CRSS,
|
|
|
|
|
};
|
|
|
|
|
static unsigned (*FunctionGetFigure[Hie_NUM_LEVELS][Hie_NUM_LEVELS]) (Hie_Level_t Level,long HieCod) =
|
|
|
|
|
{
|
2023-09-25 20:23:56 +02:00
|
|
|
|
// Child / Grandchild
|
2023-09-22 18:24:12 +02:00
|
|
|
|
[Hie_CTY][Hie_INS] = Cty_DB_GetNumCtysWithInss,
|
|
|
|
|
[Hie_CTY][Hie_CTR] = Cty_DB_GetNumCtysWithCtrs,
|
|
|
|
|
[Hie_CTY][Hie_DEG] = Cty_DB_GetNumCtysWithDegs,
|
|
|
|
|
[Hie_CTY][Hie_CRS] = Cty_DB_GetNumCtysWithCrss,
|
|
|
|
|
|
|
|
|
|
[Hie_INS][Hie_CTR] = Ins_DB_GetNumInssWithCtrs,
|
|
|
|
|
[Hie_INS][Hie_DEG] = Ins_DB_GetNumInssWithDegs,
|
|
|
|
|
[Hie_INS][Hie_CRS] = Ins_DB_GetNumInssWithCrss,
|
|
|
|
|
|
|
|
|
|
[Hie_CTR][Hie_DEG] = Ctr_DB_GetNumCtrsWithDegs,
|
|
|
|
|
[Hie_CTR][Hie_CRS] = Ctr_DB_GetNumCtrsWithCrss,
|
|
|
|
|
|
|
|
|
|
[Hie_DEG][Hie_CRS] = Deg_DB_GetNumDegsWithCrss,
|
|
|
|
|
};
|
|
|
|
|
unsigned NumNodes;
|
|
|
|
|
|
|
|
|
|
/***** Get number of centers with degrees from cache *****/
|
2023-09-25 21:14:05 +02:00
|
|
|
|
if (!FigCch_GetFigureFromCache (Figure[LevelChildren][HavingNodesOfLevel],
|
2023-09-22 18:24:12 +02:00
|
|
|
|
LevelParent,Gbl.Hierarchy.Node[LevelParent].HieCod,
|
|
|
|
|
FigCch_UNSIGNED,&NumNodes))
|
|
|
|
|
{
|
|
|
|
|
/***** Get current number of nodes with degrees from database and update cache *****/
|
2023-09-25 21:14:05 +02:00
|
|
|
|
NumNodes = FunctionGetFigure[LevelChildren][HavingNodesOfLevel] (LevelParent,Gbl.Hierarchy.Node[LevelParent].HieCod);
|
|
|
|
|
FigCch_UpdateFigureIntoCache (Figure[LevelChildren][HavingNodesOfLevel],
|
2023-09-22 18:24:12 +02:00
|
|
|
|
LevelParent,Gbl.Hierarchy.Node[LevelParent].HieCod,
|
|
|
|
|
FigCch_UNSIGNED,&NumNodes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NumNodes;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-21 18:54:59 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******** Get number of users who claim to belong to a hierarchy node ********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
void Hie_FlushCacheNumUsrsWhoClaimToBelongTo (Hie_Level_t Level)
|
2023-09-21 18:54:59 +02:00
|
|
|
|
{
|
|
|
|
|
Gbl.Cache.NumUsrsWhoClaimToBelongTo[Level].Valid = false;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Hie_GetCachedNumUsrsWhoClaimToBelongTo (Hie_Level_t Level,
|
2023-09-21 18:54:59 +02:00
|
|
|
|
struct Hie_Node *Node)
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
static FigCch_FigureCached_t Figure[Hie_NUM_LEVELS] =
|
2023-09-21 18:54:59 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_CTY] = FigCch_NUM_USRS_BELONG_CTY,
|
|
|
|
|
[Hie_INS] = FigCch_NUM_USRS_BELONG_INS,
|
|
|
|
|
[Hie_CTR] = FigCch_NUM_USRS_BELONG_CTR,
|
2023-09-21 18:54:59 +02:00
|
|
|
|
};
|
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
|
|
|
|
|
/***** Get number of users who claim to belong to hierarchy node from cache *****/
|
|
|
|
|
if (!FigCch_GetFigureFromCache (Figure[Level],Level,Node->HieCod,
|
|
|
|
|
FigCch_UNSIGNED,&NumUsrs))
|
|
|
|
|
/***** Get current number of users who claim to belong to hierarchy node
|
|
|
|
|
from database and update cache *****/
|
|
|
|
|
NumUsrs = Hie_GetNumUsrsWhoClaimToBelongTo (Level,Node);
|
|
|
|
|
|
|
|
|
|
return NumUsrs;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Hie_GetNumUsrsWhoClaimToBelongTo (Hie_Level_t Level,
|
2023-09-21 18:54:59 +02:00
|
|
|
|
struct Hie_Node *Node)
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
static FigCch_FigureCached_t Figure[Hie_NUM_LEVELS] =
|
2023-09-21 18:54:59 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_CTY] = FigCch_NUM_USRS_BELONG_CTY,
|
|
|
|
|
[Hie_INS] = FigCch_NUM_USRS_BELONG_INS,
|
|
|
|
|
[Hie_CTR] = FigCch_NUM_USRS_BELONG_CTR,
|
2023-09-21 18:54:59 +02:00
|
|
|
|
};
|
2023-09-22 14:47:56 +02:00
|
|
|
|
static unsigned (*FunctionToGetNumUsrsWhoClaimToBelongToFromDB[Hie_NUM_LEVELS]) (long HieCod) =
|
2023-09-21 18:54:59 +02:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
[Hie_CTY] = Cty_DB_GetNumUsrsWhoClaimToBelongToCty,
|
|
|
|
|
[Hie_INS] = Ins_DB_GetNumUsrsWhoClaimToBelongToIns,
|
|
|
|
|
[Hie_CTR] = Ctr_DB_GetNumUsrsWhoClaimToBelongToCtr,
|
2023-09-21 18:54:59 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/***** 1. Fast check: Trivial case *****/
|
|
|
|
|
if (Node->HieCod <= 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/***** 2. Fast check: If already got... *****/
|
|
|
|
|
if (Node->NumUsrsWhoClaimToBelong.Valid)
|
|
|
|
|
return Node->NumUsrsWhoClaimToBelong.NumUsrs;
|
|
|
|
|
|
|
|
|
|
/***** 3. Fast check: If cached... *****/
|
|
|
|
|
if (Gbl.Cache.NumUsrsWhoClaimToBelongTo[Level].Valid &&
|
|
|
|
|
Node->HieCod == Gbl.Cache.NumUsrsWhoClaimToBelongTo[Level].HieCod)
|
|
|
|
|
{
|
|
|
|
|
Node->NumUsrsWhoClaimToBelong.NumUsrs = Gbl.Cache.NumUsrsWhoClaimToBelongTo[Level].NumUsrs;
|
|
|
|
|
Node->NumUsrsWhoClaimToBelong.Valid = true;
|
|
|
|
|
return Node->NumUsrsWhoClaimToBelong.NumUsrs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** 4. Slow: number of users who claim to belong to a hierarchy node
|
|
|
|
|
from database *****/
|
|
|
|
|
Gbl.Cache.NumUsrsWhoClaimToBelongTo[Level].HieCod = Node->HieCod;
|
|
|
|
|
Gbl.Cache.NumUsrsWhoClaimToBelongTo[Level].NumUsrs =
|
|
|
|
|
Node->NumUsrsWhoClaimToBelong.NumUsrs = FunctionToGetNumUsrsWhoClaimToBelongToFromDB[Level] (Node->HieCod);
|
|
|
|
|
Gbl.Cache.NumUsrsWhoClaimToBelongTo[Level].Valid =
|
|
|
|
|
Node->NumUsrsWhoClaimToBelong.Valid = true;
|
|
|
|
|
FigCch_UpdateFigureIntoCache (Figure[Level],Level,Gbl.Cache.NumUsrsWhoClaimToBelongTo[Level].HieCod,
|
|
|
|
|
FigCch_UNSIGNED,&Gbl.Cache.NumUsrsWhoClaimToBelongTo[Level].NumUsrs);
|
|
|
|
|
return Node->NumUsrsWhoClaimToBelong.NumUsrs;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-02 23:44:27 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Show row with number of elements in hierarchy ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_ShowHierarchyRow (const char *Text1,const char *Text2,
|
|
|
|
|
const char *ClassTxt,
|
2023-09-22 14:47:56 +02:00
|
|
|
|
int NumNodes[Hie_NUM_LEVELS])
|
2022-01-02 23:44:27 +01:00
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Hie_Level_t Level;
|
|
|
|
|
|
2022-01-02 23:44:27 +01:00
|
|
|
|
/***** Begin row *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/***** Write text *****/
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM %s_%s\"",ClassTxt,The_GetSuffix ());
|
2022-01-02 23:44:27 +01:00
|
|
|
|
HTM_Txt (Text1);
|
|
|
|
|
HTM_Txt (Text2);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Write number of countries *****/
|
2023-09-25 23:25:39 +02:00
|
|
|
|
for (Level = Hie_CTY;
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Level <= Hie_CRS;
|
|
|
|
|
Level++)
|
|
|
|
|
Hie_ShowHierarchyCell (ClassTxt,NumNodes[Level]);
|
2022-01-02 23:44:27 +01:00
|
|
|
|
|
|
|
|
|
/***** End row *****/
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Hie_ShowHierarchyCell (const char *ClassTxt,int Num)
|
|
|
|
|
{
|
|
|
|
|
/***** Write number *****/
|
2022-05-30 19:03:56 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM %s_%s\"",ClassTxt,The_GetSuffix ());
|
2022-01-02 23:44:27 +01:00
|
|
|
|
if (Num >= 0)
|
|
|
|
|
HTM_Unsigned ((unsigned) Num);
|
|
|
|
|
else // < 0 ==> do not show number
|
|
|
|
|
HTM_Hyphen ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
}
|