Version 15.61

This commit is contained in:
Antonio Cañas Vargas 2015-12-09 19:51:17 +01:00
parent 34aad33da1
commit bad0711ad9
21 changed files with 549 additions and 257 deletions

View File

@ -11180,3 +11180,5 @@ INSERT INTO timetable_tut_backup SELECT * FROM timetable_tut;
UPDATE timetable_crs SET Hour=Hour+2; UPDATE timetable_crs SET Hour=Hour+2;
UPDATE timetable_tut 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;

View File

@ -696,7 +696,7 @@ void Ctr_EditCentres (void)
extern const char *Txt_You_must_create_at_least_one_institution_before_creating_centres; extern const char *Txt_You_must_create_at_least_one_institution_before_creating_centres;
/***** Get list of institutions of the current country *****/ /***** 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) if (Gbl.Inss.Num)
{ {
/***** Get list of places *****/ /***** Get list of places *****/
@ -1180,7 +1180,7 @@ static void Ctr_ListCentresForEdition (void)
/* Get data of institution of this centre */ /* Get data of institution of this centre */
Ins.InsCod = Ctr->InsCod; Ins.InsCod = Ctr->InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
ICanEdit = Ctr_CheckIfICanEdit (Ctr); ICanEdit = Ctr_CheckIfICanEdit (Ctr);

View File

@ -103,6 +103,10 @@
// TODO: Show nicknames of users in lists? // TODO: Show nicknames of users in lists?
// TODO: Form to register and remove system admins // 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: 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 one user, suggested by Francisco Ocaña Lara
// TODO: Reply to all // TODO: Reply to all
@ -110,13 +114,13 @@
/****************************** Public constants *****************************/ /****************************** 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" #define CSS_FILE "swad15.60.7.css"
// 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.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.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.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) Version 15.60.4: Dec 08, 2015 Change in text about first / last year of a degree. (186589 lines)

View File

@ -28,8 +28,8 @@
/** Uncomment one of the following installations of SWAD or create your own **/ /** Uncomment one of the following installations of SWAD or create your own **/
/*****************************************************************************/ /*****************************************************************************/
//#define LOCALHOST_UBUNTU // 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 OPENSWAD_ORG // Comment this line if not applicable
//#define SWAD_UGR_ES // 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 //#define WWW_CEVUNA_UNA_PY // Comment this line if not applicable

View File

