diff --git a/swad_changelog.h b/swad_changelog.h index ad878d8c9..2d8d293b1 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -380,10 +380,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.35.1 (2019-02-12)" +#define Log_PLATFORM_VERSION "SWAD 18.35.2 (2019-02-12)" #define CSS_FILE "swad18.33.css" #define JS_FILE "swad18.32.1.js" /* + Version 18.35.2: Feb 12, 2019 Code refactoring in hierarchy stats. (238761 lines) Version 18.35.1: Feb 12, 2019 Code refactoring in hierarchy stats. (238894 lines) Version 18.35: Feb 12, 2019 New layout of hierarchy stats. (239132 lines) Version 18.34.3: Feb 12, 2019 Changed icon remove to close in announcements. (239109 lines) diff --git a/swad_statistic.c b/swad_statistic.c index 35bd763e8..88cb65cd7 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -207,6 +207,14 @@ static void Sta_GetAndShowHierarchyWithDegs (void); static void Sta_GetAndShowHierarchyWithCrss (void); static void Sta_GetAndShowHierarchyWithUsrs (Rol_Role_t Role); static void Sta_GetAndShowHierarchyTotal (void); +static void Sta_ShowHierarchyRow (const char *Text1,const char *Text2, + const char *ClassTxt, + int NumCtys, // < 0 ==> do not show number + int NumInss, // < 0 ==> do not show number + int NumCtrs, // < 0 ==> do not show number + int NumDegs, // < 0 ==> do not show number + int NumCrss); // < 0 ==> do not show number +static void Sta_ShowHierarchyCell (const char *ClassTxt,int Num); static void Sta_GetAndShowInstitutionsStats (void); static void Sta_GetAndShowInssOrderedByNumCtrs (void); @@ -4433,6 +4441,7 @@ static void Sta_GetAndShowHierarchyStats (void) { extern const char *Hlp_ANALYTICS_Figures_hierarchy; extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES]; + Rol_Role_t Role; /***** Start box and table *****/ Box_StartBoxTable (NULL,Txt_STAT_USE_STAT_TYPES[Sta_HIERARCHY],NULL, @@ -4443,9 +4452,10 @@ static void Sta_GetAndShowHierarchyStats (void) Sta_GetAndShowHierarchyWithCtrs (); Sta_GetAndShowHierarchyWithDegs (); Sta_GetAndShowHierarchyWithCrss (); - Sta_GetAndShowHierarchyWithUsrs (Rol_TCH); - Sta_GetAndShowHierarchyWithUsrs (Rol_NET); - Sta_GetAndShowHierarchyWithUsrs (Rol_STD); + for (Role = Rol_TCH; + Role >= Rol_STD; + Role--) + Sta_GetAndShowHierarchyWithUsrs (Role); Sta_GetAndShowHierarchyTotal (); /***** End table and box *****/ @@ -4515,7 +4525,8 @@ static void Sta_WriteHeadHierarchy (void) static void Sta_GetAndShowHierarchyWithInss (void) { - extern const char *Txt_With_institutions; + extern const char *Txt_With_; + extern const char *Txt_institutions; unsigned NumCtysWithInss = 1; /***** Get number of elements with institutions *****/ @@ -4536,28 +4547,13 @@ static void Sta_GetAndShowHierarchyWithInss (void) } /***** Write number of elements with institutions *****/ - fprintf (Gbl.F.Out,"" - "" - "%s" - "" - "" - "%u" - "" - "" - "-" - "" - "" - "-" - "" - "" - "-" - "" - "" - "-" - "" - "", - Txt_With_institutions, - NumCtysWithInss); + Sta_ShowHierarchyRow (Txt_With_,Txt_institutions, + "DAT", + (int) NumCtysWithInss, + -1, // < 0 ==> do not show number + -1, // < 0 ==> do not show number + -1, // < 0 ==> do not show number + -1); // < 0 ==> do not show number } /*****************************************************************************/ @@ -4566,7 +4562,8 @@ static void Sta_GetAndShowHierarchyWithInss (void) static void Sta_GetAndShowHierarchyWithCtrs (void) { - extern const char *Txt_With_centres; + extern const char *Txt_With_; + extern const char *Txt_centres; char SubQuery[128]; unsigned NumCtysWithCtrs = 1; unsigned NumInssWithCtrs = 1; @@ -4594,29 +4591,13 @@ static void Sta_GetAndShowHierarchyWithCtrs (void) } /***** Write number of elements with centres *****/ - fprintf (Gbl.F.Out,"" - "" - "%s" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "-" - "" - "" - "-" - "" - "" - "-" - "" - "", - Txt_With_centres, - NumCtysWithCtrs, - NumInssWithCtrs); + Sta_ShowHierarchyRow (Txt_With_,Txt_centres, + "DAT", + (int) NumCtysWithCtrs, + (int) NumInssWithCtrs, + -1, // < 0 ==> do not show number + -1, // < 0 ==> do not show number + -1); // < 0 ==> do not show number } /*****************************************************************************/ @@ -4625,7 +4606,8 @@ static void Sta_GetAndShowHierarchyWithCtrs (void) static void Sta_GetAndShowHierarchyWithDegs (void) { - extern const char *Txt_With_degrees; + extern const char *Txt_With_; + extern const char *Txt_degrees; char SubQuery[128]; unsigned NumCtysWithDegs = 1; unsigned NumInssWithDegs = 1; @@ -4660,30 +4642,13 @@ static void Sta_GetAndShowHierarchyWithDegs (void) } /***** Write number of elements with degrees *****/ - fprintf (Gbl.F.Out,"" - "" - "%s" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "-" - "" - "" - "-" - "" - "", - Txt_With_degrees, - NumCtysWithDegs, - NumInssWithDegs, - NumCtrsWithDegs); + Sta_ShowHierarchyRow (Txt_With_,Txt_degrees, + "DAT", + (int) NumCtysWithDegs, + (int) NumInssWithDegs, + (int) NumCtrsWithDegs, + -1, // < 0 ==> do not show number + -1); // < 0 ==> do not show number } /*****************************************************************************/ @@ -4692,7 +4657,8 @@ static void Sta_GetAndShowHierarchyWithDegs (void) static void Sta_GetAndShowHierarchyWithCrss (void) { - extern const char *Txt_With_courses; + extern const char *Txt_With_; + extern const char *Txt_courses; char SubQuery[128]; unsigned NumCtysWithCrss = 1; unsigned NumInssWithCrss = 1; @@ -4735,31 +4701,13 @@ static void Sta_GetAndShowHierarchyWithCrss (void) } /***** Write number of elements with courses *****/ - fprintf (Gbl.F.Out,"" - "" - "%s" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "-" - "" - "", - Txt_With_courses, - NumCtysWithCrss, - NumInssWithCrss, - NumCtrsWithCrss, - NumDegsWithCrss); + Sta_ShowHierarchyRow (Txt_With_,Txt_courses, + "DAT", + (int) NumCtysWithCrss, + (int) NumInssWithCrss, + (int) NumCtrsWithCrss, + (int) NumDegsWithCrss, + -1); // < 0 ==> do not show number } /*****************************************************************************/ @@ -4768,7 +4716,7 @@ static void Sta_GetAndShowHierarchyWithCrss (void) static void Sta_GetAndShowHierarchyWithUsrs (Rol_Role_t Role) { - extern const char *Txt_With; + extern const char *Txt_With_; extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; char SubQuery[128]; unsigned NumCtysWithUsrs = 0; @@ -4838,32 +4786,13 @@ static void Sta_GetAndShowHierarchyWithUsrs (Rol_Role_t Role) } /***** Write number of elements with students *****/ - fprintf (Gbl.F.Out,"" - "" - "%s %s" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "%u" - "" - "", - Txt_With,Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN], - NumCtysWithUsrs, - NumInssWithUsrs, - NumCtrsWithUsrs, - NumDegsWithUsrs, - NumCrssWithUsrs); + Sta_ShowHierarchyRow (Txt_With_,Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN], + "DAT", + (int) NumCtysWithUsrs, + (int) NumInssWithUsrs, + (int) NumCtrsWithUsrs, + (int) NumDegsWithUsrs, + (int) NumCrssWithUsrs); } /*****************************************************************************/ @@ -4915,32 +4844,54 @@ static void Sta_GetAndShowHierarchyTotal (void) } /***** Write total number of elements *****/ + Sta_ShowHierarchyRow ("",Txt_Total, + "DAT_N_LINE_TOP", + (int) NumCtysTotal, + (int) NumInssTotal, + (int) NumCtrsTotal, + (int) NumDegsTotal, + (int) NumCrssTotal); + } + +/*****************************************************************************/ +/************** Show row with number of elements in hierarchy ****************/ +/*****************************************************************************/ + +static void Sta_ShowHierarchyRow (const char *Text1,const char *Text2, + const char *ClassTxt, + int NumCtys, // < 0 ==> do not show number + int NumInss, // < 0 ==> do not show number + int NumCtrs, // < 0 ==> do not show number + int NumDegs, // < 0 ==> do not show number + int NumCrss) // < 0 ==> do not show number + { + /***** Start row and write text *****/ fprintf (Gbl.F.Out,"" - "" - "%s" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "%u" - "" - "" - "%u" - "" - "", - Txt_Total, - NumCtysTotal, - NumInssTotal, - NumCtrsTotal, - NumDegsTotal, - NumCrssTotal); + "" + "%s%s" + "", + ClassTxt,Text1,Text2); + + /***** Write number of countries *****/ + Sta_ShowHierarchyCell (ClassTxt,NumCtys); + Sta_ShowHierarchyCell (ClassTxt,NumInss); + Sta_ShowHierarchyCell (ClassTxt,NumCtrs); + Sta_ShowHierarchyCell (ClassTxt,NumDegs); + Sta_ShowHierarchyCell (ClassTxt,NumCrss); + + /***** End row *****/ + fprintf (Gbl.F.Out,""); + } + +static void Sta_ShowHierarchyCell (const char *ClassTxt,int Num) + { + /***** Write number *****/ + fprintf (Gbl.F.Out,"",ClassTxt); + if (Num >= 0) + fprintf (Gbl.F.Out,"%d",Num); + else // < 0 ==> do not show number + fprintf (Gbl.F.Out,"-"); + fprintf (Gbl.F.Out,""); } /*****************************************************************************/ diff --git a/swad_text.c b/swad_text.c index 536a09d8b..a5f57dfcf 100644 --- a/swad_text.c +++ b/swad_text.c @@ -53109,109 +53109,25 @@ const char *Txt_Who_to_follow = "Quem seguir"; #endif -const char *Txt_With = +const char *Txt_With_ = // Example: "With students" #if L==1 // ca - "Amb"; + "Amb "; #elif L==2 // de - "Mit"; + "Mit "; #elif L==3 // en - "With"; + "With "; #elif L==4 // es - "Con"; + "Con "; #elif L==5 // fr - "Avec"; + "Avec "; #elif L==6 // gn - "Con"; // Okoteve traducción + "Con "; // Okoteve traducción #elif L==7 // it - "Con"; + "Con "; #elif L==8 // pl - "Z"; + "Z "; #elif L==9 // pt - "Com"; -#endif - -const char *Txt_With_centres = -#if L==1 // ca - "Amb centres"; -#elif L==2 // de - "Mit Lehrinstitute"; -#elif L==3 // en - "With centres"; -#elif L==4 // es - "Con centros"; -#elif L==5 // fr - "Avec centres"; -#elif L==6 // gn - "Con centros"; // Okoteve traducción -#elif L==7 // it - "Con centri"; -#elif L==8 // pl - "Z centra"; -#elif L==9 // pt - "Com centros"; -#endif - -const char *Txt_With_courses = -#if L==1 // ca - "Amb assignatures"; -#elif L==2 // de - "Mit Kursen"; -#elif L==3 // en - "With courses"; -#elif L==4 // es - "Con asignaturas"; -#elif L==5 // fr - "Avec matières"; -#elif L==6 // gn - "Con asignaturas"; // Okoteve traducción -#elif L==7 // it - "Con corsi"; -#elif L==8 // pl - "Z kursów"; -#elif L==9 // pt - "Com disciplinas"; -#endif - -const char *Txt_With_degrees = -#if L==1 // ca - "Amb titulacions"; -#elif L==2 // de - "Mit Studiengang"; -#elif L==3 // en - "With degrees"; -#elif L==4 // es - "Con titulaciones"; -#elif L==5 // fr - "Avec études"; -#elif L==6 // gn - "Con titulaciones"; // Okoteve traducción -#elif L==7 // it - "Con lauree"; -#elif L==8 // pl - "Z stopnie"; -#elif L==9 // pt - "Com graus"; -#endif - -const char *Txt_With_institutions = -#if L==1 // ca - "Amb institucions"; -#elif L==2 // de - "Mit Hochschulen"; -#elif L==3 // en - "With institutions"; -#elif L==4 // es - "Con instituciones"; -#elif L==5 // fr - "Avec établissements"; -#elif L==6 // gn - "Con instituciones"; // Okoteve traducción -#elif L==7 // it - "Con istituzioni"; -#elif L==8 // pl - "Z instytucje"; -#elif L==9 // pt - "Com instituções"; + "Com "; #endif const char *Txt_with_new_posts =