diff --git a/swad_changelog.h b/swad_changelog.h index cf8f5ca31..3e82d6bda 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -143,13 +143,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.7.3 (2016-10-03)" +#define Log_PLATFORM_VERSION "SWAD 16.7.4 (2016-10-03)" #define CSS_FILE "swad15.229.css" #define JS_FILE "swad15.238.1.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.7.4: Oct 03, 2016 Code refactoring in user's usage report. (205557 lines) Version 16.7.3: Oct 03, 2016 User's ID is removed from user's usage report. (205533 lines) Version 16.7.2: Oct 02, 2016 Change in order of hits in user's usage report. (205546 lines) Version 16.7.1: Oct 02, 2016 Fixed bugs in user's usage report. diff --git a/swad_report.c b/swad_report.c index 4a16d4608..79c7cfdc1 100644 --- a/swad_report.c +++ b/swad_report.c @@ -77,6 +77,9 @@ extern struct Globals Gbl; static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint); static void Rep_PutIconToPrintMyUsageReport (void); +static void Rep_WriteHeader (const char *StrCurrentDate); +static void Rep_WriteSectionPlatform (void); + static unsigned long Rep_GetMaxHitsPerYear (time_t FirstClickTimeUTC); static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role, time_t FirstClickTimeUTC, @@ -115,15 +118,11 @@ void Rep_PrintMyUsageReport (void) static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) { extern const char *Txt_Report; - extern const char *Txt_Report_of_use_of_PLATFORM; - extern const char *Txt_Teaching_platform; extern const char *Txt_Name; - extern const char *Txt_TAGLINE; extern const char *Txt_Personal_information; extern const char *Txt_Email; extern const char *Txt_Country; extern const char *Txt_Institution; - extern const char *Txt_URL; extern const char *Txt_Figures; extern const char *Txt_TIME_Since; extern const char *Txt_TIME_until; @@ -186,34 +185,12 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) Rep_PutIconToPrintMyUsageReport); /***** Head *****/ - sprintf (Gbl.Title,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME); - fprintf (Gbl.F.Out,"
" - "

%s

" - "

%s", - Gbl.Title, - Gbl.Usrs.Me.UsrDat.FullName); - if (StrCurrentDate[0]) - fprintf (Gbl.F.Out,", %s",StrCurrentDate); - fprintf (Gbl.F.Out,"

" - "
"); + Rep_WriteHeader (StrCurrentDate); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); /***** Platform *****/ - fprintf (Gbl.F.Out,"

%s

" - ""); + Rep_WriteSectionPlatform (); /***** Personal information *****/ fprintf (Gbl.F.Out,"

%s

" @@ -439,6 +416,61 @@ static void Rep_PutIconToPrintMyUsageReport (void) NULL); } +/*****************************************************************************/ +/******************** Write header of user's usage report ********************/ +/*****************************************************************************/ + +static void Rep_WriteHeader (const char *StrCurrentDate) + { + extern const char *Txt_Report_of_use_of_PLATFORM; + + /***** Start of header *****/ + fprintf (Gbl.F.Out,"
"); + + /***** Main title *****/ + sprintf (Gbl.Title,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME); + fprintf (Gbl.F.Out,"

%s

",Gbl.Title); + + /***** Subtitle *****/ + fprintf (Gbl.F.Out,"

%s",Gbl.Usrs.Me.UsrDat.FullName); + if (StrCurrentDate[0]) + fprintf (Gbl.F.Out,", %s",StrCurrentDate); + fprintf (Gbl.F.Out,"

"); + + /***** End of header *****/ + fprintf (Gbl.F.Out,"
"); + } + +/*****************************************************************************/ +/************* Write section for platform in user's usage report *************/ +/*****************************************************************************/ + +static void Rep_WriteSectionPlatform (void) + { + extern const char *Txt_Teaching_platform; + extern const char *Txt_Name; + extern const char *Txt_TAGLINE; + extern const char *Txt_URL; + + /***** Start of section *****/ + fprintf (Gbl.F.Out,"
" + "

%s

" + "
    ", + Txt_Teaching_platform); + + /***** Platform name *****/ + fprintf (Gbl.F.Out,"
  • %s: %s, %s
  • ", + Txt_Name, + Cfg_PLATFORM_FULL_NAME,Txt_TAGLINE); + + /***** Server URL *****/ + fprintf (Gbl.F.Out,"
  • %s: %s
  • ", + Txt_URL,Cfg_URL_SWAD_SERVER,Cfg_URL_SWAD_SERVER); + + /***** End of section *****/ + fprintf (Gbl.F.Out,"
" + "
"); + } /*****************************************************************************/ /************ Get the maximum number of hits per course-year-role ************/