@ -88,7 +88,7 @@ void Cty_SeeCtyWithPendingInss (void)
extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES]; extern const char *Txt_STR_LANG_ID[1+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; extern const char *Txt_Institutions_ABBREVIATION;
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;
@ -129,7 +129,7 @@ void Cty_SeeCtyWithPendingInss (void)
"</th>" "</th>"
"</tr>", "</tr>",
Txt_Country, Txt_Country,
Txt_Institutions); Txt_Institutions_ABBREVIATION);
/***** List the countries *****/ /***** List the countries *****/
for (NumCty = 0; for (NumCty = 0;
@ -145,7 +145,7 @@ void Cty_SeeCtyWithPendingInss (void)
Gbl.ColorRows[Gbl.RowEvenOdd]; Gbl.ColorRows[Gbl.RowEvenOdd];
/* Get data of country */ /* Get data of country */
Cty_GetDataOfCountryByCod (&Cty); Cty_GetDataOfCountryByCod (&Cty,Cty_GET_BASIC_DATA);
/* Country map */ /* Country map */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -211,6 +211,7 @@ static void Cty_Configuration (bool PrintView)
extern const char *Txt_Centres; extern const char *Txt_Centres;
extern const char *Txt_Degrees; extern const char *Txt_Degrees;
extern const char *Txt_Courses; 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]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
char *MapAttribution = NULL; char *MapAttribution = NULL;
bool PutLink = !PrintView && Gbl.CurrentCty.Cty.WWW[Gbl.Prefs.Language][0]; bool PutLink = !PrintView && Gbl.CurrentCty.Cty.WWW[Gbl.Prefs.Language][0];
@ -345,6 +346,19 @@ static void Cty_Configuration (bool PrintView)
} }
else 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 *****/ /***** Number of institutions *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">" "<td class=\"%s RIGHT_MIDDLE\">"
@ -397,7 +411,7 @@ static void Cty_Configuration (bool PrintView)
Txt_Courses, Txt_Courses,
Crs_GetNumCrssInCty (Gbl.CurrentCty.Cty.CtyCod)); Crs_GetNumCrssInCty (Gbl.CurrentCty.Cty.CtyCod));
/***** Number of teachers *****/ /***** Number of teachers in courses of this country *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">" "<td class=\"%s RIGHT_MIDDLE\">"
"%s:" "%s:"
@ -410,7 +424,7 @@ static void Cty_Configuration (bool PrintView)
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,Gbl.CurrentCty.Cty.CtyCod)); Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,Gbl.CurrentCty.Cty.CtyCod));
/***** Number of students *****/ /***** Number of students in courses of this country *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">" "<td class=\"%s RIGHT_MIDDLE\">"
"%s:" "%s:"
@ -422,6 +436,20 @@ static void Cty_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,Gbl.CurrentCty.Cty.CtyCod)); 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 *****/ /***** End frame *****/
@ -457,9 +485,12 @@ 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_Users_in_courses; extern const char *Txt_Institutions_ABBREVIATION;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_Centres_ABBREVIATION;
extern const char *Txt_Institutions; 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_Other_countries;
extern const char *Txt_Country_unspecified; extern const char *Txt_Country_unspecified;
Cty_CtysOrderType_t Order; Cty_CtysOrderType_t Order;
@ -499,16 +530,29 @@ void Cty_ListCountries2 (void)
"%s" "%s"
"</th>" "</th>"
"<th class=\"RIGHT_MIDDLE\">" "<th class=\"RIGHT_MIDDLE\">"
"%s" "%s"
"</th>" "</th>"
"<th class=\"RIGHT_MIDDLE\">"
"%s"
"</th>"
"<th class=\"RIGHT_MIDDLE\">"
"%s"
"</th>"
"<th class=\"RIGHT_MIDDLE\">" "<th class=\"RIGHT_MIDDLE\">"
"%s" "%s"
"</th>" "</th>"
"<th class=\"RIGHT_MIDDLE\">"
"%s+<br />%s"
"</th>"
"</tr>", "</tr>",
Txt_Users_in_courses, Txt_Institutions_ABBREVIATION,
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_Centres_ABBREVIATION,
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_Degrees_ABBREVIATION,
Txt_Institutions); 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 *****/ /***** Write all the countries and their number of users and institutions *****/
for (NumCty = 0; for (NumCty = 0;
@ -542,12 +586,24 @@ 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>"
"<td class=\"DAT RIGHT_MIDDLE %s\">"
"%u"
"</td>"
"<td class=\"DAT RIGHT_MIDDLE %s\">"
"%u"
"</td>"
"</tr>", "</tr>",
BgColor,Gbl.Ctys.Lst[NumCty].NumUsrs, BgColor,Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty,
BgColor,Usr_GetNumUsrsInCrssOfCty (Rol_UNKNOWN,Gbl.Ctys.Lst[NumCty].CtyCod), BgColor,Gbl.Ctys.Lst[NumCty].NumInss,
BgColor,Usr_GetNumUsrsInCrssOfCty (Rol_STUDENT,Gbl.Ctys.Lst[NumCty].CtyCod), BgColor,Gbl.Ctys.Lst[NumCty].NumCtrs,
BgColor,Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,Gbl.Ctys.Lst[NumCty].CtyCod), BgColor,Gbl.Ctys.Lst[NumCty].NumDegs,
BgColor,Gbl.Ctys.Lst[NumCty].NumInss); 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; Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
} }
@ -578,13 +634,25 @@ 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>"
"<td class=\"DAT RIGHT_MIDDLE\">"
"%u"
"</td>"
"<td class=\"DAT RIGHT_MIDDLE\">"
"%u"
"</td>"
"</tr>", "</tr>",
Txt_Other_countries, Txt_Other_countries,
Cty_GetNumUsrsWhoClaimToBelongToCty (0), 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_STUDENT,0),
Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,0), Usr_GetNumUsrsInCrssOfCty (Rol_TEACHER,0));
Ins_GetNumInssInCty (0));
/***** Write users and institutions with unknown country *****/ /***** Write users and institutions with unknown country *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -595,21 +663,33 @@ void Cty_ListCountries2 (void)
"%u" "%u"
"</td>" "</td>"
"<td class=\"DAT RIGHT_MIDDLE\">" "<td class=\"DAT RIGHT_MIDDLE\">"
"0" "%u"
"</td>"
"<td class=\"DAT RIGHT_MIDDLE\">"
"0"
"</td>"
"<td class=\"DAT RIGHT_MIDDLE\">"
"0"
"</td>" "</td>"
"<td class=\"DAT RIGHT_MIDDLE\">" "<td class=\"DAT RIGHT_MIDDLE\">"
"%u" "%u"
"</td>" "</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>", "</tr>",
Txt_Country_unspecified, Txt_Country_unspecified,
Cty_GetNumUsrsWhoClaimToBelongToCty (-1L), Cty_GetNumUsrsWhoClaimToBelongToCty (-1L),
Ins_GetNumInssInCty (-1L)); Ins_GetNumInssInCty (-1L),
Ctr_GetNumCtrsInCty (-1L),
Deg_GetNumDegsInCty (-1L),
Crs_GetNumCrssInCty (-1L));
/***** Table end *****/ /***** Table end *****/
Lay_EndRoundFrameTable (); Lay_EndRoundFrameTable ();
@ -745,14 +825,14 @@ void Cty_WriteScriptGoogleGeochart (void)
for (NumCty = 0; for (NumCty = 0;
NumCty < Gbl.Ctys.Num; NumCty < Gbl.Ctys.Num;
NumCty++) NumCty++)
if (Gbl.Ctys.Lst[NumCty].NumUsrs) if (Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty)
{ {
/* Write data of this country */ /* Write data of this country */
fprintf (Gbl.F.Out," ['%s', %u, %u],\n", fprintf (Gbl.F.Out," ['%s', %u, %u],\n",
Gbl.Ctys.Lst[NumCty].Alpha2, Gbl.Ctys.Lst[NumCty].Alpha2,
Gbl.Ctys.Lst[NumCty].NumUsrs, Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty,
Gbl.Ctys.Lst[NumCty].NumInss); Gbl.Ctys.Lst[NumCty].NumInss);
NumUsrsWithCountry += Gbl.Ctys.Lst[NumCty].NumUsrs; NumUsrsWithCountry += Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty;
NumCtysWithUsrs++; NumCtysWithUsrs++;
} }
@ -843,7 +923,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
/***** Get countries from database *****/ /***** Get countries from database *****/
switch (GetExtraData) switch (GetExtraData)
{ {
case Cty_GET_ONLY_COUNTRIES: case Cty_GET_BASIC_DATA:
sprintf (Query,"SELECT CtyCod,Alpha2,Name_%s" sprintf (Query,"SELECT CtyCod,Alpha2,Name_%s"
" FROM countries ORDER BY Name_%s", " FROM countries ORDER BY Name_%s",
Txt_STR_LANG_ID[Gbl.Prefs.Language], Txt_STR_LANG_ID[Gbl.Prefs.Language],
@ -891,7 +971,8 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
" UNION " " UNION "
"(SELECT CtyCod,Alpha2,%s%s0 AS NumUsrs" "(SELECT CtyCod,Alpha2,%s%s0 AS NumUsrs"
" FROM countries" " 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", " ORDER BY %s",
SubQueryNam1,SubQueryWWW1, SubQueryNam1,SubQueryWWW1,
SubQueryNam2,SubQueryWWW2,OrderBySubQuery); SubQueryNam2,SubQueryWWW2,OrderBySubQuery);
@ -928,7 +1009,18 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
switch (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 */ /* Get the name of the country in current language */
strcpy (Cty->Name[Gbl.Prefs.Language],row[2]); strcpy (Cty->Name[Gbl.Prefs.Language],row[2]);
break; break;
@ -942,12 +1034,26 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
strcpy (Cty->WWW[Lan],row[1+Txt_NUM_LANGUAGES+Lan]); strcpy (Cty->WWW[Lan],row[1+Txt_NUM_LANGUAGES+Lan]);
} }
/* Get number of users in this country */ /* Get number of users who claim to belong to this country */
if (sscanf (row[1+Txt_NUM_LANGUAGES*2+1],"%u",&Cty->NumUsrs) != 1) if (sscanf (row[1+Txt_NUM_LANGUAGES*2+1],"%u",&Cty->NumUsrsWhoClaimToBelongToCty) != 1)
Cty->NumUsrs = 0; Cty->NumUsrsWhoClaimToBelongToCty = 0;
/* Get number of institutions in this country */ /* Get number of institutions in this country */
Cty->NumInss = Ins_GetNumInssInCty (Cty->CtyCod); 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; 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_Another_country;
extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES]; 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->Name[Lan][0] = '\0';
Cty->WWW[Lan][0] = '\0'; Cty->WWW[Lan][0] = '\0';
} }
Cty->NumUsrsWhoClaimToBelongToCty = 0;
Cty->NumUsrs = 0; Cty->NumUsrs = 0;
Cty->NumStds = 0;
Cty->NumTchs = 0;
Cty->NumInss = 0; Cty->NumInss = 0;
/***** Check if country code is correct *****/ /***** Check if country code is correct *****/
@ -1088,37 +1197,52 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty)
return false; return false;
} }
// Cty->CtyCod > 0 // Here 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);
sprintf (StrField,"countries.WWW_%s,",Txt_STR_LANG_ID[Lan]); /***** Get data of a country from database *****/
strcat (SubQueryWWW1,StrField); switch (GetExtraData)
sprintf (StrField,"WWW_%s,",Txt_STR_LANG_ID[Lan]); {
strcat (SubQueryWWW2,StrField); 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"); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a country");
/***** Count number of rows in result *****/ /***** Count number of rows in result *****/
@ -1133,18 +1257,36 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty)
strncpy (Cty->Alpha2,row[0],2); strncpy (Cty->Alpha2,row[0],2);
Cty->Alpha2[2] = '\0'; Cty->Alpha2[2] = '\0';
/* Get the name of the country in several languages */ switch (GetExtraData)
for (Lan = (Txt_Language_t) 1;
Lan <= Txt_NUM_LANGUAGES;
Lan++)
{ {
strcpy (Cty->Name[Lan],row[Lan]); case Cty_GET_BASIC_DATA:
strcpy (Cty->WWW[Lan],row[Txt_NUM_LANGUAGES+Lan]); /* 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 */ /* Get number of users who claim to belong to this country */
if (sscanf (row[Txt_NUM_LANGUAGES*2+1],"%u",&(Cty->NumInss)) != 1) if (sscanf (row[Txt_NUM_LANGUAGES*2+1],"%u",&Cty->NumUsrsWhoClaimToBelongToCty) != 1)
Cty->NumInss = 0; 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 else
CtyFound = false; CtyFound = false;
@ -1282,6 +1424,7 @@ static void Cty_ListCountriesForEdition (void)
"<td rowspan=\"%u\" class=\"BT\">", "<td rowspan=\"%u\" class=\"BT\">",
1 + Txt_NUM_LANGUAGES); 1 + Txt_NUM_LANGUAGES);
if (Cty->NumInss || if (Cty->NumInss ||
Cty->NumUsrsWhoClaimToBelongToCty ||
Cty->NumUsrs) // Country has institutions or users ==> deletion forbidden Cty->NumUsrs) // Country has institutions or users ==> deletion forbidden
Lay_PutIconRemovalNotAllowed (); Lay_PutIconRemovalNotAllowed ();
else else
@ -1313,7 +1456,7 @@ static void Cty_ListCountriesForEdition (void)
fprintf (Gbl.F.Out,"<td rowspan=\"%u\" class=\"DAT RIGHT_TOP\">" fprintf (Gbl.F.Out,"<td rowspan=\"%u\" class=\"DAT RIGHT_TOP\">"
"%u" "%u"
"</td>", "</td>",
1 + Txt_NUM_LANGUAGES,Cty->NumUsrs); 1 + Txt_NUM_LANGUAGES,Cty->NumUsrsWhoClaimToBelongToCty);
/* Number of institutions */ /* Number of institutions */
fprintf (Gbl.F.Out,"<td rowspan=\"%u\" class=\"DAT RIGHT_TOP\">" 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."); Lay_ShowErrorAndExit ("Code of country is missing.");
/***** Get data of the country from database *****/ /***** Get data of the country from database *****/
Cty_GetDataOfCountryByCod (&Cty); Cty_GetDataOfCountryByCod (&Cty,Cty_GET_EXTRA_DATA);
/***** Check if this country has users *****/ /***** 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); Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_remove_a_country_with_institutions_or_users);
else // Country has no users ==> remove it else // Country has no users ==> remove it
{ {
@ -1466,7 +1611,7 @@ void Cty_RenameCountry (void)
Par_GetParToText ("Name",NewCtyName,Cty_MAX_BYTES_COUNTRY_NAME); Par_GetParToText ("Name",NewCtyName,Cty_MAX_BYTES_COUNTRY_NAME);
/***** Get from the database the data of the country *****/ /***** 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 *****/ /***** Check if new name is empty *****/
if (!NewCtyName[0]) if (!NewCtyName[0])
@ -1585,7 +1730,7 @@ void Cty_ChangeCtyWWW (void)
Par_GetParToText ("WWW",NewWWW,Cty_MAX_BYTES_COUNTRY_NAME); Par_GetParToText ("WWW",NewWWW,Cty_MAX_BYTES_COUNTRY_NAME);
/***** Get from the database the data of the country *****/ /***** 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 *****/ /***** Update the table changing old WWW by new WWW *****/
sprintf (Query,"UPDATE countries SET WWW_%s='%s'" 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_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; extern const char *Txt_Institutions_ABBREVIATION;
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<th class=\"BM\"></th>" "<th class=\"BM\"></th>"
@ -1767,7 +1912,7 @@ static void Cty_PutHeadCountries (void)
Txt_Name, Txt_Name,
Txt_WWW, Txt_WWW,
Txt_Users, Txt_Users,
Txt_Institutions); Txt_Institutions_ABBREVIATION);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -47,10 +47,14 @@ struct Country
char Alpha2[2+1]; char Alpha2[2+1];
char Name[1+Txt_NUM_LANGUAGES][Cty_MAX_BYTES_COUNTRY_NAME+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]; char WWW [1+Txt_NUM_LANGUAGES][Cty_MAX_LENGTH_COUNTRY_WWW+1];
unsigned NumUsrs; unsigned NumUsrsWhoClaimToBelongToCty;
unsigned NumStds;
unsigned NumTchs;
unsigned NumInss; 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 typedef enum
@ -63,7 +67,7 @@ typedef enum
typedef enum typedef enum
{ {
Cty_GET_ONLY_COUNTRIES, Cty_GET_BASIC_DATA,
Cty_GET_EXTRA_DATA, Cty_GET_EXTRA_DATA,
} Cty_GetExtraData_t; } Cty_GetExtraData_t;
@ -92,7 +96,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData);
void Cty_FreeListCountries (void); void Cty_FreeListCountries (void);
void Cty_WriteSelectorOfCountry (void); void Cty_WriteSelectorOfCountry (void);
void Cty_WriteCountryName (long CtyCod,const char *Class); 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_GetCountryName (long CtyCod,char CtyName[Cty_MAX_BYTES_COUNTRY_NAME+1]);
void Cty_PutParamCtyCod (long CtyCod); void Cty_PutParamCtyCod (long CtyCod);
long Cty_GetParamOtherCtyCod (void); long Cty_GetParamOtherCtyCod (void);

