mirror of https://github.com/acanas/swad-core.git
Version 15.40
This commit is contained in:
parent
b2121bdcde
commit
10ace7a7a8
|
@ -11164,4 +11164,3 @@ SELECT TstCod,AllowTeachers,UNIX_TIMESTAMP(TstTime) AS T,NumQsts,NumQstsNotBlank
|
||||||
SELECT * FROM expanded_folders WHERE UNIX_TIMESTAMP() > UNIX_TIMESTAMP(ClickTime)+'1000';
|
SELECT * FROM expanded_folders WHERE UNIX_TIMESTAMP() > UNIX_TIMESTAMP(ClickTime)+'1000';
|
||||||
SELECT * FROM expanded_folders WHERE ClickTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'1000');
|
SELECT * FROM expanded_folders WHERE ClickTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'1000');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -112,11 +112,12 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.39.1 (2015/11/16)"
|
#define Log_PLATFORM_VERSION "SWAD 15.40 (2015/11/17)"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 15.40: Nov 17, 2015 Changes in listing of countries. (187275 lines)
|
||||||
Version 15.39.1: Nov 16, 2015 User' e-mail can be removed even if it is the unique. (187236 lines)
|
Version 15.39.1: Nov 16, 2015 User' e-mail can be removed even if it is the unique. (187236 lines)
|
||||||
Version 15.39: Nov 16, 2015 Administrators can edit another user' e-mails. (187268 lines)
|
Version 15.39: Nov 16, 2015 Administrators can edit another user' e-mails. (187268 lines)
|
||||||
9 changes necessary in database:
|
9 changes necessary in database:
|
||||||
|
|
113
swad_country.c
113
swad_country.c
|
@ -65,6 +65,7 @@ extern struct Globals Gbl;
|
||||||
|
|
||||||
static void Cty_Configuration (bool PrintView);
|
static void Cty_Configuration (bool PrintView);
|
||||||
|
|
||||||
|
static unsigned Cty_GetNumUsrsWhoClaimToBelongToCty (long CtyCod);
|
||||||
static void Cty_GetParamCtyOrderType (void);
|
static void Cty_GetParamCtyOrderType (void);
|
||||||
static void Cty_GetMapAttribution (long CtyCod,char **MapAttribution);
|
static void Cty_GetMapAttribution (long CtyCod,char **MapAttribution);
|
||||||
static void Cty_FreeMapAttribution (char **MapAttribution);
|
static void Cty_FreeMapAttribution (char **MapAttribution);
|
||||||
|
@ -86,7 +87,7 @@ void Cty_SeeCtyWithPendingInss (void)
|
||||||
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
||||||
extern const char *Txt_Countries_with_pending_institutions;
|
extern const char *Txt_Countries_with_pending_institutions;
|
||||||
extern const char *Txt_Country;
|
extern const char *Txt_Country;
|
||||||
extern const char *Txt_Institutions_ABBREVIATION;
|
extern const char *Txt_Institutions;
|
||||||
extern const char *Txt_There_are_no_countries_with_requests_for_institutions_to_be_confirmed;
|
extern const char *Txt_There_are_no_countries_with_requests_for_institutions_to_be_confirmed;
|
||||||
char Query[1024];
|
char Query[1024];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
@ -126,7 +127,7 @@ void Cty_SeeCtyWithPendingInss (void)
|
||||||
"</th>"
|
"</th>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_Country,
|
Txt_Country,
|
||||||
Txt_Institutions_ABBREVIATION);
|
Txt_Institutions);
|
||||||
|
|
||||||
/***** List the countries *****/
|
/***** List the countries *****/
|
||||||
for (NumCty = 0;
|
for (NumCty = 0;
|
||||||
|
@ -453,22 +454,13 @@ void Cty_ListCountries2 (void)
|
||||||
extern const char *Txt_Countries;
|
extern const char *Txt_Countries;
|
||||||
extern const char *Txt_COUNTRIES_HELP_ORDER[2];
|
extern const char *Txt_COUNTRIES_HELP_ORDER[2];
|
||||||
extern const char *Txt_COUNTRIES_ORDER[2];
|
extern const char *Txt_COUNTRIES_ORDER[2];
|
||||||
extern const char *Txt_Students_ABBREVIATION;
|
extern const char *Txt_Users_in_courses;
|
||||||
extern const char *Txt_Teachers_ABBREVIATION;
|
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
extern const char *Txt_Institutions_ABBREVIATION;
|
extern const char *Txt_Institutions;
|
||||||
extern const char *Txt_Other_countries;
|
extern const char *Txt_Other_countries;
|
||||||
extern const char *Txt_Country_unspecified;
|
extern const char *Txt_Country_unspecified;
|
||||||
Cty_CtysOrderType_t Order;
|
Cty_CtysOrderType_t Order;
|
||||||
unsigned NumCty;
|
unsigned NumCty;
|
||||||
unsigned NumUsrs;
|
|
||||||
unsigned NumStds;
|
|
||||||
unsigned NumTchs;
|
|
||||||
unsigned NumUsrsWithCountry = 0;
|
|
||||||
unsigned NumStdsWithCountry = 0;
|
|
||||||
unsigned NumTchsWithCountry = 0;
|
|
||||||
unsigned NumInssWithCountry = 0;
|
|
||||||
unsigned NumUsrsInOtherCtys;
|
|
||||||
unsigned NumInssInOtherCtys;
|
|
||||||
const char *BgColor;
|
const char *BgColor;
|
||||||
|
|
||||||
/***** Put link (form) to edit countries *****/
|
/***** Put link (form) to edit countries *****/
|
||||||
|
@ -482,7 +474,9 @@ void Cty_ListCountries2 (void)
|
||||||
Order <= Cty_ORDER_BY_NUM_USRS;
|
Order <= Cty_ORDER_BY_NUM_USRS;
|
||||||
Order++)
|
Order++)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<th class=\"LEFT_MIDDLE\">");
|
fprintf (Gbl.F.Out,"<th class=\"%s\">",
|
||||||
|
Order == Cty_ORDER_BY_COUNTRY ? "LEFT_MIDDLE" :
|
||||||
|
"RIGHT_MIDDLE");
|
||||||
Act_FormStart (ActSeeCty);
|
Act_FormStart (ActSeeCty);
|
||||||
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
|
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
|
||||||
Act_LinkFormSubmit (Txt_COUNTRIES_HELP_ORDER[Order],"TIT_TBL");
|
Act_LinkFormSubmit (Txt_COUNTRIES_HELP_ORDER[Order],"TIT_TBL");
|
||||||
|
@ -496,6 +490,9 @@ void Cty_ListCountries2 (void)
|
||||||
fprintf (Gbl.F.Out,"</th>");
|
fprintf (Gbl.F.Out,"</th>");
|
||||||
}
|
}
|
||||||
fprintf (Gbl.F.Out,"<th class=\"RIGHT_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<th class=\"RIGHT_MIDDLE\">"
|
||||||
|
"%s"
|
||||||
|
"</th>"
|
||||||
|
"<th class=\"RIGHT_MIDDLE\">"
|
||||||
"%s"
|
"%s"
|
||||||
"</th>"
|
"</th>"
|
||||||
"<th class=\"RIGHT_MIDDLE\">"
|
"<th class=\"RIGHT_MIDDLE\">"
|
||||||
|
@ -505,9 +502,10 @@ void Cty_ListCountries2 (void)
|
||||||
"%s"
|
"%s"
|
||||||
"</th>"
|
"</th>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_Students_ABBREVIATION,
|
Txt_Users_in_courses,
|
||||||
Txt_Teachers_ABBREVIATION,
|
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||||
Txt_Institutions_ABBREVIATION);
|
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||||
|
Txt_Institutions);
|
||||||
|
|
||||||
/***** Write all the countries and their number of users and institutions *****/
|
/***** Write all the countries and their number of users and institutions *****/
|
||||||
for (NumCty = 0;
|
for (NumCty = 0;
|
||||||
|
@ -526,8 +524,6 @@ void Cty_ListCountries2 (void)
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
/* Write stats of this country */
|
/* Write stats of this country */
|
||||||
NumStds = Usr_GetNumUsrsInCountry (Rol_STUDENT,Gbl.Ctys.Lst[NumCty].CtyCod);
|
|
||||||
NumTchs = Usr_GetNumUsrsInCountry (Rol_TEACHER,Gbl.Ctys.Lst[NumCty].CtyCod);
|
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
||||||
"%u"
|
"%u"
|
||||||
"</td>"
|
"</td>"
|
||||||
|
@ -540,33 +536,27 @@ void Cty_ListCountries2 (void)
|
||||||
"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
||||||
"%u"
|
"%u"
|
||||||
"</td>"
|
"</td>"
|
||||||
|
"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
||||||
|
"%u"
|
||||||
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
BgColor,Gbl.Ctys.Lst[NumCty].NumUsrs,
|
BgColor,Gbl.Ctys.Lst[NumCty].NumUsrs,
|
||||||
BgColor,NumStds,
|
BgColor,Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,Gbl.Ctys.Lst[NumCty].CtyCod),
|
||||||
BgColor,NumTchs,
|
BgColor,Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,Gbl.Ctys.Lst[NumCty].CtyCod),
|
||||||
|
BgColor,Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,Gbl.Ctys.Lst[NumCty].CtyCod),
|
||||||
BgColor,Gbl.Ctys.Lst[NumCty].NumInss);
|
BgColor,Gbl.Ctys.Lst[NumCty].NumInss);
|
||||||
NumUsrsWithCountry += Gbl.Ctys.Lst[NumCty].NumUsrs;
|
|
||||||
NumInssWithCountry += Gbl.Ctys.Lst[NumCty].NumInss;
|
|
||||||
NumStdsWithCountry += NumStds;
|
|
||||||
NumTchsWithCountry += NumTchs;
|
|
||||||
|
|
||||||
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Separation row *****/
|
/***** Separation row *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td colspan=\"6\" class=\"DAT CENTER_MIDDLE\">"
|
"<td colspan=\"7\" class=\"DAT CENTER_MIDDLE\">"
|
||||||
" "
|
" "
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
/***** Write institutions and users with other country *****/
|
/***** Write users and institutions in other countries *****/
|
||||||
NumUsrsInOtherCtys = Usr_GetNumUsrsInCountry (Rol_UNKNOWN,0); // Here Rol_ROLE_UNKNOWN means "all users"
|
|
||||||
NumStds = Usr_GetNumUsrsInCountry (Rol_STUDENT,0);
|
|
||||||
NumTchs = Usr_GetNumUsrsInCountry (Rol_TEACHER,0);
|
|
||||||
NumInssInOtherCtys = Ins_GetNumInssInCty (0);
|
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td></td>"
|
|
||||||
"<td class=\"DAT LEFT_MIDDLE\">"
|
"<td class=\"DAT LEFT_MIDDLE\">"
|
||||||
"%s"
|
"%s"
|
||||||
"</td>"
|
"</td>"
|
||||||
|
@ -582,20 +572,19 @@ void Cty_ListCountries2 (void)
|
||||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||||
"%u"
|
"%u"
|
||||||
"</td>"
|
"</td>"
|
||||||
|
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||||
|
"%u"
|
||||||
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_Other_countries,
|
Txt_Other_countries,
|
||||||
NumUsrsInOtherCtys,NumStds,NumTchs,NumInssInOtherCtys);
|
Cty_GetNumUsrsWhoClaimToBelongToCty (0),
|
||||||
NumUsrsWithCountry += NumUsrsInOtherCtys;
|
Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,0), // Here Rol_ROLE_UNKNOWN means "all users",
|
||||||
NumStdsWithCountry += NumStds;
|
Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,0),
|
||||||
NumTchsWithCountry += NumTchs;
|
Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,0),
|
||||||
NumInssWithCountry += NumInssInOtherCtys;
|
Ins_GetNumInssInCty (0));
|
||||||
|
|
||||||
/***** Write institutions with no country *****/
|
/***** Write users and institutions with unknown country *****/
|
||||||
NumStds = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_STUDENT);
|
|
||||||
NumTchs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_TEACHER);
|
|
||||||
NumUsrs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_UNKNOWN); // NumUsrs >= NumStds + NumTchs
|
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td></td>"
|
|
||||||
"<td class=\"DAT LEFT_MIDDLE\">"
|
"<td class=\"DAT LEFT_MIDDLE\">"
|
||||||
"%s"
|
"%s"
|
||||||
"</td>"
|
"</td>"
|
||||||
|
@ -603,20 +592,21 @@ void Cty_ListCountries2 (void)
|
||||||
"%u"
|
"%u"
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||||
"%u"
|
"0"
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||||
"%u"
|
"0"
|
||||||
|
"</td>"
|
||||||
|
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||||
|
"0"
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||||
"%u"
|
"%u"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_Country_unspecified,
|
Txt_Country_unspecified,
|
||||||
NumUsrs - NumUsrsWithCountry,
|
Cty_GetNumUsrsWhoClaimToBelongToCty (-1L),
|
||||||
NumStds - NumStdsWithCountry,
|
Ins_GetNumInssInCty (-1L));
|
||||||
NumTchs - NumTchsWithCountry,
|
|
||||||
Ins_GetNumInssTotal () - NumInssWithCountry);
|
|
||||||
|
|
||||||
/***** Table end *****/
|
/***** Table end *****/
|
||||||
Lay_EndRoundFrameTable ();
|
Lay_EndRoundFrameTable ();
|
||||||
|
@ -624,8 +614,8 @@ void Cty_ListCountries2 (void)
|
||||||
/***** Div for Google Geochart *****/
|
/***** Div for Google Geochart *****/
|
||||||
if (Gbl.CurrentAct == ActSeeCty)
|
if (Gbl.CurrentAct == ActSeeCty)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div id='chart_div' style=\"width:625px;"
|
fprintf (Gbl.F.Out,"<div id=\"chart_div\""
|
||||||
" margin:12px auto;\">"
|
" style=\"width:500px; margin:12px auto;\">"
|
||||||
"</div>");
|
"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,6 +623,21 @@ void Cty_ListCountries2 (void)
|
||||||
Cty_FreeListCountries ();
|
Cty_FreeListCountries ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******** Get number of users who claim to belong to other countries *********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static unsigned Cty_GetNumUsrsWhoClaimToBelongToCty (long CtyCod)
|
||||||
|
{
|
||||||
|
char Query[256];
|
||||||
|
|
||||||
|
/***** Get number of users from database *****/
|
||||||
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||||
|
" WHERE CtyCod='%ld'",
|
||||||
|
CtyCod);
|
||||||
|
return (unsigned) DB_QueryCOUNT (Query,"can not get number of users who claim to belong to other countries");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********************** Check if country map exists *************************/
|
/*********************** Check if country map exists *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1698,7 +1703,7 @@ static void Cty_PutHeadCountries (void)
|
||||||
extern const char *Txt_Name;
|
extern const char *Txt_Name;
|
||||||
extern const char *Txt_WWW;
|
extern const char *Txt_WWW;
|
||||||
extern const char *Txt_Users;
|
extern const char *Txt_Users;
|
||||||
extern const char *Txt_Institutions_ABBREVIATION;
|
extern const char *Txt_Institutions;
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<th class=\"BM\"></th>"
|
"<th class=\"BM\"></th>"
|
||||||
|
@ -1727,7 +1732,7 @@ static void Cty_PutHeadCountries (void)
|
||||||
Txt_Name,
|
Txt_Name,
|
||||||
Txt_WWW,
|
Txt_WWW,
|
||||||
Txt_Users,
|
Txt_Users,
|
||||||
Txt_Institutions_ABBREVIATION);
|
Txt_Institutions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -176,7 +176,7 @@ void Dpt_SeeDepts (void)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_Department_unspecified,
|
Txt_Department_unspecified,
|
||||||
Sta_GetTotalNumberOfUsers (Sco_SCOPE_INS,
|
Sta_GetTotalNumberOfUsersInCourses (Sco_SCOPE_INS,
|
||||||
Rol_TEACHER) - NumTchsInsWithDpt);
|
Rol_TEACHER) - NumTchsInsWithDpt);
|
||||||
|
|
||||||
/***** Table end *****/
|
/***** Table end *****/
|
||||||
|
|
|
@ -70,7 +70,7 @@ static void Ins_ListInstitutionsForSeeing (void);
|
||||||
static void Ins_ListOneInstitutionForSeeing (struct Institution *Ins,unsigned NumIns);
|
static void Ins_ListOneInstitutionForSeeing (struct Institution *Ins,unsigned NumIns);
|
||||||
static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable);
|
static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable);
|
||||||
static void Ins_GetParamInsOrderType (void);
|
static void Ins_GetParamInsOrderType (void);
|
||||||
static unsigned Ins_GetNumUsrsInInstitution (long InsCod);
|
static unsigned Ins_GetNumUsrsWhoClaimToBelongToIns (long InsCod);
|
||||||
static void Ins_ListInstitutionsForEdition (void);
|
static void Ins_ListInstitutionsForEdition (void);
|
||||||
static bool Ins_CheckIfICanEdit (struct Institution *Ins);
|
static bool Ins_CheckIfICanEdit (struct Institution *Ins);
|
||||||
static Ins_StatusTxt_t Ins_GetStatusTxtFromStatusBits (Ins_Status_t Status);
|
static Ins_StatusTxt_t Ins_GetStatusTxtFromStatusBits (Ins_Status_t Status);
|
||||||
|
@ -993,12 +993,13 @@ void Ins_GetShortNameOfInstitutionByCod (struct Institution *Ins)
|
||||||
/****************** Get number of users in an institution ********************/
|
/****************** Get number of users in an institution ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static unsigned Ins_GetNumUsrsInInstitution (long InsCod)
|
static unsigned Ins_GetNumUsrsWhoClaimToBelongToIns (long InsCod)
|
||||||
{
|
{
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
/***** Get number of users in an institution from database *****/
|
/***** Get number of users in an institution from database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE InsCod='%ld'",
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||||
|
" WHERE InsCod='%ld'",
|
||||||
InsCod);
|
InsCod);
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not check number of users in an institution");
|
return (unsigned) DB_QueryCOUNT (Query,"can not check number of users in an institution");
|
||||||
}
|
}
|
||||||
|
@ -1407,7 +1408,7 @@ void Ins_RemoveInstitution (void)
|
||||||
|
|
||||||
/***** Check if this institution has users *****/
|
/***** Check if this institution has users *****/
|
||||||
if (Ctr_GetNumCtrsInIns (Ins.InsCod) ||
|
if (Ctr_GetNumCtrsInIns (Ins.InsCod) ||
|
||||||
Ins_GetNumUsrsInInstitution (Ins.InsCod)) // Institution has centres or users ==> don't remove
|
Ins_GetNumUsrsWhoClaimToBelongToIns (Ins.InsCod)) // Institution has centres or users ==> don't remove
|
||||||
Lay_ShowAlert (Lay_WARNING,Txt_To_remove_an_institution_you_must_first_remove_all_centres_and_users_in_the_institution);
|
Lay_ShowAlert (Lay_WARNING,Txt_To_remove_an_institution_you_must_first_remove_all_centres_and_users_in_the_institution);
|
||||||
else // Institution has no users ==> remove it
|
else // Institution has no users ==> remove it
|
||||||
{
|
{
|
||||||
|
|
|
@ -374,7 +374,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
|
|
||||||
/***** Get total number of users in platform *****/
|
/***** Get total number of users in platform *****/
|
||||||
NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsers (Gbl.Scope.Current,Rol_UNKNOWN);
|
NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNKNOWN);
|
||||||
|
|
||||||
/***** Get number of users with a web / social network *****/
|
/***** Get number of users with a web / social network *****/
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
|
|
|
@ -4007,8 +4007,12 @@ static void Sta_GetAndShowUsersStats (void)
|
||||||
Txt_No_of_users,
|
Txt_No_of_users,
|
||||||
Txt_Average_number_of_courses_to_which_a_user_belongs,
|
Txt_Average_number_of_courses_to_which_a_user_belongs,
|
||||||
Txt_Average_number_of_users_belonging_to_a_course);
|
Txt_Average_number_of_users_belonging_to_a_course);
|
||||||
Usr_GetAndShowNumUsrsInPlatform (Rol_STUDENT);
|
Usr_GetAndShowNumUsrsInPlatform (Rol_STUDENT); // Students
|
||||||
Usr_GetAndShowNumUsrsInPlatform (Rol_TEACHER);
|
Usr_GetAndShowNumUsrsInPlatform (Rol_TEACHER); // Teachers
|
||||||
|
Usr_GetAndShowNumUsrsInPlatform (Rol_UNKNOWN); // Students and teachers
|
||||||
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
"<th colspan=\"4\" style=\"height:10px;\">"
|
||||||
|
"</tr>");
|
||||||
Usr_GetAndShowNumUsrsInPlatform (Rol__GUEST_); // Users not beloging to any course
|
Usr_GetAndShowNumUsrsInPlatform (Rol__GUEST_); // Users not beloging to any course
|
||||||
|
|
||||||
Lay_EndRoundFrameTable ();
|
Lay_EndRoundFrameTable ();
|
||||||
|
@ -5175,8 +5179,9 @@ static unsigned Sta_GetInsAndStat (struct Institution *Ins,MYSQL_RES *mysql_res)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************* Get total number of users *************************/
|
/************************* Get total number of users *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
// Here Rol_ROLE_UNKNOWN means "students or teachers"
|
||||||
|
|
||||||
unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
|
@ -5184,15 +5189,16 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
switch (Scope)
|
switch (Scope)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data");
|
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
||||||
|
" FROM crs_usr");
|
||||||
else
|
else
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
||||||
" FROM crs_usr WHERE Role='%u'",
|
" FROM crs_usr WHERE Role='%u'",
|
||||||
(unsigned) Role);
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||||
" WHERE institutions.CtyCod='%ld'"
|
" WHERE institutions.CtyCod='%ld'"
|
||||||
|
@ -5213,7 +5219,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
Gbl.CurrentCty.Cty.CtyCod,(unsigned) Role);
|
Gbl.CurrentCty.Cty.CtyCod,(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" FROM centres,degrees,courses,crs_usr"
|
" FROM centres,degrees,courses,crs_usr"
|
||||||
" WHERE centres.InsCod='%ld'"
|
" WHERE centres.InsCod='%ld'"
|
||||||
|
@ -5232,7 +5238,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
Gbl.CurrentIns.Ins.InsCod,(unsigned) Role);
|
Gbl.CurrentIns.Ins.InsCod,(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" FROM degrees,courses,crs_usr"
|
" FROM degrees,courses,crs_usr"
|
||||||
" WHERE degrees.CtrCod='%ld'"
|
" WHERE degrees.CtrCod='%ld'"
|
||||||
|
@ -5249,7 +5255,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Role);
|
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" FROM courses,crs_usr"
|
" FROM courses,crs_usr"
|
||||||
" WHERE courses.DegCod='%ld'"
|
" WHERE courses.DegCod='%ld'"
|
||||||
|
@ -5264,7 +5270,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
|
||||||
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Role);
|
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod) FROM crs_usr"
|
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod) FROM crs_usr"
|
||||||
" WHERE CrsCod='%ld'",
|
" WHERE CrsCod='%ld'",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
@ -6593,13 +6599,14 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
|
||||||
Txt_Number_of_BR_e_mails);
|
Txt_Number_of_BR_e_mails);
|
||||||
|
|
||||||
/***** Get total number of users in platform *****/
|
/***** Get total number of users in platform *****/
|
||||||
NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsers (Gbl.Scope.Current,Rol_UNKNOWN);
|
NumUsrsTotalInPlatform = Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Rol_UNKNOWN); // !!!!!!
|
||||||
|
|
||||||
/***** Get total number of users who want to be notified by e-mail on some event, from database *****/
|
/***** Get total number of users who want to be notified by e-mail on some event, from database *****/
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE EmailNtfEvents<>0");
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||||
|
" WHERE EmailNtfEvents<>0");
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||||
|
@ -6666,7 +6673,8 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE ((EmailNtfEvents & %u)<>0)",
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||||
|
" WHERE ((EmailNtfEvents & %u)<>0)",
|
||||||
(1 << NotifyEvent));
|
(1 << NotifyEvent));
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
|
@ -8100,7 +8108,8 @@ static void Sta_GetAndShowNumUsrsPerIconSet (void)
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE IconSet='%s'",
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||||
|
" WHERE IconSet='%s'",
|
||||||
Ico_IconSetId[IconSet]);
|
Ico_IconSetId[IconSet]);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
|
@ -8373,7 +8382,8 @@ static void Sta_GetAndShowNumUsrsPerSideColumns (void)
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE SideCols='%u'",
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||||
|
" WHERE SideCols='%u'",
|
||||||
SideCols);
|
SideCols);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
|
|
|
@ -148,7 +148,7 @@ void Sta_SeeCrsAccesses (void);
|
||||||
void Sta_ReqUseOfPlatform (void);
|
void Sta_ReqUseOfPlatform (void);
|
||||||
void Pho_PutHiddenParamFigureType (void);
|
void Pho_PutHiddenParamFigureType (void);
|
||||||
void Sta_ShowUseOfPlatform (void);
|
void Sta_ShowUseOfPlatform (void);
|
||||||
unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role);
|
unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role);
|
||||||
void Sta_WriteParamsDatesSeeAccesses (void);
|
void Sta_WriteParamsDatesSeeAccesses (void);
|
||||||
|
|
||||||
void Sta_ComputeTimeToGeneratePage (void);
|
void Sta_ComputeTimeToGeneratePage (void);
|
||||||
|
|
60
swad_text.c
60
swad_text.c
|
@ -5130,23 +5130,23 @@ const char *Txt_COUNTRIES_ORDER[2] =
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==0
|
#if L==0
|
||||||
"Usuaris"
|
"Usuaris d'aquesta nacionalitat"
|
||||||
#elif L==1
|
#elif L==1
|
||||||
"Benutzer"
|
"Benutzer dieser Staatsangehörigkeit"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Users"
|
"Users of that nationality"
|
||||||
#elif L==3
|
#elif L==3
|
||||||
"Usuarios"
|
"Usuarios de esa nacionalidad"
|
||||||
#elif L==4
|
#elif L==4
|
||||||
"Utilisateurs"
|
"Utilisateurs de cette nationalité"
|
||||||
#elif L==5
|
#elif L==5
|
||||||
"Usuarios" // Okoteve traducción
|
"Usuarios de esa nacionalidad" // Okoteve traducción
|
||||||
#elif L==6
|
#elif L==6
|
||||||
"Utenti"
|
"Utenti di questa nazionalità"
|
||||||
#elif L==7
|
#elif L==7
|
||||||
"Users"
|
"Użytkownicy tej narodowości"
|
||||||
#elif L==8
|
#elif L==8
|
||||||
"Utilizadores"
|
"Utilizadores dessa nacionalidade"
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14781,27 +14781,6 @@ const char *Txt_Institutions =
|
||||||
"Instituções";
|
"Instituções";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Txt_Institutions_ABBREVIATION =
|
|
||||||
#if L==0
|
|
||||||
"Instit.";
|
|
||||||
#elif L==1
|
|
||||||
"Hochschulen";
|
|
||||||
#elif L==2
|
|
||||||
"Instit.";
|
|
||||||
#elif L==3
|
|
||||||
"Instit.";
|
|
||||||
#elif L==4
|
|
||||||
"Instit.";
|
|
||||||
#elif L==5
|
|
||||||
"Instit."; // Okoteve traducción
|
|
||||||
#elif L==6
|
|
||||||
"Istit.";
|
|
||||||
#elif L==7
|
|
||||||
"Instyt.";
|
|
||||||
#elif L==8
|
|
||||||
"Instit.";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *Txt_institutions =
|
const char *Txt_institutions =
|
||||||
#if L==0
|
#if L==0
|
||||||
"institucions";
|
"institucions";
|
||||||
|
@ -47392,6 +47371,27 @@ const char *Txt_X_users_have_been_removed = // Warning: it is very important to
|
||||||
"%u users have been removed."; // Necessita de tradução
|
"%u users have been removed."; // Necessita de tradução
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char *Txt_Users_in_courses =
|
||||||
|
#if L==0
|
||||||
|
"Usuaris en assignatures";
|
||||||
|
#elif L==1
|
||||||
|
"Benutzer in Kurse";
|
||||||
|
#elif L==2
|
||||||
|
"Users in courses";
|
||||||
|
#elif L==3
|
||||||
|
"Usuarios en asignaturas";
|
||||||
|
#elif L==4
|
||||||
|
"Utilisateurs dans matières";
|
||||||
|
#elif L==5
|
||||||
|
"Usuarios en asignaturas"; // Okoteve traducción
|
||||||
|
#elif L==6
|
||||||
|
"Utenti in corsi";
|
||||||
|
#elif L==7
|
||||||
|
"Użytkowników w kursõw";
|
||||||
|
#elif L==8
|
||||||
|
"Usuários em disciplinas";
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *Txt_usr = // Abbreviation of user (three characters + dot)
|
const char *Txt_usr = // Abbreviation of user (three characters + dot)
|
||||||
#if L==0
|
#if L==0
|
||||||
"usr."; // Necessita traduccio
|
"usr."; // Necessita traduccio
|
||||||
|
|
450
swad_user.c
450
swad_user.c
|
@ -178,7 +178,6 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
|
||||||
Rol_Role_t RoleInClassPhoto);
|
Rol_Role_t RoleInClassPhoto);
|
||||||
|
|
||||||
static unsigned Usr_GetNumUsrsNotBelongingToAnyCrs (void);
|
static unsigned Usr_GetNumUsrsNotBelongingToAnyCrs (void);
|
||||||
static unsigned Usr_GetNumUsrsBelongingToAnyCrs (Rol_Role_t Role);
|
|
||||||
static float Usr_GetNumCrssPerUsr (Rol_Role_t Role);
|
static float Usr_GetNumCrssPerUsr (Rol_Role_t Role);
|
||||||
static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role);
|
static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role);
|
||||||
|
|
||||||
|
@ -1362,7 +1361,8 @@ bool Usr_ChkIfEncryptedUsrCodExists (const char *EncryptedUsrCod)
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
/***** Get if an encrypted user's code already existed in database *****/
|
/***** Get if an encrypted user's code already existed in database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE EncryptedUsrCod='%s'",
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||||
|
" WHERE EncryptedUsrCod='%s'",
|
||||||
EncryptedUsrCod);
|
EncryptedUsrCod);
|
||||||
return (DB_QueryCOUNT (Query,"can not check if an encrypted user's code already existed") != 0);
|
return (DB_QueryCOUNT (Query,"can not check if an encrypted user's code already existed") != 0);
|
||||||
}
|
}
|
||||||
|
@ -3424,43 +3424,32 @@ unsigned Usr_GetNumUsrsInCrssOfIns (Rol_Role_t Role,long InsCod)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****** Count how many users with a role belong to courses of a country ******/
|
/****** Count how many users with a role belong to courses of a country ******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
// Here Rol_UNKNOWN means students or teachers
|
||||||
unsigned Usr_GetNumUsrsInCrssOfCty (Rol_Role_t Role,long CtyCod)
|
unsigned Usr_GetNumUsrsInCrssOfCty (Rol_Role_t Role,long CtyCod)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
/***** Get the number of users in a degree from database ******/
|
/***** Get the number of users in a degree from database ******/
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" WHERE institutions.CtyCod='%ld'"
|
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||||
" AND institutions.InsCod=centres.InsCod"
|
" WHERE institutions.CtyCod='%ld'"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND crs_usr.Role='%u'",
|
" AND courses.CrsCod=crs_usr.CrsCod",
|
||||||
CtyCod,(unsigned) Role);
|
CtyCod);
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in courses of a country");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********************** Get number of users in a country ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
unsigned Usr_GetNumUsrsInCountry (Rol_Role_t Role,long CtyCod)
|
|
||||||
{
|
|
||||||
char Query[256];
|
|
||||||
|
|
||||||
/***** Get the number of users (with a role) in a country from database ******/
|
|
||||||
if (Role == Rol_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
|
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
|
||||||
" WHERE CtyCod='%ld'",CtyCod);
|
|
||||||
else
|
else
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||||
" FROM usr_data,crs_usr"
|
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||||
" WHERE usr_data.CtyCod='%ld'"
|
" WHERE institutions.CtyCod='%ld'"
|
||||||
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'",
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
CtyCod,(unsigned) Role);
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in a country");
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role='%u'",
|
||||||
|
CtyCod,(unsigned) Role);
|
||||||
|
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in courses of a country");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -7261,7 +7250,8 @@ bool Usr_ChkIfUsrCodExists (long UsrCod)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** Get if a user exists in database *****/
|
/***** Get if a user exists in database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE UsrCod='%ld'",
|
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
|
||||||
|
" WHERE UsrCod='%ld'",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
return (DB_QueryCOUNT (Query,"can not check if a user exists") != 0);
|
return (DB_QueryCOUNT (Query,"can not check if a user exists") != 0);
|
||||||
}
|
}
|
||||||
|
@ -7281,47 +7271,52 @@ void Usr_ShowWarningNoUsersFound (Rol_Role_t Role)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************ See stats about the platform ***********************/
|
/************************ See stats about the platform ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
// Here Rol_ROLE_UNKNOWN means "all users"
|
||||||
|
|
||||||
void Usr_GetAndShowNumUsrsInPlatform (Rol_Role_t Role)
|
void Usr_GetAndShowNumUsrsInPlatform (Rol_Role_t Role)
|
||||||
{
|
{
|
||||||
|
extern const char *Txt_Total;
|
||||||
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
float NumCrssPerUsr;
|
float NumCrssPerUsr;
|
||||||
float NumUsrsPerCrs;
|
float NumUsrsPerCrs;
|
||||||
|
char *Class = (Role == Rol_UNKNOWN) ? "DAT_N_LINE_TOP RIGHT_BOTTOM" :
|
||||||
|
"DAT RIGHT_BOTTOM";
|
||||||
|
|
||||||
/***** Get the number of users belonging to any course *****/
|
/***** Get the number of users belonging to any course *****/
|
||||||
if (Role == Rol__GUEST_) // Users not beloging to any course
|
if (Role == Rol__GUEST_) // Users not beloging to any course
|
||||||
NumUsrs = Usr_GetNumUsrsNotBelongingToAnyCrs ();
|
NumUsrs = Usr_GetNumUsrsNotBelongingToAnyCrs ();
|
||||||
else
|
else
|
||||||
NumUsrs = Usr_GetNumUsrsBelongingToAnyCrs (Role);
|
NumUsrs = Sta_GetTotalNumberOfUsersInCourses (Gbl.Scope.Current,Role);
|
||||||
|
|
||||||
/***** Get average number of courses per user *****/
|
/***** Get average number of courses per user *****/
|
||||||
NumCrssPerUsr = (Role == Rol__GUEST_) ? 0 :
|
NumCrssPerUsr = (Role == Rol__GUEST_) ? 0 :
|
||||||
Usr_GetNumCrssPerUsr (Role);
|
Usr_GetNumCrssPerUsr (Role);
|
||||||
|
|
||||||
/***** Query the number of users per course *****/
|
/***** Query the number of users per course *****/
|
||||||
NumUsrsPerCrs = (Role == Rol__GUEST_) ? 0 :
|
NumUsrsPerCrs = (Role == Rol__GUEST_) ? 0 :
|
||||||
Usr_GetNumUsrsPerCrs (Role);
|
Usr_GetNumUsrsPerCrs (Role);
|
||||||
|
|
||||||
/***** Write the total number of users *****/
|
/***** Write the total number of users *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"DAT RIGHT_BOTTOM\">"
|
"<td class=\"%s\">"
|
||||||
"%s"
|
"%s"
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td class=\"DAT RIGHT_BOTTOM\">"
|
"<td class=\"%s\">"
|
||||||
"%u"
|
"%u"
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td class=\"DAT RIGHT_BOTTOM\">"
|
"<td class=\"%s\">"
|
||||||
"%.2f"
|
"%.2f"
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td class=\"DAT RIGHT_BOTTOM\">"
|
"<td class=\"%s\">"
|
||||||
"%.2f"
|
"%.2f"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN],
|
Class,(Role == Rol_UNKNOWN) ? Txt_Total :
|
||||||
NumUsrs,
|
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN],
|
||||||
NumCrssPerUsr,
|
Class,NumUsrs,
|
||||||
NumUsrsPerCrs);
|
Class,NumCrssPerUsr,
|
||||||
|
Class,NumUsrsPerCrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -7340,81 +7335,7 @@ static unsigned Usr_GetNumUsrsNotBelongingToAnyCrs (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************** Get number of courses with users of a type ******************/
|
/************ Get average number of courses with users of a role *************/
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static unsigned Usr_GetNumUsrsBelongingToAnyCrs (Rol_Role_t Role)
|
|
||||||
{
|
|
||||||
char Query[1024];
|
|
||||||
|
|
||||||
/***** Get number of users who belong to any course *****/
|
|
||||||
switch (Gbl.Scope.Current)
|
|
||||||
{
|
|
||||||
case Sco_SCOPE_SYS:
|
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
|
||||||
" FROM crs_usr"
|
|
||||||
" WHERE Role='%u'",
|
|
||||||
(unsigned) Role);
|
|
||||||
break;
|
|
||||||
case Sco_SCOPE_CTY:
|
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
|
||||||
" WHERE institutions.CtyCod='%ld'"
|
|
||||||
" AND institutions.InsCod=centres.InsCod"
|
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
|
||||||
" AND crs_usr.Role='%u'",
|
|
||||||
Gbl.CurrentCty.Cty.CtyCod,
|
|
||||||
(unsigned) Role);
|
|
||||||
break;
|
|
||||||
case Sco_SCOPE_INS:
|
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
|
||||||
" FROM centres,degrees,courses,crs_usr"
|
|
||||||
" WHERE centres.InsCod='%ld'"
|
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
|
||||||
" AND crs_usr.Role='%u'",
|
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
|
||||||
(unsigned) Role);
|
|
||||||
break;
|
|
||||||
case Sco_SCOPE_CTR:
|
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
|
||||||
" FROM degrees,courses,crs_usr"
|
|
||||||
" WHERE degrees.CtrCod='%ld'"
|
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
|
||||||
" AND crs_usr.Role='%u'",
|
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
|
||||||
(unsigned) Role);
|
|
||||||
break;
|
|
||||||
case Sco_SCOPE_DEG:
|
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
|
||||||
" FROM courses,crs_usr"
|
|
||||||
" WHERE courses.DegCod='%ld'"
|
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
|
||||||
" AND crs_usr.Role='%u'",
|
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
|
||||||
(unsigned) Role);
|
|
||||||
break;
|
|
||||||
case Sco_SCOPE_CRS:
|
|
||||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
|
||||||
" FROM crs_usr"
|
|
||||||
" WHERE crs_usr.CrsCod='%ld'"
|
|
||||||
" AND crs_usr.Role='%u'",
|
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
|
||||||
(unsigned) Role);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of users who belong to any course");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Get average number of courses with users of a type *************/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
||||||
|
@ -7428,61 +7349,109 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(CrsCod) AS NumCrss"
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
" FROM crs_usr"
|
"(SELECT COUNT(CrsCod) AS NumCrss"
|
||||||
" WHERE Role='%u' GROUP BY UsrCod) AS NumCrssTable",
|
" FROM crs_usr"
|
||||||
(unsigned) Role);
|
" GROUP BY UsrCod) AS NumCrssTable");
|
||||||
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
|
"(SELECT COUNT(CrsCod) AS NumCrss"
|
||||||
|
" FROM crs_usr"
|
||||||
|
" WHERE Role='%u' GROUP BY UsrCod) AS NumCrssTable",
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||||
" WHERE institutions.CtyCod='%ld'"
|
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||||
" AND institutions.InsCod=centres.InsCod"
|
" WHERE institutions.CtyCod='%ld'"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND crs_usr.Role='%u'"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||||
Gbl.CurrentCty.Cty.CtyCod,
|
Gbl.CurrentCty.Cty.CtyCod);
|
||||||
(unsigned) Role);
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
|
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||||
|
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||||
|
" WHERE institutions.CtyCod='%ld'"
|
||||||
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role='%u'"
|
||||||
|
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||||
|
Gbl.CurrentCty.Cty.CtyCod,
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
" FROM centres,degrees,courses,crs_usr"
|
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||||
" WHERE centres.InsCod='%ld'"
|
" FROM centres,degrees,courses,crs_usr"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" WHERE centres.InsCod='%ld'"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND crs_usr.Role='%u'"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
Gbl.CurrentIns.Ins.InsCod);
|
||||||
(unsigned) Role);
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
|
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||||
|
" FROM centres,degrees,courses,crs_usr"
|
||||||
|
" WHERE centres.InsCod='%ld'"
|
||||||
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role='%u'"
|
||||||
|
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||||
|
Gbl.CurrentIns.Ins.InsCod,
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
" FROM degrees,courses,crs_usr"
|
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||||
" WHERE degrees.CtrCod='%ld'"
|
" FROM degrees,courses,crs_usr"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" WHERE degrees.CtrCod='%ld'"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND crs_usr.Role='%u'"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
(unsigned) Role);
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
|
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||||
|
" FROM degrees,courses,crs_usr"
|
||||||
|
" WHERE degrees.CtrCod='%ld'"
|
||||||
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role='%u'"
|
||||||
|
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||||
|
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
" FROM courses,crs_usr"
|
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||||
" WHERE courses.DegCod='%ld'"
|
" FROM courses,crs_usr"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" WHERE courses.DegCod='%ld'"
|
||||||
" AND crs_usr.Role='%u'"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
Gbl.CurrentDeg.Deg.DegCod);
|
||||||
(unsigned) Role);
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumCrss) FROM "
|
||||||
|
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||||
|
" FROM courses,crs_usr"
|
||||||
|
" WHERE courses.DegCod='%ld'"
|
||||||
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role='%u'"
|
||||||
|
" GROUP BY crs_usr.UsrCod) AS NumCrssTable",
|
||||||
|
Gbl.CurrentDeg.Deg.DegCod,
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
return 1.0;
|
return 1.0;
|
||||||
|
@ -7517,65 +7486,114 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
||||||
switch (Gbl.Scope.Current)
|
switch (Gbl.Scope.Current)
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_SYS:
|
case Sco_SCOPE_SYS:
|
||||||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(UsrCod) AS NumUsrs"
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
" FROM crs_usr"
|
"(SELECT COUNT(UsrCod) AS NumUsrs"
|
||||||
" WHERE Role='%u' GROUP BY CrsCod) AS NumUsrsTable",
|
" FROM crs_usr"
|
||||||
(unsigned) Role);
|
" GROUP BY CrsCod) AS NumUsrsTable");
|
||||||
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
|
"(SELECT COUNT(UsrCod) AS NumUsrs"
|
||||||
|
" FROM crs_usr"
|
||||||
|
" WHERE Role='%u' GROUP BY CrsCod) AS NumUsrsTable",
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTY:
|
case Sco_SCOPE_CTY:
|
||||||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||||
" WHERE institutions.CtyCod='%ld'"
|
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||||
" AND institutions.InsCod=centres.InsCod"
|
" WHERE institutions.CtyCod='%ld'"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND crs_usr.Role='%u'"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||||
Gbl.CurrentCty.Cty.CtyCod,
|
Gbl.CurrentCty.Cty.CtyCod);
|
||||||
(unsigned) Role);
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
|
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||||
|
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||||
|
" WHERE institutions.CtyCod='%ld'"
|
||||||
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role='%u'"
|
||||||
|
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||||
|
Gbl.CurrentCty.Cty.CtyCod,
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_INS:
|
case Sco_SCOPE_INS:
|
||||||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
" FROM centres,degrees,courses,crs_usr"
|
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||||
" WHERE centres.InsCod='%ld'"
|
" FROM centres,degrees,courses,crs_usr"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" WHERE centres.InsCod='%ld'"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND crs_usr.Role='%u'"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
Gbl.CurrentIns.Ins.InsCod);
|
||||||
(unsigned) Role);
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
|
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||||
|
" FROM centres,degrees,courses,crs_usr"
|
||||||
|
" WHERE centres.InsCod='%ld'"
|
||||||
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role='%u'"
|
||||||
|
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||||
|
Gbl.CurrentIns.Ins.InsCod,
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CTR:
|
case Sco_SCOPE_CTR:
|
||||||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
" FROM degrees,courses,crs_usr"
|
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||||
" WHERE degrees.CtrCod='%ld'"
|
" FROM degrees,courses,crs_usr"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" WHERE degrees.CtrCod='%ld'"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND crs_usr.Role='%u'"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||||
(unsigned) Role);
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
|
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||||
|
" FROM degrees,courses,crs_usr"
|
||||||
|
" WHERE degrees.CtrCod='%ld'"
|
||||||
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role='%u'"
|
||||||
|
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||||
|
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_DEG:
|
case Sco_SCOPE_DEG:
|
||||||
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
if (Role == Rol_UNKNOWN) // Any user
|
||||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
" FROM courses,crs_usr"
|
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||||
" WHERE courses.DegCod='%ld'"
|
" FROM courses,crs_usr"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" WHERE courses.DegCod='%ld'"
|
||||||
" AND crs_usr.Role='%u'"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
Gbl.CurrentDeg.Deg.DegCod);
|
||||||
(unsigned) Role);
|
else
|
||||||
|
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
|
||||||
|
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||||
|
" FROM courses,crs_usr"
|
||||||
|
" WHERE courses.DegCod='%ld'"
|
||||||
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role='%u'"
|
||||||
|
" GROUP BY crs_usr.CrsCod) AS NumUsrsTable",
|
||||||
|
Gbl.CurrentDeg.Deg.DegCod,
|
||||||
|
(unsigned) Role);
|
||||||
break;
|
break;
|
||||||
case Sco_SCOPE_CRS:
|
case Sco_SCOPE_CRS:
|
||||||
return (float) ((Role == Rol_TEACHER) ? Gbl.CurrentCrs.Crs.NumTchs :
|
return (float) ( Role == Rol_UNKNOWN ? Gbl.CurrentCrs.Crs.NumUsrs : // Any user
|
||||||
Gbl.CurrentCrs.Crs.NumStds);
|
(Role == Rol_TEACHER ? Gbl.CurrentCrs.Crs.NumTchs : // Teachers
|
||||||
|
Gbl.CurrentCrs.Crs.NumStds)); // Students
|
||||||
default:
|
default:
|
||||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -278,7 +278,6 @@ unsigned Usr_GetNumUsrsInCrssOfDeg (Rol_Role_t Role,long DegCod);
|
||||||
unsigned Usr_GetNumUsrsInCrssOfCtr (Rol_Role_t Role,long CtrCod);
|
unsigned Usr_GetNumUsrsInCrssOfCtr (Rol_Role_t Role,long CtrCod);
|
||||||
unsigned Usr_GetNumUsrsInCrssOfIns (Rol_Role_t Role,long InsCod);
|
unsigned Usr_GetNumUsrsInCrssOfIns (Rol_Role_t Role,long InsCod);
|
||||||
unsigned Usr_GetNumUsrsInCrssOfCty (Rol_Role_t Role,long CtyCod);
|
unsigned Usr_GetNumUsrsInCrssOfCty (Rol_Role_t Role,long CtyCod);
|
||||||
unsigned Usr_GetNumUsrsInCountry (Rol_Role_t Role,long CtyCod);
|
|
||||||
|
|
||||||
long Usr_GetRamdomStdFromCrs (long CrsCod);
|
long Usr_GetRamdomStdFromCrs (long CrsCod);
|
||||||
long Usr_GetRamdomStdFromGrp (long GrpCod);
|
long Usr_GetRamdomStdFromGrp (long GrpCod);
|
||||||
|
|
Loading…
Reference in New Issue