mirror of https://github.com/acanas/swad-core.git
Version 21.10: Sep 20, 2021 New module swad_indicator_database for database queries related to course indicators.
This commit is contained in:
parent
92d5644eca
commit
61385a0565
6
Makefile
6
Makefile
|
@ -55,9 +55,9 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \
|
||||||
swad_group_database.o swad_help.o swad_hierarchy.o \
|
swad_group_database.o swad_help.o swad_hierarchy.o \
|
||||||
swad_hierarchy_config.o swad_hierarchy_database.o swad_holiday.o \
|
swad_hierarchy_config.o swad_hierarchy_database.o swad_holiday.o \
|
||||||
swad_holiday_database.o swad_HTML.o \
|
swad_holiday_database.o swad_HTML.o \
|
||||||
swad_icon.o swad_ID.o swad_ID_database.o swad_indicator.o swad_info.o \
|
swad_icon.o swad_ID.o swad_ID_database.o swad_indicator.o \
|
||||||
swad_institution.o swad_institution_config.o \
|
swad_indicator_database.o swad_info.o swad_institution.o \
|
||||||
swad_institution_database.o \
|
swad_institution_config.o swad_institution_database.o \
|
||||||
swad_language.o swad_layout.o swad_link.o swad_log.o swad_logo.o \
|
swad_language.o swad_layout.o swad_link.o swad_log.o swad_logo.o \
|
||||||
swad_MAC.o swad_mail.o swad_main.o swad_maintenance.o swad_map.o \
|
swad_MAC.o swad_mail.o swad_main.o swad_maintenance.o swad_map.o \
|
||||||
swad_mark.o swad_match.o swad_match_print.o swad_match_result.o \
|
swad_mark.o swad_match.o swad_match_print.o swad_match_result.o \
|
||||||
|
|
|
@ -602,13 +602,17 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 21.9.1 (2021-09-20)"
|
#define Log_PLATFORM_VERSION "SWAD 21.10 (2021-09-20)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.69.1.js"
|
#define JS_FILE "swad20.69.1.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
TODO: Un profesor no puede confirmar DNIs
|
||||||
|
TODO: Al cambiar un estudiante en una asignatura, dice que el rol ha cambiado de desconocido a estudiante
|
||||||
|
|
||||||
|
Version 21.10: Sep 20, 2021 New module swad_indicator_database for database queries related to course indicators. (316112 lines)
|
||||||
Version 21.9.1: Sep 20, 2021 Queries moved to module swad_browser_database. (316023 lines)
|
Version 21.9.1: Sep 20, 2021 Queries moved to module swad_browser_database. (316023 lines)
|
||||||
Version 21.9: Sep 20, 2021 New module swad_ID_database for database queries related to user's IDs. (316021 lines)
|
Version 21.9: Sep 20, 2021 New module swad_ID_database for database queries related to user's IDs. (316021 lines)
|
||||||
Version 21.8.1: Sep 20, 2021 Queries moved to module swad_holiday_database. (315927 lines)
|
Version 21.8.1: Sep 20, 2021 Queries moved to module swad_holiday_database. (315927 lines)
|
||||||
|
|
336
swad_indicator.c
336
swad_indicator.c
|
@ -41,6 +41,7 @@
|
||||||
#include "swad_hierarchy_level.h"
|
#include "swad_hierarchy_level.h"
|
||||||
#include "swad_HTML.h"
|
#include "swad_HTML.h"
|
||||||
#include "swad_indicator.h"
|
#include "swad_indicator.h"
|
||||||
|
#include "swad_indicator_database.h"
|
||||||
#include "swad_message.h"
|
#include "swad_message.h"
|
||||||
#include "swad_parameter.h"
|
#include "swad_parameter.h"
|
||||||
#include "swad_theme.h"
|
#include "swad_theme.h"
|
||||||
|
@ -71,8 +72,6 @@ typedef enum
|
||||||
|
|
||||||
static void Ind_GetParamsIndicators (struct Ind_Indicators *Indicators);
|
static void Ind_GetParamsIndicators (struct Ind_Indicators *Indicators);
|
||||||
static void Ind_GetParamNumIndicators (struct Ind_Indicators *Indicators);
|
static void Ind_GetParamNumIndicators (struct Ind_Indicators *Indicators);
|
||||||
static unsigned Ind_DB_GetTableOfCourses (const struct Ind_Indicators *Indicators,
|
|
||||||
MYSQL_RES **mysql_res);
|
|
||||||
static bool Ind_GetIfShowBigList (struct Ind_Indicators *Indicators,
|
static bool Ind_GetIfShowBigList (struct Ind_Indicators *Indicators,
|
||||||
unsigned NumCrss);
|
unsigned NumCrss);
|
||||||
static void Ind_PutButtonToConfirmIWantToSeeBigList (struct Ind_Indicators *Indicators,
|
static void Ind_PutButtonToConfirmIWantToSeeBigList (struct Ind_Indicators *Indicators,
|
||||||
|
@ -88,7 +87,6 @@ static void Ind_ShowTableOfCoursesWithIndicators (const struct Ind_Indicators *I
|
||||||
Ind_IndicatorsLayout_t IndicatorsLayout,
|
Ind_IndicatorsLayout_t IndicatorsLayout,
|
||||||
unsigned NumCrss,MYSQL_RES *mysql_res);
|
unsigned NumCrss,MYSQL_RES *mysql_res);
|
||||||
static unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod);
|
static unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod);
|
||||||
static void Ind_DB_StoreIndicatorsCrs (long CrsCod,unsigned NumIndicators);
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Request showing statistics of courses *******************/
|
/******************* Request showing statistics of courses *******************/
|
||||||
|
@ -179,7 +177,7 @@ void Ind_ReqIndicatorsCourses (void)
|
||||||
If Indicators.NumIndicators >= 0 ==> only those courses in result
|
If Indicators.NumIndicators >= 0 ==> only those courses in result
|
||||||
with Indicators.NumIndicators set to yes
|
with Indicators.NumIndicators set to yes
|
||||||
will be listed */
|
will be listed */
|
||||||
NumCrss = Ind_DB_GetTableOfCourses (&Indicators,&mysql_res);
|
NumCrss = Ind_DB_GetTableOfCourses (&mysql_res,&Indicators);
|
||||||
|
|
||||||
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
||||||
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
||||||
|
@ -273,7 +271,7 @@ void Ind_ShowIndicatorsCourses (void)
|
||||||
Ind_GetParamsIndicators (&Indicators);
|
Ind_GetParamsIndicators (&Indicators);
|
||||||
|
|
||||||
/***** Get courses from database *****/
|
/***** Get courses from database *****/
|
||||||
NumCrss = Ind_DB_GetTableOfCourses (&Indicators,&mysql_res);
|
NumCrss = Ind_DB_GetTableOfCourses (&mysql_res,&Indicators);
|
||||||
|
|
||||||
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
||||||
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
||||||
|
@ -336,313 +334,6 @@ static void Ind_GetParamNumIndicators (struct Ind_Indicators *Indicators)
|
||||||
Indicators->IndicatorsSelected[Ind] = true;
|
Indicators->IndicatorsSelected[Ind] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******************* Build query to get table of courses *********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
// Return the number of courses found
|
|
||||||
|
|
||||||
static unsigned Ind_DB_GetTableOfCourses (const struct Ind_Indicators *Indicators,
|
|
||||||
MYSQL_RES **mysql_res)
|
|
||||||
{
|
|
||||||
unsigned NumCrss = 0; // Initialized to avoid warning
|
|
||||||
|
|
||||||
switch (Gbl.Scope.Current)
|
|
||||||
{
|
|
||||||
case HieLvl_SYS:
|
|
||||||
if (Indicators->DptCod >= 0) // 0 means another department
|
|
||||||
{
|
|
||||||
if (Indicators->DegTypCod > 0)
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT DISTINCTROW "
|
|
||||||
"deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses,"
|
|
||||||
"crs_users,"
|
|
||||||
"usr_data"
|
|
||||||
" WHERE deg_degrees.DegTypCod=%ld"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
|
||||||
" AND crs_users.Role=%u"
|
|
||||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
|
||||||
" AND usr_data.DptCod=%ld"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Indicators->DegTypCod,
|
|
||||||
(unsigned) Rol_TCH,
|
|
||||||
Indicators->DptCod);
|
|
||||||
else
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT DISTINCTROW "
|
|
||||||
"deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses,"
|
|
||||||
"crs_users,"
|
|
||||||
"usr_data"
|
|
||||||
" WHERE deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
|
||||||
" AND crs_users.Role=%u"
|
|
||||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
|
||||||
" AND usr_data.DptCod=%ld"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
(unsigned) Rol_TCH,
|
|
||||||
Indicators->DptCod);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Indicators->DegTypCod > 0)
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses"
|
|
||||||
" WHERE deg_degrees.DegTypCod=%ld"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Indicators->DegTypCod);
|
|
||||||
else
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses"
|
|
||||||
" WHERE deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case HieLvl_CTY:
|
|
||||||
if (Indicators->DptCod >= 0) // 0 means another department
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT DISTINCTROW "
|
|
||||||
"deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM ins_instits,"
|
|
||||||
"ctr_centers,"
|
|
||||||
"deg_degrees,"
|
|
||||||
"crs_courses,"
|
|
||||||
"crs_users,"
|
|
||||||
"usr_data"
|
|
||||||
" 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_users.CrsCod"
|
|
||||||
" AND crs_users.Role=%u"
|
|
||||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
|
||||||
" AND usr_data.DptCod=%ld"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Cty.CtyCod,
|
|
||||||
(unsigned) Rol_TCH,
|
|
||||||
Indicators->DptCod);
|
|
||||||
else
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM ins_instits,"
|
|
||||||
"ctr_centers,"
|
|
||||||
"deg_degrees,"
|
|
||||||
"crs_courses"
|
|
||||||
" 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,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Cty.CtyCod);
|
|
||||||
break;
|
|
||||||
case HieLvl_INS:
|
|
||||||
if (Indicators->DptCod >= 0) // 0 means another department
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT DISTINCTROW "
|
|
||||||
"deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM ctr_centers,"
|
|
||||||
"deg_degrees,"
|
|
||||||
"crs_courses,"
|
|
||||||
"crs_users,"
|
|
||||||
"usr_data"
|
|
||||||
" WHERE ctr_centers.InsCod=%ld"
|
|
||||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
|
||||||
" AND crs_users.Role=%u"
|
|
||||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
|
||||||
" AND usr_data.DptCod=%ld"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Ins.InsCod,
|
|
||||||
(unsigned) Rol_TCH,
|
|
||||||
Indicators->DptCod);
|
|
||||||
else
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM ctr_centers,"
|
|
||||||
"deg_degrees,"
|
|
||||||
"crs_courses"
|
|
||||||
" WHERE ctr_centers.InsCod=%ld"
|
|
||||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Ins.InsCod);
|
|
||||||
break;
|
|
||||||
case HieLvl_CTR:
|
|
||||||
if (Indicators->DptCod >= 0) // 0 means another department
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT DISTINCTROW "
|
|
||||||
"deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses,"
|
|
||||||
"crs_users,"
|
|
||||||
"usr_data"
|
|
||||||
" WHERE deg_degrees.CtrCod=%ld"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
|
||||||
" AND crs_users.Role=%u"
|
|
||||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
|
||||||
" AND usr_data.DptCod=%ld"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Ctr.CtrCod,
|
|
||||||
(unsigned) Rol_TCH,
|
|
||||||
Indicators->DptCod);
|
|
||||||
else
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses"
|
|
||||||
" WHERE deg_degrees.CtrCod=%ld"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Ctr.CtrCod);
|
|
||||||
break;
|
|
||||||
case HieLvl_DEG:
|
|
||||||
if (Indicators->DptCod >= 0) // 0 means another department
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT DISTINCTROW "
|
|
||||||
"deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses,"
|
|
||||||
"crs_users,"
|
|
||||||
"usr_data"
|
|
||||||
" WHERE deg_degrees.DegCod=%ld"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
|
||||||
" AND crs_users.Role=%u"
|
|
||||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
|
||||||
" AND usr_data.DptCod=%ld"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Deg.DegCod,
|
|
||||||
(unsigned) Rol_TCH,
|
|
||||||
Indicators->DptCod);
|
|
||||||
else
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses"
|
|
||||||
" WHERE deg_degrees.DegCod=%ld"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Deg.DegCod);
|
|
||||||
break;
|
|
||||||
case HieLvl_CRS:
|
|
||||||
if (Indicators->DptCod >= 0) // 0 means another department
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT DISTINCTROW "
|
|
||||||
"deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses,"
|
|
||||||
"crs_users,"
|
|
||||||
"usr_data"
|
|
||||||
" WHERE crs_courses.CrsCod=%ld"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
|
||||||
" AND crs_users.CrsCod=%ld"
|
|
||||||
" AND crs_users.Role=%u"
|
|
||||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
|
||||||
" AND usr_data.DptCod=%ld"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
|
||||||
(unsigned) Rol_TCH,
|
|
||||||
Indicators->DptCod);
|
|
||||||
else
|
|
||||||
NumCrss = (unsigned)
|
|
||||||
DB_QuerySELECT (mysql_res,"can not get courses",
|
|
||||||
"SELECT deg_degrees.FullName," // row[0]
|
|
||||||
"crs_courses.FullName," // row[1]
|
|
||||||
"crs_courses.CrsCod," // row[2]
|
|
||||||
"crs_courses.InsCrsCod" // row[3]
|
|
||||||
" FROM deg_degrees,"
|
|
||||||
"crs_courses"
|
|
||||||
" WHERE crs_courses.CrsCod=%ld"
|
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
|
||||||
" ORDER BY deg_degrees.FullName,"
|
|
||||||
"crs_courses.FullName",
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Err_WrongScopeExit ();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NumCrss;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******* Show form to confirm that I want to see a big list of courses *******/
|
/******* Show form to confirm that I want to see a big list of courses *******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1374,11 +1065,7 @@ int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
|
||||||
int NumIndicatorsFromDB = -1; // -1 means not yet calculated
|
int NumIndicatorsFromDB = -1; // -1 means not yet calculated
|
||||||
|
|
||||||
/***** Get number of indicators of a course from database *****/
|
/***** Get number of indicators of a course from database *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get number of indicators",
|
if (Ind_DB_GetNumIndicatorsCrs (&mysql_res,CrsCod))
|
||||||
"SELECT NumIndicators" // row[0]
|
|
||||||
" FROM crs_courses"
|
|
||||||
" WHERE CrsCod=%ld",
|
|
||||||
CrsCod))
|
|
||||||
{
|
{
|
||||||
/***** Get row *****/
|
/***** Get row *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
@ -1394,21 +1081,6 @@ int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
|
||||||
return NumIndicatorsFromDB;
|
return NumIndicatorsFromDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Store number of indicators of a course in database *************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Ind_DB_StoreIndicatorsCrs (long CrsCod,unsigned NumIndicators)
|
|
||||||
{
|
|
||||||
/***** Store number of indicators of a course in database *****/
|
|
||||||
DB_QueryUPDATE ("can not store number of indicators of a course",
|
|
||||||
"UPDATE crs_courses"
|
|
||||||
" SET NumIndicators=%u"
|
|
||||||
" WHERE CrsCod=%ld",
|
|
||||||
NumIndicators,
|
|
||||||
CrsCod);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Compute indicators of a course ************************/
|
/********************* Compute indicators of a course ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
/********************************* Headers ***********************************/
|
/********************************* Headers ***********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include "swad_info.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************** Public types and constants ***********************/
|
/************************** Public types and constants ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -0,0 +1,391 @@
|
||||||
|
// swad_indicators_database.c: indicators of courses, operations with database
|
||||||
|
|
||||||
|
/*
|
||||||
|
SWAD (Shared Workspace At a Distance),
|
||||||
|
is a web platform developed at the University of Granada (Spain),
|
||||||
|
and used to support university teaching.
|
||||||
|
|
||||||
|
This file is part of SWAD core.
|
||||||
|
Copyright (C) 1999-2021 Antonio Cañas Vargas
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************************* Headers ***********************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
// #include <stddef.h> // For NULL
|
||||||
|
#include <mysql/mysql.h> // To access MySQL databases
|
||||||
|
|
||||||
|
// #include "swad_action.h"
|
||||||
|
// #include "swad_assignment_database.h"
|
||||||
|
// #include "swad_box.h"
|
||||||
|
// #include "swad_browser_database.h"
|
||||||
|
#include "swad_database.h"
|
||||||
|
// #include "swad_department.h"
|
||||||
|
#include "swad_error.h"
|
||||||
|
// #include "swad_form.h"
|
||||||
|
// #include "swad_forum_database.h"
|
||||||
|
#include "swad_global.h"
|
||||||
|
// #include "swad_hierarchy_level.h"
|
||||||
|
// #include "swad_HTML.h"
|
||||||
|
#include "swad_indicator.h"
|
||||||
|
// #include "swad_message.h"
|
||||||
|
// #include "swad_parameter.h"
|
||||||
|
// #include "swad_theme.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************** External global variables from others modules ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
extern struct Globals Gbl;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************************** Private constants ******************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************************* Private types *******************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Private prototypes ****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Store number of indicators of a course in database *************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Ind_DB_StoreIndicatorsCrs (long CrsCod,unsigned NumIndicators)
|
||||||
|
{
|
||||||
|
/***** Store number of indicators of a course in database *****/
|
||||||
|
DB_QueryUPDATE ("can not store number of indicators of a course",
|
||||||
|
"UPDATE crs_courses"
|
||||||
|
" SET NumIndicators=%u"
|
||||||
|
" WHERE CrsCod=%ld",
|
||||||
|
NumIndicators,
|
||||||
|
CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Get number of indicators of a course from database *************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// This function returns -1 if number of indicators is not yet calculated
|
||||||
|
|
||||||
|
unsigned Ind_DB_GetNumIndicatorsCrs (MYSQL_RES **mysql_res,long CrsCod)
|
||||||
|
{
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get number of indicators",
|
||||||
|
"SELECT NumIndicators" // row[0]
|
||||||
|
" FROM crs_courses"
|
||||||
|
" WHERE CrsCod=%ld",
|
||||||
|
CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************* Build query to get table of courses *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// Return the number of courses found
|
||||||
|
|
||||||
|
unsigned Ind_DB_GetTableOfCourses (MYSQL_RES **mysql_res,
|
||||||
|
const struct Ind_Indicators *Indicators)
|
||||||
|
{
|
||||||
|
switch (Gbl.Scope.Current)
|
||||||
|
{
|
||||||
|
case HieLvl_SYS:
|
||||||
|
if (Indicators->DptCod >= 0) // 0 means another department
|
||||||
|
{
|
||||||
|
if (Indicators->DegTypCod > 0)
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT DISTINCTROW "
|
||||||
|
"deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE deg_degrees.DegTypCod=%ld"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.Role=%u"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND usr_data.DptCod=%ld"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Indicators->DegTypCod,
|
||||||
|
(unsigned) Rol_TCH,
|
||||||
|
Indicators->DptCod);
|
||||||
|
else
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT DISTINCTROW "
|
||||||
|
"deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.Role=%u"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND usr_data.DptCod=%ld"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
(unsigned) Rol_TCH,
|
||||||
|
Indicators->DptCod);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Indicators->DegTypCod > 0)
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses"
|
||||||
|
" WHERE deg_degrees.DegTypCod=%ld"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Indicators->DegTypCod);
|
||||||
|
else
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses"
|
||||||
|
" WHERE deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName");
|
||||||
|
}
|
||||||
|
case HieLvl_CTY:
|
||||||
|
if (Indicators->DptCod >= 0) // 0 means another department
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT DISTINCTROW "
|
||||||
|
"deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM ins_instits,"
|
||||||
|
"ctr_centers,"
|
||||||
|
"deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" 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_users.CrsCod"
|
||||||
|
" AND crs_users.Role=%u"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND usr_data.DptCod=%ld"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Cty.CtyCod,
|
||||||
|
(unsigned) Rol_TCH,
|
||||||
|
Indicators->DptCod);
|
||||||
|
else
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM ins_instits,"
|
||||||
|
"ctr_centers,"
|
||||||
|
"deg_degrees,"
|
||||||
|
"crs_courses"
|
||||||
|
" 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,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Cty.CtyCod);
|
||||||
|
case HieLvl_INS:
|
||||||
|
if (Indicators->DptCod >= 0) // 0 means another department
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT DISTINCTROW "
|
||||||
|
"deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM ctr_centers,"
|
||||||
|
"deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE ctr_centers.InsCod=%ld"
|
||||||
|
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.Role=%u"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND usr_data.DptCod=%ld"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Ins.InsCod,
|
||||||
|
(unsigned) Rol_TCH,
|
||||||
|
Indicators->DptCod);
|
||||||
|
else
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM ctr_centers,"
|
||||||
|
"deg_degrees,"
|
||||||
|
"crs_courses"
|
||||||
|
" WHERE ctr_centers.InsCod=%ld"
|
||||||
|
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Ins.InsCod);
|
||||||
|
case HieLvl_CTR:
|
||||||
|
if (Indicators->DptCod >= 0) // 0 means another department
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT DISTINCTROW "
|
||||||
|
"deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE deg_degrees.CtrCod=%ld"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.Role=%u"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND usr_data.DptCod=%ld"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Ctr.CtrCod,
|
||||||
|
(unsigned) Rol_TCH,
|
||||||
|
Indicators->DptCod);
|
||||||
|
else
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses"
|
||||||
|
" WHERE deg_degrees.CtrCod=%ld"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Ctr.CtrCod);
|
||||||
|
case HieLvl_DEG:
|
||||||
|
if (Indicators->DptCod >= 0) // 0 means another department
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT DISTINCTROW "
|
||||||
|
"deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE deg_degrees.DegCod=%ld"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.Role=%u"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND usr_data.DptCod=%ld"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Deg.DegCod,
|
||||||
|
(unsigned) Rol_TCH,
|
||||||
|
Indicators->DptCod);
|
||||||
|
else
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses"
|
||||||
|
" WHERE deg_degrees.DegCod=%ld"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Deg.DegCod);
|
||||||
|
case HieLvl_CRS:
|
||||||
|
if (Indicators->DptCod >= 0) // 0 means another department
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT DISTINCTROW "
|
||||||
|
"deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses,"
|
||||||
|
"crs_users,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE crs_courses.CrsCod=%ld"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||||
|
" AND crs_users.CrsCod=%ld"
|
||||||
|
" AND crs_users.Role=%u"
|
||||||
|
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||||
|
" AND usr_data.DptCod=%ld"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
|
(unsigned) Rol_TCH,
|
||||||
|
Indicators->DptCod);
|
||||||
|
else
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get courses",
|
||||||
|
"SELECT deg_degrees.FullName," // row[0]
|
||||||
|
"crs_courses.FullName," // row[1]
|
||||||
|
"crs_courses.CrsCod," // row[2]
|
||||||
|
"crs_courses.InsCrsCod" // row[3]
|
||||||
|
" FROM deg_degrees,"
|
||||||
|
"crs_courses"
|
||||||
|
" WHERE crs_courses.CrsCod=%ld"
|
||||||
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
" ORDER BY deg_degrees.FullName,"
|
||||||
|
"crs_courses.FullName",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
default:
|
||||||
|
Err_WrongScopeExit ();
|
||||||
|
return 0; // Not reached
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
// swad_indicator_database.h: indicators of courses, operations with database
|
||||||
|
|
||||||
|
#ifndef _SWAD_IND_DB
|
||||||
|
#define _SWAD_IND_DB
|
||||||
|
/*
|
||||||
|
SWAD (Shared Workspace At a Distance in Spanish),
|
||||||
|
is a web platform developed at the University of Granada (Spain),
|
||||||
|
and used to support university teaching.
|
||||||
|
|
||||||
|
This file is part of SWAD core.
|
||||||
|
Copyright (C) 1999-2021 Antonio Cañas Vargas
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************************* Headers ***********************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************** Public types and constants ***********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Public prototypes *****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Ind_DB_StoreIndicatorsCrs (long CrsCod,unsigned NumIndicators);
|
||||||
|
unsigned Ind_DB_GetNumIndicatorsCrs (MYSQL_RES **mysql_res,long CrsCod);
|
||||||
|
|
||||||
|
unsigned Ind_DB_GetTableOfCourses (MYSQL_RES **mysql_res,
|
||||||
|
const struct Ind_Indicators *Indicators);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue