swad-core/swad_indicator.c

1509 lines
55 KiB
C
Raw Normal View History

2014-12-01 23:55:08 +01:00
// swad_indicators.c: indicators of courses
/*
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.
2020-01-01 14:53:57 +01:00
Copyright (C) 1999-2020 Antonio Ca<EFBFBD>as Vargas
2014-12-01 23:55:08 +01:00
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 ***********************************/
/*****************************************************************************/
2019-12-29 12:39:00 +01:00
#include <stddef.h> // For NULL
2014-12-01 23:55:08 +01:00
#include <mysql/mysql.h> // To access MySQL databases
#include "swad_action.h"
2017-06-10 21:38:10 +02:00
#include "swad_box.h"
2014-12-01 23:55:08 +01:00
#include "swad_database.h"
2018-11-09 20:47:39 +01:00
#include "swad_form.h"
#include "swad_forum.h"
2014-12-01 23:55:08 +01:00
#include "swad_global.h"
2019-10-23 19:05:05 +02:00
#include "swad_HTML.h"
2014-12-01 23:55:08 +01:00
#include "swad_indicator.h"
#include "swad_parameter.h"
#include "swad_theme.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
2019-11-21 16:47:07 +01:00
/**************************** Private constants ******************************/
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/*****************************************************************************/
2019-11-21 16:47:07 +01:00
/******************************* Private types *******************************/
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
typedef enum
{
Ind_INDICATORS_BRIEF,
Ind_INDICATORS_FULL,
} Ind_IndicatorsLayout_t;
/*****************************************************************************/
2019-11-21 16:47:07 +01:00
/***************************** Private prototypes ****************************/
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
2016-06-09 18:04:18 +02:00
static void Ind_GetParamsIndicators (void);
2016-06-08 14:14:31 +02:00
static void Ind_GetParamNumIndicators (void);
2014-12-01 23:55:08 +01:00
static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res);
static bool Ind_GetIfShowBigList (unsigned NumCrss);
static void Ind_PutButtonToConfirmIWantToSeeBigList (unsigned NumCrss);
2017-05-25 14:25:22 +02:00
static void Ind_PutParamsConfirmIWantToSeeBigList (void);
2016-06-04 19:16:21 +02:00
2017-01-28 15:58:46 +01:00
static void Ind_GetNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS],
2016-06-04 19:16:21 +02:00
unsigned NumCrss,MYSQL_RES *mysql_res);
2017-01-28 15:58:46 +01:00
static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS],
2016-06-08 13:19:17 +02:00
unsigned NumCrss,bool PutForm);
2016-06-04 19:16:21 +02:00
static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t IndicatorsLayout,
unsigned NumCrss,MYSQL_RES *mysql_res);
2016-06-10 10:22:22 +02:00
static unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod);
2016-06-09 14:00:10 +02:00
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators);
2016-06-08 18:41:32 +02:00
static unsigned long Ind_GetNumFilesInDocumZonesOfCrsFromDB (long CrsCod);
static unsigned long Ind_GetNumFilesInShareZonesOfCrsFromDB (long CrsCod);
static unsigned long Ind_GetNumFilesInAssigZonesOfCrsFromDB (long CrsCod);
static unsigned long Ind_GetNumFilesInWorksZonesOfCrsFromDB (long CrsCod);
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/******************* Request showing statistics of courses *******************/
/*****************************************************************************/
void Ind_ReqIndicatorsCourses (void)
{
2017-12-19 18:41:19 +01:00
extern const char *Hlp_ANALYTICS_Indicators;
2019-02-22 21:47:50 +01:00
extern const char *The_ClassFormInBox[The_NUM_THEMES];
2014-12-01 23:55:08 +01:00
extern const char *Txt_Scope;
extern const char *Txt_Types_of_degree;
extern const char *Txt_only_if_the_scope_is_X;
extern const char *Txt_Department;
2017-10-10 10:46:35 +02:00
extern const char *Txt_Any_department;
2014-12-01 23:55:08 +01:00
extern const char *Txt_No_of_indicators;
extern const char *Txt_Indicators_of_courses;
extern const char *Txt_Show_more_details;
MYSQL_RES *mysql_res;
unsigned NumCrss;
2017-01-28 15:58:46 +01:00
unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS];
2016-06-04 19:16:21 +02:00
unsigned NumCrssToList;
2016-06-08 14:14:31 +02:00
unsigned Ind;
2014-12-01 23:55:08 +01:00
2016-06-09 17:19:10 +02:00
/***** Get parameters *****/
2016-06-09 18:04:18 +02:00
Ind_GetParamsIndicators ();
2016-06-09 17:56:57 +02:00
2019-10-26 02:19:42 +02:00
/***** Begin box *****/
2019-10-25 22:48:34 +02:00
Box_BoxBegin (NULL,Txt_Indicators_of_courses,NULL,
2017-12-19 18:41:19 +01:00
Hlp_ANALYTICS_Indicators,Box_NOT_CLOSABLE);
2015-03-24 19:41:54 +01:00
2014-12-01 23:55:08 +01:00
/***** Form to update indicators *****/
2019-10-20 22:00:28 +02:00
/* Begin form and table */
2018-11-09 20:47:39 +01:00
Frm_StartForm (ActReqStaCrs);
2019-10-23 19:05:05 +02:00
HTM_TABLE_BeginWidePadding (2);
2014-12-01 23:55:08 +01:00
2016-06-08 15:03:06 +02:00
/* Scope */
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 15:15:55 +02:00
2019-12-27 21:10:39 +01:00
/* Label */
2019-12-27 15:45:19 +01:00
Frm_LabelColumn ("RT","ScopeInd",Txt_Scope);
2019-10-07 15:15:55 +02:00
2019-12-27 21:10:39 +01:00
/* Data */
2019-12-26 22:29:04 +01:00
HTM_TD_Begin ("class=\"LT\"");
2016-06-24 20:34:58 +02:00
Sco_PutSelectorScope ("ScopeInd",true);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2014-12-01 23:55:08 +01:00
/* Compute stats for a type of degree */
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 15:15:55 +02:00
2019-12-27 21:10:39 +01:00
/* Label */
2019-12-27 15:45:19 +01:00
Frm_LabelColumn ("RT","OthDegTypCod",Txt_Types_of_degree);
2019-10-07 15:15:55 +02:00
2019-12-27 21:10:39 +01:00
/* Data */
2019-12-26 22:29:04 +01:00
HTM_TD_Begin ("class=\"DAT LT\"");
2016-03-20 22:31:57 +01:00
DT_WriteSelectorDegreeTypes ();
2019-11-11 00:15:44 +01:00
HTM_Txt (" (");
HTM_TxtF (Txt_only_if_the_scope_is_X,Cfg_PLATFORM_SHORT_NAME);
2019-11-10 13:51:07 +01:00
HTM_Txt (")");
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2014-12-01 23:55:08 +01:00
/* Compute stats for courses with teachers belonging to any department or to a particular departament? */
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 15:15:55 +02:00
2019-12-27 21:10:39 +01:00
/* Label */
2019-12-27 15:45:19 +01:00
Frm_LabelColumn ("RT",Dpt_PARAM_DPT_COD_NAME,Txt_Department);
2019-10-07 15:15:55 +02:00
2019-12-27 21:10:39 +01:00
/* Data */
2019-12-27 15:45:19 +01:00
HTM_TD_Begin ("class=\"LT\"");
2019-04-03 20:57:04 +02:00
Dpt_WriteSelectorDepartment (Gbl.Hierarchy.Ins.InsCod, // Departments in current insitution
2017-10-10 10:46:35 +02:00
Gbl.Stat.DptCod, // Selected department
2018-10-08 14:11:21 +02:00
"INDICATORS_INPUT", // Selector class
2017-10-10 10:46:35 +02:00
-1L, // First option
Txt_Any_department, // Text when no department selected
true); // Submit on change
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2014-12-01 23:55:08 +01:00
2016-06-08 15:03:06 +02:00
/***** Get courses from database *****/
/* The result will contain courses with any number of indicators
If Gbl.Stat.NumIndicators < 0 ==> all courses in result will be listed
If Gbl.Stat.NumIndicators >= 0 ==> only those courses in result
with Gbl.Stat.NumIndicators set to yes
will be listed */
NumCrss = Ind_GetTableOfCourses (&mysql_res);
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
2016-06-08 13:26:19 +02:00
/* Selection of the number of indicators */
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"RT %s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
2019-11-11 10:59:24 +01:00
HTM_TxtF ("%s:",Txt_No_of_indicators);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"LT\"");
2016-06-08 13:19:17 +02:00
Ind_ShowNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,true);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2014-12-01 23:55:08 +01:00
2017-05-13 00:08:22 +02:00
/* End table and form */
2019-10-23 19:05:05 +02:00
HTM_TABLE_End ();
2018-11-09 20:47:39 +01:00
Frm_EndForm ();
2014-12-01 23:55:08 +01:00
2016-06-08 13:19:17 +02:00
/***** Show the stats of courses *****/
2016-06-08 14:14:31 +02:00
for (Ind = 0, NumCrssToList = 0;
Ind <= Ind_NUM_INDICATORS;
Ind++)
if (Gbl.Stat.IndicatorsSelected[Ind])
NumCrssToList += NumCrssWithIndicatorYes[Ind];
2016-06-04 19:16:21 +02:00
if (Ind_GetIfShowBigList (NumCrssToList))
2014-12-01 23:55:08 +01:00
{
/* Show table */
Ind_ShowTableOfCoursesWithIndicators (Ind_INDICATORS_BRIEF,NumCrss,mysql_res);
/* Button to show more details */
2018-11-09 20:47:39 +01:00
Frm_StartForm (ActSeeAllStaCrs);
2016-06-24 20:34:58 +02:00
Sco_PutParamScope ("ScopeInd",Gbl.Scope.Current);
2019-11-03 13:19:32 +01:00
Par_PutHiddenParamLong (NULL,"OthDegTypCod",Gbl.Stat.DegTypCod);
Par_PutHiddenParamLong (NULL,Dpt_PARAM_DPT_COD_NAME,Gbl.Stat.DptCod);
2016-06-08 14:14:31 +02:00
if (Gbl.Stat.StrIndicatorsSelected[0])
2019-11-03 13:19:32 +01:00
Par_PutHiddenParamString (NULL,"Indicators",Gbl.Stat.StrIndicatorsSelected);
2017-06-11 19:02:40 +02:00
Btn_PutConfirmButton (Txt_Show_more_details);
2018-11-09 20:47:39 +01:00
Frm_EndForm ();
2014-12-01 23:55:08 +01:00
}
2017-06-12 14:16:33 +02:00
/***** End box *****/
2019-10-25 22:48:34 +02:00
Box_BoxEnd ();
2015-03-24 19:41:54 +01:00
2014-12-01 23:55:08 +01:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/
2016-06-09 18:04:18 +02:00
/************* Get parameters related to indicators of courses ***************/
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
2016-06-09 18:04:18 +02:00
static void Ind_GetParamsIndicators (void)
2014-12-01 23:55:08 +01:00
{
2016-06-09 18:04:18 +02:00
/***** Get scope *****/
2019-04-03 20:57:04 +02:00
Gbl.Scope.Allowed = 1 << Hie_SYS |
1 << Hie_CTY |
1 << Hie_INS |
1 << Hie_CTR |
1 << Hie_DEG |
1 << Hie_CRS;
Gbl.Scope.Default = Hie_CRS;
2016-06-24 20:34:58 +02:00
Sco_GetScope ("ScopeInd");
2014-12-01 23:55:08 +01:00
/***** Get degree type code *****/
2019-04-03 20:57:04 +02:00
Gbl.Stat.DegTypCod = (Gbl.Scope.Current == Hie_SYS) ?
2017-05-31 21:05:59 +02:00
DT_GetAndCheckParamOtherDegTypCod (-1L) : // -1L (any degree type) is allowed here
-1L;
2014-12-01 23:55:08 +01:00
/***** Get department code *****/
2017-05-31 21:05:59 +02:00
Gbl.Stat.DptCod = Dpt_GetAndCheckParamDptCod (-1L); // -1L (any department) is allowed here
2014-12-01 23:55:08 +01:00
/***** Get number of indicators *****/
2016-06-08 14:14:31 +02:00
Ind_GetParamNumIndicators ();
2016-06-09 18:04:18 +02:00
}
/*****************************************************************************/
/*********************** Show statistics of courses **************************/
/*****************************************************************************/
void Ind_ShowIndicatorsCourses (void)
{
MYSQL_RES *mysql_res;
unsigned NumCrss;
2017-01-28 15:58:46 +01:00
unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS];
2016-06-09 18:04:18 +02:00
/***** Get parameters *****/
Ind_GetParamsIndicators ();
2014-12-01 23:55:08 +01:00
/***** Get courses from database *****/
NumCrss = Ind_GetTableOfCourses (&mysql_res);
2016-06-04 19:16:21 +02:00
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
/***** Show table with numbers of courses with 0, 1, 2... indicators set to yes *****/
2016-06-08 13:19:17 +02:00
Ind_ShowNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,false);
2016-06-04 19:16:21 +02:00
2014-12-01 23:55:08 +01:00
/***** Show the stats of courses *****/
Ind_ShowTableOfCoursesWithIndicators (Ind_INDICATORS_FULL,NumCrss,mysql_res);
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/
/*************** Get parameter with the number of indicators *****************/
/*****************************************************************************/
2016-06-08 14:14:31 +02:00
static void Ind_GetParamNumIndicators (void)
2014-12-01 23:55:08 +01:00
{
2016-06-08 14:14:31 +02:00
unsigned Ind;
const char *Ptr;
2019-11-08 01:10:32 +01:00
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
2016-06-08 14:14:31 +02:00
long Indicator;
/***** Get parameter multiple with list of indicators selected *****/
Par_GetParMultiToText ("Indicators",Gbl.Stat.StrIndicatorsSelected,Ind_MAX_SIZE_INDICATORS_SELECTED);
2014-12-01 23:55:08 +01:00
2016-06-08 14:14:31 +02:00
/***** Set which indicators have been selected (checkboxes on) *****/
if (Gbl.Stat.StrIndicatorsSelected[0])
{
/* Reset all indicators */
for (Ind = 0;
Ind <= Ind_NUM_INDICATORS;
Ind++)
Gbl.Stat.IndicatorsSelected[Ind] = false;
/* Set indicators selected */
for (Ptr = Gbl.Stat.StrIndicatorsSelected;
*Ptr;
)
{
/* Get next indicator selected */
2019-11-08 01:10:32 +01:00
Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
2016-06-08 14:14:31 +02:00
Indicator = Str_ConvertStrCodToLongCod (LongStr);
/* Set each indicator in list StrIndicatorsSelected as selected */
for (Ind = 0;
Ind <= Ind_NUM_INDICATORS;
Ind++)
if ((long) Ind == Indicator)
Gbl.Stat.IndicatorsSelected[Ind] = true;
}
}
else
/* Set all indicators */
for (Ind = 0;
Ind <= Ind_NUM_INDICATORS;
Ind++)
Gbl.Stat.IndicatorsSelected[Ind] = true;
2014-12-01 23:55:08 +01:00
}
/*****************************************************************************/
/******************* Build query to get table of courses *********************/
/*****************************************************************************/
// Return the number of courses found
static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
{
2018-10-31 13:00:40 +01:00
unsigned NumCrss = 0; // Initialized to avoid warning
2014-12-01 23:55:08 +01:00
switch (Gbl.Scope.Current)
{
2019-04-03 20:57:04 +02:00
case Hie_SYS:
2017-10-10 10:46:35 +02:00
if (Gbl.Stat.DptCod >= 0) // 0 means another department
2014-12-01 23:55:08 +01:00
{
if (Gbl.Stat.DegTypCod > 0)
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.DegTypCod=%ld"
" AND degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role=%u"
" AND crs_usr.UsrCod=usr_data.UsrCod"
" AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName",
Gbl.Stat.DegTypCod,
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
2014-12-01 23:55:08 +01:00
else
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role=%u"
" AND crs_usr.UsrCod=usr_data.UsrCod"
" AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName",
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
2014-12-01 23:55:08 +01:00
}
else
{
if (Gbl.Stat.DegTypCod > 0)
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses"
" WHERE degrees.DegTypCod=%ld"
" AND degrees.DegCod=courses.DegCod"
" ORDER BY degrees.FullName,courses.FullName",
Gbl.Stat.DegTypCod);
2014-12-01 23:55:08 +01:00
else
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses"
" WHERE degrees.DegCod=courses.DegCod"
" ORDER BY degrees.FullName,courses.FullName");
2014-12-01 23:55:08 +01:00
}
break;
2019-04-03 20:57:04 +02:00
case Hie_CTY:
2017-10-10 10:46:35 +02:00
if (Gbl.Stat.DptCod >= 0) // 0 means another department
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM institutions,centres,degrees,courses,crs_usr,usr_data"
" WHERE institutions.CtyCod=%ld"
" AND institutions.InsCod=centres.InsCod"
" AND centres.CtrCod=degrees.CtrCod"
" AND degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role=%u"
" AND crs_usr.UsrCod=usr_data.UsrCod"
" AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-03 20:57:04 +02:00
Gbl.Hierarchy.Cty.CtyCod,
2018-10-31 13:00:40 +01:00
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
2015-03-24 19:41:54 +01:00
else
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM institutions,centres,degrees,courses"
" WHERE institutions.CtyCod=%ld"
" AND institutions.InsCod=centres.InsCod"
" AND centres.CtrCod=degrees.CtrCod"
" AND degrees.DegCod=courses.DegCod"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-03 20:57:04 +02:00
Gbl.Hierarchy.Cty.CtyCod);
2015-03-24 19:41:54 +01:00
break;
2019-04-03 20:57:04 +02:00
case Hie_INS:
2017-10-10 10:46:35 +02:00
if (Gbl.Stat.DptCod >= 0) // 0 means another department
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM centres,degrees,courses,crs_usr,usr_data"
" WHERE centres.InsCod=%ld"
" AND centres.CtrCod=degrees.CtrCod"
" AND degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role=%u"
" AND crs_usr.UsrCod=usr_data.UsrCod"
" AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-03 20:57:04 +02:00
Gbl.Hierarchy.Ins.InsCod,
2018-10-31 13:00:40 +01:00
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
2014-12-01 23:55:08 +01:00
else
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM centres,degrees,courses"
" WHERE centres.InsCod=%ld"
" AND centres.CtrCod=degrees.CtrCod"
" AND degrees.DegCod=courses.DegCod"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-03 20:57:04 +02:00
Gbl.Hierarchy.Ins.InsCod);
2014-12-01 23:55:08 +01:00
break;
2019-04-03 20:57:04 +02:00
case Hie_CTR:
2017-10-10 10:46:35 +02:00
if (Gbl.Stat.DptCod >= 0) // 0 means another department
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.CtrCod=%ld"
" AND degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role=%u"
" AND crs_usr.UsrCod=usr_data.UsrCod"
" AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-03 20:57:04 +02:00
Gbl.Hierarchy.Ctr.CtrCod,
2018-10-31 13:00:40 +01:00
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
2014-12-01 23:55:08 +01:00
else
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses"
" WHERE degrees.CtrCod=%ld"
" AND degrees.DegCod=courses.DegCod"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-03 20:57:04 +02:00
Gbl.Hierarchy.Ctr.CtrCod);
2014-12-01 23:55:08 +01:00
break;
2019-04-03 20:57:04 +02:00
case Hie_DEG:
2017-10-10 10:46:35 +02:00
if (Gbl.Stat.DptCod >= 0) // 0 means another department
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.DegCod=%ld"
" AND degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.Role=%u"
" AND crs_usr.UsrCod=usr_data.UsrCod"
" AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-03 20:57:04 +02:00
Gbl.Hierarchy.Deg.DegCod,
2018-10-31 13:00:40 +01:00
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
2014-12-01 23:55:08 +01:00
else
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses"
" WHERE degrees.DegCod=%ld"
" AND degrees.DegCod=courses.DegCod"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-03 20:57:04 +02:00
Gbl.Hierarchy.Deg.DegCod);
2014-12-01 23:55:08 +01:00
break;
2019-04-03 20:57:04 +02:00
case Hie_CRS:
2017-10-10 10:46:35 +02:00
if (Gbl.Stat.DptCod >= 0) // 0 means another department
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE courses.CrsCod=%ld"
" AND degrees.DegCod=courses.DegCod"
" AND courses.CrsCod=crs_usr.CrsCod"
" AND crs_usr.CrsCod=%ld"
" AND crs_usr.Role=%u"
" AND crs_usr.UsrCod=usr_data.UsrCod"
" AND usr_data.DptCod=%ld"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-04 10:45:15 +02:00
Gbl.Hierarchy.Crs.CrsCod,
Gbl.Hierarchy.Crs.CrsCod,
2018-10-31 13:00:40 +01:00
(unsigned) Rol_TCH,
Gbl.Stat.DptCod);
2014-12-01 23:55:08 +01:00
else
2018-10-31 13:00:40 +01:00
NumCrss =
(unsigned) DB_QuerySELECT (mysql_res,"can not get courses",
"SELECT degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses"
" WHERE courses.CrsCod=%ld"
" AND degrees.DegCod=courses.DegCod"
" ORDER BY degrees.FullName,courses.FullName",
2019-04-04 10:45:15 +02:00
Gbl.Hierarchy.Crs.CrsCod);
2014-12-01 23:55:08 +01:00
break;
default:
2018-10-24 23:03:11 +02:00
Lay_WrongScopeExit ();
2014-12-01 23:55:08 +01:00
break;
}
2018-10-31 13:00:40 +01:00
return NumCrss;
2014-12-01 23:55:08 +01:00
}
/*****************************************************************************/
/******* Show form to confirm that I want to see a big list of courses *******/
/*****************************************************************************/
static bool Ind_GetIfShowBigList (unsigned NumCrss)
{
bool ShowBigList;
/***** If list of courses is too big... *****/
if (NumCrss <= Cfg_MIN_NUM_COURSES_TO_CONFIRM_SHOW_BIG_LIST)
return true; // List is not too big ==> show it
/***** Get parameter with user's confirmation to see a big list of courses *****/
2017-01-28 20:32:50 +01:00
if (!(ShowBigList = Par_GetParToBool ("ShowBigList")))
2014-12-01 23:55:08 +01:00
Ind_PutButtonToConfirmIWantToSeeBigList (NumCrss);
return ShowBigList;
}
/*****************************************************************************/
/****** Show form to confirm that I want to see a big list of courses ********/
/*****************************************************************************/
static void Ind_PutButtonToConfirmIWantToSeeBigList (unsigned NumCrss)
{
extern const char *Txt_The_list_of_X_courses_is_too_large_to_be_displayed;
extern const char *Txt_Show_anyway;
2017-05-25 14:25:22 +02:00
/***** Show alert and button to confirm that I want to see the big list *****/
2019-02-17 01:14:55 +01:00
Ale_ShowAlertAndButton (Gbl.Action.Act,NULL,NULL,
2017-05-25 14:25:22 +02:00
Ind_PutParamsConfirmIWantToSeeBigList,
2019-02-17 01:14:55 +01:00
Btn_CONFIRM_BUTTON,Txt_Show_anyway,
Ale_WARNING,Txt_The_list_of_X_courses_is_too_large_to_be_displayed,
NumCrss);
2017-05-25 14:25:22 +02:00
}
2014-12-01 23:55:08 +01:00
2017-05-25 14:25:22 +02:00
static void Ind_PutParamsConfirmIWantToSeeBigList (void)
{
2016-06-24 20:34:58 +02:00
Sco_PutParamScope ("ScopeInd",Gbl.Scope.Current);
2019-11-03 13:19:32 +01:00
Par_PutHiddenParamLong (NULL,"OthDegTypCod",Gbl.Stat.DegTypCod);
Par_PutHiddenParamLong (NULL,Dpt_PARAM_DPT_COD_NAME,Gbl.Stat.DptCod);
2016-06-08 14:14:31 +02:00
if (Gbl.Stat.StrIndicatorsSelected[0])
2019-11-03 13:19:32 +01:00
Par_PutHiddenParamString (NULL,"Indicators",Gbl.Stat.StrIndicatorsSelected);
2014-12-01 23:55:08 +01:00
Par_PutHiddenParamChar ("ShowBigList",'Y');
}
2016-06-04 19:16:21 +02:00
/*****************************************************************************/
/** Get vector with numbers of courses with 0, 1, 2... indicators set to yes */
/*****************************************************************************/
2017-01-28 15:58:46 +01:00
static void Ind_GetNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS],
2016-06-04 19:16:21 +02:00
unsigned NumCrss,MYSQL_RES *mysql_res)
{
MYSQL_ROW row;
unsigned NumCrs;
long CrsCod;
unsigned Ind;
2016-06-09 11:50:24 +02:00
unsigned NumIndicators;
2016-06-04 19:16:21 +02:00
/***** Reset counters of courses with each number of indicators *****/
for (Ind = 0;
Ind <= Ind_NUM_INDICATORS;
Ind++)
NumCrssWithIndicatorYes[Ind] = 0;
/***** List courses *****/
for (Gbl.RowEvenOdd = 1, NumCrs = 0;
NumCrs < NumCrss;
NumCrs++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
{
/* Get next course */
row = mysql_fetch_row (mysql_res);
/* Get course code (row[2]) */
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) < 0)
Lay_ShowErrorAndExit ("Wrong code of course.");
2016-06-10 10:22:22 +02:00
/* Get stored number of indicators of this course */
2016-06-09 11:50:24 +02:00
NumIndicators = Ind_GetAndUpdateNumIndicatorsCrs (CrsCod);
NumCrssWithIndicatorYes[NumIndicators]++;
2016-06-04 19:16:21 +02:00
}
}
/*****************************************************************************/
/** Show table with numbers of courses with 0, 1, 2... indicators set to yes */
/*****************************************************************************/
2017-01-28 15:58:46 +01:00
static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS],
2016-06-08 13:19:17 +02:00
unsigned NumCrss,bool PutForm)
2016-06-04 19:16:21 +02:00
{
2016-06-08 14:14:31 +02:00
extern const char *Txt_Indicators;
2016-06-04 19:16:21 +02:00
extern const char *Txt_Courses;
2016-06-08 14:14:31 +02:00
extern const char *Txt_Total;
2016-06-04 19:16:21 +02:00
unsigned Ind;
2016-06-05 01:01:18 +02:00
const char *Class;
2019-10-15 15:23:38 +02:00
const char *ClassNormal = "DAT_LIGHT RM";
const char *ClassHighlight = "DAT RM LIGHT_BLUE";
2016-06-04 19:16:21 +02:00
/***** Write number of courses with each number of indicators valid *****/
2019-10-23 19:05:05 +02:00
HTM_TABLE_BeginPadding (2);
2017-05-01 12:36:24 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-12 00:07:52 +02:00
2016-06-08 13:19:17 +02:00
if (PutForm)
2019-10-23 19:05:05 +02:00
HTM_TH_Empty (1);
HTM_TH (1,1,"RM",Txt_Indicators);
HTM_TH (1,2,"RM",Txt_Courses);
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-10-12 00:07:52 +02:00
2016-06-04 19:16:21 +02:00
for (Ind = 0;
Ind <= Ind_NUM_INDICATORS;
Ind++)
2016-06-05 01:01:18 +02:00
{
2016-06-08 14:14:31 +02:00
Class = Gbl.Stat.IndicatorsSelected[Ind] ? ClassHighlight :
ClassNormal;
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 15:15:55 +02:00
2016-06-08 13:19:17 +02:00
if (PutForm)
{
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
2020-03-12 13:53:37 +01:00
HTM_INPUT_CHECKBOX ("Indicators",HTM_SUBMIT_ON_CHANGE,
2019-11-04 20:41:35 +01:00
"id=\"Indicators%u\" value=\"%u\"%s",
Ind,Ind,
Gbl.Stat.IndicatorsSelected[Ind] ? " checked=\"checked\"" : "");
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-08 13:19:17 +02:00
}
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
2019-11-02 23:40:52 +01:00
HTM_LABEL_Begin ("for=\"Indicators%u\"",Ind);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (Ind);
2019-11-02 12:59:31 +01:00
HTM_LABEL_End ();
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (NumCrssWithIndicatorYes[Ind]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s\"",Class);
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(%.1f%%)",
NumCrss ? (double) NumCrssWithIndicatorYes[Ind] * 100.0 /
(double) NumCrss :
0.0);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2016-06-05 01:01:18 +02:00
}
/***** Write total of courses *****/
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 15:15:55 +02:00
2016-06-08 13:19:17 +02:00
if (PutForm)
2019-10-23 19:05:05 +02:00
HTM_TD_Empty (1);
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\"");
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_Total);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\"");
2019-11-10 13:31:47 +01:00
HTM_Unsigned (NumCrss);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\"");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(%.1f%%)",100.0);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2017-05-01 12:36:24 +02:00
2019-10-23 19:05:05 +02:00
HTM_TABLE_End ();
2016-06-04 19:16:21 +02:00
}
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/****************** Get and show total number of courses *********************/
/*****************************************************************************/
2016-06-04 19:16:21 +02:00
static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t IndicatorsLayout,
unsigned NumCrss,MYSQL_RES *mysql_res)
2014-12-01 23:55:08 +01:00
{
extern const char *Txt_Degree;
extern const char *Txt_Course;
extern const char *Txt_Institutional_BR_code;
extern const char *Txt_Web_page_of_the_course;
2017-05-30 21:43:05 +02:00
extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES];
2014-12-01 23:55:08 +01:00
extern const char *Txt_Indicators;
extern const char *Txt_No_INDEX;
extern const char *Txt_Syllabus_of_the_course;
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
2015-01-26 12:39:48 +01:00
extern const char *Txt_No_of_files_in_SHARE_zones;
extern const char *Txt_No_of_files_in_DOCUM_zones;
2014-12-01 23:55:08 +01:00
extern const char *Txt_Guided_academic_assignments;
extern const char *Txt_Assignments;
extern const char *Txt_Files_assignments;
extern const char *Txt_Files_works;
extern const char *Txt_Online_tutoring;
extern const char *Txt_Forum_threads;
extern const char *Txt_Forum_posts;
extern const char *Txt_Messages_sent_by_teachers;
extern const char *Txt_Materials;
extern const char *Txt_Assessment_criteria;
extern const char *Txt_YES;
extern const char *Txt_NO;
extern const char *Txt_INFO_SRC_SHORT_TEXT[Inf_NUM_INFO_SOURCES];
extern const char *Txt_Courses;
MYSQL_ROW row;
unsigned NumCrs;
long CrsCod;
unsigned NumTchs;
unsigned NumStds;
2016-06-09 14:00:10 +02:00
unsigned NumIndicators;
2014-12-01 23:55:08 +01:00
struct Ind_IndicatorsCrs Indicators;
2018-04-24 13:21:53 +02:00
long ActCod;
2014-12-01 23:55:08 +01:00
2019-10-20 22:00:28 +02:00
/***** Begin table *****/
2019-10-23 19:05:05 +02:00
HTM_TABLE_Begin ("INDICATORS");
2014-12-01 23:55:08 +01:00
/***** Write table heading *****/
switch (IndicatorsLayout)
{
case Ind_INDICATORS_BRIEF:
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TH (3,1,"LM COLOR0",Txt_Degree);
HTM_TH (3,1,"LM COLOR0",Txt_Course);
HTM_TH (3,1,"LM COLOR0",Txt_Institutional_BR_code);
HTM_TH (3,1,"LM COLOR0",Txt_Web_page_of_the_course);
2019-11-04 23:39:15 +01:00
HTM_TH (1,11,"CM COLOR0",Txt_Indicators);
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-10-04 14:42:59 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TH (2,1,"CT COLOR0",Txt_No_INDEX);
HTM_TH_Begin (1,2,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(A) %s",Txt_Syllabus_of_the_course);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
HTM_TH_Begin (1,2,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(B) %s",Txt_Guided_academic_assignments);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
HTM_TH_Begin (1,2,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(C) %s",Txt_Online_tutoring);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
HTM_TH_Begin (1,2,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(D) %s",Txt_Materials);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
HTM_TH_Begin (1,2,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(E) %s",Txt_Assessment_criteria);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-10-04 14:42:59 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2014-12-01 23:55:08 +01:00
break;
case Ind_INDICATORS_FULL:
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TH (3,1,"LM COLOR0",Txt_Degree);
HTM_TH (3,1,"LM COLOR0",Txt_Course);
HTM_TH (3,1,"LM COLOR0",Txt_Institutional_BR_code);
HTM_TH (3,1,"LM COLOR0",Txt_Web_page_of_the_course);
HTM_TH (3,1,"LM COLOR0",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH]);
HTM_TH (3,1,"LM COLOR0",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD]);
HTM_TH (1,24,"CM COLOR0",Txt_Indicators);
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2019-10-04 14:42:59 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-12 00:07:52 +02:00
2019-10-23 19:05:05 +02:00
HTM_TH (2,1,"CT COLOR0",Txt_No_INDEX);
HTM_TH_Begin (1,5,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(A) %s",Txt_Syllabus_of_the_course);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
HTM_TH_Begin (1,5,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(B) %s",Txt_Guided_academic_assignments);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
HTM_TH_Begin (1,5,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(C) %s",Txt_Online_tutoring);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
HTM_TH_Begin (1,4,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(D) %s",Txt_Materials);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
HTM_TH_Begin (1,4,"CT COLOR0");
2019-11-11 00:15:44 +01:00
HTM_TxtF ("(E) %s",Txt_Assessment_criteria);
2019-10-23 19:05:05 +02:00
HTM_TH_End ();
HTM_TR_End ();
HTM_TR_Begin (NULL);
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
HTM_TH (1,1,"LM COLOR0",Txt_INFO_TITLE[Inf_LECTURES]);
HTM_TH (1,1,"LM COLOR0",Txt_INFO_TITLE[Inf_PRACTICALS]);
HTM_TH (1,1,"LM COLOR0",Txt_INFO_TITLE[Inf_TEACHING_GUIDE]);
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
HTM_TH (1,1,"RM COLOR0",Txt_Assignments);
HTM_TH (1,1,"RM COLOR0",Txt_Files_assignments);
HTM_TH (1,1,"RM COLOR0",Txt_Files_works);
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
HTM_TH (1,1,"RM COLOR0",Txt_Forum_threads);
HTM_TH (1,1,"RM COLOR0",Txt_Forum_posts);
HTM_TH (1,1,"RM COLOR0",Txt_Messages_sent_by_teachers);
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
HTM_TH (1,1,"RM COLOR0",Txt_No_of_files_in_DOCUM_zones);
HTM_TH (1,1,"RM COLOR0",Txt_No_of_files_in_SHARE_zones);
HTM_TH (1,1,"CM COLOR0",Txt_YES);
HTM_TH (1,1,"CM COLOR0",Txt_NO);
HTM_TH (1,1,"LM COLOR0",Txt_INFO_TITLE[Inf_ASSESSMENT]);
HTM_TH (1,1,"LM COLOR0",Txt_INFO_TITLE[Inf_TEACHING_GUIDE]);
HTM_TR_End ();
2014-12-01 23:55:08 +01:00
break;
}
/***** List courses *****/
2017-04-25 14:48:47 +02:00
mysql_data_seek (mysql_res,0);
2014-12-01 23:55:08 +01:00
for (Gbl.RowEvenOdd = 1, NumCrs = 0;
NumCrs < NumCrss;
NumCrs++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
{
/* Get next course */
row = mysql_fetch_row (mysql_res);
/* Get course code (row[2]) */
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) < 0)
Lay_ShowErrorAndExit ("Wrong code of course.");
2016-06-09 14:00:10 +02:00
/* Get stored number of indicators of this course */
NumIndicators = Ind_GetAndUpdateNumIndicatorsCrs (CrsCod);
if (Gbl.Stat.IndicatorsSelected[NumIndicators])
{
/* Compute and store indicators */
Ind_ComputeAndStoreIndicatorsCrs (CrsCod,(int) NumIndicators,&Indicators);
/* The number of indicators may have changed */
2016-06-10 10:22:22 +02:00
if (Gbl.Stat.IndicatorsSelected[Indicators.NumIndicators])
2016-06-09 14:00:10 +02:00
{
2018-04-24 13:21:53 +02:00
ActCod = Act_GetActCod (ActReqStaCrs);
2016-06-09 14:00:10 +02:00
/* Write a row for this course */
switch (IndicatorsLayout)
{
case Ind_INDICATORS_BRIEF:
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Indicators.CourseAllOK ? "DAT_SMALL_GREEN" :
(Indicators.CoursePartiallyOK ? "DAT_SMALL" :
"DAT_SMALL_RED"),
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (row[0]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Indicators.CourseAllOK ? "DAT_SMALL_GREEN" :
(Indicators.CoursePartiallyOK ? "DAT_SMALL" :
"DAT_SMALL_RED"),
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (row[1]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Indicators.CourseAllOK ? "DAT_SMALL_GREEN" :
(Indicators.CoursePartiallyOK ? "DAT_SMALL" :
"DAT_SMALL_RED"),
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (row[3]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-28 13:56:04 +01:00
HTM_TD_Begin ("class=\"DAT_SMALL LM COLOR%u\"",Gbl.RowEvenOdd);
2019-10-28 20:38:29 +01:00
HTM_A_Begin ("href=\"%s/?crs=%ld&amp;act=%ld\" target=\"_blank\"",
Cfg_URL_SWAD_CGI,CrsCod,ActCod);
2019-11-11 00:15:44 +01:00
HTM_TxtF ("%s/?crs=%ld&amp;act=%ld",
Cfg_URL_SWAD_CGI,CrsCod,ActCod);
2019-10-28 13:56:04 +01:00
HTM_A_End ();
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Indicators.CourseAllOK ? "DAT_SMALL_GREEN" :
(Indicators.CoursePartiallyOK ? "DAT_SMALL" :
"DAT_SMALL_RED"),
Gbl.RowEvenOdd);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (Indicators.NumIndicators);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (Indicators.ThereIsSyllabus)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (!Indicators.ThereIsSyllabus)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (Indicators.ThereAreAssignments)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (!Indicators.ThereAreAssignments)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (Indicators.ThereIsOnlineTutoring)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (!Indicators.ThereIsOnlineTutoring)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (Indicators.ThereAreMaterials)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (!Indicators.ThereAreMaterials)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (Indicators.ThereIsAssessment)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:00:28 +02:00
if (!Indicators.ThereIsAssessment)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2016-06-09 14:00:10 +02:00
break;
case Ind_INDICATORS_FULL:
/* Get number of users */
2020-01-08 23:49:04 +01:00
NumTchs = Usr_GetNumUsrsInCrss (Hie_CRS,CrsCod,
1 << Rol_NET | // Non-editing teachers
1 << Rol_TCH); // Teachers
NumStds = Usr_GetNumUsrsInCrss (Hie_CRS,CrsCod,
1 << Rol_STD); // Students
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_Begin (NULL);
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Indicators.CourseAllOK ? "DAT_SMALL_GREEN" :
(Indicators.CoursePartiallyOK ? "DAT_SMALL" :
"DAT_SMALL_RED"),
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (row[0]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Indicators.CourseAllOK ? "DAT_SMALL_GREEN" :
(Indicators.CoursePartiallyOK ? "DAT_SMALL" :
"DAT_SMALL_RED"),
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (row[1]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Indicators.CourseAllOK ? "DAT_SMALL_GREEN" :
(Indicators.CoursePartiallyOK ? "DAT_SMALL" :
"DAT_SMALL_RED"),
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (row[3]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-28 13:56:04 +01:00
HTM_TD_Begin ("class=\"DAT_SMALL LM COLOR%u\"",Gbl.RowEvenOdd);
2019-10-28 20:38:29 +01:00
HTM_A_Begin ("href=\"%s/?crs=%ld&amp;act=%ld\" target=\"_blank\"",
Cfg_URL_SWAD_CGI,CrsCod,ActCod);
2019-11-11 00:15:44 +01:00
HTM_TxtF ("%s/?crs=%ld&amp;act=%ld",
Cfg_URL_SWAD_CGI,CrsCod,ActCod);
2019-10-28 13:56:04 +01:00
HTM_A_End ();
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
NumTchs != 0 ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (NumTchs);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
NumStds != 0 ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (NumStds);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Indicators.CourseAllOK ? "DAT_SMALL_GREEN" :
(Indicators.CoursePartiallyOK ? "DAT_SMALL" :
"DAT_SMALL_RED"),
Gbl.RowEvenOdd);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (Indicators.NumIndicators);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (Indicators.ThereIsSyllabus)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (!Indicators.ThereIsSyllabus)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.SyllabusLecSrc != Inf_INFO_SRC_NONE) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_INFO_SRC_SHORT_TEXT[Indicators.SyllabusLecSrc]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.SyllabusPraSrc != Inf_INFO_SRC_NONE) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_INFO_SRC_SHORT_TEXT[Indicators.SyllabusPraSrc]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\">",
2019-10-10 23:14:13 +02:00
(Indicators.TeachingGuideSrc != Inf_INFO_SRC_NONE) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_INFO_SRC_SHORT_TEXT[Indicators.TeachingGuideSrc]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (Indicators.ThereAreAssignments)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (!Indicators.ThereAreAssignments)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.NumAssignments != 0) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (Indicators.NumAssignments);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.NumFilesAssignments != 0) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 16:47:05 +01:00
HTM_UnsignedLong (Indicators.NumFilesAssignments);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.NumFilesWorks != 0) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 16:47:05 +01:00
HTM_UnsignedLong (Indicators.NumFilesWorks);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (Indicators.ThereIsOnlineTutoring)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (!Indicators.ThereIsOnlineTutoring)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.NumThreads != 0) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (Indicators.NumThreads);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.NumPosts != 0) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (Indicators.NumPosts);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.NumMsgsSentByTchs != 0) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 13:31:47 +01:00
HTM_Unsigned (Indicators.NumMsgsSentByTchs);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (Indicators.ThereAreMaterials)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (!Indicators.ThereAreMaterials)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.NumFilesInDocumentZones != 0) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 16:47:05 +01:00
HTM_UnsignedLong (Indicators.NumFilesInDocumentZones);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s RM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.NumFilesInSharedZones != 0) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 16:47:05 +01:00
HTM_UnsignedLong (Indicators.NumFilesInSharedZones);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2016-06-09 14:00:10 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_GREEN CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (Indicators.ThereIsAssessment)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_YES);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"DAT_SMALL_RED CM COLOR%u\"",
2019-10-10 23:14:13 +02:00
Gbl.RowEvenOdd);
2019-10-09 00:31:16 +02:00
if (!Indicators.ThereIsAssessment)
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_NO);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.AssessmentSrc != Inf_INFO_SRC_NONE) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_INFO_SRC_SHORT_TEXT[Indicators.AssessmentSrc]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TD_Begin ("class=\"%s LM COLOR%u\"",
2019-10-10 23:14:13 +02:00
(Indicators.TeachingGuideSrc != Inf_INFO_SRC_NONE) ? "DAT_SMALL_GREEN" :
"DAT_SMALL_RED",
Gbl.RowEvenOdd);
2019-11-10 12:36:37 +01:00
HTM_Txt (Txt_INFO_SRC_SHORT_TEXT[Indicators.TeachingGuideSrc]);
2019-10-23 19:05:05 +02:00
HTM_TD_End ();
2019-10-07 15:15:55 +02:00
2019-10-23 19:05:05 +02:00
HTM_TR_End ();
2016-06-09 14:00:10 +02:00
break;
}
}
}
2014-12-01 23:55:08 +01:00
}
/***** End table *****/
2019-10-23 19:05:05 +02:00
HTM_TABLE_End ();
2014-12-01 23:55:08 +01:00
}
/*****************************************************************************/
2016-06-09 11:50:24 +02:00
/************ Get number of indicators of a course from database *************/
/************ If not stored ==> compute and store it *************/
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
2016-06-10 10:22:22 +02:00
static unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod)
2014-12-01 23:55:08 +01:00
{
2016-06-09 11:50:24 +02:00
unsigned NumIndicators;
struct Ind_IndicatorsCrs Indicators;
int NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (CrsCod);
/***** If number of indicators is not already computed ==> compute it! *****/
if (NumIndicatorsFromDB >= 0)
NumIndicators = (unsigned) NumIndicatorsFromDB;
else // Number of indicators is not already computed
{
/***** Compute and store number of indicators *****/
Ind_ComputeAndStoreIndicatorsCrs (CrsCod,NumIndicatorsFromDB,&Indicators);
2016-06-10 10:22:22 +02:00
NumIndicators = Indicators.NumIndicators;
2016-06-09 11:50:24 +02:00
}
return NumIndicators;
}
/*****************************************************************************/
/************ Get number of indicators of a course from database *************/
/*****************************************************************************/
2016-12-15 02:22:47 +01:00
// This function returns -1 if number of indicators is not yet calculated
2016-06-09 11:50:24 +02:00
2016-06-10 10:22:22 +02:00
int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
2016-06-09 11:50:24 +02:00
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
2016-12-15 02:22:47 +01:00
int NumIndicatorsFromDB = -1; // -1 means not yet calculated
2016-06-09 11:50:24 +02:00
2016-12-15 02:22:47 +01:00
/***** Get number of indicators of a course from database *****/
2018-10-31 16:16:57 +01:00
if (DB_QuerySELECT (&mysql_res,"can not get number of indicators",
"SELECT NumIndicators FROM courses"
" WHERE CrsCod=%ld",
CrsCod))
2016-06-09 11:50:24 +02:00
{
/***** Get row *****/
row = mysql_fetch_row (mysql_res);
/***** Get number of indicators (row[0]) *****/
if (sscanf (row[0],"%d",&NumIndicatorsFromDB) != 1)
Lay_ShowErrorAndExit ("Error when getting number of indicators.");
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
return NumIndicatorsFromDB;
}
/*****************************************************************************/
/************ Store number of indicators of a course in database *************/
/*****************************************************************************/
2016-06-09 14:00:10 +02:00
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators)
2016-06-09 11:50:24 +02:00
{
/***** Store number of indicators of a course in database *****/
2018-11-03 12:16:40 +01:00
DB_QueryUPDATE ("can not store number of indicators of a course",
"UPDATE courses SET NumIndicators=%u WHERE CrsCod=%ld",
NumIndicators,CrsCod);
2016-06-09 11:50:24 +02:00
}
/*****************************************************************************/
/********************* Compute indicators of a course ************************/
/*****************************************************************************/
2016-06-10 10:22:22 +02:00
/* NumIndicatorsFromDB (number of indicators stored in database)
must be retrieved before calling this function.
If NumIndicatorsFromDB is different from number of indicators just computed
==> update it into database */
2016-06-09 11:50:24 +02:00
2016-06-10 10:22:22 +02:00
void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
struct Ind_IndicatorsCrs *Indicators)
2016-06-09 11:50:24 +02:00
{
/***** Initialize number of indicators *****/
2016-06-10 10:22:22 +02:00
Indicators->NumIndicators = 0;
2014-12-01 23:55:08 +01:00
2016-06-09 11:50:24 +02:00
/***** Get whether download zones are empty or not *****/
2016-06-08 18:41:32 +02:00
Indicators->NumFilesInDocumentZones = Ind_GetNumFilesInDocumZonesOfCrsFromDB (CrsCod);
Indicators->NumFilesInSharedZones = Ind_GetNumFilesInShareZonesOfCrsFromDB (CrsCod);
2014-12-01 23:55:08 +01:00
2016-06-09 11:50:24 +02:00
/***** Indicator #1: information about syllabus *****/
2016-06-08 15:03:06 +02:00
Indicators->SyllabusLecSrc = Inf_GetInfoSrcFromDB (CrsCod,Inf_LECTURES);
Indicators->SyllabusPraSrc = Inf_GetInfoSrcFromDB (CrsCod,Inf_PRACTICALS);
Indicators->TeachingGuideSrc = Inf_GetInfoSrcFromDB (CrsCod,Inf_TEACHING_GUIDE);
2014-12-01 23:55:08 +01:00
Indicators->ThereIsSyllabus = (Indicators->SyllabusLecSrc != Inf_INFO_SRC_NONE) ||
(Indicators->SyllabusPraSrc != Inf_INFO_SRC_NONE) ||
(Indicators->TeachingGuideSrc != Inf_INFO_SRC_NONE);
if (Indicators->ThereIsSyllabus)
2016-06-10 10:22:22 +02:00
Indicators->NumIndicators++;
2014-12-01 23:55:08 +01:00
2016-06-09 11:50:24 +02:00
/***** Indicator #2: information about assignments *****/
2014-12-01 23:55:08 +01:00
Indicators->NumAssignments = Asg_GetNumAssignmentsInCrs (CrsCod);
2016-06-08 18:41:32 +02:00
Indicators->NumFilesAssignments = Ind_GetNumFilesInAssigZonesOfCrsFromDB (CrsCod);
Indicators->NumFilesWorks = Ind_GetNumFilesInWorksZonesOfCrsFromDB (CrsCod);
2014-12-01 23:55:08 +01:00
Indicators->ThereAreAssignments = (Indicators->NumAssignments != 0) ||
(Indicators->NumFilesAssignments != 0) ||
(Indicators->NumFilesWorks != 0);
if (Indicators->ThereAreAssignments)
2016-06-10 10:22:22 +02:00
Indicators->NumIndicators++;
2014-12-01 23:55:08 +01:00
2016-06-09 11:50:24 +02:00
/***** Indicator #3: information about online tutoring *****/
2015-03-09 01:41:37 +01:00
Indicators->NumThreads = For_GetNumTotalThrsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod);
Indicators->NumPosts = For_GetNumTotalPstsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod,&(Indicators->NumUsrsToBeNotifiedByEMail));
2014-12-01 23:55:08 +01:00
Indicators->NumMsgsSentByTchs = Msg_GetNumMsgsSentByTchsCrs (CrsCod);
Indicators->ThereIsOnlineTutoring = (Indicators->NumThreads != 0) ||
(Indicators->NumPosts != 0) ||
(Indicators->NumMsgsSentByTchs != 0);
if (Indicators->ThereIsOnlineTutoring)
2016-06-10 10:22:22 +02:00
Indicators->NumIndicators++;
2014-12-01 23:55:08 +01:00
2016-06-09 11:50:24 +02:00
/***** Indicator #4: information about materials *****/
2016-04-22 09:47:25 +02:00
Indicators->ThereAreMaterials = (Indicators->NumFilesInDocumentZones != 0) ||
(Indicators->NumFilesInSharedZones != 0);
2014-12-01 23:55:08 +01:00
if (Indicators->ThereAreMaterials)
2016-06-10 10:22:22 +02:00
Indicators->NumIndicators++;
2014-12-01 23:55:08 +01:00
2016-06-09 11:50:24 +02:00
/***** Indicator #5: information about assessment *****/
2016-06-08 15:03:06 +02:00
Indicators->AssessmentSrc = Inf_GetInfoSrcFromDB (CrsCod,Inf_ASSESSMENT);
2014-12-01 23:55:08 +01:00
Indicators->ThereIsAssessment = (Indicators->AssessmentSrc != Inf_INFO_SRC_NONE) ||
(Indicators->TeachingGuideSrc != Inf_INFO_SRC_NONE);
if (Indicators->ThereIsAssessment)
2016-06-10 10:22:22 +02:00
Indicators->NumIndicators++;
2014-12-01 23:55:08 +01:00
2016-06-09 11:50:24 +02:00
/***** All the indicators are OK? *****/
2016-06-10 10:22:22 +02:00
Indicators->CoursePartiallyOK = Indicators->NumIndicators >= 1 &&
Indicators->NumIndicators < Ind_NUM_INDICATORS;
Indicators->CourseAllOK = Indicators->NumIndicators == Ind_NUM_INDICATORS;
2016-06-09 11:50:24 +02:00
/***** Update number of indicators into database
if different to the stored one *****/
2016-06-10 10:22:22 +02:00
if (NumIndicatorsFromDB != (int) Indicators->NumIndicators)
Ind_StoreIndicatorsCrsIntoDB (CrsCod,Indicators->NumIndicators);
2014-12-01 23:55:08 +01:00
}
/*****************************************************************************/
2016-06-08 18:41:32 +02:00
/*********** Get the number of files in document zones of a course ***********/
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
2016-06-08 18:41:32 +02:00
static unsigned long Ind_GetNumFilesInDocumZonesOfCrsFromDB (long CrsCod)
2014-12-01 23:55:08 +01:00
{
2015-01-25 23:40:07 +01:00
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
2016-06-08 18:41:32 +02:00
MYSQL_RES *mysql_res;
MYSQL_ROW row;
2016-06-08 19:05:49 +02:00
unsigned long NumFiles;
2016-06-08 18:41:32 +02:00
/***** Get number of files in document zones of a course from database *****/
2018-10-31 16:16:57 +01:00
DB_QuerySELECT (&mysql_res,"can not get the number of files",
"SELECT"
" (SELECT COALESCE(SUM(NumFiles),0)"
" FROM file_browser_size"
" WHERE FileBrowser=%u AND Cod=%ld) +"
" (SELECT COALESCE(SUM(file_browser_size.NumFiles),0)"
" FROM crs_grp_types,crs_grp,file_browser_size"
" WHERE crs_grp_types.CrsCod=%ld"
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
" AND file_browser_size.FileBrowser=%u"
" AND file_browser_size.Cod=crs_grp.GrpCod)",
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_DOC_CRS],
CrsCod,
CrsCod,
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_DOC_GRP]);
2016-06-08 18:41:32 +02:00
/***** Get row *****/
row = mysql_fetch_row (mysql_res);
/***** Get number of files (row[0]) *****/
2016-06-08 19:05:49 +02:00
if (sscanf (row[0],"%lu",&NumFiles) != 1)
Lay_ShowErrorAndExit ("Error when getting the number of files.");
2016-06-08 18:41:32 +02:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
return NumFiles;
}
/*****************************************************************************/
/*********** Get the number of files in shared zones of a course ***********/
/*****************************************************************************/
static unsigned long Ind_GetNumFilesInShareZonesOfCrsFromDB (long CrsCod)
{
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
2016-06-08 19:05:49 +02:00
unsigned long NumFiles;
2016-06-08 18:41:32 +02:00
/***** Get number of files in document zones of a course from database *****/
2018-10-31 16:16:57 +01:00
DB_QuerySELECT (&mysql_res,"can not get the number of files",
"SELECT"
" (SELECT COALESCE(SUM(NumFiles),0)"
" FROM file_browser_size"
" WHERE FileBrowser=%u AND Cod=%ld) +"
" (SELECT COALESCE(SUM(file_browser_size.NumFiles),0)"
" FROM crs_grp_types,crs_grp,file_browser_size"
" WHERE crs_grp_types.CrsCod=%ld"
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
" AND file_browser_size.FileBrowser=%u"
" AND file_browser_size.Cod=crs_grp.GrpCod)",
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_SHR_CRS],
CrsCod,
CrsCod,
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_SHR_GRP]);
2016-06-08 18:41:32 +02:00
/***** Get row *****/
row = mysql_fetch_row (mysql_res);
/***** Get number of files (row[0]) *****/
2016-06-08 19:05:49 +02:00
if (sscanf (row[0],"%lu",&NumFiles) != 1)
Lay_ShowErrorAndExit ("Error when getting the number of files.");
2016-06-08 18:41:32 +02:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
return NumFiles;
}
/*****************************************************************************/
/********* Get the number of files in assignment zones of a course ***********/
/*****************************************************************************/
static unsigned long Ind_GetNumFilesInAssigZonesOfCrsFromDB (long CrsCod)
{
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
2016-06-08 19:05:49 +02:00
unsigned long NumFiles;
2016-06-08 18:41:32 +02:00
/***** Get number of files in document zones of a course from database *****/
2018-10-31 16:16:57 +01:00
DB_QuerySELECT (&mysql_res,"can not get the number of files",
"SELECT COALESCE(SUM(NumFiles),0)"
" FROM file_browser_size"
" WHERE FileBrowser=%u AND Cod=%ld",
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_ASG_USR],
CrsCod);
2016-06-08 18:41:32 +02:00
/***** Get row *****/
row = mysql_fetch_row (mysql_res);
/***** Get number of files (row[0]) *****/
2016-06-08 19:05:49 +02:00
if (sscanf (row[0],"%lu",&NumFiles) != 1)
Lay_ShowErrorAndExit ("Error when getting the number of files.");
2016-06-08 18:41:32 +02:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
return NumFiles;
}
/*****************************************************************************/
/************* Get the number of files in works zones of a course ************/
/*****************************************************************************/
static unsigned long Ind_GetNumFilesInWorksZonesOfCrsFromDB (long CrsCod)
{
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
2014-12-01 23:55:08 +01:00
MYSQL_RES *mysql_res;
MYSQL_ROW row;
2016-06-08 19:05:49 +02:00
unsigned long NumFiles;
2014-12-01 23:55:08 +01:00
2016-06-08 18:41:32 +02:00
/***** Get number of files in document zones of a course from database *****/
2018-10-31 16:16:57 +01:00
DB_QuerySELECT (&mysql_res,"can not get the number of files",
"SELECT COALESCE(SUM(NumFiles),0)"
" FROM file_browser_size"
" WHERE FileBrowser=%u AND Cod=%ld",
(unsigned) Brw_FileBrowserForDB_files[Brw_ADMI_WRK_USR],
CrsCod);
2014-12-01 23:55:08 +01:00
/***** Get row *****/
row = mysql_fetch_row (mysql_res);
/***** Get number of files (row[0]) *****/
2016-06-08 19:05:49 +02:00
if (sscanf (row[0],"%lu",&NumFiles) != 1)
Lay_ShowErrorAndExit ("Error when getting the number of files.");
2014-12-01 23:55:08 +01:00
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
return NumFiles;
}