mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-02 14:55:23 +02:00
Version 15.43
This commit is contained in:
parent
272cdd74cc
commit
7045feb554
|
@ -111,11 +111,12 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.42.4 (2015/11/21)"
|
#define Log_PLATFORM_VERSION "SWAD 15.43 (2015/11/21)"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 15.43: Nov 21, 2015 New figure (statistic) about first day of week. (187693 lines)
|
||||||
Version 15.42.4: Nov 21, 2015 Fixed bug when getting first day of week from IP preferences. (187535 lines)
|
Version 15.42.4: Nov 21, 2015 Fixed bug when getting first day of week from IP preferences. (187535 lines)
|
||||||
Version 15.42.3: Nov 21, 2015 Stats of hits distributed by week depend on user's preference about first day of the week. (187528 lines)
|
Version 15.42.3: Nov 21, 2015 Stats of hits distributed by week depend on user's preference about first day of the week. (187528 lines)
|
||||||
Version 15.42.2: Nov 21, 2015 Fixed bug in JavaScript code to draw months. (187524 lines)
|
Version 15.42.2: Nov 21, 2015 Fixed bug in JavaScript code to draw months. (187524 lines)
|
||||||
|
|
144
swad_statistic.c
144
swad_statistic.c
|
@ -240,6 +240,7 @@ static void Sta_GetAndShowSurveysStats (void);
|
||||||
static void Sta_GetAndShowNumUsrsPerPrivacy (void);
|
static void Sta_GetAndShowNumUsrsPerPrivacy (void);
|
||||||
static void Sta_GetAndShowNumUsrsPerPrivacyForAnObject (const char *TxtObject,const char *FieldName);
|
static void Sta_GetAndShowNumUsrsPerPrivacyForAnObject (const char *TxtObject,const char *FieldName);
|
||||||
static void Sta_GetAndShowNumUsrsPerLanguage (void);
|
static void Sta_GetAndShowNumUsrsPerLanguage (void);
|
||||||
|
static void Sta_GetAndShowNumUsrsPerFirstDayOfWeek (void);
|
||||||
static void Sta_GetAndShowNumUsrsPerLayout (void);
|
static void Sta_GetAndShowNumUsrsPerLayout (void);
|
||||||
static void Sta_GetAndShowNumUsrsPerTheme (void);
|
static void Sta_GetAndShowNumUsrsPerTheme (void);
|
||||||
static void Sta_GetAndShowNumUsrsPerIconSet (void);
|
static void Sta_GetAndShowNumUsrsPerIconSet (void);
|
||||||
|
@ -3930,6 +3931,10 @@ void Sta_ShowUseOfPlatform (void)
|
||||||
/***** Number of users who have chosen a language *****/
|
/***** Number of users who have chosen a language *****/
|
||||||
Sta_GetAndShowNumUsrsPerLanguage ();
|
Sta_GetAndShowNumUsrsPerLanguage ();
|
||||||
break;
|
break;
|
||||||
|
case Sta_FIRST_DAY_OF_WEEK:
|
||||||
|
/***** Number of users who have chosen a first day of week *****/
|
||||||
|
Sta_GetAndShowNumUsrsPerFirstDayOfWeek ();
|
||||||
|
break;
|
||||||
case Sta_LAYOUTS:
|
case Sta_LAYOUTS:
|
||||||
/***** Number of users who have chosen a layout *****/
|
/***** Number of users who have chosen a layout *****/
|
||||||
Sta_GetAndShowNumUsrsPerLayout ();
|
Sta_GetAndShowNumUsrsPerLayout ();
|
||||||
|
@ -7771,6 +7776,145 @@ static void Sta_GetAndShowNumUsrsPerLanguage (void)
|
||||||
Lay_EndRoundFrameTable ();
|
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 *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[Lay_NUM_LAYOUTS];
|
||||||
|
unsigned NumUsrsTotal = 0;
|
||||||
|
|
||||||
|
Lay_StartRoundFrameTable (NULL,2,Txt_STAT_USE_STAT_TYPES[Sta_FIRST_DAY_OF_WEEK]);
|
||||||
|
|
||||||
|
/***** 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=\"ICON32x32\" />"
|
||||||
|
"</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);
|
||||||
|
|
||||||
|
Lay_EndRoundFrameTable ();
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********* Get and show number of users who have chosen a layout *************/
|
/********* Get and show number of users who have chosen a layout *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -97,7 +97,7 @@ typedef enum
|
||||||
Sta_CLICKS_GBL_PER_COURSE = 23,
|
Sta_CLICKS_GBL_PER_COURSE = 23,
|
||||||
} Sta_ClicksGroupedBy_t;
|
} Sta_ClicksGroupedBy_t;
|
||||||
|
|
||||||
#define Sta_NUM_FIGURES 21
|
#define Sta_NUM_FIGURES 22
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Sta_USERS, // Number of users
|
Sta_USERS, // Number of users
|
||||||
|
@ -116,6 +116,7 @@ typedef enum
|
||||||
Sta_SURVEYS, // Number of surveys
|
Sta_SURVEYS, // Number of surveys
|
||||||
Sta_PRIVACY, // Number of users per privacity
|
Sta_PRIVACY, // Number of users per privacity
|
||||||
Sta_LANGUAGES, // Number of users per language
|
Sta_LANGUAGES, // Number of users per language
|
||||||
|
Sta_FIRST_DAY_OF_WEEK, // Number of users per first day of week
|
||||||
Sta_LAYOUTS, // Number of users per layout
|
Sta_LAYOUTS, // Number of users per layout
|
||||||
Sta_THEMES, // Number of users per theme
|
Sta_THEMES, // Number of users per theme
|
||||||
Sta_ICON_SETS, // Number of users per icon set
|
Sta_ICON_SETS, // Number of users per icon set
|
||||||
|
|
20
swad_text.c
20
swad_text.c
|
@ -36715,6 +36715,26 @@ const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES] =
|
||||||
"Lingua"
|
"Lingua"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
|
#if L==0 // Sta_FIRST_DAY_OF_WEEK
|
||||||
|
"Calendari"
|
||||||
|
#elif L==1
|
||||||
|
"Kalender"
|
||||||
|
#elif L==2
|
||||||
|
"Calendar"
|
||||||
|
#elif L==3
|
||||||
|
"Calendario"
|
||||||
|
#elif L==4
|
||||||
|
"Calendrier"
|
||||||
|
#elif L==5
|
||||||
|
"Arapapaha"
|
||||||
|
#elif L==6
|
||||||
|
"Calendario"
|
||||||
|
#elif L==7
|
||||||
|
"Kalendarz"
|
||||||
|
#elif L==8
|
||||||
|
"Calendário"
|
||||||
|
#endif
|
||||||
|
,
|
||||||
#if L==0 // Sta_LAYOUTS
|
#if L==0 // Sta_LAYOUTS
|
||||||
"Disseny"
|
"Disseny"
|
||||||
#elif L==1
|
#elif L==1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user