View File

@ -577,7 +577,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Get data of this institution *****/ /***** Get data of this institution *****/
Cty.CtyCod = Str_ConvertStrCodToLongCod (row[0]); Cty.CtyCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Cty_GetDataOfCountryByCod (&Cty)) if (!Cty_GetDataOfCountryByCod (&Cty,Cty_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Country not found."); Lay_ShowErrorAndExit ("Country not found.");
/***** Write link to country *****/ /***** Write link to country *****/
@ -620,7 +620,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Get data of this institution *****/ /***** Get data of this institution *****/
Ins.InsCod = Str_ConvertStrCodToLongCod (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."); Lay_ShowErrorAndExit ("Institution not found.");
/***** Write link to institution *****/ /***** Write link to institution *****/

View File

@ -890,7 +890,7 @@ void Deg_InitCurrentCourse (void)
/***** If numerical institution code is available, get institution data *****/ /***** If numerical institution code is available, get institution data *****/
if (Gbl.CurrentIns.Ins.InsCod > 0) 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; Gbl.CurrentCty.Cty.CtyCod = Gbl.CurrentIns.Ins.CtyCod;
else else
{ {
@ -906,7 +906,7 @@ void Deg_InitCurrentCourse (void)
/***** If numerical country code is available, get country data *****/ /***** If numerical country code is available, get country data *****/
if (Gbl.CurrentCty.Cty.CtyCod > 0) 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.YearOK = false;
Gbl.CurrentCty.Cty.CtyCod = Gbl.CurrentCty.Cty.CtyCod =
@ -3901,7 +3901,7 @@ void Deg_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
if (Ins.InsCod > 0) if (Ins.InsCod > 0)
{ {
/* Get data of institution */ /* Get data of institution */
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
/* Write institution logo and name */ /* Write institution logo and name */
Ins_DrawInstitutionLogoAndNameWithLink (&Ins,ActSeeInsInf, Ins_DrawInstitutionLogoAndNameWithLink (&Ins,ActSeeInsInf,

View File

@ -230,7 +230,7 @@ void Dpt_EditDepartments (void)
Lay_ShowErrorAndExit ("No institution selected."); // This should not happen Lay_ShowErrorAndExit ("No institution selected."); // This should not happen
/***** Get list of institutions *****/ /***** 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) if (!Gbl.Inss.Num)
Lay_ShowErrorAndExit ("There is no list of institutions."); // This should not happen 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 */ /* Get data of institution of this department */
Ins.InsCod = Dpt->InsCod; Ins.InsCod = Dpt->InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
/* Put icon to remove department */ /* Put icon to remove department */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"

View File

@ -745,7 +745,7 @@ static void Exa_ShowExamAnnouncement (long ExaCod,Exa_TypeViewExamAnnouncement_t
/***** Get data of institution of this degree *****/ /***** Get data of institution of this degree *****/
Ins.InsCod = Gbl.CurrentIns.Ins.InsCod; Ins.InsCod = Gbl.CurrentIns.Ins.InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
switch (TypeViewExamAnnouncement) switch (TypeViewExamAnnouncement)
{ {
@ -1295,7 +1295,7 @@ static void Exa_GetNotifContentExamAnnouncement (char **ContentStr)
/***** Get data of institution *****/ /***** Get data of institution *****/
Ins.InsCod = Deg_GetInsCodOfDegreeByCod (Deg.DegCod); 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); Dat_ConvDateToDateStr (&Gbl.ExamAnnouncement.ExamDate,StrExamDate);

View File

@ -1870,7 +1870,7 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,bool IsLastIte
/***** Get data of this institution *****/ /***** Get data of this institution *****/
Gbl.Forum.Ins.InsCod = InsCod; 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."); Lay_ShowErrorAndExit ("Institution not found.");
/***** Link to the forum of users from this institution *****/ /***** Link to the forum of users from this institution *****/
@ -3579,7 +3579,7 @@ void For_GetParamsForum (void)
/***** Get parameter with code of institution *****/ /***** Get parameter with code of institution *****/
Par_GetParToText ("ForInsCod",LongStr,1+10); Par_GetParToText ("ForInsCod",LongStr,1+10);
Gbl.Forum.Ins.InsCod = Str_ConvertStrCodToLongCod (LongStr); 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 *****/ /***** Get parameter with code of institution *****/
Par_GetParToText ("ForCtrCod",LongStr,1+10); Par_GetParToText ("ForCtrCod",LongStr,1+10);

View File

@ -155,7 +155,7 @@ void Ins_SeeInsWithPendingCtrs (void)
Gbl.ColorRows[Gbl.RowEvenOdd]; Gbl.ColorRows[Gbl.RowEvenOdd];
/* Get data of institution */ /* Get data of institution */
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
/* Institution logo and name */ /* Institution logo and name */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -251,6 +251,7 @@ static void Ins_Configuration (bool PrintView)
extern const char *Txt_Degrees; extern const char *Txt_Degrees;
extern const char *Txt_Courses; extern const char *Txt_Courses;
extern const char *Txt_Departments; 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]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
bool PutLink = !PrintView && Gbl.CurrentIns.Ins.WWW[0]; bool PutLink = !PrintView && Gbl.CurrentIns.Ins.WWW[0];
@ -379,6 +380,19 @@ static void Ins_Configuration (bool PrintView)
} }
else 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 *****/ /***** Number of centres *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">" "<td class=\"%s RIGHT_MIDDLE\">"
@ -431,7 +445,7 @@ static void Ins_Configuration (bool PrintView)
Txt_Departments, Txt_Departments,
Dpt_GetNumDepartmentsInInstitution (Gbl.CurrentIns.Ins.InsCod)); Dpt_GetNumDepartmentsInInstitution (Gbl.CurrentIns.Ins.InsCod));
/***** Number of teachers *****/ /***** Number of teachers in courses of this institution *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">" "<td class=\"%s RIGHT_MIDDLE\">"
"%s:" "%s:"
@ -444,7 +458,7 @@ static void Ins_Configuration (bool PrintView)
Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_TEACHER,Gbl.CurrentIns.Ins.InsCod)); Usr_GetNumUsrsInCrssOfIns (Rol_TEACHER,Gbl.CurrentIns.Ins.InsCod));
/***** Number of students *****/ /***** Number of students in courses of this institution *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">" "<td class=\"%s RIGHT_MIDDLE\">"
"%s:" "%s:"
@ -456,6 +470,20 @@ static void Ins_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_STUDENT,Gbl.CurrentIns.Ins.InsCod)); 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 *****/ /***** End of the frame *****/
@ -581,31 +609,54 @@ static void Ins_ListOneInstitutionForSeeing (struct Institution *Ins,unsigned Nu
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
/***** Stats *****/ /***** Stats *****/
/* Number of users who claim to belong to this institution */
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">" fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u" "%u"
"</td>", "</td>",
TxtClassNormal,BgColor,Ins->NumUsrs); TxtClassNormal,BgColor,Ins->NumUsrsWhoClaimToBelongToIns);
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u" /* Number of centres in this institution */
"</td>",
TxtClassNormal,BgColor,Ins->NumStds);
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u"
"</td>",
TxtClassNormal,BgColor,Ins->NumTchs);
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">" fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u" "%u"
"</td>", "</td>",
TxtClassNormal,BgColor,Ins->NumCtrs); TxtClassNormal,BgColor,Ins->NumCtrs);
/* Number of degrees in this institution */
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">" fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u" "%u"
"</td>", "</td>",
TxtClassNormal,BgColor,Ins->NumDegs); 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\">" fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u" "%u"
"</td>", "</td>",
TxtClassNormal,BgColor,Ins->NumDpts); 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 *****/ /***** Institution status *****/
StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status); StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status);
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_MIDDLE %s\">" 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_HELP_ORDER[2];
extern const char *Txt_INSTITUTIONS_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_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_Degrees_ABBREVIATION;
extern const char *Txt_Courses_ABBREVIATION;
extern const char *Txt_Departments_ABBREVIATION; extern const char *Txt_Departments_ABBREVIATION;
extern const char *Txt_Status; extern const char *Txt_Status;
Ins_InssOrderType_t Order; Ins_InssOrderType_t Order;
@ -639,7 +691,9 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
Order <= Ins_ORDER_BY_NUM_USRS; Order <= Ins_ORDER_BY_NUM_USRS;
Order++) 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) if (OrderSelectable)
{ {
Act_FormStart (ActSeeIns); Act_FormStart (ActSeeIns);
@ -659,7 +713,7 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
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" "%s"
"</th>" "</th>"
"<th class=\"RIGHT_MIDDLE\">" "<th class=\"RIGHT_MIDDLE\">"
"%s" "%s"
@ -673,15 +727,24 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
"<th class=\"RIGHT_MIDDLE\">" "<th class=\"RIGHT_MIDDLE\">"
"%s" "%s"
"</th>" "</th>"
"<th class=\"RIGHT_MIDDLE\">"
"%s"
"</th>"
"<th class=\"RIGHT_MIDDLE\">"
"%s+<br />%s"
"</th>"
"<th class=\"LEFT_MIDDLE\">" "<th class=\"LEFT_MIDDLE\">"
"%s" "%s"
"</th>" "</th>"
"</tr>", "</tr>",
Txt_Centres_ABBREVIATION,
Txt_Degrees_ABBREVIATION,
Txt_Courses_ABBREVIATION,
Txt_Departments_ABBREVIATION,
Txt_Teachers_ABBREVIATION,
Txt_Students_ABBREVIATION, Txt_Students_ABBREVIATION,
Txt_Teachers_ABBREVIATION, Txt_Teachers_ABBREVIATION,
Txt_Centres, Txt_Students_ABBREVIATION,
Txt_Degrees_ABBREVIATION,
Txt_Departments_ABBREVIATION,
Txt_Status); Txt_Status);
} }
@ -743,7 +806,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
/***** Get institutions from database *****/ /***** Get institutions from database *****/
switch (GetExtraData) switch (GetExtraData)
{ {
case Ins_GET_MINIMAL_DATA: case Ins_GET_BASIC_DATA:
if (CtyCod <= 0) // Get all the institutions, belonging to any country if (CtyCod <= 0) // Get all the institutions, belonging to any country
sprintf (Query,"SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW" sprintf (Query,"SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW"
" FROM institutions" " FROM institutions"
@ -776,7 +839,8 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
" UNION " " UNION "
"(SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW,0 AS NumUsrs" "(SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW,0 AS NumUsrs"
" FROM institutions" " 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", " ORDER BY %s",
OrderBySubQuery); OrderBySubQuery);
else // Get only the institutions belonging to the country specified by CtyCod 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.ShortName,institutions.FullName,"
"institutions.WWW,COUNT(*) AS NumUsrs" "institutions.WWW,COUNT(*) AS NumUsrs"
" FROM institutions,usr_data" " 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)" " GROUP BY institutions.InsCod)"
" UNION " " UNION "
"(SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW,0 AS NumUsrs" "(SELECT InsCod,CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW,0 AS NumUsrs"
" FROM institutions" " 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", " ORDER BY %s",
CtyCod,CtyCod, CtyCod,CtyCod,
OrderBySubQuery); OrderBySubQuery);
@ -844,32 +911,32 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
/* Get extra data */ /* Get extra data */
switch (GetExtraData) switch (GetExtraData)
{ {
case Ins_GET_MINIMAL_DATA: case Ins_GET_BASIC_DATA:
Ins->NumStds = Ins->NumTchs = Ins->NumUsrs = Ins->NumUsrsWhoClaimToBelongToIns = 0;
Ins->NumCtrs = Ins->NumDpts = Ins->NumDegs = 0; Ins->NumCtrs = Ins->NumDegs = Ins->NumCrss = Ins->NumDpts = 0;
Ins->NumUsrs = Ins->NumTchs = Ins->NumStds = 0;
break; break;
case Ins_GET_EXTRA_DATA: case Ins_GET_EXTRA_DATA:
/* Get number of users in this institution (row[7]) */ /* Get number of users who claim to belong to this institution (row[7]) */
if (sscanf (row[7],"%u",&Ins->NumUsrs) == 1) if (sscanf (row[7],"%u",&Ins->NumUsrsWhoClaimToBelongToIns) != 1)
{ Ins->NumUsrsWhoClaimToBelongToIns = 0;
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 centres in this institution */ /* Get number of centres in this institution */
Ins->NumCtrs = Ctr_GetNumCtrsInIns (Ins->InsCod); 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 */ /* Get number of departments in this institution */
Ins->NumDpts = Dpt_GetNumberOfDepartmentsInInstitution (Ins->InsCod); Ins->NumDpts = Dpt_GetNumberOfDepartmentsInInstitution (Ins->InsCod);
/* Get number of degrees in this institution */ /* Get number of users in courses */
Ins->NumDegs = Deg_GetNumDegsInIns (Ins->InsCod); 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; break;
} }
} }
@ -944,10 +1011,10 @@ bool Ins_GetDataOfInstitutionByCod (struct Institution *Ins,
/* Get extra data */ /* Get extra data */
if (GetExtraData == Ins_GET_EXTRA_DATA) if (GetExtraData == Ins_GET_EXTRA_DATA)
{ {
/* Get number of users in this institution */ /* Get number of users in courses of this institution */
Ins->NumStds = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_STUDENT); // Slow query Ins->NumUsrs = Usr_GetNumUsrsInCrssOfIns (Rol_UNKNOWN,Ins->InsCod); // Here Rol_UNKNOWN means "all users", NumUsrs <= NumStds + NumTchs
Ins->NumTchs = Usr_GetNumberOfUsersInInstitution (Ins->InsCod,Rol_TEACHER); // Slow query Ins->NumStds = Usr_GetNumUsrsInCrssOfIns (Rol_STUDENT,Ins->InsCod);
Ins->NumUsrs = Ins->NumStds + Ins->NumTchs; Ins->NumTchs = Usr_GetNumUsrsInCrssOfIns (Rol_TEACHER,Ins->InsCod);
/* Get number of centres in this institution */ /* Get number of centres in this institution */
Ins->NumCtrs = Ctr_GetNumCtrsInIns (Ins->InsCod); Ins->NumCtrs = Ctr_GetNumCtrsInIns (Ins->InsCod);
@ -1119,7 +1186,7 @@ static void Ins_ListInstitutionsForEdition (void)
/***** Get list of countries *****/ /***** Get list of countries *****/
Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY; Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY;
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES); Cty_GetListCountries (Cty_GET_BASIC_DATA);
/***** Write heading *****/ /***** Write heading *****/
sprintf (Gbl.Title,Txt_Institutions_of_COUNTRY_X, sprintf (Gbl.Title,Txt_Institutions_of_COUNTRY_X,
@ -1418,7 +1485,7 @@ void Ins_RemoveInstitution (void)
Lay_ShowErrorAndExit ("Code of institution is missing."); Lay_ShowErrorAndExit ("Code of institution is missing.");
/***** Get data of the institution from database *****/ /***** 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 *****/ /***** Check if this institution has users *****/
if (Ctr_GetNumCtrsInIns (Ins.InsCod) || if (Ctr_GetNumCtrsInIns (Ins.InsCod) ||
@ -1513,7 +1580,7 @@ static void Ins_RenameInstitution (Cns_ShortOrFullName_t ShortOrFullName)
Par_GetParToText (ParamName,NewInsName,MaxLength); Par_GetParToText (ParamName,NewInsName,MaxLength);
/***** Get from the database the old names of the institution *****/ /***** 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 *****/ /***** Check if new name is empty *****/
if (!NewInsName[0]) if (!NewInsName[0])
@ -1582,7 +1649,7 @@ static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Nam
void Ins_ChangeInsCountry (void) void Ins_ChangeInsCountry (void)
{ {
extern const char *Txt_The_institution_X_already_exists; 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 Institution *Ins;
struct Country NewCty; struct Country NewCty;
char Query[256]; char Query[256];
@ -1599,10 +1666,10 @@ void Ins_ChangeInsCountry (void)
Lay_ShowErrorAndExit ("Code of country is missing."); Lay_ShowErrorAndExit ("Code of country is missing.");
/***** Get data of the institution from database *****/ /***** 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 *****/ /***** Get data of the country from database *****/
Cty_GetDataOfCountryByCod (&NewCty); Cty_GetDataOfCountryByCod (&NewCty,Cty_GET_BASIC_DATA);
/***** Check if country has changed *****/ /***** Check if country has changed *****/
if (NewCty.CtyCod != Ins->CtyCod) if (NewCty.CtyCod != Ins->CtyCod)
@ -1629,8 +1696,8 @@ void Ins_ChangeInsCountry (void)
DB_QueryUPDATE (Query,"can not update the country of an institution"); DB_QueryUPDATE (Query,"can not update the country of an institution");
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
sprintf (Gbl.Message,Txt_The_country_of_the_institution_X_has_changed_Y, sprintf (Gbl.Message,Txt_The_country_of_the_institution_X_has_changed_to_Y,
Ins->FullName,NewCty.Name); Ins->FullName,NewCty.Name[Gbl.Prefs.Language]);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
Ins->CtyCod = NewCty.CtyCod; Ins->CtyCod = NewCty.CtyCod;
@ -1712,7 +1779,7 @@ void Ins_ChangeInsStatus (void)
Status = Ins_GetStatusBitsFromStatusTxt (StatusTxt); // New status Status = Ins_GetStatusBitsFromStatusTxt (StatusTxt); // New status
/***** Get data of institution *****/ /***** Get data of institution *****/
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA);
/***** Update status in table of institutions *****/ /***** Update status in table of institutions *****/
sprintf (Query,"UPDATE institutions SET Status='%u' WHERE InsCod='%ld'", sprintf (Query,"UPDATE institutions SET Status='%u' WHERE InsCod='%ld'",
@ -1772,7 +1839,7 @@ static void Ins_PutFormToCreateInstitution (void)
/***** Get list of countries *****/ /***** Get list of countries *****/
Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY; Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY;
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES); Cty_GetListCountries (Cty_GET_BASIC_DATA);
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)

View File

@ -64,12 +64,14 @@ struct Institution
char ShortName[Ins_MAX_LENGTH_INSTITUTION_SHORT_NAME+1]; char ShortName[Ins_MAX_LENGTH_INSTITUTION_SHORT_NAME+1];
char FullName[Ins_MAX_LENGTH_INSTITUTION_FULL_NAME+1]; char FullName[Ins_MAX_LENGTH_INSTITUTION_FULL_NAME+1];
char WWW[Cns_MAX_LENGTH_WWW+1]; char WWW[Cns_MAX_LENGTH_WWW+1];
unsigned NumStds; unsigned NumUsrsWhoClaimToBelongToIns;
unsigned NumTchs;
unsigned NumUsrs;
unsigned NumCtrs; unsigned NumCtrs;
unsigned NumDpts;
unsigned NumDegs; unsigned NumDegs;
unsigned NumCrss;
unsigned NumDpts;
unsigned NumUsrs;
unsigned NumTchs;
unsigned NumStds;
}; };
typedef enum typedef enum
@ -82,7 +84,7 @@ typedef enum
typedef enum typedef enum
{ {
Ins_GET_MINIMAL_DATA, Ins_GET_BASIC_DATA,
Ins_GET_EXTRA_DATA, Ins_GET_EXTRA_DATA,
} Ins_GetExtraData_t; } Ins_GetExtraData_t;

View File

@ -1456,7 +1456,7 @@ void Lay_WriteHeaderClassPhoto (unsigned NumColumns,bool PrintView,bool DrawingC
/***** Get data of institution *****/ /***** Get data of institution *****/
Ins.InsCod = InsCod; Ins.InsCod = InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
/***** Get data of degree *****/ /***** Get data of degree *****/
Deg.DegCod = DegCod; Deg.DegCod = DegCod;

View File

@ -361,7 +361,7 @@ void Ntf_ShowMyNotifications (void)
/* Get institution code (row[2]) */ /* Get institution code (row[2]) */
Ins.InsCod = Str_ConvertStrCodToLongCod (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]) */ /* Get centre code (row[3]) */
Ctr.CtrCod = Str_ConvertStrCodToLongCod (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]) */ /* Get institution code (row[2]) */
Ins.InsCod = Str_ConvertStrCodToLongCod (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]) */ /* Get centre code (row[3]) */
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[3]); Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[3]);

