From 0f4e4325cdf2be43c05a2ca8ef24ac751ae531b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Fri, 24 Mar 2017 12:23:42 +0100 Subject: [PATCH] Version 16.164 --- swad_action.c | 2 +- swad_changelog.h | 3 +- swad_degree_type.c | 79 +++++++++++++++++++++++++++++++--------------- swad_degree_type.h | 5 +-- swad_global.c | 1 - swad_help_URL.c | 21 ++++++++++++ swad_statistic.c | 15 ++++++++- swad_statistic.h | 3 +- swad_text.c | 22 ++++++++++++- 9 files changed, 117 insertions(+), 34 deletions(-) diff --git a/swad_action.c b/swad_action.c index c2878032..c31a2c4b 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1517,7 +1517,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActSeeCty */{ 862, 1,TabSys,ActSeeCty , 0, 0, 0, 0, 0, 0,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Cty_ListCountries1 ,Cty_ListCountries2 ,"earth64x64.gif" }, /* ActSeePen */{1060, 2,TabSys,ActSeePen , 0, 0, 0, 0, 0, 0,0x1E0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Deg_SeePending ,"hierarchy64x64.png" }, /* ActReqRemOldCrs */{1109, 3,TabSys,ActReqRemOldCrs , 0, 0, 0, 0, 0, 0,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Crs_AskRemoveOldCrss ,"removeusers64x64.gif" }, - /* ActSeeDegTyp */{1013, 4,TabSys,ActSeeDegTyp , 0, 0, 0, 0, 0, 0,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,DT_SeeDegreeTypes ,"grouptypes64x64.gif" }, + /* ActSeeDegTyp */{1013, 4,TabSys,ActSeeDegTyp , 0, 0, 0, 0, 0, 0,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,DT_SeeDegreeTypesInSysTab ,"grouptypes64x64.gif" }, /* ActSeeMai */{ 855, 5,TabSys,ActSeeMai , 0, 0, 0, 0, 0, 0,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Mai_SeeMailDomains ,"email64x64.gif" }, /* ActSeeBan */{1137, 6,TabSys,ActSeeBan , 0, 0, 0, 0, 0, 0,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ban_SeeBanners ,"picture64x64.gif" }, /* ActSeeLnk */{ 748, 7,TabSys,ActSeeLnk , 0, 0, 0, 0, 0, 0,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Lnk_SeeLinks ,"link64x64.gif" }, diff --git a/swad_changelog.h b/swad_changelog.h index 987611ff..0f32ed4b 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -209,13 +209,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.163 (2017-03-24)" +#define Log_PLATFORM_VERSION "SWAD 16.164 (2017-03-24)" #define CSS_FILE "swad16.161.css" #define JS_FILE "swad16.144.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.164: Mar 24, 2017 New figure in statistics: types of degree. (217510 lines) Version 16.163: Mar 24, 2017 Types of degree can be ordered by name and by number of degrees. Integer fields in database queries without single quotes. (217434 lines) Version 16.162: Mar 23, 2017 Changes in layout of types of degree. (217330 lines) diff --git a/swad_degree_type.c b/swad_degree_type.c index 247a4509..d011b297 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -62,16 +62,17 @@ extern struct Globals Gbl; /**************************** Private prototypes *****************************/ /*****************************************************************************/ -static void DT_GetParamDegTypOrder (void); +static void DT_SeeDegreeTypes (Act_Action_t NextAction,DT_Order_t DefaultOrder); +static void DT_GetParamDegTypOrder (DT_Order_t DefaultOrder); -static void DT_ListDegreeTypes (void); +static void DT_ListDegreeTypes (Act_Action_t NextAction); static void DT_EditDegreeTypes (void); static void DT_ListDegreeTypesForSeeing (void); static void DT_PutIconToEditDegTypes (void); static void DT_ListDegreeTypesForEdition (void); static void DT_PutFormToCreateDegreeType (void); -static void DT_PutHeadDegreeTypesForSeeing (void); +static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction); static void DT_PutHeadDegreeTypesForEdition (void); static void DT_CreateDegreeType (struct DegreeType *DegTyp); @@ -124,16 +125,28 @@ void DT_WriteSelectorDegreeTypes (void) /***************************** Show degree types *****************************/ /*****************************************************************************/ -void DT_SeeDegreeTypes (void) +void DT_SeeDegreeTypesInSysTab (void) + { + DT_SeeDegreeTypes (ActSeeDegTyp, + DT_ORDER_BY_DEGREE_TYPE); // Default order if not specified + } + +void DT_SeeDegreeTypesInStaTab (void) + { + DT_SeeDegreeTypes (ActSeeUseGbl, + DT_ORDER_BY_NUM_DEGREES); // Default order if not specified + } + +static void DT_SeeDegreeTypes (Act_Action_t NextAction,DT_Order_t DefaultOrder) { /***** Get parameter with the type of order in the list of degree types *****/ - DT_GetParamDegTypOrder (); + DT_GetParamDegTypOrder (DefaultOrder); /***** Get list of degree types *****/ DT_GetListDegreeTypes (); /***** List degree types *****/ - DT_ListDegreeTypes (); + DT_ListDegreeTypes (NextAction); /***** Free list of degree types *****/ DT_FreeListDegreeTypes (); @@ -143,13 +156,13 @@ void DT_SeeDegreeTypes (void) /******* Get parameter with the type or order in list of degree types ********/ /*****************************************************************************/ -static void DT_GetParamDegTypOrder (void) +static void DT_GetParamDegTypOrder (DT_Order_t DefaultOrder) { Gbl.Degs.DegTypes.SelectedOrder = (DT_Order_t) Par_GetParToUnsignedLong ("Order", 0, DT_NUM_ORDERS - 1, - (unsigned long) DT_ORDER_DEFAULT); + (unsigned long) DefaultOrder); } /*****************************************************************************/ @@ -159,6 +172,7 @@ static void DT_GetParamDegTypOrder (void) void DT_ReqEditDegreeTypes (void) { /***** Get list of degree types *****/ + Gbl.Degs.DegTypes.SelectedOrder = DT_ORDER_BY_DEGREE_TYPE; DT_GetListDegreeTypes (); /***** Put form to edit degree types *****/ @@ -171,13 +185,34 @@ void DT_ReqEditDegreeTypes (void) /*****************************************************************************/ /***************************** List degree types *****************************/ /*****************************************************************************/ +// This function can be called from: +// - system tab ==> NextAction = ActSeeDegTyp +// - statistic tab ==> NextAction = ActSeeUseGbl -static void DT_ListDegreeTypes (void) +static void DT_ListDegreeTypes (Act_Action_t NextAction) { + extern const char *Hlp_SYSTEM_Studies; + extern const char *Hlp_STATS_Figures_types_of_degree; + extern const char *Txt_Types_of_degree; extern const char *Txt_There_are_no_types_of_degree; if (Gbl.Degs.DegTypes.Num) + { + /***** Write heading *****/ + Lay_StartRoundFrameTable (NULL,Txt_Types_of_degree, + Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ? DT_PutIconToEditDegTypes : + NULL, + (NextAction == ActSeeDegTyp) ? Hlp_SYSTEM_Studies : + Hlp_STATS_Figures_types_of_degree, + 2); + DT_PutHeadDegreeTypesForSeeing (NextAction); + + /***** List current degree types for seeing *****/ DT_ListDegreeTypesForSeeing (); + + /***** End table and frame *****/ + Lay_EndRoundFrameTable (); + } else Lay_ShowAlert (Lay_INFO,Txt_There_are_no_types_of_degree); } @@ -208,18 +243,9 @@ static void DT_EditDegreeTypes (void) static void DT_ListDegreeTypesForSeeing (void) { - extern const char *Hlp_SYSTEM_Studies; - extern const char *Txt_Types_of_degree; unsigned NumDegTyp; const char *BgColor; - /***** Write heading *****/ - Lay_StartRoundFrameTable (NULL,Txt_Types_of_degree, - Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ? DT_PutIconToEditDegTypes : - NULL, - Hlp_SYSTEM_Studies,2); - DT_PutHeadDegreeTypesForSeeing (); - /***** List degree types with forms for edition *****/ for (NumDegTyp = 0; NumDegTyp < Gbl.Degs.DegTypes.Num; @@ -251,10 +277,6 @@ static void DT_ListDegreeTypesForSeeing (void) Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; } - - /***** End table *****/ - fprintf (Gbl.F.Out,""); - Lay_EndRoundFrame (); } /*****************************************************************************/ @@ -381,7 +403,7 @@ static void DT_PutFormToCreateDegreeType (void) /***************** Write header with fields of a degree type *****************/ /*****************************************************************************/ -static void DT_PutHeadDegreeTypesForSeeing (void) +static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction) { extern const char *Txt_DEGREE_TYPES_HELP_ORDER[DT_NUM_ORDERS]; extern const char *Txt_DEGREE_TYPES_ORDER[DT_NUM_ORDERS]; @@ -397,17 +419,22 @@ static void DT_PutHeadDegreeTypesForSeeing (void) Order == DT_ORDER_BY_DEGREE_TYPE ? "LEFT_MIDDLE" : "RIGHT_MIDDLE"); - Act_FormStart (ActSeeDegTyp); + /* Start form to change order */ + Act_FormStart (NextAction); + if (NextAction == ActSeeUseGbl) + Sta_PutHiddenParamFigures (); Par_PutHiddenParamUnsigned ("Order",(unsigned) Order); + + /* Link with the head of this column */ Act_LinkFormSubmit (Txt_DEGREE_TYPES_HELP_ORDER[Order],"TIT_TBL",NULL); if (Order == Gbl.Degs.DegTypes.SelectedOrder) fprintf (Gbl.F.Out,""); - fprintf (Gbl.F.Out,"%s",Txt_DEGREE_TYPES_ORDER[Order]); - if (Order == Gbl.Degs.DegTypes.SelectedOrder) fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,""); + + /* End form */ Act_FormEnd (); fprintf (Gbl.F.Out,""); diff --git a/swad_degree_type.h b/swad_degree_type.h index 8970aad1..74fbf016 100644 --- a/swad_degree_type.h +++ b/swad_degree_type.h @@ -51,14 +51,15 @@ typedef enum DT_ORDER_BY_DEGREE_TYPE = 0, DT_ORDER_BY_NUM_DEGREES = 1, } DT_Order_t; -#define DT_ORDER_DEFAULT DT_ORDER_BY_DEGREE_TYPE /*****************************************************************************/ /***************************** Public prototypes *****************************/ /*****************************************************************************/ void DT_WriteSelectorDegreeTypes (void); -void DT_SeeDegreeTypes (void); + +void DT_SeeDegreeTypesInSysTab (void); +void DT_SeeDegreeTypesInStaTab (void); void DT_ReqEditDegreeTypes (void); void DT_GetListDegreeTypes (void); diff --git a/swad_global.c b/swad_global.c index 59897b57..15fbdbaf 100644 --- a/swad_global.c +++ b/swad_global.c @@ -294,7 +294,6 @@ void Gbl_InitializeGlobals (void) Gbl.Degs.DegTypes.Num = 0; Gbl.Degs.DegTypes.Lst = NULL; - Gbl.Degs.DegTypes.SelectedOrder = DT_ORDER_DEFAULT; Gbl.Degs.EditingDegTyp.DegTypCod = -1L; Gbl.Degs.EditingDegTyp.DegTypName[0] = '\0'; diff --git a/swad_help_URL.c b/swad_help_URL.c index 838d258b..54c8caa8 100644 --- a/swad_help_URL.c +++ b/swad_help_URL.c @@ -2174,6 +2174,27 @@ const char *Hlp_STATS_Figures_institutions = "STATS.Figures#institutions"; #endif +const char *Hlp_STATS_Figures_types_of_degree = +#if L==1 + "STATS.Figures#types-of-degree"; +#elif L==2 + "STATS.Figures#types-of-degree"; +#elif L==3 + "STATS.Figures#types-of-degree"; +#elif L==4 + "STATS.Figures#types-of-degree"; +#elif L==5 + "STATS.Figures#types-of-degree"; +#elif L==6 + "STATS.Figures#types-of-degree"; +#elif L==7 + "STATS.Figures#types-of-degree"; +#elif L==8 + "STATS.Figures#types-of-degree"; +#elif L==9 + "STATS.Figures#types-of-degree"; +#endif + const char *Hlp_STATS_Figures_folders_and_files = #if L==1 "STATS.Figures#folders-and-files"; diff --git a/swad_statistic.c b/swad_statistic.c index da85de37..e8ce97b8 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -199,6 +199,8 @@ static void Sta_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem (void); static void Sta_GetAndShowInss (const char *Query,const char *TxtFigure); static unsigned Sta_GetInsAndStat (struct Instit *Ins,MYSQL_RES *mysql_res); +static void Sta_GetAndShowDegreeTypesStats (void); + static unsigned Sta_GetTotalNumberOfUsersInPlatform (void); static void Sta_GetAndShowUsersStats (void); @@ -3986,6 +3988,7 @@ void Sta_ShowFigures (void) Sta_GetAndShowUsersRanking, // Sta_USERS_RANKING Sta_GetAndShowHierarchyStats, // Sta_HIERARCHY Sta_GetAndShowInstitutionsStats, // Sta_INSTITS + Sta_GetAndShowDegreeTypesStats, // Sta_DEGREE_TYPES Sta_GetAndShowFileBrowsersStats, // Sta_FOLDERS_AND_FILES Sta_GetAndShowOERsStats, // Sta_OER Sta_GetAndShowAssignmentsStats, // Sta_ASSIGNMENTS @@ -5209,7 +5212,7 @@ static void Sta_GetAndShowInss (const char *Query,const char *TxtFigure) } /*****************************************************************************/ -/************************* Get total number of users *************************/ +/******************** Get institution data and statistic *********************/ /*****************************************************************************/ static unsigned Sta_GetInsAndStat (struct Instit *Ins,MYSQL_RES *mysql_res) @@ -5232,6 +5235,16 @@ static unsigned Sta_GetInsAndStat (struct Instit *Ins,MYSQL_RES *mysql_res) return NumberThisRow; } +/*****************************************************************************/ +/****************** Get and show stats about institutions ********************/ +/*****************************************************************************/ + +static void Sta_GetAndShowDegreeTypesStats (void) + { + /***** Show statistic about number of degrees in each type of degree *****/ + DT_SeeDegreeTypesInStaTab (); + } + /*****************************************************************************/ /****************** Get total number of users in platform ********************/ /*****************************************************************************/ diff --git a/swad_statistic.h b/swad_statistic.h index 03a79f81..28025347 100644 --- a/swad_statistic.h +++ b/swad_statistic.h @@ -103,13 +103,14 @@ typedef enum } Sta_ClicksGroupedBy_t; #define Sta_CLICKS_GROUPED_BY_DEFAULT Sta_CLICKS_CRS_PER_USR -#define Sta_NUM_FIGURES 23 +#define Sta_NUM_FIGURES 24 typedef enum { Sta_USERS, // Number of users Sta_USERS_RANKING, // Users' ranking Sta_HIERARCHY, // Number of countries, institutions, centres, degrees and courses Sta_INSTITS, // Number of users in each institution + Sta_DEGREE_TYPES, // Number of degrees in each type of degree Sta_FOLDERS_AND_FILES, // Number of folders and files Sta_OER, // Number of OERs (Open Educational Resources) Sta_ASSIGNMENTS, // Number of assignments diff --git a/swad_text.c b/swad_text.c index 0f9901ac..467588cb 100644 --- a/swad_text.c +++ b/swad_text.c @@ -39614,7 +39614,7 @@ const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES] = "Hierarquia" #endif , -#if L==1 // Sta_INSTITUTIONS +#if L==1 // Sta_INSTITS "Institucions" #elif L==2 "Hochschulen" @@ -39634,6 +39634,26 @@ const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES] = "Instituções" #endif , +#if L==1 // Sta_DEGREE_TYPES + "Tipus de titulació" +#elif L==2 + "Abschlussart" +#elif L==3 + "Types of degree" +#elif L==4 + "Tipos de titulación" +#elif L==5 + "Types d'étude" +#elif L==6 + "Arandurã lája" +#elif L==7 + "Tipi di laurea" +#elif L==8 + "Rodzaje stopni" +#elif L==9 + "Tipos de titulação" +#endif + , #if L==1 // Sta_FOLDERS_AND_FILES "Carpetes i fitxers" #elif L==2