mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-05 00:05:23 +02:00
Version 16.10
This commit is contained in:
parent
6fa4500d7e
commit
8e8e5d4e0d
|
@ -2503,11 +2503,11 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
||||||
/* ActRemSocComGbl */{1508,-1,TabSoc,ActSeeSocPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialComUsr ,NULL},
|
/* ActRemSocComGbl */{1508,-1,TabSoc,ActSeeSocPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialComUsr ,NULL},
|
||||||
|
|
||||||
/* ActSeePubPrf */{1402,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_GetUsrDatAndShowUserProfile,NULL},
|
/* ActSeePubPrf */{1402,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_GetUsrDatAndShowUserProfile,NULL},
|
||||||
/* ActCal1stClkTim */{1405,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateFirstClickTime ,NULL},
|
/* ActCal1stClkTim */{1405,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateFigures ,NULL},
|
||||||
/* ActCalNumClk */{1406,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumClicks ,NULL},
|
/* ActCalNumClk */{1406,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateFigures ,NULL},
|
||||||
/* ActCalNumFilVie */{1409,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumFileViews ,NULL},
|
/* ActCalNumFilVie */{1409,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateFigures ,NULL},
|
||||||
/* ActCalNumForPst */{1408,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumForPst ,NULL},
|
/* ActCalNumForPst */{1408,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateFigures ,NULL},
|
||||||
/* ActCalNumMsgSnt */{1407,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumMsgSnt ,NULL},
|
/* ActCalNumMsgSnt */{1407,-1,TabSoc,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateFigures ,NULL},
|
||||||
|
|
||||||
/* ActFolUsr */{1410,-1,TabSoc,ActSeeSocPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Fol_FollowUsr ,NULL},
|
/* ActFolUsr */{1410,-1,TabSoc,ActSeeSocPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Fol_FollowUsr ,NULL},
|
||||||
/* ActUnfUsr */{1411,-1,TabSoc,ActSeeSocPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Fol_UnfollowUsr ,NULL},
|
/* ActUnfUsr */{1411,-1,TabSoc,ActSeeSocPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Fol_UnfollowUsr ,NULL},
|
||||||
|
|
|
@ -143,13 +143,15 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.9 (2016-10-03)"
|
#define Log_PLATFORM_VERSION "SWAD 16.10 (2016-10-03)"
|
||||||
#define CSS_FILE "swad15.229.css"
|
#define CSS_FILE "swad15.229.css"
|
||||||
#define JS_FILE "swad15.238.1.js"
|
#define JS_FILE "swad15.238.1.js"
|
||||||
|
|
||||||
// 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 16.11: Oct 03, 2016 Created permalinks to report files. (? lines)
|
||||||
|
Version 16.10: Oct 03, 2016 All user's figures are calculated in one click. (205795 lines)
|
||||||
Version 16.9: Oct 03, 2016 User's usage report is written into a temporary file. (205795 lines)
|
Version 16.9: Oct 03, 2016 User's usage report is written into a temporary file. (205795 lines)
|
||||||
Version 16.8.1: Oct 03, 2016 Do not show courses with a few clicks in user's usage report. (205747 lines)
|
Version 16.8.1: Oct 03, 2016 Do not show courses with a few clicks in user's usage report. (205747 lines)
|
||||||
Version 16.8: Oct 03, 2016 New option to view user's usage report. (205720 lines)
|
Version 16.8: Oct 03, 2016 New option to view user's usage report. (205720 lines)
|
||||||
|
|
116
swad_profile.c
116
swad_profile.c
|
@ -756,21 +756,67 @@ static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********* Calculate first click time and show user's profile again **********/
|
/********** Calculate user's figures and show user's profile again ***********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Prf_CalculateFirstClickTime (void)
|
void Prf_CalculateFigures (void)
|
||||||
{
|
{
|
||||||
|
struct UsrFigures UsrFigures;
|
||||||
|
|
||||||
/***** Get user's code *****/
|
/***** Get user's code *****/
|
||||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||||
|
|
||||||
/***** Get first click time from log and store as user's figure *****/
|
/***** Get first click time from log and store as user's figure *****/
|
||||||
Prf_GetFirstClickFromLogAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
Prf_GetUsrFigures (Gbl.Usrs.Other.UsrDat.UsrCod,&UsrFigures);
|
||||||
|
Prf_GetAndStoreAllUsrFigures (Gbl.Usrs.Other.UsrDat.UsrCod,&UsrFigures);
|
||||||
|
|
||||||
/***** Show user's profile again *****/
|
/***** Show user's profile again *****/
|
||||||
Prf_GetUsrDatAndShowUserProfile ();
|
Prf_GetUsrDatAndShowUserProfile ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*** Calculate and store all figures in user's profile not yet calculated ****/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// Return true if any figure has been calculated and stored
|
||||||
|
|
||||||
|
bool Prf_GetAndStoreAllUsrFigures (long UsrCod,struct UsrFigures *UsrFigures)
|
||||||
|
{
|
||||||
|
bool UsrFiguresModified = false;
|
||||||
|
|
||||||
|
if (!UsrFigures->FirstClickTimeUTC)
|
||||||
|
{
|
||||||
|
/***** Get first click time from log and store as user's figure *****/
|
||||||
|
Prf_GetFirstClickFromLogAndStoreAsUsrFigure (UsrCod);
|
||||||
|
UsrFiguresModified = true;
|
||||||
|
}
|
||||||
|
if (UsrFigures->NumClicks < 0)
|
||||||
|
{
|
||||||
|
/***** Get number of clicks and store as user's figure *****/
|
||||||
|
Prf_GetNumClicksAndStoreAsUsrFigure (UsrCod);
|
||||||
|
UsrFiguresModified = true;
|
||||||
|
}
|
||||||
|
if (UsrFigures->NumFileViews < 0)
|
||||||
|
{
|
||||||
|
/***** Get number of file views and store as user's figure *****/
|
||||||
|
Prf_GetNumFileViewsAndStoreAsUsrFigure (UsrCod);
|
||||||
|
UsrFiguresModified = true;
|
||||||
|
}
|
||||||
|
if (UsrFigures->NumForPst < 0)
|
||||||
|
{
|
||||||
|
/***** Get number of forum posts and store as user's figure *****/
|
||||||
|
Prf_GetNumForPstAndStoreAsUsrFigure (UsrCod);
|
||||||
|
UsrFiguresModified = true;
|
||||||
|
}
|
||||||
|
if (UsrFigures->NumMsgSnt < 0)
|
||||||
|
{
|
||||||
|
/***** Get number of messages sent and store as user's figure *****/
|
||||||
|
Prf_GetNumMsgSntAndStoreAsUsrFigure (UsrCod);
|
||||||
|
UsrFiguresModified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return UsrFiguresModified;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Get first click of a user from log table and store in user's figures ****/
|
/*** Get first click of a user from log table and store in user's figures ****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -818,22 +864,6 @@ static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********* Calculate number of clicks and show user's profile again **********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Prf_CalculateNumClicks (void)
|
|
||||||
{
|
|
||||||
/***** Get user's code *****/
|
|
||||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
|
||||||
|
|
||||||
/***** Get number of clicks and store as user's figure *****/
|
|
||||||
Prf_GetNumClicksAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
/***** Show user's profile again *****/
|
|
||||||
Prf_GetUsrDatAndShowUserProfile ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Get number of clicks of a user from log table and store in user's figures */
|
/* Get number of clicks of a user from log table and store in user's figures */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -866,22 +896,6 @@ static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******* Calculate number of file views and show user's profile again *******/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Prf_CalculateNumFileViews (void)
|
|
||||||
{
|
|
||||||
/***** Get user's code *****/
|
|
||||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
|
||||||
|
|
||||||
/***** Get number of file views and store as user's figure *****/
|
|
||||||
Prf_GetNumFileViewsAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
/***** Show user's profile again *****/
|
|
||||||
Prf_GetUsrDatAndShowUserProfile ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**** Get number of file views sent by a user and store in user's figures ****/
|
/**** Get number of file views sent by a user and store in user's figures ****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -912,22 +926,6 @@ static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******* Calculate number of forum posts and show user's profile again *******/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Prf_CalculateNumForPst (void)
|
|
||||||
{
|
|
||||||
/***** Get user's code *****/
|
|
||||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
|
||||||
|
|
||||||
/***** Get number of forum posts and store as user's figure *****/
|
|
||||||
Prf_GetNumForPstAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
/***** Show user's profile again *****/
|
|
||||||
Prf_GetUsrDatAndShowUserProfile ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**** Get number of forum posts sent by a user and store in user's figures ***/
|
/**** Get number of forum posts sent by a user and store in user's figures ***/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -958,22 +956,6 @@ static void Prf_GetNumForPstAndStoreAsUsrFigure (long UsrCod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****** Calculate number of messages sent and show user's profile again ******/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Prf_CalculateNumMsgSnt (void)
|
|
||||||
{
|
|
||||||
/***** Get user's code *****/
|
|
||||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
|
||||||
|
|
||||||
/***** Get number of messages sent and store as user's figure *****/
|
|
||||||
Prf_GetNumMsgSntAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
/***** Show user's profile again *****/
|
|
||||||
Prf_GetUsrDatAndShowUserProfile ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***** Get number of messages sent by a user and store in user's figures *****/
|
/***** Get number of messages sent by a user and store in user's figures *****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -61,11 +61,8 @@ void Prf_ChangeProfileVisibility (void);
|
||||||
|
|
||||||
void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat);
|
void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat);
|
||||||
void Prf_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures);
|
void Prf_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures);
|
||||||
void Prf_CalculateFirstClickTime (void);
|
void Prf_CalculateFigures (void);
|
||||||
void Prf_CalculateNumClicks (void);
|
bool Prf_GetAndStoreAllUsrFigures (long UsrCod,struct UsrFigures *UsrFigures);
|
||||||
void Prf_CalculateNumFileViews (void);
|
|
||||||
void Prf_CalculateNumForPst (void);
|
|
||||||
void Prf_CalculateNumMsgSnt (void);
|
|
||||||
|
|
||||||
void Prf_CreateNewUsrFigures (long UsrCod);
|
void Prf_CreateNewUsrFigures (long UsrCod);
|
||||||
void Prf_RemoveUsrFigures (long UsrCod);
|
void Prf_RemoveUsrFigures (long UsrCod);
|
||||||
|
|
|
@ -124,7 +124,7 @@ static void Rep_DrawBarNumHits (float HitsNum,float HitsMax,
|
||||||
|
|
||||||
void Rep_ReqMyUsageReport (void)
|
void Rep_ReqMyUsageReport (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Report;
|
extern const char *Txt_Report_of_use_of_PLATFORM;
|
||||||
extern const char *Txt_Generate_report;
|
extern const char *Txt_Generate_report;
|
||||||
char StrCurrentDateUTC[10+1]; // Example: 2016-10-02
|
char StrCurrentDateUTC[10+1]; // Example: 2016-10-02
|
||||||
// 1234567890
|
// 1234567890
|
||||||
|
@ -138,10 +138,14 @@ void Rep_ReqMyUsageReport (void)
|
||||||
Act_FormStart (ActSeeMyUsgRep);
|
Act_FormStart (ActSeeMyUsgRep);
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Report,NULL);
|
sprintf (Gbl.Title,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME);
|
||||||
|
Lay_StartRoundFrame (NULL,Gbl.Title,NULL);
|
||||||
|
|
||||||
/***** Header *****/
|
/***** Header *****/
|
||||||
Rep_WriteHeader (Gbl.F.Out,StrCurrentDateUTC);
|
fprintf (Gbl.F.Out,"<div class=\"DAT_N\">%s",Gbl.Usrs.Me.UsrDat.FullName);
|
||||||
|
if (StrCurrentDateUTC[0])
|
||||||
|
fprintf (Gbl.F.Out,"<br />%s",StrCurrentDateUTC);
|
||||||
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
/***** Send button and end frame *****/
|
/***** Send button and end frame *****/
|
||||||
Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Generate_report);
|
Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Generate_report);
|
||||||
|
@ -171,6 +175,7 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint)
|
||||||
// 1234567890
|
// 1234567890
|
||||||
char StrCurrentTimeUTC[8+1]; // Example: 19:03:49
|
char StrCurrentTimeUTC[8+1]; // Example: 19:03:49
|
||||||
// 12345678
|
// 12345678
|
||||||
|
bool GetUsrFiguresAgain;
|
||||||
unsigned long MaxHitsPerYear;
|
unsigned long MaxHitsPerYear;
|
||||||
|
|
||||||
/***** Get current date-time *****/
|
/***** Get current date-time *****/
|
||||||
|
@ -206,6 +211,10 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint)
|
||||||
|
|
||||||
/***** Figures *****/
|
/***** Figures *****/
|
||||||
Prf_GetUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&UsrFigures);
|
Prf_GetUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&UsrFigures);
|
||||||
|
GetUsrFiguresAgain = Prf_GetAndStoreAllUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&UsrFigures);
|
||||||
|
if (GetUsrFiguresAgain)
|
||||||
|
Prf_GetUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&UsrFigures);
|
||||||
|
|
||||||
if (UsrFigures.FirstClickTimeUTC)
|
if (UsrFigures.FirstClickTimeUTC)
|
||||||
gmtime_r (&UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime);
|
gmtime_r (&UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime);
|
||||||
Rep_WriteSectionUsrFigures (&UsrFigures,&tm_FirstClickTime,
|
Rep_WriteSectionUsrFigures (&UsrFigures,&tm_FirstClickTime,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user