View File

@ -2127,7 +2127,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
if (UsrDat->InsCod > 0) if (UsrDat->InsCod > 0)
{ {
Ins.InsCod = UsrDat->InsCod; Ins.InsCod = UsrDat->InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
/* Form to go to the institution */ /* Form to go to the institution */
if (PutFormLinks) if (PutFormLinks)
@ -2792,7 +2792,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
if (!Gbl.Ctys.Num) if (!Gbl.Ctys.Num)
{ {
Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY; Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY;
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES); Cty_GetListCountries (Cty_GET_BASIC_DATA);
} }
fprintf (Gbl.F.Out,"<tr>" 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_Please_fill_in_your_centre_and_department;
extern const char *Txt_Institution_centre_and_department; extern const char *Txt_Institution_centre_and_department;
extern const char *Txt_Institution; 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_Another_institution;
extern const char *Txt_Centre; extern const char *Txt_Centre;
extern const char *Txt_Another_centre; extern const char *Txt_Another_centre;
@ -3401,14 +3401,14 @@ void Rec_ShowFormMyInsCtrDpt (void)
"%s:" "%s:"
"</td>" "</td>"
"<td class=\"LEFT_MIDDLE\" style=\"width:%upx;\">", "<td class=\"LEFT_MIDDLE\" style=\"width:%upx;\">",
ClassForm,Txt_Country_of_institution, ClassForm,Txt_Country_of_the_institution,
COL2_WIDTH); COL2_WIDTH);
/* If list of countries is empty, try to get it */ /* If list of countries is empty, try to get it */
if (!Gbl.Ctys.Num) if (!Gbl.Ctys.Num)
{ {
Gbl.Ctys.SelectedOrderType = Cty_ORDER_BY_COUNTRY; 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 */ /* Start form to select the country of my institution */
@ -3448,7 +3448,7 @@ void Rec_ShowFormMyInsCtrDpt (void)
/* Get list of institutions in this country */ /* Get list of institutions in this country */
Ins_FreeListInstitutions (); Ins_FreeListInstitutions ();
if (Gbl.Usrs.Me.UsrDat.InsCtyCod > 0) 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 */ /* Start form to select institution */
Act_FormGoToStart (ActChgMyIns); Act_FormGoToStart (ActChgMyIns);
@ -3653,7 +3653,7 @@ void Rec_UpdateMyInstitution (void)
/* Get country of institution */ /* Get country of institution */
if (Ins.InsCod > 0) 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) if (Gbl.Usrs.Me.UsrDat.InsCtyCod != Ins.CtyCod)
Gbl.Usrs.Me.UsrDat.InsCtyCod = Ins.CtyCod; Gbl.Usrs.Me.UsrDat.InsCtyCod = Ins.CtyCod;
} }

