diff --git a/swad_account.c b/swad_account.c index fe640de91..bb1118512 100644 --- a/swad_account.c +++ b/swad_account.c @@ -79,7 +79,7 @@ static bool Acc_GetParamsNewAccount (char *NewNicknameWithoutArroba, static void Acc_CreateNewEncryptedUsrCod (struct UsrData *UsrDat); static void Acc_PutLinkToRemoveMyAccount (void); -static void Acc_PutLinkToRemoveMyAccountParams (void); +static void Acc_PutParamsToRemoveMyAccount (void); static void Acc_PrintAccountSeparator (void); @@ -503,13 +503,13 @@ static void Acc_PutLinkToRemoveMyAccount (void) { extern const char *Txt_Remove_account; - Lay_PutContextualLink (ActReqRemMyAcc,Acc_PutLinkToRemoveMyAccountParams, + Lay_PutContextualLink (ActReqRemMyAcc,Acc_PutParamsToRemoveMyAccount, "remove-on64x64.png", Txt_Remove_account,Txt_Remove_account, NULL); } -static void Acc_PutLinkToRemoveMyAccountParams (void) +static void Acc_PutParamsToRemoveMyAccount (void) { Usr_PutParamUsrCodEncrypted (Gbl.Usrs.Me.UsrDat.EncryptedUsrCod); Par_PutHiddenParamUnsigned ("RegRemAction",(unsigned) Enr_ELIMINATE_ONE_USR_FROM_PLATFORM); diff --git a/swad_action.c b/swad_action.c index 83624a76d..b281e057b 100644 --- a/swad_action.c +++ b/swad_action.c @@ -2722,7 +2722,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = // TabSta ****************************************************************** // Actions in menu: /* ActSeeAllSvy */{ 966, 0,TabSta,ActSeeAllSvy ,0x1F8,0x1F8,0x1F8,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Svy_SeeAllSurveys ,"survey64x64.gif" }, - /* ActReqUseGbl */{ 761, 1,TabSta,ActReqUseGbl ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Sta_ReqUseOfPlatform ,"pie64x64.gif" }, + /* ActReqUseGbl */{ 761, 1,TabSta,ActReqUseGbl ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Sta_ReqShowFigures ,"pie64x64.gif" }, /* ActSeePhoDeg */{ 447, 2,TabSta,ActSeePhoDeg ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Pho_ShowPhotoDegree ,"classphoto64x64.gif" }, /* ActReqStaCrs */{ 767, 3,TabSta,ActReqStaCrs ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ind_ReqIndicatorsCourses ,"tablestats64x64.gif" }, /* ActReqAccGbl */{ 591, 4,TabSta,ActReqAccGbl ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,Sta_SetIniEndDates ,Sta_AskShowGblHits ,"stats64x64.gif" }, @@ -2748,7 +2748,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActReqRemSvyQst */{1524,-1,TabUnk,ActSeeAllSvy ,0x1F0,0x1E0,0x1E0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Svy_RequestRemoveQst ,NULL}, /* ActRemSvyQst */{ 981,-1,TabUnk,ActSeeAllSvy ,0x1F0,0x1E0,0x1E0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Svy_RemoveQst ,NULL}, - /* ActSeeUseGbl */{ 84,-1,TabUnk,ActReqUseGbl ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Sta_ShowUseOfPlatform ,NULL}, + /* ActSeeUseGbl */{ 84,-1,TabUnk,ActReqUseGbl ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Sta_ShowFigures ,NULL}, /* ActPrnPhoDeg */{ 448,-1,TabUnk,ActSeePhoDeg ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_BLNK_WINDOW,NULL ,Pho_PrintPhotoDegree ,NULL}, /* ActCalPhoDeg */{ 444,-1,TabUnk,ActSeePhoDeg ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Pho_CalcPhotoDegree ,NULL}, /* ActSeeAccGbl */{ 79,-1,TabUnk,ActReqAccGbl ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Sta_SeeGblAccesses ,NULL}, diff --git a/swad_calendar.c b/swad_calendar.c index 56157d27c..b2e16a1fa 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -279,7 +279,7 @@ void Cal_DrawCalendar (void) } /*****************************************************************************/ -/************************ Draw an academic calendar **************************/ +/************************ Put icon to print calendar *************************/ /*****************************************************************************/ static void Cal_PutIconToPrintCalendar (void) @@ -291,4 +291,3 @@ static void Cal_PutIconToPrintCalendar (void) Txt_Print,NULL, NULL); } - diff --git a/swad_changelog.h b/swad_changelog.h index 64797ce0d..f90d56227 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -156,13 +156,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.46.9 (2016-11-06)" +#define Log_PLATFORM_VERSION "SWAD 16.47 (2016-11-06)" #define CSS_FILE "swad16.32.1.css" #define JS_FILE "swad16.46.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.47: Nov 06, 2016 New functions to put a contextual icon to show a figure (statistics). (206113 lines) + Version 16.46.10: Nov 06, 2016 Code refactoring in statistics. (206080 lines) Version 16.46.9: Nov 06, 2016 Fixed bug in figures (statistics). (206064 lines) Version 16.46.8: Nov 05, 2016 Changes in texts related to notifications. (206047 lines) Version 16.46.7: Nov 05, 2016 Changes in text related to forum statistics. (206046 lines) diff --git a/swad_statistic.c b/swad_statistic.c index bf4d74f74..0ac60e172 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -178,6 +178,10 @@ static void Sta_ShowNumHitsPerCourse (unsigned long NumRows, static void Sta_DrawBarNumHits (char Color,float HitsNum,float HitsMax,float HitsTotal,unsigned MaxBarWidth); +static void Sta_PutParamsToShowFigure (void); +static void Sta_PutHiddenParamFigureType (void); +static void Sta_PutHiddenParamScopeSta (void); + static void Sta_GetAndShowHierarchyStats (void); static void Sta_WriteHeadDegsCrssInSWAD (void); static void Sta_GetAndShowNumCtysInSWAD (void); @@ -397,7 +401,14 @@ void Sta_AskShowCrsHits (void) extern const char *Txt_results_per_page; extern const char *Txt_Show_hits; extern const char *Txt_No_teachers_or_students_found; - static unsigned long RowsPerPage[] = {10,20,30,40,50,100,500,1000,5000,10000,50000,100000}; + static unsigned long RowsPerPage[] = + { + 10,20,30,40,50, + 100,500, + 1000,5000, + 10000,50000, + 100000 + }; #define NUM_OPTIONS_ROWS_PER_PAGE (sizeof (RowsPerPage) / sizeof (RowsPerPage[0])) unsigned NumTotalUsrs; Sta_ClicksGroupedBy_t ClicksGroupedBy; @@ -3777,7 +3788,7 @@ void Sta_WriteParamsDatesSeeAccesses (void) /************************** Show use of the platform *************************/ /*****************************************************************************/ -void Sta_ReqUseOfPlatform (void) +void Sta_ReqShowFigures (void) { extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *Txt_Statistic; @@ -3833,11 +3844,57 @@ void Sta_ReqUseOfPlatform (void) Act_FormEnd (); } +/*****************************************************************************/ +/************************* Put icon to show a figure *************************/ +/*****************************************************************************/ +// Gbl.Stat.FigureType must be set to the desired figure before calling this function + +void Sta_PutIconToShowFigure (void) + { + extern const char *Txt_Show_statistic; + + Lay_PutContextualLink (ActSeeUseGbl,Sta_PutParamsToShowFigure, + "pie64x64.gif", + Txt_Show_statistic,NULL, + NULL); + } + +/*****************************************************************************/ +/************* Put hidden parameters for figures (statistics) ****************/ +/*****************************************************************************/ +// Gbl.Stat.FigureType must be set to the desired figure before calling this function + +static void Sta_PutParamsToShowFigure (void) + { + if (Gbl.CurrentCrs.Crs.CrsCod > 0) + Gbl.Scope.Current = Sco_SCOPE_CRS; + else if (Gbl.CurrentDeg.Deg.DegCod > 0) + Gbl.Scope.Current = Sco_SCOPE_DEG; + else if (Gbl.CurrentCtr.Ctr.CtrCod > 0) + Gbl.Scope.Current = Sco_SCOPE_CTR; + else if (Gbl.CurrentIns.Ins.InsCod > 0) + Gbl.Scope.Current = Sco_SCOPE_INS; + else + Gbl.Scope.Current = Sco_SCOPE_SYS; + + Sta_PutHiddenParamFigures (); + } + +/*****************************************************************************/ +/************* Put hidden parameters for figures (statistics) ****************/ +/*****************************************************************************/ + +void Sta_PutHiddenParamFigures (void) + { + Sta_PutHiddenParamScopeSta (); + Sta_PutHiddenParamFigureType (); + } + /*****************************************************************************/ /********* Put hidden parameter for the type of figure (statistic) ***********/ /*****************************************************************************/ -void Sta_PutHiddenParamFigureType (void) +static void Sta_PutHiddenParamFigureType (void) { Par_PutHiddenParamUnsigned ("FigureType",(unsigned) Gbl.Stat.FigureType); } @@ -3846,7 +3903,7 @@ void Sta_PutHiddenParamFigureType (void) /********* Put hidden parameter for the type of figure (statistic) ***********/ /*****************************************************************************/ -void Sta_PutHiddenParamScopeSta (void) +static void Sta_PutHiddenParamScopeSta (void) { Sco_PutParamScope ("ScopeSta",Gbl.Scope.Current); } @@ -3855,7 +3912,7 @@ void Sta_PutHiddenParamScopeSta (void) /************************** Show use of the platform *************************/ /*****************************************************************************/ -void Sta_ShowUseOfPlatform (void) +void Sta_ShowFigures (void) { static void (*Sta_Function[Sta_NUM_FIGURES])(void) = // Array of pointers to functions { @@ -3895,7 +3952,7 @@ void Sta_ShowUseOfPlatform (void) Gbl.Stat.FigureType = (Sta_FigureType_t) UnsignedNum; /***** Show again the form to see use of the platform *****/ - Sta_ReqUseOfPlatform (); + Sta_ReqShowFigures (); /***** Show the stat of use selected by user *****/ Sta_Function[Gbl.Stat.FigureType] (); diff --git a/swad_statistic.h b/swad_statistic.h index 87aff9914..78e531afa 100644 --- a/swad_statistic.h +++ b/swad_statistic.h @@ -160,10 +160,11 @@ void Sta_ComputeMaxAndTotalHits (struct Sta_Hits *Hits, MYSQL_RES *mysql_res,unsigned Field, unsigned Divisor); -void Sta_ReqUseOfPlatform (void); -void Sta_PutHiddenParamFigureType (void); -void Sta_PutHiddenParamScopeSta (void); -void Sta_ShowUseOfPlatform (void); +void Sta_ReqShowFigures (void); +void Sta_PutIconToShowFigure (void); +void Sta_PutHiddenParamFigures (void); +void Sta_ShowFigures (void); + unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role); void Sta_WriteParamsDatesSeeAccesses (void); diff --git a/swad_user.c b/swad_user.c index 268834ac2..ab0a2053d 100644 --- a/swad_user.c +++ b/swad_user.c @@ -5232,8 +5232,7 @@ void Usr_PutExtraParamsUsrList (Act_Action_t NextAction) } break; case ActSeeUseGbl: - Sta_PutHiddenParamScopeSta (); - Sta_PutHiddenParamFigureType (); + Sta_PutHiddenParamFigures (); break; case ActSeePhoDeg: Pho_PutHiddenParamTypeOfAvg ();