mirror of https://github.com/acanas/swad-core.git
Version 15.15
This commit is contained in:
parent
290da880fd
commit
f26f1533e2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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)
|
||||
|
|
|
@ -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 ();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -165,7 +165,7 @@ void Ins_SeeInsWithPendingCtrs (void)
|
|||
"<a href=\"%s\" title=\"%s\" class=\"DAT\" target=\"_blank\">",
|
||||
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,"</a>"
|
||||
"</td>");
|
||||
|
||||
|
|
|
@ -281,7 +281,8 @@ 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
|
||||
/***** Get and update type of list,
|
||||
number of columns in class photo
|
||||
and preference about view photos *****/
|
||||
Usr_GetAndUpdatePrefsAboutUsrList ();
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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</a>",Rank);
|
||||
Act_FormEnd ();
|
||||
|
|
141
swad_statistic.c
141
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,"<br />"
|
||||
"%s: <select name=\"UseStatType\">",
|
||||
"%s: <select name=\"FigureType\">",
|
||||
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,"<option value=\"%u\"",
|
||||
(unsigned) UseStatType);
|
||||
if (UseStatType == Gbl.Stat.UseStatType)
|
||||
(unsigned) FigureType);
|
||||
if (FigureType == Gbl.Stat.FigureType)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out," />"
|
||||
"%s"
|
||||
"</option>",
|
||||
Txt_STAT_USE_STAT_TYPES[UseStatType]);
|
||||
Txt_STAT_USE_STAT_TYPES[FigureType]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</div>");
|
||||
|
@ -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,17 +5023,64 @@ 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")))
|
||||
{
|
||||
/* Draw the classphoto/list */
|
||||
switch (Gbl.Usrs.Me.ListType)
|
||||
{
|
||||
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,"<tr>");
|
||||
TRIsOpen = true;
|
||||
}
|
||||
|
||||
/***** Get institution data and statistic *****/
|
||||
NumberThisRow = Sta_GetInsAndStat (&Ins,mysql_res);
|
||||
|
||||
/***** Write link to institution *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s CENTER_MIDDLE\">",
|
||||
The_ClassForm[Gbl.Prefs.Theme]);
|
||||
|
||||
/* 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,"<br />%u</a>",NumberThisRow);
|
||||
Act_FormEnd ();
|
||||
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/***** End of user's cell *****/
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
if ((++NumIns % Gbl.Usrs.ClassPhoto.Cols) == 0)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"</tr>");
|
||||
TRIsOpen = false;
|
||||
}
|
||||
}
|
||||
if (TRIsOpen)
|
||||
fprintf (Gbl.F.Out,"</tr>");
|
||||
|
||||
break;
|
||||
case Usr_LIST:
|
||||
/***** Draw institutions as a list *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<th></th>"
|
||||
"<th class=\"LEFT_MIDDLE\">"
|
||||
|
@ -5027,17 +5097,8 @@ static void Sta_GetAndShowInss (const char *Query,const char *TxtFigure)
|
|||
NumIns <= NumInss;
|
||||
NumIns++)
|
||||
{
|
||||
/***** 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");
|
||||
/***** Get institution data and statistic *****/
|
||||
NumberThisRow = Sta_GetInsAndStat (&Ins,mysql_res);
|
||||
|
||||
/***** Number of order *****/
|
||||
if (NumberThisRow != NumberLastRow)
|
||||
|
@ -5056,9 +5117,13 @@ static void Sta_GetAndShowInss (const char *Query,const char *TxtFigure)
|
|||
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," %s</a>",Ins.FullName);
|
||||
fprintf (Gbl.F.Out," ");
|
||||
}
|
||||
fprintf (Gbl.F.Out,"%s</a>",Ins.FullName);
|
||||
Act_FormEnd ();
|
||||
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
@ -5072,6 +5137,8 @@ static void Sta_GetAndShowInss (const char *Query,const char *TxtFigure)
|
|||
|
||||
NumberLastRow = NumberThisRow;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Free structure that stores the query result */
|
||||
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 ();
|
||||
|
||||
|
|
|
@ -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,"<table class=\"CELLS_PAD_4\" style=\"margin:4px auto;\">"
|
||||
"<tr>"
|
||||
"<td class=\"%s LEFT_MIDDLE\">",
|
||||
|
@ -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 ();
|
||||
|
|
Loading…
Reference in New Issue