View File

@ -3293,11 +3293,11 @@ static void Sta_WriteCountry (long CtyCod)
{ {
/***** Get data of country *****/ /***** Get data of country *****/
Cty.CtyCod = CtyCod; Cty.CtyCod = CtyCod;
Cty_GetDataOfCountryByCod (&Cty); Cty_GetDataOfCountryByCod (&Cty,Cty_GET_BASIC_DATA);
/***** Form to go to country *****/ /***** Form to go to country *****/
Cty_DrawCountryMapAndNameWithLink (&Cty,ActSeeCtyInf, Cty_DrawCountryMapAndNameWithLink (&Cty,ActSeeCtyInf,
"LOG","COUNTRY_MAP_TINY"); "LOG","COUNTRY_MAP_TINY");
} }
else // Hit with no country selected else // Hit with no country selected
/***** No country selected *****/ /***** No country selected *****/
@ -3384,7 +3384,7 @@ static void Sta_WriteInstitution (long InsCod)
{ {
/***** Get data of institution *****/ /***** Get data of institution *****/
Ins.InsCod = InsCod; Ins.InsCod = InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
/***** Title in cell *****/ /***** Title in cell *****/
fprintf (Gbl.F.Out,"title=\"%s\">", 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]) *****/ /***** Get data of this institution (row[0]) *****/
Ins->InsCod = Str_ConvertStrCodToLongCod (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."); Lay_ShowErrorAndExit ("Institution not found.");
/***** Get statistic (row[1]) *****/ /***** Get statistic (row[1]) *****/

View File

@ -1613,7 +1613,7 @@ const char *Txt_accessible_for_reading_and_writing_by_administrators_of_the_inst
#elif L==4 #elif L==4
"accesible para lectura y escritura por administradores de la instituci&oacute;n"; "accesible para lectura y escritura por administradores de la instituci&oacute;n";
#elif L==5 #elif L==5
"accessible en lecture et en &eacute;criture par les administrateurs de l'&eacute;tablissement"; "accessible en lecture et en &eacute;criture par les administrateurs du &eacute;tablissement";
#elif L==6 #elif L==6
"accesible para lectura y escritura por administradores de la instituci&oacute;n"; // Okoteve traducción "accesible para lectura y escritura por administradores de la instituci&oacute;n"; // Okoteve traducción
#elif L==7 #elif L==7
@ -1697,7 +1697,7 @@ const char *Txt_accessible_for_reading_and_writing_by_students_and_teachers_of_t
#elif L==4 #elif L==4
"accesible para lectura y escritura por estudiantes y profesores de la instituci&oacute;n"; "accesible para lectura y escritura por estudiantes y profesores de la instituci&oacute;n";
#elif L==5 #elif L==5
"accessible en lecture et en &eacute;criture par les &eacute;tudiants et les enseignants de l'&eacute;tablissement"; "accessible en lecture et en &eacute;criture par les &eacute;tudiants et les enseignants du &eacute;tablissement";
#elif L==6 #elif L==6
"accesible para lectura y escritura por estudiantes y profesores de la instituci&oacute;n"; // Okoteve traducción "accesible para lectura y escritura por estudiantes y profesores de la instituci&oacute;n"; // Okoteve traducción
#elif L==7 #elif L==7
@ -1865,7 +1865,7 @@ const char *Txt_accessible_only_for_reading_by_students_and_teachers_of_the_inst
#elif L==4 #elif L==4
"accesible solo para lectura por estudiantes y profesores de la instituci&oacute;n"; "accesible solo para lectura por estudiantes y profesores de la instituci&oacute;n";
#elif L==5 #elif L==5
"accessible uniquement pour la lecture par les &eacute;tudiants et les enseignants de l'&eacute;tablissement"; "accessible uniquement pour la lecture par les &eacute;tudiants et les enseignants du &eacute;tablissement";
#elif L==6 #elif L==6
"accesible solo para lectura por estudiantes y profesores de la instituci&oacute;n"; // Okoteve traducción "accesible solo para lectura por estudiantes y profesores de la instituci&oacute;n"; // Okoteve traducción
#elif L==7 #elif L==7
@ -3972,23 +3972,23 @@ const char *Txt_Centres =
const char *Txt_Centres_ABBREVIATION = const char *Txt_Centres_ABBREVIATION =
#if L==1 #if L==1
"Centres"; "Cent.";
#elif L==2 #elif L==2
"Lehrinst."; "Lehrin.";
#elif L==3 #elif L==3
"Centres"; "Cent.";
#elif L==4 #elif L==4
"Centros"; "Cent.";
#elif L==5 #elif L==5
"Centres"; "Cent.";
#elif L==6 #elif L==6
"Mbo'ehao"; "Mbo'ehao";
#elif L==7 #elif L==7
"Centri"; "Cent.";
#elif L==8 #elif L==8
"Centra"; "Cent.";
#elif L==9 #elif L==9
"Centros"; "Cent.";
#endif #endif
const char *Txt_centres = const char *Txt_centres =
@ -5193,23 +5193,23 @@ const char *Txt_COUNTRIES_ORDER[2] =
#endif #endif
, ,
#if L==1 #if L==1
"Usuaris d'aquesta nacionalitat" "Usuaris del pa&iacute;s"
#elif L==2 #elif L==2
"Benutzer dieser Staatsangeh&ouml;rigkeit" "Benutzer des Landes"
#elif L==3 #elif L==3
"Users of that nationality" "Users of the country"
#elif L==4 #elif L==4
"Usuarios de esa nacionalidad" "Usuarios del pa&iacute;s"
#elif L==5 #elif L==5
"Utilisateurs de cette nationalité" "Utilisateurs du pays"
#elif L==6 #elif L==6
"Usuarios de esa nacionalidad" // Okoteve traducción "Usuarios del pa&iacute;s" // Okoteve traducción
#elif L==7 #elif L==7
"Utenti di questa nazionalit&agrave;" "Utenti del paese"
#elif L==8 #elif L==8
"U&zdot;ytkownicy tej narodowo&sacute;ci" "U&zdot;ytkownicy kraju"
#elif L==9 #elif L==9
"Utilizadores dessa nacionalidade" "Utilizadores do pa&iacute;s"
#endif #endif
}; };
@ -5234,25 +5234,25 @@ const char *Txt_Country =
"Pa&iacute;s"; "Pa&iacute;s";
#endif #endif
const char *Txt_Country_of_institution = const char *Txt_Country_of_the_institution =
#if L==1 #if L==1
"Pa&iacute;s de la instituci&oacute;"; "Pa&iacute;s de la instituci&oacute;";
#elif L==2 #elif L==2
"Land der Hochschule"; "Land der Hochschule";
#elif L==3 #elif L==3
"Country of institution"; "Country of the institution";
#elif L==4 #elif L==4
"Pa&iacute;s de la instituci&oacute;n"; "Pa&iacute;s de la instituci&oacute;n";
#elif L==5 #elif L==5
"Pays de l'&eacute;tablissement"; "Pays du &eacute;tablissement";
#elif L==6 #elif L==6
"Tet&atilde; mbo'ehao"; "Tet&atilde; mbo'ehao";
#elif L==7 #elif L==7
"Paese di istituzione"; "Paese della istituzione";
#elif L==8 #elif L==8
"Kraj instytucji"; "Kraj instytucji";
#elif L==9 #elif L==9
"Pa&iacute;s de institu&ccedil;&atilde;o"; "Pa&iacute;s da institu&ccedil;&atilde;o";
#endif #endif
const char *Txt_Country_unspecified = const char *Txt_Country_unspecified =
@ -14814,6 +14814,27 @@ const char *Txt_Institutions =
"Institu&ccedil;&otilde;es"; "Institu&ccedil;&otilde;es";
#endif #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
"&Eacute;tabl.";
#elif L==6
"Mbo'ehao";
#elif L==7
"Istit.";
#elif L==8
"Instyt.";
#elif L==9
"Instit.";
#endif
const char *Txt_institutions = const char *Txt_institutions =
#if L==1 #if L==1
"institucions"; "institucions";
@ -15027,23 +15048,23 @@ const char *Txt_INSTITUTIONS_ORDER[2] =
#endif #endif
, ,
#if L==1 #if L==1
"Usuaris" "Usuaris de la instituci&oacute;"
#elif L==2 #elif L==2
"Benutzer" "Benutzer der Hochschule"
#elif L==3 #elif L==3
"Users" "Users of the institution"
#elif L==4 #elif L==4
"Usuarios" "Usuarios de la instituci&oacute;n"
#elif L==5 #elif L==5
"Utilisateurs" "Utilisateurs du &eacute;tablissement"
#elif L==6 #elif L==6
"Puruh&aacute;ra" "Usuarios de la instituci&oacute;n" // Okoteve traducción
#elif L==7 #elif L==7
"Utenti" "Utenti della istituzione"
#elif L==8 #elif L==8
"U&zdot;ytkownicy" "U&zdot;ytkownicy instytucji"
#elif L==9 #elif L==9
"Utilizadores" "Utilizadores da institu&ccedil;&atilde;o"
#endif #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 "The country <strong>%s</strong> has been renamed as <strong>%s</strong>."; // Necessita de tradução
#endif #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 #if L==1
"El pa&iacute;s de la instituci&oacute;n <strong>%s</strong>" "El pa&iacute;s de la instituci&oacute;n <strong>%s</strong>"
" ha cambiado a <strong>%s</strong>."; // Necessita traduccio " 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 "%u users have been removed."; // Necessita de tradução
#endif #endif
const char *Txt_Users_in_courses = const char *Txt_Users_of_the_country =
#if L==1 #if L==1
"Usuaris en assignatures"; "Usuaris del pa&iacute;s";
#elif L==2 #elif L==2
"Benutzer in Kurse"; "Benutzer des Landes";
#elif L==3 #elif L==3
"Users in courses"; "Users of the country";
#elif L==4 #elif L==4
"Usuarios en asignaturas"; "Usuarios del pa&iacute;s";
#elif L==5 #elif L==5
"Utilisateurs dans mati&egrave;res"; "Utilisateurs du pays";
#elif L==6 #elif L==6
"Usuarios en asignaturas"; // Okoteve traducción "Usuarios del pa&iacute;s"; // Okoteve traducción
#elif L==7 #elif L==7
"Utenti in corsi"; "Utenti del paese";
#elif L==8 #elif L==8
"U&zdot;ytkownik&oacute;w w kurs&otilde;w"; "U&zdot;ytkownicy kraju";
#elif L==9 #elif L==9
"Usu&aacute;rios em disciplinas"; "Utilizadores do pa&iacute;s";
#endif
const char *Txt_Users_of_the_institution =
#if L==1
"Usuaris de la instituci&oacute;";
#elif L==2
"Benutzer der Hochschule";
#elif L==3
"Users of the institution";
#elif L==4
"Usuarios de la instituci&oacute;n";
#elif L==5
"Utilisateurs du &eacute;tablissement";
#elif L==6
"Usuarios de la instituci&oacute;n"; // Okoteve traducción
#elif L==7
"Utenti della istituzione";
#elif L==8
"U&zdot;ytkownicy instytucji";
#elif L==9
"Utilizadores da institu&ccedil;&atilde;o";
#endif #endif
const char *Txt_usr = // Abbreviation of user (three characters + dot) const char *Txt_usr = // Abbreviation of user (three characters + dot)

