mirror of https://github.com/acanas/swad-core.git
Version 15.61
This commit is contained in:
parent
34aad33da1
commit
bad0711ad9
|
@ -11180,3 +11180,5 @@ INSERT INTO timetable_tut_backup SELECT * FROM timetable_tut;
|
|||
UPDATE timetable_crs SET Hour=Hour+2;
|
||||
UPDATE timetable_tut SET Hour=Hour+2;
|
||||
|
||||
|
||||
SELECT COUNT(DISTINCT crs_usr.UsrCod) FROM institutions,centres,degrees,courses,crs_usr WHERE institutions.CtyCod='724' AND institutions.InsCod=centres.InsCod AND centres.CtrCod=degrees.CtrCod AND degrees.DegCod=courses.DegCod AND courses.CrsCod=crs_usr.CrsCod;
|
|
@ -696,7 +696,7 @@ void Ctr_EditCentres (void)
|
|||
extern const char *Txt_You_must_create_at_least_one_institution_before_creating_centres;
|
||||
|
||||
/***** Get list of institutions of the current country *****/
|
||||
Ins_GetListInstitutions (Gbl.CurrentCty.Cty.CtyCod,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetListInstitutions (Gbl.CurrentCty.Cty.CtyCod,Ins_GET_BASIC_DATA);
|
||||
if (Gbl.Inss.Num)
|
||||
{
|
||||
/***** Get list of places *****/
|
||||
|
@ -1180,7 +1180,7 @@ static void Ctr_ListCentresForEdition (void)
|
|||
|
||||
/* Get data of institution of this centre */
|
||||
Ins.InsCod = Ctr->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
ICanEdit = Ctr_CheckIfICanEdit (Ctr);
|
||||
|
||||
|
|
|
@ -103,6 +103,10 @@
|
|||
// TODO: Show nicknames of users in lists?
|
||||
// TODO: Form to register and remove system admins
|
||||
// TODO: Fix this bug: when an admin clicks on "Use this email" in the email of another user the email was confirmed, the email becomes unconfirmed
|
||||
// TODO: When error ("Ya existía un evento con el título") creating a new event, the data f the event is empty
|
||||
// TODO: When teacher clicks in attendance of a student (button in her/his record),
|
||||
// only (the groups he/she should have attend) union (the groups he/she really attended)
|
||||
// should be shown.
|
||||
// TODO: Reply to one user, suggested by Francisco Ocaña Lara
|
||||
// TODO: Reply to all
|
||||
|
||||
|
@ -110,13 +114,13 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.60.7 (2015/12/08)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.61 (2015/12/09)"
|
||||
#define CSS_FILE "swad15.60.7.css"
|
||||
|
||||
// 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.60.7: Dec 08, 2015 Changed some small icons. (186591 lines)
|
||||
Version 15.61: Dec 09, 2015 Bug fixing and lot of changes in data of countries and institutions. (186852 lines)
|
||||
Version 15.60.6: Dec 08, 2015 Changed icons in login. (186592 lines)
|
||||
Version 15.60.5: Dec 08, 2015 Changed some messages related to login. (186589 lines)
|
||||
Version 15.60.4: Dec 08, 2015 Change in text about first / last year of a degree. (186589 lines)
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
/** Uncomment one of the following installations of SWAD or create your own **/
|
||||
/*****************************************************************************/
|
||||
|
||||
//#define LOCALHOST_UBUNTU // Comment this line if not applicable
|
||||
#define OPENSWAD_ORG // Comment this line if not applicable
|
||||
#define LOCALHOST_UBUNTU // Comment this line if not applicable
|
||||
//#define OPENSWAD_ORG // Comment this line if not applicable
|
||||
//#define SWAD_UGR_ES // Comment this line if not applicable
|
||||
//#define WWW_CEVUNA_UNA_PY // Comment this line if not applicable
|
||||
|
||||
|
|
319
swad_country.c
319
swad_country.c
|
@ -88,7 +88,7 @@ void Cty_SeeCtyWithPendingInss (void)
|
|||
extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES];
|
||||
extern const char *Txt_Countries_with_pending_institutions;
|
||||
extern const char *Txt_Country;
|
||||
extern const char *Txt_Institutions;
|
||||
extern const char *Txt_Institutions_ABBREVIATION;
|
||||
extern const char *Txt_There_are_no_countries_with_requests_for_institutions_to_be_confirmed;
|
||||
char Query[1024];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -129,7 +129,7 @@ void Cty_SeeCtyWithPendingInss (void)
|
|||
"</th>"
|
||||
"</tr>",
|
||||
Txt_Country,
|
||||
Txt_Institutions);
|
||||
Txt_Institutions_ABBREVIATION);
|
||||
|
||||
/***** List the countries *****/
|
||||
for (NumCty = 0;
|
||||
|
@ -145,7 +145,7 @@ void Cty_SeeCtyWithPendingInss (void)
|
|||
Gbl.ColorRows[Gbl.RowEvenOdd];
|
||||
|
||||
/* Get data of country */
|
||||
Cty_GetDataOfCountryByCod (&Cty);
|
||||
Cty_GetDataOfCountryByCod (&Cty,Cty_GET_BASIC_DATA);
|
||||
|
||||
/* Country map */
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -211,6 +211,7 @@ static void Cty_Configuration (bool PrintView)
|
|||
extern const char *Txt_Centres;
|
||||
extern const char *Txt_Degrees;
|
||||
extern const char *Txt_Courses;
|
||||
extern const char *Txt_Users_of_the_country;
|
||||
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
char *MapAttribution = NULL;
|
||||
bool PutLink = !PrintView && Gbl.CurrentCty.Cty.WWW[Gbl.Prefs.Language][0];
|
||||
|
@ -345,6 +346,19 @@ static void Cty_Configuration (bool PrintView)
|
|||
}
|
||||
else
|
||||
{
|
||||
/***** Number of users who claim to belong to this country *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s:"
|
||||
"</td>"
|
||||
"<td class=\"DAT LEFT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Users_of_the_country,
|
||||
Usr_GetNumUsrsWhoClaimToBelongToCty (Gbl.CurrentCty.Cty.CtyCod));
|
||||
|
||||
/***** Number of institutions *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
|
@ -397,7 +411,7 @@ static void Cty_Configuration (bool PrintView)
|
|||
Txt_Courses,
|
||||
Crs_GetNumCrssInCty (Gbl.CurrentCty.Cty.CtyCod));
|
||||
|
||||
/***** Number of teachers *****/
|
||||
/***** Number of teachers in courses of this country *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s:"
|
||||
|
@ -410,7 +424,7 @@ static void Cty_Configuration (bool PrintView)
|
|||
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||
Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,Gbl.CurrentCty.Cty.CtyCod));
|
||||
|
||||
/***** Number of students *****/
|
||||
/***** Number of students in courses of this country *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s:"
|
||||
|
@ -422,6 +436,20 @@ static void Cty_Configuration (bool PrintView)
|
|||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||
Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,Gbl.CurrentCty.Cty.CtyCod));
|
||||
|
||||
/***** Number of users in courses of this country *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s + %s:"
|
||||
"</td>"
|
||||
"<td class=\"DAT LEFT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||
Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,Gbl.CurrentCty.Cty.CtyCod));
|
||||
}
|
||||
|
||||
/***** End frame *****/
|
||||
|
@ -457,9 +485,12 @@ void Cty_ListCountries2 (void)
|
|||
extern const char *Txt_Countries;
|
||||
extern const char *Txt_COUNTRIES_HELP_ORDER[2];
|
||||
extern const char *Txt_COUNTRIES_ORDER[2];
|
||||
extern const char *Txt_Users_in_courses;
|
||||
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
extern const char *Txt_Institutions;
|
||||
extern const char *Txt_Institutions_ABBREVIATION;
|
||||
extern const char *Txt_Centres_ABBREVIATION;
|
||||
extern const char *Txt_Degrees_ABBREVIATION;
|
||||
extern const char *Txt_Courses_ABBREVIATION;
|
||||
extern const char *Txt_Teachers_ABBREVIATION;
|
||||
extern const char *Txt_Students_ABBREVIATION;
|
||||
extern const char *Txt_Other_countries;
|
||||
extern const char *Txt_Country_unspecified;
|
||||
Cty_CtysOrderType_t Order;
|
||||
|
@ -499,16 +530,29 @@ void Cty_ListCountries2 (void)
|
|||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s+<br />%s"
|
||||
"</th>"
|
||||
"</tr>",
|
||||
Txt_Users_in_courses,
|
||||
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||
Txt_Institutions);
|
||||
Txt_Institutions_ABBREVIATION,
|
||||
Txt_Centres_ABBREVIATION,
|
||||
Txt_Degrees_ABBREVIATION,
|
||||
Txt_Courses_ABBREVIATION,
|
||||
Txt_Teachers_ABBREVIATION,
|
||||
Txt_Students_ABBREVIATION,
|
||||
Txt_Teachers_ABBREVIATION,
|
||||
Txt_Students_ABBREVIATION);
|
||||
|
||||
/***** Write all the countries and their number of users and institutions *****/
|
||||
for (NumCty = 0;
|
||||
|
@ -542,12 +586,24 @@ void Cty_ListCountries2 (void)
|
|||
"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
BgColor,Gbl.Ctys.Lst[NumCty].NumUsrs,
|
||||
BgColor,Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,Gbl.Ctys.Lst[NumCty].CtyCod),
|
||||
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].NumUsrsWhoClaimToBelongToCty,
|
||||
BgColor,Gbl.Ctys.Lst[NumCty].NumInss,
|
||||
BgColor,Gbl.Ctys.Lst[NumCty].NumCtrs,
|
||||
BgColor,Gbl.Ctys.Lst[NumCty].NumDegs,
|
||||
BgColor,Gbl.Ctys.Lst[NumCty].NumCrss,
|
||||
BgColor,Gbl.Ctys.Lst[NumCty].NumTchs,
|
||||
BgColor,Gbl.Ctys.Lst[NumCty].NumStds,
|
||||
BgColor,Gbl.Ctys.Lst[NumCty].NumUsrs);
|
||||
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
||||
}
|
||||
|
||||
|
@ -578,13 +634,25 @@ void Cty_ListCountries2 (void)
|
|||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Txt_Other_countries,
|
||||
Cty_GetNumUsrsWhoClaimToBelongToCty (0),
|
||||
Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,0), // Here Rol_ROLE_UNKNOWN means "all users",
|
||||
Ins_GetNumInssInCty (0),
|
||||
Ctr_GetNumCtrsInCty (0),
|
||||
Deg_GetNumDegsInCty (0),
|
||||
Crs_GetNumCrssInCty (0),
|
||||
Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,0),
|
||||
Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,0),
|
||||
Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,0),
|
||||
Ins_GetNumInssInCty (0));
|
||||
Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,0));
|
||||
|
||||
/***** Write users and institutions with unknown country *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -595,21 +663,33 @@ void Cty_ListCountries2 (void)
|
|||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"0"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"0"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"0"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"0"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"0"
|
||||
"</td>"
|
||||
"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"0"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Txt_Country_unspecified,
|
||||
Cty_GetNumUsrsWhoClaimToBelongToCty (-1L),
|
||||
Ins_GetNumInssInCty (-1L));
|
||||
Ins_GetNumInssInCty (-1L),
|
||||
Ctr_GetNumCtrsInCty (-1L),
|
||||
Deg_GetNumDegsInCty (-1L),
|
||||
Crs_GetNumCrssInCty (-1L));
|
||||
|
||||
/***** Table end *****/
|
||||
Lay_EndRoundFrameTable ();
|
||||
|
@ -745,14 +825,14 @@ void Cty_WriteScriptGoogleGeochart (void)
|
|||
for (NumCty = 0;
|
||||
NumCty < Gbl.Ctys.Num;
|
||||
NumCty++)
|
||||
if (Gbl.Ctys.Lst[NumCty].NumUsrs)
|
||||
if (Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty)
|
||||
{
|
||||
/* Write data of this country */
|
||||
fprintf (Gbl.F.Out," ['%s', %u, %u],\n",
|
||||
Gbl.Ctys.Lst[NumCty].Alpha2,
|
||||
Gbl.Ctys.Lst[NumCty].NumUsrs,
|
||||
Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty,
|
||||
Gbl.Ctys.Lst[NumCty].NumInss);
|
||||
NumUsrsWithCountry += Gbl.Ctys.Lst[NumCty].NumUsrs;
|
||||
NumUsrsWithCountry += Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty;
|
||||
NumCtysWithUsrs++;
|
||||
}
|
||||
|
||||
|
@ -843,7 +923,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
|
|||
/***** Get countries from database *****/
|
||||
switch (GetExtraData)
|
||||
{
|
||||
case Cty_GET_ONLY_COUNTRIES:
|
||||
case Cty_GET_BASIC_DATA:
|
||||
sprintf (Query,"SELECT CtyCod,Alpha2,Name_%s"
|
||||
" FROM countries ORDER BY Name_%s",
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
|
@ -891,7 +971,8 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
|
|||
" UNION "
|
||||
"(SELECT CtyCod,Alpha2,%s%s0 AS NumUsrs"
|
||||
" FROM countries"
|
||||
" WHERE CtyCod NOT IN (SELECT DISTINCT CtyCod FROM usr_data))"
|
||||
" WHERE CtyCod NOT IN"
|
||||
" (SELECT DISTINCT CtyCod FROM usr_data))"
|
||||
" ORDER BY %s",
|
||||
SubQueryNam1,SubQueryWWW1,
|
||||
SubQueryNam2,SubQueryWWW2,OrderBySubQuery);
|
||||
|
@ -928,7 +1009,18 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
|
|||
|
||||
switch (GetExtraData)
|
||||
{
|
||||
case Cty_GET_ONLY_COUNTRIES:
|
||||
case Cty_GET_BASIC_DATA:
|
||||
for (Lan = (Txt_Language_t) 1;
|
||||
Lan <= Txt_NUM_LANGUAGES;
|
||||
Lan++)
|
||||
{
|
||||
Cty->Name[Lan][0] = '\0';
|
||||
Cty->WWW[Lan][0] = '\0';
|
||||
}
|
||||
Cty->NumUsrsWhoClaimToBelongToCty = 0;
|
||||
Cty->NumInss = Cty->NumCtrs = Cty->NumDegs = Cty->NumCrss = 0;
|
||||
Cty->NumUsrs = Cty->NumTchs = Cty->NumStds = 0;
|
||||
|
||||
/* Get the name of the country in current language */
|
||||
strcpy (Cty->Name[Gbl.Prefs.Language],row[2]);
|
||||
break;
|
||||
|
@ -942,12 +1034,26 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
|
|||
strcpy (Cty->WWW[Lan],row[1+Txt_NUM_LANGUAGES+Lan]);
|
||||
}
|
||||
|
||||
/* Get number of users in this country */
|
||||
if (sscanf (row[1+Txt_NUM_LANGUAGES*2+1],"%u",&Cty->NumUsrs) != 1)
|
||||
Cty->NumUsrs = 0;
|
||||
/* Get number of users who claim to belong to this country */
|
||||
if (sscanf (row[1+Txt_NUM_LANGUAGES*2+1],"%u",&Cty->NumUsrsWhoClaimToBelongToCty) != 1)
|
||||
Cty->NumUsrsWhoClaimToBelongToCty = 0;
|
||||
|
||||
/* Get number of institutions in this country */
|
||||
Cty->NumInss = Ins_GetNumInssInCty (Cty->CtyCod);
|
||||
|
||||
/* Get number of centres in this country */
|
||||
Cty->NumCtrs = Ctr_GetNumCtrsInCty (Cty->CtyCod);
|
||||
|
||||
/* Get number of degrees in this country */
|
||||
Cty->NumDegs = Deg_GetNumDegsInCty (Cty->CtyCod);
|
||||
|
||||
/* Get number of courses in this country */
|
||||
Cty->NumCrss = Crs_GetNumCrssInCty (Cty->CtyCod);
|
||||
|
||||
/* Get number of users in courses of this country */
|
||||
Cty->NumUsrs = Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,Cty->CtyCod); // Here Rol_UNKNOWN means "all users", NumUsrs <= NumStds + NumTchs
|
||||
Cty->NumStds = Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,Cty->CtyCod);
|
||||
Cty->NumTchs = Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,Cty->CtyCod);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1042,10 +1148,10 @@ void Cty_WriteCountryName (long CtyCod,const char *Class)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Get country full name **************************/
|
||||
/***************** Get basic data of country given its code ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Cty_GetDataOfCountryByCod (struct Country *Cty)
|
||||
bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraData)
|
||||
{
|
||||
extern const char *Txt_Another_country;
|
||||
extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES];
|
||||
|
@ -1072,7 +1178,10 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty)
|
|||
Cty->Name[Lan][0] = '\0';
|
||||
Cty->WWW[Lan][0] = '\0';
|
||||
}
|
||||
Cty->NumUsrsWhoClaimToBelongToCty = 0;
|
||||
Cty->NumUsrs = 0;
|
||||
Cty->NumStds = 0;
|
||||
Cty->NumTchs = 0;
|
||||
Cty->NumInss = 0;
|
||||
|
||||
/***** Check if country code is correct *****/
|
||||
|
@ -1088,37 +1197,52 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Cty->CtyCod > 0
|
||||
/***** Get data of a country from database *****/
|
||||
SubQueryNam1[0] = '\0';
|
||||
SubQueryNam2[0] = '\0';
|
||||
SubQueryWWW1[0] = '\0';
|
||||
SubQueryWWW2[0] = '\0';
|
||||
for (Lan = (Txt_Language_t) 1;
|
||||
Lan <= Txt_NUM_LANGUAGES;
|
||||
Lan++)
|
||||
{
|
||||
sprintf (StrField,"countries.Name_%s,",Txt_STR_LANG_ID[Lan]);
|
||||
strcat (SubQueryNam1,StrField);
|
||||
sprintf (StrField,"Name_%s,",Txt_STR_LANG_ID[Lan]);
|
||||
strcat (SubQueryNam2,StrField);
|
||||
// Here Cty->CtyCod > 0
|
||||
|
||||
sprintf (StrField,"countries.WWW_%s,",Txt_STR_LANG_ID[Lan]);
|
||||
strcat (SubQueryWWW1,StrField);
|
||||
sprintf (StrField,"WWW_%s,",Txt_STR_LANG_ID[Lan]);
|
||||
strcat (SubQueryWWW2,StrField);
|
||||
/***** Get data of a country from database *****/
|
||||
switch (GetExtraData)
|
||||
{
|
||||
case Cty_GET_BASIC_DATA:
|
||||
sprintf (Query,"SELECT Alpha2,Name_%s"
|
||||
" FROM countries"
|
||||
" WHERE CtyCod='%03ld'",
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
Cty->CtyCod);
|
||||
break;
|
||||
case Cty_GET_EXTRA_DATA:
|
||||
SubQueryNam1[0] = '\0';
|
||||
SubQueryNam2[0] = '\0';
|
||||
SubQueryWWW1[0] = '\0';
|
||||
SubQueryWWW2[0] = '\0';
|
||||
for (Lan = (Txt_Language_t) 1;
|
||||
Lan <= Txt_NUM_LANGUAGES;
|
||||
Lan++)
|
||||
{
|
||||
sprintf (StrField,"countries.Name_%s,",Txt_STR_LANG_ID[Lan]);
|
||||
strcat (SubQueryNam1,StrField);
|
||||
sprintf (StrField,"Name_%s,",Txt_STR_LANG_ID[Lan]);
|
||||
strcat (SubQueryNam2,StrField);
|
||||
|
||||
sprintf (StrField,"countries.WWW_%s,",Txt_STR_LANG_ID[Lan]);
|
||||
strcat (SubQueryWWW1,StrField);
|
||||
sprintf (StrField,"WWW_%s,",Txt_STR_LANG_ID[Lan]);
|
||||
strcat (SubQueryWWW2,StrField);
|
||||
}
|
||||
sprintf (Query,"(SELECT countries.Alpha2,%s%sCOUNT(*) AS NumUsrs"
|
||||
" FROM countries,usr_data"
|
||||
" WHERE countries.CtyCod='%03ld'"
|
||||
" AND countries.CtyCod=usr_data.CtyCod)"
|
||||
" UNION "
|
||||
"(SELECT Alpha2,%s%s0 AS NumUsrs"
|
||||
" FROM countries"
|
||||
" WHERE CtyCod='%03ld'"
|
||||
" AND CtyCod NOT IN"
|
||||
" (SELECT DISTINCT CtyCod FROM usr_data))",
|
||||
SubQueryNam1,SubQueryWWW1,Cty->CtyCod,
|
||||
SubQueryNam2,SubQueryWWW2,Cty->CtyCod);
|
||||
break;
|
||||
}
|
||||
sprintf (Query,"(SELECT Alpha2,%s%sCOUNT(*)"
|
||||
" FROM countries,institutions"
|
||||
" WHERE countries.CtyCod='%03ld' AND countries.CtyCod=institutions.CtyCod"
|
||||
" GROUP BY countries.CtyCod)"
|
||||
" UNION "
|
||||
"(SELECT Alpha2,%s%s0"
|
||||
" FROM countries"
|
||||
" WHERE CtyCod='%03ld'"
|
||||
" AND CtyCod NOT IN (SELECT DISTINCT CtyCod FROM institutions))",
|
||||
SubQueryNam1,SubQueryWWW1,Cty->CtyCod,
|
||||
SubQueryNam2,SubQueryWWW2,Cty->CtyCod);
|
||||
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a country");
|
||||
|
||||
/***** Count number of rows in result *****/
|
||||
|
@ -1133,18 +1257,36 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty)
|
|||
strncpy (Cty->Alpha2,row[0],2);
|
||||
Cty->Alpha2[2] = '\0';
|
||||
|
||||
/* Get the name of the country in several languages */
|
||||
for (Lan = (Txt_Language_t) 1;
|
||||
Lan <= Txt_NUM_LANGUAGES;
|
||||
Lan++)
|
||||
switch (GetExtraData)
|
||||
{
|
||||
strcpy (Cty->Name[Lan],row[Lan]);
|
||||
strcpy (Cty->WWW[Lan],row[Txt_NUM_LANGUAGES+Lan]);
|
||||
}
|
||||
case Cty_GET_BASIC_DATA:
|
||||
/* Get the name of the country in current language */
|
||||
strcpy (Cty->Name[Gbl.Prefs.Language],row[1]);
|
||||
break;
|
||||
case Cty_GET_EXTRA_DATA:
|
||||
/* Get the name of the country in several languages */
|
||||
for (Lan = (Txt_Language_t) 1;
|
||||
Lan <= Txt_NUM_LANGUAGES;
|
||||
Lan++)
|
||||
{
|
||||
strcpy (Cty->Name[Lan],row[Lan]);
|
||||
strcpy (Cty->WWW[Lan],row[Txt_NUM_LANGUAGES+Lan]);
|
||||
}
|
||||
|
||||
/* Get number of institutions in this country */
|
||||
if (sscanf (row[Txt_NUM_LANGUAGES*2+1],"%u",&(Cty->NumInss)) != 1)
|
||||
Cty->NumInss = 0;
|
||||
/* Get number of users who claim to belong to this country */
|
||||
if (sscanf (row[Txt_NUM_LANGUAGES*2+1],"%u",&Cty->NumUsrsWhoClaimToBelongToCty) != 1)
|
||||
Cty->NumUsrsWhoClaimToBelongToCty = 0;
|
||||
|
||||
/* Get number of user in courses of this institution */
|
||||
Cty->NumUsrs = Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,Cty->CtyCod); // Here Rol_UNKNOWN means "all users", NumUsrs <= NumStds + NumTchs
|
||||
Cty->NumStds = Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,Cty->CtyCod);
|
||||
Cty->NumTchs = Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,Cty->CtyCod);
|
||||
|
||||
/* Get number of institutions in this country */
|
||||
Cty->NumInss = Ins_GetNumInssInCty (Cty->CtyCod);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
CtyFound = false;
|
||||
|
@ -1282,6 +1424,7 @@ static void Cty_ListCountriesForEdition (void)
|
|||
"<td rowspan=\"%u\" class=\"BT\">",
|
||||
1 + Txt_NUM_LANGUAGES);
|
||||
if (Cty->NumInss ||
|
||||
Cty->NumUsrsWhoClaimToBelongToCty ||
|
||||
Cty->NumUsrs) // Country has institutions or users ==> deletion forbidden
|
||||
Lay_PutIconRemovalNotAllowed ();
|
||||
else
|
||||
|
@ -1313,7 +1456,7 @@ static void Cty_ListCountriesForEdition (void)
|
|||
fprintf (Gbl.F.Out,"<td rowspan=\"%u\" class=\"DAT RIGHT_TOP\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
1 + Txt_NUM_LANGUAGES,Cty->NumUsrs);
|
||||
1 + Txt_NUM_LANGUAGES,Cty->NumUsrsWhoClaimToBelongToCty);
|
||||
|
||||
/* Number of institutions */
|
||||
fprintf (Gbl.F.Out,"<td rowspan=\"%u\" class=\"DAT RIGHT_TOP\">"
|
||||
|
@ -1414,10 +1557,12 @@ void Cty_RemoveCountry (void)
|
|||
Lay_ShowErrorAndExit ("Code of country is missing.");
|
||||
|
||||
/***** Get data of the country from database *****/
|
||||
Cty_GetDataOfCountryByCod (&Cty);
|
||||
Cty_GetDataOfCountryByCod (&Cty,Cty_GET_EXTRA_DATA);
|
||||
|
||||
/***** Check if this country has users *****/
|
||||
if (Cty.NumInss || Cty.NumUsrs) // Country has institutions or users ==> don't remove
|
||||
if (Cty.NumInss ||
|
||||
Cty.NumUsrsWhoClaimToBelongToCty ||
|
||||
Cty.NumUsrs) // Country has institutions or users ==> don't remove
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_remove_a_country_with_institutions_or_users);
|
||||
else // Country has no users ==> remove it
|
||||
{
|
||||
|
@ -1466,7 +1611,7 @@ void Cty_RenameCountry (void)
|
|||
Par_GetParToText ("Name",NewCtyName,Cty_MAX_BYTES_COUNTRY_NAME);
|
||||
|
||||
/***** Get from the database the data of the country *****/
|
||||
Cty_GetDataOfCountryByCod (Cty);
|
||||
Cty_GetDataOfCountryByCod (Cty,Cty_GET_EXTRA_DATA);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (!NewCtyName[0])
|
||||
|
@ -1585,7 +1730,7 @@ void Cty_ChangeCtyWWW (void)
|
|||
Par_GetParToText ("WWW",NewWWW,Cty_MAX_BYTES_COUNTRY_NAME);
|
||||
|
||||
/***** Get from the database the data of the country *****/
|
||||
Cty_GetDataOfCountryByCod (Cty);
|
||||
Cty_GetDataOfCountryByCod (Cty,Cty_GET_EXTRA_DATA);
|
||||
|
||||
/***** Update the table changing old WWW by new WWW *****/
|
||||
sprintf (Query,"UPDATE countries SET WWW_%s='%s'"
|
||||
|
@ -1738,7 +1883,7 @@ static void Cty_PutHeadCountries (void)
|
|||
extern const char *Txt_Name;
|
||||
extern const char *Txt_WWW;
|
||||
extern const char *Txt_Users;
|
||||
extern const char *Txt_Institutions;
|
||||
extern const char *Txt_Institutions_ABBREVIATION;
|
||||
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<th class=\"BM\"></th>"
|
||||
|
@ -1767,7 +1912,7 @@ static void Cty_PutHeadCountries (void)
|
|||
Txt_Name,
|
||||
Txt_WWW,
|
||||
Txt_Users,
|
||||
Txt_Institutions);
|
||||
Txt_Institutions_ABBREVIATION);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -47,10 +47,14 @@ struct Country
|
|||
char Alpha2[2+1];
|
||||
char Name[1+Txt_NUM_LANGUAGES][Cty_MAX_BYTES_COUNTRY_NAME+1];
|
||||
char WWW [1+Txt_NUM_LANGUAGES][Cty_MAX_LENGTH_COUNTRY_WWW+1];
|
||||
unsigned NumUsrs;
|
||||
unsigned NumStds;
|
||||
unsigned NumTchs;
|
||||
unsigned NumUsrsWhoClaimToBelongToCty;
|
||||
unsigned NumInss;
|
||||
unsigned NumCtrs;
|
||||
unsigned NumDegs;
|
||||
unsigned NumCrss;
|
||||
unsigned NumUsrs; // Number of users in courses of the institution
|
||||
unsigned NumStds; // Number of students in courses of the institution
|
||||
unsigned NumTchs; // Number of teachers in courses of the institution
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
@ -63,7 +67,7 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
Cty_GET_ONLY_COUNTRIES,
|
||||
Cty_GET_BASIC_DATA,
|
||||
Cty_GET_EXTRA_DATA,
|
||||
} Cty_GetExtraData_t;
|
||||
|
||||
|
@ -92,7 +96,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData);
|
|||
void Cty_FreeListCountries (void);
|
||||
void Cty_WriteSelectorOfCountry (void);
|
||||
void Cty_WriteCountryName (long CtyCod,const char *Class);
|
||||
bool Cty_GetDataOfCountryByCod (struct Country *Cty);
|
||||
bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraData);
|
||||
void Cty_GetCountryName (long CtyCod,char CtyName[Cty_MAX_BYTES_COUNTRY_NAME+1]);
|
||||
void Cty_PutParamCtyCod (long CtyCod);
|
||||
long Cty_GetParamOtherCtyCod (void);
|
||||
|
|
|
@ -577,7 +577,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
|||
|
||||
/***** Get data of this institution *****/
|
||||
Cty.CtyCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (!Cty_GetDataOfCountryByCod (&Cty))
|
||||
if (!Cty_GetDataOfCountryByCod (&Cty,Cty_GET_BASIC_DATA))
|
||||
Lay_ShowErrorAndExit ("Country not found.");
|
||||
|
||||
/***** Write link to country *****/
|
||||
|
@ -620,7 +620,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
|||
|
||||
/***** Get data of this institution *****/
|
||||
Ins.InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (!Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA))
|
||||
if (!Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA))
|
||||
Lay_ShowErrorAndExit ("Institution not found.");
|
||||
|
||||
/***** Write link to institution *****/
|
||||
|
|
|
@ -890,7 +890,7 @@ void Deg_InitCurrentCourse (void)
|
|||
/***** If numerical institution code is available, get institution data *****/
|
||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||
{
|
||||
if (Ins_GetDataOfInstitutionByCod (&Gbl.CurrentIns.Ins,Ins_GET_MINIMAL_DATA)) // Institution found
|
||||
if (Ins_GetDataOfInstitutionByCod (&Gbl.CurrentIns.Ins,Ins_GET_BASIC_DATA)) // Institution found
|
||||
Gbl.CurrentCty.Cty.CtyCod = Gbl.CurrentIns.Ins.CtyCod;
|
||||
else
|
||||
{
|
||||
|
@ -906,7 +906,7 @@ void Deg_InitCurrentCourse (void)
|
|||
/***** If numerical country code is available, get country data *****/
|
||||
if (Gbl.CurrentCty.Cty.CtyCod > 0)
|
||||
{
|
||||
if (!Cty_GetDataOfCountryByCod (&Gbl.CurrentCty.Cty)) // Country not found
|
||||
if (!Cty_GetDataOfCountryByCod (&Gbl.CurrentCty.Cty,Cty_GET_BASIC_DATA)) // Country not found
|
||||
{
|
||||
Gbl.YearOK = false;
|
||||
Gbl.CurrentCty.Cty.CtyCod =
|
||||
|
@ -3901,7 +3901,7 @@ void Deg_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
|
|||
if (Ins.InsCod > 0)
|
||||
{
|
||||
/* Get data of institution */
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/* Write institution logo and name */
|
||||
Ins_DrawInstitutionLogoAndNameWithLink (&Ins,ActSeeInsInf,
|
||||
|
|
|
@ -230,7 +230,7 @@ void Dpt_EditDepartments (void)
|
|||
Lay_ShowErrorAndExit ("No institution selected."); // This should not happen
|
||||
|
||||
/***** Get list of institutions *****/
|
||||
Ins_GetListInstitutions (Gbl.CurrentCty.Cty.CtyCod,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetListInstitutions (Gbl.CurrentCty.Cty.CtyCod,Ins_GET_BASIC_DATA);
|
||||
if (!Gbl.Inss.Num)
|
||||
Lay_ShowErrorAndExit ("There is no list of institutions."); // This should not happen
|
||||
|
||||
|
@ -501,7 +501,7 @@ static void Dpt_ListDepartmentsForEdition (void)
|
|||
|
||||
/* Get data of institution of this department */
|
||||
Ins.InsCod = Dpt->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/* Put icon to remove department */
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
|
|
@ -745,7 +745,7 @@ static void Exa_ShowExamAnnouncement (long ExaCod,Exa_TypeViewExamAnnouncement_t
|
|||
|
||||
/***** Get data of institution of this degree *****/
|
||||
Ins.InsCod = Gbl.CurrentIns.Ins.InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
switch (TypeViewExamAnnouncement)
|
||||
{
|
||||
|
@ -1295,7 +1295,7 @@ static void Exa_GetNotifContentExamAnnouncement (char **ContentStr)
|
|||
|
||||
/***** Get data of institution *****/
|
||||
Ins.InsCod = Deg_GetInsCodOfDegreeByCod (Deg.DegCod);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
Dat_ConvDateToDateStr (&Gbl.ExamAnnouncement.ExamDate,StrExamDate);
|
||||
|
||||
|
|
|
@ -1870,7 +1870,7 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,bool IsLastIte
|
|||
|
||||
/***** Get data of this institution *****/
|
||||
Gbl.Forum.Ins.InsCod = InsCod;
|
||||
if (!Ins_GetDataOfInstitutionByCod (&Gbl.Forum.Ins,Ins_GET_MINIMAL_DATA))
|
||||
if (!Ins_GetDataOfInstitutionByCod (&Gbl.Forum.Ins,Ins_GET_BASIC_DATA))
|
||||
Lay_ShowErrorAndExit ("Institution not found.");
|
||||
|
||||
/***** Link to the forum of users from this institution *****/
|
||||
|
@ -3579,7 +3579,7 @@ void For_GetParamsForum (void)
|
|||
/***** Get parameter with code of institution *****/
|
||||
Par_GetParToText ("ForInsCod",LongStr,1+10);
|
||||
Gbl.Forum.Ins.InsCod = Str_ConvertStrCodToLongCod (LongStr);
|
||||
Ins_GetDataOfInstitutionByCod (&Gbl.Forum.Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Gbl.Forum.Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/***** Get parameter with code of institution *****/
|
||||
Par_GetParToText ("ForCtrCod",LongStr,1+10);
|
||||
|
|
|
@ -155,7 +155,7 @@ void Ins_SeeInsWithPendingCtrs (void)
|
|||
Gbl.ColorRows[Gbl.RowEvenOdd];
|
||||
|
||||
/* Get data of institution */
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/* Institution logo and name */
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -251,6 +251,7 @@ static void Ins_Configuration (bool PrintView)
|
|||
extern const char *Txt_Degrees;
|
||||
extern const char *Txt_Courses;
|
||||
extern const char *Txt_Departments;
|
||||
extern const char *Txt_Users_of_the_institution;
|
||||
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
bool PutLink = !PrintView && Gbl.CurrentIns.Ins.WWW[0];
|
||||
|
||||
|
@ -379,6 +380,19 @@ static void Ins_Configuration (bool PrintView)
|
|||
}
|
||||
else
|
||||
{
|
||||
/***** Number of users who claim to belong to this institution *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s:"
|
||||
"</td>"
|
||||
"<td class=\"DAT LEFT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Users_of_the_institution,
|
||||
Usr_GetNumUsrsWhoClaimToBelongToIns (Gbl.CurrentIns.Ins.InsCod));
|
||||
|
||||
/***** Number of centres *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
|
@ -431,7 +445,7 @@ static void Ins_Configuration (bool PrintView)
|
|||
Txt_Departments,
|
||||
Dpt_GetNumDepartmentsInInstitution (Gbl.CurrentIns.Ins.InsCod));
|
||||
|
||||
/***** Number of teachers *****/
|
||||
/***** Number of teachers in courses of this institution *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s:"
|
||||
|
@ -444,7 +458,7 @@ static void Ins_Configuration (bool PrintView)
|
|||
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||
Usr_GetNumUsrsInCrssOfIns (Rol_TEACHER,Gbl.CurrentIns.Ins.InsCod));
|
||||
|
||||
/***** Number of students *****/
|
||||
/***** Number of students in courses of this institution *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s:"
|
||||
|
@ -456,6 +470,20 @@ static void Ins_Configuration (bool PrintView)
|
|||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||
Usr_GetNumUsrsInCrssOfIns (Rol_STUDENT,Gbl.CurrentIns.Ins.InsCod));
|
||||
|
||||
/***** Number of users in courses of this institution *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s + %s:"
|
||||
"</td>"
|
||||
"<td class=\"DAT LEFT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
|
||||
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
|
||||
Usr_GetNumUsrsInCrssOfIns (Rol_UNKNOWN,Gbl.CurrentIns.Ins.InsCod));
|
||||
}
|
||||
|
||||
/***** End of the frame *****/
|
||||
|
@ -581,31 +609,54 @@ static void Ins_ListOneInstitutionForSeeing (struct Institution *Ins,unsigned Nu
|
|||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/***** Stats *****/
|
||||
/* Number of users who claim to belong to this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumUsrs);
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumStds);
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumTchs);
|
||||
TxtClassNormal,BgColor,Ins->NumUsrsWhoClaimToBelongToIns);
|
||||
|
||||
/* Number of centres in this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumCtrs);
|
||||
|
||||
/* Number of degrees in this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumDegs);
|
||||
|
||||
/* Number of courses in this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumCrss);
|
||||
|
||||
/* Number of departments in this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumDpts);
|
||||
|
||||
/* Number of teachers in courses of this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumTchs);
|
||||
|
||||
/* Number of students in courses of this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumStds);
|
||||
|
||||
/* Number of users in courses of this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumUsrs);
|
||||
|
||||
/***** Institution status *****/
|
||||
StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status);
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_MIDDLE %s\">"
|
||||
|
@ -625,10 +676,11 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
|
|||
{
|
||||
extern const char *Txt_INSTITUTIONS_HELP_ORDER[2];
|
||||
extern const char *Txt_INSTITUTIONS_ORDER[2];
|
||||
extern const char *Txt_Students_ABBREVIATION;
|
||||
extern const char *Txt_Teachers_ABBREVIATION;
|
||||
extern const char *Txt_Centres;
|
||||
extern const char *Txt_Students_ABBREVIATION;
|
||||
extern const char *Txt_Centres_ABBREVIATION;
|
||||
extern const char *Txt_Degrees_ABBREVIATION;
|
||||
extern const char *Txt_Courses_ABBREVIATION;
|
||||
extern const char *Txt_Departments_ABBREVIATION;
|
||||
extern const char *Txt_Status;
|
||||
Ins_InssOrderType_t Order;
|
||||
|
@ -639,7 +691,9 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
|
|||
Order <= Ins_ORDER_BY_NUM_USRS;
|
||||
Order++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<th class=\"LEFT_MIDDLE\">");
|
||||
fprintf (Gbl.F.Out,"<th class=\"%s\">",
|
||||
Order == Ins_ORDER_BY_INSTITUTION ? "LEFT_MIDDLE" :
|
||||
"RIGHT_MIDDLE");
|
||||
if (OrderSelectable)
|
||||
{
|
||||
Act_FormStart (ActSeeIns);
|
||||
|
@ -659,7 +713,7 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
|
|||
fprintf (Gbl.F.Out,"</th>");
|
||||
}
|
||||
fprintf (Gbl.F.Out,"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
|
@ -673,15 +727,24 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
|
|||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"RIGHT_MIDDLE\">"
|
||||
"%s+<br />%s"
|
||||
"</th>"
|
||||
"<th class=\"LEFT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"</tr>",
|
||||
Txt_Centres_ABBREVIATION,
|
||||
Txt_Degrees_ABBREVIATION,
|
||||
Txt_Courses_ABBREVIATION,
|
||||
Txt_Departments_ABBREVIATION,
|
||||
Txt_Teachers_ABBREVIATION,
|
||||
Txt_Students_ABBREVIATION,
|
||||
Txt_Teachers_ABBREVIATION,
|
||||
Txt_Centres,
|
||||
Txt_Degrees_ABBREVIATION,
|
||||
Txt_Departments_ABBREVIATION,
|
||||
Txt_Students_ABBREVIATION,
|
||||
Txt_Status);
|
||||
}
|
||||
|
||||
|
@ -743,7 +806,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
|||
/***** Get institutions from database *****/
|
||||
switch (GetExtraData)
|
||||
{
|
||||
case Ins_GET_MINIMAL_DATA:
|
||||
case Ins_GET_BASIC_DATA:
|
||||
if (CtyCod <= 0) // Get all the institutions, belonging to any country
|
||||
sprintf (Query,"SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW"
|
||||
" FROM institutions"
|
||||
|
@ -776,7 +839,8 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
|||
" UNION "
|
||||
"(SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW,0 AS NumUsrs"
|
||||
" FROM institutions"
|
||||
" WHERE InsCod NOT IN (SELECT DISTINCT InsCod FROM usr_data))"
|
||||
" WHERE InsCod NOT IN"
|
||||
" (SELECT DISTINCT InsCod FROM usr_data))"
|
||||
" ORDER BY %s",
|
||||
OrderBySubQuery);
|
||||
else // Get only the institutions belonging to the country specified by CtyCod
|
||||
|
@ -785,12 +849,15 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
|||
"institutions.ShortName,institutions.FullName,"
|
||||
"institutions.WWW,COUNT(*) AS NumUsrs"
|
||||
" FROM institutions,usr_data"
|
||||
" WHERE institutions.CtyCod='%ld' AND institutions.InsCod=usr_data.InsCod"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" AND institutions.InsCod=usr_data.InsCod"
|
||||
" GROUP BY institutions.InsCod)"
|
||||
" UNION "
|
||||
"(SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW,0 AS NumUsrs"
|
||||
" FROM institutions"
|
||||
" WHERE CtyCod='%ld' AND InsCod NOT IN (SELECT DISTINCT InsCod FROM usr_data))"
|
||||
" WHERE CtyCod='%ld'"
|
||||
" AND InsCod NOT IN"
|
||||
" (SELECT DISTINCT InsCod FROM usr_data))"
|
||||
" ORDER BY %s",
|
||||
CtyCod,CtyCod,
|
||||
OrderBySubQuery);
|
||||
|
@ -844,32 +911,32 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
|||
/* Get extra data */
|
||||
switch (GetExtraData)
|
||||
{
|
||||
case Ins_GET_MINIMAL_DATA:
|
||||
Ins->NumStds = Ins->NumTchs = Ins->NumUsrs =
|
||||
Ins->NumCtrs = Ins->NumDpts = Ins->NumDegs = 0;
|
||||
case Ins_GET_BASIC_DATA:
|
||||
Ins->NumUsrsWhoClaimToBelongToIns = 0;
|
||||
Ins->NumCtrs = Ins->NumDegs = Ins->NumCrss = Ins->NumDpts = 0;
|
||||
Ins->NumUsrs = Ins->NumTchs = Ins->NumStds = 0;
|
||||
break;
|
||||
case Ins_GET_EXTRA_DATA:
|
||||
/* Get number of users in this institution (row[7]) */
|
||||
if (sscanf (row[7],"%u",&Ins->NumUsrs) == 1)
|
||||
{
|
||||
if (Ins->NumUsrs)
|
||||
{
|
||||
Ins->NumStds = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_STUDENT); // Slow query
|
||||
Ins->NumTchs = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_TEACHER); // Slow query
|
||||
Ins->NumUsrs = Ins->NumStds + Ins->NumTchs;
|
||||
}
|
||||
}
|
||||
else
|
||||
Ins->NumStds = Ins->NumTchs = Ins->NumUsrs = 0;
|
||||
/* Get number of users who claim to belong to this institution (row[7]) */
|
||||
if (sscanf (row[7],"%u",&Ins->NumUsrsWhoClaimToBelongToIns) != 1)
|
||||
Ins->NumUsrsWhoClaimToBelongToIns = 0;
|
||||
|
||||
/* Get number of centres in this institution */
|
||||
Ins->NumCtrs = Ctr_GetNumCtrsInIns (Ins->InsCod);
|
||||
|
||||
/* Get number of degrees in this institution */
|
||||
Ins->NumDegs = Deg_GetNumDegsInIns (Ins->InsCod);
|
||||
|
||||
/* Get number of degrees in this institution */
|
||||
Ins->NumCrss = Crs_GetNumCrssInIns (Ins->InsCod);
|
||||
|
||||
/* Get number of departments in this institution */
|
||||
Ins->NumDpts = Dpt_GetNumberOfDepartmentsInInstitution (Ins->InsCod);
|
||||
|
||||
/* Get number of degrees in this institution */
|
||||
Ins->NumDegs = Deg_GetNumDegsInIns (Ins->InsCod);
|
||||
/* Get number of users in courses */
|
||||
Ins->NumUsrs = Usr_GetNumUsrsInCrssOfIns (Rol_UNKNOWN,Ins->InsCod); // Here Rol_UNKNOWN means "all users", NumUsrs <= NumStds + NumTchs
|
||||
Ins->NumTchs = Usr_GetNumUsrsInCrssOfIns (Rol_TEACHER,Ins->InsCod);
|
||||
Ins->NumStds = Usr_GetNumUsrsInCrssOfIns (Rol_STUDENT,Ins->InsCod);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -944,10 +1011,10 @@ bool Ins_GetDataOfInstitutionByCod (struct Institution *Ins,
|
|||
/* Get extra data */
|
||||
if (GetExtraData == Ins_GET_EXTRA_DATA)
|
||||
{
|
||||
/* Get number of users in this institution */
|
||||
Ins->NumStds = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_STUDENT); // Slow query
|
||||
Ins->NumTchs = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_TEACHER); // Slow query
|
||||
Ins->NumUsrs = Ins->NumStds + Ins->NumTchs;
|
||||
/* Get number of users in courses of this institution */
|
||||
Ins->NumUsrs = Usr_GetNumUsrsInCrssOfIns (Rol_UNKNOWN,Ins->InsCod); // Here Rol_UNKNOWN means "all users", NumUsrs <= NumStds + NumTchs
|
||||
Ins->NumStds = Usr_GetNumUsrsInCrssOfIns (Rol_STUDENT,Ins->InsCod);
|
||||
Ins->NumTchs = Usr_GetNumUsrsInCrssOfIns (Rol_TEACHER,Ins->InsCod);
|
||||
|
||||
/* Get number of centres in this institution */
|
||||
Ins->NumCtrs = Ctr_GetNumCtrsInIns (Ins->InsCod);
|
||||
|
@ -1119,7 +1186,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
|
||||
/***** Get list of countries *****/
|
||||
Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY;
|
||||
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES);
|
||||
Cty_GetListCountries (Cty_GET_BASIC_DATA);
|
||||
|
||||
/***** Write heading *****/
|
||||
sprintf (Gbl.Title,Txt_Institutions_of_COUNTRY_X,
|
||||
|
@ -1418,7 +1485,7 @@ void Ins_RemoveInstitution (void)
|
|||
Lay_ShowErrorAndExit ("Code of institution is missing.");
|
||||
|
||||
/***** Get data of the institution from database *****/
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/***** Check if this institution has users *****/
|
||||
if (Ctr_GetNumCtrsInIns (Ins.InsCod) ||
|
||||
|
@ -1513,7 +1580,7 @@ static void Ins_RenameInstitution (Cns_ShortOrFullName_t ShortOrFullName)
|
|||
Par_GetParToText (ParamName,NewInsName,MaxLength);
|
||||
|
||||
/***** Get from the database the old names of the institution *****/
|
||||
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (!NewInsName[0])
|
||||
|
@ -1582,7 +1649,7 @@ static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Nam
|
|||
void Ins_ChangeInsCountry (void)
|
||||
{
|
||||
extern const char *Txt_The_institution_X_already_exists;
|
||||
extern const char *Txt_The_country_of_the_institution_X_has_changed_Y;
|
||||
extern const char *Txt_The_country_of_the_institution_X_has_changed_to_Y;
|
||||
struct Institution *Ins;
|
||||
struct Country NewCty;
|
||||
char Query[256];
|
||||
|
@ -1599,10 +1666,10 @@ void Ins_ChangeInsCountry (void)
|
|||
Lay_ShowErrorAndExit ("Code of country is missing.");
|
||||
|
||||
/***** Get data of the institution from database *****/
|
||||
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/***** Get data of the country from database *****/
|
||||
Cty_GetDataOfCountryByCod (&NewCty);
|
||||
Cty_GetDataOfCountryByCod (&NewCty,Cty_GET_BASIC_DATA);
|
||||
|
||||
/***** Check if country has changed *****/
|
||||
if (NewCty.CtyCod != Ins->CtyCod)
|
||||
|
@ -1629,8 +1696,8 @@ void Ins_ChangeInsCountry (void)
|
|||
DB_QueryUPDATE (Query,"can not update the country of an institution");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_country_of_the_institution_X_has_changed_Y,
|
||||
Ins->FullName,NewCty.Name);
|
||||
sprintf (Gbl.Message,Txt_The_country_of_the_institution_X_has_changed_to_Y,
|
||||
Ins->FullName,NewCty.Name[Gbl.Prefs.Language]);
|
||||
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
|
||||
|
||||
Ins->CtyCod = NewCty.CtyCod;
|
||||
|
@ -1712,7 +1779,7 @@ void Ins_ChangeInsStatus (void)
|
|||
Status = Ins_GetStatusBitsFromStatusTxt (StatusTxt); // New status
|
||||
|
||||
/***** Get data of institution *****/
|
||||
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/***** Update status in table of institutions *****/
|
||||
sprintf (Query,"UPDATE institutions SET Status='%u' WHERE InsCod='%ld'",
|
||||
|
@ -1772,7 +1839,7 @@ static void Ins_PutFormToCreateInstitution (void)
|
|||
|
||||
/***** Get list of countries *****/
|
||||
Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY;
|
||||
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES);
|
||||
Cty_GetListCountries (Cty_GET_BASIC_DATA);
|
||||
|
||||
/***** Start form *****/
|
||||
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
|
||||
|
|
|
@ -64,12 +64,14 @@ struct Institution
|
|||
char ShortName[Ins_MAX_LENGTH_INSTITUTION_SHORT_NAME+1];
|
||||
char FullName[Ins_MAX_LENGTH_INSTITUTION_FULL_NAME+1];
|
||||
char WWW[Cns_MAX_LENGTH_WWW+1];
|
||||
unsigned NumStds;
|
||||
unsigned NumTchs;
|
||||
unsigned NumUsrs;
|
||||
unsigned NumUsrsWhoClaimToBelongToIns;
|
||||
unsigned NumCtrs;
|
||||
unsigned NumDpts;
|
||||
unsigned NumDegs;
|
||||
unsigned NumCrss;
|
||||
unsigned NumDpts;
|
||||
unsigned NumUsrs;
|
||||
unsigned NumTchs;
|
||||
unsigned NumStds;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
@ -82,7 +84,7 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
Ins_GET_MINIMAL_DATA,
|
||||
Ins_GET_BASIC_DATA,
|
||||
Ins_GET_EXTRA_DATA,
|
||||
} Ins_GetExtraData_t;
|
||||
|
||||
|
|
|
@ -1456,7 +1456,7 @@ void Lay_WriteHeaderClassPhoto (unsigned NumColumns,bool PrintView,bool DrawingC
|
|||
|
||||
/***** Get data of institution *****/
|
||||
Ins.InsCod = InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/***** Get data of degree *****/
|
||||
Deg.DegCod = DegCod;
|
||||
|
|
|
@ -361,7 +361,7 @@ void Ntf_ShowMyNotifications (void)
|
|||
|
||||
/* Get institution code (row[2]) */
|
||||
Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/* Get centre code (row[3]) */
|
||||
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||
|
@ -1415,7 +1415,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
|
||||
/* Get institution code (row[2]) */
|
||||
Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/* Get centre code (row[3]) */
|
||||
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||
|
|
|
@ -2127,7 +2127,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
|||
if (UsrDat->InsCod > 0)
|
||||
{
|
||||
Ins.InsCod = UsrDat->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/* Form to go to the institution */
|
||||
if (PutFormLinks)
|
||||
|
@ -2792,7 +2792,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
|||
if (!Gbl.Ctys.Num)
|
||||
{
|
||||
Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY;
|
||||
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES);
|
||||
Cty_GetListCountries (Cty_GET_BASIC_DATA);
|
||||
}
|
||||
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -3366,7 +3366,7 @@ void Rec_ShowFormMyInsCtrDpt (void)
|
|||
extern const char *Txt_Please_fill_in_your_centre_and_department;
|
||||
extern const char *Txt_Institution_centre_and_department;
|
||||
extern const char *Txt_Institution;
|
||||
extern const char *Txt_Country_of_institution;
|
||||
extern const char *Txt_Country_of_the_institution;
|
||||
extern const char *Txt_Another_institution;
|
||||
extern const char *Txt_Centre;
|
||||
extern const char *Txt_Another_centre;
|
||||
|
@ -3401,14 +3401,14 @@ void Rec_ShowFormMyInsCtrDpt (void)
|
|||
"%s:"
|
||||
"</td>"
|
||||
"<td class=\"LEFT_MIDDLE\" style=\"width:%upx;\">",
|
||||
ClassForm,Txt_Country_of_institution,
|
||||
ClassForm,Txt_Country_of_the_institution,
|
||||
COL2_WIDTH);
|
||||
|
||||
/* If list of countries is empty, try to get it */
|
||||
if (!Gbl.Ctys.Num)
|
||||
{
|
||||
Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY;
|
||||
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES);
|
||||
Cty_GetListCountries (Cty_GET_BASIC_DATA);
|
||||
}
|
||||
|
||||
/* Start form to select the country of my institution */
|
||||
|
@ -3448,7 +3448,7 @@ void Rec_ShowFormMyInsCtrDpt (void)
|
|||
/* Get list of institutions in this country */
|
||||
Ins_FreeListInstitutions ();
|
||||
if (Gbl.Usrs.Me.UsrDat.InsCtyCod > 0)
|
||||
Ins_GetListInstitutions (Gbl.Usrs.Me.UsrDat.InsCtyCod,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetListInstitutions (Gbl.Usrs.Me.UsrDat.InsCtyCod,Ins_GET_BASIC_DATA);
|
||||
|
||||
/* Start form to select institution */
|
||||
Act_FormGoToStart (ActChgMyIns);
|
||||
|
@ -3653,7 +3653,7 @@ void Rec_UpdateMyInstitution (void)
|
|||
/* Get country of institution */
|
||||
if (Ins.InsCod > 0)
|
||||
{
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
if (Gbl.Usrs.Me.UsrDat.InsCtyCod != Ins.CtyCod)
|
||||
Gbl.Usrs.Me.UsrDat.InsCtyCod = Ins.CtyCod;
|
||||
}
|
||||
|
|
|
@ -3293,11 +3293,11 @@ static void Sta_WriteCountry (long CtyCod)
|
|||
{
|
||||
/***** Get data of country *****/
|
||||
Cty.CtyCod = CtyCod;
|
||||
Cty_GetDataOfCountryByCod (&Cty);
|
||||
Cty_GetDataOfCountryByCod (&Cty,Cty_GET_BASIC_DATA);
|
||||
|
||||
/***** Form to go to country *****/
|
||||
Cty_DrawCountryMapAndNameWithLink (&Cty,ActSeeCtyInf,
|
||||
"LOG","COUNTRY_MAP_TINY");
|
||||
"LOG","COUNTRY_MAP_TINY");
|
||||
}
|
||||
else // Hit with no country selected
|
||||
/***** No country selected *****/
|
||||
|
@ -3384,7 +3384,7 @@ static void Sta_WriteInstitution (long InsCod)
|
|||
{
|
||||
/***** Get data of institution *****/
|
||||
Ins.InsCod = InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/***** Title in cell *****/
|
||||
fprintf (Gbl.F.Out,"title=\"%s\">",
|
||||
|
@ -5147,7 +5147,7 @@ static unsigned Sta_GetInsAndStat (struct Institution *Ins,MYSQL_RES *mysql_res)
|
|||
|
||||
/***** Get data of this institution (row[0]) *****/
|
||||
Ins->InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (!Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_MINIMAL_DATA))
|
||||
if (!Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA))
|
||||
Lay_ShowErrorAndExit ("Institution not found.");
|
||||
|
||||
/***** Get statistic (row[1]) *****/
|
||||
|
|
132
swad_text.c
132
swad_text.c
|
@ -1613,7 +1613,7 @@ const char *Txt_accessible_for_reading_and_writing_by_administrators_of_the_inst
|
|||
#elif L==4
|
||||
"accesible para lectura y escritura por administradores de la institución";
|
||||
#elif L==5
|
||||
"accessible en lecture et en écriture par les administrateurs de l'établissement";
|
||||
"accessible en lecture et en écriture par les administrateurs du établissement";
|
||||
#elif L==6
|
||||
"accesible para lectura y escritura por administradores de la institución"; // Okoteve traducción
|
||||
#elif L==7
|
||||
|
@ -1697,7 +1697,7 @@ const char *Txt_accessible_for_reading_and_writing_by_students_and_teachers_of_t
|
|||
#elif L==4
|
||||
"accesible para lectura y escritura por estudiantes y profesores de la institución";
|
||||
#elif L==5
|
||||
"accessible en lecture et en écriture par les étudiants et les enseignants de l'établissement";
|
||||
"accessible en lecture et en écriture par les étudiants et les enseignants du établissement";
|
||||
#elif L==6
|
||||
"accesible para lectura y escritura por estudiantes y profesores de la institución"; // Okoteve traducción
|
||||
#elif L==7
|
||||
|
@ -1865,7 +1865,7 @@ const char *Txt_accessible_only_for_reading_by_students_and_teachers_of_the_inst
|
|||
#elif L==4
|
||||
"accesible solo para lectura por estudiantes y profesores de la institución";
|
||||
#elif L==5
|
||||
"accessible uniquement pour la lecture par les étudiants et les enseignants de l'établissement";
|
||||
"accessible uniquement pour la lecture par les étudiants et les enseignants du établissement";
|
||||
#elif L==6
|
||||
"accesible solo para lectura por estudiantes y profesores de la institución"; // Okoteve traducción
|
||||
#elif L==7
|
||||
|
@ -3972,23 +3972,23 @@ const char *Txt_Centres =
|
|||
|
||||
const char *Txt_Centres_ABBREVIATION =
|
||||
#if L==1
|
||||
"Centres";
|
||||
"Cent.";
|
||||
#elif L==2
|
||||
"Lehrinst.";
|
||||
"Lehrin.";
|
||||
#elif L==3
|
||||
"Centres";
|
||||
"Cent.";
|
||||
#elif L==4
|
||||
"Centros";
|
||||
"Cent.";
|
||||
#elif L==5
|
||||
"Centres";
|
||||
"Cent.";
|
||||
#elif L==6
|
||||
"Mbo'ehao";
|
||||
#elif L==7
|
||||
"Centri";
|
||||
"Cent.";
|
||||
#elif L==8
|
||||
"Centra";
|
||||
"Cent.";
|
||||
#elif L==9
|
||||
"Centros";
|
||||
"Cent.";
|
||||
#endif
|
||||
|
||||
const char *Txt_centres =
|
||||
|
@ -5193,23 +5193,23 @@ const char *Txt_COUNTRIES_ORDER[2] =
|
|||
#endif
|
||||
,
|
||||
#if L==1
|
||||
"Usuaris d'aquesta nacionalitat"
|
||||
"Usuaris del país"
|
||||
#elif L==2
|
||||
"Benutzer dieser Staatsangehörigkeit"
|
||||
"Benutzer des Landes"
|
||||
#elif L==3
|
||||
"Users of that nationality"
|
||||
"Users of the country"
|
||||
#elif L==4
|
||||
"Usuarios de esa nacionalidad"
|
||||
"Usuarios del país"
|
||||
#elif L==5
|
||||
"Utilisateurs de cette nationalité"
|
||||
"Utilisateurs du pays"
|
||||
#elif L==6
|
||||
"Usuarios de esa nacionalidad" // Okoteve traducción
|
||||
"Usuarios del país" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Utenti di questa nazionalità"
|
||||
"Utenti del paese"
|
||||
#elif L==8
|
||||
"Użytkownicy tej narodowości"
|
||||
"Użytkownicy kraju"
|
||||
#elif L==9
|
||||
"Utilizadores dessa nacionalidade"
|
||||
"Utilizadores do país"
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -5234,25 +5234,25 @@ const char *Txt_Country =
|
|||
"País";
|
||||
#endif
|
||||
|
||||
const char *Txt_Country_of_institution =
|
||||
const char *Txt_Country_of_the_institution =
|
||||
#if L==1
|
||||
"País de la institució";
|
||||
#elif L==2
|
||||
"Land der Hochschule";
|
||||
#elif L==3
|
||||
"Country of institution";
|
||||
"Country of the institution";
|
||||
#elif L==4
|
||||
"País de la institución";
|
||||
#elif L==5
|
||||
"Pays de l'établissement";
|
||||
"Pays du établissement";
|
||||
#elif L==6
|
||||
"Tetã mbo'ehao";
|
||||
#elif L==7
|
||||
"Paese di istituzione";
|
||||
"Paese della istituzione";
|
||||
#elif L==8
|
||||
"Kraj instytucji";
|
||||
#elif L==9
|
||||
"País de institução";
|
||||
"País da institução";
|
||||
#endif
|
||||
|
||||
const char *Txt_Country_unspecified =
|
||||
|
@ -14814,6 +14814,27 @@ const char *Txt_Institutions =
|
|||
"Instituções";
|
||||
#endif
|
||||
|
||||
const char *Txt_Institutions_ABBREVIATION =
|
||||
#if L==1
|
||||
"Instit.";
|
||||
#elif L==2
|
||||
"Hochsc.";
|
||||
#elif L==3
|
||||
"Instit.";
|
||||
#elif L==4
|
||||
"Instit.";
|
||||
#elif L==5
|
||||
"Établ.";
|
||||
#elif L==6
|
||||
"Mbo'ehao";
|
||||
#elif L==7
|
||||
"Istit.";
|
||||
#elif L==8
|
||||
"Instyt.";
|
||||
#elif L==9
|
||||
"Instit.";
|
||||
#endif
|
||||
|
||||
const char *Txt_institutions =
|
||||
#if L==1
|
||||
"institucions";
|
||||
|
@ -15027,23 +15048,23 @@ const char *Txt_INSTITUTIONS_ORDER[2] =
|
|||
#endif
|
||||
,
|
||||
#if L==1
|
||||
"Usuaris"
|
||||
"Usuaris de la institució"
|
||||
#elif L==2
|
||||
"Benutzer"
|
||||
"Benutzer der Hochschule"
|
||||
#elif L==3
|
||||
"Users"
|
||||
"Users of the institution"
|
||||
#elif L==4
|
||||
"Usuarios"
|
||||
"Usuarios de la institución"
|
||||
#elif L==5
|
||||
"Utilisateurs"
|
||||
"Utilisateurs du établissement"
|
||||
#elif L==6
|
||||
"Puruhára"
|
||||
"Usuarios de la institución" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Utenti"
|
||||
"Utenti della istituzione"
|
||||
#elif L==8
|
||||
"Użytkownicy"
|
||||
"Użytkownicy instytucji"
|
||||
#elif L==9
|
||||
"Utilizadores"
|
||||
"Utilizadores da institução"
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -39110,7 +39131,7 @@ const char *Txt_The_country_X_has_been_renamed_as_Y = // Warning: it is very imp
|
|||
"The country <strong>%s</strong> has been renamed as <strong>%s</strong>."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_The_country_of_the_institution_X_has_changed_Y = // Warning: it is very important to include two %s in the following sentences
|
||||
const char *Txt_The_country_of_the_institution_X_has_changed_to_Y = // Warning: it is very important to include two %s in the following sentences
|
||||
#if L==1
|
||||
"El país de la institución <strong>%s</strong>"
|
||||
" ha cambiado a <strong>%s</strong>."; // Necessita traduccio
|
||||
|
@ -47130,25 +47151,46 @@ const char *Txt_X_users_have_been_removed = // Warning: it is very important to
|
|||
"%u users have been removed."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_Users_in_courses =
|
||||
const char *Txt_Users_of_the_country =
|
||||
#if L==1
|
||||
"Usuaris en assignatures";
|
||||
"Usuaris del país";
|
||||
#elif L==2
|
||||
"Benutzer in Kurse";
|
||||
"Benutzer des Landes";
|
||||
#elif L==3
|
||||
"Users in courses";
|
||||
"Users of the country";
|
||||
#elif L==4
|
||||
"Usuarios en asignaturas";
|
||||
"Usuarios del país";
|
||||
#elif L==5
|
||||
"Utilisateurs dans matières";
|
||||
"Utilisateurs du pays";
|
||||
#elif L==6
|
||||
"Usuarios en asignaturas"; // Okoteve traducción
|
||||
"Usuarios del país"; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Utenti in corsi";
|
||||
"Utenti del paese";
|
||||
#elif L==8
|
||||
"Użytkowników w kursõw";
|
||||
"Użytkownicy kraju";
|
||||
#elif L==9
|
||||
"Usuários em disciplinas";
|
||||
"Utilizadores do país";
|
||||
#endif
|
||||
|
||||
const char *Txt_Users_of_the_institution =
|
||||
#if L==1
|
||||
"Usuaris de la institució";
|
||||
#elif L==2
|
||||
"Benutzer der Hochschule";
|
||||
#elif L==3
|
||||
"Users of the institution";
|
||||
#elif L==4
|
||||
"Usuarios de la institución";
|
||||
#elif L==5
|
||||
"Utilisateurs du établissement";
|
||||
#elif L==6
|
||||
"Usuarios de la institución"; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Utenti della istituzione";
|
||||
#elif L==8
|
||||
"Użytkownicy instytucji";
|
||||
#elif L==9
|
||||
"Utilizadores da institução";
|
||||
#endif
|
||||
|
||||
const char *Txt_usr = // Abbreviation of user (three characters + dot)
|
||||
|
|
81
swad_user.c
81
swad_user.c
|
@ -2719,7 +2719,7 @@ static void Usr_WriteRowGstMainData (unsigned NumUsr,struct UsrData *UsrDat)
|
|||
|
||||
/***** Write rest of main student's data *****/
|
||||
Ins.InsCod = UsrDat->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],true,
|
||||
UsrDat->Email[0] ? MailLink :
|
||||
NULL,
|
||||
|
@ -2821,7 +2821,7 @@ void Usr_WriteRowStdMainData (unsigned NumUsr,struct UsrData *UsrDat,bool PutChe
|
|||
|
||||
/***** Write rest of main student's data *****/
|
||||
Ins.InsCod = UsrDat->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor,ShowEmail,
|
||||
UsrDat->Email[0] ? MailLink :
|
||||
NULL,
|
||||
|
@ -2870,7 +2870,7 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
|
|||
|
||||
/***** Write rest of guest's main data *****/
|
||||
Ins.InsCod = UsrDat->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],true,
|
||||
NULL,Ins.ShortName,NULL);
|
||||
|
||||
|
@ -2974,7 +2974,7 @@ void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
|
|||
|
||||
/***** Write rest of main student's data *****/
|
||||
Ins.InsCod = UsrDat->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],ShowData,NULL,Ins.ShortName,NULL);
|
||||
|
||||
/***** Write the rest of the data of the student *****/
|
||||
|
@ -3133,7 +3133,7 @@ static void Usr_WriteRowTchMainData (unsigned NumUsr,struct UsrData *UsrDat,bool
|
|||
|
||||
/***** Write rest of main teacher's data *****/
|
||||
Ins.InsCod = UsrDat->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor,ShowEmail,
|
||||
UsrDat->Email[0] ? MailLink :
|
||||
NULL,
|
||||
|
@ -3185,7 +3185,7 @@ void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
|
|||
|
||||
/***** Write rest of main teacher's data *****/
|
||||
Ins.InsCod = UsrDat->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],ShowData,NULL,Ins.ShortName,NULL);
|
||||
|
||||
/***** Write the rest of teacher's data *****/
|
||||
|
@ -3266,7 +3266,7 @@ void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
|
|||
|
||||
/***** Write rest of main administrator's data *****/
|
||||
Ins.InsCod = UsrDat->InsCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],true,
|
||||
UsrDat->Email[0] ? MailLink :
|
||||
NULL,
|
||||
|
@ -3377,7 +3377,7 @@ unsigned Usr_GetNumUsrsInCrssOfDeg (Rol_Role_t Role,long DegCod)
|
|||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Get the number of users in a degree from database ******/
|
||||
/***** Get the number of users in courses of a degree from database ******/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM courses,crs_usr"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
|
@ -3395,7 +3395,7 @@ unsigned Usr_GetNumUsrsInCrssOfCtr (Rol_Role_t Role,long CtrCod)
|
|||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Get the number of users in a degree from database ******/
|
||||
/***** Get the number of users in courses of a centre from database ******/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM degrees,courses,crs_usr"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
|
@ -3409,20 +3409,30 @@ unsigned Usr_GetNumUsrsInCrssOfCtr (Rol_Role_t Role,long CtrCod)
|
|||
/*****************************************************************************/
|
||||
/********* Count how many users with a role belong to an institution *********/
|
||||
/*****************************************************************************/
|
||||
// Here Rol_UNKNOWN means students or teachers
|
||||
|
||||
unsigned Usr_GetNumUsrsInCrssOfIns (Rol_Role_t Role,long InsCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Get the number of users in a degree from database ******/
|
||||
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'",
|
||||
InsCod,(unsigned) Role);
|
||||
/***** Get the number of users in a courses of an institution from database ******/
|
||||
if (Role == Rol_UNKNOWN) // Any user
|
||||
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",
|
||||
InsCod);
|
||||
else
|
||||
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'",
|
||||
InsCod,(unsigned) Role);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in courses of an institution");
|
||||
}
|
||||
|
||||
|
@ -3430,11 +3440,12 @@ unsigned Usr_GetNumUsrsInCrssOfIns (Rol_Role_t Role,long InsCod)
|
|||
/****** 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)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Get the number of users in a degree from database ******/
|
||||
/***** Get the number of users in courses of a country from database ******/
|
||||
if (Role == Rol_UNKNOWN) // Any user
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr"
|
||||
|
@ -3536,20 +3547,34 @@ unsigned Usr_GetNumTchsCurrentInsInDepartment (long DptCod)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get number of users in a institution ********************/
|
||||
/*********** Get number of users who claim to belong to a country ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Usr_GetNumberOfUsersInInstitution (long InsCod,Rol_Role_t Role)
|
||||
unsigned Usr_GetNumUsrsWhoClaimToBelongToCty (long CtyCod)
|
||||
{
|
||||
char Query[256];
|
||||
char Query[128];
|
||||
|
||||
/***** Get the number of users in a country from database *****/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
||||
" FROM usr_data"
|
||||
" WHERE usr_data.CtyCod='%ld'",
|
||||
CtyCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in a country");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******** Get number of users who claim to belong to an institution **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Usr_GetNumUsrsWhoClaimToBelongToIns (long InsCod)
|
||||
{
|
||||
char Query[128];
|
||||
|
||||
/***** Get the number of users in an institution from database *****/
|
||||
// The following query is very slow, so call this function as minimum as possible
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM usr_data,crs_usr"
|
||||
" WHERE usr_data.InsCod='%ld'"
|
||||
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'",
|
||||
InsCod,(unsigned) Role);
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
||||
" FROM usr_data"
|
||||
" WHERE usr_data.InsCod='%ld'",
|
||||
InsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in an institution");
|
||||
}
|
||||
|
||||
|
|
|
@ -283,7 +283,8 @@ long Usr_GetRamdomStdFromCrs (long CrsCod);
|
|||
long Usr_GetRamdomStdFromGrp (long GrpCod);
|
||||
|
||||
unsigned Usr_GetNumTchsCurrentInsInDepartment (long DptCod);
|
||||
unsigned Usr_GetNumberOfUsersInInstitution (long InsCod,Rol_Role_t Role);
|
||||
unsigned Usr_GetNumUsrsWhoClaimToBelongToCty (long InsCod);
|
||||
unsigned Usr_GetNumUsrsWhoClaimToBelongToIns (long InsCod);
|
||||
unsigned Usr_GetNumberOfTeachersInCentre (long CtrCod);
|
||||
|
||||
void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t ListUsrsRange,const char *TchQuery,bool Search);
|
||||
|
|
|
@ -2624,7 +2624,7 @@ int swad__getNotifications (struct soap *soap,
|
|||
|
||||
/* Get institution (row[4]) */
|
||||
Ins.InsCod = Str_ConvertStrCodToLongCod (row[4]);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
/* Get centre (row[5]) */
|
||||
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[5]);
|
||||
|
|
Loading…
Reference in New Issue