From 95764c5db3840dc41b3c3dd6b06ae68a31dacf85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 11 Sep 2016 14:28:32 +0200 Subject: [PATCH] Version 15.250.4 --- swad_changelog.h | 4 +++- swad_profile.c | 20 ++++--------------- swad_profile.h | 11 ++++++++++ swad_report.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ swad_text.c | 21 +++++++++++++++++++ 5 files changed, 91 insertions(+), 17 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 1d98d376b..9e804302a 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -135,13 +135,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.250.2 (2016-09-11)" +#define Log_PLATFORM_VERSION "SWAD 15.250.4 (2016-09-11)" #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 15.250.4: Sep 11, 2016 Time of first click in user's usage report. (204171 lines) + Version 15.250.3: Sep 11, 2016 Number of puslished files in user's usage report. (? lines) Version 15.250.2: Sep 11, 2016 Record card replaced by raw user's data in user's usage report. (204100 lines) Version 15.250.1: Sep 09, 2016 Changes in layout of user's usage report. (204056 lines) Version 15.250: Sep 09, 2016 New option to print user's usage report. (204053 lines) diff --git a/swad_profile.c b/swad_profile.c index 9334d6070..b81144bb2 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -55,16 +55,6 @@ /****************************** Internal types *******************************/ /*****************************************************************************/ -struct UsrFigures - { - time_t FirstClickTimeUTC; // 0 ==> unknown first click time of user never logged - int NumDays; // -1 ==> not applicable - long NumClicks; // -1L ==> unknown number of clicks - long NumFileViews; // -1L ==> unknown number of file views - long NumForPst; // -1L ==> unknown number of forum posts - long NumMsgSnt; // -1L ==> unknown number of messages sent - }; - /*****************************************************************************/ /************** External global variables from others modules ****************/ /*****************************************************************************/ @@ -83,8 +73,6 @@ static void Prf_RequestUserProfileWithDefaultNickname (const char *DefaultNickna static void Prf_PutLinkToUpdateAction (Act_Action_t Action,const char *EncryptedUsrCod); -static void Prf_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures); - static unsigned long Prf_GetRankingFigure (long UsrCod,const char *FieldName); static unsigned long Prf_GetNumUsrsWithFigure (const char *FieldName); static unsigned long Prf_GetRankingNumClicksPerDay (long UsrCod); @@ -356,7 +344,7 @@ void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat) extern const char *Txt_teachers_ABBREVIATION; extern const char *Txt_students_ABBREVIATION; extern const char *Txt_courses_ABBREVIATION; - extern const char *Txt_Files; + extern const char *Txt_Files_uploaded; extern const char *Txt_file; extern const char *Txt_files; extern const char *Txt_public_FILES; @@ -430,7 +418,7 @@ void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat) " style=\"background-image:url('%s/file64x64.gif');\" />" "%u %s (%u %s)" "", - Txt_Files, + Txt_Files_uploaded, Gbl.Prefs.IconsURL, NumFiles, (NumFiles == 1) ? Txt_file : @@ -440,7 +428,7 @@ void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat) /***** Get figures *****/ Prf_GetUsrFigures (UsrDat->UsrCod,&UsrFigures); - /* First click time */ + /* Time since first click */ fprintf (Gbl.F.Out,"
  • ", Txt_From_TIME, @@ -612,7 +600,7 @@ static void Prf_PutLinkToUpdateAction (Act_Action_t Action,const char *Encrypted /********************** Select values on user's figures **********************/ /*****************************************************************************/ -static void Prf_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures) +void Prf_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures) { char Query[512]; MYSQL_RES *mysql_res; diff --git a/swad_profile.h b/swad_profile.h index 29699c64b..c4b8c2695 100644 --- a/swad_profile.h +++ b/swad_profile.h @@ -35,6 +35,16 @@ /******************************** Public types *******************************/ /*****************************************************************************/ +struct UsrFigures + { + time_t FirstClickTimeUTC; // 0 ==> unknown first click time of user never logged + int NumDays; // -1 ==> not applicable + long NumClicks; // -1L ==> unknown number of clicks + long NumFileViews; // -1L ==> unknown number of file views + long NumForPst; // -1L ==> unknown number of forum posts + long NumMsgSnt; // -1L ==> unknown number of messages sent + }; + /*****************************************************************************/ /****************************** Public prototypes ****************************/ /*****************************************************************************/ @@ -50,6 +60,7 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat); void Prf_ChangeProfileVisibility (void); void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat); +void Prf_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures); void Prf_CalculateFirstClickTime (void); void Prf_CalculateNumClicks (void); void Prf_CalculateNumFileViews (void); diff --git a/swad_report.c b/swad_report.c index 6e0038c62..92561a6c4 100644 --- a/swad_report.c +++ b/swad_report.c @@ -90,9 +90,20 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) extern const char *Txt_Email; extern const char *Txt_Country; extern const char *Txt_Institution; + extern const char *Txt_From_TIME; + extern const char *Txt_day; + extern const char *Txt_days; + extern const char *Txt_Files_uploaded; + extern const char *Txt_file; + extern const char *Txt_files; + extern const char *Txt_public_FILES; unsigned NumID; char CtyName[Cty_MAX_BYTES_COUNTRY_NAME+1]; struct Institution Ins; + struct UsrFigures UsrFigures; + struct tm FirstClickTime; + unsigned NumFiles; + unsigned NumPublicFiles; /***** Start frame and table *****/ Lay_StartRoundFrame ("100%",Txt_Report_of_use_of_the_platform, @@ -139,6 +150,47 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) Txt_Institution, Ins.FullName); + /***** Get figures *****/ + Prf_GetUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&UsrFigures); + + /***** Time since first click *****/ + fprintf (Gbl.F.Out,"
  • %s: ",Txt_From_TIME); + if (UsrFigures.FirstClickTimeUTC) + { + if ((gmtime_r (&UsrFigures.FirstClickTimeUTC,&FirstClickTime)) != NULL) + { + fprintf (Gbl.F.Out,"%04d-%02d-%02d %02d:%02d:%02d UTC", + 1900 + FirstClickTime.tm_year, // year + 1 + FirstClickTime.tm_mon, // month + FirstClickTime.tm_mday, // day of the month + FirstClickTime.tm_hour, // hours + FirstClickTime.tm_min, // minutes + FirstClickTime.tm_sec); // seconds + if (UsrFigures.NumDays > 0) + fprintf (Gbl.F.Out," (%d %s)", + UsrFigures.NumDays, + (UsrFigures.NumDays == 1) ? Txt_day : + Txt_days); + } + } + else + fprintf (Gbl.F.Out,"?"); + fprintf (Gbl.F.Out,"
  • "); + + /***** Number of files currently published *****/ + if ((NumFiles = Brw_GetNumFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod))) + NumPublicFiles = Brw_GetNumPublicFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod); + else + NumPublicFiles = 0; + fprintf (Gbl.F.Out,"
  • " + "%s: %u %s (%u %s)" + "
  • ", + Txt_Files_uploaded, + NumFiles, + (NumFiles == 1) ? Txt_file : + Txt_files, + NumPublicFiles,Txt_public_FILES); + fprintf (Gbl.F.Out,""); /***** Show details of user's profile *****/ diff --git a/swad_text.c b/swad_text.c index 1748229de..2e283184a 100644 --- a/swad_text.c +++ b/swad_text.c @@ -11919,6 +11919,27 @@ const char *Txt_Files_copied = "Arquivos copiados"; #endif +const char *Txt_Files_uploaded = +#if L==1 + "Fitxers pujats"; +#elif L==2 + "Dateien hochgeladen"; +#elif L==3 + "Files uploaded"; +#elif L==4 + "Archivos subidos"; +#elif L==5 + "Fichiers téléchargés"; +#elif L==6 + "Archivos subidos"; // Okoteve traducción +#elif L==7 + "File caricati"; +#elif L==8 + "Pliki dodane"; +#elif L==9 + "Arquivos enviados"; +#endif + const char *Txt_Files_of_marks_must_contain_a_table_in_HTML_format_ = #if L==1 "Los archivos de calificaciones deben contener una tabla en formato HTML sin imágenes."