mirror of https://github.com/acanas/swad-core.git
Version 20.45.1: Mar 06, 2021 Institutions database table renamed.
This commit is contained in:
parent
11be8771c1
commit
eda9c23757
26
swad_API.c
26
swad_API.c
|
@ -5989,9 +5989,9 @@ int swad__getLocation (struct soap *soap,
|
|||
/***** Get list of locations *****/
|
||||
NumLocs = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get matches",
|
||||
"SELECT institutions.InsCod," // row[ 0]
|
||||
"institutions.ShortName," // row[ 1]
|
||||
"institutions.FullName," // row[ 2]
|
||||
"SELECT ins_instits.InsCod," // row[ 0]
|
||||
"ins_instits.ShortName," // row[ 1]
|
||||
"ins_instits.FullName," // row[ 2]
|
||||
"ctr_centers.CtrCod," // row[ 3]
|
||||
"ctr_centers.ShortName," // row[ 4]
|
||||
"ctr_centers.FullName," // row[ 5]
|
||||
|
@ -6006,12 +6006,12 @@ int swad__getLocation (struct soap *soap,
|
|||
"rooms,"
|
||||
"buildings,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE room_MAC.MAC=%llu"
|
||||
" AND room_MAC.RooCod=rooms.RooCod"
|
||||
" AND rooms.BldCod=buildings.BldCod"
|
||||
" AND buildings.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" ORDER BY rooms.Capacity," // Get the biggest room
|
||||
"rooms.ShortName"
|
||||
" DESC LIMIT 1",
|
||||
|
@ -6130,9 +6130,9 @@ int swad__getLastLocation (struct soap *soap,
|
|||
/***** Get list of locations *****/
|
||||
NumLocs = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get matches",
|
||||
"SELECT institutions.InsCod," // row[ 0]
|
||||
"institutions.ShortName," // row[ 1]
|
||||
"institutions.FullName," // row[ 2]
|
||||
"SELECT ins_instits.InsCod," // row[ 0]
|
||||
"ins_instits.ShortName," // row[ 1]
|
||||
"ins_instits.FullName," // row[ 2]
|
||||
"ctr_centers.CtrCod," // row[ 3]
|
||||
"ctr_centers.ShortName," // row[ 4]
|
||||
"ctr_centers.FullName," // row[ 5]
|
||||
|
@ -6148,7 +6148,7 @@ int swad__getLastLocation (struct soap *soap,
|
|||
"rooms,"
|
||||
"buildings,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE room_check_in.UsrCod=%d"
|
||||
" AND room_check_in.ChkCod="
|
||||
"(SELECT ChkCod FROM room_check_in"
|
||||
|
@ -6157,7 +6157,7 @@ int swad__getLastLocation (struct soap *soap,
|
|||
" AND room_check_in.RooCod=rooms.RooCod"
|
||||
" AND rooms.BldCod=buildings.BldCod"
|
||||
" AND buildings.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod",
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod",
|
||||
userCode,userCode);
|
||||
API_GetDataOfLocation (soap,
|
||||
&(getLastLocationOut->location),
|
||||
|
@ -6193,9 +6193,9 @@ static void API_GetDataOfLocation (struct soap *soap,
|
|||
/* Get row */
|
||||
row = mysql_fetch_row (*mysql_res);
|
||||
/*
|
||||
institutions.InsCod // row[ 0]
|
||||
institutions.ShortName // row[ 1]
|
||||
institutions.FullName // row[ 2]
|
||||
ins_instits.InsCod // row[ 0]
|
||||
ins_instits.ShortName // row[ 1]
|
||||
ins_instits.FullName // row[ 2]
|
||||
ctr_centers.CtrCod // row[ 3]
|
||||
ctr_centers.ShortName // row[ 4]
|
||||
ctr_centers.FullName // row[ 5]
|
||||
|
|
|
@ -1865,14 +1865,14 @@ unsigned Agd_GetNumUsrsWithEvents (Hie_Lvl_Level_t Scope)
|
|||
case Hie_Lvl_CTY:
|
||||
DB_QuerySELECT (&mysql_res,"can not get number of users with events",
|
||||
"SELECT COUNT(DISTINCT agendas.UsrCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"agendas"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.Status=0"
|
||||
|
@ -1969,14 +1969,14 @@ unsigned Agd_GetNumEvents (Hie_Lvl_Level_t Scope)
|
|||
case Hie_Lvl_CTY:
|
||||
DB_QuerySELECT (&mysql_res,"can not get number of events",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"agendas"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
|
|
@ -1840,13 +1840,13 @@ unsigned Asg_GetNumCoursesWithAssignments (Hie_Lvl_Level_t Scope)
|
|||
case Hie_Lvl_CTY:
|
||||
DB_QuerySELECT (&mysql_res,"can not get number of courses with assignments",
|
||||
"SELECT COUNT(DISTINCT assignments.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"courses,"
|
||||
"assignments"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.Status=0"
|
||||
|
@ -1938,13 +1938,13 @@ unsigned Asg_GetNumAssignments (Hie_Lvl_Level_t Scope,unsigned *NumNotif)
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of assignments",
|
||||
"SELECT COUNT(*)," // row[0]
|
||||
"SUM(assignments.NumNotif)" // row[1]
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"assignments"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=assignments.CrsCod",
|
||||
|
|
|
@ -1953,10 +1953,10 @@ static unsigned Ctr_GetNumCtrsInCty (long CtyCod)
|
|||
Gbl.Cache.NumCtrsInCty.NumCtrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of centers in a country",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod",
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod",
|
||||
CtyCod);
|
||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTRS,Hie_Lvl_CTY,Gbl.Cache.NumCtrsInCty.CtyCod,
|
||||
FigCch_UNSIGNED,&Gbl.Cache.NumCtrsInCty.NumCtrs);
|
||||
|
@ -2062,10 +2062,10 @@ unsigned Ctr_GetCachedNumCtrsWithMapInCty (long CtyCod)
|
|||
NumCtrsWithMap = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of centers with map",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND (ctr_centers.Latitude<>0"
|
||||
" OR ctr_centers.Longitude<>0)",
|
||||
CtyCod);
|
||||
|
@ -2134,7 +2134,7 @@ unsigned Ctr_GetCachedNumCtrsWithDegs (const char *SubQuery,
|
|||
NumCtrsWithDegs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of centers with degrees",
|
||||
"SELECT COUNT(DISTINCT ctr_centers.CtrCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees"
|
||||
" WHERE %sinstitutions.InsCod=ctr_centers.InsCod"
|
||||
|
@ -2164,7 +2164,7 @@ unsigned Ctr_GetCachedNumCtrsWithCrss (const char *SubQuery,
|
|||
NumCtrsWithCrss = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of centers with courses",
|
||||
"SELECT COUNT(DISTINCT ctr_centers.CtrCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses"
|
||||
|
@ -2202,7 +2202,7 @@ unsigned Ctr_GetCachedNumCtrsWithUsrs (Rol_Role_t Role,const char *SubQuery,
|
|||
NumCtrsWithUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of centers with users",
|
||||
"SELECT COUNT(DISTINCT ctr_centers.CtrCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
|
|
|
@ -600,10 +600,16 @@ TODO: Salvador Romero Cort
|
|||
|
||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.45 (2021-03-07)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.45.1 (2021-03-07)"
|
||||
#define CSS_FILE "swad20.45.css"
|
||||
#define JS_FILE "swad20.6.2.js"
|
||||
/*
|
||||
Version 20.45.1: Mar 06, 2021 Institutions database table renamed. (307120 lines)
|
||||
1 change necessary in database:
|
||||
RENAME TABLE institutions TO ins_instits;
|
||||
|
||||
TODO: Rename CENTRE to CENTER in help wiki.
|
||||
|
||||
Version 20.45: Mar 06, 2021 Centers database table renamed.
|
||||
All variables and files related to centers renamed. (307106 lines)
|
||||
1 change necessary in database:
|
||||
|
|
|
@ -503,15 +503,15 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
"SELECT COUNT(DISTINCT connected.UsrCod)," // row[0]
|
||||
"COUNT(DISTINCT usr_data.Sex)," // row[1]
|
||||
"MIN(usr_data.Sex)" // row[2]
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"connected,"
|
||||
"usr_data"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -635,15 +635,15 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
|
|||
"SELECT COUNT(DISTINCT connected.UsrCod)," // row[0]
|
||||
"COUNT(DISTINCT usr_data.Sex)," // row[1]
|
||||
"MIN(usr_data.Sex)" // row[2]
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"connected,"
|
||||
"usr_data"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -995,14 +995,14 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
|||
"connected.LastCrsCod," // row[1]
|
||||
"UNIX_TIMESTAMP()-"
|
||||
"UNIX_TIMESTAMP(connected.LastTime) AS Dif" // row[2]
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"connected"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
|
|
@ -123,16 +123,19 @@ void Cty_SeeCtyWithPendingInss (void)
|
|||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_SYS_ADM:
|
||||
NumCtys = (unsigned) DB_QuerySELECT (&mysql_res,"can not get countries"
|
||||
"with pending institutions",
|
||||
"SELECT institutions.CtyCod,COUNT(*)"
|
||||
" FROM institutions,countries"
|
||||
" WHERE (institutions.Status & %u)<>0"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" GROUP BY institutions.CtyCod"
|
||||
" ORDER BY countries.Name_%s",
|
||||
(unsigned) Ins_STATUS_BIT_PENDING,
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
NumCtys = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get countries"
|
||||
" with pending institutions",
|
||||
"SELECT ins_instits.CtyCod,"
|
||||
"COUNT(*)"
|
||||
" FROM ins_instits,"
|
||||
"countries"
|
||||
" WHERE (ins_instits.Status & %u)<>0"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
" GROUP BY ins_instits.CtyCod"
|
||||
" ORDER BY countries.Name_%s",
|
||||
(unsigned) Ins_STATUS_BIT_PENDING,
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
break;
|
||||
default: // Forbidden for other users
|
||||
return;
|
||||
|
@ -1907,11 +1910,11 @@ unsigned Cty_GetCachedNumCtysWithInss (void)
|
|||
{
|
||||
/***** Get current number of countries with institutions from cache *****/
|
||||
NumCtysWithInss = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of countries"
|
||||
" with institutions",
|
||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
||||
" FROM countries,institutions"
|
||||
" WHERE countries.CtyCod=institutions.CtyCod");
|
||||
DB_QueryCOUNT ("can not get number of countries with institutions",
|
||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
||||
" FROM countries,"
|
||||
"ins_instits"
|
||||
" WHERE countries.CtyCod=ins_instits.CtyCod");
|
||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_INSS,Hie_Lvl_SYS,-1L,
|
||||
FigCch_UNSIGNED,&NumCtysWithInss);
|
||||
}
|
||||
|
@ -1936,10 +1939,10 @@ unsigned Cty_GetCachedNumCtysWithCtrs (void)
|
|||
DB_QueryCOUNT ("can not get number of countries with centers",
|
||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
||||
" FROM countries,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"ctr_centers"
|
||||
" WHERE countries.CtyCod=institutions.CtyCod"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod");
|
||||
" WHERE countries.CtyCod=ins_instits.CtyCod"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod");
|
||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_CTRS,Hie_Lvl_SYS,-1L,
|
||||
FigCch_UNSIGNED,&NumCtysWithCtrs);
|
||||
}
|
||||
|
@ -1962,11 +1965,11 @@ unsigned Cty_GetCachedNumCtysWithDegs (void)
|
|||
DB_QueryCOUNT ("can not get number of countries with degrees",
|
||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
||||
" FROM countries,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees"
|
||||
" WHERE countries.CtyCod=institutions.CtyCod"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE countries.CtyCod=ins_instits.CtyCod"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod");
|
||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_DEGS,Hie_Lvl_SYS,-1L,
|
||||
FigCch_UNSIGNED,&NumCtysWithDegs);
|
||||
|
@ -1992,12 +1995,12 @@ unsigned Cty_GetCachedNumCtysWithCrss (void)
|
|||
DB_QueryCOUNT ("can not get number of countries with courses",
|
||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
||||
" FROM countries,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses"
|
||||
" WHERE countries.CtyCod=institutions.CtyCod"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE countries.CtyCod=ins_instits.CtyCod"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod");
|
||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_CRSS,Hie_Lvl_SYS,-1L,
|
||||
|
@ -2031,13 +2034,13 @@ unsigned Cty_GetCachedNumCtysWithUsrs (Rol_Role_t Role,const char *SubQuery,
|
|||
DB_QueryCOUNT ("can not get number of countries with users",
|
||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
||||
" FROM countries,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr"
|
||||
" WHERE %scountries.CtyCod=institutions.CtyCod"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE %scountries.CtyCod=ins_instits.CtyCod"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -2175,10 +2178,10 @@ bool Cty_GetIfMapIsAvailable (long CtyCod)
|
|||
if (DB_QuerySELECT (&mysql_res,"can not get if map is available",
|
||||
"SELECT EXISTS"
|
||||
"(SELECT *"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND (ctr_centers.Latitude<>0"
|
||||
" OR ctr_centers.Longitude<>0))",
|
||||
CtyCod))
|
||||
|
|
|
@ -250,10 +250,10 @@ static void CtyCfg_GetCoordAndZoom (struct Coordinates *Coord,unsigned *Zoom)
|
|||
"AVG(ctr_centers.Longitude)," // row[1]
|
||||
"GREATEST(MAX(ctr_centers.Latitude)-MIN(ctr_centers.Latitude),"
|
||||
"MAX(ctr_centers.Longitude)-MIN(ctr_centers.Longitude))" // row[2]
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.Latitude<>0"
|
||||
" AND ctr_centers.Longitude<>0",
|
||||
Gbl.Hierarchy.Cty.CtyCod) < 0)
|
||||
|
@ -303,9 +303,10 @@ static void CtyCfg_Map (void)
|
|||
NumCtrs = (unsigned) DB_QuerySELECT (&mysql_res,"can not get centers"
|
||||
" with coordinates",
|
||||
"SELECT ctr_centers.CtrCod" // row[0]
|
||||
" FROM institutions,ctr_centers"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.Latitude<>0"
|
||||
" AND ctr_centers.Longitude<>0",
|
||||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
|
|
|
@ -448,12 +448,12 @@ unsigned Crs_GetNumCrssInCty (long CtyCod)
|
|||
Gbl.Cache.NumCrssInCty.NumCrss = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of courses in a country",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod",
|
||||
CtyCod);
|
||||
|
@ -642,7 +642,7 @@ unsigned Crs_GetCachedNumCrssWithUsrs (Rol_Role_t Role,const char *SubQuery,
|
|||
NumCrssWithUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with users",
|
||||
"SELECT COUNT(DISTINCT crs_courses.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
|
|
|
@ -1895,9 +1895,9 @@ mysql> DESCRIBE holidays;
|
|||
"INDEX(InsCod),"
|
||||
"INDEX(PlcCod))");
|
||||
|
||||
/***** Table institutions *****/
|
||||
/***** Table ins_instits *****/
|
||||
/*
|
||||
mysql> DESCRIBE institutions;
|
||||
mysql> DESCRIBE ins_instits;
|
||||
+-----------------+---------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-----------------+---------------+------+-----+---------+----------------+
|
||||
|
@ -1911,7 +1911,7 @@ mysql> DESCRIBE institutions;
|
|||
+-----------------+---------------+------+-----+---------+----------------+
|
||||
7 rows in set (0,00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS institutions ("
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS ins_instits ("
|
||||
"InsCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"CtyCod INT NOT NULL,"
|
||||
"Status TINYINT NOT NULL DEFAULT 0,"
|
||||
|
|
|
@ -1955,11 +1955,11 @@ unsigned Deg_GetNumDegsInCty (long CtyCod)
|
|||
Gbl.Cache.NumDegsInCty.NumDegs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of degrees in a country",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod",
|
||||
CtyCod);
|
||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_DEGS,Hie_Lvl_CTY,Gbl.Cache.NumDegsInCty.CtyCod,
|
||||
|
@ -2090,7 +2090,7 @@ unsigned Deg_GetCachedNumDegsWithCrss (const char *SubQuery,
|
|||
NumDegsWithCrss = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of degrees with courses",
|
||||
"SELECT COUNT(DISTINCT deg_degrees.DegCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses"
|
||||
|
@ -2128,7 +2128,7 @@ unsigned Deg_GetCachedNumDegsWithUsrs (Rol_Role_t Role,const char *SubQuery,
|
|||
NumDegsWithUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of degrees with users",
|
||||
"SELECT COUNT(DISTINCT deg_degrees.DegCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
|
|
|
@ -629,12 +629,12 @@ void DT_GetListDegreeTypes (Hie_Lvl_Level_t Scope,DT_Order_t Order)
|
|||
"SELECT deg_types.DegTypCod," // row[0]
|
||||
"deg_types.DegTypName," // row[1]
|
||||
"COUNT(deg_degrees.DegCod) AS NumDegs" // row[2]
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"deg_types"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegTypCod=deg_types.DegTypCod"
|
||||
" GROUP BY deg_degrees.DegTypCod"
|
||||
|
|
|
@ -2448,7 +2448,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
|
@ -2458,8 +2458,8 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
" AND crs_usr.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND crs_courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
" ORDER BY crs_usr_requests.RequestTime DESC",
|
||||
|
@ -2478,7 +2478,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM usr_admins,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
|
@ -2487,8 +2487,8 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
" AND ((1<<crs_usr_requests.Role)&%u)<>0"
|
||||
|
@ -2508,7 +2508,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM usr_admins,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
|
@ -2516,8 +2516,8 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
" WHERE usr_admins.UsrCod=%ld"
|
||||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
|
@ -2539,16 +2539,16 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM usr_admins,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr_requests"
|
||||
" WHERE usr_admins.UsrCod=%ld"
|
||||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" AND usr_admins.Cod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
|
@ -2568,13 +2568,13 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr_requests"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
|
|
18
swad_exam.c
18
swad_exam.c
|
@ -1897,13 +1897,13 @@ unsigned Exa_GetNumCoursesWithExams (Hie_Lvl_Level_t Scope)
|
|||
case Hie_Lvl_CTY:
|
||||
DB_QuerySELECT (&mysql_res,"can not get number of courses with exams",
|
||||
"SELECT COUNT(DISTINCT exa_exams.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"exa_exams"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=exa_exams.CrsCod",
|
||||
|
@ -1987,13 +1987,13 @@ unsigned Exa_GetNumExams (Hie_Lvl_Level_t Scope)
|
|||
case Hie_Lvl_CTY:
|
||||
DB_QuerySELECT (&mysql_res,"can not get number of exams",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"exa_exams"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=exa_exams.CrsCod",
|
||||
|
@ -2080,14 +2080,14 @@ double Exa_GetNumQstsPerCrsExam (Hie_Lvl_Level_t Scope)
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of questions per exam",
|
||||
"SELECT AVG(NumQsts) FROM"
|
||||
" (SELECT COUNT(exa_set_questions.QstCod) AS NumQsts"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"exa_exams,"
|
||||
"exa_set_questions"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=exa_exams.CrsCod"
|
||||
|
|
116
swad_figure.c
116
swad_figure.c
|
@ -702,7 +702,7 @@ static void Fig_GetAndShowHierarchyWithCtrs (void)
|
|||
NumInssWithCtrs = Ins_GetCachedNumInssWithCtrs ("",Hie_Lvl_SYS,-1L);
|
||||
break;
|
||||
case Hie_Lvl_CTY:
|
||||
sprintf (SubQuery,"institutions.CtyCod=%ld AND ",Gbl.Hierarchy.Cty.CtyCod);
|
||||
sprintf (SubQuery,"ins_instits.CtyCod=%ld AND ",Gbl.Hierarchy.Cty.CtyCod);
|
||||
NumInssWithCtrs = Ins_GetCachedNumInssWithCtrs (SubQuery,Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod);
|
||||
break;
|
||||
case Hie_Lvl_INS:
|
||||
|
@ -747,7 +747,7 @@ static void Fig_GetAndShowHierarchyWithDegs (void)
|
|||
NumCtrsWithDegs = Ctr_GetCachedNumCtrsWithDegs ("",Hie_Lvl_SYS,-1L);
|
||||
break;
|
||||
case Hie_Lvl_CTY:
|
||||
sprintf (SubQuery,"institutions.CtyCod=%ld AND ",Gbl.Hierarchy.Cty.CtyCod);
|
||||
sprintf (SubQuery,"ins_instits.CtyCod=%ld AND ",Gbl.Hierarchy.Cty.CtyCod);
|
||||
NumInssWithDegs = Ins_GetCachedNumInssWithDegs (SubQuery,Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod);
|
||||
NumCtrsWithDegs = Ctr_GetCachedNumCtrsWithDegs (SubQuery,Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod);
|
||||
break;
|
||||
|
@ -798,7 +798,7 @@ static void Fig_GetAndShowHierarchyWithCrss (void)
|
|||
NumDegsWithCrss = Deg_GetCachedNumDegsWithCrss ("",Hie_Lvl_SYS,-1L);
|
||||
break;
|
||||
case Hie_Lvl_CTY:
|
||||
sprintf (SubQuery,"institutions.CtyCod=%ld AND ",Gbl.Hierarchy.Cty.CtyCod);
|
||||
sprintf (SubQuery,"ins_instits.CtyCod=%ld AND ",Gbl.Hierarchy.Cty.CtyCod);
|
||||
NumInssWithCrss = Ins_GetCachedNumInssWithCrss (SubQuery,Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod);
|
||||
NumCtrsWithCrss = Ctr_GetCachedNumCtrsWithCrss (SubQuery,Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod);
|
||||
NumDegsWithCrss = Deg_GetCachedNumDegsWithCrss (SubQuery,Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod);
|
||||
|
@ -857,7 +857,7 @@ static void Fig_GetAndShowHierarchyWithUsrs (Rol_Role_t Role)
|
|||
NumCrssWithUsrs = Crs_GetCachedNumCrssWithUsrs (Role,"",Hie_Lvl_SYS,-1L);
|
||||
break;
|
||||
case Hie_Lvl_CTY:
|
||||
sprintf (SubQuery,"institutions.CtyCod=%ld AND ",Gbl.Hierarchy.Cty.CtyCod);
|
||||
sprintf (SubQuery,"ins_instits.CtyCod=%ld AND ",Gbl.Hierarchy.Cty.CtyCod);
|
||||
NumCtysWithUsrs = Cty_GetCachedNumCtysWithUsrs (Role,SubQuery,Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod);
|
||||
NumInssWithUsrs = Ins_GetCachedNumInssWithUsrs (Role,SubQuery,Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod);
|
||||
NumCtrsWithUsrs = Ctr_GetCachedNumCtrsWithUsrs (Role,SubQuery,Hie_Lvl_CTY,Gbl.Hierarchy.Cty.CtyCod);
|
||||
|
@ -1086,10 +1086,10 @@ static void Fig_GetAndShowInssOrderedByNumCtrs (void)
|
|||
DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||
"SELECT ctr_centers.InsCod,"
|
||||
"COUNT(*) AS N"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" GROUP BY ctr_centers.InsCod"
|
||||
" ORDER BY N DESC",
|
||||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
|
@ -1158,11 +1158,11 @@ static void Fig_GetAndShowInssOrderedByNumDegs (void)
|
|||
DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||
"SELECT ctr_centers.InsCod,"
|
||||
"COUNT(*) AS N"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" GROUP BY ctr_centers.InsCod"
|
||||
" ORDER BY N DESC",
|
||||
|
@ -1236,12 +1236,12 @@ static void Fig_GetAndShowInssOrderedByNumCrss (void)
|
|||
DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||
"SELECT ctr_centers.InsCod,"
|
||||
"COUNT(*) AS N"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" GROUP BY ctr_centers.InsCod"
|
||||
|
@ -1320,13 +1320,13 @@ static void Fig_GetAndShowInssOrderedByNumUsrsInCrss (void)
|
|||
DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||
"SELECT ctr_centers.InsCod,"
|
||||
"COUNT(DISTINCT crs_usr.UsrCod) AS N"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -1402,9 +1402,9 @@ static void Fig_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem (void)
|
|||
NumInss =
|
||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||
"SELECT usr_data.InsCod,COUNT(*) AS N"
|
||||
" FROM institutions,usr_data"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=usr_data.InsCod"
|
||||
" FROM ins_instits,usr_data"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=usr_data.InsCod"
|
||||
" GROUP BY usr_data.InsCod"
|
||||
" ORDER BY N DESC",
|
||||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
|
@ -1816,13 +1816,13 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Lvl_Level_t Scope,
|
|||
"file_browser_size.NumFolders,"
|
||||
"file_browser_size.NumFiles,"
|
||||
"file_browser_size.TotalSize"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"file_browser_size"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=file_browser_size.Cod"
|
||||
|
@ -1834,15 +1834,15 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Lvl_Level_t Scope,
|
|||
"file_browser_size.NumFolders,"
|
||||
"file_browser_size.NumFiles,"
|
||||
"file_browser_size.TotalSize"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_grp_types,"
|
||||
"crs_grp,"
|
||||
"file_browser_size"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_grp_types.CrsCod"
|
||||
|
@ -1875,13 +1875,13 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Lvl_Level_t Scope,
|
|||
"SUM(file_browser_size.NumFolders),"
|
||||
"SUM(file_browser_size.NumFiles),"
|
||||
"SUM(file_browser_size.TotalSize)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"file_browser_size"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=file_browser_size.Cod"
|
||||
|
@ -1900,15 +1900,15 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Lvl_Level_t Scope,
|
|||
"SUM(file_browser_size.NumFolders),"
|
||||
"SUM(file_browser_size.NumFiles),"
|
||||
"SUM(file_browser_size.TotalSize)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_grp_types,"
|
||||
"crs_grp,"
|
||||
"file_browser_size"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_grp_types.CrsCod"
|
||||
|
@ -1927,13 +1927,13 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Lvl_Level_t Scope,
|
|||
"SUM(file_browser_size.NumFolders),"
|
||||
"SUM(file_browser_size.NumFiles),"
|
||||
"SUM(file_browser_size.TotalSize)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"file_browser_size"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=file_browser_size.Cod"
|
||||
|
@ -1949,14 +1949,14 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Lvl_Level_t Scope,
|
|||
"SUM(file_browser_size.NumFolders),"
|
||||
"SUM(file_browser_size.NumFiles),"
|
||||
"SUM(file_browser_size.TotalSize)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"file_browser_size"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -2955,13 +2955,13 @@ static void Fig_GetNumberOfOERsFromDB (Hie_Lvl_Level_t Scope,Brw_License_t Licen
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of OERs",
|
||||
"SELECT files.Public,"
|
||||
"COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"files"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=files.Cod"
|
||||
|
@ -3578,14 +3578,14 @@ static void Fig_GetAndShowTimelineActivityStats (void)
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"tml_notes"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -3729,14 +3729,14 @@ static void Fig_GetAndShowTimelineActivityStats (void)
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"tml_notes"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -3930,14 +3930,14 @@ static void Fig_GetAndShowFollowStats (void)
|
|||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the total number of following/followers",
|
||||
"SELECT COUNT(DISTINCT usr_follow.%s)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"usr_follow"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -4055,14 +4055,14 @@ static void Fig_GetAndShowFollowStats (void)
|
|||
" per survey",
|
||||
"SELECT AVG(N) FROM "
|
||||
"(SELECT COUNT(DISTINCT usr_follow.%s) AS N"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"usr_follow"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -4609,12 +4609,12 @@ static void Fig_GetAndShowNumUsrsPerNotifyEvent (void)
|
|||
" of notifications by email",
|
||||
"SELECT SUM(sta_notif.NumEvents),"
|
||||
"SUM(sta_notif.NumMails)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"sta_notif"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=sta_notif.DegCod"
|
||||
" AND sta_notif.NotifyEvent=%u",
|
||||
|
@ -5785,14 +5785,14 @@ unsigned Fig_GetNumUsrsWhoChoseAnOption (const char *SubQuery)
|
|||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"usr_data"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
|
|
@ -1380,14 +1380,14 @@ void Fol_GetAndShowRankingFollowers (void)
|
|||
DB_QuerySELECT (&mysql_res,"can not get ranking",
|
||||
"SELECT usr_follow.FollowedCod,"
|
||||
"COUNT(DISTINCT usr_follow.FollowerCod) AS N"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"usr_follow"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
|
72
swad_forum.c
72
swad_forum.c
|
@ -2631,10 +2631,10 @@ unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
|||
DB_QueryCOUNT ("can not get number of forums of a type",
|
||||
"SELECT COUNT(DISTINCT forum_thread.Location)"
|
||||
" FROM forum_thread,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld",
|
||||
" AND forum_thread.Location=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
|
||||
// CtyCod <= 0 ==> Number of institutions forums for the whole platform
|
||||
|
@ -2675,11 +2675,11 @@ unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
|||
"SELECT COUNT(DISTINCT forum_thread.Location)"
|
||||
" FROM forum_thread,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld",
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
|
||||
// InsCod <= 0 ==> Number of center forums for the whole platform
|
||||
|
@ -2735,12 +2735,12 @@ unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
|||
" FROM forum_thread,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld",
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
|
||||
// InsCod <= 0 ==> Number of degree forums for the whole platform
|
||||
|
@ -2813,13 +2813,13 @@ unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld",
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
|
||||
// InsCod <= 0 ==> Number of course forums for the whole platform
|
||||
|
@ -2873,10 +2873,10 @@ unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
|||
DB_QueryCOUNT ("can not get the number of threads in forums of a type",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM forum_thread,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld",
|
||||
" AND forum_thread.Location=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
|
||||
// InsCod <= 0 ==> Number of threads in institution forums for the whole platform
|
||||
|
@ -2917,11 +2917,11 @@ unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
|||
"SELECT COUNT(*)"
|
||||
" FROM forum_thread,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld",
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
|
||||
// InsCod <= 0 ==> Number of threads in center forums for the whole platform
|
||||
|
@ -2976,12 +2976,12 @@ unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
|||
" FROM forum_thread,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld",
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
|
||||
// InsCod <= 0 ==> Number of threads in degree forums for the whole platform
|
||||
|
@ -3054,13 +3054,13 @@ unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld",
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
|
||||
// InsCod <= 0 ==> Number of threads in course forums for the whole platform
|
||||
|
@ -3143,11 +3143,11 @@ unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
|
|||
"SELECT COUNT(*),"
|
||||
"SUM(forum_post.NumNotif)"
|
||||
" FROM forum_thread,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"forum_post"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND forum_thread.Location=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND forum_thread.ThrCod=forum_post.ThrCod",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
else // InsCod <= 0 ==> Number of posts in institution forums for the whole platform
|
||||
|
@ -3194,12 +3194,12 @@ unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
|
|||
"SUM(forum_post.NumNotif)"
|
||||
" FROM forum_thread,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"forum_post"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND forum_thread.ThrCod=forum_post.ThrCod",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
else // InsCod <= 0 ==> Number of posts in center forums for the whole platform
|
||||
|
@ -3262,13 +3262,13 @@ unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
|
|||
" FROM forum_thread,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"forum_post"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND forum_thread.ThrCod=forum_post.ThrCod",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
else // InsCod <= 0 ==> Number of posts in degree forums for the whole platform
|
||||
|
@ -3349,14 +3349,14 @@ unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"forum_post"
|
||||
" WHERE forum_thread.ForumType=%u"
|
||||
" AND forum_thread.Location=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND forum_thread.ThrCod=forum_post.ThrCod",
|
||||
(unsigned) ForumType,CtyCod);
|
||||
else // CrsCod <= 0 && DegCod <= 0 && CtrCod <= 0 ==> Number of posts in course forums for the whole platform
|
||||
|
|
18
swad_game.c
18
swad_game.c
|
@ -2671,13 +2671,13 @@ unsigned Gam_GetNumCoursesWithGames (Hie_Lvl_Level_t Scope)
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with games",
|
||||
"SELECT COUNT(DISTINCT gam_games.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"gam_games"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=gam_games.CrsCod",
|
||||
|
@ -2746,13 +2746,13 @@ unsigned Gam_GetNumGames (Hie_Lvl_Level_t Scope)
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of games",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"gam_games"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=gam_games.CrsCod",
|
||||
|
@ -2828,14 +2828,14 @@ double Gam_GetNumQstsPerCrsGame (Hie_Lvl_Level_t Scope)
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of questions per game",
|
||||
"SELECT AVG(NumQsts) FROM"
|
||||
" (SELECT COUNT(gam_questions.QstCod) AS NumQsts"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"gam_games,"
|
||||
"gam_questions"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=gam_games.CrsCod"
|
||||
|
|
|
@ -668,11 +668,14 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
|
|||
" WHERE UsrCod=%ld"
|
||||
" AND Scope='%s')"
|
||||
" UNION "
|
||||
"(SELECT %u AS S,usr_admins.Cod,institutions.FullName"
|
||||
" FROM usr_admins,institutions"
|
||||
"(SELECT %u AS S,"
|
||||
"usr_admins.Cod,"
|
||||
"ins_instits.FullName"
|
||||
" FROM usr_admins,"
|
||||
"ins_instits"
|
||||
" WHERE usr_admins.UsrCod=%ld"
|
||||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=institutions.InsCod)"
|
||||
" AND usr_admins.Cod=ins_instits.InsCod)"
|
||||
" UNION "
|
||||
"(SELECT %u AS S,"
|
||||
"usr_admins.Cod,"
|
||||
|
|
|
@ -435,14 +435,14 @@ static unsigned Ind_GetTableOfCourses (const struct Ind_Indicators *Indicators,
|
|||
"crs_courses.FullName,"
|
||||
"crs_courses.CrsCod,"
|
||||
"crs_courses.InsCrsCod"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"usr_data"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -461,12 +461,12 @@ static unsigned Ind_GetTableOfCourses (const struct Ind_Indicators *Indicators,
|
|||
"crs_courses.FullName,"
|
||||
"crs_courses.CrsCod,"
|
||||
"crs_courses.InsCrsCod"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" ORDER BY deg_degrees.FullName,"
|
||||
|
|
|
@ -138,13 +138,13 @@ void Ins_SeeInsWithPendingCtrs (void)
|
|||
"COUNT(*)"
|
||||
" FROM ctr_centers,"
|
||||
"ins_admin,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE (ctr_centers.Status & %u)<>0"
|
||||
" AND ctr_centers.InsCod=ins_admin.InsCod"
|
||||
" AND ins_admin.UsrCod=%ld"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" GROUP BY ctr_centers.InsCod"
|
||||
" ORDER BY institutions.ShortName",
|
||||
" ORDER BY ins_instits.ShortName",
|
||||
(unsigned) Ctr_STATUS_BIT_PENDING,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
|
@ -154,11 +154,12 @@ void Ins_SeeInsWithPendingCtrs (void)
|
|||
" with pending centers",
|
||||
"SELECT ctr_centers.InsCod,"
|
||||
"COUNT(*)"
|
||||
" FROM ctr_centers,institutions"
|
||||
" FROM ctr_centers,"
|
||||
"ins_instits"
|
||||
" WHERE (ctr_centers.Status & %u)<>0"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" GROUP BY ctr_centers.InsCod"
|
||||
" ORDER BY institutions.ShortName",
|
||||
" ORDER BY ins_instits.ShortName",
|
||||
(unsigned) Ctr_STATUS_BIT_PENDING);
|
||||
break;
|
||||
default: // Forbidden for other users
|
||||
|
@ -540,10 +541,10 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
|
|||
static void Ins_GetParamInsOrder (void)
|
||||
{
|
||||
Gbl.Hierarchy.Inss.SelectedOrder = (Ins_Order_t)
|
||||
Par_GetParToUnsignedLong ("Order",
|
||||
0,
|
||||
Ins_NUM_ORDERS - 1,
|
||||
(unsigned long) Ins_ORDER_DEFAULT);
|
||||
Par_GetParToUnsignedLong ("Order",
|
||||
0,
|
||||
Ins_NUM_ORDERS - 1,
|
||||
(unsigned long) Ins_ORDER_DEFAULT);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -642,7 +643,7 @@ void Ins_GetBasicListOfInstitutions (long CtyCod)
|
|||
"ShortName," // row[4]
|
||||
"FullName," // row[5]
|
||||
"WWW" // row[6]
|
||||
" FROM institutions"
|
||||
" FROM ins_instits"
|
||||
" WHERE CtyCod=%ld"
|
||||
" ORDER BY FullName",
|
||||
CtyCod);
|
||||
|
@ -703,18 +704,18 @@ void Ins_GetFullListOfInstitutions (long CtyCod)
|
|||
/***** Get institutions from database *****/
|
||||
/* Query database */
|
||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||
"(SELECT institutions.InsCod," // row[0]
|
||||
"institutions.CtyCod," // row[1]
|
||||
"institutions.Status," // row[2]
|
||||
"institutions.RequesterUsrCod," // row[3]
|
||||
"institutions.ShortName," // row[4]
|
||||
"institutions.FullName," // row[5]
|
||||
"institutions.WWW," // row[6]
|
||||
"(SELECT ins_instits.InsCod," // row[0]
|
||||
"ins_instits.CtyCod," // row[1]
|
||||
"ins_instits.Status," // row[2]
|
||||
"ins_instits.RequesterUsrCod," // row[3]
|
||||
"ins_instits.ShortName," // row[4]
|
||||
"ins_instits.FullName," // row[5]
|
||||
"ins_instits.WWW," // row[6]
|
||||
"COUNT(*) AS NumUsrs" // row[7]
|
||||
" FROM institutions,usr_data"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=usr_data.InsCod"
|
||||
" GROUP BY institutions.InsCod)"
|
||||
" FROM ins_instits,usr_data"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=usr_data.InsCod"
|
||||
" GROUP BY ins_instits.InsCod)"
|
||||
" UNION "
|
||||
"(SELECT InsCod," // row[0]
|
||||
"CtyCod," // row[1]
|
||||
|
@ -724,7 +725,7 @@ void Ins_GetFullListOfInstitutions (long CtyCod)
|
|||
"FullName," // row[5]
|
||||
"WWW," // row[6]
|
||||
"0 AS NumUsrs" // row[7]
|
||||
" FROM institutions"
|
||||
" FROM ins_instits"
|
||||
" WHERE CtyCod=%ld"
|
||||
" AND InsCod NOT IN"
|
||||
" (SELECT DISTINCT InsCod FROM usr_data))"
|
||||
|
@ -817,7 +818,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Ins_Instit *Ins)
|
|||
"ShortName," // row[4]
|
||||
"FullName," // row[5]
|
||||
"WWW" // row[6]
|
||||
" FROM institutions WHERE InsCod=%ld",
|
||||
" FROM ins_instits WHERE InsCod=%ld",
|
||||
Ins->InsCod)) // Institution found...
|
||||
{
|
||||
/* Get institution data */
|
||||
|
@ -897,7 +898,7 @@ void Ins_GetShortNameOfInstitution (struct Ins_Instit *Ins)
|
|||
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get the short name"
|
||||
" of an institution",
|
||||
"SELECT ShortName FROM institutions"
|
||||
"SELECT ShortName FROM ins_instits"
|
||||
" WHERE InsCod=%ld",
|
||||
Ins->InsCod) == 1)
|
||||
{
|
||||
|
@ -958,10 +959,12 @@ static void Ins_GetShrtNameAndCtyOfInstitution (struct Ins_Instit *Ins,
|
|||
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get short name and country"
|
||||
" of an institution",
|
||||
"SELECT institutions.ShortName,countries.Name_%s"
|
||||
" FROM institutions,countries"
|
||||
" WHERE institutions.InsCod=%ld"
|
||||
" AND institutions.CtyCod=countries.CtyCod",
|
||||
"SELECT ins_instits.ShortName,"
|
||||
"countries.Name_%s"
|
||||
" FROM ins_instits,"
|
||||
"countries"
|
||||
" WHERE ins_instits.InsCod=%ld"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod",
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language],Ins->InsCod) == 1)
|
||||
{
|
||||
/* Get row */
|
||||
|
@ -1034,8 +1037,9 @@ void Ins_WriteSelectorOfInstitution (void)
|
|||
/***** Get institutions of selected country from database *****/
|
||||
NumInss =
|
||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||
"SELECT DISTINCT InsCod,ShortName"
|
||||
" FROM institutions"
|
||||
"SELECT DISTINCT InsCod,"
|
||||
"ShortName"
|
||||
" FROM ins_instits"
|
||||
" WHERE CtyCod=%ld"
|
||||
" ORDER BY ShortName",
|
||||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
|
@ -1399,7 +1403,7 @@ void Ins_RemoveInstitution (void)
|
|||
|
||||
/***** Remove institution *****/
|
||||
DB_QueryDELETE ("can not remove an institution",
|
||||
"DELETE FROM institutions WHERE InsCod=%ld",
|
||||
"DELETE FROM ins_instits WHERE InsCod=%ld",
|
||||
Ins_EditingIns->InsCod);
|
||||
|
||||
/***** Flush caches *****/
|
||||
|
@ -1529,7 +1533,7 @@ bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,
|
|||
/***** Get number of institutions in current country with a name from database *****/
|
||||
return (DB_QueryCOUNT ("can not check if the name of an institution"
|
||||
" already existed",
|
||||
"SELECT COUNT(*) FROM institutions"
|
||||
"SELECT COUNT(*) FROM ins_instits"
|
||||
" WHERE CtyCod=%ld AND %s='%s' AND InsCod<>%ld",
|
||||
CtyCod,FieldName,Name,InsCod) != 0);
|
||||
}
|
||||
|
@ -1542,7 +1546,7 @@ static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *N
|
|||
{
|
||||
/***** Update institution changing old name by new name */
|
||||
DB_QueryUPDATE ("can not update the name of an institution",
|
||||
"UPDATE institutions SET %s='%s' WHERE InsCod=%ld",
|
||||
"UPDATE ins_instits SET %s='%s' WHERE InsCod=%ld",
|
||||
FieldName,NewInsName,InsCod);
|
||||
|
||||
/***** Flush caches *****/
|
||||
|
@ -1597,7 +1601,7 @@ void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
|||
{
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
DB_QueryUPDATE ("can not update the web of an institution",
|
||||
"UPDATE institutions SET WWW='%s' WHERE InsCod=%ld",
|
||||
"UPDATE ins_instits SET WWW='%s' WHERE InsCod=%ld",
|
||||
NewWWW,InsCod);
|
||||
}
|
||||
|
||||
|
@ -1634,7 +1638,7 @@ void Ins_ChangeInsStatus (void)
|
|||
|
||||
/***** Update status in table of institutions *****/
|
||||
DB_QueryUPDATE ("can not update the status of an institution",
|
||||
"UPDATE institutions SET Status=%u WHERE InsCod=%ld",
|
||||
"UPDATE ins_instits SET Status=%u WHERE InsCod=%ld",
|
||||
(unsigned) Status,Ins_EditingIns->InsCod);
|
||||
Ins_EditingIns->Status = Status;
|
||||
|
||||
|
@ -1912,7 +1916,7 @@ static void Ins_CreateInstitution (unsigned Status)
|
|||
/***** Create a new institution *****/
|
||||
Ins_EditingIns->InsCod =
|
||||
DB_QueryINSERTandReturnCode ("can not create institution",
|
||||
"INSERT INTO institutions"
|
||||
"INSERT INTO ins_instits"
|
||||
" (CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
|
||||
" VALUES"
|
||||
" (%ld,%u,%ld,'%s','%s','%s')",
|
||||
|
@ -1937,7 +1941,7 @@ unsigned Ins_GetCachedNumInssInSys (void)
|
|||
FigCch_UNSIGNED,&NumInss))
|
||||
{
|
||||
/***** Get current number of institutions from database and update cache *****/
|
||||
NumInss = (unsigned) DB_GetNumRowsTable ("institutions");
|
||||
NumInss = (unsigned) DB_GetNumRowsTable ("ins_instits");
|
||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_INSS,Hie_Lvl_SYS,-1L,
|
||||
FigCch_UNSIGNED,&NumInss);
|
||||
}
|
||||
|
@ -1966,7 +1970,7 @@ unsigned Ins_GetNumInssInCty (long CtyCod)
|
|||
Gbl.Cache.NumInssInCty.NumInss =
|
||||
(unsigned) DB_QueryCOUNT ("can not get the number of institutions"
|
||||
" in a country",
|
||||
"SELECT COUNT(*) FROM institutions"
|
||||
"SELECT COUNT(*) FROM ins_instits"
|
||||
" WHERE CtyCod=%ld",
|
||||
CtyCod);
|
||||
Gbl.Cache.NumInssInCty.Valid = true;
|
||||
|
@ -2004,8 +2008,8 @@ unsigned Ins_GetCachedNumInssWithCtrs (const char *SubQuery,
|
|||
/***** Get current number of institutions with centers from database and update cache *****/
|
||||
NumInssWithCtrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of institutions with centers",
|
||||
"SELECT COUNT(DISTINCT institutions.InsCod)"
|
||||
" FROM institutions,"
|
||||
"SELECT COUNT(DISTINCT ins_instits.InsCod)"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers"
|
||||
" WHERE %sinstitutions.InsCod=ctr_centers.InsCod",
|
||||
SubQuery);
|
||||
|
@ -2032,8 +2036,8 @@ unsigned Ins_GetCachedNumInssWithDegs (const char *SubQuery,
|
|||
/***** Get current number of institutions with degrees from database and update cache *****/
|
||||
NumInssWithDegs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of institutions with degrees",
|
||||
"SELECT COUNT(DISTINCT institutions.InsCod)"
|
||||
" FROM institutions,"
|
||||
"SELECT COUNT(DISTINCT ins_instits.InsCod)"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees"
|
||||
" WHERE %sinstitutions.InsCod=ctr_centers.InsCod"
|
||||
|
@ -2062,8 +2066,8 @@ unsigned Ins_GetCachedNumInssWithCrss (const char *SubQuery,
|
|||
/***** Get current number of institutions with courses from database and update cache *****/
|
||||
NumInssWithCrss = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of institutions with courses",
|
||||
"SELECT COUNT(DISTINCT institutions.InsCod)"
|
||||
" FROM institutions,"
|
||||
"SELECT COUNT(DISTINCT ins_instits.InsCod)"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses"
|
||||
|
@ -2100,8 +2104,8 @@ unsigned Ins_GetCachedNumInssWithUsrs (Rol_Role_t Role,const char *SubQuery,
|
|||
/***** Get current number of institutions with users from database and update cache *****/
|
||||
NumInssWithUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of institutions with users",
|
||||
"SELECT COUNT(DISTINCT institutions.InsCod)"
|
||||
" FROM institutions,"
|
||||
"SELECT COUNT(DISTINCT ins_instits.InsCod)"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
|
|
|
@ -625,7 +625,7 @@ static void InsCfg_UpdateInsCtyDB (long InsCod,long CtyCod)
|
|||
{
|
||||
/***** Update country in table of institutions *****/
|
||||
DB_QueryUPDATE ("can not update the country of an institution",
|
||||
"UPDATE institutions SET CtyCod=%ld WHERE InsCod=%ld",
|
||||
"UPDATE ins_instits SET CtyCod=%ld WHERE InsCod=%ld",
|
||||
CtyCod,InsCod);
|
||||
}
|
||||
|
||||
|
|
|
@ -2239,13 +2239,13 @@ unsigned Msg_GetNumMsgsSent (Hie_Lvl_Level_t Scope,Msg_Status_t MsgStatus)
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of sent messages",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"%s"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=%s.CrsCod",
|
||||
|
@ -2329,14 +2329,14 @@ unsigned Msg_GetNumMsgsReceived (Hie_Lvl_Level_t Scope,Msg_Status_t MsgStatus)
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of received messages",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"%s,"
|
||||
"msg_snt"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=msg_snt.CrsCod"
|
||||
|
@ -2424,14 +2424,14 @@ unsigned Msg_GetNumMsgsReceived (Hie_Lvl_Level_t Scope,Msg_Status_t MsgStatus)
|
|||
DB_QueryCOUNT ("can not get number of received messages",
|
||||
"SELECT "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"msg_snt,"
|
||||
"msg_rcv"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=msg_snt.CrsCod"
|
||||
|
@ -2439,14 +2439,14 @@ unsigned Msg_GetNumMsgsReceived (Hie_Lvl_Level_t Scope,Msg_Status_t MsgStatus)
|
|||
" AND msg_rcv.Notified='Y')"
|
||||
" + "
|
||||
"(SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"msg_snt,"
|
||||
"msg_rcv_deleted"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=msg_snt.CrsCod"
|
||||
|
|
|
@ -469,14 +469,14 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
|||
" with webs / social networks",
|
||||
"SELECT usr_webs.Web,"
|
||||
"COUNT(DISTINCT usr_webs.UsrCod) AS N"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"usr_webs"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
|
|
@ -832,13 +832,13 @@ unsigned Not_GetNumNotices (Hie_Lvl_Level_t Scope,Not_Status_t Status,unsigned *
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of notices",
|
||||
"SELECT COUNT(*),"
|
||||
"SUM(notices.NumNotif)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"notices"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=notices.CrsCod"
|
||||
|
@ -948,13 +948,13 @@ unsigned Not_GetNumNoticesDeleted (Hie_Lvl_Level_t Scope,unsigned *NumNotif)
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of deleted notices",
|
||||
"SELECT COUNT(*),"
|
||||
"SUM(notices_deleted.NumNotif)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"notices_deleted"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=notices_deleted.CrsCod",
|
||||
|
|
|
@ -1440,14 +1440,14 @@ static void Prf_GetAndShowRankingFigure (const char *FieldName)
|
|||
"SELECT DISTINCTROW "
|
||||
"usr_figures.UsrCod,"
|
||||
"usr_figures.%s"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"usr_figures"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -1657,14 +1657,14 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
"usr_figures.UsrCod,"
|
||||
"usr_figures.NumClicks/(DATEDIFF(NOW(),"
|
||||
"usr_figures.FirstClickTime)+1) AS NumClicksPerDay"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr,"
|
||||
"usr_figures"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
|
|
@ -2195,13 +2195,13 @@ unsigned Prg_GetNumCoursesWithItems (Hie_Lvl_Level_t Scope)
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with program items",
|
||||
"SELECT COUNT(DISTINCT prg_items.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"prg_items"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.Status=0"
|
||||
|
@ -2276,13 +2276,13 @@ unsigned Prg_GetNumItems (Hie_Lvl_Level_t Scope)
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of program items",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"prg_items"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=prg_items.CrsCod",
|
||||
|
|
|
@ -4583,13 +4583,13 @@ unsigned Prj_GetNumCoursesWithProjects (Hie_Lvl_Level_t Scope)
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with projects",
|
||||
"SELECT COUNT(DISTINCT projects.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"projects"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.Status=0"
|
||||
|
@ -4666,13 +4666,13 @@ unsigned Prj_GetNumProjects (Hie_Lvl_Level_t Scope)
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of projects",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"projects"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=projects.CrsCod",
|
||||
|
|
158
swad_search.c
158
swad_search.c
|
@ -358,7 +358,7 @@ static void Sch_SearchInDB (void)
|
|||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
break;
|
||||
case Hie_Lvl_INS:
|
||||
sprintf (RangeQuery," AND institutions.InsCod=%ld",
|
||||
sprintf (RangeQuery," AND ins_instits.InsCod=%ld",
|
||||
Gbl.Hierarchy.Ins.InsCod);
|
||||
break;
|
||||
case Hie_Lvl_CTR:
|
||||
|
@ -498,18 +498,20 @@ static unsigned Sch_SearchInstitutionsInDB (const char *RangeQuery)
|
|||
/***** Check user's permission *****/
|
||||
if (Sch_CheckIfIHavePermissionToSearch (Sch_SEARCH_INSTITS))
|
||||
/***** Split institutions string into words *****/
|
||||
if (Sch_BuildSearchQuery (SearchQuery,"institutions.FullName",NULL,NULL))
|
||||
if (Sch_BuildSearchQuery (SearchQuery,"ins_instits.FullName",NULL,NULL))
|
||||
{
|
||||
/***** Query database and list institutions found *****/
|
||||
NumInss = (unsigned) DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||
"SELECT institutions.InsCod"
|
||||
" FROM institutions,countries"
|
||||
" WHERE %s"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" ORDER BY institutions.FullName,countries.Name_%s",
|
||||
SearchQuery,RangeQuery,
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
NumInss = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||
"SELECT ins_instits.InsCod"
|
||||
" FROM ins_instits,"
|
||||
"countries"
|
||||
" WHERE %s"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" ORDER BY ins_instits.FullName,countries.Name_%s",
|
||||
SearchQuery,RangeQuery,
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
Ins_ListInssFound (&mysql_res,NumInss);
|
||||
return NumInss;
|
||||
}
|
||||
|
@ -541,14 +543,14 @@ static unsigned Sch_SearchCentersInDB (const char *RangeQuery)
|
|||
DB_QuerySELECT (&mysql_res,"can not get centers",
|
||||
"SELECT ctr_centers.CtrCod"
|
||||
" FROM ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE %s"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" ORDER BY ctr_centers.FullName,"
|
||||
"institutions.FullName",
|
||||
"ins_instits.FullName",
|
||||
SearchQuery,RangeQuery);
|
||||
Ctr_ListCtrsFound (&mysql_res,NumCtrs);
|
||||
return NumCtrs;
|
||||
|
@ -581,14 +583,14 @@ static unsigned Sch_SearchDegreesInDB (const char *RangeQuery)
|
|||
"SELECT deg_degrees.DegCod"
|
||||
" FROM deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,countries"
|
||||
"ins_instits,countries"
|
||||
" WHERE %s"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" ORDER BY deg_degrees.FullName,"
|
||||
"institutions.FullName",
|
||||
"ins_instits.FullName",
|
||||
SearchQuery,RangeQuery);
|
||||
Deg_ListDegsFound (&mysql_res,NumDegs);
|
||||
return NumDegs;
|
||||
|
@ -626,16 +628,16 @@ static unsigned Sch_SearchCoursesInDB (const char *RangeQuery)
|
|||
" FROM crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE %s"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" ORDER BY crs_courses.FullName,"
|
||||
"institutions.FullName,"
|
||||
"ins_instits.FullName,"
|
||||
"degrees.FullName,"
|
||||
"crs_courses.Year",
|
||||
SearchQuery,RangeQuery);
|
||||
|
@ -700,8 +702,8 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"("
|
||||
"SELECT files.FilCod," // Institution
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"-1 AS CtrCod,"
|
||||
"'' AS CtrShortName,"
|
||||
"-1 AS DegCod,"
|
||||
|
@ -713,18 +715,18 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND files.Cod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" UNION "
|
||||
"SELECT files.FilCod," // Center
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"ctr_centers.CtrCod,"
|
||||
"ctr_centers.ShortName AS CtrShortName,"
|
||||
"-1 AS DegCod,"
|
||||
|
@ -736,19 +738,19 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" UNION "
|
||||
"SELECT files.FilCod," // Degree
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"ctr_centers.CtrCod,"
|
||||
"ctr_centers.ShortName AS CtrShortName,"
|
||||
"deg_degrees.DegCod,"
|
||||
|
@ -759,20 +761,20 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" UNION "
|
||||
"SELECT files.FilCod," // Course
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"ctr_centers.CtrCod,"
|
||||
"ctr_centers.ShortName AS CtrShortName,"
|
||||
"deg_degrees.DegCod,"
|
||||
|
@ -784,15 +786,15 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
") AS selected_files"
|
||||
" WHERE PathFromRoot<>''"
|
||||
|
@ -887,8 +889,8 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
"("
|
||||
"SELECT files.FilCod,"
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"ctr_centers.CtrCod,"
|
||||
"ctr_centers.ShortName AS CtrShortName,"
|
||||
"deg_degrees.DegCod,"
|
||||
|
@ -900,21 +902,21 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.FilCod IN (SELECT FilCod FROM my_files_crs) AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND files.Cod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" UNION "
|
||||
"SELECT files.FilCod,"
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"ctr_centers.CtrCod,"
|
||||
"ctr_centers.ShortName AS CtrShortName,"
|
||||
"deg_degrees.DegCod,"
|
||||
|
@ -928,7 +930,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.FilCod IN (SELECT FilCod FROM my_files_grp) AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
|
@ -937,8 +939,8 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
" AND crs_grp_types.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
") AS selected_files"
|
||||
" WHERE PathFromRoot<>''"
|
||||
|
@ -1000,8 +1002,8 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"("
|
||||
"SELECT files.FilCod," // Institution
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"-1 AS CtrCod,"
|
||||
"'' AS CtrShortName,"
|
||||
"-1 AS DegCod,"
|
||||
|
@ -1013,18 +1015,18 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND files.Cod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" UNION "
|
||||
"SELECT files.FilCod," // Center
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"ctr_centers.CtrCod,"
|
||||
"ctr_centers.ShortName AS CtrShortName,"
|
||||
"-1 AS DegCod,"
|
||||
|
@ -1036,19 +1038,19 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" UNION "
|
||||
"SELECT files.FilCod," // Degree
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"ctr_centers.CtrCod,"
|
||||
"ctr_centers.ShortName AS CtrShortName,"
|
||||
"deg_degrees.DegCod,"
|
||||
|
@ -1060,20 +1062,20 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u)"
|
||||
" AND files.Cod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" UNION "
|
||||
"SELECT files.FilCod," // Course
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"ctr_centers.CtrCod,"
|
||||
"ctr_centers.ShortName AS CtrShortName,"
|
||||
"deg_degrees.DegCod,"
|
||||
|
@ -1085,21 +1087,21 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND files.Cod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" UNION "
|
||||
"SELECT files.FilCod," // Group
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"institutions.InsCod,"
|
||||
"institutions.ShortName AS InsShortName,"
|
||||
"ins_instits.InsCod,"
|
||||
"ins_instits.ShortName AS InsShortName,"
|
||||
"ctr_centers.CtrCod,"
|
||||
"ctr_centers.ShortName AS CtrShortName,"
|
||||
"deg_degrees.DegCod,"
|
||||
|
@ -1113,7 +1115,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
|
@ -1122,8 +1124,8 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
" AND crs_grp_types.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" UNION "
|
||||
"SELECT files.FilCod," // Briefcase
|
||||
|
|
|
@ -3891,13 +3891,13 @@ unsigned Svy_GetNumCoursesWithCrsSurveys (Hie_Lvl_Level_t Scope)
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with surveys",
|
||||
"SELECT COUNT(DISTINCT svy_surveys.Cod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"svy_surveys"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=svy_surveys.Cod"
|
||||
|
@ -3983,13 +3983,13 @@ unsigned Svy_GetNumCrsSurveys (Hie_Lvl_Level_t Scope,unsigned *NumNotif)
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of surveys",
|
||||
"SELECT COUNT(*),"
|
||||
"SUM(svy_surveys.NumNotif)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"svy_surveys"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=svy_surveys.Cod"
|
||||
|
@ -4104,14 +4104,14 @@ double Svy_GetNumQstsPerCrsSurvey (Hie_Lvl_Level_t Scope)
|
|||
" per survey",
|
||||
"SELECT AVG(NumQsts) FROM"
|
||||
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"svy_surveys,"
|
||||
"svy_questions"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=svy_surveys.Cod"
|
||||
|
|
36
swad_test.c
36
swad_test.c
|
@ -5359,13 +5359,13 @@ static unsigned Tst_GetNumTstQuestions (Hie_Lvl_Level_t Scope,Tst_AnswerType_t A
|
|||
"SELECT COUNT(*),"
|
||||
"SUM(NumHits),"
|
||||
"SUM(Score)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"tst_questions"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=tst_questions.CrsCod",
|
||||
|
@ -5375,13 +5375,13 @@ static unsigned Tst_GetNumTstQuestions (Hie_Lvl_Level_t Scope,Tst_AnswerType_t A
|
|||
"SELECT COUNT(*),"
|
||||
"SUM(NumHits),"
|
||||
"SUM(Score)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"tst_questions"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=tst_questions.CrsCod"
|
||||
|
@ -5553,13 +5553,13 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Hie_Lvl_Level_t Scope,Tst_Ans
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with test questions",
|
||||
"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"tst_questions"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=tst_questions.CrsCod",
|
||||
|
@ -5568,13 +5568,13 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Hie_Lvl_Level_t Scope,Tst_Ans
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with test questions",
|
||||
"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"tst_questions"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=tst_questions.CrsCod"
|
||||
|
@ -5717,14 +5717,14 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Hie_Lvl_Level_t Scop
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with pluggable test questions",
|
||||
"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"tst_questions,"
|
||||
"tst_config"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=tst_questions.CrsCod"
|
||||
|
@ -5736,14 +5736,14 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Hie_Lvl_Level_t Scop
|
|||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of courses with pluggable test questions",
|
||||
"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"tst_questions,"
|
||||
"tst_config"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=tst_questions.CrsCod"
|
||||
|
|
102
swad_user.c
102
swad_user.c
|
@ -2207,14 +2207,14 @@ unsigned Usr_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"countries"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
||||
" GROUP BY countries.CtyCod"
|
||||
" ORDER BY countries.Name_%s",
|
||||
UsrCod,Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
|
@ -2231,39 +2231,39 @@ unsigned long Usr_GetInssFromUsr (long UsrCod,long CtyCod,MYSQL_RES **mysql_res)
|
|||
if (CtyCod > 0)
|
||||
return DB_QuerySELECT (mysql_res,"can not get the institutions"
|
||||
" a user belongs to",
|
||||
"SELECT institutions.InsCod,"
|
||||
"SELECT ins_instits.InsCod,"
|
||||
"MAX(crs_usr.Role)"
|
||||
" FROM crs_usr,"
|
||||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" GROUP BY institutions.InsCod"
|
||||
" ORDER BY institutions.ShortName",
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" GROUP BY ins_instits.InsCod"
|
||||
" ORDER BY ins_instits.ShortName",
|
||||
UsrCod,CtyCod);
|
||||
else
|
||||
return DB_QuerySELECT (mysql_res,"can not get the institutions"
|
||||
return DB_QuerySELECT (mysql_res,"can not get the ins_instits"
|
||||
" a user belongs to",
|
||||
"SELECT institutions.InsCod,"
|
||||
"SELECT ins_instits.InsCod,"
|
||||
"MAX(crs_usr.Role)"
|
||||
" FROM crs_usr,"
|
||||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE crs_usr.UsrCod=%ld"
|
||||
" AND crs_usr.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" GROUP BY institutions.InsCod"
|
||||
" ORDER BY institutions.ShortName",
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" GROUP BY ins_instits.InsCod"
|
||||
" ORDER BY ins_instits.ShortName",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
|
@ -4606,14 +4606,14 @@ void Usr_GetListUsrs (Hie_Lvl_Level_t Scope,Rol_Role_t Role)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE usr_data.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" AND crs_usr.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" ORDER BY usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
|
@ -4769,14 +4769,14 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
Gbl.Hierarchy.Cty.CtyCod,
|
||||
|
@ -4916,15 +4916,15 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
"crs_courses,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions,"
|
||||
"ins_instits,"
|
||||
"usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
"%s"
|
||||
" AND crs_usr.CrsCod=crs_courses.CrsCod"
|
||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld"
|
||||
" AND %s",
|
||||
QueryFields,
|
||||
SubQueryRole,
|
||||
|
@ -5123,30 +5123,30 @@ static void Usr_GetAdmsLst (Hie_Lvl_Level_t Scope)
|
|||
" OR UsrCod IN "
|
||||
"(SELECT usr_admins.UsrCod"
|
||||
" FROM usr_admins,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" AND usr_admins.Cod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT usr_admins.UsrCod"
|
||||
" FROM usr_admins,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld)"
|
||||
" OR UsrCod IN "
|
||||
"(SELECT usr_admins.UsrCod"
|
||||
" FROM usr_admins,"
|
||||
"deg_degrees,"
|
||||
"ctr_centers,"
|
||||
"institutions"
|
||||
"ins_instits"
|
||||
" WHERE usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=deg_degrees.DegCod"
|
||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||
" AND ctr_centers.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=%ld)"
|
||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||
" AND ins_instits.CtyCod=%ld)"
|
||||
" ORDER BY Surname1,"
|
||||
"Surname2,"
|
||||
"FirstName,"
|
||||
|
@ -9379,13 +9379,13 @@ unsigned Usr_GetNumUsrsInCrss (Hie_Lvl_Level_t Scope,long Cod,unsigned Roles)
|
|||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users",
|
||||
"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod",
|
||||
|
@ -9394,13 +9394,13 @@ unsigned Usr_GetNumUsrsInCrss (Hie_Lvl_Level_t Scope,long Cod,unsigned Roles)
|
|||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of users",
|
||||
"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -9604,13 +9604,13 @@ static double Usr_GetNumCrssPerUsr (Hie_Lvl_Level_t Scope,long Cod,Rol_Role_t Ro
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of courses per user",
|
||||
"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -9620,13 +9620,13 @@ static double Usr_GetNumCrssPerUsr (Hie_Lvl_Level_t Scope,long Cod,Rol_Role_t Ro
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of courses per user",
|
||||
"SELECT AVG(NumCrss) FROM "
|
||||
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -9793,13 +9793,13 @@ static double Usr_GetNumUsrsPerCrs (Hie_Lvl_Level_t Scope,long Cod,Rol_Role_t Ro
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of users per course",
|
||||
"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
@ -9809,13 +9809,13 @@ static double Usr_GetNumUsrsPerCrs (Hie_Lvl_Level_t Scope,long Cod,Rol_Role_t Ro
|
|||
DB_QuerySELECT (&mysql_res,"can not get number of users per course",
|
||||
"SELECT AVG(NumUsrs) FROM "
|
||||
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
|
||||
" FROM institutions,"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_usr"
|
||||
" WHERE institutions.CtyCod=%ld"
|
||||
" AND institutions.InsCod=ctr_centers.InsCod"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_usr.CrsCod"
|
||||
|
|
Loading…
Reference in New Issue