swad-core/swad_figure.c

4102 lines
147 KiB
C
Raw Normal View History

2019-02-12 14:46:14 +01:00
// swad_figure.c: figures (global stats)
/*
SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
2021-02-09 12:43:45 +01:00
Copyright (C) 1999-2021 Antonio Ca<EFBFBD>as Vargas
2019-02-12 14:46:14 +01:00
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#define _GNU_SOURCE // For asprintf
#include <stdio.h> // For asprintf
#include <stdlib.h> // For system, getenv, etc.
#include <string.h> // For string functions
#include "swad_action.h"
#include "swad_agenda_database.h"
#include "swad_assignment_database.h"
2019-02-12 14:46:14 +01:00
#include "swad_box.h"
#include "swad_browser_database.h"
2019-02-12 14:46:14 +01:00
#include "swad_database.h"
#include "swad_error.h"
#include "swad_exam_database.h"
2019-02-12 14:46:14 +01:00
#include "swad_figure.h"
2020-05-01 22:56:02 +02:00
#include "swad_figure_cache.h"
2019-02-12 14:46:14 +01:00
#include "swad_follow.h"
#include "swad_follow_database.h"
2019-02-12 14:46:14 +01:00
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_forum_database.h"
#include "swad_game_database.h"
2019-02-12 14:46:14 +01:00
#include "swad_global.h"
#include "swad_hierarchy.h"
2021-02-11 22:57:09 +01:00
#include "swad_hierarchy_level.h"
2019-10-23 19:05:05 +02:00
#include "swad_HTML.h"
2019-02-12 14:46:14 +01:00
#include "swad_institution.h"
#include "swad_institution_database.h"
2019-02-12 14:46:14 +01:00
#include "swad_logo.h"
2020-04-14 17:15:17 +02:00
#include "swad_message.h"
#include "swad_message_database.h"
2019-02-12 14:46:14 +01:00
#include "swad_network.h"
#include "swad_notice.h"
#include "swad_notification_database.h"
2019-03-23 13:10:31 +01:00
#include "swad_privacy.h"
2019-02-12 14:46:14 +01:00
#include "swad_profile.h"
2020-02-24 22:47:34 +01:00
#include "swad_program.h"
#include "swad_program_database.h"
2020-04-14 17:15:17 +02:00
#include "swad_project.h"
#include "swad_project_database.h"
2019-02-12 14:46:14 +01:00
#include "swad_role.h"
#include "swad_setting.h"
2020-04-14 17:15:17 +02:00
#include "swad_survey.h"
#include "swad_survey_database.h"
2020-04-14 17:15:17 +02:00
#include "swad_test.h"
#include "swad_timeline.h"
#include "swad_timeline_database.h"
2021-02-11 00:58:53 +01:00
#include "swad_timeline_note.h"
#include "swad_user_database.h"
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/******************************* Private types *******************************/
/*****************************************************************************/
struct Fig_SizeOfFileZones
{
int NumCrss; // -1 stands for not aplicable
int NumGrps; // -1 stands for not aplicable
int NumUsrs; // -1 stands for not aplicable
unsigned MaxLevels;
unsigned long NumFolders;
unsigned long NumFiles;
unsigned long long int Size; // Total size in bytes
};
struct Fig_FiguresForum
{
unsigned NumForums;
unsigned NumThreads;
unsigned NumPosts;
unsigned NumUsrsToBeNotifiedByEMail;
};
2020-04-06 23:18:02 +02:00
/*****************************************************************************/
/***************************** Private variables *****************************/
/*****************************************************************************/
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
2019-11-21 16:47:07 +01:00
/****************************** Private prototypes ***************************/
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
2020-04-06 23:18:02 +02:00
static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType);
static void Fig_PutHiddenParamFigureType (Fig_FigureType_t FigureType);
static void Fig_PutHiddenParamScopeFig (HieLvl_Level_t ScopeFig);
2019-02-12 14:46:14 +01:00
static void Fig_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 Fig_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);
2021-02-11 00:58:53 +01:00
static unsigned Fig_GetInsAndStat (struct Ins_Instit *Ins,MYSQL_RES *mysql_res);
2019-02-12 14:46:14 +01:00
static void Fig_GetAndShowDegreeTypesStats (void);
static void Fig_GetAndShowUsersStats (void);
static void Fig_GetAndShowNumUsrsInCrss (Rol_Role_t Role);
static void Fig_GetAndShowNumUsrsNotBelongingToAnyCrs (void);
static void Fig_GetAndShowUsersRanking (void);
static void Fig_GetAndShowFileBrowsersStats (void);
static void Fig_GetSizeOfFileZone (Brw_FileBrowser_t FileBrowser,
struct Fig_SizeOfFileZones *SizeOfFileZones);
2019-02-12 14:46:14 +01:00
static void Fig_WriteStatsExpTreesTableHead1 (void);
static void Fig_WriteStatsExpTreesTableHead2 (void);
static void Fig_WriteStatsExpTreesTableHead3 (void);
static void Fig_WriteRowStatsFileBrowsers1 (const char *NameOfFileZones,
Brw_FileBrowser_t FileZone,
struct Fig_SizeOfFileZones *SizeOfFileZones);
static void Fig_WriteRowStatsFileBrowsers2 (const char *NameOfFileZones,
Brw_FileBrowser_t FileZone,
struct Fig_SizeOfFileZones *SizeOfFileZones);
static void Fig_WriteRowStatsFileBrowsers3 (const char *NameOfFileZones,
Brw_FileBrowser_t FileZone,
struct Fig_SizeOfFileZones *SizeOfFileZones);
static void Fig_GetAndShowOERsStats (void);
static void Fig_GetNumberOfOERs (Brw_License_t License,
unsigned long NumFiles[2]);
2019-02-12 14:46:14 +01:00
2020-02-20 23:48:48 +01:00
static void Fig_GetAndShowCourseProgramStats (void); // TODO: Change function from assignments to schedule
2019-02-12 14:46:14 +01:00
static void Fig_GetAndShowAssignmentsStats (void);
static void Fig_GetAndShowProjectsStats (void);
static void Fig_GetAndShowTestsStats (void);
2020-04-22 03:15:04 +02:00
static void Fig_GetAndShowExamsStats (void);
2019-02-12 14:46:14 +01:00
static void Fig_GetAndShowGamesStats (void);
2019-11-25 13:29:56 +01:00
static void Fig_GetAndShowTimelineActivityStats (void);
2019-02-12 14:46:14 +01:00
static void Fig_GetAndShowFollowStats (void);
static void Fig_GetAndShowForumStats (void);
static void Fig_ShowStatOfAForumType (For_ForumType_t ForumType,
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
struct Fig_FiguresForum *FiguresForum);
static void Fig_WriteForumTitleAndStats (For_ForumType_t ForumType,
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
const char *Icon,struct Fig_FiguresForum *FiguresForum,
const char *ForumName1,const char *ForumName2);
static void Fig_WriteForumTotalStats (struct Fig_FiguresForum *FiguresForum);
static void Fig_GetAndShowNumUsrsPerNotifyEvent (void);
static void Fig_GetAndShowNoticesStats (void);
static void Fig_GetAndShowMsgsStats (void);
static void Fig_GetAndShowAgendasStats (void);
2019-02-12 14:46:14 +01:00
static void Fig_GetAndShowSurveysStats (void);
static void Fig_GetAndShowNumUsrsPerPrivacy (void);
2019-03-22 15:21:46 +01:00
static void Fig_GetAndShowNumUsrsPerPrivacyForAnObject (const char *TxtObject,
2019-03-23 13:10:31 +01:00
const char *FieldName,
unsigned MaskAllowedVisibility);
2019-03-17 20:12:59 +01:00
static void Fig_GetAndShowNumUsrsPerCookies (void);
2019-02-12 14:46:14 +01:00
static void Fig_GetAndShowNumUsrsPerLanguage (void);
static void Fig_GetAndShowNumUsrsPerFirstDayOfWeek (void);
static void Fig_GetAndShowNumUsrsPerDateFormat (void);
static void Fig_GetAndShowNumUsrsPerIconSet (void);
static void Fig_GetAndShowNumUsrsPerMenu (void);
static void Fig_GetAndShowNumUsrsPerTheme (void);
static void Fig_GetAndShowNumUsrsPerSideColumns (void);
/*****************************************************************************/
/************************** Show use of the platform *************************/
/*****************************************************************************/
void Fig_ReqShowFigures (void)
2020-04-06 23:18:02 +02:00
{
Fig_ReqShowFigure (Fig_FIGURE_TYPE_DEF);
}
static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType)
2019-02-12 14:46:14 +01:00
{
extern const char *Hlp_ANALYTICS_Figures;
2019-02-22 21:47:50 +01:00
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *The_ClassInput[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_Figures;
extern const char *Txt_Scope;
extern const char *Txt_Statistic;
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Show_statistic;
2020-04-06 23:18:02 +02:00
Fig_FigureType_t FigType;
2019-11-06 19:45:20 +01:00
unsigned FigureTypeUnsigned;
2019-02-12 14:46:14 +01:00
/***** Form to show statistic *****/
Frm_BeginForm (ActSeeUseGbl);
2019-02-12 14:46:14 +01:00
/***** Begin box *****/
Box_BoxBegin (NULL,Txt_Figures,
NULL,NULL,
Hlp_ANALYTICS_Figures,Box_NOT_CLOSABLE);
/***** Compute stats for anywhere, degree or course? *****/
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
HTM_TxtColonNBSP (Txt_Scope);
Gbl.Scope.Allowed = 1 << HieLvl_SYS |
1 << HieLvl_CTY |
1 << HieLvl_INS |
1 << HieLvl_CTR |
1 << HieLvl_DEG |
1 << HieLvl_CRS;
Gbl.Scope.Default = HieLvl_SYS;
Sco_GetScope ("ScopeFig");
Sco_PutSelectorScope ("ScopeFig",HTM_DONT_SUBMIT_ON_CHANGE);
HTM_LABEL_End ();
HTM_BR ();
/***** Type of statistic *****/
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
HTM_TxtColonNBSP (Txt_Statistic);
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
"name=\"FigureType\" class=\"%s\"",
The_ClassInput[Gbl.Prefs.Theme]);
for (FigType = (Fig_FigureType_t) 0;
FigType <= (Fig_FigureType_t) (Fig_NUM_FIGURES - 1);
FigType++)
{
FigureTypeUnsigned = (unsigned) FigType;
HTM_OPTION (HTM_Type_UNSIGNED,&FigureTypeUnsigned,
FigType == SelectedFigureType,false,
"%s",Txt_FIGURE_TYPES[FigType]);
}
HTM_SELECT_End ();
HTM_LABEL_End ();
2019-02-12 14:46:14 +01:00
/***** Send button and end box *****/
Box_BoxWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Show_statistic);
2019-02-12 14:46:14 +01:00
/***** End form *****/
Frm_EndForm ();
}
/*****************************************************************************/
/************************* Put icon to show a figure *************************/
/*****************************************************************************/
2020-04-06 23:18:02 +02:00
void Fig_PutIconToShowFigure (Fig_FigureType_t FigureType)
2019-02-12 14:46:14 +01:00
{
extern const char *Txt_Show_statistic;
2020-04-06 23:18:02 +02:00
struct Fig_Figures Figures;
2019-02-12 14:46:14 +01:00
2020-04-06 23:18:02 +02:00
/***** Set default scope (used only if Gbl.Scope.Current is unknown) *****/
Gbl.Scope.Default = HieLvl_CRS;
2020-04-06 23:18:02 +02:00
Sco_AdjustScope ();
/***** Put icon to show figure *****/
Figures.Scope = Gbl.Scope.Current;
Figures.FigureType = FigureType;
2020-03-26 02:54:30 +01:00
Lay_PutContextualLinkOnlyIcon (ActSeeUseGbl,NULL,
2020-04-06 23:18:02 +02:00
Fig_PutHiddenParamFigures,&Figures,
"chart-pie.svg",Ico_BLACK,
2019-02-12 14:46:14 +01:00
Txt_Show_statistic);
}
/*****************************************************************************/
/************* Put hidden parameters for figures (statistics) ****************/
/*****************************************************************************/
2020-04-06 23:18:02 +02:00
void Fig_PutHiddenParamFigures (void *Figures)
2019-02-12 14:46:14 +01:00
{
2020-04-06 23:18:02 +02:00
if (Figures)
2020-03-26 02:54:30 +01:00
{
2020-04-06 23:18:02 +02:00
Fig_PutHiddenParamScopeFig (((struct Fig_Figures *) Figures)->Scope);
Fig_PutHiddenParamFigureType (((struct Fig_Figures *) Figures)->FigureType);
2020-03-26 02:54:30 +01:00
}
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********* Put hidden parameter for the type of figure (statistic) ***********/
/*****************************************************************************/
2020-04-06 23:18:02 +02:00
static void Fig_PutHiddenParamFigureType (Fig_FigureType_t FigureType)
2019-02-12 14:46:14 +01:00
{
2020-04-06 23:18:02 +02:00
Par_PutHiddenParamUnsigned (NULL,"FigureType",(unsigned) FigureType);
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********* Put hidden parameter for the type of figure (statistic) ***********/
/*****************************************************************************/
static void Fig_PutHiddenParamScopeFig (HieLvl_Level_t ScopeFig)
2019-02-12 14:46:14 +01:00
{
2020-04-06 23:18:02 +02:00
Sco_PutParamScope ("ScopeFig",ScopeFig);
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************************** Show use of the platform *************************/
/*****************************************************************************/
void Fig_ShowFigures (void)
{
static void (*Fig_Function[Fig_NUM_FIGURES])(void) = // Array of pointers to functions
{
2019-12-15 01:10:36 +01:00
[Fig_USERS ] = Fig_GetAndShowUsersStats,
[Fig_USERS_RANKING ] = Fig_GetAndShowUsersRanking,
[Fig_HIERARCHY ] = Fig_GetAndShowHierarchyStats,
[Fig_INSTITS ] = Fig_GetAndShowInstitutionsStats,
[Fig_DEGREE_TYPES ] = Fig_GetAndShowDegreeTypesStats,
[Fig_FOLDERS_AND_FILES] = Fig_GetAndShowFileBrowsersStats,
[Fig_OER ] = Fig_GetAndShowOERsStats,
2020-04-06 23:18:02 +02:00
[Fig_COURSE_PROGRAMS ] = Fig_GetAndShowCourseProgramStats,
2019-12-15 01:10:36 +01:00
[Fig_ASSIGNMENTS ] = Fig_GetAndShowAssignmentsStats,
[Fig_PROJECTS ] = Fig_GetAndShowProjectsStats,
[Fig_TESTS ] = Fig_GetAndShowTestsStats,
2020-04-22 03:15:04 +02:00
[Fig_EXAMS ] = Fig_GetAndShowExamsStats,
2019-12-15 01:10:36 +01:00
[Fig_GAMES ] = Fig_GetAndShowGamesStats,
[Fig_SURVEYS ] = Fig_GetAndShowSurveysStats,
[Fig_TIMELINE ] = Fig_GetAndShowTimelineActivityStats,
[Fig_FOLLOW ] = Fig_GetAndShowFollowStats,
[Fig_FORUMS ] = Fig_GetAndShowForumStats,
[Fig_NOTIFY_EVENTS ] = Fig_GetAndShowNumUsrsPerNotifyEvent,
[Fig_NOTICES ] = Fig_GetAndShowNoticesStats,
[Fig_MESSAGES ] = Fig_GetAndShowMsgsStats,
[Fig_AGENDAS ] = Fig_GetAndShowAgendasStats,
2019-12-15 01:10:36 +01:00
[Fig_SOCIAL_NETWORKS ] = Net_ShowWebAndSocialNetworksStats,
[Fig_LANGUAGES ] = Fig_GetAndShowNumUsrsPerLanguage,
[Fig_FIRST_DAY_OF_WEEK] = Fig_GetAndShowNumUsrsPerFirstDayOfWeek,
[Fig_DATE_FORMAT ] = Fig_GetAndShowNumUsrsPerDateFormat,
[Fig_ICON_SETS ] = Fig_GetAndShowNumUsrsPerIconSet,
[Fig_MENUS ] = Fig_GetAndShowNumUsrsPerMenu,
[Fig_THEMES ] = Fig_GetAndShowNumUsrsPerTheme,
[Fig_SIDE_COLUMNS ] = Fig_GetAndShowNumUsrsPerSideColumns,
[Fig_PHOTO_SHAPES ] = Fig_GetAndShowNumUsrsPerPhotoShape,
2019-12-15 01:10:36 +01:00
[Fig_PRIVACY ] = Fig_GetAndShowNumUsrsPerPrivacy,
[Fig_COOKIES ] = Fig_GetAndShowNumUsrsPerCookies,
2019-02-12 14:46:14 +01:00
};
2020-04-06 23:18:02 +02:00
Fig_FigureType_t SelectedFigureType;
2019-02-12 14:46:14 +01:00
/***** Get the type of figure ******/
2020-04-06 23:18:02 +02:00
SelectedFigureType = (Fig_FigureType_t)
Par_GetParToUnsignedLong ("FigureType",
0,
Fig_NUM_FIGURES - 1,
(unsigned long) Fig_FIGURE_TYPE_DEF);
2019-02-12 14:46:14 +01:00
/***** Show again the form to see use of the platform *****/
2020-04-06 23:18:02 +02:00
Fig_ReqShowFigure (SelectedFigureType);
2019-02-12 14:46:14 +01:00
/***** Show the stat of use selected by user *****/
2020-04-06 23:18:02 +02:00
Fig_Function[SelectedFigureType] ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********************** Show stats about number of users *********************/
/*****************************************************************************/
static void Fig_GetAndShowUsersStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_users;
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Users;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
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;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_USERS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_users,Box_NOT_CLOSABLE,2);
/***** Write heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Users ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_users ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_number_of_courses_to_which_a_user_belongs,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_number_of_users_belonging_to_a_course ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** 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
2019-10-11 15:36:50 +02:00
/***** Separator *****/
HTM_TR_Begin (NULL);
HTM_TH (1,4,NULL,"SEPAR_ROW");
HTM_TR_End ();
2019-10-11 15:36:50 +02:00
Fig_GetAndShowNumUsrsNotBelongingToAnyCrs (); // Users not beloging to any course
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/**************** 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];
2019-02-12 14:46:14 +01:00
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);
}
2019-02-12 14:46:14 +01:00
/***** Write the total number of users *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
HTM_Txt ((Role == Rol_UNK) ? Txt_Total :
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
/* Number of users in courses */
HTM_TD_Begin ("class=\"%s\"",Class);
HTM_Unsigned (Enr_GetCachedNumUsrsInCrss (Gbl.Scope.Current,Cod,Roles));
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
HTM_Double2Decimals (Enr_GetCachedAverageNumCrssPerUsr (Gbl.Scope.Current,Cod,Role));
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
HTM_Double2Decimals (Enr_GetCachedAverageNumUsrsPerCrs (Gbl.Scope.Current,Cod,Role));
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
free (Class);
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/**************** Get and show number of users in courses ********************/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsNotBelongingToAnyCrs (void)
{
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
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 ();
2019-02-12 14:46:14 +01:00
/***** Write the total number of users not belonging to any course *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
HTM_Txt (Txt_ROLES_PLURAL_Abc[Rol_GST][Usr_SEX_UNKNOWN]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
HTM_Unsigned (Enr_GetCachedNumUsrsNotBelongingToAnyCrs ());
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
HTM_Double2Decimals (0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
HTM_Double2Decimals (0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
free (Class);
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/****************************** Show users' ranking **************************/
/*****************************************************************************/
static void Fig_GetAndShowUsersRanking (void)
{
extern const char *Hlp_ANALYTICS_Figures_ranking;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Clicks;
extern const char *Txt_Clicks_per_day;
2019-03-06 13:14:40 +01:00
extern const char *Txt_Timeline;
2019-02-12 14:46:14 +01:00
extern const char *Txt_Downloads;
extern const char *Txt_Forums;
extern const char *Txt_Messages;
extern const char *Txt_Followers;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_USERS_RANKING],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_ranking,Box_NOT_CLOSABLE,2);
/***** Write heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Clicks ,"TIT_TBL_%s CM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Clicks_per_day,"TIT_TBL_%s CM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Timeline ,"TIT_TBL_%s CM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Followers ,"TIT_TBL_%s CM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Downloads ,"TIT_TBL_%s CM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Forums ,"TIT_TBL_%s CM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Messages ,"TIT_TBL_%s CM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** Rankings *****/
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
Prf_GetAndShowRankingClicks ();
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
Prf_GetAndShowRankingClicksPerDay ();
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
Prf_GetAndShowRankingTimelinePubs ();
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
Fol_GetAndShowRankingFollowers ();
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
Prf_GetAndShowRankingFileViews ();
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
Prf_GetAndShowRankingForPsts ();
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
Prf_GetAndShowRankingMsgsSnt ();
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********* Get and show stats about hierarchy ***********/
/********* (countries, institutions, centers, degrees and courses) ***********/
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
static void Fig_GetAndShowHierarchyStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_hierarchy;
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
Rol_Role_t Role;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_HIERARCHY],
NULL,NULL,
2019-02-12 14:46:14 +01:00
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 ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************************ Write head of hierarchy table **********************/
/*****************************************************************************/
static void Fig_WriteHeadHierarchy (void)
{
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_Countries;
extern const char *Txt_Institutions;
extern const char *Txt_Centers;
2019-02-12 14:46:14 +01:00
extern const char *Txt_Degrees;
extern const char *Txt_Courses;
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-11 15:36:50 +02:00
HTM_TH_Empty (1);
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
Ico_PutIcon ("globe-americas.svg",Ico_BLACK,
Txt_Countries,"CONTEXT_ICO_x16");
HTM_BR ();
HTM_Txt (Txt_Countries);
HTM_TH_End ();
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
Ico_PutIcon ("university.svg",Ico_BLACK,
Txt_Institutions,"CONTEXT_ICO_x16");
HTM_BR ();
HTM_Txt (Txt_Institutions);
HTM_TH_End ();
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
Ico_PutIcon ("building.svg",Ico_BLACK,
Txt_Centers,"CONTEXT_ICO_x16");
HTM_BR ();
HTM_Txt (Txt_Centers);
HTM_TH_End ();
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
Ico_PutIcon ("graduation-cap.svg",Ico_BLACK,
Txt_Degrees,"CONTEXT_ICO_x16");
HTM_BR ();
HTM_Txt (Txt_Degrees);
HTM_TH_End ();
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
Ico_PutIcon ("chalkboard-teacher.svg",Ico_BLACK,
Txt_Courses,"CONTEXT_ICO_x16");
HTM_BR ();
HTM_Txt (Txt_Courses);
HTM_TH_End ();
2019-10-11 15:36:50 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/****** Get and show number of elements in hierarchy with institutions *******/
/*****************************************************************************/
static void Fig_GetAndShowHierarchyWithInss (void)
{
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
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:
2020-05-03 20:58:03 +02:00
NumCtysWithInss = Cty_GetCachedNumCtysWithInss ();
2019-02-12 14:46:14 +01:00
break;
case HieLvl_CTY:
case HieLvl_INS:
case HieLvl_CTR:
case HieLvl_DEG:
case HieLvl_CRS:
2019-02-12 14:46:14 +01:00
break;
default:
Err_WrongScopeExit ();
2019-02-12 14:46:14 +01:00
break;
}
/***** Write number of elements with institutions *****/
Fig_ShowHierarchyRow (Txt_With_,Txt_institutions,
The_ClassDat[Gbl.Prefs.Theme],
2019-02-12 14:46:14 +01:00
(int) NumCtysWithInss,
-1, // < 0 ==> do not show number
-1, // < 0 ==> do not show number
-1, // < 0 ==> do not show number
-1); // < 0 ==> do not show number
}
/*****************************************************************************/
/******** Get and show number of elements in hierarchy with centers **********/
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
static void Fig_GetAndShowHierarchyWithCtrs (void)
{
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_With_;
extern const char *Txt_centers;
2019-02-12 14:46:14 +01:00
unsigned NumCtysWithCtrs = 1;
unsigned NumInssWithCtrs = 1;
/***** Get number of elements with centers *****/
2019-02-12 14:46:14 +01:00
switch (Gbl.Scope.Current)
{
case HieLvl_SYS:
2020-05-03 20:58:03 +02:00
NumCtysWithCtrs = Cty_GetCachedNumCtysWithCtrs ();
/* falls through */
/* no break */
case HieLvl_CTY:
NumInssWithCtrs = Ins_GetCachedNumInssWithCtrs ();
2019-02-12 14:46:14 +01:00
break;
case HieLvl_INS:
case HieLvl_CTR:
case HieLvl_DEG:
case HieLvl_CRS:
2019-02-12 14:46:14 +01:00
break;
default:
Err_WrongScopeExit ();
2019-02-12 14:46:14 +01:00
break;
}
/***** Write number of elements with centers *****/
Fig_ShowHierarchyRow (Txt_With_,Txt_centers,
The_ClassDat[Gbl.Prefs.Theme],
2019-02-12 14:46:14 +01:00
(int) NumCtysWithCtrs,
(int) NumInssWithCtrs,
-1, // < 0 ==> do not show number
-1, // < 0 ==> do not show number
-1); // < 0 ==> do not show number
}
/*****************************************************************************/
/******** Get and show number of elements in hierarchy with degrees **********/
/*****************************************************************************/
static void Fig_GetAndShowHierarchyWithDegs (void)
{
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
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:
2020-05-03 20:58:03 +02:00
NumCtysWithDegs = Cty_GetCachedNumCtysWithDegs ();
/* falls through */
/* no break */
2019-02-12 14:46:14 +01:00
break;
case HieLvl_CTY:
NumInssWithDegs = Ins_GetCachedNumInssWithDegs ();
/* falls through */
/* no break */
case HieLvl_INS:
NumCtrsWithDegs = Ctr_GetCachedNumCtrsWithDegs ();
2019-02-12 14:46:14 +01:00
break;
case HieLvl_CTR:
case HieLvl_DEG:
case HieLvl_CRS:
2019-02-12 14:46:14 +01:00
break;
default:
Err_WrongScopeExit ();
2019-02-12 14:46:14 +01:00
break;
}
/***** Write number of elements with degrees *****/
Fig_ShowHierarchyRow (Txt_With_,Txt_degrees,
The_ClassDat[Gbl.Prefs.Theme],
2019-02-12 14:46:14 +01:00
(int) NumCtysWithDegs,
(int) NumInssWithDegs,
(int) NumCtrsWithDegs,
-1, // < 0 ==> do not show number
-1); // < 0 ==> do not show number
}
/*****************************************************************************/
/******** Get and show number of elements in hierarchy with courses **********/
/*****************************************************************************/
static void Fig_GetAndShowHierarchyWithCrss (void)
{
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
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:
2020-05-03 20:58:03 +02:00
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 ();
2019-02-12 14:46:14 +01:00
break;
case HieLvl_DEG:
case HieLvl_CRS:
2019-02-12 14:46:14 +01:00
break;
default:
Err_WrongScopeExit ();
2019-02-12 14:46:14 +01:00
break;
}
/***** Write number of elements with courses *****/
Fig_ShowHierarchyRow (Txt_With_,Txt_courses,
The_ClassDat[Gbl.Prefs.Theme],
2019-02-12 14:46:14 +01:00
(int) NumCtysWithCrss,
(int) NumInssWithCrss,
(int) NumCtrsWithCrss,
(int) NumDegsWithCrss,
-1); // < 0 ==> do not show number
}
/*****************************************************************************/
/********** Get and show number of elements in hierarchy with users **********/
/*****************************************************************************/
static void Fig_GetAndShowHierarchyWithUsrs (Rol_Role_t Role)
{
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
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;
2019-02-12 14:46:14 +01:00
/***** 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);
2019-02-12 14:46:14 +01:00
/***** Write number of elements with students *****/
Fig_ShowHierarchyRow (Txt_With_,Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN],
The_ClassDat[Gbl.Prefs.Theme],
2019-02-12 14:46:14 +01:00
(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];
2019-02-12 14:46:14 +01:00
extern const char *Txt_Total;
char *ClassTxt;
2019-02-12 14:46:14 +01:00
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:
2020-05-03 20:58:03 +02:00
NumCtysTotal = Cty_GetCachedNumCtysInSys ();
NumInssTotal = Ins_GetCachedNumInssInSys ();
NumCtrsTotal = Ctr_GetCachedNumCtrsInSys ();
NumDegsTotal = Deg_GetCachedNumDegsInSys ();
NumCrssTotal = Crs_GetCachedNumCrssInSys ();
2019-02-12 14:46:14 +01:00
break;
case HieLvl_CTY:
2020-05-03 20:58:03 +02:00
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);
2019-02-12 14:46:14 +01:00
break;
case HieLvl_INS:
2020-05-03 20:58:03 +02:00
NumCtrsTotal = Ctr_GetCachedNumCtrsInIns (Gbl.Hierarchy.Ins.InsCod);
NumDegsTotal = Deg_GetCachedNumDegsInIns (Gbl.Hierarchy.Ins.InsCod);
NumCrssTotal = Crs_GetCachedNumCrssInIns (Gbl.Hierarchy.Ins.InsCod);
2019-02-12 14:46:14 +01:00
break;
case HieLvl_CTR:
2020-05-03 20:58:03 +02:00
NumDegsTotal = Deg_GetCachedNumDegsInCtr (Gbl.Hierarchy.Ctr.CtrCod);
NumCrssTotal = Crs_GetCachedNumCrssInCtr (Gbl.Hierarchy.Ctr.CtrCod);
2019-02-12 14:46:14 +01:00
break;
case HieLvl_DEG:
2020-05-03 20:58:03 +02:00
NumCrssTotal = Crs_GetCachedNumCrssInDeg (Gbl.Hierarchy.Deg.DegCod);
2019-02-12 14:46:14 +01:00
break;
case HieLvl_CRS:
2019-02-12 14:46:14 +01:00
break;
default:
Err_WrongScopeExit ();
2019-02-12 14:46:14 +01:00
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,
2019-02-12 14:46:14 +01:00
(int) NumCtysTotal,
(int) NumInssTotal,
(int) NumCtrsTotal,
(int) NumDegsTotal,
(int) NumCrssTotal);
free (ClassTxt);
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************** 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 *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-08 22:33:19 +02:00
/***** Write text *****/
HTM_TD_Begin ("class=\"%s RM\"",ClassTxt);
HTM_Txt (Text1);
HTM_Txt (Text2);
HTM_TD_End ();
2019-02-12 14:46:14 +01:00
/***** Write number of countries *****/
Fig_ShowHierarchyCell (ClassTxt,NumCtys);
Fig_ShowHierarchyCell (ClassTxt,NumInss);
Fig_ShowHierarchyCell (ClassTxt,NumCtrs);
Fig_ShowHierarchyCell (ClassTxt,NumDegs);
Fig_ShowHierarchyCell (ClassTxt,NumCrss);
2019-02-12 14:46:14 +01:00
/***** End row *****/
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
}
static void Fig_ShowHierarchyCell (const char *ClassTxt,int Num)
{
/***** Write number *****/
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM\"",ClassTxt);
if (Num >= 0)
HTM_Unsigned ((unsigned) Num);
else // < 0 ==> do not show number
HTM_Hyphen ();
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/****************** Get and show stats about institutions ********************/
/*****************************************************************************/
static void Fig_GetAndShowInstitutionsStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_institutions;
extern const char *Txt_Institutions;
2020-04-06 23:18:02 +02:00
struct Fig_Figures Figures;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box *****/
2020-03-26 02:54:30 +01:00
Box_BoxBegin (NULL,Txt_Institutions,
NULL,NULL,
2019-02-12 14:46:14 +01:00
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);
2019-02-12 14:46:14 +01:00
/***** Institutions ordered by number of centers *****/
Fig_GetAndShowInssOrderedByNumCtrs ();
2019-02-12 14:46:14 +01:00
/***** Institutions ordered by number of degrees *****/
Fig_GetAndShowInssOrderedByNumDegs ();
2019-02-12 14:46:14 +01:00
/***** Institutions ordered by number of courses *****/
Fig_GetAndShowInssOrderedByNumCrss ();
2019-02-12 14:46:14 +01:00
/***** Institutions ordered by number of users in courses *****/
Fig_GetAndShowInssOrderedByNumUsrsInCrss ();
2019-02-12 14:46:14 +01:00
/***** Institutions ordered by number of users who claim to belong to them *****/
Fig_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem ();
2019-02-12 14:46:14 +01:00
/***** End box *****/
2019-10-25 22:48:34 +02:00
Box_BoxEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/**** Get and show stats about institutions ordered by number of centers *****/
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
static void Fig_GetAndShowInssOrderedByNumCtrs (void)
{
extern const char *Txt_Institutions_by_number_of_centers;
extern const char *Txt_Centers;
2019-02-12 14:46:14 +01:00
MYSQL_RES *mysql_res;
unsigned NumInss;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_centers,
2020-03-26 02:54:30 +01:00
NULL,NULL,
2019-02-12 14:46:14 +01:00
NULL,Box_NOT_CLOSABLE,2);
/***** Get institutions ordered by number of centers *****/
NumInss = Ins_DB_GetInssOrderedByNumCtrs (&mysql_res);
2019-02-12 14:46:14 +01:00
/***** Show institutions *****/
Fig_ShowInss (&mysql_res,NumInss,Txt_Centers);
2019-02-12 14:46:14 +01:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/**** 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;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_degrees,
NULL,NULL,
2019-02-12 14:46:14 +01:00
NULL,Box_NOT_CLOSABLE,2);
/***** Get institutions ordered by number of degrees *****/
NumInss = Ins_DB_GetInssOrderedByNumDegs (&mysql_res);
2019-02-12 14:46:14 +01:00
/***** Show institutions *****/
Fig_ShowInss (&mysql_res,NumInss,Txt_Degrees);
2019-02-12 14:46:14 +01:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/**** 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;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_courses,
NULL,NULL,
2019-02-12 14:46:14 +01:00
NULL,Box_NOT_CLOSABLE,2);
/***** Get institutions ordered by number of courses *****/
NumInss = Ins_DB_GetInssOrderedByNumCrss (&mysql_res);
2019-02-12 14:46:14 +01:00
/***** Show institutions *****/
Fig_ShowInss (&mysql_res,NumInss,Txt_Courses);
2019-02-12 14:46:14 +01:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/***** 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;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_users_in_courses,
NULL,NULL,
2019-02-12 14:46:14 +01:00
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)
{
2019-02-12 14:46:14 +01:00
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;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableBegin ("100%",Txt_Institutions_by_number_of_users_who_claim_to_belong_to_them,
2020-03-26 02:54:30 +01:00
NULL,NULL,
2019-02-12 14:46:14 +01:00
NULL,Box_NOT_CLOSABLE,2);
/***** Get institutions ordered by number of users who claim to belong to them *****/
NumInss = Ins_DB_GetInssOrderedByNumUsrsWhoClaimToBelongToThem (&mysql_res);
2019-02-12 14:46:14 +01:00
/***** Show institutions *****/
Fig_ShowInss (&mysql_res,NumInss,Txt_Users);
2019-02-12 14:46:14 +01:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/****************** Get and show stats about institutions ********************/
/*****************************************************************************/
static void Fig_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
const char *TxtFigure)
{
2019-02-22 21:47:50 +01:00
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_Institution;
unsigned NumIns;
unsigned NumOrder;
unsigned NumberLastRow;
unsigned NumberThisRow;
2021-02-11 00:58:53 +01:00
struct Ins_Instit Ins;
2019-02-12 14:46:14 +01:00
bool TRIsOpen = false;
/***** Query database *****/
if (NumInss)
{
/* Draw the classphoto/list */
switch (Gbl.Usrs.Me.ListType)
{
case Set_USR_LIST_AS_CLASS_PHOTO:
2019-02-12 14:46:14 +01:00
/***** Draw institutions as a class photo *****/
for (NumIns = 0;
NumIns < NumInss;)
{
if ((NumIns % Gbl.Usrs.ClassPhoto.Cols) == 0)
{
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-02-12 14:46:14 +01:00
TRIsOpen = true;
}
/***** Get institution data and statistic *****/
NumberThisRow = Fig_GetInsAndStat (&Ins,*mysql_res);
/***** Write link to institution *****/
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s CM\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
Ins_DrawInstitutionLogoWithLink (&Ins,40);
HTM_BR ();
HTM_Unsigned (NumberThisRow);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-02-12 14:46:14 +01:00
if ((++NumIns % Gbl.Usrs.ClassPhoto.Cols) == 0)
{
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
TRIsOpen = false;
}
}
if (TRIsOpen)
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
break;
case Set_USR_LIST_AS_LISTING:
2019-02-12 14:46:14 +01:00
/***** Draw institutions as a list *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
HTM_TH_Empty (1);
HTM_TH (1,1,Txt_Institution,"TIT_TBL_%s LM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,TxtFigure,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
for (NumIns = 1, NumOrder = 1, NumberLastRow = 0;
2019-02-12 14:46:14 +01:00
NumIns <= NumInss;
NumIns++)
{
/***** Get institution data and statistic *****/
NumberThisRow = Fig_GetInsAndStat (&Ins,*mysql_res);
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-08 22:33:19 +02:00
/***** 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 ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
NumberLastRow = NumberThisRow;
}
break;
default:
break;
}
}
}
/*****************************************************************************/
/******************** Get institution data and statistic *********************/
/*****************************************************************************/
2021-02-11 00:58:53 +01:00
static unsigned Fig_GetInsAndStat (struct Ins_Instit *Ins,MYSQL_RES *mysql_res)
2019-02-12 14:46:14 +01:00
{
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 ();
2019-02-12 14:46:14 +01:00
/***** Get statistic (row[1]) *****/
if (sscanf (row[1],"%u",&NumberThisRow) != 1)
Err_ShowErrorAndExit ("Error in statistic");
2019-02-12 14:46:14 +01:00
return NumberThisRow;
}
/*****************************************************************************/
/****************** Get and show stats about institutions ********************/
/*****************************************************************************/
static void Fig_GetAndShowDegreeTypesStats (void)
{
/***** Show statistic about number of degrees in each type of degree *****/
DegTyp_SeeDegreeTypesInStaTab ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********************* Show stats about exploration trees ********************/
/*****************************************************************************/
// TODO: add links to statistic
static void Fig_GetAndShowFileBrowsersStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_folders_and_files;
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_STAT_COURSE_FILE_ZONES[Fig_NUM_STAT_CRS_FILE_ZONES];
static const Brw_FileBrowser_t StatCrsFileZones[Fig_NUM_STAT_CRS_FILE_ZONES] =
{
Brw_ADMI_DOC_CRS,
Brw_ADMI_DOC_GRP,
Brw_ADMI_TCH_CRS,
Brw_ADMI_TCH_GRP,
Brw_ADMI_SHR_CRS,
Brw_ADMI_SHR_GRP,
Brw_ADMI_MRK_CRS,
Brw_ADMI_MRK_GRP,
Brw_ADMI_ASG_USR,
Brw_ADMI_WRK_USR,
Brw_UNKNOWN,
Brw_ADMI_BRF_USR,
};
struct Fig_SizeOfFileZones SizeOfFileZones[Fig_NUM_STAT_CRS_FILE_ZONES];
unsigned NumStat;
/***** Get sizes of all file zones *****/
for (NumStat = 0;
NumStat < Fig_NUM_STAT_CRS_FILE_ZONES;
NumStat++)
Fig_GetSizeOfFileZone (StatCrsFileZones[NumStat],
2019-02-12 14:46:14 +01:00
&SizeOfFileZones[NumStat]);
2019-10-26 02:19:42 +02:00
/***** Begin box *****/
2020-03-26 02:54:30 +01:00
Box_BoxBegin (NULL,Txt_FIGURE_TYPES[Fig_FOLDERS_AND_FILES],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_folders_and_files,Box_NOT_CLOSABLE);
/***** Write sizes of all file zones *****/
HTM_TABLE_BeginCenterPadding (2);
Fig_WriteStatsExpTreesTableHead1 ();
for (NumStat = 0;
NumStat < Fig_NUM_STAT_CRS_FILE_ZONES;
NumStat++)
Fig_WriteRowStatsFileBrowsers1 (Txt_STAT_COURSE_FILE_ZONES[NumStat],
StatCrsFileZones[NumStat],
&SizeOfFileZones[NumStat]);
HTM_TABLE_End ();
/***** Write sizes of all file zones per course *****/
HTM_TABLE_BeginCenterPadding (2);
Fig_WriteStatsExpTreesTableHead2 ();
for (NumStat = 0;
NumStat < Fig_NUM_STAT_CRS_FILE_ZONES;
NumStat++)
Fig_WriteRowStatsFileBrowsers2 (Txt_STAT_COURSE_FILE_ZONES[NumStat],
StatCrsFileZones[NumStat],
&SizeOfFileZones[NumStat]);
HTM_TABLE_End ();
/***** Write sizes of all file zones per user *****/
HTM_TABLE_BeginCenterPadding (2);
Fig_WriteStatsExpTreesTableHead3 ();
for (NumStat = 0;
NumStat < Fig_NUM_STAT_CRS_FILE_ZONES;
NumStat++)
Fig_WriteRowStatsFileBrowsers3 (Txt_STAT_COURSE_FILE_ZONES[NumStat],
StatCrsFileZones[NumStat],
&SizeOfFileZones[NumStat]);
HTM_TABLE_End ();
2019-02-12 14:46:14 +01:00
/***** End box *****/
2019-10-25 22:48:34 +02:00
Box_BoxEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/**************** Get the size of a file zone from database ******************/
/*****************************************************************************/
static void Fig_GetSizeOfFileZone (Brw_FileBrowser_t FileBrowser,
struct Fig_SizeOfFileZones *SizeOfFileZones)
2019-02-12 14:46:14 +01:00
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
/***** Get the size of a file browser *****/
/* Query database */
Brw_DB_GetSizeOfFileBrowser (&mysql_res,FileBrowser);
2019-02-12 14:46:14 +01:00
/* Get row */
row = mysql_fetch_row (mysql_res);
/* Reset default values to zero */
SizeOfFileZones->NumCrss =
SizeOfFileZones->NumUsrs = 0;
SizeOfFileZones->MaxLevels = 0;
SizeOfFileZones->NumFolders =
SizeOfFileZones->NumFiles = 0;
SizeOfFileZones->Size = 0;
2019-02-12 14:46:14 +01:00
/* Get number of courses (row[0]) */
if (row[0])
if (sscanf (row[0],"%d",&(SizeOfFileZones->NumCrss)) != 1)
Err_ShowErrorAndExit ("Error when getting number of courses.");
2019-02-12 14:46:14 +01:00
/* Get number of groups (row[1]) */
if (row[1])
if (sscanf (row[1],"%d",&(SizeOfFileZones->NumGrps)) != 1)
Err_ShowErrorAndExit ("Error when getting number of groups.");
2019-02-12 14:46:14 +01:00
/* Get number of users (row[2]) */
if (row[2])
if (sscanf (row[2],"%d",&(SizeOfFileZones->NumUsrs)) != 1)
Err_ShowErrorAndExit ("Error when getting number of users.");
2019-02-12 14:46:14 +01:00
/* Get maximum number of levels (row[3]) */
if (row[3])
if (sscanf (row[3],"%u",&(SizeOfFileZones->MaxLevels)) != 1)
Err_ShowErrorAndExit ("Error when getting maximum number of levels.");
2019-02-12 14:46:14 +01:00
/* Get number of folders (row[4]) */
if (row[4])
if (sscanf (row[4],"%lu",&(SizeOfFileZones->NumFolders)) != 1)
Err_ShowErrorAndExit ("Error when getting number of folders.");
2019-02-12 14:46:14 +01:00
/* Get number of files (row[5]) */
if (row[5])
if (sscanf (row[5],"%lu",&(SizeOfFileZones->NumFiles)) != 1)
Err_ShowErrorAndExit ("Error when getting number of files.");
2019-02-12 14:46:14 +01:00
/* Get total size (row[6]) */
if (row[6])
if (sscanf (row[6],"%llu",&(SizeOfFileZones->Size)) != 1)
Err_ShowErrorAndExit ("Error when getting toal size.");
2019-02-12 14:46:14 +01:00
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/
/*********** Write table heading for stats of exploration trees **************/
/*****************************************************************************/
static void Fig_WriteStatsExpTreesTableHead1 (void)
{
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_File_zones;
extern const char *Txt_Courses;
extern const char *Txt_Groups;
extern const char *Txt_Users;
extern const char *Txt_Max_levels;
extern const char *Txt_Folders;
extern const char *Txt_Files;
extern const char *Txt_Size;
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_File_zones,"TIT_TBL_%s LM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Courses ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Groups ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Users ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Max_levels,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Folders ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Files ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Size ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
}
static void Fig_WriteStatsExpTreesTableHead2 (void)
{
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_File_zones;
extern const char *Txt_Folders;
extern const char *Txt_Files;
extern const char *Txt_Size;
extern const char *Txt_course;
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-11 15:36:50 +02:00
HTM_TH (1,1,Txt_File_zones,"TIT_TBL_%s LM",The_Colors[Gbl.Prefs.Theme]);
2019-11-09 21:03:02 +01:00
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TxtF ("%s/",Txt_Folders);
HTM_BR ();
HTM_Txt (Txt_course);
HTM_TH_End ();
2019-11-09 21:03:02 +01:00
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TxtF ("%s/",Txt_Files);
HTM_BR ();
HTM_Txt (Txt_course);
HTM_TH_End ();
2019-11-09 21:03:02 +01:00
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TxtF ("%s/",Txt_Size);
HTM_BR ();
HTM_Txt (Txt_course);
HTM_TH_End ();
2019-10-11 15:36:50 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
}
static void Fig_WriteStatsExpTreesTableHead3 (void)
{
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_File_zones;
extern const char *Txt_Folders;
extern const char *Txt_Files;
extern const char *Txt_Size;
extern const char *Txt_user[Usr_NUM_SEXS];
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-11 15:36:50 +02:00
HTM_TH (1,1,Txt_File_zones,"TIT_TBL_%s LM",The_Colors[Gbl.Prefs.Theme]);
2019-11-09 21:03:02 +01:00
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TxtF ("%s/",Txt_Folders);
HTM_BR ();
HTM_Txt (Txt_user[Usr_SEX_UNKNOWN]);
HTM_TH_End ();
2019-11-09 21:03:02 +01:00
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TxtF ("%s/",Txt_Files);
HTM_BR ();
HTM_Txt (Txt_user[Usr_SEX_UNKNOWN]);
HTM_TH_End ();
2019-11-09 21:03:02 +01:00
HTM_TH_Begin (1,1,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TxtF ("%s/",Txt_Size);
HTM_BR ();
HTM_Txt (Txt_user[Usr_SEX_UNKNOWN]);
HTM_TH_End ();
2019-10-11 15:36:50 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/*************** Write a row of stats of exploration trees *******************/
/*****************************************************************************/
static void Fig_WriteRowStatsFileBrowsers1 (const char *NameOfFileZones,
Brw_FileBrowser_t FileZone,
struct Fig_SizeOfFileZones *SizeOfFileZones)
{
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_ClassDatStrong[The_NUM_THEMES];
2019-11-08 01:10:32 +01:00
char StrNumCrss[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
char StrNumGrps[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
char StrNumUsrs[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
2019-02-12 14:46:14 +01:00
char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1];
char *Cl;
const char *Class;
if (FileZone == Brw_UNKNOWN)
{
if (asprintf (&Cl,"%s LINE_TOP",The_ClassDatStrong[Gbl.Prefs.Theme]) < 0)
Err_NotEnoughMemoryExit ();
Class = Cl;
}
else
Class = The_ClassDat[Gbl.Prefs.Theme];
2019-02-12 14:46:14 +01:00
Fil_WriteFileSizeFull ((double) SizeOfFileZones->Size,FileSizeStr);
if (SizeOfFileZones->NumCrss == -1) // Not applicable
Str_Copy (StrNumCrss,"-",sizeof (StrNumCrss) - 1);
2019-02-12 14:46:14 +01:00
else
snprintf (StrNumCrss,sizeof (StrNumCrss),"%d",
2019-02-12 14:46:14 +01:00
SizeOfFileZones->NumCrss);
if (SizeOfFileZones->NumGrps == -1) // Not applicable
Str_Copy (StrNumGrps,"-",sizeof (StrNumGrps) - 1);
2019-02-12 14:46:14 +01:00
else
snprintf (StrNumGrps,sizeof (StrNumGrps),"%d",
2019-02-12 14:46:14 +01:00
SizeOfFileZones->NumGrps);
if (SizeOfFileZones->NumUsrs == -1) // Not applicable
Str_Copy (StrNumUsrs,"-",sizeof (StrNumUsrs) - 1);
2019-02-12 14:46:14 +01:00
else
snprintf (StrNumUsrs,sizeof (StrNumUsrs),"%d",
2019-02-12 14:46:14 +01:00
SizeOfFileZones->NumUsrs);
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LM\"",Class);
HTM_Txt (NameOfFileZones);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (StrNumCrss);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (StrNumGrps);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (StrNumUsrs);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Unsigned (SizeOfFileZones->MaxLevels);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_UnsignedLong (SizeOfFileZones->NumFolders);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_UnsignedLong (SizeOfFileZones->NumFiles);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (FileSizeStr);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
if (FileZone == Brw_UNKNOWN)
free (Cl);
2019-02-12 14:46:14 +01:00
}
static void Fig_WriteRowStatsFileBrowsers2 (const char *NameOfFileZones,
Brw_FileBrowser_t FileZone,
struct Fig_SizeOfFileZones *SizeOfFileZones)
{
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_ClassDatStrong[The_NUM_THEMES];
2019-11-08 01:10:32 +01:00
char StrNumFoldersPerCrs[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
char StrNumFilesPerCrs[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
2019-02-12 14:46:14 +01:00
char FileSizePerCrsStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1];
char *Cl;
const char *Class;
if (FileZone == Brw_UNKNOWN)
{
if (asprintf (&Cl,"%s LINE_TOP",The_ClassDatStrong[Gbl.Prefs.Theme]) < 0)
Err_NotEnoughMemoryExit ();
Class = Cl;
}
else
Class = The_ClassDat[Gbl.Prefs.Theme];
2019-02-12 14:46:14 +01:00
if (SizeOfFileZones->NumCrss == -1) // Not applicable
{
Str_Copy (StrNumFoldersPerCrs,"-",sizeof (StrNumFoldersPerCrs) - 1);
Str_Copy (StrNumFilesPerCrs ,"-",sizeof (StrNumFilesPerCrs ) - 1);
Str_Copy (FileSizePerCrsStr ,"-",sizeof (FileSizePerCrsStr ) - 1);
2019-02-12 14:46:14 +01:00
}
else
{
snprintf (StrNumFoldersPerCrs,sizeof (StrNumFoldersPerCrs),"%.1f",
2019-02-12 14:46:14 +01:00
SizeOfFileZones->NumCrss ? (double) SizeOfFileZones->NumFolders /
(double) SizeOfFileZones->NumCrss :
0.0);
snprintf (StrNumFilesPerCrs,sizeof (StrNumFilesPerCrs),"%.1f",
2019-02-12 14:46:14 +01:00
SizeOfFileZones->NumCrss ? (double) SizeOfFileZones->NumFiles /
(double) SizeOfFileZones->NumCrss :
0.0);
Fil_WriteFileSizeFull (SizeOfFileZones->NumCrss ? (double) SizeOfFileZones->Size /
(double) SizeOfFileZones->NumCrss :
0.0,
FileSizePerCrsStr);
}
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LM\"",Class);
HTM_Txt (NameOfFileZones);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (StrNumFoldersPerCrs);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (StrNumFilesPerCrs);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (FileSizePerCrsStr);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
if (FileZone == Brw_UNKNOWN)
free (Cl);
2019-02-12 14:46:14 +01:00
}
static void Fig_WriteRowStatsFileBrowsers3 (const char *NameOfFileZones,
Brw_FileBrowser_t FileZone,
struct Fig_SizeOfFileZones *SizeOfFileZones)
{
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_ClassDatStrong[The_NUM_THEMES];
2019-11-08 01:10:32 +01:00
char StrNumFoldersPerUsr[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
char StrNumFilesPerUsr[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
2019-02-12 14:46:14 +01:00
char FileSizePerUsrStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1];
char *Cl;
const char *Class;
if (FileZone == Brw_UNKNOWN)
{
if (asprintf (&Cl,"%s LINE_TOP",The_ClassDatStrong[Gbl.Prefs.Theme]) < 0)
Err_NotEnoughMemoryExit ();
Class = Cl;
}
else
Class = The_ClassDat[Gbl.Prefs.Theme];
2019-02-12 14:46:14 +01:00
if (SizeOfFileZones->NumUsrs == -1) // Not applicable
{
Str_Copy (StrNumFoldersPerUsr,"-",sizeof (StrNumFoldersPerUsr) - 1);
Str_Copy (StrNumFilesPerUsr ,"-",sizeof (StrNumFilesPerUsr ) - 1);
Str_Copy (FileSizePerUsrStr ,"-",sizeof (FileSizePerUsrStr ) - 1);
2019-02-12 14:46:14 +01:00
}
else
{
snprintf (StrNumFoldersPerUsr,sizeof (StrNumFoldersPerUsr),"%.1f",
2019-02-12 14:46:14 +01:00
SizeOfFileZones->NumUsrs ? (double) SizeOfFileZones->NumFolders /
(double) SizeOfFileZones->NumUsrs :
0.0);
snprintf (StrNumFilesPerUsr,sizeof (StrNumFilesPerUsr),"%.1f",
2019-02-12 14:46:14 +01:00
SizeOfFileZones->NumUsrs ? (double) SizeOfFileZones->NumFiles /
(double) SizeOfFileZones->NumUsrs :
0.0);
Fil_WriteFileSizeFull (SizeOfFileZones->NumUsrs ? (double) SizeOfFileZones->Size /
(double) SizeOfFileZones->NumUsrs :
0.0,
FileSizePerUsrStr);
}
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LM\"",Class);
HTM_Txt (NameOfFileZones);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (StrNumFoldersPerUsr);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (StrNumFilesPerUsr);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",Class);
HTM_Txt (FileSizePerUsrStr);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
if (FileZone == Brw_UNKNOWN)
free (Cl);
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************ Show stats about Open Educational Resources (OERs) *************/
/*****************************************************************************/
static void Fig_GetAndShowOERsStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_open_educational_resources_oer;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_License;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_private_files;
extern const char *Txt_Number_of_public_files;
2019-02-12 14:46:14 +01:00
extern const char *Txt_LICENSES[Brw_NUM_LICENSES];
Brw_License_t License;
unsigned long NumFiles[2];
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_OER],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_open_educational_resources_oer,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_License ,"TIT_TBL_%s LM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_private_files,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_public_files ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
for (License = (Brw_License_t) 0;
License <= (Brw_License_t) (Brw_NUM_LICENSES - 1);
License++)
{
Fig_GetNumberOfOERs (License,NumFiles);
2019-02-12 14:46:14 +01:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Txt_LICENSES[License]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_UnsignedLong (NumFiles[0]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_UnsignedLong (NumFiles[1]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/**************** Get the size of a file zone from database ******************/
/*****************************************************************************/
static void Fig_GetNumberOfOERs (Brw_License_t License,
unsigned long NumFiles[2])
2019-02-12 14:46:14 +01:00
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumRows = 0; // Initialized to avoid warning
unsigned NumRow;
unsigned Public;
/***** Get the size of a file browser *****/
/* Query database */
NumRows = Brw_DB_GetNumberOfPublicFiles (&mysql_res,License);
2019-02-12 14:46:14 +01:00
/* Reset values to zero */
NumFiles[0] = NumFiles[1] = 0L;
for (NumRow = 0;
NumRow < NumRows;
NumRow++)
{
/* Get row */
row = mysql_fetch_row (mysql_res);
/* Get if public (row[0]) */
Public = (row[0][0] == 'Y') ? 1 :
0;
/* Get number of files (row[1]) */
if (sscanf (row[1],"%lu",&NumFiles[Public]) != 1)
Err_ShowErrorAndExit ("Error when getting number of files.");
2019-02-12 14:46:14 +01:00
}
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
}
2020-02-20 23:48:48 +01:00
/*****************************************************************************/
/********************** Show stats about schedule items **********************/
/*****************************************************************************/
static void Fig_GetAndShowCourseProgramStats (void) // TODO: Change function from assignments to course program items
{
2020-02-24 22:47:34 +01:00
extern const char *Hlp_ANALYTICS_Figures_course_programs;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2020-02-20 23:48:48 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
2020-02-24 22:47:34 +01:00
extern const char *Txt_Number_of_BR_program_items;
extern const char *Txt_Number_of_BR_courses_with_BR_program_items;
extern const char *Txt_Average_number_BR_of_items_BR_per_course;
2020-03-06 00:11:09 +01:00
unsigned NumItems;
unsigned NumCoursesWithItems = 0;
double NumItemsPerCourse = 0.0;
2020-02-24 22:47:34 +01:00
/***** Get the number of program items from this location *****/
if ((NumItems = Prg_DB_GetNumItems (Gbl.Scope.Current)))
if ((NumCoursesWithItems = Prg_DB_GetNumCoursesWithItems (Gbl.Scope.Current)) != 0)
2020-03-06 00:11:09 +01:00
NumItemsPerCourse = (double) NumItems /
(double) NumCoursesWithItems;
2020-02-20 23:48:48 +01:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_ASSIGNMENTS],
NULL,NULL,
2020-02-24 22:47:34 +01:00
Hlp_ANALYTICS_Figures_course_programs,Box_NOT_CLOSABLE,2);
2020-02-20 23:48:48 +01:00
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Number_of_BR_program_items ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_courses_with_BR_program_items,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_number_BR_of_items_BR_per_course ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2020-02-20 23:48:48 +01:00
/***** Write number of assignments *****/
HTM_TR_Begin (NULL);
2020-02-20 23:48:48 +01:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumItems);
HTM_TD_End ();
2020-02-20 23:48:48 +01:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumCoursesWithItems);
HTM_TD_End ();
2020-02-20 23:48:48 +01:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumItemsPerCourse);
HTM_TD_End ();
2020-02-20 23:48:48 +01:00
HTM_TR_End ();
2020-02-20 23:48:48 +01:00
/***** End table and box *****/
Box_BoxTableEnd ();
}
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
/************************ Show stats about assignments ***********************/
/*****************************************************************************/
static void Fig_GetAndShowAssignmentsStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_assignments;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Number_of_BR_assignments;
extern const char *Txt_Number_of_BR_courses_with_BR_assignments;
extern const char *Txt_Average_number_BR_of_ASSIG_BR_per_course;
extern const char *Txt_Number_of_BR_notifications;
unsigned NumAssignments;
unsigned NumNotif;
unsigned NumCoursesWithAssignments = 0;
2019-11-11 00:15:44 +01:00
double NumAssignmentsPerCourse = 0.0;
2019-02-12 14:46:14 +01:00
/***** Get the number of assignments from this location *****/
if ((NumAssignments = Asg_GetNumAssignments (Gbl.Scope.Current,&NumNotif)))
if ((NumCoursesWithAssignments = Asg_DB_GetNumCoursesWithAssignments (Gbl.Scope.Current)) != 0)
2019-11-11 00:15:44 +01:00
NumAssignmentsPerCourse = (double) NumAssignments /
(double) NumCoursesWithAssignments;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_ASSIGNMENTS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_assignments,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Number_of_BR_assignments ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_courses_with_BR_assignments,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_number_BR_of_ASSIG_BR_per_course,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_notifications ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** Write number of assignments *****/
HTM_TR_Begin (NULL);
2019-10-08 22:33:19 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumAssignments);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumCoursesWithAssignments);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumAssignmentsPerCourse);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumNotif);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************************ Show figures about projects ************************/
/*****************************************************************************/
static void Fig_GetAndShowProjectsStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_projects;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Number_of_BR_projects;
extern const char *Txt_Number_of_BR_courses_with_BR_projects;
extern const char *Txt_Average_number_BR_of_projects_BR_per_course;
unsigned NumProjects;
unsigned NumCoursesWithProjects = 0;
2019-11-11 00:15:44 +01:00
double NumProjectsPerCourse = 0.0;
2019-02-12 14:46:14 +01:00
/***** Get the number of projects from this location *****/
if ((NumProjects = Prj_DB_GetNumProjects (Gbl.Scope.Current)))
if ((NumCoursesWithProjects = Prj_DB_GetNumCoursesWithProjects (Gbl.Scope.Current)) != 0)
2019-11-11 00:15:44 +01:00
NumProjectsPerCourse = (double) NumProjects /
(double) NumCoursesWithProjects;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_PROJECTS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_projects,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Number_of_BR_projects ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_courses_with_BR_projects ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_number_BR_of_projects_BR_per_course,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** Write number of projects *****/
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumProjects);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumCoursesWithProjects);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumProjectsPerCourse);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********************** Show figures about test questions ********************/
/*****************************************************************************/
static void Fig_GetAndShowTestsStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_tests;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_ClassDatStrong[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Type_of_BR_answers;
extern const char *Txt_Number_of_BR_courses_BR_with_test_BR_questions;
extern const char *Txt_Number_of_BR_courses_with_BR_exportable_BR_test_BR_questions;
extern const char *Txt_Number_BR_of_test_BR_questions;
extern const char *Txt_Average_BR_number_BR_of_test_BR_questions_BR_per_course;
extern const char *Txt_Number_of_BR_times_that_BR_questions_BR_have_been_BR_responded;
extern const char *Txt_Average_BR_number_of_BR_times_that_BR_questions_BR_have_been_BR_responded_BR_per_course;
extern const char *Txt_Average_BR_number_of_BR_times_that_BR_a_question_BR_has_been_BR_responded;
2020-06-22 19:27:23 +02:00
extern const char *Txt_Average_BR_score_BR_per_question;
extern const char *Txt_TST_STR_ANSWER_TYPES[Qst_NUM_ANS_TYPES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_Total;
Qst_AnswerType_t AnsType;
struct Qst_Stats Stats;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_TESTS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_tests,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Type_of_BR_answers ,"TIT_TBL_%s LM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_courses_BR_with_test_BR_questions ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_courses_with_BR_exportable_BR_test_BR_questions ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_BR_of_test_BR_questions ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_BR_number_BR_of_test_BR_questions_BR_per_course ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_times_that_BR_questions_BR_have_been_BR_responded ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_BR_number_of_BR_times_that_BR_questions_BR_have_been_BR_responded_BR_per_course,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_BR_number_of_BR_times_that_BR_a_question_BR_has_been_BR_responded ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_BR_score_BR_per_question ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-10-11 15:36:50 +02:00
for (AnsType = (Qst_AnswerType_t) 0;
AnsType <= (Qst_AnswerType_t) (Qst_NUM_ANS_TYPES - 1);
AnsType++)
{
/***** Get the stats about test questions from this location *****/
Qst_GetTestStats (AnsType,&Stats);
2019-10-11 15:36:50 +02:00
/***** Write stats *****/
HTM_TR_Begin (NULL);
2019-02-12 14:46:14 +01:00
HTM_TD_Begin ("class=\"%s LM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Txt_TST_STR_ANSWER_TYPES[AnsType]);
HTM_TD_End ();
2019-02-12 14:46:14 +01:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (Stats.NumCoursesWithQuestions);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_TxtF ("%u (%.1lf%%)",
Stats.NumCoursesWithPluggableQuestions,
Stats.NumCoursesWithQuestions ? (double) Stats.NumCoursesWithPluggableQuestions * 100.0 /
(double) Stats.NumCoursesWithQuestions :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (Stats.NumQsts);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (Stats.AvgQstsPerCourse);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_UnsignedLong (Stats.NumHits);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (Stats.AvgHitsPerCourse);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (Stats.AvgHitsPerQuestion);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (Stats.AvgScorePerQuestion);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-10-07 13:21:39 +02:00
/***** Get the stats about test questions from this location *****/
Qst_GetTestStats (Qst_ANS_UNKNOWN,&Stats);
2019-10-07 13:21:39 +02:00
/***** Write stats *****/
HTM_TR_Begin (NULL);
2019-02-12 14:46:14 +01:00
HTM_TD_Begin ("class=\"LM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Txt (Txt_Total);
HTM_TD_End ();
2019-02-12 14:46:14 +01:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (Stats.NumCoursesWithQuestions);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_TxtF ("%u (%.1f%%)",
Stats.NumCoursesWithPluggableQuestions,
Stats.NumCoursesWithQuestions ? (double) Stats.NumCoursesWithPluggableQuestions * 100.0 /
(double) Stats.NumCoursesWithQuestions :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (Stats.NumQsts);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Double2Decimals (Stats.AvgQstsPerCourse);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_UnsignedLong (Stats.NumHits);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Double2Decimals (Stats.AvgHitsPerCourse);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Double2Decimals (Stats.AvgHitsPerQuestion);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Double2Decimals (Stats.AvgScorePerQuestion);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
2020-04-22 03:15:04 +02:00
/*****************************************************************************/
/*************************** Show stats about exams **************************/
/*****************************************************************************/
static void Fig_GetAndShowExamsStats (void)
{
2020-05-18 15:30:06 +02:00
extern const char *Hlp_ANALYTICS_Figures_exams;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2020-04-22 03:15:04 +02:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
2020-05-18 15:30:06 +02:00
extern const char *Txt_Number_of_BR_exams;
extern const char *Txt_Number_of_BR_courses_with_BR_exams;
extern const char *Txt_Average_number_BR_of_exams_BR_per_course;
unsigned NumExams;
unsigned NumCoursesWithExams = 0;
double NumExamsPerCourse = 0.0;
/***** Get the number of exams from this location *****/
if ((NumExams = Exa_DB_GetNumExams (Gbl.Scope.Current)))
if ((NumCoursesWithExams = Exa_DB_GetNumCoursesWithExams (Gbl.Scope.Current)) != 0)
2020-05-18 15:30:06 +02:00
NumExamsPerCourse = (double) NumExams / (double) NumCoursesWithExams;
2020-04-22 03:15:04 +02:00
/***** Begin box and table *****/
2020-05-18 15:30:06 +02:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_EXAMS],
2020-04-22 03:15:04 +02:00
NULL,NULL,
2020-05-18 15:30:06 +02:00
Hlp_ANALYTICS_Figures_exams,Box_NOT_CLOSABLE,2);
2020-04-22 03:15:04 +02:00
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Number_of_BR_exams ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_courses_with_BR_exams ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_number_BR_of_exams_BR_per_course,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2020-04-22 03:15:04 +02:00
/***** Write number of exams *****/
HTM_TR_Begin (NULL);
2020-04-22 03:15:04 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumExams);
HTM_TD_End ();
2020-04-22 03:15:04 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumCoursesWithExams);
HTM_TD_End ();
2020-04-22 03:15:04 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumExamsPerCourse);
HTM_TD_End ();
2020-04-22 03:15:04 +02:00
HTM_TR_End ();
2020-04-22 03:15:04 +02:00
/***** End table and box *****/
Box_BoxTableEnd ();
}
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
/*************************** Show stats about games **************************/
/*****************************************************************************/
static void Fig_GetAndShowGamesStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_games;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Number_of_BR_games;
extern const char *Txt_Number_of_BR_courses_with_BR_games;
extern const char *Txt_Average_number_BR_of_games_BR_per_course;
unsigned NumGames;
unsigned NumCoursesWithGames = 0;
2019-11-11 00:15:44 +01:00
double NumGamesPerCourse = 0.0;
2019-02-12 14:46:14 +01:00
/***** Get the number of games from this location *****/
if ((NumGames = Gam_DB_GetNumGames (Gbl.Scope.Current)))
if ((NumCoursesWithGames = Gam_DB_GetNumCoursesWithGames (Gbl.Scope.Current)) != 0)
2019-11-11 00:15:44 +01:00
NumGamesPerCourse = (double) NumGames / (double) NumCoursesWithGames;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_GAMES],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_games,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Number_of_BR_games ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_courses_with_BR_games ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_number_BR_of_games_BR_per_course,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** Write number of games *****/
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumGames);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumCoursesWithGames);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumGamesPerCourse);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
2019-11-25 13:29:56 +01:00
/******************* Get and show number of timeline notes *******************/
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
2019-11-25 13:29:56 +01:00
static void Fig_GetAndShowTimelineActivityStats (void)
2019-02-12 14:46:14 +01:00
{
extern const char *Hlp_ANALYTICS_Figures_timeline;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_ClassDatStrong[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Type;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_posts;
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_posts_BR_per_user;
extern const char *Txt_TIMELINE_NOTE[Tml_NOT_NUM_NOTE_TYPES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_Total;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
Tml_Not_Type_t NoteType;
unsigned NumNotes;
2019-02-12 14:46:14 +01:00
unsigned NumUsrs;
unsigned NumUsrsTotal;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_TIMELINE],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_timeline,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Type ,"TIT_TBL_%s LM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_posts ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_users ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_PERCENT_of_users ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_posts_BR_per_user,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-10-11 15:36:50 +02:00
/***** Get total number of users *****/
NumUsrsTotal = Usr_GetTotalNumberOfUsers ();
2019-10-11 15:36:50 +02:00
/***** Get total number of timeline notes and users for each note type *****/
for (NoteType = (Tml_Not_Type_t) 0;
NoteType <= (Tml_Not_Type_t) (Tml_NOT_NUM_NOTE_TYPES - 1);
NoteType++)
{
/***** Get number of timeline notes and users for this type *****/
if (Tml_DB_GetNumNotesAndUsrsByType (&mysql_res,NoteType))
{
row = mysql_fetch_row (mysql_res);
/* Get number of timeline notes */
if (row[0])
if (sscanf (row[0],"%u",&NumNotes) != 1)
NumNotes = 0;
/* Get number of users */
if (row[1])
if (sscanf (row[1],"%u",&NumUsrs) != 1)
NumUsrs = 0;
}
else
{
NumNotes = 0;
NumUsrs = 0;
}
2019-02-12 14:46:14 +01:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
/***** Write number of timeline notes and number of users *****/
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"%s LM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Txt_TIMELINE_NOTE[NoteType]);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumNotes);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumUsrs ? (double) NumNotes /
(double) NumUsrs :
0.0);
HTM_TD_End ();
HTM_TR_End ();
}
/***** Get and write totals *****/
if (Tml_DB_GetNumNotesAndUsrsTotal (&mysql_res))
2019-02-12 14:46:14 +01:00
{
/* Get number of social notes and number of users */
2019-02-12 14:46:14 +01:00
row = mysql_fetch_row (mysql_res);
/* Get number of social notes */
if (row[0])
if (sscanf (row[0],"%u",&NumNotes) != 1)
2019-11-25 13:29:56 +01:00
NumNotes = 0;
2019-02-12 14:46:14 +01:00
/* Get number of users */
if (row[1])
if (sscanf (row[1],"%u",&NumUsrs) != 1)
NumUsrs = 0;
}
else
{
NumNotes = 0;
NumUsrs = 0;
}
2019-02-12 14:46:14 +01:00
/* Free structure that stores the query result */
2019-02-12 14:46:14 +01:00
DB_FreeMySQLResult (&mysql_res);
/* Write totals */
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"LM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Txt (Txt_Total);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (NumNotes);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumUsrs ? (double) NumNotes / (double) NumUsrs :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************** Get and show number of following and followers ***************/
/*****************************************************************************/
static void Fig_GetAndShowFollowStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_followed_followers;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Users;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
extern const char *Txt_Followed;
extern const char *Txt_Followers;
extern const char *Txt_FollowPerFollow[2];
unsigned Fol;
unsigned NumUsrsTotal;
unsigned NumUsrs;
2019-11-11 00:15:44 +01:00
double Average;
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_FOLLOW],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_followed_followers,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Users ,"TIT_TBL_%s LM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_users ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_PERCENT_of_users,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** Get total number of users *****/
NumUsrsTotal = Usr_GetTotalNumberOfUsers ();
2019-02-12 14:46:14 +01:00
/***** Get total number of following/followers from database *****/
for (Fol = 0;
Fol < 2;
Fol++)
2019-02-12 14:46:14 +01:00
{
NumUsrs = Fol_DB_GetNumFollowinFollowers (Fol);
2019-02-12 14:46:14 +01:00
/***** Write number of followed / followers *****/
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Fol == 0 ? Txt_Followed :
Txt_Followers);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** Write number of followed/followers per follower/followed *****/
for (Fol = 0;
Fol < 2;
Fol++)
2019-02-12 14:46:14 +01:00
{
Average = Fol_DB_GetNumFollowedPerFollower (Fol);
2019-02-12 14:46:14 +01:00
/***** Write number of followed per follower *****/
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Txt_FollowPerFollow[Fol]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (Average);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Empty (1);
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************************** Show figures about forums ************************/
/*****************************************************************************/
static void Fig_GetAndShowForumStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_forums;
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Scope;
extern const char *Txt_Forums;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_forums;
extern const char *Txt_Number_of_threads;
extern const char *Txt_Number_of_posts;
2019-02-12 14:46:14 +01:00
extern const char *Txt_Number_of_BR_notifications;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_threads_BR_per_forum;
extern const char *Txt_Number_of_posts_BR_per_thread;
extern const char *Txt_Number_of_posts_BR_per_forum;
2019-02-12 14:46:14 +01:00
struct Fig_FiguresForum FiguresForum;
/***** Reset total stats *****/
FiguresForum.NumForums = 0;
FiguresForum.NumThreads = 0;
FiguresForum.NumPosts = 0;
FiguresForum.NumUsrsToBeNotifiedByEMail = 0;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_FORUMS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_forums,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH_Begin (1,1,"BT");
Ico_PutIcon ("comments.svg",Ico_BLACK,Txt_Scope,"ICO16x16");
HTM_TH_End ();
HTM_TH (1,1,Txt_Forums ,"LT");
HTM_TH (1,1,Txt_Number_of_forums ,"RT");
HTM_TH (1,1,Txt_Number_of_threads ,"RT");
HTM_TH (1,1,Txt_Number_of_posts ,"RT");
HTM_TH (1,1,Txt_Number_of_BR_notifications ,"RT");
HTM_TH (1,1,Txt_Number_of_threads_BR_per_forum,"RT");
HTM_TH (1,1,Txt_Number_of_posts_BR_per_thread ,"RT");
HTM_TH (1,1,Txt_Number_of_posts_BR_per_forum ,"RT");
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** Write a row for each type of forum *****/
switch (Gbl.Scope.Current)
{
case HieLvl_SYS:
Fig_ShowStatOfAForumType (For_FORUM_GLOBAL_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_GLOBAL_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM__SWAD__USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM__SWAD__TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_INSTIT_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_INSTIT_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_CENTER_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_CENTER_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,-1L,-1L,&FiguresForum);
break;
case HieLvl_CTY:
Fig_ShowStatOfAForumType (For_FORUM_INSTIT_USRS,Gbl.Hierarchy.Cty.CtyCod,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_INSTIT_TCHS,Gbl.Hierarchy.Cty.CtyCod,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_CENTER_USRS,Gbl.Hierarchy.Cty.CtyCod,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_CENTER_TCHS,Gbl.Hierarchy.Cty.CtyCod,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,Gbl.Hierarchy.Cty.CtyCod,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,Gbl.Hierarchy.Cty.CtyCod,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_USRS,Gbl.Hierarchy.Cty.CtyCod,-1L,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,Gbl.Hierarchy.Cty.CtyCod,-1L,-1L,-1L,-1L,&FiguresForum);
break;
case HieLvl_INS:
Fig_ShowStatOfAForumType (For_FORUM_INSTIT_USRS,-1L,Gbl.Hierarchy.Ins.InsCod,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_INSTIT_TCHS,-1L,Gbl.Hierarchy.Ins.InsCod,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_CENTER_USRS,-1L,Gbl.Hierarchy.Ins.InsCod,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_CENTER_TCHS,-1L,Gbl.Hierarchy.Ins.InsCod,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,Gbl.Hierarchy.Ins.InsCod,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,-1L,Gbl.Hierarchy.Ins.InsCod,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,Gbl.Hierarchy.Ins.InsCod,-1L,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,Gbl.Hierarchy.Ins.InsCod,-1L,-1L,-1L,&FiguresForum);
break;
case HieLvl_CTR:
Fig_ShowStatOfAForumType (For_FORUM_CENTER_USRS,-1L,-1L,Gbl.Hierarchy.Ctr.CtrCod,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_CENTER_TCHS,-1L,-1L,Gbl.Hierarchy.Ctr.CtrCod,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,-1L,Gbl.Hierarchy.Ctr.CtrCod,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,-1L,-1L,Gbl.Hierarchy.Ctr.CtrCod,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,Gbl.Hierarchy.Ctr.CtrCod,-1L,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,Gbl.Hierarchy.Ctr.CtrCod,-1L,-1L,&FiguresForum);
break;
case HieLvl_DEG:
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,-1L,-1L,Gbl.Hierarchy.Deg.DegCod,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,-1L,-1L,-1L,Gbl.Hierarchy.Deg.DegCod,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,Gbl.Hierarchy.Deg.DegCod,-1L,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,Gbl.Hierarchy.Deg.DegCod,-1L,&FiguresForum);
break;
case HieLvl_CRS:
Fig_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Crs.CrsCod,&FiguresForum);
Fig_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Crs.CrsCod,&FiguresForum);
break;
default:
Err_WrongScopeExit ();
break;
}
2019-02-12 14:46:14 +01:00
Fig_WriteForumTotalStats (&FiguresForum);
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************************* Show stats of a forum type ************************/
/*****************************************************************************/
static void Fig_ShowStatOfAForumType (For_ForumType_t ForumType,
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
struct Fig_FiguresForum *FiguresForum)
{
extern const char *Txt_Courses;
extern const char *Txt_Degrees;
extern const char *Txt_Centers;
2019-02-12 14:46:14 +01:00
extern const char *Txt_Institutions;
extern const char *Txt_General;
extern const char *Txt_only_teachers;
static const char *PlatformShortName = Cfg_PLATFORM_SHORT_NAME;
static const char *EmptyName = "";
static const struct
2019-02-12 14:46:14 +01:00
{
const char *Icon;
const char **ForumName1;
const char **ForumName2;
} Params[For_NUM_TYPES_FORUM] =
{
[For_FORUM_COURSE_USRS] = {"chalkboard-teacher.svg",&Txt_Courses ,&EmptyName },
[For_FORUM_COURSE_TCHS] = {"chalkboard-teacher.svg",&Txt_Courses ,&Txt_only_teachers},
[For_FORUM_DEGREE_USRS] = {"graduation-cap.svg" ,&Txt_Degrees ,&EmptyName },
[For_FORUM_DEGREE_TCHS] = {"graduation-cap.svg" ,&Txt_Degrees ,&Txt_only_teachers},
[For_FORUM_CENTER_USRS] = {"building.svg" ,&Txt_Centers ,&EmptyName },
[For_FORUM_CENTER_TCHS] = {"building.svg" ,&Txt_Centers ,&Txt_only_teachers},
[For_FORUM_INSTIT_USRS] = {"university.svg" ,&Txt_Institutions ,&EmptyName },
[For_FORUM_INSTIT_TCHS] = {"university.svg" ,&Txt_Institutions ,&Txt_only_teachers},
[For_FORUM_GLOBAL_USRS] = {"comments.svg" ,&Txt_General ,&EmptyName },
[For_FORUM_GLOBAL_TCHS] = {"comments.svg" ,&Txt_General ,&Txt_only_teachers},
[For_FORUM__SWAD__USRS] = {"swad64x64.png" ,&PlatformShortName,&EmptyName },
[For_FORUM__SWAD__TCHS] = {"swad64x64.png" ,&PlatformShortName,&Txt_only_teachers},
};
if (Params[ForumType].Icon)
Fig_WriteForumTitleAndStats (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod,
Params[ForumType].Icon,FiguresForum,
*Params[ForumType].ForumName1,
*Params[ForumType].ForumName2);
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/******************* Write title and stats of a forum type *******************/
/*****************************************************************************/
static void Fig_WriteForumTitleAndStats (For_ForumType_t ForumType,
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
const char *Icon,struct Fig_FiguresForum *FiguresForum,
const char *ForumName1,const char *ForumName2)
{
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
unsigned NumForums;
unsigned NumThreads;
unsigned NumPosts;
unsigned NumUsrsToBeNotifiedByEMail;
2019-11-11 00:15:44 +01:00
double NumThrsPerForum;
double NumPostsPerThread;
double NumPostsPerForum;
2019-10-30 22:31:03 +01:00
char *ForumName;
2019-02-12 14:46:14 +01:00
/***** Compute number of forums, number of threads and number of posts *****/
NumForums = For_DB_GetNumTotalForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod);
NumThreads = For_DB_GetNumTotalThrsInForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod);
NumPosts = For_DB_GetNumTotalPstsInForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod,&NumUsrsToBeNotifiedByEMail);
2019-02-12 14:46:14 +01:00
/***** Compute number of threads per forum, number of posts per forum and number of posts per thread *****/
2019-11-11 00:15:44 +01:00
NumThrsPerForum = (NumForums ? (double) NumThreads / (double) NumForums :
2019-02-12 14:46:14 +01:00
0.0);
2019-11-11 00:15:44 +01:00
NumPostsPerThread = (NumThreads ? (double) NumPosts / (double) NumThreads :
2019-02-12 14:46:14 +01:00
0.0);
2019-11-11 00:15:44 +01:00
NumPostsPerForum = (NumForums ? (double) NumPosts / (double) NumForums :
2019-02-12 14:46:14 +01:00
0.0);
/***** Update total stats *****/
FiguresForum->NumForums += NumForums;
FiguresForum->NumThreads += NumThreads;
FiguresForum->NumPosts += NumPosts;
FiguresForum->NumUsrsToBeNotifiedByEMail += NumUsrsToBeNotifiedByEMail;
/***** Write forum name and stats *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"BT\"");
if (asprintf (&ForumName,"%s%s",
ForumName1,ForumName2) < 0)
Err_NotEnoughMemoryExit ();
Ico_PutIcon (Icon,Ico_BLACK,ForumName,"ICO16x16");
free (ForumName);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LT\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (ForumName1);
HTM_Txt (ForumName2);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RT\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumForums);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RT\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumThreads);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RT\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumPosts);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RT\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrsToBeNotifiedByEMail);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RT\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumThrsPerForum);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RT\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumPostsPerThread);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RT\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumPostsPerForum);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/******************* Write title and stats of a forum type *******************/
/*****************************************************************************/
static void Fig_WriteForumTotalStats (struct Fig_FiguresForum *FiguresForum)
{
extern const char *The_ClassDatStrong[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_Total;
2019-11-11 00:15:44 +01:00
double NumThrsPerForum;
double NumPostsPerThread;
double NumPostsPerForum;
2019-02-12 14:46:14 +01:00
/***** Compute number of threads per forum, number of posts per forum and number of posts per thread *****/
2019-11-11 00:15:44 +01:00
NumThrsPerForum = (FiguresForum->NumForums ? (double) FiguresForum->NumThreads /
(double) FiguresForum->NumForums :
0.0);
NumPostsPerThread = (FiguresForum->NumThreads ? (double) FiguresForum->NumPosts /
(double) FiguresForum->NumThreads :
0.0);
NumPostsPerForum = (FiguresForum->NumForums ? (double) FiguresForum->NumPosts /
(double) FiguresForum->NumForums :
2019-02-12 14:46:14 +01:00
0.0);
/***** Write forum name and stats *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LINE_TOP\" style=\"width:20px;\"",
The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"LM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Txt (Txt_Total);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (FiguresForum->NumForums);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (FiguresForum->NumThreads);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (FiguresForum->NumPosts);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP RM\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (FiguresForum->NumUsrsToBeNotifiedByEMail);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumThrsPerForum);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumPostsPerThread);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumPostsPerForum);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/****** Get and show number of users who want to be notified by email ********/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerNotifyEvent (void)
{
extern const char *Hlp_ANALYTICS_Figures_notifications;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_ClassDatStrong[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Event;
extern const char *Txt_NOTIFY_EVENTS_PLURAL[Ntf_NUM_NOTIFY_EVENTS];
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
extern const char *Txt_Number_of_events;
extern const char *Txt_Number_of_emails;
2019-02-12 14:46:14 +01:00
extern const char *Txt_Total;
Ntf_NotifyEvent_t NotifyEvent;
char *SubQuery;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumUsrsTotal;
unsigned NumUsrsTotalWhoWantToBeNotifiedByEMailAboutSomeEvent;
unsigned NumUsrs[Ntf_NUM_NOTIFY_EVENTS];
unsigned NumEventsTotal = 0;
unsigned NumEvents[Ntf_NUM_NOTIFY_EVENTS];
unsigned NumMailsTotal = 0;
unsigned NumMails[Ntf_NUM_NOTIFY_EVENTS];
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_NOTIFY_EVENTS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_notifications,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Event ,"LM");
HTM_TH (1,1,Txt_Number_of_users ,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users,"RM");
HTM_TH (1,1,Txt_Number_of_events,"RM");
HTM_TH (1,1,Txt_Number_of_emails,"RM");
HTM_TR_End ();
2019-10-11 15:36:50 +02:00
/***** Get total number of users *****/
NumUsrsTotal = Usr_GetTotalNumberOfUsers ();
2019-10-11 15:36:50 +02:00
/***** Get total number of users who want to be
notified by email on some event, from database *****/
NumUsrsTotalWhoWantToBeNotifiedByEMailAboutSomeEvent =
Usr_DB_GetNumUsrsWhoChoseAnOption ("usr_data.EmailNtfEvents<>0");
2019-02-12 14:46:14 +01:00
/***** For each notify event... *****/
for (NotifyEvent = (Ntf_NotifyEvent_t) 1;
NotifyEvent <= (Ntf_NotifyEvent_t) (Ntf_NUM_NOTIFY_EVENTS - 1);
NotifyEvent++) // 0 is reserved for Ntf_EVENT_UNKNOWN
{
/* Get the number of users who want to be notified by email on this event, from database */
if (asprintf (&SubQuery,"((usr_data.EmailNtfEvents & %u)<>0)",
(1 << NotifyEvent)) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[NotifyEvent] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
2019-02-12 14:46:14 +01:00
/* Get number of notifications by email from database */
if (Ntf_DB_GetNumNotifs (&mysql_res,NotifyEvent))
{
row = mysql_fetch_row (mysql_res);
2019-02-12 14:46:14 +01:00
/* Get number of events notified */
if (row[0])
{
if (sscanf (row[0],"%u",&NumEvents[NotifyEvent]) != 1)
Err_ShowErrorAndExit ("Error when getting the number of notifications by email.");
}
else
NumEvents[NotifyEvent] = 0;
2019-02-12 14:46:14 +01:00
/* Get number of mails sent */
if (row[1])
{
if (sscanf (row[1],"%u",&NumMails[NotifyEvent]) != 1)
Err_ShowErrorAndExit ("Error when getting the number of emails to notify events3.");
}
else
NumMails[NotifyEvent] = 0;
}
else
{
NumEvents[NotifyEvent] = 0;
NumMails[NotifyEvent] = 0;
}
2019-02-12 14:46:14 +01:00
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
2019-02-12 14:46:14 +01:00
/* Update total number of events and mails */
NumEventsTotal += NumEvents[NotifyEvent];
NumMailsTotal += NumMails [NotifyEvent];
}
2019-02-12 14:46:14 +01:00
/***** Write number of users who want to be notified by email on each event *****/
for (NotifyEvent = (Ntf_NotifyEvent_t) 1;
NotifyEvent <= (Ntf_NotifyEvent_t) (Ntf_NUM_NOTIFY_EVENTS - 1);
NotifyEvent++) // 0 is reserved for Ntf_EVENT_UNKNOWN
{
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Txt_NOTIFY_EVENTS_PLURAL[NotifyEvent]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[NotifyEvent]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[NotifyEvent] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumEvents[NotifyEvent]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumMails[NotifyEvent]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** Write total number of users who want to be notified by email on some event *****/
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"LM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Txt (Txt_Total);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrsTotalWhoWantToBeNotifiedByEMailAboutSomeEvent);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrsTotalWhoWantToBeNotifiedByEMailAboutSomeEvent * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (NumEventsTotal);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s LINE_TOP\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (NumMailsTotal);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************************** Show figures about notices ***********************/
/*****************************************************************************/
static void Fig_GetAndShowNoticesStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_notices;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_ClassDatStrong[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_NOTICE_Active_BR_notices;
extern const char *Txt_NOTICE_Obsolete_BR_notices;
extern const char *Txt_NOTICE_Deleted_BR_notices;
extern const char *Txt_Total;
extern const char *Txt_Number_of_BR_notifications;
Not_Status_t NoticeStatus;
unsigned NumNotices[Not_NUM_STATUS];
unsigned NumNoticesDeleted;
unsigned NumTotalNotices = 0;
unsigned NumNotif;
unsigned NumTotalNotifications = 0;
/***** Get the number of notices active and obsolete *****/
2019-12-15 20:02:34 +01:00
for (NoticeStatus = (Not_Status_t) 0;
NoticeStatus <= (Not_Status_t) (Not_NUM_STATUS - 1);
2019-02-12 14:46:14 +01:00
NoticeStatus++)
{
NumNotices[NoticeStatus] = Not_GetNumNotices (Gbl.Scope.Current,NoticeStatus,&NumNotif);
NumTotalNotices += NumNotices[NoticeStatus];
NumTotalNotifications += NumNotif;
}
NumNoticesDeleted = Not_GetNumNoticesDeleted (Gbl.Scope.Current,&NumNotif);
NumTotalNotices += NumNoticesDeleted;
NumTotalNotifications += NumNotif;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_NOTICES],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_notices,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_NOTICE_Active_BR_notices ,"RM");
HTM_TH (1,1,Txt_NOTICE_Obsolete_BR_notices,"RM");
HTM_TH (1,1,Txt_NOTICE_Deleted_BR_notices ,"RM");
HTM_TH (1,1,Txt_Total ,"RM");
HTM_TH (1,1,Txt_Number_of_BR_notifications,"RM");
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** Write number of notices *****/
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumNotices[Not_ACTIVE_NOTICE]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumNotices[Not_OBSOLETE_NOTICE]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumNoticesDeleted);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned ( NumTotalNotices);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumTotalNotifications);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/************************ Show figures about messages ************************/
/*****************************************************************************/
static void Fig_GetAndShowMsgsStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_messages;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_ClassDatStrong[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Messages;
extern const char *Txt_MSGS_Not_deleted;
extern const char *Txt_MSGS_Deleted;
extern const char *Txt_Total;
extern const char *Txt_Number_of_BR_notifications;
extern const char *Txt_MSGS_Sent;
extern const char *Txt_MSGS_Received;
unsigned NumMsgsSentNotDeleted,NumMsgsSentDeleted;
unsigned NumMsgsReceivedNotDeleted,NumMsgsReceivedAndDeleted;
unsigned NumMsgsReceivedAndNotified;
/***** Get the number of unique messages sent from this location *****/
NumMsgsSentNotDeleted = Msg_DB_GetNumSntMsgs (Gbl.Scope.Current,Msg_STATUS_ALL );
NumMsgsSentDeleted = Msg_DB_GetNumSntMsgs (Gbl.Scope.Current,Msg_STATUS_DELETED );
2019-02-12 14:46:14 +01:00
NumMsgsReceivedNotDeleted = Msg_DB_GetNumRcvMsgs (Gbl.Scope.Current,Msg_STATUS_ALL );
NumMsgsReceivedAndDeleted = Msg_DB_GetNumRcvMsgs (Gbl.Scope.Current,Msg_STATUS_DELETED );
NumMsgsReceivedAndNotified = Msg_DB_GetNumRcvMsgs (Gbl.Scope.Current,Msg_STATUS_NOTIFIED);
2019-02-12 14:46:14 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_MESSAGES],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_messages,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Messages ,"LM");
HTM_TH (1,1,Txt_MSGS_Not_deleted ,"RM");
HTM_TH (1,1,Txt_MSGS_Deleted ,"RM");
HTM_TH (1,1,Txt_Total ,"RM");
HTM_TH (1,1,Txt_Number_of_BR_notifications,"RM");
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** Write number of messages *****/
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"LM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Txt_MSGS_Sent);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumMsgsSentNotDeleted);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumMsgsSentDeleted);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (NumMsgsSentNotDeleted + NumMsgsSentDeleted);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Hyphen ();
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-10-04 14:42:59 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"LM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Txt_MSGS_Received);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumMsgsReceivedNotDeleted);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumMsgsReceivedAndDeleted);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
HTM_Unsigned (NumMsgsReceivedNotDeleted + NumMsgsReceivedAndDeleted);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumMsgsReceivedAndNotified);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********* Get and show number of users who have chosen a language ***********/
/*****************************************************************************/
static void Fig_GetAndShowAgendasStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_agendas;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Number_of_events;
extern const char *Txt_Number_of_users;
extern const char *Txt_PERCENT_of_users;
extern const char *Txt_Number_of_events_per_user;
unsigned NumEvents;
unsigned NumUsrs;
unsigned NumUsrsTotal;
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_AGENDAS],
NULL,NULL,
Hlp_ANALYTICS_Figures_agendas,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Number_of_events ,"RM");
HTM_TH (1,1,Txt_Number_of_users ,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users ,"RM");
HTM_TH (1,1,Txt_Number_of_events_per_user,"RM");
HTM_TR_End ();
/***** Number of agenda events *****/
NumEvents = Agd_DB_GetNumEvents (Gbl.Scope.Current);
/***** Number of users with agenda events *****/
NumUsrs = Agd_DB_GetNumUsrsWithEvents (Gbl.Scope.Current);
/***** Get total number of users in current scope *****/
NumUsrsTotal = Usr_GetTotalNumberOfUsers ();
/***** Write number of users who have chosen each language *****/
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumEvents);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 /
(double) NumUsrsTotal :
0);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumUsrs ? (double) NumEvents /
(double) NumUsrs :
0);
HTM_TD_End ();
HTM_TR_End ();
/***** End table and box *****/
Box_BoxTableEnd ();
}
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
/***************************** Show stats of surveys *************************/
/*****************************************************************************/
static void Fig_GetAndShowSurveysStats (void)
{
extern const char *Hlp_ANALYTICS_Figures_surveys;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_Colors[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Number_of_BR_surveys;
extern const char *Txt_Number_of_BR_courses_with_BR_surveys;
extern const char *Txt_Average_number_BR_of_surveys_BR_per_course;
extern const char *Txt_Average_number_BR_of_questions_BR_per_survey;
extern const char *Txt_Number_of_BR_notifications;
unsigned NumSurveys;
unsigned NumNotif;
unsigned NumCoursesWithSurveys = 0;
2019-11-11 00:15:44 +01:00
double NumSurveysPerCourse = 0.0;
double NumQstsPerSurvey = 0.0;
2019-02-12 14:46:14 +01:00
/***** Get the number of surveys and the average number of questions per survey from this location *****/
if ((NumSurveys = Svy_GetNumCrsSurveys (Gbl.Scope.Current,&NumNotif)))
{
if ((NumCoursesWithSurveys = Svy_DB_GetNumCrssWithCrsSurveys (Gbl.Scope.Current)) != 0)
2019-11-11 00:15:44 +01:00
NumSurveysPerCourse = (double) NumSurveys /
(double) NumCoursesWithSurveys;
NumQstsPerSurvey = Svy_DB_GetNumQstsPerCrsSurvey (Gbl.Scope.Current);
2019-02-12 14:46:14 +01:00
}
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_SURVEYS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_surveys,Box_NOT_CLOSABLE,2);
/***** Write table heading *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Number_of_BR_surveys ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_courses_with_BR_surveys ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_number_BR_of_surveys_BR_per_course ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Average_number_BR_of_questions_BR_per_survey,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TH (1,1,Txt_Number_of_BR_notifications ,"TIT_TBL_%s RM",The_Colors[Gbl.Prefs.Theme]);
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** Write number of surveys *****/
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumSurveys);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumCoursesWithSurveys);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumSurveysPerCourse);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Double2Decimals (NumQstsPerSurvey);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumNotif);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********** Get and show number of users who have chosen a privacy ***********/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerPrivacy (void)
{
extern const char *Hlp_ANALYTICS_Figures_privacy;
extern const char *Txt_Photo;
2019-03-22 15:21:46 +01:00
extern const char *Txt_Basic_public_profile;
extern const char *Txt_Extended_public_profile;
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_PRIVACY],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_privacy,Box_NOT_CLOSABLE,2);
/***** Privacy for photo *****/
Fig_GetAndShowNumUsrsPerPrivacyForAnObject (Txt_Photo,
"PhotoVisibility",
Pri_PHOTO_ALLOWED_VIS);
2019-02-12 14:46:14 +01:00
/***** Privacy for public profile *****/
Fig_GetAndShowNumUsrsPerPrivacyForAnObject (Txt_Basic_public_profile,
"BaPrfVisibility",
Pri_BASIC_PROFILE_ALLOWED_VIS);
Fig_GetAndShowNumUsrsPerPrivacyForAnObject (Txt_Extended_public_profile,
"ExPrfVisibility",
Pri_EXTENDED_PROFILE_ALLOWED_VIS);
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********** Get and show number of users who have chosen a privacy ***********/
/*****************************************************************************/
2019-03-22 15:21:46 +01:00
static void Fig_GetAndShowNumUsrsPerPrivacyForAnObject (const char *TxtObject,
2019-03-23 13:10:31 +01:00
const char *FieldName,
unsigned MaskAllowedVisibility)
2019-02-12 14:46:14 +01:00
{
extern const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY];
extern const char *The_ClassDat[The_NUM_THEMES];
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
extern const char *Txt_PRIVACY_OPTIONS[Pri_NUM_OPTIONS_PRIVACY];
Pri_Visibility_t Visibility;
char *SubQuery;
unsigned NumUsrs[Pri_NUM_OPTIONS_PRIVACY];
unsigned NumUsrsTotal = 0;
/***** Heading row *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
HTM_TH (1,1,TxtObject ,"LM");
HTM_TH (1,1,Txt_Number_of_users ,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users,"RM");
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** For each privacy option... *****/
2019-12-15 20:02:34 +01:00
for (Visibility = (Pri_Visibility_t) 0;
Visibility <= (Pri_Visibility_t) (Pri_NUM_OPTIONS_PRIVACY - 1);
2019-02-12 14:46:14 +01:00
Visibility++)
2019-03-23 13:10:31 +01:00
if (MaskAllowedVisibility & (1 << Visibility))
{
/* Get the number of users who have chosen this privacy option from database */
if (asprintf (&SubQuery,"usr_data.%s='%s'",
FieldName,Pri_VisibilityDB[Visibility]) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[Visibility] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
2019-11-06 19:45:20 +01:00
free (SubQuery);
2019-03-23 13:10:31 +01:00
/* Update total number of users */
NumUsrsTotal += NumUsrs[Visibility];
}
2019-02-12 14:46:14 +01:00
/***** Write number of users who have chosen each privacy option *****/
2019-12-15 20:02:34 +01:00
for (Visibility = (Pri_Visibility_t) 0;
Visibility <= (Pri_Visibility_t) (Pri_NUM_OPTIONS_PRIVACY - 1);
2019-02-12 14:46:14 +01:00
Visibility++)
2019-03-23 13:10:31 +01:00
if (MaskAllowedVisibility & (1 << Visibility))
2019-10-04 14:42:59 +02:00
{
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Txt_PRIVACY_OPTIONS[Visibility]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[Visibility]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Visibility] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-10-04 14:42:59 +02:00
}
2019-02-12 14:46:14 +01:00
}
2019-03-17 20:12:59 +01:00
/*****************************************************************************/
/** Get and show number of users who have chosen a preference about cookies **/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerCookies (void)
{
extern const char *Hlp_ANALYTICS_Figures_cookies;
extern const char *The_ClassDat[The_NUM_THEMES];
2019-03-17 20:12:59 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Cookies;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-03-17 20:12:59 +01:00
extern const char *Txt_PERCENT_of_users;
unsigned i;
2019-11-21 11:39:30 +01:00
static const char AcceptedInDB[2] =
2019-03-17 20:12:59 +01:00
{
2019-12-15 20:02:34 +01:00
[false] = 'N',
[true ] = 'Y'
2019-03-17 20:12:59 +01:00
};
2019-11-21 11:39:30 +01:00
static const char *AcceptedClass[2] =
2019-03-17 20:12:59 +01:00
{
2019-12-15 20:02:34 +01:00
[false] = "DAT_RED",
[true ] = "DAT_GREEN"
2019-03-17 20:12:59 +01:00
};
2019-11-21 11:39:30 +01:00
static const char *AcceptedSymbol[2] =
2019-03-17 20:12:59 +01:00
{
2019-12-15 20:02:34 +01:00
[false] = "&cross;",
[true ] = "&check;"
2019-03-17 20:12:59 +01:00
};
char *SubQuery;
unsigned NumUsrs[Mnu_NUM_MENUS];
unsigned NumUsrsTotal = 0;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_COOKIES],
NULL,NULL,
2019-03-17 20:12:59 +01:00
Hlp_ANALYTICS_Figures_cookies,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Cookies ,"LM");
HTM_TH (1,1,Txt_Number_of_users ,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users,"RM");
HTM_TR_End ();
2019-10-12 00:07:52 +02:00
/***** For each option... *****/
for (i = 0;
i < 2;
i++)
{
/* Get number of users who have chosen this menu from database */
if (asprintf (&SubQuery,"usr_data.ThirdPartyCookies='%c'",
AcceptedInDB[i]) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[i] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
2019-03-17 20:12:59 +01:00
/* Update total number of users */
NumUsrsTotal += NumUsrs[i];
}
2019-03-17 20:12:59 +01:00
/***** Write number of users who have chosen each option *****/
for (i = 0;
i < 2;
i++)
{
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s CM\"",AcceptedClass[i]);
HTM_Txt (AcceptedSymbol[i]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[i]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[i] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-03-17 20:12:59 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-03-17 20:12:59 +01:00
}
2019-02-12 14:46:14 +01:00
/*****************************************************************************/
/********* Get and show number of users who have chosen a language ***********/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerLanguage (void)
{
extern const char *Hlp_ANALYTICS_Figures_language;
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Language;
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
extern const char *Txt_STR_LANG_NAME[1 + Lan_NUM_LANGUAGES];
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
Lan_Language_t Lan;
char *SubQuery;
unsigned NumUsrs[1 + Lan_NUM_LANGUAGES];
unsigned NumUsrsTotal = 0;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_LANGUAGES],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_language,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Language ,"LM");
HTM_TH (1,1,Txt_Number_of_users ,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users,"RM");
HTM_TR_End ();
2019-10-12 00:07:52 +02:00
/***** For each language... *****/
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
{
/* Get the number of users who have chosen this language from database */
if (asprintf (&SubQuery,"usr_data.Language='%s'",
Lan_STR_LANG_ID[Lan]) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[Lan] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
2019-02-12 14:46:14 +01:00
/* Update total number of users */
NumUsrsTotal += NumUsrs[Lan];
}
2019-02-12 14:46:14 +01:00
/***** Write number of users who have chosen each language *****/
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
{
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s LM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Txt (Txt_STR_LANG_NAME[Lan]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[Lan]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Lan] * 100.0 /
(double) NumUsrsTotal :
0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/***** Get and show number of users who have chosen a first day of week ******/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerFirstDayOfWeek (void)
{
extern const bool Cal_DayIsValidAsFirstDayOfWeek[7];
extern const char *Hlp_ANALYTICS_Figures_calendar;
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Calendar;
2019-12-30 18:49:52 +01:00
extern const char *Txt_First_day_of_the_week_X;
2019-02-12 14:46:14 +01:00
extern const char *Txt_DAYS_SMALL[7];
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
unsigned FirstDayOfWeek;
char *SubQuery;
2019-10-30 22:31:03 +01:00
char *Icon;
char *Title;
2019-02-12 14:46:14 +01:00
unsigned NumUsrs[7]; // 7: seven days in a week
unsigned NumUsrsTotal = 0;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_FIRST_DAY_OF_WEEK],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_calendar,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Calendar,"LM");
HTM_TH (1,1,Txt_Number_of_users,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users,"RM");
HTM_TR_End ();
2019-02-12 14:46:14 +01:00
/***** For each day... *****/
for (FirstDayOfWeek = 0; // Monday
FirstDayOfWeek <= 6; // Sunday
FirstDayOfWeek++)
if (Cal_DayIsValidAsFirstDayOfWeek[FirstDayOfWeek])
{
/* Get number of users who have chosen this first day of week from database */
if (asprintf (&SubQuery,"usr_data.FirstDayOfWeek=%u",
(unsigned) FirstDayOfWeek) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[FirstDayOfWeek] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
/* Update total number of users */
NumUsrsTotal += NumUsrs[FirstDayOfWeek];
}
2019-02-12 14:46:14 +01:00
/***** Write number of users who have chosen each first day of week *****/
for (FirstDayOfWeek = 0; // Monday
FirstDayOfWeek <= 6; // Sunday
FirstDayOfWeek++)
if (Cal_DayIsValidAsFirstDayOfWeek[FirstDayOfWeek])
{
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"CM\"");
if (asprintf (&Icon,"first-day-of-week-%u.png",
FirstDayOfWeek) < 0)
Err_NotEnoughMemoryExit ();
if (asprintf (&Title,Txt_First_day_of_the_week_X,
Txt_DAYS_SMALL[FirstDayOfWeek]) < 0)
Err_NotEnoughMemoryExit ();
Ico_PutIcon (Icon,Ico_BLACK,Title,"ICO40x40");
free (Title);
free (Icon);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[FirstDayOfWeek]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[FirstDayOfWeek] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/******** Get and show number of users who have chosen a date format *********/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerDateFormat (void)
{
extern const char *Hlp_ANALYTICS_Figures_dates;
extern const char *The_ClassDat[The_NUM_THEMES];
extern const char *The_ClassDatStrong[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Format;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
unsigned Format;
char *SubQuery;
unsigned NumUsrs[Dat_NUM_OPTIONS_FORMAT];
unsigned NumUsrsTotal = 0;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_DATE_FORMAT],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_dates,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Format ,"LM");
HTM_TH (1,1,Txt_Number_of_users ,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users,"RM");
HTM_TR_End ();
2019-10-12 00:07:52 +02:00
/***** For each format... *****/
for (Format = (Dat_Format_t) 0;
Format <= (Dat_Format_t) (Dat_NUM_OPTIONS_FORMAT - 1);
Format++)
{
/* Get number of users who have chosen this date format from database */
if (asprintf (&SubQuery,"usr_data.DateFormat=%u",
(unsigned) Format) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[Format] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
2019-02-12 14:46:14 +01:00
/* Update total number of users */
NumUsrsTotal += NumUsrs[Format];
}
2019-02-12 14:46:14 +01:00
/***** Write number of users who have chosen each date format *****/
for (Format = (Dat_Format_t) 0;
Format <= (Dat_Format_t) (Dat_NUM_OPTIONS_FORMAT - 1);
Format++)
{
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"LM %s\"",The_ClassDatStrong[Gbl.Prefs.Theme]);
Dat_PutSpanDateFormat (Format);
Dat_PutScriptDateFormat (Format);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[Format]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"RM %s\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Format] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********* Get and show number of users who have chosen an icon set **********/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerIconSet (void)
{
extern const char *Hlp_ANALYTICS_Figures_icons;
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
extern const char *Ico_IconSetNames[Ico_NUM_ICON_SETS];
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Icons;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
Ico_IconSet_t IconSet;
char *SubQuery;
2019-10-30 22:31:03 +01:00
char *URL;
2019-02-12 14:46:14 +01:00
unsigned NumUsrs[Ico_NUM_ICON_SETS];
unsigned NumUsrsTotal = 0;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_ICON_SETS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_icons,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Icons ,"LM");
HTM_TH (1,1,Txt_Number_of_users ,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users,"RM");
HTM_TR_End ();
2019-10-07 13:21:39 +02:00
/***** For each icon set... *****/
for (IconSet = (Ico_IconSet_t) 0;
IconSet <= (Ico_IconSet_t) (Ico_NUM_ICON_SETS - 1);
IconSet++)
{
/* Get the number of users who have chosen this icon set from database */
if (asprintf (&SubQuery,"usr_data.IconSet='%s'",
Ico_IconSetId[IconSet]) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[IconSet] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
2019-10-07 13:21:39 +02:00
/* Update total number of users */
NumUsrsTotal += NumUsrs[IconSet];
}
2019-10-07 13:21:39 +02:00
/***** Write number of users who have chosen each icon set *****/
for (IconSet = (Ico_IconSet_t) 0;
IconSet <= (Ico_IconSet_t) (Ico_NUM_ICON_SETS - 1);
IconSet++)
{
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"LM\"");
if (asprintf (&URL,"%s/%s",
Cfg_URL_ICON_SETS_PUBLIC,Ico_IconSetId[IconSet]) < 0)
Err_NotEnoughMemoryExit ();
HTM_IMG (URL,"cog.svg",Ico_IconSetNames[IconSet],
"class=\"ICO40x40\"");
free (URL);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[IconSet]);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[IconSet] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/*********** Get and show number of users who have chosen a menu *************/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerMenu (void)
{
extern const char *Hlp_ANALYTICS_Figures_menu;
extern const char *Mnu_MenuIcons[Mnu_NUM_MENUS];
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Menu;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
extern const char *Txt_MENU_NAMES[Mnu_NUM_MENUS];
Mnu_Menu_t Menu;
char *SubQuery;
unsigned NumUsrs[Mnu_NUM_MENUS];
unsigned NumUsrsTotal = 0;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_MENUS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_menu,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,"LM",Txt_Menu);
HTM_TH (1,1,"RM",Txt_Number_of_users);
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
HTM_TR_End ();
2019-10-12 00:07:52 +02:00
/***** For each menu... *****/
for (Menu = (Mnu_Menu_t) 0;
Menu <= (Mnu_Menu_t) (Mnu_NUM_MENUS - 1);
Menu++)
{
/* Get number of users who have chosen this menu from database */
if (asprintf (&SubQuery,"usr_data.Menu=%u",
(unsigned) Menu) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[Menu] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
2019-02-12 14:46:14 +01:00
/* Update total number of users */
NumUsrsTotal += NumUsrs[Menu];
}
2019-02-12 14:46:14 +01:00
/***** Write number of users who have chosen each menu *****/
for (Menu = (Mnu_Menu_t) 0;
Menu <= (Mnu_Menu_t) (Mnu_NUM_MENUS - 1);
Menu++)
{
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"CM\"");
Ico_PutIcon (Mnu_MenuIcons[Menu],Ico_BLACK,Txt_MENU_NAMES[Menu],"ICO40x40");
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[Menu]);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Menu] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
2019-10-07 13:21:39 +02:00
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/********** Get and show number of users who have chosen a theme *************/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerTheme (void)
{
extern const char *Hlp_ANALYTICS_Figures_theme;
extern const char *The_ThemeId[The_NUM_THEMES];
extern const char *The_ThemeNames[The_NUM_THEMES];
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Theme_SKIN;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
The_Theme_t Theme;
char *SubQuery;
2019-10-30 22:31:03 +01:00
char *URL;
2019-02-12 14:46:14 +01:00
unsigned NumUsrs[The_NUM_THEMES];
unsigned NumUsrsTotal = 0;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_THEMES],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_theme,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Theme_SKIN ,"LM");
HTM_TH (1,1,Txt_Number_of_users ,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users,"RM");
HTM_TR_End ();
2019-10-07 13:21:39 +02:00
/***** For each theme... *****/
for (Theme = (The_Theme_t) 0;
Theme <= (The_Theme_t) (The_NUM_THEMES - 1);
Theme++)
{
/* Get number of users who have chosen this theme from database */
if (asprintf (&SubQuery,"usr_data.Theme='%s'",
The_ThemeId[Theme]) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[Theme] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
2019-10-07 13:21:39 +02:00
/* Update total number of users */
NumUsrsTotal += NumUsrs[Theme];
}
2019-10-07 13:21:39 +02:00
/***** Write number of users who have chosen each theme *****/
for (Theme = (The_Theme_t) 0;
Theme <= (The_Theme_t) (The_NUM_THEMES - 1);
Theme++)
{
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"CM\"");
if (asprintf (&URL,"%s/%s",
Cfg_URL_ICON_THEMES_PUBLIC,The_ThemeId[Theme]) < 0)
Err_NotEnoughMemoryExit ();
HTM_IMG (URL,"theme_32x20.gif",The_ThemeNames[Theme],
"style=\"width:40px;height:25px;\"");
free (URL);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[Theme]);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Theme] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}
/*****************************************************************************/
/***** Get and show number of users who have chosen a layout of columns ******/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerSideColumns (void)
{
extern const char *Hlp_ANALYTICS_Figures_columns;
extern const char *The_ClassDat[The_NUM_THEMES];
2019-02-12 14:46:14 +01:00
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_Columns;
2020-05-07 14:15:39 +02:00
extern const char *Txt_Number_of_users;
2019-02-12 14:46:14 +01:00
extern const char *Txt_PERCENT_of_users;
extern const char *Txt_LAYOUT_SIDE_COLUMNS[4];
2019-02-12 14:46:14 +01:00
unsigned SideCols;
char *SubQuery;
2019-10-30 22:31:03 +01:00
char *Icon;
2019-02-12 14:46:14 +01:00
unsigned NumUsrs[4];
unsigned NumUsrsTotal = 0;
2019-10-26 02:19:42 +02:00
/***** Begin box and table *****/
2020-03-26 02:54:30 +01:00
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_SIDE_COLUMNS],
NULL,NULL,
2019-02-12 14:46:14 +01:00
Hlp_ANALYTICS_Figures_columns,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
HTM_TH (1,1,Txt_Columns ,"CM");
HTM_TH (1,1,Txt_Number_of_users ,"RM");
HTM_TH (1,1,Txt_PERCENT_of_users,"RM");
HTM_TR_End ();
2019-10-07 13:21:39 +02:00
/***** For each layout of columns... *****/
for (SideCols = 0;
SideCols <= Lay_SHOW_BOTH_COLUMNS;
SideCols++)
{
/* Get the number of users who have chosen this layout of columns from database */
if (asprintf (&SubQuery,"usr_data.SideCols=%u",
SideCols) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[SideCols] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
2019-10-07 13:21:39 +02:00
/* Update total number of users */
NumUsrsTotal += NumUsrs[SideCols];
}
2019-10-07 13:21:39 +02:00
/***** Write number of users who have chosen this layout of columns *****/
for (SideCols = 0;
SideCols <= Lay_SHOW_BOTH_COLUMNS;
SideCols++)
{
HTM_TR_Begin (NULL);
2019-10-07 13:21:39 +02:00
HTM_TD_Begin ("class=\"CM\"");
if (asprintf (&Icon,"layout%u%u_32x20.gif",
SideCols >> 1,SideCols & 1) < 0)
Err_NotEnoughMemoryExit ();
HTM_IMG (Cfg_URL_ICON_PUBLIC,Icon,Txt_LAYOUT_SIDE_COLUMNS[SideCols],
"style=\"width:40px;height:25px;\"");
free (Icon);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Unsigned (NumUsrs[SideCols]);
HTM_TD_End ();
HTM_TD_Begin ("class=\"%s RM\"",The_ClassDat[Gbl.Prefs.Theme]);
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[SideCols] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
HTM_TR_End ();
}
2019-02-12 14:46:14 +01:00
/***** End table and box *****/
2019-11-25 23:18:08 +01:00
Box_BoxTableEnd ();
2019-02-12 14:46:14 +01:00
}