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.
|
2022-09-21 10:46:14 +02:00
|
|
|
|
Copyright (C) 1999-2022 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
|
|
|
|
|
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"
|
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"
|
2021-05-27 23:30:16 +02:00
|
|
|
|
#include "swad_hierarchy_level.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2016-12-10 22:21:04 +01:00
|
|
|
|
#include "swad_logo.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
2021-11-10 10:53:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
static void Hie_GetAndShowHierarchyWithInss (void);
|
|
|
|
|
static void Hie_GetAndShowHierarchyWithCtrs (void);
|
|
|
|
|
static void Hie_GetAndShowHierarchyWithDegs (void);
|
|
|
|
|
static void Hie_GetAndShowHierarchyWithCrss (void);
|
|
|
|
|
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,
|
|
|
|
|
int NumCtys, // < 0 ==> do not show number
|
|
|
|
|
int NumInss, // < 0 ==> do not show number
|
|
|
|
|
int NumCtrs, // < 0 ==> do not show number
|
|
|
|
|
int NumDegs, // < 0 ==> do not show number
|
|
|
|
|
int NumCrss); // < 0 ==> do not show number
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
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 */
|
|
|
|
|
Frm_LabelColumn ("RT","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
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
if (Gbl.Hierarchy.Cty.CtyCod > 0)
|
|
|
|
|
{
|
|
|
|
|
/***** 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 */
|
|
|
|
|
Frm_LabelColumn ("RT","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
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
if (Gbl.Hierarchy.Ins.InsCod > 0)
|
|
|
|
|
{
|
|
|
|
|
/***** 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 */
|
|
|
|
|
Frm_LabelColumn ("RT","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
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
if (Gbl.Hierarchy.Ctr.CtrCod > 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 */
|
|
|
|
|
Frm_LabelColumn ("RT","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
|
|
|
|
|
|
|
|
|
if (Gbl.Hierarchy.Deg.DegCod > 0)
|
|
|
|
|
{
|
|
|
|
|
/***** 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 */
|
|
|
|
|
Frm_LabelColumn ("RT","crs",Txt_Course);
|
|
|
|
|
|
|
|
|
|
/* 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);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Par_PutHiddenParamUnsigned (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
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
if (Gbl.Hierarchy.Cty.CtyCod > 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);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Cty_PutParamCtyCod (Gbl.Hierarchy.Cty.CtyCod);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language],
|
|
|
|
|
"class=\"BT_LINK\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
if (Gbl.Hierarchy.Ins.InsCod > 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);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Ins_PutParamInsCod (Gbl.Hierarchy.Ins.InsCod);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Ins.FullName,
|
|
|
|
|
"class=\"BT_LINK\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Ins.ShrtName);
|
|
|
|
|
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
|
|
|
|
}
|
2019-04-03 20:57:04 +02:00
|
|
|
|
else if (Gbl.Hierarchy.Cty.CtyCod > 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
|
|
|
|
}
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
if (Gbl.Hierarchy.Ctr.CtrCod > 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);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Ctr_PutParamCtrCod (Gbl.Hierarchy.Ctr.CtrCod);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Ctr.FullName,
|
|
|
|
|
"class=\"BT_LINK\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Ctr.ShrtName);
|
|
|
|
|
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
|
|
|
|
}
|
2019-04-03 20:57:04 +02:00
|
|
|
|
else if (Gbl.Hierarchy.Ins.InsCod > 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
|
|
|
|
}
|
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
if (Gbl.Hierarchy.Deg.DegCod > 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);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Deg_PutParamDegCod (Gbl.Hierarchy.Deg.DegCod);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Deg.FullName,
|
|
|
|
|
"class=\"BT_LINK\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Deg.ShrtName);
|
|
|
|
|
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
|
|
|
|
}
|
2019-04-03 20:57:04 +02:00
|
|
|
|
else if (Gbl.Hierarchy.Ctr.CtrCod > 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\"",
|
2021-05-27 23:30:16 +02:00
|
|
|
|
(Gbl.Hierarchy.Level == HieLvl_CRS) ? "" :
|
2019-10-24 00:04:40 +02:00
|
|
|
|
((Gbl.Hierarchy.Deg.DegCod > 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)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_TAGLINE;
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
/***** Logo *****/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
switch (Gbl.Hierarchy.Level)
|
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_SYS: // System
|
2021-12-22 18:54:43 +01:00
|
|
|
|
Ico_PutIcon ("swad64x64.png",Ico_UNCHANGED,
|
|
|
|
|
Cfg_PLATFORM_FULL_NAME,"ICO40x40 TOP_LOGO");
|
2019-04-03 20:57:04 +02:00
|
|
|
|
break;
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_CTY: // Country
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,"COUNTRY_MAP_TITLE");
|
|
|
|
|
break;
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_INS: // Institution
|
|
|
|
|
Lgo_DrawLogo (HieLvl_INS,Gbl.Hierarchy.Ins.InsCod,
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Ins.ShrtName,40,"TOP_LOGO",false);
|
|
|
|
|
break;
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_CTR: // Center
|
|
|
|
|
Lgo_DrawLogo (HieLvl_CTR,Gbl.Hierarchy.Ctr.CtrCod,
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Ctr.ShrtName,40,"TOP_LOGO",false);
|
|
|
|
|
break;
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_DEG: // Degree
|
|
|
|
|
case HieLvl_CRS: // Course
|
|
|
|
|
Lgo_DrawLogo (HieLvl_DEG,Gbl.Hierarchy.Deg.DegCod,
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Deg.ShrtName,40,"TOP_LOGO",false);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
|
|
|
|
/***** Text *****/
|
2019-10-24 00:04:40 +02:00
|
|
|
|
HTM_DIV_Begin ("id=\"big_name_container\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (Gbl.Hierarchy.Cty.CtyCod > 0)
|
|
|
|
|
{
|
|
|
|
|
HTM_DIV_Begin ("id=\"big_full_name\"");
|
2022-06-28 11:09:19 +02:00
|
|
|
|
HTM_Txt ( (Gbl.Hierarchy.Level == HieLvl_CRS) ? Gbl.Hierarchy.Crs.FullName :// Full name
|
2021-07-08 15:00:17 +02:00
|
|
|
|
((Gbl.Hierarchy.Level == HieLvl_DEG) ? Gbl.Hierarchy.Deg.FullName :
|
|
|
|
|
((Gbl.Hierarchy.Level == HieLvl_CTR) ? Gbl.Hierarchy.Ctr.FullName :
|
|
|
|
|
((Gbl.Hierarchy.Level == HieLvl_INS) ? Gbl.Hierarchy.Ins.FullName :
|
2022-06-28 11:09:19 +02:00
|
|
|
|
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]))));
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
HTM_DIV_Begin ("class=\"NOT_SHOWN\"");
|
|
|
|
|
HTM_Txt (" / "); // To separate
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
HTM_DIV_Begin ("id=\"big_short_name\"");
|
|
|
|
|
HTM_Txt ( (Gbl.Hierarchy.Level == HieLvl_CRS) ? Gbl.Hierarchy.Crs.ShrtName :// Short name
|
|
|
|
|
((Gbl.Hierarchy.Level == HieLvl_DEG) ? Gbl.Hierarchy.Deg.ShrtName :
|
|
|
|
|
((Gbl.Hierarchy.Level == HieLvl_CTR) ? Gbl.Hierarchy.Ctr.ShrtName :
|
|
|
|
|
((Gbl.Hierarchy.Level == HieLvl_INS) ? Gbl.Hierarchy.Ins.ShrtName :
|
|
|
|
|
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]))));
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
}
|
|
|
|
|
else // No country specified ==> home page
|
|
|
|
|
{
|
|
|
|
|
HTM_DIV_Begin ("id=\"big_full_name\""); // Full name
|
|
|
|
|
HTM_TxtF ("%s: %s",Cfg_PLATFORM_SHORT_NAME,Txt_TAGLINE);
|
|
|
|
|
HTM_DIV_End ();
|
2019-10-24 00:04:40 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"NOT_SHOWN\"");
|
|
|
|
|
HTM_Txt (" / "); // To separate
|
|
|
|
|
HTM_DIV_End ();
|
2019-10-24 00:04:40 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_DIV_Begin ("id=\"big_short_name\""); // Short name
|
|
|
|
|
HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
}
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2019-11-11 00:15:44 +01:00
|
|
|
|
HTM_TxtF ("</h1>");
|
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
|
|
|
|
|
|
|
|
|
/***** Copy last hierarchy scope and code to current hierarchy *****/
|
|
|
|
|
switch (Gbl.Usrs.Me.UsrLast.LastHie.Scope)
|
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_CTY: // Country
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Cty.CtyCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod;
|
2019-04-01 23:15:17 +02:00
|
|
|
|
break;
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_INS: // Institution
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Ins.InsCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod;
|
2019-04-01 23:15:17 +02:00
|
|
|
|
break;
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_CTR: // Center
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Ctr.CtrCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod;
|
2019-04-01 23:15:17 +02:00
|
|
|
|
break;
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_DEG: // Degree
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Deg.DegCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod;
|
2019-04-01 23:15:17 +02:00
|
|
|
|
break;
|
2021-05-27 23:30:16 +02:00
|
|
|
|
case HieLvl_CRS: // Course
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Crs.CrsCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod;
|
2019-04-01 23:15:17 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
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 *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Hierarchy.Crs.CrsCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2020-01-05 14:09:28 +01:00
|
|
|
|
if (Crs_GetDataOfCourseByCod (&Gbl.Hierarchy.Crs)) // Course found
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Deg.DegCod = Gbl.Hierarchy.Crs.DegCod;
|
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 *****/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
if (Gbl.Hierarchy.Deg.DegCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2020-01-05 12:52:03 +01:00
|
|
|
|
if (Deg_GetDataOfDegreeByCod (&Gbl.Hierarchy.Deg)) // Degree found
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Ctr.CtrCod = Gbl.Hierarchy.Deg.CtrCod;
|
2021-05-28 19:59:55 +02:00
|
|
|
|
Gbl.Hierarchy.Ins.InsCod = Deg_DB_GetInsCodOfDegreeByCod (Gbl.Hierarchy.Deg.DegCod);
|
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 *****/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
if (Gbl.Hierarchy.Ctr.CtrCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
if (Ctr_GetDataOfCenterByCod (&Gbl.Hierarchy.Ctr)) // Center found
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Ins.InsCod = Gbl.Hierarchy.Ctr.InsCod;
|
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 *****/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
if (Gbl.Hierarchy.Ins.InsCod > 0)
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
2021-10-01 18:54:12 +02:00
|
|
|
|
if (Ins_GetDataOfInstitByCod (&Gbl.Hierarchy.Ins)) // Institution found
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Cty.CtyCod = Gbl.Hierarchy.Ins.CtyCod;
|
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 *****/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
if (Gbl.Hierarchy.Cty.CtyCod > 0)
|
2020-01-07 22:07:06 +01:00
|
|
|
|
if (!Cty_GetDataOfCountryByCod (&Gbl.Hierarchy.Cty)) // Country not found
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Hie_ResetHierarchy ();
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
/***** Set current hierarchy level and code
|
|
|
|
|
depending on course code, degree code, etc. *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Hierarchy.Crs.CrsCod > 0) // Course selected
|
2019-04-03 20:57:04 +02:00
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Gbl.Hierarchy.Level = HieLvl_CRS;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Crs.CrsCod;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
}
|
|
|
|
|
else if (Gbl.Hierarchy.Deg.DegCod > 0) // Degree selected
|
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Gbl.Hierarchy.Level = HieLvl_DEG;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Deg.DegCod;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
}
|
2021-03-07 21:21:04 +01:00
|
|
|
|
else if (Gbl.Hierarchy.Ctr.CtrCod > 0) // Center selected
|
2019-04-03 20:57:04 +02:00
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Gbl.Hierarchy.Level = HieLvl_CTR;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Ctr.CtrCod;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
}
|
|
|
|
|
else if (Gbl.Hierarchy.Ins.InsCod > 0) // Institution selected
|
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Gbl.Hierarchy.Level = HieLvl_INS;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Ins.InsCod;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
}
|
|
|
|
|
else if (Gbl.Hierarchy.Cty.CtyCod > 0) // Country selected
|
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Gbl.Hierarchy.Level = HieLvl_CTY;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Cty.CtyCod;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Gbl.Hierarchy.Level = HieLvl_SYS;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Cod = -1L;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
}
|
2019-04-01 23:15:17 +02:00
|
|
|
|
|
2016-12-10 22:21:04 +01:00
|
|
|
|
/***** Initialize paths *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
if (Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
|
2016-12-10 22:21:04 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Paths of course directories *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (Gbl.Crs.PathPriv,sizeof (Gbl.Crs.PathPriv),"%s/%ld",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Cfg_PATH_CRS_PRIVATE,Gbl.Hierarchy.Crs.CrsCod);
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (Gbl.Crs.PathRelPubl,sizeof (Gbl.Crs.PathRelPubl),"%s/%ld",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Cfg_PATH_CRS_PUBLIC,Gbl.Hierarchy.Crs.CrsCod);
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (Gbl.Crs.PathURLPubl,sizeof (Gbl.Crs.PathURLPubl),"%s/%ld",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Cfg_URL_CRS_PUBLIC,Gbl.Hierarchy.Crs.CrsCod);
|
2016-12-10 22:21:04 +01:00
|
|
|
|
|
|
|
|
|
/***** If any of the course directories does not exist, create it *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (!Fil_CheckIfPathExists (Gbl.Crs.PathPriv))
|
|
|
|
|
Fil_CreateDirIfNotExists (Gbl.Crs.PathPriv);
|
|
|
|
|
if (!Fil_CheckIfPathExists (Gbl.Crs.PathRelPubl))
|
|
|
|
|
Fil_CreateDirIfNotExists (Gbl.Crs.PathRelPubl);
|
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)
|
|
|
|
|
{
|
|
|
|
|
/***** Country *****/
|
|
|
|
|
Gbl.Hierarchy.Cty.CtyCod = -1L;
|
|
|
|
|
|
|
|
|
|
/***** Institution *****/
|
|
|
|
|
Gbl.Hierarchy.Ins.InsCod = -1L;
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Center *****/
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Ctr.CtrCod = -1L;
|
|
|
|
|
Gbl.Hierarchy.Ctr.InsCod = -1L;
|
|
|
|
|
Gbl.Hierarchy.Ctr.PlcCod = -1L;
|
|
|
|
|
|
|
|
|
|
/***** Degree *****/
|
|
|
|
|
Gbl.Hierarchy.Deg.DegCod = -1L;
|
|
|
|
|
|
|
|
|
|
/***** Course *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Crs.CrsCod = -1L;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
|
|
|
|
|
/***** Hierarchy level and code *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Gbl.Hierarchy.Level = HieLvl_UNK;
|
2019-04-03 20:57:04 +02:00
|
|
|
|
Gbl.Hierarchy.Cod = -1L;
|
|
|
|
|
}
|
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;
|
2021-02-11 23:27:48 +01:00
|
|
|
|
struct Hie_Hierarchy Hie;
|
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]))
|
|
|
|
|
{
|
|
|
|
|
case HieLvl_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;
|
|
|
|
|
case HieLvl_INS: // Institution
|
2021-12-26 22:39:16 +01:00
|
|
|
|
if ((Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[1])) > 0)
|
2021-09-20 14:06:42 +02:00
|
|
|
|
{
|
|
|
|
|
/* Get data of institution */
|
2021-10-01 18:54:12 +02:00
|
|
|
|
Ins_GetDataOfInstitByCod (&Hie.Ins);
|
2021-09-20 14:06:42 +02:00
|
|
|
|
|
|
|
|
|
/* Write institution logo and name */
|
2021-12-26 22:39:16 +01:00
|
|
|
|
Ins_DrawInstitLogoAndNameWithLink (&Hie.Ins,ActSeeInsInf,"LT");
|
2021-09-20 14:06:42 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_CTR: // Center
|
2021-12-26 22:39:16 +01:00
|
|
|
|
if ((Hie.Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[1])) > 0)
|
2021-09-20 14:06:42 +02:00
|
|
|
|
{
|
|
|
|
|
/* Get data of center */
|
|
|
|
|
Ctr_GetDataOfCenterByCod (&Hie.Ctr);
|
|
|
|
|
|
|
|
|
|
/* Write center logo and name */
|
2021-12-26 22:39:16 +01:00
|
|
|
|
Ctr_DrawCenterLogoAndNameWithLink (&Hie.Ctr,ActSeeCtrInf,"LT");
|
2021-09-20 14:06:42 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_DEG: // Degree
|
2021-12-26 22:39:16 +01:00
|
|
|
|
if ((Hie.Deg.DegCod = Str_ConvertStrCodToLongCod (row[1])) > 0)
|
2021-09-20 14:06:42 +02:00
|
|
|
|
{
|
|
|
|
|
/* Get data of degree */
|
|
|
|
|
Deg_GetDataOfDegreeByCod (&Hie.Deg);
|
|
|
|
|
|
|
|
|
|
/* Write degree logo and name */
|
2021-12-26 22:39:16 +01:00
|
|
|
|
Deg_DrawDegreeLogoAndNameWithLink (&Hie.Deg,ActSeeDegInf,"LT");
|
2021-09-20 14:06:42 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default: // There are no administrators in other scopes
|
|
|
|
|
Err_WrongScopeExit ();
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Hie_PutParamOtherHieCod (&HieCod);
|
2021-11-10 10:53:08 +01:00
|
|
|
|
|
|
|
|
|
/* Selector */
|
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"name=\"Status\" class=\"INPUT_STATUS\"");
|
|
|
|
|
|
|
|
|
|
StatusUnsigned = (unsigned) Hie_GetStatusBitsFromStatusTxt (Hie_STATUS_PENDING);
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,true,false,
|
|
|
|
|
"%s",Txt[Hie_STATUS_PENDING]);
|
|
|
|
|
|
|
|
|
|
StatusUnsigned = (unsigned) Hie_GetStatusBitsFromStatusTxt (Hie_STATUS_ACTIVE);
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&StatusUnsigned,false,false,
|
|
|
|
|
"%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
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-11-10 10:53:08 +01:00
|
|
|
|
Hie_Status_t Hie_GetParamStatus (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)
|
|
|
|
|
Par_GetParToUnsignedLong ("Status",
|
|
|
|
|
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 ****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Hie_PutParamOtherHieCod (void *HieCod)
|
|
|
|
|
{
|
|
|
|
|
if (HieCod)
|
|
|
|
|
Par_PutHiddenParamLong (NULL,"OthHieCod",*((long *) HieCod));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***** Get parameter with code of other institution/center/degree/course *****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
long Hie_GetAndCheckParamOtherHieCod (long MinCodAllowed)
|
|
|
|
|
{
|
|
|
|
|
long HieCod;
|
|
|
|
|
|
|
|
|
|
/***** Get and check parameter with code *****/
|
|
|
|
|
if ((HieCod = Par_GetParToLong ("OthHieCod")) < MinCodAllowed)
|
|
|
|
|
Err_WrongHierarchyExit ();
|
|
|
|
|
|
|
|
|
|
return HieCod;
|
2021-09-10 10:19:46 +02:00
|
|
|
|
}
|
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];
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
Hie_WriteHeadHierarchy ();
|
|
|
|
|
Hie_GetAndShowHierarchyWithInss ();
|
|
|
|
|
Hie_GetAndShowHierarchyWithCtrs ();
|
|
|
|
|
Hie_GetAndShowHierarchyWithDegs ();
|
|
|
|
|
Hie_GetAndShowHierarchyWithCrss ();
|
|
|
|
|
for (Role = Rol_TCH;
|
|
|
|
|
Role >= Rol_STD;
|
|
|
|
|
Role--)
|
|
|
|
|
Hie_GetAndShowHierarchyWithUsrs (Role);
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
HTM_TH_Empty (1);
|
|
|
|
|
|
|
|
|
|
HTM_TH_Begin (HTM_HEAD_RIGHT);
|
|
|
|
|
Ico_PutIcon ("globe-americas.svg",Ico_BLACK,
|
|
|
|
|
Txt_Countries,"ICOx16");
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (Txt_Countries);
|
|
|
|
|
HTM_TH_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TH_Begin (HTM_HEAD_RIGHT);
|
|
|
|
|
Ico_PutIcon ("university.svg",Ico_BLACK,
|
|
|
|
|
Txt_Institutions,"ICOx16");
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (Txt_Institutions);
|
|
|
|
|
HTM_TH_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TH_Begin (HTM_HEAD_RIGHT);
|
|
|
|
|
Ico_PutIcon ("building.svg",Ico_BLACK,
|
|
|
|
|
Txt_Centers,"ICOx16");
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (Txt_Centers);
|
|
|
|
|
HTM_TH_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TH_Begin (HTM_HEAD_RIGHT);
|
|
|
|
|
Ico_PutIcon ("graduation-cap.svg",Ico_BLACK,
|
|
|
|
|
Txt_Degrees,"ICOx16");
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (Txt_Degrees);
|
|
|
|
|
HTM_TH_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TH_Begin (HTM_HEAD_RIGHT);
|
|
|
|
|
Ico_PutIcon ("chalkboard-teacher.svg",Ico_BLACK,
|
|
|
|
|
Txt_Courses,"ICOx16");
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (Txt_Courses);
|
|
|
|
|
HTM_TH_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****** Get and show number of elements in hierarchy with institutions *******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_GetAndShowHierarchyWithInss (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_With_;
|
|
|
|
|
extern const char *Txt_institutions;
|
|
|
|
|
unsigned NumCtysWithInss = 1;
|
|
|
|
|
|
|
|
|
|
/***** Get number of elements with institutions *****/
|
|
|
|
|
switch (Gbl.Scope.Current)
|
|
|
|
|
{
|
|
|
|
|
case HieLvl_SYS:
|
|
|
|
|
NumCtysWithInss = Cty_GetCachedNumCtysWithInss ();
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_CTY:
|
|
|
|
|
case HieLvl_INS:
|
|
|
|
|
case HieLvl_CTR:
|
|
|
|
|
case HieLvl_DEG:
|
|
|
|
|
case HieLvl_CRS:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Err_WrongScopeExit ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Write number of elements with institutions *****/
|
|
|
|
|
Hie_ShowHierarchyRow (Txt_With_,Txt_institutions,
|
2022-03-25 19:18:01 +01:00
|
|
|
|
"DAT",
|
2022-01-02 23:44:27 +01:00
|
|
|
|
(int) NumCtysWithInss,
|
|
|
|
|
-1, // < 0 ==> do not show number
|
|
|
|
|
-1, // < 0 ==> do not show number
|
|
|
|
|
-1, // < 0 ==> do not show number
|
|
|
|
|
-1); // < 0 ==> do not show number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******** Get and show number of elements in hierarchy with centers **********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_GetAndShowHierarchyWithCtrs (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_With_;
|
|
|
|
|
extern const char *Txt_centers;
|
|
|
|
|
unsigned NumCtysWithCtrs = 1;
|
|
|
|
|
unsigned NumInssWithCtrs = 1;
|
|
|
|
|
|
|
|
|
|
/***** Get number of elements with centers *****/
|
|
|
|
|
switch (Gbl.Scope.Current)
|
|
|
|
|
{
|
|
|
|
|
case HieLvl_SYS:
|
|
|
|
|
NumCtysWithCtrs = Cty_GetCachedNumCtysWithCtrs ();
|
|
|
|
|
/* falls through */
|
|
|
|
|
/* no break */
|
|
|
|
|
case HieLvl_CTY:
|
|
|
|
|
NumInssWithCtrs = Ins_GetCachedNumInssWithCtrs ();
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_INS:
|
|
|
|
|
case HieLvl_CTR:
|
|
|
|
|
case HieLvl_DEG:
|
|
|
|
|
case HieLvl_CRS:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Err_WrongScopeExit ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Write number of elements with centers *****/
|
|
|
|
|
Hie_ShowHierarchyRow (Txt_With_,Txt_centers,
|
2022-03-25 19:18:01 +01:00
|
|
|
|
"DAT",
|
2022-01-02 23:44:27 +01:00
|
|
|
|
(int) NumCtysWithCtrs,
|
|
|
|
|
(int) NumInssWithCtrs,
|
|
|
|
|
-1, // < 0 ==> do not show number
|
|
|
|
|
-1, // < 0 ==> do not show number
|
|
|
|
|
-1); // < 0 ==> do not show number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******** Get and show number of elements in hierarchy with degrees **********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_GetAndShowHierarchyWithDegs (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_With_;
|
|
|
|
|
extern const char *Txt_degrees;
|
|
|
|
|
unsigned NumCtysWithDegs = 1;
|
|
|
|
|
unsigned NumInssWithDegs = 1;
|
|
|
|
|
unsigned NumCtrsWithDegs = 1;
|
|
|
|
|
|
|
|
|
|
/***** Get number of elements with degrees *****/
|
|
|
|
|
switch (Gbl.Scope.Current)
|
|
|
|
|
{
|
|
|
|
|
case HieLvl_SYS:
|
|
|
|
|
NumCtysWithDegs = Cty_GetCachedNumCtysWithDegs ();
|
|
|
|
|
/* falls through */
|
|
|
|
|
/* no break */
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_CTY:
|
|
|
|
|
NumInssWithDegs = Ins_GetCachedNumInssWithDegs ();
|
|
|
|
|
/* falls through */
|
|
|
|
|
/* no break */
|
|
|
|
|
case HieLvl_INS:
|
|
|
|
|
NumCtrsWithDegs = Ctr_GetCachedNumCtrsWithDegs ();
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_CTR:
|
|
|
|
|
case HieLvl_DEG:
|
|
|
|
|
case HieLvl_CRS:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Err_WrongScopeExit ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Write number of elements with degrees *****/
|
|
|
|
|
Hie_ShowHierarchyRow (Txt_With_,Txt_degrees,
|
2022-03-25 19:18:01 +01:00
|
|
|
|
"DAT",
|
2022-01-02 23:44:27 +01:00
|
|
|
|
(int) NumCtysWithDegs,
|
|
|
|
|
(int) NumInssWithDegs,
|
|
|
|
|
(int) NumCtrsWithDegs,
|
|
|
|
|
-1, // < 0 ==> do not show number
|
|
|
|
|
-1); // < 0 ==> do not show number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******** Get and show number of elements in hierarchy with courses **********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_GetAndShowHierarchyWithCrss (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_With_;
|
|
|
|
|
extern const char *Txt_courses;
|
|
|
|
|
unsigned NumCtysWithCrss = 1;
|
|
|
|
|
unsigned NumInssWithCrss = 1;
|
|
|
|
|
unsigned NumCtrsWithCrss = 1;
|
|
|
|
|
unsigned NumDegsWithCrss = 1;
|
|
|
|
|
|
|
|
|
|
/***** Get number of elements with courses *****/
|
|
|
|
|
switch (Gbl.Scope.Current)
|
|
|
|
|
{
|
|
|
|
|
case HieLvl_SYS:
|
|
|
|
|
NumCtysWithCrss = Cty_GetCachedNumCtysWithCrss ();
|
|
|
|
|
/* falls through */
|
|
|
|
|
/* no break */
|
|
|
|
|
case HieLvl_CTY:
|
|
|
|
|
NumInssWithCrss = Ins_GetCachedNumInssWithCrss ();
|
|
|
|
|
/* falls through */
|
|
|
|
|
/* no break */
|
|
|
|
|
case HieLvl_INS:
|
|
|
|
|
NumCtrsWithCrss = Ctr_GetCachedNumCtrsWithCrss ();
|
|
|
|
|
/* falls through */
|
|
|
|
|
/* no break */
|
|
|
|
|
case HieLvl_CTR:
|
|
|
|
|
NumDegsWithCrss = Deg_GetCachedNumDegsWithCrss ();
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_DEG:
|
|
|
|
|
case HieLvl_CRS:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Err_WrongScopeExit ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Write number of elements with courses *****/
|
|
|
|
|
Hie_ShowHierarchyRow (Txt_With_,Txt_courses,
|
2022-03-25 19:18:01 +01:00
|
|
|
|
"DAT",
|
2022-01-02 23:44:27 +01:00
|
|
|
|
(int) NumCtysWithCrss,
|
|
|
|
|
(int) NumInssWithCrss,
|
|
|
|
|
(int) NumCtrsWithCrss,
|
|
|
|
|
(int) NumDegsWithCrss,
|
|
|
|
|
-1); // < 0 ==> do not show number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** 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];
|
|
|
|
|
unsigned NumCtysWithUsrs;
|
|
|
|
|
unsigned NumInssWithUsrs;
|
|
|
|
|
unsigned NumCtrsWithUsrs;
|
|
|
|
|
unsigned NumDegsWithUsrs;
|
|
|
|
|
unsigned NumCrssWithUsrs;
|
|
|
|
|
|
|
|
|
|
/***** Get number of elements with students *****/
|
|
|
|
|
NumCtysWithUsrs = Cty_GetCachedNumCtysWithUsrs (Role);
|
|
|
|
|
NumInssWithUsrs = Ins_GetCachedNumInssWithUsrs (Role);
|
|
|
|
|
NumCtrsWithUsrs = Ctr_GetCachedNumCtrsWithUsrs (Role);
|
|
|
|
|
NumDegsWithUsrs = Deg_GetCachedNumDegsWithUsrs (Role);
|
|
|
|
|
NumCrssWithUsrs = Crs_GetCachedNumCrssWithUsrs (Role);
|
|
|
|
|
|
|
|
|
|
/***** Write number of elements with students *****/
|
|
|
|
|
Hie_ShowHierarchyRow (Txt_With_,Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN],
|
2022-03-25 19:18:01 +01:00
|
|
|
|
"DAT",
|
2022-01-02 23:44:27 +01:00
|
|
|
|
(int) NumCtysWithUsrs,
|
|
|
|
|
(int) NumInssWithUsrs,
|
|
|
|
|
(int) NumCtrsWithUsrs,
|
|
|
|
|
(int) NumDegsWithUsrs,
|
|
|
|
|
(int) NumCrssWithUsrs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************ Get and show total number of elements in hierarchy *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_GetAndShowHierarchyTotal (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Total;
|
|
|
|
|
unsigned NumCtysTotal = 1;
|
|
|
|
|
unsigned NumInssTotal = 1;
|
|
|
|
|
unsigned NumCtrsTotal = 1;
|
|
|
|
|
unsigned NumDegsTotal = 1;
|
|
|
|
|
unsigned NumCrssTotal = 1;
|
|
|
|
|
|
|
|
|
|
/***** Get total number of elements *****/
|
|
|
|
|
switch (Gbl.Scope.Current)
|
|
|
|
|
{
|
|
|
|
|
case HieLvl_SYS:
|
|
|
|
|
NumCtysTotal = Cty_GetCachedNumCtysInSys ();
|
|
|
|
|
NumInssTotal = Ins_GetCachedNumInssInSys ();
|
|
|
|
|
NumCtrsTotal = Ctr_GetCachedNumCtrsInSys ();
|
|
|
|
|
NumDegsTotal = Deg_GetCachedNumDegsInSys ();
|
|
|
|
|
NumCrssTotal = Crs_GetCachedNumCrssInSys ();
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_CTY:
|
|
|
|
|
NumInssTotal = Ins_GetCachedNumInssInCty (Gbl.Hierarchy.Cty.CtyCod);
|
|
|
|
|
NumCtrsTotal = Ctr_GetCachedNumCtrsInCty (Gbl.Hierarchy.Cty.CtyCod);
|
|
|
|
|
NumDegsTotal = Deg_GetCachedNumDegsInCty (Gbl.Hierarchy.Cty.CtyCod);
|
|
|
|
|
NumCrssTotal = Crs_GetCachedNumCrssInCty (Gbl.Hierarchy.Cty.CtyCod);
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_INS:
|
|
|
|
|
NumCtrsTotal = Ctr_GetCachedNumCtrsInIns (Gbl.Hierarchy.Ins.InsCod);
|
|
|
|
|
NumDegsTotal = Deg_GetCachedNumDegsInIns (Gbl.Hierarchy.Ins.InsCod);
|
|
|
|
|
NumCrssTotal = Crs_GetCachedNumCrssInIns (Gbl.Hierarchy.Ins.InsCod);
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_CTR:
|
|
|
|
|
NumDegsTotal = Deg_GetCachedNumDegsInCtr (Gbl.Hierarchy.Ctr.CtrCod);
|
|
|
|
|
NumCrssTotal = Crs_GetCachedNumCrssInCtr (Gbl.Hierarchy.Ctr.CtrCod);
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_DEG:
|
|
|
|
|
NumCrssTotal = Crs_GetCachedNumCrssInDeg (Gbl.Hierarchy.Deg.DegCod);
|
|
|
|
|
break;
|
|
|
|
|
case HieLvl_CRS:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Err_WrongScopeExit ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Write total number of elements *****/
|
2022-03-25 19:18:01 +01:00
|
|
|
|
Hie_ShowHierarchyRow ("",Txt_Total,
|
|
|
|
|
"LINE_TOP DAT_STRONG",
|
2022-01-02 23:44:27 +01:00
|
|
|
|
(int) NumCtysTotal,
|
|
|
|
|
(int) NumInssTotal,
|
|
|
|
|
(int) NumCtrsTotal,
|
|
|
|
|
(int) NumDegsTotal,
|
|
|
|
|
(int) NumCrssTotal);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Show row with number of elements in hierarchy ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Hie_ShowHierarchyRow (const char *Text1,const char *Text2,
|
|
|
|
|
const char *ClassTxt,
|
|
|
|
|
int NumCtys, // < 0 ==> do not show number
|
|
|
|
|
int NumInss, // < 0 ==> do not show number
|
|
|
|
|
int NumCtrs, // < 0 ==> do not show number
|
|
|
|
|
int NumDegs, // < 0 ==> do not show number
|
|
|
|
|
int NumCrss) // < 0 ==> do not show number
|
|
|
|
|
{
|
|
|
|
|
/***** 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 *****/
|
|
|
|
|
Hie_ShowHierarchyCell (ClassTxt,NumCtys);
|
|
|
|
|
Hie_ShowHierarchyCell (ClassTxt,NumInss);
|
|
|
|
|
Hie_ShowHierarchyCell (ClassTxt,NumCtrs);
|
|
|
|
|
Hie_ShowHierarchyCell (ClassTxt,NumDegs);
|
|
|
|
|
Hie_ShowHierarchyCell (ClassTxt,NumCrss);
|
|
|
|
|
|
|
|
|
|
/***** 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 ();
|
|
|
|
|
}
|