mirror of https://github.com/acanas/swad-core.git
Version 21.81.2: Jan 02, 2022 Functions moved from swad_figure to other modules.
This commit is contained in:
parent
84f367b274
commit
e88fbae138
|
@ -2320,8 +2320,23 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************** Listing of users *********************************/
|
/************************** Listing of users *********************************/
|
||||||
.USR_LIST_NUM {color:#A0A0A0; font-size:15pt; font-weight:bold;}
|
.USR_LIST_NUM {color:#a0a0a0; font-size:15pt; font-weight:bold;}
|
||||||
.USR_LIST_NUM_N {color:#202020; font-size:15pt; font-weight:bold;}
|
.USR_LIST_NUM_WHITE {color:#a0a0a0; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_GREY {color:#a0a0a0; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_PURPLE {color:#a0a0a0; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_BLUE {color:#a0a0a0; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_YELLOW {color:#a0a0a0; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_PINK {color:#a0a0a0; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_DARK {color:#808080; font-size:15pt; font-weight:bold;}
|
||||||
|
|
||||||
|
.USR_LIST_NUM_N {color:#202020; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_N_WHITE {color:#202020; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_N_GREY {color:#202020; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_N_PURPLE {color:#202020; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_N_BLUE {color:#202020; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_N_YELLOW {color:#202020; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_N_PINK {color:#202020; font-size:15pt; font-weight:bold;}
|
||||||
|
.USR_LIST_NUM_N_DARK {color:#e0e0e0; font-size:15pt; font-weight:bold;}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
.TITLE_WHITE {color:#505050; font-size:18pt;}
|
.TITLE_WHITE {color:#505050; font-size:18pt;}
|
||||||
|
@ -2364,7 +2379,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
|
||||||
.FORM_IN_BLUE {color:#4d88a1; font-size:13pt;}
|
.FORM_IN_BLUE {color:#4d88a1; font-size:13pt;}
|
||||||
.FORM_IN_YELLOW {color:#7c4d2a; font-size:13pt;}
|
.FORM_IN_YELLOW {color:#7c4d2a; font-size:13pt;}
|
||||||
.FORM_IN_PINK {color:#4d88a1; font-size:13pt;}
|
.FORM_IN_PINK {color:#4d88a1; font-size:13pt;}
|
||||||
.FORM_IN_DARK {color:#a6c4d0; font-size:13pt;}
|
.FORM_IN_DARK {color:#afc4cc; font-size:13pt;}
|
||||||
|
|
||||||
/* Outside white box */
|
/* Outside white box */
|
||||||
.FORM_OUT_WHITE {color:#4d88a1; font-size:13pt;}
|
.FORM_OUT_WHITE {color:#4d88a1; font-size:13pt;}
|
||||||
|
@ -2551,6 +2566,43 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
|
||||||
.DAT_LIGHT_PINK {color:#a0a0a0; font-size:13pt;}
|
.DAT_LIGHT_PINK {color:#a0a0a0; font-size:13pt;}
|
||||||
.DAT_LIGHT_DARK {color:#909090; font-size:13pt;}
|
.DAT_LIGHT_DARK {color:#909090; font-size:13pt;}
|
||||||
|
|
||||||
|
.DAT_SMALL {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt;}
|
||||||
|
.DAT_SMALL_WHITE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt;}
|
||||||
|
.DAT_SMALL_GREY {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt;}
|
||||||
|
.DAT_SMALL_PURPLE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt;}
|
||||||
|
.DAT_SMALL_BLUE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt;}
|
||||||
|
.DAT_SMALL_YELLOW {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt;}
|
||||||
|
.DAT_SMALL_PINK {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt;}
|
||||||
|
.DAT_SMALL_DARK {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#d0d0d0; font-size:12pt;}
|
||||||
|
|
||||||
|
.DAT_SMALL_N {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt;}
|
||||||
|
.DAT_SMALL_N_WHITE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt;}
|
||||||
|
.DAT_SMALL_N_GREY {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt;}
|
||||||
|
.DAT_SMALL_N_PURPLE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt;}
|
||||||
|
.DAT_SMALL_N_BLUE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt;}
|
||||||
|
.DAT_SMALL_N_YELLOW {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt;}
|
||||||
|
.DAT_SMALL_N_PINK {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt;}
|
||||||
|
.DAT_SMALL_N_DARK {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:white; font-size:12pt;}
|
||||||
|
|
||||||
|
.DAT_SMALL_NOBR {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_WHITE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_GREY {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_PURPLE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_BLUE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_YELLOW {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_PINK {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_DARK {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#d0d0d0; font-size:12pt; white-space:nowrap;}
|
||||||
|
|
||||||
|
.DAT_SMALL_NOBR_N {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_N_WHITE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_N_GREY {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_N_PURPLE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_N_BLUE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_N_YELLOW {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_N_PINK {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt; white-space:nowrap;}
|
||||||
|
.DAT_SMALL_NOBR_N_DARK {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:white; font-size:12pt; white-space:nowrap;}
|
||||||
|
|
||||||
.DAT_GREEN {color:#246600; font-size:13pt;}
|
.DAT_GREEN {color:#246600; font-size:13pt;}
|
||||||
.DAT_RED {color:#660000; font-size:13pt;}
|
.DAT_RED {color:#660000; font-size:13pt;}
|
||||||
|
|
||||||
|
@ -2579,11 +2631,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
|
||||||
border-width:1px;
|
border-width:1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.DAT_SMALL {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt;}
|
|
||||||
.DAT_SMALL_LIGHT {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#A0A0A0; font-size:12pt;}
|
.DAT_SMALL_LIGHT {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#A0A0A0; font-size:12pt;}
|
||||||
.DAT_SMALL_NOBR {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#404040; font-size:12pt; white-space:nowrap;}
|
|
||||||
.DAT_SMALL_N {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt;}
|
|
||||||
.DAT_SMALL_NOBR_N {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt; white-space:nowrap;}
|
|
||||||
|
|
||||||
.DAT_SMALL_GREY {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#707070; font-size:12pt;}
|
.DAT_SMALL_GREY {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#707070; font-size:12pt;}
|
||||||
.DAT_SMALL_RED {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#660000; font-size:12pt;}
|
.DAT_SMALL_RED {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#660000; font-size:12pt;}
|
||||||
|
@ -2749,7 +2797,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
|
||||||
.TIT_TBL_BLUE {color:#4d88a1;}
|
.TIT_TBL_BLUE {color:#4d88a1;}
|
||||||
.TIT_TBL_YELLOW {color:#4d88a1;}
|
.TIT_TBL_YELLOW {color:#4d88a1;}
|
||||||
.TIT_TBL_PINK {color:#4d88a1;}
|
.TIT_TBL_PINK {color:#4d88a1;}
|
||||||
.TIT_TBL_DARK {color:#8cbcce;}
|
.TIT_TBL_DARK {color:#afc4cc;}
|
||||||
|
|
||||||
.GRP_TITLE {color:#4d88a1; font-size:15pt; font-weight:bold;}
|
.GRP_TITLE {color:#4d88a1; font-size:15pt; font-weight:bold;}
|
||||||
|
|
||||||
|
|
|
@ -602,10 +602,11 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 21.81.1 (2022-01-02)"
|
#define Log_PLATFORM_VERSION "SWAD 21.81.2 (2022-01-02)"
|
||||||
#define CSS_FILE "swad21.81.css"
|
#define CSS_FILE "swad21.81.css"
|
||||||
#define JS_FILE "swad21.78.2.js"
|
#define JS_FILE "swad21.78.2.js"
|
||||||
/*
|
/*
|
||||||
|
Version 21.81.2: Jan 02, 2022 Functions moved from swad_figure to other modules. (322523 lines)
|
||||||
Version 21.81.1: Jan 02, 2022 Fixed bug in projects. (322460 lines)
|
Version 21.81.1: Jan 02, 2022 Fixed bug in projects. (322460 lines)
|
||||||
Version 21.81: Jan 02, 2022 Code refactoring on table heads. (322457 lines)
|
Version 21.81: Jan 02, 2022 Code refactoring on table heads. (322457 lines)
|
||||||
Version 21.80: Jan 01, 2022 Working on design of dark theme. (322456 lines)
|
Version 21.80: Jan 01, 2022 Working on design of dark theme. (322456 lines)
|
||||||
|
|
961
swad_figure.c
961
swad_figure.c
|
@ -112,41 +112,8 @@ static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType);
|
||||||
static void Fig_PutHiddenParamFigureType (Fig_FigureType_t FigureType);
|
static void Fig_PutHiddenParamFigureType (Fig_FigureType_t FigureType);
|
||||||
static void Fig_PutHiddenParamScopeFig (HieLvl_Level_t ScopeFig);
|
static void Fig_PutHiddenParamScopeFig (HieLvl_Level_t ScopeFig);
|
||||||
|
|
||||||
static void Hie_GetAndShowHierarchyStats (void);
|
|
||||||
static void Fig_WriteHeadHierarchy (void);
|
|
||||||
static void Fig_GetAndShowHierarchyWithInss (void);
|
|
||||||
static void Fig_GetAndShowHierarchyWithCtrs (void);
|
|
||||||
static void Fig_GetAndShowHierarchyWithDegs (void);
|
|
||||||
static void Fig_GetAndShowHierarchyWithCrss (void);
|
|
||||||
static void Fig_GetAndShowHierarchyWithUsrs (Rol_Role_t Role);
|
|
||||||
static void Fig_GetAndShowHierarchyTotal (void);
|
|
||||||
static void Fig_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 Fig_ShowHierarchyCell (const char *ClassTxt,int Num);
|
|
||||||
|
|
||||||
static void Ins_GetAndShowInstitutionsStats (void);
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumCtrs (void);
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumDegs (void);
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumCrss (void);
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumUsrsInCrss (void);
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem (void);
|
|
||||||
static void Fig_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
|
|
||||||
const char *TxtFigure);
|
|
||||||
static unsigned Fig_GetInsAndStat (struct Ins_Instit *Ins,MYSQL_RES *mysql_res);
|
|
||||||
|
|
||||||
static void DegTyp_GetAndShowDegreeTypesStats (void);
|
static void DegTyp_GetAndShowDegreeTypesStats (void);
|
||||||
|
|
||||||
static void Usr_GetAndShowUsersStats (void);
|
|
||||||
static void Fig_GetAndShowNumUsrsInCrss (Rol_Role_t Role);
|
|
||||||
static void Fig_GetAndShowNumUsrsNotBelongingToAnyCrs (void);
|
|
||||||
|
|
||||||
static void Usr_GetAndShowUsersRanking (void);
|
|
||||||
|
|
||||||
static void Brw_GetAndShowFileBrowsersStats (void);
|
static void Brw_GetAndShowFileBrowsersStats (void);
|
||||||
static void Fig_GetSizeOfFileZone (Brw_FileBrowser_t FileBrowser,
|
static void Fig_GetSizeOfFileZone (Brw_FileBrowser_t FileBrowser,
|
||||||
struct Fig_SizeOfFileZones *SizeOfFileZones);
|
struct Fig_SizeOfFileZones *SizeOfFileZones);
|
||||||
|
@ -389,934 +356,6 @@ void Fig_ShowFigures (void)
|
||||||
Fig_Function[SelectedFigureType] ();
|
Fig_Function[SelectedFigureType] ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********************** Show stats about number of users *********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Usr_GetAndShowUsersStats (void)
|
|
||||||
{
|
|
||||||
extern const char *Hlp_ANALYTICS_Figures_users;
|
|
||||||
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
|
|
||||||
extern const char *Txt_Users;
|
|
||||||
extern const char *Txt_Number_of_users;
|
|
||||||
extern const char *Txt_Average_number_of_courses_to_which_a_user_belongs;
|
|
||||||
extern const char *Txt_Average_number_of_users_belonging_to_a_course;
|
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
|
||||||
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_USERS],
|
|
||||||
NULL,NULL,
|
|
||||||
Hlp_ANALYTICS_Figures_users,Box_NOT_CLOSABLE,2);
|
|
||||||
|
|
||||||
/***** Write heading *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
HTM_TH (Txt_Users ,HTM_HEAD_RIGHT);
|
|
||||||
HTM_TH (Txt_Number_of_users ,HTM_HEAD_RIGHT);
|
|
||||||
HTM_TH (Txt_Average_number_of_courses_to_which_a_user_belongs,HTM_HEAD_RIGHT);
|
|
||||||
HTM_TH (Txt_Average_number_of_users_belonging_to_a_course ,HTM_HEAD_RIGHT);
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** Figures *****/
|
|
||||||
Fig_GetAndShowNumUsrsInCrss (Rol_STD); // Students
|
|
||||||
Fig_GetAndShowNumUsrsInCrss (Rol_NET); // Non-editing teachers
|
|
||||||
Fig_GetAndShowNumUsrsInCrss (Rol_TCH); // Teachers
|
|
||||||
Fig_GetAndShowNumUsrsInCrss (Rol_UNK); // Any user in courses
|
|
||||||
|
|
||||||
/***** Separator *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
HTM_TH_Span (NULL,HTM_HEAD_CENTER,1,4,"SEPAR_ROW");
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
Fig_GetAndShowNumUsrsNotBelongingToAnyCrs (); // Users not beloging to any course
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_BoxTableEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**************** Get and show number of users in courses ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
// Rol_UNK means any role in courses
|
|
||||||
|
|
||||||
static void Fig_GetAndShowNumUsrsInCrss (Rol_Role_t Role)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassDat[The_NUM_THEMES];
|
|
||||||
extern const char *The_ClassDatStrong[The_NUM_THEMES];
|
|
||||||
extern const char *Txt_Total;
|
|
||||||
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
|
||||||
long Cod = Sco_GetCurrentCod ();
|
|
||||||
char *Class;
|
|
||||||
unsigned Roles;
|
|
||||||
|
|
||||||
/***** Initializations depending on role *****/
|
|
||||||
if (Role == Rol_UNK)
|
|
||||||
{
|
|
||||||
if (asprintf (&Class,"RB %s LINE_TOP",The_ClassDatStrong[Gbl.Prefs.Theme]) < 0)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
Roles = (1 << Rol_STD) |
|
|
||||||
(1 << Rol_NET) |
|
|
||||||
(1 << Rol_TCH);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (asprintf (&Class,"RB %s",The_ClassDat[Gbl.Prefs.Theme]) < 0)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
Roles = (1 << Role);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Write the total number of users *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s\"",Class);
|
|
||||||
HTM_Txt ((Role == Rol_UNK) ? Txt_Total :
|
|
||||||
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Number of users in courses */
|
|
||||||
HTM_TD_Begin ("class=\"%s\"",Class);
|
|
||||||
HTM_Unsigned (Enr_GetCachedNumUsrsInCrss (Gbl.Scope.Current,Cod,Roles));
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s\"",Class);
|
|
||||||
HTM_Double2Decimals (Enr_GetCachedAverageNumCrssPerUsr (Gbl.Scope.Current,Cod,Role));
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s\"",Class);
|
|
||||||
HTM_Double2Decimals (Enr_GetCachedAverageNumUsrsPerCrs (Gbl.Scope.Current,Cod,Role));
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
free (Class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**************** Get and show number of users in courses ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_GetAndShowNumUsrsNotBelongingToAnyCrs (void)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassDat[The_NUM_THEMES];
|
|
||||||
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
|
||||||
char *Class;
|
|
||||||
|
|
||||||
if (asprintf (&Class,"%s RB",The_ClassDat[Gbl.Prefs.Theme]) < 0)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
|
|
||||||
/***** Write the total number of users not belonging to any course *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s\"",Class);
|
|
||||||
HTM_Txt (Txt_ROLES_PLURAL_Abc[Rol_GST][Usr_SEX_UNKNOWN]);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s\"",Class);
|
|
||||||
HTM_Unsigned (Enr_GetCachedNumUsrsNotBelongingToAnyCrs ());
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s\"",Class);
|
|
||||||
HTM_Double2Decimals (0.0);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s\"",Class);
|
|
||||||
HTM_Double2Decimals (0.0);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
free (Class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************************** Show users' ranking **************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Usr_GetAndShowUsersRanking (void)
|
|
||||||
{
|
|
||||||
extern const char *Hlp_ANALYTICS_Figures_ranking;
|
|
||||||
extern const char *The_ClassDat[The_NUM_THEMES];
|
|
||||||
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
|
|
||||||
extern const char *Txt_Clicks;
|
|
||||||
extern const char *Txt_Clicks_per_day;
|
|
||||||
extern const char *Txt_Timeline;
|
|
||||||
extern const char *Txt_Downloads;
|
|
||||||
extern const char *Txt_Forums;
|
|
||||||
extern const char *Txt_Messages;
|
|
||||||
extern const char *Txt_Followers;
|
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
|
||||||
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_USERS_RANKING],
|
|
||||||
NULL,NULL,
|
|
||||||
Hlp_ANALYTICS_Figures_ranking,Box_NOT_CLOSABLE,2);
|
|
||||||
|
|
||||||
/***** Write heading *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
HTM_TH (Txt_Clicks ,HTM_HEAD_CENTER);
|
|
||||||
HTM_TH (Txt_Clicks_per_day,HTM_HEAD_CENTER);
|
|
||||||
HTM_TH (Txt_Timeline ,HTM_HEAD_CENTER);
|
|
||||||
HTM_TH (Txt_Followers ,HTM_HEAD_CENTER);
|
|
||||||
HTM_TH (Txt_Downloads ,HTM_HEAD_CENTER);
|
|
||||||
HTM_TH (Txt_Forums ,HTM_HEAD_CENTER);
|
|
||||||
HTM_TH (Txt_Messages ,HTM_HEAD_CENTER);
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** Rankings *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
|
||||||
Prf_GetAndShowRankingClicks ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
|
||||||
Prf_GetAndShowRankingClicksPerDay ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
|
||||||
Prf_GetAndShowRankingTimelinePubs ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
|
||||||
Fol_GetAndShowRankingFollowers ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
|
||||||
Prf_GetAndShowRankingFileViews ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
|
||||||
Prf_GetAndShowRankingForPsts ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
|
||||||
Prf_GetAndShowRankingMsgsSnt ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_BoxTableEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********* Get and show stats about hierarchy ***********/
|
|
||||||
/********* (countries, institutions, centers, degrees and courses) ***********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static 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);
|
|
||||||
|
|
||||||
Fig_WriteHeadHierarchy ();
|
|
||||||
Fig_GetAndShowHierarchyWithInss ();
|
|
||||||
Fig_GetAndShowHierarchyWithCtrs ();
|
|
||||||
Fig_GetAndShowHierarchyWithDegs ();
|
|
||||||
Fig_GetAndShowHierarchyWithCrss ();
|
|
||||||
for (Role = Rol_TCH;
|
|
||||||
Role >= Rol_STD;
|
|
||||||
Role--)
|
|
||||||
Fig_GetAndShowHierarchyWithUsrs (Role);
|
|
||||||
Fig_GetAndShowHierarchyTotal ();
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_BoxTableEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************************ Write head of hierarchy table **********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_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 Fig_GetAndShowHierarchyWithInss (void)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassDat[The_NUM_THEMES];
|
|
||||||
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 *****/
|
|
||||||
Fig_ShowHierarchyRow (Txt_With_,Txt_institutions,
|
|
||||||
The_ClassDat[Gbl.Prefs.Theme],
|
|
||||||
(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 Fig_GetAndShowHierarchyWithCtrs (void)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassDat[The_NUM_THEMES];
|
|
||||||
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 *****/
|
|
||||||
Fig_ShowHierarchyRow (Txt_With_,Txt_centers,
|
|
||||||
The_ClassDat[Gbl.Prefs.Theme],
|
|
||||||
(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 Fig_GetAndShowHierarchyWithDegs (void)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassDat[The_NUM_THEMES];
|
|
||||||
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 *****/
|
|
||||||
Fig_ShowHierarchyRow (Txt_With_,Txt_degrees,
|
|
||||||
The_ClassDat[Gbl.Prefs.Theme],
|
|
||||||
(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 Fig_GetAndShowHierarchyWithCrss (void)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassDat[The_NUM_THEMES];
|
|
||||||
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 *****/
|
|
||||||
Fig_ShowHierarchyRow (Txt_With_,Txt_courses,
|
|
||||||
The_ClassDat[Gbl.Prefs.Theme],
|
|
||||||
(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 Fig_GetAndShowHierarchyWithUsrs (Rol_Role_t Role)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassDat[The_NUM_THEMES];
|
|
||||||
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 *****/
|
|
||||||
Fig_ShowHierarchyRow (Txt_With_,Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN],
|
|
||||||
The_ClassDat[Gbl.Prefs.Theme],
|
|
||||||
(int) NumCtysWithUsrs,
|
|
||||||
(int) NumInssWithUsrs,
|
|
||||||
(int) NumCtrsWithUsrs,
|
|
||||||
(int) NumDegsWithUsrs,
|
|
||||||
(int) NumCrssWithUsrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Get and show total number of elements in hierarchy *************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_GetAndShowHierarchyTotal (void)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassDatStrong[The_NUM_THEMES];
|
|
||||||
extern const char *Txt_Total;
|
|
||||||
char *ClassTxt;
|
|
||||||
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 *****/
|
|
||||||
if (asprintf (&ClassTxt,"%s LINE_TOP",The_ClassDatStrong[Gbl.Prefs.Theme]) < 0)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
Fig_ShowHierarchyRow ("",Txt_Total,ClassTxt,
|
|
||||||
(int) NumCtysTotal,
|
|
||||||
(int) NumInssTotal,
|
|
||||||
(int) NumCtrsTotal,
|
|
||||||
(int) NumDegsTotal,
|
|
||||||
(int) NumCrssTotal);
|
|
||||||
free (ClassTxt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************** Show row with number of elements in hierarchy ****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_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 *****/
|
|
||||||
HTM_TD_Begin ("class=\"%s RM\"",ClassTxt);
|
|
||||||
HTM_Txt (Text1);
|
|
||||||
HTM_Txt (Text2);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** Write number of countries *****/
|
|
||||||
Fig_ShowHierarchyCell (ClassTxt,NumCtys);
|
|
||||||
Fig_ShowHierarchyCell (ClassTxt,NumInss);
|
|
||||||
Fig_ShowHierarchyCell (ClassTxt,NumCtrs);
|
|
||||||
Fig_ShowHierarchyCell (ClassTxt,NumDegs);
|
|
||||||
Fig_ShowHierarchyCell (ClassTxt,NumCrss);
|
|
||||||
|
|
||||||
/***** End row *****/
|
|
||||||
HTM_TR_End ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Fig_ShowHierarchyCell (const char *ClassTxt,int Num)
|
|
||||||
{
|
|
||||||
/***** Write number *****/
|
|
||||||
HTM_TD_Begin ("class=\"%s RM\"",ClassTxt);
|
|
||||||
if (Num >= 0)
|
|
||||||
HTM_Unsigned ((unsigned) Num);
|
|
||||||
else // < 0 ==> do not show number
|
|
||||||
HTM_Hyphen ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************** Get and show stats about institutions ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Ins_GetAndShowInstitutionsStats (void)
|
|
||||||
{
|
|
||||||
extern const char *Hlp_ANALYTICS_Figures_institutions;
|
|
||||||
extern const char *Txt_Institutions;
|
|
||||||
struct Fig_Figures Figures;
|
|
||||||
|
|
||||||
/***** Begin box *****/
|
|
||||||
Box_BoxBegin (NULL,Txt_Institutions,
|
|
||||||
NULL,NULL,
|
|
||||||
Hlp_ANALYTICS_Figures_institutions,Box_NOT_CLOSABLE);
|
|
||||||
|
|
||||||
/***** Form to select type of list used to display degree photos *****/
|
|
||||||
Set_GetAndUpdatePrefsAboutUsrList ();
|
|
||||||
Figures.Scope = Gbl.Scope.Current;
|
|
||||||
Figures.FigureType = Fig_INSTITS;
|
|
||||||
Usr_ShowFormsToSelectUsrListType (Fig_PutHiddenParamFigures,&Figures);
|
|
||||||
|
|
||||||
/***** Institutions ordered by number of centers *****/
|
|
||||||
Fig_GetAndShowInssOrderedByNumCtrs ();
|
|
||||||
|
|
||||||
/***** Institutions ordered by number of degrees *****/
|
|
||||||
Fig_GetAndShowInssOrderedByNumDegs ();
|
|
||||||
|
|
||||||
/***** Institutions ordered by number of courses *****/
|
|
||||||
Fig_GetAndShowInssOrderedByNumCrss ();
|
|
||||||
|
|
||||||
/***** Institutions ordered by number of users in courses *****/
|
|
||||||
Fig_GetAndShowInssOrderedByNumUsrsInCrss ();
|
|
||||||
|
|
||||||
/***** Institutions ordered by number of users who claim to belong to them *****/
|
|
||||||
Fig_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem ();
|
|
||||||
|
|
||||||
/***** End box *****/
|
|
||||||
Box_BoxEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**** Get and show stats about institutions ordered by number of centers *****/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumCtrs (void)
|
|
||||||
{
|
|
||||||
extern const char *Txt_Institutions_by_number_of_centers;
|
|
||||||
extern const char *Txt_Centers;
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
unsigned NumInss;
|
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
|
||||||
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_centers,
|
|
||||||
NULL,NULL,
|
|
||||||
NULL,Box_NOT_CLOSABLE,2);
|
|
||||||
|
|
||||||
/***** Get institutions ordered by number of centers *****/
|
|
||||||
NumInss = Ins_DB_GetInssOrderedByNumCtrs (&mysql_res);
|
|
||||||
|
|
||||||
/***** Show institutions *****/
|
|
||||||
Fig_ShowInss (&mysql_res,NumInss,Txt_Centers);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_BoxTableEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**** Get and show stats about institutions ordered by number of degrees *****/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumDegs (void)
|
|
||||||
{
|
|
||||||
extern const char *Txt_Institutions_by_number_of_degrees;
|
|
||||||
extern const char *Txt_Degrees;
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
unsigned NumInss;
|
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
|
||||||
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_degrees,
|
|
||||||
NULL,NULL,
|
|
||||||
NULL,Box_NOT_CLOSABLE,2);
|
|
||||||
|
|
||||||
/***** Get institutions ordered by number of degrees *****/
|
|
||||||
NumInss = Ins_DB_GetInssOrderedByNumDegs (&mysql_res);
|
|
||||||
|
|
||||||
/***** Show institutions *****/
|
|
||||||
Fig_ShowInss (&mysql_res,NumInss,Txt_Degrees);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_BoxTableEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**** Get and show stats about institutions ordered by number of courses *****/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumCrss (void)
|
|
||||||
{
|
|
||||||
extern const char *Txt_Institutions_by_number_of_courses;
|
|
||||||
extern const char *Txt_Courses;
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
unsigned NumInss;
|
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
|
||||||
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_courses,
|
|
||||||
NULL,NULL,
|
|
||||||
NULL,Box_NOT_CLOSABLE,2);
|
|
||||||
|
|
||||||
/***** Get institutions ordered by number of courses *****/
|
|
||||||
NumInss = Ins_DB_GetInssOrderedByNumCrss (&mysql_res);
|
|
||||||
|
|
||||||
/***** Show institutions *****/
|
|
||||||
Fig_ShowInss (&mysql_res,NumInss,Txt_Courses);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_BoxTableEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/***** Get and show stats about institutions ordered by users in courses *****/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumUsrsInCrss (void)
|
|
||||||
{
|
|
||||||
extern const char *Txt_Institutions_by_number_of_users_in_courses;
|
|
||||||
extern const char *Txt_Users;
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
unsigned NumInss;
|
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
|
||||||
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_users_in_courses,
|
|
||||||
NULL,NULL,
|
|
||||||
NULL,Box_NOT_CLOSABLE,2);
|
|
||||||
|
|
||||||
/***** Get institutions ordered by number of users in courses *****/
|
|
||||||
NumInss = Ins_DB_GetInssOrderedByNumUsrsInCrss (&mysql_res);
|
|
||||||
|
|
||||||
/***** Show institutions *****/
|
|
||||||
Fig_ShowInss (&mysql_res,NumInss,Txt_Users);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_BoxTableEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************* Get and show stats about institutions ordered by **************/
|
|
||||||
/************* number of users who claim to belong to them **************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem (void)
|
|
||||||
{
|
|
||||||
extern const char *Txt_Institutions_by_number_of_users_who_claim_to_belong_to_them;
|
|
||||||
extern const char *Txt_Users;
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
unsigned NumInss;
|
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
|
||||||
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_users_who_claim_to_belong_to_them,
|
|
||||||
NULL,NULL,
|
|
||||||
NULL,Box_NOT_CLOSABLE,2);
|
|
||||||
|
|
||||||
/***** Get institutions ordered by number of users who claim to belong to them *****/
|
|
||||||
NumInss = Ins_DB_GetInssOrderedByNumUsrsWhoClaimToBelongToThem (&mysql_res);
|
|
||||||
|
|
||||||
/***** Show institutions *****/
|
|
||||||
Fig_ShowInss (&mysql_res,NumInss,Txt_Users);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_BoxTableEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************** Get and show stats about institutions ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Fig_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
|
|
||||||
const char *TxtFigure)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
|
||||||
extern const char *The_ClassDat[The_NUM_THEMES];
|
|
||||||
extern const char *Txt_Institution;
|
|
||||||
unsigned NumIns;
|
|
||||||
unsigned NumOrder;
|
|
||||||
unsigned NumberLastRow;
|
|
||||||
unsigned NumberThisRow;
|
|
||||||
struct Ins_Instit Ins;
|
|
||||||
bool TRIsOpen = false;
|
|
||||||
|
|
||||||
/***** Query database *****/
|
|
||||||
if (NumInss)
|
|
||||||
{
|
|
||||||
/* Draw the classphoto/list */
|
|
||||||
switch (Gbl.Usrs.Me.ListType)
|
|
||||||
{
|
|
||||||
case Set_USR_LIST_AS_CLASS_PHOTO:
|
|
||||||
/***** Draw institutions as a class photo *****/
|
|
||||||
for (NumIns = 0;
|
|
||||||
NumIns < NumInss;)
|
|
||||||
{
|
|
||||||
if ((NumIns % Gbl.Usrs.ClassPhoto.Cols) == 0)
|
|
||||||
{
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
TRIsOpen = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Get institution data and statistic *****/
|
|
||||||
NumberThisRow = Fig_GetInsAndStat (&Ins,*mysql_res);
|
|
||||||
|
|
||||||
/***** Write link to institution *****/
|
|
||||||
HTM_TD_Begin ("class=\"%s CM\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
|
||||||
Ins_DrawInstitutionLogoWithLink (&Ins,40);
|
|
||||||
HTM_BR ();
|
|
||||||
HTM_Unsigned (NumberThisRow);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
if ((++NumIns % Gbl.Usrs.ClassPhoto.Cols) == 0)
|
|
||||||
{
|
|
||||||
HTM_TR_End ();
|
|
||||||
TRIsOpen = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (TRIsOpen)
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
break;
|
|
||||||
case Set_USR_LIST_AS_LISTING:
|
|
||||||
/***** Draw institutions as a list *****/
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
HTM_TH_Empty (1);
|
|
||||||
HTM_TH (Txt_Institution,HTM_HEAD_LEFT);
|
|
||||||
HTM_TH (TxtFigure ,HTM_HEAD_RIGHT);
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
for (NumIns = 1, NumOrder = 1, NumberLastRow = 0;
|
|
||||||
NumIns <= NumInss;
|
|
||||||
NumIns++)
|
|
||||||
{
|
|
||||||
/***** Get institution data and statistic *****/
|
|
||||||
NumberThisRow = Fig_GetInsAndStat (&Ins,*mysql_res);
|
|
||||||
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
/***** Number of order *****/
|
|
||||||
if (NumberThisRow != NumberLastRow)
|
|
||||||
NumOrder = NumIns;
|
|
||||||
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
|
|
||||||
HTM_Unsigned (NumOrder);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** Write link to institution *****/
|
|
||||||
HTM_TD_Begin ("class=\"%s LM\"",
|
|
||||||
The_ClassFormInBox[Gbl.Prefs.Theme]);
|
|
||||||
/* Icon and name of this institution */
|
|
||||||
Frm_BeginForm (ActSeeInsInf);
|
|
||||||
Ins_PutParamInsCod (Ins.InsCod);
|
|
||||||
HTM_BUTTON_OnSubmit_Begin (Ins.ShrtName,"BT_LINK",NULL);
|
|
||||||
if (Gbl.Usrs.Listing.WithPhotos)
|
|
||||||
{
|
|
||||||
Lgo_DrawLogo (HieLvl_INS,Ins.InsCod,Ins.ShrtName,
|
|
||||||
40,NULL,true);
|
|
||||||
HTM_NBSP ();
|
|
||||||
}
|
|
||||||
HTM_Txt (Ins.FullName);
|
|
||||||
HTM_BUTTON_End ();
|
|
||||||
Frm_EndForm ();
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** Write statistic *****/
|
|
||||||
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
|
|
||||||
HTM_Unsigned (NumberThisRow);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
|
|
||||||
NumberLastRow = NumberThisRow;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******************** Get institution data and statistic *********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static unsigned Fig_GetInsAndStat (struct Ins_Instit *Ins,MYSQL_RES *mysql_res)
|
|
||||||
{
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumberThisRow;
|
|
||||||
|
|
||||||
/***** Get next institution *****/
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
/***** Get data of this institution (row[0]) *****/
|
|
||||||
Ins->InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
|
||||||
if (!Ins_GetDataOfInstitByCod (Ins))
|
|
||||||
Err_WrongInstitExit ();
|
|
||||||
|
|
||||||
/***** Get statistic (row[1]) *****/
|
|
||||||
if (sscanf (row[1],"%u",&NumberThisRow) != 1)
|
|
||||||
Err_ShowErrorAndExit ("Error in statistic");
|
|
||||||
|
|
||||||
return NumberThisRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************** Get and show stats about institutions ********************/
|
/****************** Get and show stats about institutions ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -754,7 +754,7 @@ static void Fol_PutIconToFollow (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_
|
||||||
/***** Form to unfollow *****/
|
/***** Form to unfollow *****/
|
||||||
Frm_BeginForm (ActFolUsr);
|
Frm_BeginForm (ActFolUsr);
|
||||||
Usr_PutParamUsrCodEncrypted (EncryptedUsrCod);
|
Usr_PutParamUsrCodEncrypted (EncryptedUsrCod);
|
||||||
if (asprintf (&Class,"FOLLOW_USR_ICO %s ICO_HIGHLIGHT ICO16x16",
|
if (asprintf (&Class,"FOLLOW_USR_ICO ICO16x16 %s ICO_HIGHLIGHT",
|
||||||
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]) < 0)
|
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user-plus.svg",Txt_Follow,Class);
|
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user-plus.svg",Txt_Follow,Class);
|
||||||
|
|
416
swad_hierarchy.c
416
swad_hierarchy.c
|
@ -32,6 +32,7 @@
|
||||||
#include "swad_database.h"
|
#include "swad_database.h"
|
||||||
#include "swad_degree_database.h"
|
#include "swad_degree_database.h"
|
||||||
#include "swad_error.h"
|
#include "swad_error.h"
|
||||||
|
#include "swad_figure.h"
|
||||||
#include "swad_form.h"
|
#include "swad_form.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
#include "swad_group_database.h"
|
#include "swad_group_database.h"
|
||||||
|
@ -54,6 +55,22 @@ extern struct Globals Gbl;
|
||||||
static Hie_StatusTxt_t Hie_GetStatusTxtFromStatusBits (Hie_Status_t Status);
|
static Hie_StatusTxt_t Hie_GetStatusTxtFromStatusBits (Hie_Status_t Status);
|
||||||
static Hie_Status_t Hie_GetStatusBitsFromStatusTxt (Hie_StatusTxt_t StatusTxt);
|
static Hie_Status_t Hie_GetStatusBitsFromStatusTxt (Hie_StatusTxt_t StatusTxt);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********** List pending institutions, centers, degrees and courses **********/
|
/********** List pending institutions, centers, degrees and courses **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -870,3 +887,402 @@ long Hie_GetAndCheckParamOtherHieCod (long MinCodAllowed)
|
||||||
|
|
||||||
return HieCod;
|
return HieCod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********* 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 *The_ClassDat[The_NUM_THEMES];
|
||||||
|
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,
|
||||||
|
The_ClassDat[Gbl.Prefs.Theme],
|
||||||
|
(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 *The_ClassDat[The_NUM_THEMES];
|
||||||
|
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,
|
||||||
|
The_ClassDat[Gbl.Prefs.Theme],
|
||||||
|
(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 *The_ClassDat[The_NUM_THEMES];
|
||||||
|
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,
|
||||||
|
The_ClassDat[Gbl.Prefs.Theme],
|
||||||
|
(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 *The_ClassDat[The_NUM_THEMES];
|
||||||
|
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,
|
||||||
|
The_ClassDat[Gbl.Prefs.Theme],
|
||||||
|
(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 *The_ClassDat[The_NUM_THEMES];
|
||||||
|
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],
|
||||||
|
The_ClassDat[Gbl.Prefs.Theme],
|
||||||
|
(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 *The_ClassDatStrong[The_NUM_THEMES];
|
||||||
|
extern const char *Txt_Total;
|
||||||
|
char *ClassTxt;
|
||||||
|
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 *****/
|
||||||
|
if (asprintf (&ClassTxt,"%s LINE_TOP",The_ClassDatStrong[Gbl.Prefs.Theme]) < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
Hie_ShowHierarchyRow ("",Txt_Total,ClassTxt,
|
||||||
|
(int) NumCtysTotal,
|
||||||
|
(int) NumInssTotal,
|
||||||
|
(int) NumCtrsTotal,
|
||||||
|
(int) NumDegsTotal,
|
||||||
|
(int) NumCrssTotal);
|
||||||
|
free (ClassTxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************** 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 *****/
|
||||||
|
HTM_TD_Begin ("class=\"%s RM\"",ClassTxt);
|
||||||
|
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 *****/
|
||||||
|
HTM_TD_Begin ("class=\"%s RM\"",ClassTxt);
|
||||||
|
if (Num >= 0)
|
||||||
|
HTM_Unsigned ((unsigned) Num);
|
||||||
|
else // < 0 ==> do not show number
|
||||||
|
HTM_Hyphen ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
}
|
||||||
|
|
|
@ -72,4 +72,7 @@ Hie_Status_t Hie_GetParamStatus (void);
|
||||||
void Hie_PutParamOtherHieCod (void *HieCod);
|
void Hie_PutParamOtherHieCod (void *HieCod);
|
||||||
long Hie_GetAndCheckParamOtherHieCod (long MinCodAllowed);
|
long Hie_GetAndCheckParamOtherHieCod (long MinCodAllowed);
|
||||||
|
|
||||||
|
//-------------------------------- Figures ------------------------------------
|
||||||
|
void Hie_GetAndShowHierarchyStats (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -101,6 +101,15 @@ static void Ins_EditingInstitutionDestructor ();
|
||||||
|
|
||||||
static void Ins_FormToGoToMap (struct Ins_Instit *Ins);
|
static void Ins_FormToGoToMap (struct Ins_Instit *Ins);
|
||||||
|
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumCtrs (void);
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumDegs (void);
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumCrss (void);
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumUsrsInCrss (void);
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem (void);
|
||||||
|
static void Ins_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
|
||||||
|
const char *TxtFigure);
|
||||||
|
static unsigned Ins_GetInsAndStat (struct Ins_Instit *Ins,MYSQL_RES *mysql_res);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** List institutions with pending centers ********************/
|
/***************** List institutions with pending centers ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -228,7 +237,7 @@ void Ins_DrawInstitLogoAndNameWithLink (struct Ins_Instit *Ins,Act_Action_t Acti
|
||||||
|
|
||||||
/***** Link to action *****/
|
/***** Link to action *****/
|
||||||
HTM_BUTTON_OnSubmit_Begin (Str_BuildGoToTitle (Ins->FullName),
|
HTM_BUTTON_OnSubmit_Begin (Str_BuildGoToTitle (Ins->FullName),
|
||||||
"BT_LINK",NULL);
|
"BT_LINK LT",NULL);
|
||||||
Str_FreeGoToTitle ();
|
Str_FreeGoToTitle ();
|
||||||
|
|
||||||
/***** Institution logo and name *****/
|
/***** Institution logo and name *****/
|
||||||
|
@ -391,7 +400,7 @@ static void Ins_ListOneInstitutionForSeeing (struct Ins_Instit *Ins,unsigned Num
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Institution logo and name *****/
|
/***** Institution logo and name *****/
|
||||||
HTM_TD_Begin ("class=\"LM %s\"",BgColor);
|
HTM_TD_Begin ("class=\"%s LM %s\"",TxtClassStrong,BgColor);
|
||||||
Ins_DrawInstitLogoAndNameWithLink (Ins,ActSeeCtr,"CM");
|
Ins_DrawInstitLogoAndNameWithLink (Ins,ActSeeCtr,"CM");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
@ -2066,3 +2075,325 @@ unsigned Ins_GetCachedNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins)
|
||||||
|
|
||||||
return NumUsrsIns;
|
return NumUsrsIns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****************** Get and show stats about institutions ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Ins_GetAndShowInstitutionsStats (void)
|
||||||
|
{
|
||||||
|
extern const char *Hlp_ANALYTICS_Figures_institutions;
|
||||||
|
extern const char *Txt_Institutions;
|
||||||
|
struct Fig_Figures Figures;
|
||||||
|
|
||||||
|
/***** Begin box *****/
|
||||||
|
Box_BoxBegin (NULL,Txt_Institutions,
|
||||||
|
NULL,NULL,
|
||||||
|
Hlp_ANALYTICS_Figures_institutions,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
|
/***** Form to select type of list used to display degree photos *****/
|
||||||
|
Set_GetAndUpdatePrefsAboutUsrList ();
|
||||||
|
Figures.Scope = Gbl.Scope.Current;
|
||||||
|
Figures.FigureType = Fig_INSTITS;
|
||||||
|
Usr_ShowFormsToSelectUsrListType (Fig_PutHiddenParamFigures,&Figures);
|
||||||
|
|
||||||
|
/***** Institutions ordered by number of centers *****/
|
||||||
|
Ins_GetAndShowInssOrderedByNumCtrs ();
|
||||||
|
|
||||||
|
/***** Institutions ordered by number of degrees *****/
|
||||||
|
Ins_GetAndShowInssOrderedByNumDegs ();
|
||||||
|
|
||||||
|
/***** Institutions ordered by number of courses *****/
|
||||||
|
Ins_GetAndShowInssOrderedByNumCrss ();
|
||||||
|
|
||||||
|
/***** Institutions ordered by number of users in courses *****/
|
||||||
|
Ins_GetAndShowInssOrderedByNumUsrsInCrss ();
|
||||||
|
|
||||||
|
/***** Institutions ordered by number of users who claim to belong to them *****/
|
||||||
|
Ins_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem ();
|
||||||
|
|
||||||
|
/***** End box *****/
|
||||||
|
Box_BoxEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**** Get and show stats about institutions ordered by number of centers *****/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumCtrs (void)
|
||||||
|
{
|
||||||
|
extern const char *Txt_Institutions_by_number_of_centers;
|
||||||
|
extern const char *Txt_Centers;
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
unsigned NumInss;
|
||||||
|
|
||||||
|
/***** Begin box and table *****/
|
||||||
|
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_centers,
|
||||||
|
NULL,NULL,
|
||||||
|
NULL,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
|
/***** Get institutions ordered by number of centers *****/
|
||||||
|
NumInss = Ins_DB_GetInssOrderedByNumCtrs (&mysql_res);
|
||||||
|
|
||||||
|
/***** Show institutions *****/
|
||||||
|
Ins_ShowInss (&mysql_res,NumInss,Txt_Centers);
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
|
/***** End table and box *****/
|
||||||
|
Box_BoxTableEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**** Get and show stats about institutions ordered by number of degrees *****/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumDegs (void)
|
||||||
|
{
|
||||||
|
extern const char *Txt_Institutions_by_number_of_degrees;
|
||||||
|
extern const char *Txt_Degrees;
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
unsigned NumInss;
|
||||||
|
|
||||||
|
/***** Begin box and table *****/
|
||||||
|
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_degrees,
|
||||||
|
NULL,NULL,
|
||||||
|
NULL,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
|
/***** Get institutions ordered by number of degrees *****/
|
||||||
|
NumInss = Ins_DB_GetInssOrderedByNumDegs (&mysql_res);
|
||||||
|
|
||||||
|
/***** Show institutions *****/
|
||||||
|
Ins_ShowInss (&mysql_res,NumInss,Txt_Degrees);
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
|
/***** End table and box *****/
|
||||||
|
Box_BoxTableEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**** Get and show stats about institutions ordered by number of courses *****/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumCrss (void)
|
||||||
|
{
|
||||||
|
extern const char *Txt_Institutions_by_number_of_courses;
|
||||||
|
extern const char *Txt_Courses;
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
unsigned NumInss;
|
||||||
|
|
||||||
|
/***** Begin box and table *****/
|
||||||
|
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_courses,
|
||||||
|
NULL,NULL,
|
||||||
|
NULL,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
|
/***** Get institutions ordered by number of courses *****/
|
||||||
|
NumInss = Ins_DB_GetInssOrderedByNumCrss (&mysql_res);
|
||||||
|
|
||||||
|
/***** Show institutions *****/
|
||||||
|
Ins_ShowInss (&mysql_res,NumInss,Txt_Courses);
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
|
/***** End table and box *****/
|
||||||
|
Box_BoxTableEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***** Get and show stats about institutions ordered by users in courses *****/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumUsrsInCrss (void)
|
||||||
|
{
|
||||||
|
extern const char *Txt_Institutions_by_number_of_users_in_courses;
|
||||||
|
extern const char *Txt_Users;
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
unsigned NumInss;
|
||||||
|
|
||||||
|
/***** Begin box and table *****/
|
||||||
|
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_users_in_courses,
|
||||||
|
NULL,NULL,
|
||||||
|
NULL,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
|
/***** Get institutions ordered by number of users in courses *****/
|
||||||
|
NumInss = Ins_DB_GetInssOrderedByNumUsrsInCrss (&mysql_res);
|
||||||
|
|
||||||
|
/***** Show institutions *****/
|
||||||
|
Ins_ShowInss (&mysql_res,NumInss,Txt_Users);
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
|
/***** End table and box *****/
|
||||||
|
Box_BoxTableEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************* Get and show stats about institutions ordered by **************/
|
||||||
|
/************* number of users who claim to belong to them **************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Ins_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem (void)
|
||||||
|
{
|
||||||
|
extern const char *Txt_Institutions_by_number_of_users_who_claim_to_belong_to_them;
|
||||||
|
extern const char *Txt_Users;
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
unsigned NumInss;
|
||||||
|
|
||||||
|
/***** Begin box and table *****/
|
||||||
|
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_users_who_claim_to_belong_to_them,
|
||||||
|
NULL,NULL,
|
||||||
|
NULL,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
|
/***** Get institutions ordered by number of users who claim to belong to them *****/
|
||||||
|
NumInss = Ins_DB_GetInssOrderedByNumUsrsWhoClaimToBelongToThem (&mysql_res);
|
||||||
|
|
||||||
|
/***** Show institutions *****/
|
||||||
|
Ins_ShowInss (&mysql_res,NumInss,Txt_Users);
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
|
/***** End table and box *****/
|
||||||
|
Box_BoxTableEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****************** Get and show stats about institutions ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Ins_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
|
||||||
|
const char *TxtFigure)
|
||||||
|
{
|
||||||
|
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
||||||
|
extern const char *The_ClassDat[The_NUM_THEMES];
|
||||||
|
extern const char *Txt_Institution;
|
||||||
|
unsigned NumIns;
|
||||||
|
unsigned NumOrder;
|
||||||
|
unsigned NumberLastRow;
|
||||||
|
unsigned NumberThisRow;
|
||||||
|
struct Ins_Instit Ins;
|
||||||
|
bool TRIsOpen = false;
|
||||||
|
|
||||||
|
/***** Query database *****/
|
||||||
|
if (NumInss)
|
||||||
|
{
|
||||||
|
/* Draw the classphoto/list */
|
||||||
|
switch (Gbl.Usrs.Me.ListType)
|
||||||
|
{
|
||||||
|
case Set_USR_LIST_AS_CLASS_PHOTO:
|
||||||
|
/***** Draw institutions as a class photo *****/
|
||||||
|
for (NumIns = 0;
|
||||||
|
NumIns < NumInss;)
|
||||||
|
{
|
||||||
|
if ((NumIns % Gbl.Usrs.ClassPhoto.Cols) == 0)
|
||||||
|
{
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
TRIsOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Get institution data and statistic *****/
|
||||||
|
NumberThisRow = Ins_GetInsAndStat (&Ins,*mysql_res);
|
||||||
|
|
||||||
|
/***** Write link to institution *****/
|
||||||
|
HTM_TD_Begin ("class=\"%s CM\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||||
|
Ins_DrawInstitutionLogoWithLink (&Ins,40);
|
||||||
|
HTM_BR ();
|
||||||
|
HTM_Unsigned (NumberThisRow);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
if ((++NumIns % Gbl.Usrs.ClassPhoto.Cols) == 0)
|
||||||
|
{
|
||||||
|
HTM_TR_End ();
|
||||||
|
TRIsOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (TRIsOpen)
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Set_USR_LIST_AS_LISTING:
|
||||||
|
/***** Draw institutions as a list *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
HTM_TH_Empty (1);
|
||||||
|
HTM_TH (Txt_Institution,HTM_HEAD_LEFT);
|
||||||
|
HTM_TH (TxtFigure ,HTM_HEAD_RIGHT);
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
for (NumIns = 1, NumOrder = 1, NumberLastRow = 0;
|
||||||
|
NumIns <= NumInss;
|
||||||
|
NumIns++)
|
||||||
|
{
|
||||||
|
/***** Get institution data and statistic *****/
|
||||||
|
NumberThisRow = Ins_GetInsAndStat (&Ins,*mysql_res);
|
||||||
|
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/***** Number of order *****/
|
||||||
|
if (NumberThisRow != NumberLastRow)
|
||||||
|
NumOrder = NumIns;
|
||||||
|
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
|
||||||
|
HTM_Unsigned (NumOrder);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Write link to institution *****/
|
||||||
|
HTM_TD_Begin ("class=\"%s LM\"",
|
||||||
|
The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||||
|
/* Icon and name of this institution */
|
||||||
|
Frm_BeginForm (ActSeeInsInf);
|
||||||
|
Ins_PutParamInsCod (Ins.InsCod);
|
||||||
|
HTM_BUTTON_OnSubmit_Begin (Ins.ShrtName,"BT_LINK",NULL);
|
||||||
|
if (Gbl.Usrs.Listing.WithPhotos)
|
||||||
|
{
|
||||||
|
Lgo_DrawLogo (HieLvl_INS,Ins.InsCod,Ins.ShrtName,
|
||||||
|
40,NULL,true);
|
||||||
|
HTM_NBSP ();
|
||||||
|
}
|
||||||
|
HTM_Txt (Ins.FullName);
|
||||||
|
HTM_BUTTON_End ();
|
||||||
|
Frm_EndForm ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Write statistic *****/
|
||||||
|
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
|
||||||
|
HTM_Unsigned (NumberThisRow);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
NumberLastRow = NumberThisRow;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Get institution data and statistic *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static unsigned Ins_GetInsAndStat (struct Ins_Instit *Ins,MYSQL_RES *mysql_res)
|
||||||
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
unsigned NumberThisRow;
|
||||||
|
|
||||||
|
/***** Get next institution *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
|
/***** Get data of this institution (row[0]) *****/
|
||||||
|
Ins->InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
if (!Ins_GetDataOfInstitByCod (Ins))
|
||||||
|
Err_WrongInstitExit ();
|
||||||
|
|
||||||
|
/***** Get statistic (row[1]) *****/
|
||||||
|
if (sscanf (row[1],"%u",&NumberThisRow) != 1)
|
||||||
|
Err_ShowErrorAndExit ("Error in statistic");
|
||||||
|
|
||||||
|
return NumberThisRow;
|
||||||
|
}
|
||||||
|
|
|
@ -128,4 +128,7 @@ void Ins_FlushCacheNumUsrsWhoClaimToBelongToIns (void);
|
||||||
unsigned Ins_GetNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins);
|
unsigned Ins_GetNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins);
|
||||||
unsigned Ins_GetCachedNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins);
|
unsigned Ins_GetCachedNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins);
|
||||||
|
|
||||||
|
//-------------------------------- Figures ------------------------------------
|
||||||
|
void Ins_GetAndShowInstitutionsStats (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
11
swad_logo.c
11
swad_logo.c
|
@ -63,6 +63,7 @@ static void Lgo_PutIconToRemoveLogo (Act_Action_t ActionRem);
|
||||||
void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
|
void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
|
||||||
unsigned Size,const char *Class,bool PutIconIfNotExists)
|
unsigned Size,const char *Class,bool PutIconIfNotExists)
|
||||||
{
|
{
|
||||||
|
extern const char *Ico_ClassColor[Ico_NUM_COLORS][The_NUM_THEMES];
|
||||||
static const char *HieIcon[HieLvl_NUM_LEVELS] =
|
static const char *HieIcon[HieLvl_NUM_LEVELS] =
|
||||||
{
|
{
|
||||||
[HieLvl_UNK] = "sitemap.svg", // not applicable here
|
[HieLvl_UNK] = "sitemap.svg", // not applicable here
|
||||||
|
@ -82,6 +83,7 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
|
||||||
char *URL;
|
char *URL;
|
||||||
char *Icon;
|
char *Icon;
|
||||||
bool ClassNotEmpty;
|
bool ClassNotEmpty;
|
||||||
|
Ico_Color_t Color;
|
||||||
|
|
||||||
/***** Path to logo *****/
|
/***** Path to logo *****/
|
||||||
if (HieIcon[Scope]) // Scope is correct
|
if (HieIcon[Scope]) // Scope is correct
|
||||||
|
@ -153,6 +155,7 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
if (asprintf (&Icon,"%u.png",(unsigned) Cod) < 0)
|
if (asprintf (&Icon,"%u.png",(unsigned) Cod) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
|
Color = Ico_UNCHANGED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -160,14 +163,20 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
if (asprintf (&Icon,"%s",HieIcon[Scope]) < 0)
|
if (asprintf (&Icon,"%s",HieIcon[Scope]) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
|
Color = Ico_BLACK;
|
||||||
}
|
}
|
||||||
ClassNotEmpty = false;
|
ClassNotEmpty = false;
|
||||||
if (Class)
|
if (Class)
|
||||||
if (Class[0])
|
if (Class[0])
|
||||||
ClassNotEmpty = true;
|
ClassNotEmpty = true;
|
||||||
HTM_IMG (URL,Icon,AltText,
|
HTM_IMG (URL,Icon,AltText,
|
||||||
"class=\"ICO%ux%u%s%s\"",
|
"class=\"ICO%ux%u"
|
||||||
|
"%s%s"
|
||||||
|
"%s%s\"",
|
||||||
Size,Size,
|
Size,Size,
|
||||||
|
Ico_ClassColor[Color][Gbl.Prefs.Theme][0] ? " " :
|
||||||
|
"",
|
||||||
|
Ico_ClassColor[Color][Gbl.Prefs.Theme],
|
||||||
ClassNotEmpty ? " " :
|
ClassNotEmpty ? " " :
|
||||||
"",
|
"",
|
||||||
ClassNotEmpty ? Class :
|
ClassNotEmpty ? Class :
|
||||||
|
|
232
swad_user.c
232
swad_user.c
|
@ -78,6 +78,7 @@
|
||||||
#include "swad_password.h"
|
#include "swad_password.h"
|
||||||
#include "swad_photo.h"
|
#include "swad_photo.h"
|
||||||
#include "swad_privacy.h"
|
#include "swad_privacy.h"
|
||||||
|
#include "swad_profile.h"
|
||||||
#include "swad_QR.h"
|
#include "swad_QR.h"
|
||||||
#include "swad_record.h"
|
#include "swad_record.h"
|
||||||
#include "swad_record_database.h"
|
#include "swad_record_database.h"
|
||||||
|
@ -249,6 +250,9 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
|
||||||
struct SelectedUsrs *SelectedUsrs,
|
struct SelectedUsrs *SelectedUsrs,
|
||||||
bool PutCheckBoxToSelectUsr);
|
bool PutCheckBoxToSelectUsr);
|
||||||
|
|
||||||
|
static void Usr_GetAndShowNumUsrsInCrss (Rol_Role_t Role);
|
||||||
|
static void Usr_GetAndShowNumUsrsNotBelongingToAnyCrs (void);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**** Show alert about number of clicks remaining before sending my photo ****/
|
/**** Show alert about number of clicks remaining before sending my photo ****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2150,6 +2154,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
|
||||||
bool PutCheckBoxToSelectUsr,Rol_Role_t Role,
|
bool PutCheckBoxToSelectUsr,Rol_Role_t Role,
|
||||||
struct SelectedUsrs *SelectedUsrs)
|
struct SelectedUsrs *SelectedUsrs)
|
||||||
{
|
{
|
||||||
|
extern const char *The_Colors[The_NUM_THEMES];
|
||||||
extern const char *Txt_Enrolment_confirmed;
|
extern const char *Txt_Enrolment_confirmed;
|
||||||
extern const char *Txt_Enrolment_not_confirmed;
|
extern const char *Txt_Enrolment_not_confirmed;
|
||||||
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
|
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
|
||||||
|
@ -2184,16 +2189,18 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
|
||||||
|
|
||||||
/***** User has accepted enrolment? *****/
|
/***** User has accepted enrolment? *****/
|
||||||
if (UsrIsTheMsgSender)
|
if (UsrIsTheMsgSender)
|
||||||
HTM_TD_Begin ("class=\"BM_SEL %s\" title=\"%s\"",
|
HTM_TD_Begin ("class=\"BM_SEL %s_%s\" title=\"%s\"",
|
||||||
UsrDat->Accepted ? "USR_LIST_NUM_N" :
|
UsrDat->Accepted ? "USR_LIST_NUM_N" :
|
||||||
"USR_LIST_NUM",
|
"USR_LIST_NUM",
|
||||||
|
The_Colors[Gbl.Prefs.Theme],
|
||||||
UsrDat->Accepted ? Txt_Enrolment_confirmed :
|
UsrDat->Accepted ? Txt_Enrolment_confirmed :
|
||||||
Txt_Enrolment_not_confirmed);
|
Txt_Enrolment_not_confirmed);
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("class=\"BM%u %s\" title=\"%s\"",
|
HTM_TD_Begin ("class=\"BM %s_%s %s\" title=\"%s\"",
|
||||||
Gbl.RowEvenOdd,
|
|
||||||
UsrDat->Accepted ? "USR_LIST_NUM_N" :
|
UsrDat->Accepted ? "USR_LIST_NUM_N" :
|
||||||
"USR_LIST_NUM",
|
"USR_LIST_NUM",
|
||||||
|
The_Colors[Gbl.Prefs.Theme],
|
||||||
|
BgColor,
|
||||||
UsrDat->Accepted ? Txt_Enrolment_confirmed :
|
UsrDat->Accepted ? Txt_Enrolment_confirmed :
|
||||||
Txt_Enrolment_not_confirmed);
|
Txt_Enrolment_not_confirmed);
|
||||||
HTM_Txt (UsrDat->Accepted ? "✓" :
|
HTM_Txt (UsrDat->Accepted ? "✓" :
|
||||||
|
@ -2201,9 +2208,10 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write number of user in the list *****/
|
/***** Write number of user in the list *****/
|
||||||
HTM_TD_Begin ("class=\"%s RM %s\"",
|
HTM_TD_Begin ("class=\"%s_%s RM %s\"",
|
||||||
UsrDat->Accepted ? "USR_LIST_NUM_N" :
|
UsrDat->Accepted ? "USR_LIST_NUM_N" :
|
||||||
"USR_LIST_NUM",
|
"USR_LIST_NUM",
|
||||||
|
The_Colors[Gbl.Prefs.Theme],
|
||||||
BgColor);
|
BgColor);
|
||||||
HTM_Unsigned (NumUsr);
|
HTM_Unsigned (NumUsr);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -2635,12 +2643,15 @@ static void Usr_WriteUsrData (const char *BgColor,
|
||||||
const char *Data,const char *Link,
|
const char *Data,const char *Link,
|
||||||
bool NonBreak,bool Accepted)
|
bool NonBreak,bool Accepted)
|
||||||
{
|
{
|
||||||
|
extern const char *The_Colors[The_NUM_THEMES];
|
||||||
|
|
||||||
/***** Begin table cell *****/
|
/***** Begin table cell *****/
|
||||||
HTM_TD_Begin ("class=\"%s LM %s\"",
|
HTM_TD_Begin ("class=\"%s_%s LM %s\"",
|
||||||
Accepted ? (NonBreak ? "DAT_SMALL_NOBR_N" :
|
Accepted ? (NonBreak ? "DAT_SMALL_NOBR_N" :
|
||||||
"DAT_SMALL_N") :
|
"DAT_SMALL_N") :
|
||||||
(NonBreak ? "DAT_SMALL_NOBR" :
|
(NonBreak ? "DAT_SMALL_NOBR" :
|
||||||
"DAT_SMALL"),
|
"DAT_SMALL"),
|
||||||
|
The_Colors[Gbl.Prefs.Theme],
|
||||||
BgColor);
|
BgColor);
|
||||||
|
|
||||||
/***** Container to limit length *****/
|
/***** Container to limit length *****/
|
||||||
|
@ -4767,7 +4778,7 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,
|
||||||
/***** List data of users *****/
|
/***** List data of users *****/
|
||||||
for (NumUsr = 0, Gbl.RowEvenOdd = 0;
|
for (NumUsr = 0, Gbl.RowEvenOdd = 0;
|
||||||
NumUsr < NumUsrs;
|
NumUsr < NumUsrs;
|
||||||
NumUsr++)
|
NumUsr++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
|
||||||
{
|
{
|
||||||
UsrInList = &Gbl.Usrs.LstUsrs[Role].Lst[NumUsr];
|
UsrInList = &Gbl.Usrs.LstUsrs[Role].Lst[NumUsr];
|
||||||
|
|
||||||
|
@ -4806,8 +4817,6 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free memory used for user's data *****/
|
/***** Free memory used for user's data *****/
|
||||||
|
@ -6533,3 +6542,210 @@ Usr_Who_t Usr_GetHiddenParamWho (void)
|
||||||
Usr_NUM_WHO - 1,
|
Usr_NUM_WHO - 1,
|
||||||
Usr_WHO_UNKNOWN);
|
Usr_WHO_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************** Show stats about number of users *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Usr_GetAndShowUsersStats (void)
|
||||||
|
{
|
||||||
|
extern const char *Hlp_ANALYTICS_Figures_users;
|
||||||
|
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
|
||||||
|
extern const char *Txt_Users;
|
||||||
|
extern const char *Txt_Number_of_users;
|
||||||
|
extern const char *Txt_Average_number_of_courses_to_which_a_user_belongs;
|
||||||
|
extern const char *Txt_Average_number_of_users_belonging_to_a_course;
|
||||||
|
|
||||||
|
/***** Begin box and table *****/
|
||||||
|
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_USERS],
|
||||||
|
NULL,NULL,
|
||||||
|
Hlp_ANALYTICS_Figures_users,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
|
/***** Write heading *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
HTM_TH (Txt_Users ,HTM_HEAD_RIGHT);
|
||||||
|
HTM_TH (Txt_Number_of_users ,HTM_HEAD_RIGHT);
|
||||||
|
HTM_TH (Txt_Average_number_of_courses_to_which_a_user_belongs,HTM_HEAD_RIGHT);
|
||||||
|
HTM_TH (Txt_Average_number_of_users_belonging_to_a_course ,HTM_HEAD_RIGHT);
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Figures *****/
|
||||||
|
Usr_GetAndShowNumUsrsInCrss (Rol_STD); // Students
|
||||||
|
Usr_GetAndShowNumUsrsInCrss (Rol_NET); // Non-editing teachers
|
||||||
|
Usr_GetAndShowNumUsrsInCrss (Rol_TCH); // Teachers
|
||||||
|
Usr_GetAndShowNumUsrsInCrss (Rol_UNK); // Any user in courses
|
||||||
|
|
||||||
|
/***** Separator *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
HTM_TH_Span (NULL,HTM_HEAD_CENTER,1,4,"SEPAR_ROW");
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
Usr_GetAndShowNumUsrsNotBelongingToAnyCrs (); // Users not beloging to any course
|
||||||
|
|
||||||
|
/***** End table and box *****/
|
||||||
|
Box_BoxTableEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Get and show number of users in courses ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// Rol_UNK means any role in courses
|
||||||
|
|
||||||
|
static void Usr_GetAndShowNumUsrsInCrss (Rol_Role_t Role)
|
||||||
|
{
|
||||||
|
extern const char *The_ClassDat[The_NUM_THEMES];
|
||||||
|
extern const char *The_ClassDatStrong[The_NUM_THEMES];
|
||||||
|
extern const char *Txt_Total;
|
||||||
|
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
|
long Cod = Sco_GetCurrentCod ();
|
||||||
|
char *Class;
|
||||||
|
unsigned Roles;
|
||||||
|
|
||||||
|
/***** Initializations depending on role *****/
|
||||||
|
if (Role == Rol_UNK)
|
||||||
|
{
|
||||||
|
if (asprintf (&Class,"RB %s LINE_TOP",The_ClassDatStrong[Gbl.Prefs.Theme]) < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
Roles = (1 << Rol_STD) |
|
||||||
|
(1 << Rol_NET) |
|
||||||
|
(1 << Rol_TCH);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (asprintf (&Class,"RB %s",The_ClassDat[Gbl.Prefs.Theme]) < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
Roles = (1 << Role);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Write the total number of users *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s\"",Class);
|
||||||
|
HTM_Txt ((Role == Rol_UNK) ? Txt_Total :
|
||||||
|
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Number of users in courses */
|
||||||
|
HTM_TD_Begin ("class=\"%s\"",Class);
|
||||||
|
HTM_Unsigned (Enr_GetCachedNumUsrsInCrss (Gbl.Scope.Current,Cod,Roles));
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s\"",Class);
|
||||||
|
HTM_Double2Decimals (Enr_GetCachedAverageNumCrssPerUsr (Gbl.Scope.Current,Cod,Role));
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s\"",Class);
|
||||||
|
HTM_Double2Decimals (Enr_GetCachedAverageNumUsrsPerCrs (Gbl.Scope.Current,Cod,Role));
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
free (Class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Get and show number of users in courses ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Usr_GetAndShowNumUsrsNotBelongingToAnyCrs (void)
|
||||||
|
{
|
||||||
|
extern const char *The_ClassDat[The_NUM_THEMES];
|
||||||
|
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
|
char *Class;
|
||||||
|
|
||||||
|
if (asprintf (&Class,"%s RB",The_ClassDat[Gbl.Prefs.Theme]) < 0)
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/***** Write the total number of users not belonging to any course *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s\"",Class);
|
||||||
|
HTM_Txt (Txt_ROLES_PLURAL_Abc[Rol_GST][Usr_SEX_UNKNOWN]);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s\"",Class);
|
||||||
|
HTM_Unsigned (Enr_GetCachedNumUsrsNotBelongingToAnyCrs ());
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s\"",Class);
|
||||||
|
HTM_Double2Decimals (0.0);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s\"",Class);
|
||||||
|
HTM_Double2Decimals (0.0);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
free (Class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****************************** Show users' ranking **************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Usr_GetAndShowUsersRanking (void)
|
||||||
|
{
|
||||||
|
extern const char *Hlp_ANALYTICS_Figures_ranking;
|
||||||
|
extern const char *The_ClassDat[The_NUM_THEMES];
|
||||||
|
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
|
||||||
|
extern const char *Txt_Clicks;
|
||||||
|
extern const char *Txt_Clicks_per_day;
|
||||||
|
extern const char *Txt_Timeline;
|
||||||
|
extern const char *Txt_Downloads;
|
||||||
|
extern const char *Txt_Forums;
|
||||||
|
extern const char *Txt_Messages;
|
||||||
|
extern const char *Txt_Followers;
|
||||||
|
|
||||||
|
/***** Begin box and table *****/
|
||||||
|
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_USERS_RANKING],
|
||||||
|
NULL,NULL,
|
||||||
|
Hlp_ANALYTICS_Figures_ranking,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
|
/***** Write heading *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
HTM_TH (Txt_Clicks ,HTM_HEAD_CENTER);
|
||||||
|
HTM_TH (Txt_Clicks_per_day,HTM_HEAD_CENTER);
|
||||||
|
HTM_TH (Txt_Timeline ,HTM_HEAD_CENTER);
|
||||||
|
HTM_TH (Txt_Followers ,HTM_HEAD_CENTER);
|
||||||
|
HTM_TH (Txt_Downloads ,HTM_HEAD_CENTER);
|
||||||
|
HTM_TH (Txt_Forums ,HTM_HEAD_CENTER);
|
||||||
|
HTM_TH (Txt_Messages ,HTM_HEAD_CENTER);
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Rankings *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
||||||
|
Prf_GetAndShowRankingClicks ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
||||||
|
Prf_GetAndShowRankingClicksPerDay ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
||||||
|
Prf_GetAndShowRankingTimelinePubs ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
||||||
|
Fol_GetAndShowRankingFollowers ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
||||||
|
Prf_GetAndShowRankingFileViews ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
||||||
|
Prf_GetAndShowRankingForPsts ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
|
||||||
|
Prf_GetAndShowRankingMsgsSnt ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** End table and box *****/
|
||||||
|
Box_BoxTableEnd ();
|
||||||
|
}
|
||||||
|
|
|
@ -440,4 +440,8 @@ void Usr_PutWhoIcon (Usr_Who_t Who);
|
||||||
void Usr_PutHiddenParamWho (Usr_Who_t Who);
|
void Usr_PutHiddenParamWho (Usr_Who_t Who);
|
||||||
Usr_Who_t Usr_GetHiddenParamWho (void);
|
Usr_Who_t Usr_GetHiddenParamWho (void);
|
||||||
|
|
||||||
|
//-------------------------------- Figures ------------------------------------
|
||||||
|
void Usr_GetAndShowUsersStats (void);
|
||||||
|
void Usr_GetAndShowUsersRanking (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue