diff --git a/html/SWAD-manual-EN.odt b/html/SWAD-manual-EN.odt index 2cf9495a..c40d3779 100644 Binary files a/html/SWAD-manual-EN.odt and b/html/SWAD-manual-EN.odt differ diff --git a/html/SWAD-manual-EN.pdf b/html/SWAD-manual-EN.pdf index 4e60fbb9..8078cbf0 100644 Binary files a/html/SWAD-manual-EN.pdf and b/html/SWAD-manual-EN.pdf differ diff --git a/html/SWAD-manual-ES.odt b/html/SWAD-manual-ES.odt index a9092874..9df544af 100644 Binary files a/html/SWAD-manual-ES.odt and b/html/SWAD-manual-ES.odt differ diff --git a/html/SWAD-manual-ES.pdf b/html/SWAD-manual-ES.pdf index 61b55de3..6053f849 100644 Binary files a/html/SWAD-manual-ES.pdf and b/html/SWAD-manual-ES.pdf differ diff --git a/swad_changelog.h b/swad_changelog.h index c40f8039..5b3558ff 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -107,11 +107,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.14.2 (2015/10/16)" +#define Log_PLATFORM_VERSION "SWAD 15.15 (2015/10/19)" // 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.15: Oct 19, 2015 Statistic figure about institutions can be displayed as a class photo or as a list. (186251 lines) Version 15.14.2: Oct 16, 2015 Minor changes in layout. (186166 lines) Version 15.14.1: Oct 16, 2015 Fixed minor bug in edition of degrees. (186170 lines) Version 15.14: Oct 15, 2015 Table log (historical log) renamed as log_full. (186169 lines) diff --git a/swad_file_browser.c b/swad_file_browser.c index 02793299..f761964c 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -2842,7 +2842,8 @@ void Brw_AskEditWorksCrs (void) /***** Get parameters related to file browser *****/ Brw_GetParAndInitFileBrowser (); - /***** Get and update type of list, number of columns in class photo + /***** Get and update type of list, + number of columns in class photo and preference about view photos *****/ Usr_GetAndUpdatePrefsAboutUsrList (); diff --git a/swad_global.c b/swad_global.c index 25e07fbb..d1a56ebc 100644 --- a/swad_global.c +++ b/swad_global.c @@ -405,7 +405,7 @@ void Gbl_InitializeGlobals (void) Gbl.Stat.Role = Sta_IDENTIFIED_USRS; Gbl.Stat.NumAction = ActAll; Gbl.Stat.RowsPerPage = 50; - Gbl.Stat.UseStatType = Sta_USERS; + Gbl.Stat.FigureType = Sta_USERS; Gbl.Scope.Current = Sco_SCOPE_CRS; diff --git a/swad_global.h b/swad_global.h index 17340cd6..702d9717 100644 --- a/swad_global.h +++ b/swad_global.h @@ -655,7 +655,7 @@ struct Globals struct { Sta_ClicksGroupedBy_t ClicksGroupedBy; - Sta_FigureType_t UseStatType; + Sta_FigureType_t FigureType; Sta_Role_t Role; Sta_CountType_t CountType; Act_Action_t NumAction; diff --git a/swad_institution.c b/swad_institution.c index 7d9f5d59..ff890d6d 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -165,7 +165,7 @@ void Ins_SeeInsWithPendingCtrs (void) "", BgColor,Ins.WWW,Ins.FullName); Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName, - 16,"CENTER_TOP",true); + 16,"CENTER_MIDDLE",true); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_message.c b/swad_message.c index a32162f9..045e8f06 100644 --- a/swad_message.c +++ b/swad_message.c @@ -281,8 +281,9 @@ static void Msg_PutFormMsgUsrs (const char *Content) if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) { - /***** Get and update type of list, number of columns in class photo - and preference about view photos *****/ + /***** Get and update type of list, + number of columns in class photo + and preference about view photos *****/ Usr_GetAndUpdatePrefsAboutUsrList (); /***** Form to select groups *****/ diff --git a/swad_photo.c b/swad_photo.c index 8e439d87..4035b41f 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -1486,7 +1486,9 @@ void Pho_ShowOrPrintPhotoDegree (Pho_AvgPhotoSeeOrPrint_t SeeOrPrint) /***** Get how to order degrees from form *****/ Gbl.Stat.DegPhotos.HowOrderDegrees = Pho_GetHowOrderDegreesFromForm (); - /***** Get and update type of list, number of columns in class photo and preference about view photos *****/ + /***** Get and update type of list, + number of columns in class photo + and preference about view photos *****/ Usr_GetAndUpdatePrefsAboutUsrList (); if (SeeOrPrint == Pho_DEGREES_SEE) diff --git a/swad_profile.c b/swad_profile.c index 162bf905..bc8e5fc5 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -755,7 +755,7 @@ static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs) /***** Rank in form to go to ranking *****/ Act_FormStart (ActSeeUseGbl); Sco_PutParamScope (Sco_SCOPE_SYS); - Par_PutHiddenParamUnsigned ("UseStatType",(unsigned) Sta_USERS_RANKING); + Par_PutHiddenParamUnsigned ("FigureType",(unsigned) Sta_USERS_RANKING); Act_LinkFormSubmit (Gbl.Title,The_ClassForm[Gbl.Prefs.Theme]); fprintf (Gbl.F.Out,"#%lu",Rank); Act_FormEnd (); diff --git a/swad_statistic.c b/swad_statistic.c index bb00d616..4f4adb00 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -175,6 +175,7 @@ static void Sta_GetAndShowInssOrderedByNumCrss (void); static void Sta_GetAndShowInssOrderedByNumUsrsInCrss (void); static void Sta_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem (void); static void Sta_GetAndShowInss (const char *Query,const char *TxtFigure); +static unsigned Sta_GetInsAndStat (struct Institution *Ins,MYSQL_RES *mysql_res); static void Sta_GetAndShowUsersStats (void); static void Sta_GetAndShowUsersRanking (void); @@ -451,7 +452,9 @@ void Sta_AskShowCrsHits (void) Sta_ClicksGroupedBy_t ClicksGroupedBy; unsigned long i; - /***** Get and update type of list, number of columns in class photo and preference about view photos *****/ + /***** Get and update type of list, + number of columns in class photo + and preference about view photos *****/ Usr_GetAndUpdatePrefsAboutUsrList (); /***** Show form to select the grupos *****/ @@ -3799,7 +3802,7 @@ void Sta_ReqUseOfPlatform (void) extern const char *Txt_Scope; extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES]; extern const char *Txt_Show_statistic; - Sta_FigureType_t UseStatType; + Sta_FigureType_t FigureType; /***** Form to show statistic *****/ Act_FormStart (ActSeeUseGbl); @@ -3823,20 +3826,20 @@ void Sta_ReqUseOfPlatform (void) /***** Type of statistic *****/ fprintf (Gbl.F.Out,"
" - "%s: ", Txt_Statistic); - for (UseStatType = (Sta_FigureType_t) 0; - UseStatType < Sta_NUM_FIGURES; - UseStatType++) + for (FigureType = (Sta_FigureType_t) 0; + FigureType < Sta_NUM_FIGURES; + FigureType++) { fprintf (Gbl.F.Out,"", - Txt_STAT_USE_STAT_TYPES[UseStatType]); + Txt_STAT_USE_STAT_TYPES[FigureType]); } fprintf (Gbl.F.Out,"" ""); @@ -3848,6 +3851,15 @@ void Sta_ReqUseOfPlatform (void) Act_FormEnd (); } +/*****************************************************************************/ +/********* Put hidden parameter for the type of figure (statistic) ***********/ +/*****************************************************************************/ + +void Pho_PutHiddenParamFigureType (void) + { + Par_PutHiddenParamUnsigned ("FigureType",(unsigned) Gbl.Stat.FigureType); + } + /*****************************************************************************/ /************************** Show use of the platform *************************/ /*****************************************************************************/ @@ -3858,18 +3870,18 @@ void Sta_ShowUseOfPlatform (void) unsigned UnsignedNum; /***** Get the type of stat of use ******/ - Par_GetParToText ("UseStatType",UnsignedStr,10); + Par_GetParToText ("FigureType",UnsignedStr,10); if (sscanf (UnsignedStr,"%u",&UnsignedNum) != 1) Lay_ShowErrorAndExit ("Type of stat is missing."); if (UnsignedNum >= Sta_NUM_FIGURES) Lay_ShowErrorAndExit ("Type of stat is missing."); - Gbl.Stat.UseStatType = (Sta_FigureType_t) UnsignedNum; + Gbl.Stat.FigureType = (Sta_FigureType_t) UnsignedNum; /***** Show again the form to see use of the platform *****/ Sta_ReqUseOfPlatform (); /***** Show the stat of use selected by user *****/ - switch (Gbl.Stat.UseStatType) + switch (Gbl.Stat.FigureType) { case Sta_USERS_RANKING: /***** Users ranking *****/ @@ -4700,6 +4712,17 @@ static void Sta_GetAndShowNumCrssInSWAD (void) static void Sta_GetAndShowInstitutionsStats (void) { + extern const char *Txt_Institutions; + + /***** Get and update type of list, number of columns in class photo + and preference about view photos *****/ + Usr_GetAndUpdatePrefsAboutUsrList (); + + /***** Form to select type of list used to display degree photos *****/ + Lay_StartRoundFrame (NULL,Txt_Institutions); + Usr_ShowFormsToSelectUsrListType (ActSeeUseGbl); + Lay_EndRoundFrame (); + /****** Institutions ordered by number of centres ******/ Sta_GetAndShowInssOrderedByNumCtrs (); @@ -5000,77 +5023,121 @@ static void Sta_GetAndShowInss (const char *Query,const char *TxtFigure) extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *Txt_Institution; MYSQL_RES *mysql_res; - MYSQL_ROW row; unsigned NumInss; unsigned NumIns; unsigned NumOrder; unsigned NumberLastRow; unsigned NumberThisRow; struct Institution Ins; + bool TRIsOpen = false; /***** Query database *****/ if ((NumInss = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get institutions"))) { - fprintf (Gbl.F.Out,"" - "" - "" - "%s" - "" - "" - "%s" - "" - "", - Txt_Institution, - TxtFigure); - - for (NumIns = 1, NumOrder = 1, NumberLastRow = 0; - NumIns <= NumInss; - NumIns++) + /* Draw the classphoto/list */ + switch (Gbl.Usrs.Me.ListType) { - /***** Get next institution *****/ - row = mysql_fetch_row (mysql_res); + case Usr_CLASS_PHOTO: + /***** Draw institutions as a class photo *****/ + for (NumIns = 0; + NumIns < NumInss;) + { + if ((NumIns % Gbl.Usrs.ClassPhoto.Cols) == 0) + { + fprintf (Gbl.F.Out,""); + TRIsOpen = true; + } - /* Get data of this institution (row[0]) */ - Ins.InsCod = Str_ConvertStrCodToLongCod (row[0]); - if (!Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA)) - Lay_ShowErrorAndExit ("Institution not found."); + /***** Get institution data and statistic *****/ + NumberThisRow = Sta_GetInsAndStat (&Ins,mysql_res); - /* Get statistic (row[1]) */ - if (sscanf (row[1],"%u",&NumberThisRow) != 1) - Lay_ShowErrorAndExit ("Error in statistic"); + /***** Write link to institution *****/ + fprintf (Gbl.F.Out,"", + The_ClassForm[Gbl.Prefs.Theme]); - /***** Number of order *****/ - if (NumberThisRow != NumberLastRow) - NumOrder = NumIns; - fprintf (Gbl.F.Out,"" - "" - "%u" - "", - NumOrder); + /* Icon and name of this institution */ + Act_FormStart (ActSeeInsInf); + Ins_PutParamInsCod (Ins.InsCod); + Act_LinkFormSubmit (Ins.FullName,The_ClassForm[Gbl.Prefs.Theme]); + Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.FullName, + 32,NULL,true); + fprintf (Gbl.F.Out,"
%u",NumberThisRow); + Act_FormEnd (); - /***** Write link to institution *****/ - fprintf (Gbl.F.Out,"", - The_ClassForm[Gbl.Prefs.Theme]); + fprintf (Gbl.F.Out,""); - /* Icon and name of this institution */ - Act_FormStart (ActSeeInsInf); - Ins_PutParamInsCod (Ins.InsCod); - Act_LinkFormSubmit (Ins.ShortName,The_ClassForm[Gbl.Prefs.Theme]); - Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName, - 32,NULL,true); - fprintf (Gbl.F.Out," %s",Ins.FullName); - Act_FormEnd (); + /***** End of user's cell *****/ + fprintf (Gbl.F.Out,""); - fprintf (Gbl.F.Out,""); + if ((++NumIns % Gbl.Usrs.ClassPhoto.Cols) == 0) + { + fprintf (Gbl.F.Out,""); + TRIsOpen = false; + } + } + if (TRIsOpen) + fprintf (Gbl.F.Out,""); - /***** Write statistic *****/ - fprintf (Gbl.F.Out,"" - "%u" - "" - "", - NumberThisRow); + break; + case Usr_LIST: + /***** Draw institutions as a list *****/ + fprintf (Gbl.F.Out,"" + "" + "" + "%s" + "" + "" + "%s" + "" + "", + Txt_Institution, + TxtFigure); - NumberLastRow = NumberThisRow; + for (NumIns = 1, NumOrder = 1, NumberLastRow = 0; + NumIns <= NumInss; + NumIns++) + { + /***** Get institution data and statistic *****/ + NumberThisRow = Sta_GetInsAndStat (&Ins,mysql_res); + + /***** Number of order *****/ + if (NumberThisRow != NumberLastRow) + NumOrder = NumIns; + fprintf (Gbl.F.Out,"" + "" + "%u" + "", + NumOrder); + + /***** Write link to institution *****/ + fprintf (Gbl.F.Out,"", + The_ClassForm[Gbl.Prefs.Theme]); + + /* Icon and name of this institution */ + Act_FormStart (ActSeeInsInf); + Ins_PutParamInsCod (Ins.InsCod); + Act_LinkFormSubmit (Ins.ShortName,The_ClassForm[Gbl.Prefs.Theme]); + if (Gbl.Usrs.Listing.WithPhotos) + { + Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName, + 32,NULL,true); + fprintf (Gbl.F.Out," "); + } + fprintf (Gbl.F.Out,"%s",Ins.FullName); + Act_FormEnd (); + + fprintf (Gbl.F.Out,""); + + /***** Write statistic *****/ + fprintf (Gbl.F.Out,"" + "%u" + "" + "", + NumberThisRow); + + NumberLastRow = NumberThisRow; + } + break; } } @@ -5082,6 +5149,30 @@ static void Sta_GetAndShowInss (const char *Query,const char *TxtFigure) /************************* Get total number of users *************************/ /*****************************************************************************/ +static unsigned Sta_GetInsAndStat (struct Institution *Ins,MYSQL_RES *mysql_res) + { + MYSQL_ROW row; + unsigned NumberThisRow; + + /***** Get next institution *****/ + row = mysql_fetch_row (mysql_res); + + /***** Get data of this institution (row[0]) *****/ + Ins->InsCod = Str_ConvertStrCodToLongCod (row[0]); + if (!Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_MINIMAL_DATA)) + Lay_ShowErrorAndExit ("Institution not found."); + + /***** Get statistic (row[1]) *****/ + if (sscanf (row[1],"%u",&NumberThisRow) != 1) + Lay_ShowErrorAndExit ("Error in statistic"); + + return NumberThisRow; + } + +/*****************************************************************************/ +/************************* Get total number of users *************************/ +/*****************************************************************************/ + unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role) { char Query[512]; diff --git a/swad_statistic.h b/swad_statistic.h index ef362002..1ade0f7a 100644 --- a/swad_statistic.h +++ b/swad_statistic.h @@ -147,6 +147,7 @@ void Sta_SetIniEndDates (void); void Sta_SeeGblAccesses (void); void Sta_SeeCrsAccesses (void); void Sta_ReqUseOfPlatform (void); +void Pho_PutHiddenParamFigureType (void); void Sta_ShowUseOfPlatform (void); unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role); void Sta_WriteParamsDatesSeeAccesses (void); diff --git a/swad_test.c b/swad_test.c index 30967a58..b4fe3c1c 100644 --- a/swad_test.c +++ b/swad_test.c @@ -5889,7 +5889,8 @@ void Tst_SelUsrsToSeeUsrsTstExams (void) extern const char *Txt_Users; extern const char *Txt_See_exams; - /***** Get and update type of list, number of columns in class photo + /***** Get and update type of list, + number of columns in class photo and preference about view photos *****/ Usr_GetAndUpdatePrefsAboutUsrList (); diff --git a/swad_user.c b/swad_user.c index 1d578bb7..57c464fc 100644 --- a/swad_user.c +++ b/swad_user.c @@ -4779,7 +4779,7 @@ void Usr_FreeListOtherRecipients (void) void Usr_ShowFormsToSelectUsrListType (Act_Action_t NextAction) { - /***** Select USR_CLASS_ROOM *****/ + /***** Select Usr_CLASS_PHOTO *****/ fprintf (Gbl.F.Out,"" "" "
", @@ -4869,6 +4869,9 @@ void Usr_PutExtraParamsUsrList (Act_Action_t NextAction) Usr_PutParamOtherUsrCodEncrypted (); } break; + case ActSeeUseGbl: + Pho_PutHiddenParamFigureType (); + break; case ActSeePhoDeg: Pho_PutHiddenParamTypeOfAvg (); Pho_PutHiddenParamPhotoSize (); @@ -5707,11 +5710,11 @@ void Usr_ListAllDataTchs (void) Usr_GetAndUpdatePrefsAboutUsrList (); /***** Get scope *****/ - Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | - 1 << Sco_SCOPE_CTY | + Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | + 1 << Sco_SCOPE_CTY | 1 << Sco_SCOPE_INS | - 1 << Sco_SCOPE_CTR | - 1 << Sco_SCOPE_DEG | + 1 << Sco_SCOPE_CTR | + 1 << Sco_SCOPE_DEG | 1 << Sco_SCOPE_CRS; Gbl.Scope.Default = Sco_SCOPE_CRS; Sco_GetScope (); @@ -6756,11 +6759,11 @@ void Usr_SeeTeachers (void) Usr_GetAndUpdatePrefsAboutUsrList (); /***** Get scope *****/ - Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | - 1 << Sco_SCOPE_CTY | + Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | + 1 << Sco_SCOPE_CTY | 1 << Sco_SCOPE_INS | - 1 << Sco_SCOPE_CTR | - 1 << Sco_SCOPE_DEG | + 1 << Sco_SCOPE_CTR | + 1 << Sco_SCOPE_DEG | 1 << Sco_SCOPE_CRS; Gbl.Scope.Default = Sco_SCOPE_CRS; Sco_GetScope (); @@ -6991,11 +6994,11 @@ void Usr_SeeTchClassPhotoPrn (void) Usr_GetAndUpdatePrefsAboutUsrList (); /***** Get scope *****/ - Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | - 1 << Sco_SCOPE_CTY | + Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | + 1 << Sco_SCOPE_CTY | 1 << Sco_SCOPE_INS | - 1 << Sco_SCOPE_CTR | - 1 << Sco_SCOPE_DEG | + 1 << Sco_SCOPE_CTR | + 1 << Sco_SCOPE_DEG | 1 << Sco_SCOPE_CRS; Gbl.Scope.Default = Sco_SCOPE_CRS; Sco_GetScope ();