View File

@ -2719,7 +2719,7 @@ static void Usr_WriteRowGstMainData (unsigned NumUsr,struct UsrData *UsrDat)
/***** Write rest of main student's data *****/ /***** Write rest of main student's data *****/
Ins.InsCod = UsrDat->InsCod; 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, Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],true,
UsrDat->Email[0] ? MailLink : UsrDat->Email[0] ? MailLink :
NULL, NULL,
@ -2821,7 +2821,7 @@ void Usr_WriteRowStdMainData (unsigned NumUsr,struct UsrData *UsrDat,bool PutChe
/***** Write rest of main student's data *****/ /***** Write rest of main student's data *****/
Ins.InsCod = UsrDat->InsCod; Ins.InsCod = UsrDat->InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor,ShowEmail, Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor,ShowEmail,
UsrDat->Email[0] ? MailLink : UsrDat->Email[0] ? MailLink :
NULL, NULL,
@ -2870,7 +2870,7 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
/***** Write rest of guest's main data *****/ /***** Write rest of guest's main data *****/
Ins.InsCod = UsrDat->InsCod; 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, Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],true,
NULL,Ins.ShortName,NULL); NULL,Ins.ShortName,NULL);
@ -2974,7 +2974,7 @@ void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
/***** Write rest of main student's data *****/ /***** Write rest of main student's data *****/
Ins.InsCod = UsrDat->InsCod; 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); Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],ShowData,NULL,Ins.ShortName,NULL);
/***** Write the rest of the data of the student *****/ /***** 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 *****/ /***** Write rest of main teacher's data *****/
Ins.InsCod = UsrDat->InsCod; Ins.InsCod = UsrDat->InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA); Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor,ShowEmail, Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor,ShowEmail,
UsrDat->Email[0] ? MailLink : UsrDat->Email[0] ? MailLink :
NULL, NULL,
@ -3185,7 +3185,7 @@ void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
/***** Write rest of main teacher's data *****/ /***** Write rest of main teacher's data *****/
Ins.InsCod = UsrDat->InsCod; 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); Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],ShowData,NULL,Ins.ShortName,NULL);
/***** Write the rest of teacher's data *****/ /***** 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 *****/ /***** Write rest of main administrator's data *****/
Ins.InsCod = UsrDat->InsCod; 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, Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd],true,
UsrDat->Email[0] ? MailLink : UsrDat->Email[0] ? MailLink :
NULL, NULL,
@ -3377,7 +3377,7 @@ unsigned Usr_GetNumUsrsInCrssOfDeg (Rol_Role_t Role,long DegCod)
{ {
char Query[512]; 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)" sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM courses,crs_usr" " FROM courses,crs_usr"
" WHERE courses.DegCod='%ld'" " WHERE courses.DegCod='%ld'"
@ -3395,7 +3395,7 @@ unsigned Usr_GetNumUsrsInCrssOfCtr (Rol_Role_t Role,long CtrCod)
{ {
char Query[512]; 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)" 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'"
@ -3409,20 +3409,30 @@ unsigned Usr_GetNumUsrsInCrssOfCtr (Rol_Role_t Role,long CtrCod)
/*****************************************************************************/ /*****************************************************************************/
/********* Count how many users with a role belong to an institution *********/ /********* 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) unsigned Usr_GetNumUsrsInCrssOfIns (Rol_Role_t Role,long InsCod)
{ {
char Query[512]; char Query[512];
/***** Get the number of users in a degree from database ******/ /***** Get the number of users in a courses of an institution from database ******/
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)" if (Role == Rol_UNKNOWN) // Any user
" FROM centres,degrees,courses,crs_usr" sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" 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",
InsCod,(unsigned) Role); 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"); 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 ******/ /****** Count how many users with a role belong to courses of a country ******/
/*****************************************************************************/ /*****************************************************************************/
// Here Rol_UNKNOWN means students or teachers // 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 courses of a country from database ******/
if (Role == Rol_UNKNOWN) // Any user 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"
@ -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 *****/ /***** 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 UsrCod)"
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)" " FROM usr_data"
" FROM usr_data,crs_usr" " WHERE usr_data.InsCod='%ld'",
" WHERE usr_data.InsCod='%ld'" InsCod);
" AND usr_data.UsrCod=crs_usr.UsrCod AND crs_usr.Role='%u'",
InsCod,(unsigned) Role);
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in an institution"); return (unsigned) DB_QueryCOUNT (Query,"can not get the number of users in an institution");
} }

View File

@ -283,7 +283,8 @@ long Usr_GetRamdomStdFromCrs (long CrsCod);
long Usr_GetRamdomStdFromGrp (long GrpCod); long Usr_GetRamdomStdFromGrp (long GrpCod);
unsigned Usr_GetNumTchsCurrentInsInDepartment (long DptCod); 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); unsigned Usr_GetNumberOfTeachersInCentre (long CtrCod);
void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t ListUsrsRange,const char *TchQuery,bool Search); void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t ListUsrsRange,const char *TchQuery,bool Search);

View File

@ -2624,7 +2624,7 @@ int swad__getNotifications (struct soap *soap,
/* Get institution (row[4]) */ /* Get institution (row[4]) */
Ins.InsCod = Str_ConvertStrCodToLongCod (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]) */ /* Get centre (row[5]) */
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[5]); Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[5]);