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 ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "swad_action.h"
|
2022-01-03 02:47:16 +01:00
|
|
|
|
#include "swad_agenda.h"
|
2019-02-12 14:46:14 +01:00
|
|
|
|
#include "swad_box.h"
|
2022-01-03 02:47:16 +01:00
|
|
|
|
#include "swad_calendar.h"
|
|
|
|
|
#include "swad_cookie.h"
|
|
|
|
|
#include "swad_exam.h"
|
2019-02-12 14:46:14 +01:00
|
|
|
|
#include "swad_figure.h"
|
|
|
|
|
#include "swad_follow.h"
|
|
|
|
|
#include "swad_form.h"
|
|
|
|
|
#include "swad_global.h"
|
2021-09-10 10:19:46 +02:00
|
|
|
|
#include "swad_hierarchy.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_message.h"
|
2019-02-12 14:46:14 +01:00
|
|
|
|
#include "swad_network.h"
|
|
|
|
|
#include "swad_notice.h"
|
2019-03-23 13:10:31 +01:00
|
|
|
|
#include "swad_privacy.h"
|
2020-02-24 22:47:34 +01:00
|
|
|
|
#include "swad_program.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_project.h"
|
|
|
|
|
#include "swad_survey.h"
|
|
|
|
|
#include "swad_test.h"
|
2022-01-03 02:47:16 +01:00
|
|
|
|
#include "swad_theme.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_timeline.h"
|
2019-02-12 14:46:14 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
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);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
static void Fig_PutHiddenParamScopeFig (HieLvl_Level_t ScopeFig);
|
2019-02-12 14:46:14 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** 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;
|
|
|
|
|
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 *****/
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActSeeUseGbl);
|
2019-02-12 14:46:14 +01:00
|
|
|
|
|
2021-06-17 13:26:25 +02:00
|
|
|
|
/***** Begin box *****/
|
|
|
|
|
Box_BoxBegin (NULL,Txt_Figures,
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_ANALYTICS_Figures,Box_NOT_CLOSABLE);
|
|
|
|
|
|
|
|
|
|
/***** Compute stats for anywhere, degree or course? *****/
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_LABEL_Begin ("class=\"FORM_IN_%s\"",The_GetSuffix ());
|
2021-06-17 13:26:25 +02:00
|
|
|
|
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 *****/
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_LABEL_Begin ("class=\"FORM_IN_%s\"",The_GetSuffix ());
|
2021-06-17 13:26:25 +02:00
|
|
|
|
HTM_TxtColonNBSP (Txt_Statistic);
|
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
2022-03-30 00:46:18 +02:00
|
|
|
|
"name=\"FigureType\" class=\"INPUT_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-06-17 13:26:25 +02:00
|
|
|
|
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
|
|
|
|
|
2021-06-17 13:26:25 +02: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
|
|
|
|
{
|
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) *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
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,
|
2022-06-29 18:34:15 +02:00
|
|
|
|
"chart-pie.svg",Ico_BLACK);
|
2019-02-12 14:46:14 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************* 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) ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
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
|
|
|
|
|
{
|
2021-12-31 14:51:44 +01:00
|
|
|
|
[Fig_USERS ] = Usr_GetAndShowUsersStats,
|
|
|
|
|
[Fig_USERS_RANKING ] = Usr_GetAndShowUsersRanking,
|
|
|
|
|
[Fig_HIERARCHY ] = Hie_GetAndShowHierarchyStats,
|
|
|
|
|
[Fig_INSTITS ] = Ins_GetAndShowInstitutionsStats,
|
|
|
|
|
[Fig_DEGREE_TYPES ] = DegTyp_GetAndShowDegreeTypesStats,
|
|
|
|
|
[Fig_FOLDERS_AND_FILES] = Brw_GetAndShowFileBrowsersStats,
|
|
|
|
|
[Fig_OER ] = Brw_GetAndShowOERsStats,
|
|
|
|
|
[Fig_COURSE_PROGRAMS ] = Prg_GetAndShowCourseProgramStats,
|
|
|
|
|
[Fig_ASSIGNMENTS ] = Asg_GetAndShowAssignmentsStats,
|
|
|
|
|
[Fig_PROJECTS ] = Prj_GetAndShowProjectsStats,
|
|
|
|
|
[Fig_TESTS ] = Tst_GetAndShowTestsStats,
|
|
|
|
|
[Fig_EXAMS ] = Exa_GetAndShowExamsStats,
|
|
|
|
|
[Fig_GAMES ] = Gam_GetAndShowGamesStats,
|
|
|
|
|
[Fig_SURVEYS ] = Svy_GetAndShowSurveysStats,
|
|
|
|
|
[Fig_TIMELINE ] = Tml_GetAndShowTimelineActivityStats,
|
|
|
|
|
[Fig_FOLLOW ] = Fol_GetAndShowFollowStats,
|
|
|
|
|
[Fig_FORUMS ] = For_GetAndShowForumStats,
|
|
|
|
|
[Fig_NOTIFY_EVENTS ] = Ntf_GetAndShowNumUsrsPerNotifyEvent,
|
|
|
|
|
[Fig_NOTICES ] = Not_GetAndShowNoticesStats,
|
|
|
|
|
[Fig_MESSAGES ] = Msg_GetAndShowMsgsStats,
|
|
|
|
|
[Fig_AGENDAS ] = Agd_GetAndShowAgendasStats,
|
2019-12-15 01:10:36 +01:00
|
|
|
|
[Fig_SOCIAL_NETWORKS ] = Net_ShowWebAndSocialNetworksStats,
|
2021-12-31 14:51:44 +01:00
|
|
|
|
[Fig_LANGUAGES ] = Lan_GetAndShowNumUsrsPerLanguage,
|
|
|
|
|
[Fig_FIRST_DAY_OF_WEEK] = Cal_GetAndShowNumUsrsPerFirstDayOfWeek,
|
|
|
|
|
[Fig_DATE_FORMAT ] = Dat_GetAndShowNumUsrsPerDateFormat,
|
|
|
|
|
[Fig_ICON_SETS ] = Ico_GetAndShowNumUsrsPerIconSet,
|
|
|
|
|
[Fig_MENUS ] = Mnu_GetAndShowNumUsrsPerMenu,
|
|
|
|
|
[Fig_THEMES ] = The_GetAndShowNumUsrsPerTheme,
|
|
|
|
|
[Fig_SIDE_COLUMNS ] = Lay_GetAndShowNumUsrsPerSideColumns,
|
|
|
|
|
[Fig_PHOTO_SHAPES ] = PhoSha_GetAndShowNumUsrsPerPhotoShape,
|
|
|
|
|
[Fig_PRIVACY ] = Pri_GetAndShowNumUsrsPerPrivacy,
|
|
|
|
|
[Fig_COOKIES ] = Coo_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
|
|
|
|
}
|