mirror of https://github.com/acanas/swad-core.git
Version 16.106.1
This commit is contained in:
parent
f371a32b0c
commit
eb174fc852
|
@ -188,13 +188,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.106 (2016-12-23)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.106.1 (2016-12-24)"
|
||||
#define CSS_FILE "swad16.106.css"
|
||||
#define JS_FILE "swad16.101.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 16.106.1: Dec 24, 2016 Changes in stats about preferences. (211408 lines)
|
||||
Version 16.106: Dec 23, 2016 Changes in preferences. (211407 lines)
|
||||
Version 16.105.13:Dec 23, 2016 Changes in behaviour of labels in forms. (211411 lines)
|
||||
Version 16.105.12:Dec 21, 2016 Changes in behaviour of labels in forms. (211408 lines)
|
||||
|
|
|
@ -230,10 +230,10 @@ const char *Hlp_STATS_Figures_messages = WIKI "STATS.Figur
|
|||
const char *Hlp_STATS_Figures_surveys = WIKI "STATS.Figures#surveys";
|
||||
const char *Hlp_STATS_Figures_webs_social_networks = WIKI "STATS.Figures#webs--social-networks";
|
||||
const char *Hlp_STATS_Figures_language = WIKI "STATS.Figures#language";
|
||||
const char *Hlp_STATS_Figures_calendar = WIKI "STATS.Figures#calendar";
|
||||
const char *Hlp_STATS_Figures_icons = WIKI "STATS.Figures#icons";
|
||||
const char *Hlp_STATS_Figures_theme = WIKI "STATS.Figures#theme";
|
||||
const char *Hlp_STATS_Figures_menu = WIKI "STATS.Figures#menu";
|
||||
const char *Hlp_STATS_Figures_calendar = WIKI "STATS.Figures#calendar";
|
||||
const char *Hlp_STATS_Figures_theme = WIKI "STATS.Figures#theme";
|
||||
const char *Hlp_STATS_Figures_columns = WIKI "STATS.Figures#columns";
|
||||
const char *Hlp_STATS_Figures_privacy = WIKI "STATS.Figures#privacy";
|
||||
|
||||
|
|
574
swad_statistic.c
574
swad_statistic.c
|
@ -238,10 +238,10 @@ static void Sta_GetAndShowSurveysStats (void);
|
|||
static void Sta_GetAndShowNumUsrsPerPrivacy (void);
|
||||
static void Sta_GetAndShowNumUsrsPerPrivacyForAnObject (const char *TxtObject,const char *FieldName);
|
||||
static void Sta_GetAndShowNumUsrsPerLanguage (void);
|
||||
static void Sta_GetAndShowNumUsrsPerFirstDayOfWeek (void);
|
||||
static void Sta_GetAndShowNumUsrsPerTheme (void);
|
||||
static void Sta_GetAndShowNumUsrsPerIconSet (void);
|
||||
static void Sta_GetAndShowNumUsrsPerMenu (void);
|
||||
static void Sta_GetAndShowNumUsrsPerFirstDayOfWeek (void);
|
||||
static void Sta_GetAndShowNumUsrsPerTheme (void);
|
||||
static void Sta_GetAndShowNumUsrsPerSideColumns (void);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3926,10 +3926,10 @@ void Sta_ShowFigures (void)
|
|||
Sta_GetAndShowSurveysStats, // Sta_SURVEYS
|
||||
Net_ShowWebAndSocialNetworksStats, // Sta_SOCIAL_NETWORKS
|
||||
Sta_GetAndShowNumUsrsPerLanguage, // Sta_LANGUAGES
|
||||
Sta_GetAndShowNumUsrsPerFirstDayOfWeek, // Sta_FIRST_DAY_OF_WEEK
|
||||
Sta_GetAndShowNumUsrsPerIconSet, // Sta_ICON_SETS
|
||||
Sta_GetAndShowNumUsrsPerTheme, // Sta_THEMES
|
||||
Sta_GetAndShowNumUsrsPerMenu, // Sta_MENUS
|
||||
Sta_GetAndShowNumUsrsPerFirstDayOfWeek, // Sta_FIRST_DAY_OF_WEEK
|
||||
Sta_GetAndShowNumUsrsPerTheme, // Sta_THEMES
|
||||
Sta_GetAndShowNumUsrsPerSideColumns, // Sta_SIDE_COLUMNS
|
||||
Sta_GetAndShowNumUsrsPerPrivacy, // Sta_PRIVACY
|
||||
};
|
||||
|
@ -8593,289 +8593,6 @@ static void Sta_GetAndShowNumUsrsPerLanguage (void)
|
|||
Lay_EndRoundFrameTable ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***** Get and show number of users who have chosen a first day of week ******/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Sta_GetAndShowNumUsrsPerFirstDayOfWeek (void)
|
||||
{
|
||||
extern const bool Cal_DayIsValidAsFirstDayOfWeek[7];
|
||||
extern const char *Hlp_STATS_Figures_calendar;
|
||||
extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES];
|
||||
extern const char *Txt_Calendar;
|
||||
extern const char *Txt_First_day_of_the_week;
|
||||
extern const char *Txt_DAYS_SMALL[7];
|
||||
extern const char *Txt_No_of_users;
|
||||
extern const char *Txt_PERCENT_of_users;
|
||||
unsigned FirstDayOfWeek;
|
||||
char Query[1024];
|
||||
unsigned NumUsrs[7]; // 7: seven days in a week
|
||||
unsigned NumUsrsTotal = 0;
|
||||
|
||||
/***** Start table *****/
|
||||
Lay_StartRoundFrameTable (NULL,Txt_STAT_USE_STAT_TYPES[Sta_FIRST_DAY_OF_WEEK],
|
||||
NULL,Hlp_STATS_Figures_calendar,2);
|
||||
|
||||
/***** Heading row *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<th class=\"LEFT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"</tr>",
|
||||
Txt_Calendar,
|
||||
Txt_No_of_users,
|
||||
Txt_PERCENT_of_users);
|
||||
|
||||
/***** 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 *****/
|
||||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||
" WHERE FirstDayOfWeek='%u'",
|
||||
(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentCty.Cty.CtyCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentIns.Ins.InsCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM degrees,courses,crs_usr,usr_data"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM courses,crs_usr,usr_data"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentDeg.Deg.DegCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM crs_usr,usr_data"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
default:
|
||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||
break;
|
||||
}
|
||||
NumUsrs[FirstDayOfWeek] = (unsigned) DB_QueryCOUNT (Query,"can not get the number of users who have chosen a layout");
|
||||
|
||||
/* Update total number of users */
|
||||
NumUsrsTotal += NumUsrs[FirstDayOfWeek];
|
||||
}
|
||||
|
||||
/***** Write number of users who have chosen each layout *****/
|
||||
for (FirstDayOfWeek = 0; // Monday
|
||||
FirstDayOfWeek <= 6; // Sunday
|
||||
FirstDayOfWeek++)
|
||||
if (Cal_DayIsValidAsFirstDayOfWeek[FirstDayOfWeek])
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"CENTER_MIDDLE\">"
|
||||
"<img src=\"%s/first-day-of-week-%u-64x64.png\""
|
||||
" alt=\"%s\" title=\"%s: %s\""
|
||||
" class=\"ICO40x40\" />"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%5.2f%%"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Gbl.Prefs.IconsURL,FirstDayOfWeek,
|
||||
Txt_DAYS_SMALL[FirstDayOfWeek],
|
||||
Txt_First_day_of_the_week,Txt_DAYS_SMALL[FirstDayOfWeek],
|
||||
NumUsrs[FirstDayOfWeek],
|
||||
NumUsrsTotal ? (float) NumUsrs[FirstDayOfWeek] * 100.0 /
|
||||
(float) NumUsrsTotal :
|
||||
0);
|
||||
|
||||
/***** End table *****/
|
||||
Lay_EndRoundFrameTable ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Get and show number of users who have chosen a theme *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Sta_GetAndShowNumUsrsPerTheme (void)
|
||||
{
|
||||
extern const char *Hlp_STATS_Figures_theme;
|
||||
extern const char *The_ThemeId[The_NUM_THEMES];
|
||||
extern const char *The_ThemeNames[The_NUM_THEMES];
|
||||
extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES];
|
||||
extern const char *Txt_Theme_SKIN;
|
||||
extern const char *Txt_No_of_users;
|
||||
extern const char *Txt_PERCENT_of_users;
|
||||
The_Theme_t Theme;
|
||||
char Query[1024];
|
||||
unsigned NumUsrs[The_NUM_THEMES];
|
||||
unsigned NumUsrsTotal = 0;
|
||||
|
||||
/***** Start table *****/
|
||||
Lay_StartRoundFrameTable (NULL,Txt_STAT_USE_STAT_TYPES[Sta_THEMES],
|
||||
NULL,Hlp_STATS_Figures_theme,2);
|
||||
|
||||
/***** Heading row *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<th class=\"LEFT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"</tr>",
|
||||
Txt_Theme_SKIN,
|
||||
Txt_No_of_users,
|
||||
Txt_PERCENT_of_users);
|
||||
|
||||
/***** For each theme... *****/
|
||||
for (Theme = (The_Theme_t) 0;
|
||||
Theme < The_NUM_THEMES;
|
||||
Theme++)
|
||||
{
|
||||
/***** Get number of users who have chosen this theme from database *****/
|
||||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||
" WHERE Theme='%s'",
|
||||
The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentCty.Cty.CtyCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentIns.Ins.InsCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM degrees,courses,crs_usr,usr_data"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM courses,crs_usr,usr_data"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentDeg.Deg.DegCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM crs_usr,usr_data"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
default:
|
||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||
break;
|
||||
}
|
||||
NumUsrs[Theme] = (unsigned) DB_QueryCOUNT (Query,"can not get the number of users who have chosen a theme");
|
||||
|
||||
/* Update total number of users */
|
||||
NumUsrsTotal += NumUsrs[Theme];
|
||||
}
|
||||
|
||||
/***** Write number of users who have chosen each theme *****/
|
||||
for (Theme = (The_Theme_t) 0;
|
||||
Theme < The_NUM_THEMES;
|
||||
Theme++)
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"CENTER_MIDDLE\">"
|
||||
"<img src=\"%s/%s/%s/theme_32x20.gif\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" style=\"width:40px; height:25px;\" />"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%5.2f%%"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_THEMES,The_ThemeId[Theme],
|
||||
The_ThemeNames[Theme],
|
||||
The_ThemeNames[Theme],
|
||||
NumUsrs[Theme],
|
||||
NumUsrsTotal ? (float) NumUsrs[Theme] * 100.0 /
|
||||
(float) NumUsrsTotal :
|
||||
0);
|
||||
|
||||
/***** End table *****/
|
||||
Lay_EndRoundFrameTable ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Get and show number of users who have chosen an icon set **********/
|
||||
/*****************************************************************************/
|
||||
|
@ -9159,6 +8876,289 @@ static void Sta_GetAndShowNumUsrsPerMenu (void)
|
|||
Lay_EndRoundFrameTable ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***** Get and show number of users who have chosen a first day of week ******/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Sta_GetAndShowNumUsrsPerFirstDayOfWeek (void)
|
||||
{
|
||||
extern const bool Cal_DayIsValidAsFirstDayOfWeek[7];
|
||||
extern const char *Hlp_STATS_Figures_calendar;
|
||||
extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES];
|
||||
extern const char *Txt_Calendar;
|
||||
extern const char *Txt_First_day_of_the_week;
|
||||
extern const char *Txt_DAYS_SMALL[7];
|
||||
extern const char *Txt_No_of_users;
|
||||
extern const char *Txt_PERCENT_of_users;
|
||||
unsigned FirstDayOfWeek;
|
||||
char Query[1024];
|
||||
unsigned NumUsrs[7]; // 7: seven days in a week
|
||||
unsigned NumUsrsTotal = 0;
|
||||
|
||||
/***** Start table *****/
|
||||
Lay_StartRoundFrameTable (NULL,Txt_STAT_USE_STAT_TYPES[Sta_FIRST_DAY_OF_WEEK],
|
||||
NULL,Hlp_STATS_Figures_calendar,2);
|
||||
|
||||
/***** Heading row *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<th class=\"LEFT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"</tr>",
|
||||
Txt_Calendar,
|
||||
Txt_No_of_users,
|
||||
Txt_PERCENT_of_users);
|
||||
|
||||
/***** 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 *****/
|
||||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||
" WHERE FirstDayOfWeek='%u'",
|
||||
(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentCty.Cty.CtyCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentIns.Ins.InsCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM degrees,courses,crs_usr,usr_data"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM courses,crs_usr,usr_data"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentDeg.Deg.DegCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM crs_usr,usr_data"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.FirstDayOfWeek='%u'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) FirstDayOfWeek);
|
||||
break;
|
||||
default:
|
||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||
break;
|
||||
}
|
||||
NumUsrs[FirstDayOfWeek] = (unsigned) DB_QueryCOUNT (Query,"can not get the number of users who have chosen a layout");
|
||||
|
||||
/* Update total number of users */
|
||||
NumUsrsTotal += NumUsrs[FirstDayOfWeek];
|
||||
}
|
||||
|
||||
/***** Write number of users who have chosen each layout *****/
|
||||
for (FirstDayOfWeek = 0; // Monday
|
||||
FirstDayOfWeek <= 6; // Sunday
|
||||
FirstDayOfWeek++)
|
||||
if (Cal_DayIsValidAsFirstDayOfWeek[FirstDayOfWeek])
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"CENTER_MIDDLE\">"
|
||||
"<img src=\"%s/first-day-of-week-%u-64x64.png\""
|
||||
" alt=\"%s\" title=\"%s: %s\""
|
||||
" class=\"ICO40x40\" />"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%5.2f%%"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Gbl.Prefs.IconsURL,FirstDayOfWeek,
|
||||
Txt_DAYS_SMALL[FirstDayOfWeek],
|
||||
Txt_First_day_of_the_week,Txt_DAYS_SMALL[FirstDayOfWeek],
|
||||
NumUsrs[FirstDayOfWeek],
|
||||
NumUsrsTotal ? (float) NumUsrs[FirstDayOfWeek] * 100.0 /
|
||||
(float) NumUsrsTotal :
|
||||
0);
|
||||
|
||||
/***** End table *****/
|
||||
Lay_EndRoundFrameTable ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Get and show number of users who have chosen a theme *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Sta_GetAndShowNumUsrsPerTheme (void)
|
||||
{
|
||||
extern const char *Hlp_STATS_Figures_theme;
|
||||
extern const char *The_ThemeId[The_NUM_THEMES];
|
||||
extern const char *The_ThemeNames[The_NUM_THEMES];
|
||||
extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES];
|
||||
extern const char *Txt_Theme_SKIN;
|
||||
extern const char *Txt_No_of_users;
|
||||
extern const char *Txt_PERCENT_of_users;
|
||||
The_Theme_t Theme;
|
||||
char Query[1024];
|
||||
unsigned NumUsrs[The_NUM_THEMES];
|
||||
unsigned NumUsrsTotal = 0;
|
||||
|
||||
/***** Start table *****/
|
||||
Lay_StartRoundFrameTable (NULL,Txt_STAT_USE_STAT_TYPES[Sta_THEMES],
|
||||
NULL,Hlp_STATS_Figures_theme,2);
|
||||
|
||||
/***** Heading row *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<th class=\"LEFT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"</tr>",
|
||||
Txt_Theme_SKIN,
|
||||
Txt_No_of_users,
|
||||
Txt_PERCENT_of_users);
|
||||
|
||||
/***** For each theme... *****/
|
||||
for (Theme = (The_Theme_t) 0;
|
||||
Theme < The_NUM_THEMES;
|
||||
Theme++)
|
||||
{
|
||||
/***** Get number of users who have chosen this theme from database *****/
|
||||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||
" WHERE Theme='%s'",
|
||||
The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentCty.Cty.CtyCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM centres,degrees,courses,crs_usr,usr_data"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentIns.Ins.InsCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM degrees,courses,crs_usr,usr_data"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM courses,crs_usr,usr_data"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentDeg.Deg.DegCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM crs_usr,usr_data"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.UsrCod=usr_data.UsrCod"
|
||||
" AND usr_data.Theme='%s'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,The_ThemeId[Theme]);
|
||||
break;
|
||||
default:
|
||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||
break;
|
||||
}
|
||||
NumUsrs[Theme] = (unsigned) DB_QueryCOUNT (Query,"can not get the number of users who have chosen a theme");
|
||||
|
||||
/* Update total number of users */
|
||||
NumUsrsTotal += NumUsrs[Theme];
|
||||
}
|
||||
|
||||
/***** Write number of users who have chosen each theme *****/
|
||||
for (Theme = (The_Theme_t) 0;
|
||||
Theme < The_NUM_THEMES;
|
||||
Theme++)
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"CENTER_MIDDLE\">"
|
||||
"<img src=\"%s/%s/%s/theme_32x20.gif\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" style=\"width:40px; height:25px;\" />"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%5.2f%%"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_THEMES,The_ThemeId[Theme],
|
||||
The_ThemeNames[Theme],
|
||||
The_ThemeNames[Theme],
|
||||
NumUsrs[Theme],
|
||||
NumUsrsTotal ? (float) NumUsrs[Theme] * 100.0 /
|
||||
(float) NumUsrsTotal :
|
||||
0);
|
||||
|
||||
/***** End table *****/
|
||||
Lay_EndRoundFrameTable ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***** Get and show number of users who have chosen a layout of columns ******/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -117,10 +117,10 @@ typedef enum
|
|||
Sta_SURVEYS, // Number of surveys
|
||||
Sta_SOCIAL_NETWORKS, // Number of users in social networks
|
||||
Sta_LANGUAGES, // Number of users per language
|
||||
Sta_FIRST_DAY_OF_WEEK, // Number of users per first day of week
|
||||
Sta_ICON_SETS, // Number of users per icon set
|
||||
Sta_THEMES, // Number of users per theme
|
||||
Sta_MENUS, // Number of users per menu
|
||||
Sta_FIRST_DAY_OF_WEEK, // Number of users per first day of week
|
||||
Sta_THEMES, // Number of users per theme
|
||||
Sta_SIDE_COLUMNS, // Number of users per layout of columns
|
||||
Sta_PRIVACY, // Number of users per privacity
|
||||
} Sta_FigureType_t;
|
||||
|
|
80
swad_text.c
80
swad_text.c
|
@ -39393,26 +39393,6 @@ const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES] =
|
|||
"Lingua"
|
||||
#endif
|
||||
,
|
||||
#if L==1 // Sta_FIRST_DAY_OF_WEEK
|
||||
"Calendari"
|
||||
#elif L==2
|
||||
"Kalender"
|
||||
#elif L==3
|
||||
"Calendar"
|
||||
#elif L==4
|
||||
"Calendario"
|
||||
#elif L==5
|
||||
"Calendrier"
|
||||
#elif L==6
|
||||
"Arapapaha"
|
||||
#elif L==7
|
||||
"Calendario"
|
||||
#elif L==8
|
||||
"Kalendarz"
|
||||
#elif L==9
|
||||
"Calendário"
|
||||
#endif
|
||||
,
|
||||
#if L==1 // Sta_ICON_SETS
|
||||
"Icones"
|
||||
#elif L==2
|
||||
|
@ -39433,26 +39413,6 @@ const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES] =
|
|||
"Ícones"
|
||||
#endif
|
||||
,
|
||||
#if L==1 // Sta_THEMES
|
||||
"Tema (colors)"
|
||||
#elif L==2
|
||||
"Skin"
|
||||
#elif L==3
|
||||
"Theme"
|
||||
#elif L==4
|
||||
"Tema (colores)"
|
||||
#elif L==5
|
||||
"Thème"
|
||||
#elif L==6
|
||||
"Tema (colores)" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Tema"
|
||||
#elif L==8
|
||||
"Temat"
|
||||
#elif L==9
|
||||
"Skin"
|
||||
#endif
|
||||
,
|
||||
#if L==1 // Sta_MENUS
|
||||
"Menú"
|
||||
#elif L==2
|
||||
|
@ -39473,6 +39433,46 @@ const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES] =
|
|||
"Menu"
|
||||
#endif
|
||||
,
|
||||
#if L==1 // Sta_FIRST_DAY_OF_WEEK
|
||||
"Calendari"
|
||||
#elif L==2
|
||||
"Kalender"
|
||||
#elif L==3
|
||||
"Calendar"
|
||||
#elif L==4
|
||||
"Calendario"
|
||||
#elif L==5
|
||||
"Calendrier"
|
||||
#elif L==6
|
||||
"Arapapaha"
|
||||
#elif L==7
|
||||
"Calendario"
|
||||
#elif L==8
|
||||
"Kalendarz"
|
||||
#elif L==9
|
||||
"Calendário"
|
||||
#endif
|
||||
,
|
||||
#if L==1 // Sta_THEMES
|
||||
"Tema (colors)"
|
||||
#elif L==2
|
||||
"Skin"
|
||||
#elif L==3
|
||||
"Theme"
|
||||
#elif L==4
|
||||
"Tema (colores)"
|
||||
#elif L==5
|
||||
"Thème"
|
||||
#elif L==6
|
||||
"Tema (colores)" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Tema"
|
||||
#elif L==8
|
||||
"Temat"
|
||||
#elif L==9
|
||||
"Skin"
|
||||
#endif
|
||||
,
|
||||
#if L==1 // Sta_SIDE_COLUMNS
|
||||
"Columnes"
|
||||
#elif L==2
|
||||
|
|
Loading…
Reference in New Issue