Version 22.120.4: Jul 11, 2023 Fixed bug in CSS related to global connected.

This commit is contained in:
acanas 2023-07-11 19:12:24 +02:00
parent 9c3a86afe6
commit 85a0b27a49
107 changed files with 711 additions and 746 deletions

View File

@ -1252,7 +1252,7 @@ a:hover /* Default ==> underlined */
.MENU_TXT_DARK {color:#d0d0d0;} .MENU_TXT_DARK {color:#d0d0d0;}
/***************************** Users connected *******************************/ /***************************** Users connected *******************************/
#courseconnected #globalconnected, #courseconnected
{ {
box-sizing:border-box; box-sizing:border-box;
width:136px; width:136px;

View File

@ -35,12 +35,6 @@
#include "swad_global.h" #include "swad_global.h"
#include "swad_HTML.h" #include "swad_HTML.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
/**************************** Private constants ******************************/ /**************************** Private constants ******************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -39,12 +39,6 @@
#include "swad_notice_database.h" #include "swad_notice_database.h"
#include "swad_RSS.h" #include "swad_RSS.h"
/*****************************************************************************/
/*************** External global variables from others modules ***************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -113,7 +113,7 @@ void Acc_PutLinkToCreateAccount (void)
extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
Lay_PutContextualLinkIconText (ActFrmMyAcc,NULL, Lay_PutContextualLinkIconText (ActFrmMyAcc,NULL,
NULL,NULL, NULL,NULL,
"at.svg",Ico_BLACK, "at.svg",Ico_BLACK,
Txt_Actions[ActCreUsrAcc],NULL); Txt_Actions[ActCreUsrAcc],NULL);
} }

View File

@ -58,21 +58,21 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Adm_ReqAddAdm (HieLvl_Level_t Scope,long Cod, static void Adm_ReqAddAdm (HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName); const char *InsCtrDegName);
static void Enr_AddAdm (HieLvl_Level_t Scope,long Cod, static void Adm_AddAdm (HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName); const char *InsCtrDegName);
static void Adm_RegisterAdmin (struct Usr_Data *UsrDat, static void Adm_RegisterAdmin (struct Usr_Data *UsrDat,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName); const char *InsCtrDegName);
static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr, static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName); const char *InsCtrDegName);
static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Scope, static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Level,
const char *InsCtrDegName); const char *InsCtrDegName);
static void Adm_EffectivelyRemAdm (struct Usr_Data *UsrDat, static void Adm_EffectivelyRemAdm (struct Usr_Data *UsrDat,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName); const char *InsCtrDegName);
/*****************************************************************************/ /*****************************************************************************/
@ -106,7 +106,7 @@ void Adm_ReqAddAdmOfDeg (void)
/**** Ask if really wanted to add an administrator to current institution ****/ /**** Ask if really wanted to add an administrator to current institution ****/
/*****************************************************************************/ /*****************************************************************************/
static void Adm_ReqAddAdm (HieLvl_Level_t Scope,long Cod, static void Adm_ReqAddAdm (HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName) const char *InsCtrDegName)
{ {
extern const char *Txt_THE_USER_X_is_already_an_administrator_of_Y; extern const char *Txt_THE_USER_X_is_already_an_administrator_of_Y;
@ -130,12 +130,12 @@ static void Adm_ReqAddAdm (HieLvl_Level_t Scope,long Cod,
if (Usr_GetParOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParOtherUsrCodEncryptedAndGetUsrData ())
{ {
/* Check if I am allowed to register user as administrator in institution/center/degree */ /* Check if I am allowed to register user as administrator in institution/center/degree */
ICanRegister = ((Scope == HieLvl_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) || ICanRegister = ((Level == HieLvl_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ||
(Scope == HieLvl_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) || (Level == HieLvl_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ||
(Scope == HieLvl_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); (Level == HieLvl_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
if (ICanRegister) if (ICanRegister)
{ {
if (Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is already an administrator of current institution/center/degree if (Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Level,Cod)) // User is already an administrator of current institution/center/degree
{ {
Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_is_already_an_administrator_of_Y, Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_is_already_an_administrator_of_Y,
Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName); Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName);
@ -152,7 +152,7 @@ static void Adm_ReqAddAdm (HieLvl_Level_t Scope,long Cod,
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
/* End alert */ /* End alert */
Ale_ShowAlertAndButton2 (Enr_ActNewAdm[Scope],NULL,NULL, Ale_ShowAlertAndButton2 (Enr_ActNewAdm[Level],NULL,NULL,
Usr_PutParOtherUsrCodEncrypted,Gbl.Usrs.Other.UsrDat.EnUsrCod, Usr_PutParOtherUsrCodEncrypted,Gbl.Usrs.Other.UsrDat.EnUsrCod,
Btn_CREATE_BUTTON,Txt_Register_user_IN_A_COURSE_OR_DEGREE); Btn_CREATE_BUTTON,Txt_Register_user_IN_A_COURSE_OR_DEGREE);
} }
@ -171,7 +171,7 @@ static void Adm_ReqAddAdm (HieLvl_Level_t Scope,long Cod,
void Adm_AddAdmToIns (void) void Adm_AddAdmToIns (void)
{ {
Enr_AddAdm (HieLvl_INS,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Ins.FullName); Adm_AddAdm (HieLvl_INS,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Ins.FullName);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -180,7 +180,7 @@ void Adm_AddAdmToIns (void)
void Adm_AddAdmToCtr (void) void Adm_AddAdmToCtr (void)
{ {
Enr_AddAdm (HieLvl_CTR,Gbl.Hierarchy.Ctr.CtrCod,Gbl.Hierarchy.Ctr.FullName); Adm_AddAdm (HieLvl_CTR,Gbl.Hierarchy.Ctr.CtrCod,Gbl.Hierarchy.Ctr.FullName);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -189,32 +189,32 @@ void Adm_AddAdmToCtr (void)
void Adm_AddAdmToDeg (void) void Adm_AddAdmToDeg (void)
{ {
Enr_AddAdm (HieLvl_DEG,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Deg.FullName); Adm_AddAdm (HieLvl_DEG,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Deg.FullName);
} }
/*****************************************************************************/ /*****************************************************************************/
/******************** Get list with data of administrators *******************/ /******************** Get list with data of administrators *******************/
/*****************************************************************************/ /*****************************************************************************/
void Adm_GetAdmsLst (HieLvl_Level_t Scope) void Adm_GetAdmsLst (HieLvl_Level_t Level)
{ {
char *Query = NULL; char *Query = NULL;
/***** Build query *****/ /***** Build query *****/
Usr_DB_BuildQueryToGetAdmsLst (Scope,&Query); Usr_DB_BuildQueryToGetAdmsLst (Level,&Query);
/***** Get list of administrators from database *****/ /***** Get list of administrators from database *****/
Usr_GetListUsrsFromQuery (Query,Rol_DEG_ADM,Scope); Usr_GetListUsrsFromQuery (Query,Rol_DEG_ADM,Level);
/***** Free query string *****/ /***** Free query string *****/
free (Query); free (Query);
} }
/*****************************************************************************/ /*****************************************************************************/
/******************* Add an administrator to current degree ******************/ /******************* Add an administrator in a given level *******************/
/*****************************************************************************/ /*****************************************************************************/
static void Enr_AddAdm (HieLvl_Level_t Scope,long Cod, static void Adm_AddAdm (HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName) const char *InsCtrDegName)
{ {
bool ICanRegister; bool ICanRegister;
@ -225,13 +225,13 @@ static void Enr_AddAdm (HieLvl_Level_t Scope,long Cod,
if (Usr_GetParOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParOtherUsrCodEncryptedAndGetUsrData ())
{ {
/* Check if I am allowed to register user as administrator in institution/center/degree */ /* Check if I am allowed to register user as administrator in institution/center/degree */
ICanRegister = ((Scope == HieLvl_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) || ICanRegister = ((Level == HieLvl_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ||
(Scope == HieLvl_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) || (Level == HieLvl_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ||
(Scope == HieLvl_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); (Level == HieLvl_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
if (ICanRegister) if (ICanRegister)
{ {
/***** Register administrator in current institution/center/degree in database *****/ /***** Register administrator in current institution/center/degree in database *****/
Adm_RegisterAdmin (&Gbl.Usrs.Other.UsrDat,Scope, Adm_RegisterAdmin (&Gbl.Usrs.Other.UsrDat,Level,
Cod,InsCtrDegName); Cod,InsCtrDegName);
/***** Show user's record *****/ /***** Show user's record *****/
@ -250,20 +250,20 @@ static void Enr_AddAdm (HieLvl_Level_t Scope,long Cod,
/*****************************************************************************/ /*****************************************************************************/
static void Adm_RegisterAdmin (struct Usr_Data *UsrDat, static void Adm_RegisterAdmin (struct Usr_Data *UsrDat,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName) const char *InsCtrDegName)
{ {
extern const char *Txt_THE_USER_X_is_already_an_administrator_of_Y; extern const char *Txt_THE_USER_X_is_already_an_administrator_of_Y;
extern const char *Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y; extern const char *Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y;
/***** Check if user was and administrator of current institution/center/degree *****/ /***** Check if user was and administrator of current institution/center/degree *****/
if (Adm_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Scope,Cod)) if (Adm_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Level,Cod))
Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_is_already_an_administrator_of_Y, Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_is_already_an_administrator_of_Y,
UsrDat->FullName,InsCtrDegName); UsrDat->FullName,InsCtrDegName);
else // User was not administrator of current institution/center/degree else // User was not administrator of current institution/center/degree
{ {
/***** Insert or replace administrator in current institution/center/degree *****/ /***** Insert or replace administrator in current institution/center/degree *****/
Adm_DB_InsertAdmin (UsrDat->UsrCod,Scope,Cod); Adm_DB_InsertAdmin (UsrDat->UsrCod,Level,Cod);
Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y, Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y,
UsrDat->FullName,InsCtrDegName); UsrDat->FullName,InsCtrDegName);
@ -335,7 +335,7 @@ void Adm_RemAdmDeg (void)
/*****************************************************************************/ /*****************************************************************************/
static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr, static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName) const char *InsCtrDegName)
{ {
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_Y; extern const char *Txt_THE_USER_X_is_not_an_administrator_of_Y;
@ -350,21 +350,21 @@ static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,
/* Check if it's forbidden to remove an administrator */ /* Check if it's forbidden to remove an administrator */
MeOrOther = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod); MeOrOther = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
ICanRemove = (MeOrOther == Usr_ME || ICanRemove = (MeOrOther == Usr_ME ||
(Scope == HieLvl_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) || (Level == HieLvl_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ||
(Scope == HieLvl_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) || (Level == HieLvl_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ||
(Scope == HieLvl_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); (Level == HieLvl_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
if (ICanRemove) if (ICanRemove)
{ {
/* Check if the other user is an admin of the current institution/center/degree */ /* Check if the other user is an admin of the current institution/center/degree */
if (Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) if (Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Level,Cod))
{ // The other user is an administrator of current institution/center/degree ==> ask for removing or remove her/him { // The other user is an administrator of current institution/center/degree ==> ask for removing or remove her/him
switch (ReqDelOrDelUsr) switch (ReqDelOrDelUsr)
{ {
case Enr_REQUEST_REMOVE_USR: // Ask if remove administrator from current institution case Enr_REQUEST_REMOVE_USR: // Ask if remove administrator from current institution
Adm_AskIfRemAdm (MeOrOther,Scope,InsCtrDegName); Adm_AskIfRemAdm (MeOrOther,Level,InsCtrDegName);
break; break;
case Enr_REMOVE_USR: // Remove administrator from current institution case Enr_REMOVE_USR: // Remove administrator from current institution
Adm_EffectivelyRemAdm (&Gbl.Usrs.Other.UsrDat,Scope, Adm_EffectivelyRemAdm (&Gbl.Usrs.Other.UsrDat,Level,
Cod,InsCtrDegName); Cod,InsCtrDegName);
break; break;
} }
@ -385,7 +385,7 @@ static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,
/** Ask if really wanted to remove an administrator from current institution */ /** Ask if really wanted to remove an administrator from current institution */
/*****************************************************************************/ /*****************************************************************************/
static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Scope, static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Level,
const char *InsCtrDegName) const char *InsCtrDegName)
{ {
extern const char *Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_X; extern const char *Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_X;
@ -423,7 +423,7 @@ static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Scope,
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
/* End alert */ /* End alert */
Ale_ShowAlertAndButton2 (ActRemAdm[Scope],NULL,NULL, Ale_ShowAlertAndButton2 (ActRemAdm[Level],NULL,NULL,
Usr_PutParOtherUsrCodEncrypted,Gbl.Usrs.Other.UsrDat.EnUsrCod, Usr_PutParOtherUsrCodEncrypted,Gbl.Usrs.Other.UsrDat.EnUsrCod,
Btn_REMOVE_BUTTON,TxtButton[MeOrOther]); Btn_REMOVE_BUTTON,TxtButton[MeOrOther]);
} }
@ -436,16 +436,16 @@ static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Scope,
/*****************************************************************************/ /*****************************************************************************/
static void Adm_EffectivelyRemAdm (struct Usr_Data *UsrDat, static void Adm_EffectivelyRemAdm (struct Usr_Data *UsrDat,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
const char *InsCtrDegName) const char *InsCtrDegName)
{ {
extern const char *Txt_THE_USER_X_has_been_removed_as_administrator_of_Y; extern const char *Txt_THE_USER_X_has_been_removed_as_administrator_of_Y;
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_Y; extern const char *Txt_THE_USER_X_is_not_an_administrator_of_Y;
if (Adm_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Scope,Cod)) // User is administrator of current institution/center/degree if (Adm_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Level,Cod)) // User is administrator of current institution/center/degree
{ {
/***** Remove user as administrator of institution, center or degree *****/ /***** Remove user as administrator of institution, center or degree *****/
Adm_DB_RemAdmin (UsrDat->UsrCod,Scope,Cod); Adm_DB_RemAdmin (UsrDat->UsrCod,Level,Cod);
Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_removed_as_administrator_of_Y, Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_removed_as_administrator_of_Y,
UsrDat->FullName,InsCtrDegName); UsrDat->FullName,InsCtrDegName);

View File

@ -43,7 +43,7 @@ void Adm_AddAdmToIns (void);
void Adm_AddAdmToCtr (void); void Adm_AddAdmToCtr (void);
void Adm_AddAdmToDeg (void); void Adm_AddAdmToDeg (void);
void Adm_GetAdmsLst (HieLvl_Level_t Scope); void Adm_GetAdmsLst (HieLvl_Level_t Level);
void Adm_ReqRemAdmOfIns (void); void Adm_ReqRemAdmOfIns (void);
void Adm_ReqRemAdmOfCtr (void); void Adm_ReqRemAdmOfCtr (void);

View File

@ -41,7 +41,7 @@ extern struct Globals Gbl;
/** Insert/replace user as administrator of an institution, center or degree */ /** Insert/replace user as administrator of an institution, center or degree */
/*****************************************************************************/ /*****************************************************************************/
void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Scope,long Cod) void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Level,long Cod)
{ {
DB_QueryREPLACE ("can not create administrator", DB_QueryREPLACE ("can not create administrator",
"REPLACE INTO usr_admins" "REPLACE INTO usr_admins"
@ -49,7 +49,7 @@ void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Scope,long Cod)
" VALUES" " VALUES"
" (%ld,'%s',%ld)", " (%ld,'%s',%ld)",
UsrCod, UsrCod,
Sco_GetDBStrFromScope (Scope), Hie_GetDBStrFromLevel (Level),
Cod); Cod);
} }
@ -68,10 +68,10 @@ unsigned Adm_DB_GetAdmsCurrentScopeExceptMe (MYSQL_RES **mysql_res)
" OR (Scope='%s' AND Cod=%ld)" " OR (Scope='%s' AND Cod=%ld)"
" OR (Scope='%s' AND Cod=%ld))" " OR (Scope='%s' AND Cod=%ld))"
" AND UsrCod<>%ld", " AND UsrCod<>%ld",
Sco_GetDBStrFromScope (HieLvl_SYS), Hie_GetDBStrFromLevel (HieLvl_SYS),
Sco_GetDBStrFromScope (HieLvl_INS),Gbl.Hierarchy.Ins.InsCod, Hie_GetDBStrFromLevel (HieLvl_INS),Gbl.Hierarchy.Ins.InsCod,
Sco_GetDBStrFromScope (HieLvl_CTR),Gbl.Hierarchy.Ctr.CtrCod, Hie_GetDBStrFromLevel (HieLvl_CTR),Gbl.Hierarchy.Ctr.CtrCod,
Sco_GetDBStrFromScope (HieLvl_DEG),Gbl.Hierarchy.Deg.DegCod, Hie_GetDBStrFromLevel (HieLvl_DEG),Gbl.Hierarchy.Deg.DegCod,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
@ -79,7 +79,7 @@ unsigned Adm_DB_GetAdmsCurrentScopeExceptMe (MYSQL_RES **mysql_res)
/***** Check if a user is an administrator of a degree/center/institution ****/ /***** Check if a user is an administrator of a degree/center/institution ****/
/*****************************************************************************/ /*****************************************************************************/
bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Scope,long Cod) bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Level,long Cod)
{ {
return return
DB_QueryEXISTS ("can not check if a user is administrator", DB_QueryEXISTS ("can not check if a user is administrator",
@ -90,7 +90,7 @@ bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Scope,long Cod)
" AND Scope='%s'" " AND Scope='%s'"
" AND Cod=%ld)", " AND Cod=%ld)",
UsrCod, UsrCod,
Sco_GetDBStrFromScope (Scope), Hie_GetDBStrFromLevel (Level),
Cod); Cod);
} }
@ -108,14 +108,14 @@ bool Adm_DB_CheckIfUsrIsSuperuser (long UsrCod)
" WHERE UsrCod=%ld" " WHERE UsrCod=%ld"
" AND Scope='%s')", " AND Scope='%s')",
UsrCod, UsrCod,
Sco_GetDBStrFromScope (HieLvl_SYS)); Hie_GetDBStrFromLevel (HieLvl_SYS));
} }
/*****************************************************************************/ /*****************************************************************************/
/***** Remove user as administrator of an institution, center or degree ******/ /***** Remove user as administrator of an institution, center or degree ******/
/*****************************************************************************/ /*****************************************************************************/
void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Scope,long Cod) void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Level,long Cod)
{ {
DB_QueryDELETE ("can not remove an administrator", DB_QueryDELETE ("can not remove an administrator",
"DELETE FROM usr_admins" "DELETE FROM usr_admins"
@ -123,7 +123,7 @@ void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Scope,long Cod)
" AND Scope='%s'" " AND Scope='%s'"
" AND Cod=%ld", " AND Cod=%ld",
UsrCod, UsrCod,
Sco_GetDBStrFromScope (Scope), Hie_GetDBStrFromLevel (Level),
Cod); Cod);
} }
@ -143,12 +143,12 @@ void Adm_DB_RemUsrAsAdmin (long UsrCod)
/********* Remove administrators of an institution, center or degree *********/ /********* Remove administrators of an institution, center or degree *********/
/*****************************************************************************/ /*****************************************************************************/
void Adm_DB_RemAdmins (HieLvl_Level_t Scope,long Cod) void Adm_DB_RemAdmins (HieLvl_Level_t Level,long Cod)
{ {
DB_QueryDELETE ("can not remove administrators", DB_QueryDELETE ("can not remove administrators",
"DELETE FROM usr_admins" "DELETE FROM usr_admins"
" WHERE Scope='%s'" " WHERE Scope='%s'"
" AND Cod=%ld", " AND Cod=%ld",
Sco_GetDBStrFromScope (Scope), Hie_GetDBStrFromLevel (Level),
Cod); Cod);
} }

View File

@ -33,14 +33,14 @@
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Scope,long Cod); void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Level,long Cod);
unsigned Adm_DB_GetAdmsCurrentScopeExceptMe (MYSQL_RES **mysql_res); unsigned Adm_DB_GetAdmsCurrentScopeExceptMe (MYSQL_RES **mysql_res);
bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Scope,long Cod); bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Level,long Cod);
bool Adm_DB_CheckIfUsrIsSuperuser (long UsrCod); bool Adm_DB_CheckIfUsrIsSuperuser (long UsrCod);
void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Scope,long Cod); void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Level,long Cod);
void Adm_DB_RemUsrAsAdmin (long UsrCod); void Adm_DB_RemUsrAsAdmin (long UsrCod);
void Adm_DB_RemAdmins (HieLvl_Level_t Scope,long Cod); void Adm_DB_RemAdmins (HieLvl_Level_t Level,long Cod);
#endif #endif

View File

@ -343,12 +343,12 @@ unsigned Agd_DB_GetNumEventsFromUsr (long UsrCod)
/*****************************************************************************/ /*****************************************************************************/
/********************** Get number of users with events **********************/ /********************** Get number of users with events **********************/
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of users with events in a given scope // Returns the number of users with events in a given hierarchy level
unsigned Agd_DB_GetNumUsrsWithEvents (HieLvl_Level_t Scope) unsigned Agd_DB_GetNumUsrsWithEvents (HieLvl_Level_t Level)
{ {
/***** Get number of users with events from database *****/ /***** Get number of users with events from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -422,7 +422,7 @@ unsigned Agd_DB_GetNumUsrsWithEvents (HieLvl_Level_t Scope)
" AND crs_users.UsrCod=agd_agendas.UsrCod", " AND crs_users.UsrCod=agd_agendas.UsrCod",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -430,12 +430,12 @@ unsigned Agd_DB_GetNumUsrsWithEvents (HieLvl_Level_t Scope)
/*****************************************************************************/ /*****************************************************************************/
/*************************** Get number of events ****************************/ /*************************** Get number of events ****************************/
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of events in a given scope // Returns the number of events in a given hierarchy level
unsigned Agd_DB_GetNumEvents (HieLvl_Level_t Scope) unsigned Agd_DB_GetNumEvents (HieLvl_Level_t Level)
{ {
/***** Get number of events from database *****/ /***** Get number of events from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -517,7 +517,7 @@ unsigned Agd_DB_GetNumEvents (HieLvl_Level_t Scope)
" AND crs_users.UsrCod=agd_agendas.UsrCod", " AND crs_users.UsrCod=agd_agendas.UsrCod",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -56,8 +56,8 @@ void Agd_DB_RemoveUsrEvents (long UsrCod);
unsigned Agd_DB_GetNumEventsFromUsr (long UsrCod); unsigned Agd_DB_GetNumEventsFromUsr (long UsrCod);
unsigned Agd_DB_GetNumUsrsWithEvents (HieLvl_Level_t Scope); unsigned Agd_DB_GetNumUsrsWithEvents (HieLvl_Level_t Level);
unsigned Agd_DB_GetNumEvents (HieLvl_Level_t Scope); unsigned Agd_DB_GetNumEvents (HieLvl_Level_t Level);
#endif #endif

View File

@ -1642,7 +1642,7 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod)
// Returns the number of assignments // Returns the number of assignments
// in this location (all the platform, the current degree or the current course) // in this location (all the platform, the current degree or the current course)
unsigned Asg_GetNumAssignments (HieLvl_Level_t Scope,unsigned *NumNotif) unsigned Asg_GetNumAssignments (HieLvl_Level_t Level,unsigned *NumNotif)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1653,7 +1653,7 @@ unsigned Asg_GetNumAssignments (HieLvl_Level_t Scope,unsigned *NumNotif)
*NumNotif = 0; *NumNotif = 0;
/***** Get number of assignments from database *****/ /***** Get number of assignments from database *****/
if (Asg_DB_GetNumAssignments (&mysql_res,Scope)) if (Asg_DB_GetNumAssignments (&mysql_res,Level))
{ {
/***** Get number of assignments *****/ /***** Get number of assignments *****/
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);

View File

@ -105,7 +105,7 @@ void Asg_UnhideAssignment (void);
void Asg_ReceiveFormAssignment (void); void Asg_ReceiveFormAssignment (void);
void Asg_RemoveCrsAssignments (long CrsCod); void Asg_RemoveCrsAssignments (long CrsCod);
unsigned Asg_GetNumAssignments (HieLvl_Level_t Scope,unsigned *NumNotif); unsigned Asg_GetNumAssignments (HieLvl_Level_t Level,unsigned *NumNotif);
//-------------------------------- Figures ------------------------------------ //-------------------------------- Figures ------------------------------------
void Asg_GetAndShowAssignmentsStats (void); void Asg_GetAndShowAssignmentsStats (void);

View File

@ -519,10 +519,10 @@ unsigned Asg_DB_GetUsrsFromAssignmentExceptMe (MYSQL_RES **mysql_res,long AsgCod
// Returns the number of courses with assignments // Returns the number of courses with assignments
// in this location (all the platform, the current degree or the current course) // in this location (all the platform, the current degree or the current course)
unsigned Asg_DB_GetNumCoursesWithAssignments (HieLvl_Level_t Scope) unsigned Asg_DB_GetNumCoursesWithAssignments (HieLvl_Level_t Level)
{ {
/***** Get number of courses with assignments from database *****/ /***** Get number of courses with assignments from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -586,7 +586,7 @@ unsigned Asg_DB_GetNumCoursesWithAssignments (HieLvl_Level_t Scope)
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -597,10 +597,10 @@ unsigned Asg_DB_GetNumCoursesWithAssignments (HieLvl_Level_t Scope)
// Returns the number of assignments // Returns the number of assignments
// in this location (all the platform, the current degree or the current course) // in this location (all the platform, the current degree or the current course)
unsigned Asg_DB_GetNumAssignments (MYSQL_RES **mysql_res,HieLvl_Level_t Scope) unsigned Asg_DB_GetNumAssignments (MYSQL_RES **mysql_res,HieLvl_Level_t Level)
{ {
/***** Get number of assignments from database *****/ /***** Get number of assignments from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -670,7 +670,7 @@ unsigned Asg_DB_GetNumAssignments (MYSQL_RES **mysql_res,HieLvl_Level_t Scope)
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -73,9 +73,9 @@ void Asg_DB_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,
unsigned NumUsrsToBeNotifiedByEMail); unsigned NumUsrsToBeNotifiedByEMail);
unsigned Asg_DB_GetUsrsFromAssignmentExceptMe (MYSQL_RES **mysql_res,long AsgCod); unsigned Asg_DB_GetUsrsFromAssignmentExceptMe (MYSQL_RES **mysql_res,long AsgCod);
unsigned Asg_DB_GetNumCoursesWithAssignments (HieLvl_Level_t Scope); unsigned Asg_DB_GetNumCoursesWithAssignments (HieLvl_Level_t Level);
unsigned Asg_DB_GetNumAssignments (MYSQL_RES **mysql_res,HieLvl_Level_t Scope); unsigned Asg_DB_GetNumAssignments (MYSQL_RES **mysql_res,HieLvl_Level_t Level);
unsigned Asg_DB_GetNumAssignmentsInCrs (long CrsCod); unsigned Asg_DB_GetNumAssignmentsInCrs (long CrsCod);

View File

@ -1377,7 +1377,7 @@ void Att_RemoveCrsEvents (long CrsCod)
// Returns the number of attendance events // Returns the number of attendance events
// in this location (all the platform, the current degree or the current course) // in this location (all the platform, the current degree or the current course)
unsigned Att_GetNumEvents (HieLvl_Level_t Scope,unsigned *NumNotif) unsigned Att_GetNumEvents (HieLvl_Level_t Level,unsigned *NumNotif)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1388,7 +1388,7 @@ unsigned Att_GetNumEvents (HieLvl_Level_t Scope,unsigned *NumNotif)
*NumNotif = 0; *NumNotif = 0;
/***** Get number of attendance events from database *****/ /***** Get number of attendance events from database *****/
if (Att_DB_GetNumEvents (&mysql_res,Scope)) if (Att_DB_GetNumEvents (&mysql_res,Level))
{ {
/***** Get number of attendance events *****/ /***** Get number of attendance events *****/
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);

View File

@ -103,7 +103,7 @@ void Att_UpdateEvent (struct Att_Event *Event,const char *Description);
void Att_RemoveCrsEvents (long CrsCod); void Att_RemoveCrsEvents (long CrsCod);
unsigned Att_GetNumEvents (HieLvl_Level_t Scope,unsigned *NumNotif); unsigned Att_GetNumEvents (HieLvl_Level_t Level,unsigned *NumNotif);
void Att_SeeOneEvent (void); void Att_SeeOneEvent (void);

View File

@ -854,9 +854,9 @@ unsigned Att_DB_GetNumEventsInCrs (long CrsCod)
// Returns the number of courses with attendance events // Returns the number of courses with attendance events
// in this location (all the platform, the current degree or the current course) // in this location (all the platform, the current degree or the current course)
unsigned Att_DB_GetNumCoursesWithEvents (HieLvl_Level_t Scope) unsigned Att_DB_GetNumCoursesWithEvents (HieLvl_Level_t Level)
{ {
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return DB_QueryCOUNT ("can not get number of courses with attendance events", return DB_QueryCOUNT ("can not get number of courses with attendance events",
@ -900,7 +900,7 @@ unsigned Att_DB_GetNumCoursesWithEvents (HieLvl_Level_t Scope)
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -909,9 +909,9 @@ unsigned Att_DB_GetNumCoursesWithEvents (HieLvl_Level_t Scope)
/********************* Get number of attendance events ***********************/ /********************* Get number of attendance events ***********************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Att_DB_GetNumEvents (MYSQL_RES **mysql_res,HieLvl_Level_t Scope) unsigned Att_DB_GetNumEvents (MYSQL_RES **mysql_res,HieLvl_Level_t Level)
{ {
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -965,7 +965,7 @@ unsigned Att_DB_GetNumEvents (MYSQL_RES **mysql_res,HieLvl_Level_t Scope)
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -86,8 +86,8 @@ void Att_DB_RemoveGrpsAssociatedToCrsEvents (long CrsCod);
void Att_DB_RemoveCrsEvents (long CrsCod); void Att_DB_RemoveCrsEvents (long CrsCod);
unsigned Att_DB_GetNumEventsInCrs (long CrsCod); unsigned Att_DB_GetNumEventsInCrs (long CrsCod);
unsigned Att_DB_GetNumCoursesWithEvents (HieLvl_Level_t Scope); unsigned Att_DB_GetNumCoursesWithEvents (HieLvl_Level_t Level);
unsigned Att_DB_GetNumEvents (MYSQL_RES **mysql_res,HieLvl_Level_t Scope); unsigned Att_DB_GetNumEvents (MYSQL_RES **mysql_res,HieLvl_Level_t Level);
#endif #endif

View File

@ -29,13 +29,6 @@
#include "swad_banner_database.h" #include "swad_banner_database.h"
#include "swad_config.h" #include "swad_config.h"
#include "swad_database.h" #include "swad_database.h"
#include "swad_global.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
/************************** Get list of all banners **************************/ /************************** Get list of all banners **************************/

View File

@ -1577,7 +1577,7 @@ unsigned Brw_DB_GetNumberOfPublicFiles (MYSQL_RES **mysql_res,Brw_License_t Lice
(unsigned) Brw_ADMI_SHR_CRS, (unsigned) Brw_ADMI_SHR_CRS,
(unsigned) License); (unsigned) License);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -3765,7 +3765,7 @@ void Brw_DB_GetSizeOfFileBrowser (MYSQL_RES **mysql_res,
} }
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
} }
} }

View File

@ -36,12 +36,6 @@
#include "swad_parameter_code.h" #include "swad_parameter_code.h"
#include "swad_resource_database.h" #include "swad_resource_database.h"
/*****************************************************************************/
/******************** Global variables from other modules ********************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
/****************************** Get link to file *****************************/ /****************************** Get link to file *****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1709,7 +1709,7 @@ unsigned Ctr_GetCachedNumCtrsWithMapInIns (long InsCod)
unsigned Ctr_GetCachedNumCtrsWithDegs (void) unsigned Ctr_GetCachedNumCtrsWithDegs (void)
{ {
unsigned NumCtrsWithDegs; unsigned NumCtrsWithDegs;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of centers with degrees from cache *****/ /***** Get number of centers with degrees from cache *****/
if (!FigCch_GetFigureFromCache (FigCch_NUM_CTRS_WITH_DEGS,Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigCch_NUM_CTRS_WITH_DEGS,Gbl.Scope.Current,Cod,
@ -1731,7 +1731,7 @@ unsigned Ctr_GetCachedNumCtrsWithDegs (void)
unsigned Ctr_GetCachedNumCtrsWithCrss (void) unsigned Ctr_GetCachedNumCtrsWithCrss (void)
{ {
unsigned NumCtrsWithCrss; unsigned NumCtrsWithCrss;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of centers with courses *****/ /***** Get number of centers with courses *****/
if (!FigCch_GetFigureFromCache (FigCch_NUM_CTRS_WITH_CRSS,Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigCch_NUM_CTRS_WITH_CRSS,Gbl.Scope.Current,Cod,
@ -1759,7 +1759,7 @@ unsigned Ctr_GetCachedNumCtrsWithUsrs (Rol_Role_t Role)
[Rol_TCH] = FigCch_NUM_CTRS_WITH_TCHS, // Teachers [Rol_TCH] = FigCch_NUM_CTRS_WITH_TCHS, // Teachers
}; };
unsigned NumCtrsWithUsrs; unsigned NumCtrsWithUsrs;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of centers with users from cache *****/ /***** Get number of centers with users from cache *****/
if (!FigCch_GetFigureFromCache (FigureCtrs[Role],Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigureCtrs[Role],Gbl.Scope.Current,Cod,

View File

@ -67,7 +67,7 @@ typedef enum
} Ctr_Order_t; } Ctr_Order_t;
#define Ctr_ORDER_DEFAULT Ctr_ORDER_BY_CENTER #define Ctr_ORDER_DEFAULT Ctr_ORDER_BY_CENTER
struct ListCenters struct Ctr_ListCtrs
{ {
unsigned Num; // Number of centers unsigned Num; // Number of centers
struct Ctr_Center *Lst; // List of centers struct Ctr_Center *Lst; // List of centers

View File

@ -433,11 +433,11 @@ unsigned Ctr_DB_GetNumCtrsWithMapInIns (long InsCod)
/********************* Get number of centers with degrees ********************/ /********************* Get number of centers with degrees ********************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Ctr_DB_GetNumCtrsWithDegs (HieLvl_Level_t Scope,long Cod) unsigned Ctr_DB_GetNumCtrsWithDegs (HieLvl_Level_t Level,long Cod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,Cod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of centers with degrees", DB_QueryCOUNT ("can not get number of centers with degrees",
@ -455,11 +455,11 @@ unsigned Ctr_DB_GetNumCtrsWithDegs (HieLvl_Level_t Scope,long Cod)
/********************* Get number of centers with courses ********************/ /********************* Get number of centers with courses ********************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Ctr_DB_GetNumCtrsWithCrss (HieLvl_Level_t Scope,long Cod) unsigned Ctr_DB_GetNumCtrsWithCrss (HieLvl_Level_t Level,long Cod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,Cod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of centers with courses", DB_QueryCOUNT ("can not get number of centers with courses",
@ -480,11 +480,11 @@ unsigned Ctr_DB_GetNumCtrsWithCrss (HieLvl_Level_t Scope,long Cod)
/*****************************************************************************/ /*****************************************************************************/
unsigned Ctr_DB_GetNumCtrsWithUsrs (Rol_Role_t Role, unsigned Ctr_DB_GetNumCtrsWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod) HieLvl_Level_t Level,long Cod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,Cod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of centers with users", DB_QueryCOUNT ("can not get number of centers with users",

View File

@ -62,10 +62,10 @@ unsigned Ctr_DB_GetNumCtrsInPlc (long PlcCod);
unsigned Ctr_DB_GetNumCtrsWithMap (void); unsigned Ctr_DB_GetNumCtrsWithMap (void);
unsigned Ctr_DB_GetNumCtrsWithMapInCty (long CtyCod); unsigned Ctr_DB_GetNumCtrsWithMapInCty (long CtyCod);
unsigned Ctr_DB_GetNumCtrsWithMapInIns (long InsCod); unsigned Ctr_DB_GetNumCtrsWithMapInIns (long InsCod);
unsigned Ctr_DB_GetNumCtrsWithDegs (HieLvl_Level_t Scope,long Cod); unsigned Ctr_DB_GetNumCtrsWithDegs (HieLvl_Level_t Level,long Cod);
unsigned Ctr_DB_GetNumCtrsWithCrss (HieLvl_Level_t Scope,long Cod); unsigned Ctr_DB_GetNumCtrsWithCrss (HieLvl_Level_t Level,long Cod);
unsigned Ctr_DB_GetNumCtrsWithUsrs (Rol_Role_t Role, unsigned Ctr_DB_GetNumCtrsWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod); HieLvl_Level_t Level,long Cod);
void Ctr_DB_UpdateCtrIns (long CtrCod,long NewInsCod); void Ctr_DB_UpdateCtrIns (long CtrCod,long NewInsCod);
void Ctr_DB_UpdateCtrPlc (long CtrCod,long NewPlcCod); void Ctr_DB_UpdateCtrPlc (long CtrCod,long NewPlcCod);

View File

@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen. TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
*/ */
#define Log_PLATFORM_VERSION "SWAD 22.120.3 (2023-06-21)" #define Log_PLATFORM_VERSION "SWAD 22.120.4 (2023-07-11)"
#define CSS_FILE "swad22.120.css" #define CSS_FILE "swad22.120.4.css"
#define JS_FILE "swad22.49.js" #define JS_FILE "swad22.49.js"
/* /*
Version 22.120.4: Jul 11, 2023 Fixed bug in CSS related to global connected. (337624 lines)
Version 22.120.3: Jun 21, 2023 Fixed bug in forums. Reported by Raymon Moreno Colina. (337647 lines) Version 22.120.3: Jun 21, 2023 Fixed bug in forums. Reported by Raymon Moreno Colina. (337647 lines)
Version 22.120.2: Jun 07, 2023 Code refactoring related to cookies and hidden-visible. (337646 lines) Version 22.120.2: Jun 07, 2023 Code refactoring related to cookies and hidden-visible. (337646 lines)
Version 22.120.1: Jun 06, 2023 Translation of messages about cookies. (337620 lines) Version 22.120.1: Jun 06, 2023 Translation of messages about cookies. (337620 lines)

View File

@ -171,7 +171,7 @@ unsigned Con_DB_GetNumConnectedFromCurrentLocation (MYSQL_RES **mysql_res,Rol_Ro
" AND usr_connected.UsrCod=usr_data.UsrCod", " AND usr_connected.UsrCod=usr_data.UsrCod",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
} }
return 0; // Not reached return 0; // Not reached
case Rol_GST: case Rol_GST:
@ -314,7 +314,7 @@ unsigned Con_DB_GetNumConnectedFromCurrentLocation (MYSQL_RES **mysql_res,Rol_Ro
Gbl.Hierarchy.Crs.CrsCod, Gbl.Hierarchy.Crs.CrsCod,
(unsigned) Role); (unsigned) Role);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
} }
return 0; // Not reached return 0; // Not reached
default: default:
@ -469,7 +469,7 @@ unsigned Con_DB_GetConnectedFromCurrentLocation (MYSQL_RES **mysql_res,Rol_Role_
Gbl.Hierarchy.Crs.CrsCod, Gbl.Hierarchy.Crs.CrsCod,
(unsigned) Role); (unsigned) Role);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
} }
return 0; // Not reached return 0; // Not reached
default: default:

View File

@ -1746,7 +1746,7 @@ unsigned Cty_GetCachedNumCtysWithUsrs (Rol_Role_t Role)
[Rol_TCH] = FigCch_NUM_CTYS_WITH_TCHS, // Teachers [Rol_TCH] = FigCch_NUM_CTYS_WITH_TCHS, // Teachers
}; };
unsigned NumCtysWithUsrs; unsigned NumCtysWithUsrs;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of countries with users from cache *****/ /***** Get number of countries with users from cache *****/
if (!FigCch_GetFigureFromCache (FigureCtys[Role],Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigureCtys[Role],Gbl.Scope.Current,Cod,

View File

@ -66,7 +66,7 @@ typedef enum
} Cty_Order_t; } Cty_Order_t;
#define Cty_ORDER_DEFAULT Cty_ORDER_BY_NUM_USRS #define Cty_ORDER_DEFAULT Cty_ORDER_BY_NUM_USRS
struct ListCountries struct Cty_ListCtys
{ {
unsigned Num; // Number of countries unsigned Num; // Number of countries
struct Cty_Countr *Lst; // List of countries struct Cty_Countr *Lst; // List of countries

View File

@ -334,11 +334,11 @@ unsigned Cty_DB_GetNumCtysWithCrss (void)
/*****************************************************************************/ /*****************************************************************************/
unsigned Cty_DB_GetNumCtysWithUsrs (Rol_Role_t Role, unsigned Cty_DB_GetNumCtysWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod) HieLvl_Level_t Level,long Cod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,Cod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of countries with users", DB_QueryCOUNT ("can not get number of countries with users",

View File

@ -52,7 +52,7 @@ unsigned Cty_DB_GetNumCtysWithCtrs (void);
unsigned Cty_DB_GetNumCtysWithDegs (void); unsigned Cty_DB_GetNumCtysWithDegs (void);
unsigned Cty_DB_GetNumCtysWithCrss (void); unsigned Cty_DB_GetNumCtysWithCrss (void);
unsigned Cty_DB_GetNumCtysWithUsrs (Rol_Role_t Role, unsigned Cty_DB_GetNumCtysWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod); HieLvl_Level_t Level,long Cod);
bool Cty_DB_CheckIfNumericCountryCodeExists (long CtyCod); bool Cty_DB_CheckIfNumericCountryCodeExists (long CtyCod);
bool Cty_DB_CheckIfAlpha2CountryCodeExists (const char Alpha2[2 + 1]); bool Cty_DB_CheckIfAlpha2CountryCodeExists (const char Alpha2[2 + 1]);

View File

@ -598,7 +598,7 @@ unsigned Crs_GetCachedNumCrssWithUsrs (Rol_Role_t Role)
[Rol_TCH] = FigCch_NUM_CRSS_WITH_TCHS, // Teachers [Rol_TCH] = FigCch_NUM_CRSS_WITH_TCHS, // Teachers
}; };
unsigned NumCrssWithUsrs; unsigned NumCrssWithUsrs;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of courses with users from cache *****/ /***** Get number of courses with users from cache *****/
if (!FigCch_GetFigureFromCache (FigureCrss[Role],Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigureCrss[Role],Gbl.Scope.Current,Cod,

View File

@ -64,7 +64,7 @@ struct Crs_Course
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]; // Full name of course char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]; // Full name of course
}; };
struct Crs_ListCourses struct Crs_ListCrss
{ {
unsigned Num; // Number of courses unsigned Num; // Number of courses
struct Crs_Course *Lst; // List of courses struct Crs_Course *Lst; // List of courses

View File

@ -408,11 +408,11 @@ unsigned Crs_DB_GetNumCrssInDeg (long DegCod)
/*****************************************************************************/ /*****************************************************************************/
unsigned Crs_DB_GetNumCrssWithUsrs (Rol_Role_t Role, unsigned Crs_DB_GetNumCrssWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod) HieLvl_Level_t Level,long HieCod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,HieCod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of courses with users", DB_QueryCOUNT ("can not get number of courses with users",

View File

@ -60,7 +60,7 @@ unsigned Crs_DB_GetNumCrssInIns (long InsCod);
unsigned Crs_DB_GetNumCrssInCtr (long CtrCod); unsigned Crs_DB_GetNumCrssInCtr (long CtrCod);
unsigned Crs_DB_GetNumCrssInDeg (long DegCod); unsigned Crs_DB_GetNumCrssInDeg (long DegCod);
unsigned Crs_DB_GetNumCrssWithUsrs (Rol_Role_t Role, unsigned Crs_DB_GetNumCrssWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod); HieLvl_Level_t Level,long HieCod);
unsigned Crs_DB_GetCrssFromUsr (MYSQL_RES **mysql_res,long UsrCod,long DegCod); unsigned Crs_DB_GetCrssFromUsr (MYSQL_RES **mysql_res,long UsrCod,long DegCod);

View File

@ -42,12 +42,6 @@
#include "swad_HTML.h" #include "swad_HTML.h"
#include "swad_language.h" #include "swad_language.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
/************************* Private global variables **************************/ /************************* Private global variables **************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -955,7 +955,7 @@ void Deg_PutIconToViewDegrees (void)
/************ Create a list with all degrees that have students **************/ /************ Create a list with all degrees that have students **************/
/*****************************************************************************/ /*****************************************************************************/
void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs) void Deg_GetListAllDegsWithStds (struct Deg_ListDegs *Degs)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumDeg; unsigned NumDeg;
@ -1015,7 +1015,7 @@ void Deg_GetListDegsInCurrentCtr (void)
/*************************** Free list of degrees ****************************/ /*************************** Free list of degrees ****************************/
/*****************************************************************************/ /*****************************************************************************/
void Deg_FreeListDegs (struct ListDegrees *Degs) void Deg_FreeListDegs (struct Deg_ListDegs *Degs)
{ {
if (Degs->Lst) if (Degs->Lst)
{ {
@ -1662,7 +1662,7 @@ unsigned Deg_GetCachedNumDegsInCtr (long CtrCod)
unsigned Deg_GetCachedNumDegsWithCrss (void) unsigned Deg_GetCachedNumDegsWithCrss (void)
{ {
unsigned NumDegsWithCrss; unsigned NumDegsWithCrss;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of degrees with courses from cache *****/ /***** Get number of degrees with courses from cache *****/
if (!FigCch_GetFigureFromCache (FigCch_NUM_DEGS_WITH_CRSS,Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigCch_NUM_DEGS_WITH_CRSS,Gbl.Scope.Current,Cod,
@ -1690,7 +1690,7 @@ unsigned Deg_GetCachedNumDegsWithUsrs (Rol_Role_t Role)
[Rol_TCH] = FigCch_NUM_DEGS_WITH_TCHS, // Teachers [Rol_TCH] = FigCch_NUM_DEGS_WITH_TCHS, // Teachers
}; };
unsigned NumDegsWithUsrs; unsigned NumDegsWithUsrs;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of degrees with users from cache *****/ /***** Get number of degrees with users from cache *****/
if (!FigCch_GetFigureFromCache (FigureDegs[Role],Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigureDegs[Role],Gbl.Scope.Current,Cod,

View File

@ -59,7 +59,7 @@ struct Deg_Degree
char WWW[Cns_MAX_BYTES_WWW + 1]; char WWW[Cns_MAX_BYTES_WWW + 1];
}; };
struct ListDegrees struct Deg_ListDegs
{ {
unsigned Num; // Number of degrees unsigned Num; // Number of degrees
struct Deg_Degree *Lst; // List of degrees struct Deg_Degree *Lst; // List of degrees
@ -84,9 +84,9 @@ void Deg_EditDegrees (void);
void Deg_PutIconToViewDegrees (void); void Deg_PutIconToViewDegrees (void);
void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs); void Deg_GetListAllDegsWithStds (struct Deg_ListDegs *Degs);
void Deg_GetListDegsInCurrentCtr (void); void Deg_GetListDegsInCurrentCtr (void);
void Deg_FreeListDegs (struct ListDegrees *Degs); void Deg_FreeListDegs (struct Deg_ListDegs *Degs);
void Deg_ReceiveFormReqDeg (void); void Deg_ReceiveFormReqDeg (void);
void Deg_ReceiveFormNewDeg (void); void Deg_ReceiveFormNewDeg (void);

View File

@ -77,10 +77,10 @@ void Deg_DB_CreateDegree (struct Deg_Degree *Deg,Hie_Status_t Status)
/************************* Get number of degree types ************************/ /************************* Get number of degree types ************************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Deg_DB_GetNumDegreeTypes (HieLvl_Level_t Scope) unsigned Deg_DB_GetNumDegreeTypes (HieLvl_Level_t Level)
{ {
/***** Get number of types of degree from database *****/ /***** Get number of types of degree from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -140,7 +140,7 @@ unsigned Deg_DB_GetNumDegreeTypes (HieLvl_Level_t Scope)
" AND deg_degrees.DegTypCod=deg_types.DegTypCod", " AND deg_degrees.DegTypCod=deg_types.DegTypCod",
Gbl.Hierarchy.Deg.DegCod); Gbl.Hierarchy.Deg.DegCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -150,7 +150,7 @@ unsigned Deg_DB_GetNumDegreeTypes (HieLvl_Level_t Scope)
/*****************************************************************************/ /*****************************************************************************/
unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res, unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res,
HieLvl_Level_t Scope,DegTyp_Order_t Order) HieLvl_Level_t Level,DegTyp_Order_t Order)
{ {
static const char *OrderBySubQuery[DegTyp_NUM_ORDERS] = static const char *OrderBySubQuery[DegTyp_NUM_ORDERS] =
{ {
@ -160,7 +160,7 @@ unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res,
}; };
/***** Get types of degree from database *****/ /***** Get types of degree from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
/* Get /* Get
@ -257,7 +257,7 @@ unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res,
Gbl.Hierarchy.Deg.DegCod, Gbl.Hierarchy.Deg.DegCod,
OrderBySubQuery[Order]); OrderBySubQuery[Order]);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -465,7 +465,7 @@ unsigned Deg_DB_GetDegsWithPendingCrss (MYSQL_RES **mysql_res)
" GROUP BY crs_courses.DegCod" " GROUP BY crs_courses.DegCod"
" ORDER BY deg_degrees.ShortName", " ORDER BY deg_degrees.ShortName",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_GetDBStrFromScope (HieLvl_DEG), Hie_GetDBStrFromLevel (HieLvl_DEG),
(unsigned) Hie_STATUS_BIT_PENDING); (unsigned) Hie_STATUS_BIT_PENDING);
case Rol_SYS_ADM: case Rol_SYS_ADM:
return (unsigned) return (unsigned)
@ -563,11 +563,11 @@ unsigned Deg_DB_SearchDegs (MYSQL_RES **mysql_res,
/***************** Get current number of degrees with courses ****************/ /***************** Get current number of degrees with courses ****************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Deg_DB_GetNumDegsWithCrss (HieLvl_Level_t Scope,long Cod) unsigned Deg_DB_GetNumDegsWithCrss (HieLvl_Level_t Level,long Cod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,Cod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of degrees with courses", DB_QueryCOUNT ("can not get number of degrees with courses",
@ -588,11 +588,11 @@ unsigned Deg_DB_GetNumDegsWithCrss (HieLvl_Level_t Scope,long Cod)
/*****************************************************************************/ /*****************************************************************************/
unsigned Deg_DB_GetNumDegsWithUsrs (Rol_Role_t Role, unsigned Deg_DB_GetNumDegsWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod) HieLvl_Level_t Level,long Cod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,Cod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of degrees with users", DB_QueryCOUNT ("can not get number of degrees with users",

View File

@ -40,9 +40,9 @@
void Deg_DB_CreateDegreeType (const char DegTypName[DegTyp_MAX_BYTES_DEGREE_TYPE_NAME + 1]); void Deg_DB_CreateDegreeType (const char DegTypName[DegTyp_MAX_BYTES_DEGREE_TYPE_NAME + 1]);
void Deg_DB_CreateDegree (struct Deg_Degree *Deg,Hie_Status_t Status); void Deg_DB_CreateDegree (struct Deg_Degree *Deg,Hie_Status_t Status);
unsigned Deg_DB_GetNumDegreeTypes (HieLvl_Level_t Scope); unsigned Deg_DB_GetNumDegreeTypes (HieLvl_Level_t Level);
unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res, unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res,
HieLvl_Level_t Scope,DegTyp_Order_t Order); HieLvl_Level_t Level,DegTyp_Order_t Order);
void Deg_DB_GetDegTypeNameByCod (struct DegTyp_DegreeType *DegTyp); void Deg_DB_GetDegTypeNameByCod (struct DegTyp_DegreeType *DegTyp);
unsigned Deg_DB_GetDegreeDataByCod (MYSQL_RES **mysql_res,long DegCod); unsigned Deg_DB_GetDegreeDataByCod (MYSQL_RES **mysql_res,long DegCod);
long Deg_DB_GetInsCodOfDegreeByCod (long DegCod); long Deg_DB_GetInsCodOfDegreeByCod (long DegCod);
@ -62,9 +62,9 @@ unsigned Deg_DB_SearchDegs (MYSQL_RES **mysql_res,
const char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1], const char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1],
const char *RangeQuery); const char *RangeQuery);
unsigned Deg_DB_GetNumDegsWithCrss (HieLvl_Level_t Scope,long Cod); unsigned Deg_DB_GetNumDegsWithCrss (HieLvl_Level_t Level,long Cod);
unsigned Deg_DB_GetNumDegsWithUsrs (Rol_Role_t Role, unsigned Deg_DB_GetNumDegsWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod); HieLvl_Level_t Level,long Cod);
unsigned Deg_DB_GetNumDegsInCty (long CtyCod); unsigned Deg_DB_GetNumDegsInCty (long CtyCod);
unsigned Deg_DB_GetNumDegsInIns (long InsCod); unsigned Deg_DB_GetNumDegsInIns (long InsCod);

View File

@ -65,13 +65,13 @@ static struct DegTyp_DegreeType *DegTyp_EditingDegTyp = NULL; // Static variable
/*************************** Private prototypes ******************************/ /*************************** Private prototypes ******************************/
/*****************************************************************************/ /*****************************************************************************/
static void DegTyp_SeeDegreeTypes (Act_Action_t NextAction,HieLvl_Level_t Scope, static void DegTyp_SeeDegreeTypes (Act_Action_t NextAction,HieLvl_Level_t Level,
DegTyp_Order_t DefaultOrder); DegTyp_Order_t DefaultOrder);
static DegTyp_Order_t DegTyp_GetParDegTypOrder (DegTyp_Order_t DefaultOrder); static DegTyp_Order_t DegTyp_GetParDegTypOrder (DegTyp_Order_t DefaultOrder);
static void DegTyp_ListDegreeTypes (const struct DegTyp_DegTypes *DegTypes, static void DegTyp_ListDegreeTypes (const struct DegTyp_DegTypes *DegTypes,
Act_Action_t NextAction, Act_Action_t NextAction,
HieLvl_Level_t Scope, HieLvl_Level_t Level,
DegTyp_Order_t SelectedOrder); DegTyp_Order_t SelectedOrder);
static void DegTyp_EditDegreeTypesInternal (const struct DegTyp_DegTypes *DegTypes); static void DegTyp_EditDegreeTypesInternal (const struct DegTyp_DegTypes *DegTypes);
@ -85,7 +85,7 @@ static void DegTyp_ListDegreeTypesForEdition (const struct DegTyp_DegTypes *DegT
static void DegTyp_PutFormToCreateDegreeType (void); static void DegTyp_PutFormToCreateDegreeType (void);
static void DegTyp_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction, static void DegTyp_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction,
HieLvl_Level_t Scope, HieLvl_Level_t Level,
DegTyp_Order_t SelectedOrder); DegTyp_Order_t SelectedOrder);
static void DegTyp_PutHeadDegreeTypesForEdition (void); static void DegTyp_PutHeadDegreeTypesForEdition (void);
@ -154,7 +154,7 @@ void DegTyp_SeeDegreeTypesInStaTab (void)
DegTyp_ORDER_BY_NUM_DEGREES); // Default order if not specified DegTyp_ORDER_BY_NUM_DEGREES); // Default order if not specified
} }
static void DegTyp_SeeDegreeTypes (Act_Action_t NextAction,HieLvl_Level_t Scope, static void DegTyp_SeeDegreeTypes (Act_Action_t NextAction,HieLvl_Level_t Level,
DegTyp_Order_t DefaultOrder) DegTyp_Order_t DefaultOrder)
{ {
DegTyp_Order_t SelectedOrder; DegTyp_Order_t SelectedOrder;
@ -164,10 +164,10 @@ static void DegTyp_SeeDegreeTypes (Act_Action_t NextAction,HieLvl_Level_t Scope,
SelectedOrder = DegTyp_GetParDegTypOrder (DefaultOrder); SelectedOrder = DegTyp_GetParDegTypOrder (DefaultOrder);
/***** Get list of degree types *****/ /***** Get list of degree types *****/
DegTyp_GetListDegreeTypes (&DegTypes,Scope,SelectedOrder); DegTyp_GetListDegreeTypes (&DegTypes,Level,SelectedOrder);
/***** List degree types *****/ /***** List degree types *****/
DegTyp_ListDegreeTypes (&DegTypes,NextAction,Scope,SelectedOrder); DegTyp_ListDegreeTypes (&DegTypes,NextAction,Level,SelectedOrder);
/***** Free list of degree types *****/ /***** Free list of degree types *****/
DegTyp_FreeListDegreeTypes (&DegTypes); DegTyp_FreeListDegreeTypes (&DegTypes);
@ -194,7 +194,7 @@ static DegTyp_Order_t DegTyp_GetParDegTypOrder (DegTyp_Order_t DefaultOrder)
static void DegTyp_ListDegreeTypes (const struct DegTyp_DegTypes *DegTypes, static void DegTyp_ListDegreeTypes (const struct DegTyp_DegTypes *DegTypes,
Act_Action_t NextAction, Act_Action_t NextAction,
HieLvl_Level_t Scope, HieLvl_Level_t Level,
DegTyp_Order_t SelectedOrder) DegTyp_Order_t SelectedOrder)
{ {
extern const char *Hlp_CENTER_DegreeTypes; extern const char *Hlp_CENTER_DegreeTypes;
@ -225,7 +225,7 @@ static void DegTyp_ListDegreeTypes (const struct DegTyp_DegTypes *DegTypes,
HTM_TABLE_BeginWideMarginPadding (2); HTM_TABLE_BeginWideMarginPadding (2);
/***** Write heading *****/ /***** Write heading *****/
DegTyp_PutHeadDegreeTypesForSeeing (NextAction,Scope,SelectedOrder); DegTyp_PutHeadDegreeTypesForSeeing (NextAction,Level,SelectedOrder);
/***** List current degree types for seeing *****/ /***** List current degree types for seeing *****/
DegTyp_ListDegreeTypesForSeeing (DegTypes); DegTyp_ListDegreeTypesForSeeing (DegTypes);
@ -502,7 +502,7 @@ static void DegTyp_PutFormToCreateDegreeType (void)
/*****************************************************************************/ /*****************************************************************************/
static void DegTyp_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction, static void DegTyp_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction,
HieLvl_Level_t Scope, HieLvl_Level_t Level,
DegTyp_Order_t SelectedOrder) DegTyp_Order_t SelectedOrder)
{ {
extern const char *Txt_DEGREE_TYPES_HELP_ORDER[DegTyp_NUM_ORDERS]; extern const char *Txt_DEGREE_TYPES_HELP_ORDER[DegTyp_NUM_ORDERS];
@ -529,7 +529,7 @@ static void DegTyp_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction,
Frm_BeginForm (NextAction); Frm_BeginForm (NextAction);
if (NextAction == ActSeeUseGbl) if (NextAction == ActSeeUseGbl)
{ {
Figures.Scope = Scope; Figures.Level = Level;
Figures.FigureType = Fig_DEGREE_TYPES; Figures.FigureType = Fig_DEGREE_TYPES;
Fig_PutParsFigures (&Figures); Fig_PutParsFigures (&Figures);
} }
@ -579,14 +579,14 @@ static void DegTyp_PutHeadDegreeTypesForEdition (void)
/*****************************************************************************/ /*****************************************************************************/
void DegTyp_GetListDegreeTypes (struct DegTyp_DegTypes *DegTypes, void DegTyp_GetListDegreeTypes (struct DegTyp_DegTypes *DegTypes,
HieLvl_Level_t Scope,DegTyp_Order_t Order) HieLvl_Level_t Level,DegTyp_Order_t Order)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumTyp; unsigned NumTyp;
/***** Get types of degree from database *****/ /***** Get types of degree from database *****/
DegTypes->Num = Deg_DB_GetDegreeTypes (&mysql_res,Scope,Order); DegTypes->Num = Deg_DB_GetDegreeTypes (&mysql_res,Level,Order);
DegTypes->Lst = NULL; DegTypes->Lst = NULL;
/***** Get degree types *****/ /***** Get degree types *****/

View File

@ -76,7 +76,7 @@ void DegTyp_PutIconToViewDegreeTypes (void);
bool DegTyp_CheckIfICanCreateDegreeTypes (void); bool DegTyp_CheckIfICanCreateDegreeTypes (void);
void DegTyp_GetListDegreeTypes (struct DegTyp_DegTypes *DegTypes, void DegTyp_GetListDegreeTypes (struct DegTyp_DegTypes *DegTypes,
HieLvl_Level_t Scope,DegTyp_Order_t Order); HieLvl_Level_t Level,DegTyp_Order_t Order);
void DegTyp_FreeListDegreeTypes (struct DegTyp_DegTypes *DegTypes); void DegTyp_FreeListDegreeTypes (struct DegTyp_DegTypes *DegTypes);
void DegTyp_ReceiveFormNewDegreeType (void); void DegTyp_ReceiveFormNewDegreeType (void);

View File

@ -3471,7 +3471,7 @@ bool Enr_CheckIfUsrSharesAnyOfMyCrs (struct Usr_Data *UsrDat)
#define Enr_DB_MAX_BYTES_SUBQUERY_ROLES (Rol_NUM_ROLES * (10 + 1) - 1) #define Enr_DB_MAX_BYTES_SUBQUERY_ROLES (Rol_NUM_ROLES * (10 + 1) - 1)
unsigned Enr_GetNumUsrsInCrss (HieLvl_Level_t Scope,long Cod,unsigned Roles) unsigned Enr_GetNumUsrsInCrss (HieLvl_Level_t Level,long Cod,unsigned Roles)
{ {
bool AnyUserInCourses; bool AnyUserInCourses;
unsigned NumUsrs; unsigned NumUsrs;
@ -3496,22 +3496,22 @@ unsigned Enr_GetNumUsrsInCrss (HieLvl_Level_t Scope,long Cod,unsigned Roles)
(1 << Rol_TCH))); (1 << Rol_TCH)));
/***** Get number of users from database *****/ /***** Get number of users from database *****/
NumUsrs = Enr_DB_GetNumUsrsInCrss (Scope,Cod,Roles,AnyUserInCourses); NumUsrs = Enr_DB_GetNumUsrsInCrss (Level,Cod,Roles,AnyUserInCourses);
FigCch_UpdateFigureIntoCache (Enr_GetFigureNumUsrsInCrss (Roles),Scope,Cod, FigCch_UpdateFigureIntoCache (Enr_GetFigureNumUsrsInCrss (Roles),Level,Cod,
FigCch_UNSIGNED,&NumUsrs); FigCch_UNSIGNED,&NumUsrs);
return NumUsrs; return NumUsrs;
} }
unsigned Enr_GetCachedNumUsrsInCrss (HieLvl_Level_t Scope,long Cod,unsigned Roles) unsigned Enr_GetCachedNumUsrsInCrss (HieLvl_Level_t Level,long Cod,unsigned Roles)
{ {
unsigned NumUsrsInCrss; unsigned NumUsrsInCrss;
/***** Get number of users in courses from cache *****/ /***** Get number of users in courses from cache *****/
if (!FigCch_GetFigureFromCache (Enr_GetFigureNumUsrsInCrss (Roles),Scope,Cod, if (!FigCch_GetFigureFromCache (Enr_GetFigureNumUsrsInCrss (Roles),Level,Cod,
FigCch_UNSIGNED,&NumUsrsInCrss)) FigCch_UNSIGNED,&NumUsrsInCrss))
/***** Get current number of users in courses from database and update cache *****/ /***** Get current number of users in courses from database and update cache *****/
NumUsrsInCrss = Enr_GetNumUsrsInCrss (Scope,Cod,Roles); NumUsrsInCrss = Enr_GetNumUsrsInCrss (Level,Cod,Roles);
return NumUsrsInCrss; return NumUsrsInCrss;
} }
@ -3564,7 +3564,7 @@ unsigned Enr_GetCachedNumUsrsNotBelongingToAnyCrs (void)
/************ Get average number of courses with users of a type *************/ /************ Get average number of courses with users of a type *************/
/*****************************************************************************/ /*****************************************************************************/
double Enr_GetCachedAverageNumUsrsPerCrs (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role) double Enr_GetCachedAverageNumUsrsPerCrs (HieLvl_Level_t Level,long Cod,Rol_Role_t Role)
{ {
static const FigCch_FigureCached_t FigureNumUsrsPerCrs[Rol_NUM_ROLES] = static const FigCch_FigureCached_t FigureNumUsrsPerCrs[Rol_NUM_ROLES] =
{ {
@ -3576,12 +3576,12 @@ double Enr_GetCachedAverageNumUsrsPerCrs (HieLvl_Level_t Scope,long Cod,Rol_Role
double AverageNumUsrsPerCrs; double AverageNumUsrsPerCrs;
/***** Get number of users per course from cache *****/ /***** Get number of users per course from cache *****/
if (!FigCch_GetFigureFromCache (FigureNumUsrsPerCrs[Role],Scope,Cod, if (!FigCch_GetFigureFromCache (FigureNumUsrsPerCrs[Role],Level,Cod,
FigCch_DOUBLE,&AverageNumUsrsPerCrs)) FigCch_DOUBLE,&AverageNumUsrsPerCrs))
{ {
/***** Get current number of users per course from database and update cache *****/ /***** Get current number of users per course from database and update cache *****/
AverageNumUsrsPerCrs = Enr_DB_GetAverageNumUsrsPerCrs (Scope,Cod,Role); AverageNumUsrsPerCrs = Enr_DB_GetAverageNumUsrsPerCrs (Level,Cod,Role);
FigCch_UpdateFigureIntoCache (FigureNumUsrsPerCrs[Role],Scope,Cod, FigCch_UpdateFigureIntoCache (FigureNumUsrsPerCrs[Role],Level,Cod,
FigCch_DOUBLE,&AverageNumUsrsPerCrs); FigCch_DOUBLE,&AverageNumUsrsPerCrs);
} }
@ -3592,7 +3592,7 @@ double Enr_GetCachedAverageNumUsrsPerCrs (HieLvl_Level_t Scope,long Cod,Rol_Role
/************ Get average number of courses with users of a role *************/ /************ Get average number of courses with users of a role *************/
/*****************************************************************************/ /*****************************************************************************/
double Enr_GetCachedAverageNumCrssPerUsr (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role) double Enr_GetCachedAverageNumCrssPerUsr (HieLvl_Level_t Level,long Cod,Rol_Role_t Role)
{ {
static const FigCch_FigureCached_t FigureNumCrssPerUsr[Rol_NUM_ROLES] = static const FigCch_FigureCached_t FigureNumCrssPerUsr[Rol_NUM_ROLES] =
{ {
@ -3604,12 +3604,12 @@ double Enr_GetCachedAverageNumCrssPerUsr (HieLvl_Level_t Scope,long Cod,Rol_Role
double AverageNumCrssPerUsr; double AverageNumCrssPerUsr;
/***** Get number of courses per user from cache *****/ /***** Get number of courses per user from cache *****/
if (!FigCch_GetFigureFromCache (FigureNumCrssPerUsr[Role],Scope,Cod, if (!FigCch_GetFigureFromCache (FigureNumCrssPerUsr[Role],Level,Cod,
FigCch_DOUBLE,&AverageNumCrssPerUsr)) FigCch_DOUBLE,&AverageNumCrssPerUsr))
{ {
/***** Get current number of courses per user from database and update cache *****/ /***** Get current number of courses per user from database and update cache *****/
AverageNumCrssPerUsr = Enr_DB_GetAverageNumCrssPerUsr (Scope,Cod,Role); AverageNumCrssPerUsr = Enr_DB_GetAverageNumCrssPerUsr (Level,Cod,Role);
FigCch_UpdateFigureIntoCache (FigureNumCrssPerUsr[Role],Scope,Cod, FigCch_UpdateFigureIntoCache (FigureNumCrssPerUsr[Role],Level,Cod,
FigCch_DOUBLE,&AverageNumCrssPerUsr); FigCch_DOUBLE,&AverageNumCrssPerUsr);
} }

View File

@ -142,7 +142,7 @@ void Enr_FreeMyCourses (void);
bool Enr_CheckIfIBelongToCrs (long CrsCod); bool Enr_CheckIfIBelongToCrs (long CrsCod);
void Enr_FlushCacheUsrBelongsToCrs (void); void Enr_FlushCacheUsrBelongsToCrs (void);
bool Enr_CheckIfUsrBelongsToCrs (long UsrCod,long CrsCod, bool Enr_CheckIfUsrBelongsToCrs (long UsrCod,long CrsCod,
bool CountOnlyAcceptedCourses);; bool CountOnlyAcceptedCourses);
void Enr_FlushCacheUsrBelongsToCurrentCrs (void); void Enr_FlushCacheUsrBelongsToCurrentCrs (void);
bool Enr_CheckIfUsrBelongsToCurrentCrs (const struct Usr_Data *UsrDat); bool Enr_CheckIfUsrBelongsToCurrentCrs (const struct Usr_Data *UsrDat);
void Enr_FlushCacheUsrHasAcceptedInCurrentCrs (void); void Enr_FlushCacheUsrHasAcceptedInCurrentCrs (void);
@ -150,10 +150,10 @@ bool Enr_CheckIfUsrHasAcceptedInCurrentCrs (const struct Usr_Data *UsrDat);
void Enr_FlushCacheUsrSharesAnyOfMyCrs (void); void Enr_FlushCacheUsrSharesAnyOfMyCrs (void);
bool Enr_CheckIfUsrSharesAnyOfMyCrs (struct Usr_Data *UsrDat); bool Enr_CheckIfUsrSharesAnyOfMyCrs (struct Usr_Data *UsrDat);
unsigned Enr_GetNumUsrsInCrss (HieLvl_Level_t Scope,long Cod,unsigned Roles); unsigned Enr_GetNumUsrsInCrss (HieLvl_Level_t Level,long Cod,unsigned Roles);
unsigned Enr_GetCachedNumUsrsInCrss (HieLvl_Level_t Scope,long Cod,unsigned Roles); unsigned Enr_GetCachedNumUsrsInCrss (HieLvl_Level_t Level,long Cod,unsigned Roles);
unsigned Enr_GetCachedNumUsrsNotBelongingToAnyCrs (void); unsigned Enr_GetCachedNumUsrsNotBelongingToAnyCrs (void);
double Enr_GetCachedAverageNumUsrsPerCrs (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role); double Enr_GetCachedAverageNumUsrsPerCrs (HieLvl_Level_t Level,long Cod,Rol_Role_t Role);
double Enr_GetCachedAverageNumCrssPerUsr (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role); double Enr_GetCachedAverageNumCrssPerUsr (HieLvl_Level_t Level,long Cod,Rol_Role_t Role);
#endif #endif

View File

@ -442,7 +442,7 @@ unsigned Enr_DB_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
#define Enr_DB_MAX_BYTES_SUBQUERY_ROLES (Rol_NUM_ROLES * (10 + 1) - 1) #define Enr_DB_MAX_BYTES_SUBQUERY_ROLES (Rol_NUM_ROLES * (10 + 1) - 1)
unsigned Enr_DB_GetNumUsrsInCrss (HieLvl_Level_t Scope,long Cod,unsigned Roles, unsigned Enr_DB_GetNumUsrsInCrss (HieLvl_Level_t Level,long Cod,unsigned Roles,
bool AnyUserInCourses) bool AnyUserInCourses)
{ {
char UnsignedStr[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char UnsignedStr[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
@ -497,7 +497,7 @@ unsigned Enr_DB_GetNumUsrsInCrss (HieLvl_Level_t Scope,long Cod,unsigned Roles,
sprintf (SubQueryRoles,"=%u",FirstRoleRequested); sprintf (SubQueryRoles,"=%u",FirstRoleRequested);
/***** Get number of users from database *****/ /***** Get number of users from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
if (AnyUserInCourses) // Any user if (AnyUserInCourses) // Any user
@ -644,7 +644,7 @@ unsigned Enr_DB_GetNumUsrsInCrss (HieLvl_Level_t Scope,long Cod,unsigned Roles,
Cod, Cod,
SubQueryRoles); SubQueryRoles);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -670,9 +670,9 @@ unsigned Enr_DB_GetNumUsrsNotBelongingToAnyCrs (void)
/************ Get average number of courses with users of a type *************/ /************ Get average number of courses with users of a type *************/
/*****************************************************************************/ /*****************************************************************************/
double Enr_DB_GetAverageNumUsrsPerCrs (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role) double Enr_DB_GetAverageNumUsrsPerCrs (HieLvl_Level_t Level,long Cod,Rol_Role_t Role)
{ {
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
if (Role == Rol_UNK) // Any user if (Role == Rol_UNK) // Any user
@ -813,7 +813,7 @@ double Enr_DB_GetAverageNumUsrsPerCrs (HieLvl_Level_t Scope,long Cod,Rol_Role_t
1 << Role); 1 << Role);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0.0; // Not reached return 0.0; // Not reached
} }
} }
@ -822,9 +822,9 @@ double Enr_DB_GetAverageNumUsrsPerCrs (HieLvl_Level_t Scope,long Cod,Rol_Role_t
/************ Get average number of courses with users of a role *************/ /************ Get average number of courses with users of a role *************/
/*****************************************************************************/ /*****************************************************************************/
double Enr_DB_GetAverageNumCrssPerUsr (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role) double Enr_DB_GetAverageNumCrssPerUsr (HieLvl_Level_t Level,long Cod,Rol_Role_t Role)
{ {
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
if (Role == Rol_UNK) // Any user if (Role == Rol_UNK) // Any user
@ -960,7 +960,7 @@ double Enr_DB_GetAverageNumCrssPerUsr (HieLvl_Level_t Scope,long Cod,Rol_Role_t
case HieLvl_CRS: case HieLvl_CRS:
return 1.0; return 1.0;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0.0; // Not reached return 0.0; // Not reached
} }
} }
@ -1087,7 +1087,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
" AND crs_courses.CrsCod=crs_requests.CrsCod" " AND crs_courses.CrsCod=crs_requests.CrsCod"
" AND ((1<<crs_requests.Role)&%u)<>0" " AND ((1<<crs_requests.Role)&%u)<>0"
" ORDER BY crs_requests.RequestTime DESC", " ORDER BY crs_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,Sco_GetDBStrFromScope (HieLvl_DEG), Gbl.Usrs.Me.UsrDat.UsrCod,Hie_GetDBStrFromLevel (HieLvl_DEG),
RolesSelected); RolesSelected);
case Rol_CTR_ADM: case Rol_CTR_ADM:
// Requests in all centers administrated by me // Requests in all centers administrated by me
@ -1109,7 +1109,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
" AND crs_courses.CrsCod=crs_requests.CrsCod" " AND crs_courses.CrsCod=crs_requests.CrsCod"
" AND ((1<<crs_requests.Role)&%u)<>0" " AND ((1<<crs_requests.Role)&%u)<>0"
" ORDER BY crs_requests.RequestTime DESC", " ORDER BY crs_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,Sco_GetDBStrFromScope (HieLvl_CTR), Gbl.Usrs.Me.UsrDat.UsrCod,Hie_GetDBStrFromLevel (HieLvl_CTR),
RolesSelected); RolesSelected);
case Rol_INS_ADM: case Rol_INS_ADM:
// Requests in all institutions administrated by me // Requests in all institutions administrated by me
@ -1133,7 +1133,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
" AND crs_courses.CrsCod=crs_requests.CrsCod" " AND crs_courses.CrsCod=crs_requests.CrsCod"
" AND ((1<<crs_requests.Role)&%u)<>0" " AND ((1<<crs_requests.Role)&%u)<>0"
" ORDER BY crs_requests.RequestTime DESC", " ORDER BY crs_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,Sco_GetDBStrFromScope (HieLvl_INS), Gbl.Usrs.Me.UsrDat.UsrCod,Hie_GetDBStrFromLevel (HieLvl_INS),
RolesSelected); RolesSelected);
case Rol_SYS_ADM: case Rol_SYS_ADM:
// All requests // All requests
@ -1211,7 +1211,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
" AND ((1<<crs_requests.Role)&%u)<>0" " AND ((1<<crs_requests.Role)&%u)<>0"
" ORDER BY crs_requests.RequestTime DESC", " ORDER BY crs_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_GetDBStrFromScope (HieLvl_DEG), Hie_GetDBStrFromLevel (HieLvl_DEG),
Gbl.Hierarchy.Cty.CtyCod, Gbl.Hierarchy.Cty.CtyCod,
RolesSelected); RolesSelected);
case Rol_CTR_ADM: case Rol_CTR_ADM:
@ -1240,7 +1240,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
" AND ((1<<crs_requests.Role)&%u)<>0" " AND ((1<<crs_requests.Role)&%u)<>0"
" ORDER BY crs_requests.RequestTime DESC", " ORDER BY crs_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_GetDBStrFromScope (HieLvl_CTR), Hie_GetDBStrFromLevel (HieLvl_CTR),
Gbl.Hierarchy.Cty.CtyCod, Gbl.Hierarchy.Cty.CtyCod,
RolesSelected); RolesSelected);
case Rol_INS_ADM: case Rol_INS_ADM:
@ -1269,7 +1269,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
" AND ((1<<crs_requests.Role)&%u)<>0" " AND ((1<<crs_requests.Role)&%u)<>0"
" ORDER BY crs_requests.RequestTime DESC", " ORDER BY crs_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_GetDBStrFromScope (HieLvl_INS), Hie_GetDBStrFromLevel (HieLvl_INS),
Gbl.Hierarchy.Cty.CtyCod, Gbl.Hierarchy.Cty.CtyCod,
RolesSelected); RolesSelected);
case Rol_SYS_ADM: case Rol_SYS_ADM:
@ -1354,7 +1354,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
" AND ((1<<crs_requests.Role)&%u)<>0" " AND ((1<<crs_requests.Role)&%u)<>0"
" ORDER BY crs_requests.RequestTime DESC", " ORDER BY crs_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_GetDBStrFromScope (HieLvl_DEG), Hie_GetDBStrFromLevel (HieLvl_DEG),
Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Ins.InsCod,
RolesSelected); RolesSelected);
case Rol_CTR_ADM: case Rol_CTR_ADM:
@ -1380,7 +1380,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
" AND crs_courses.CrsCod=crs_requests.CrsCod" " AND crs_courses.CrsCod=crs_requests.CrsCod"
" AND ((1<<crs_requests.Role)&%u)<>0" " AND ((1<<crs_requests.Role)&%u)<>0"
" ORDER BY crs_requests.RequestTime DESC", " ORDER BY crs_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,Sco_GetDBStrFromScope (HieLvl_CTR), Gbl.Usrs.Me.UsrDat.UsrCod,Hie_GetDBStrFromLevel (HieLvl_CTR),
Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Ins.InsCod,
RolesSelected); RolesSelected);
case Rol_INS_ADM: // If I am logged as admin of this institution, I can view all requesters from this institution case Rol_INS_ADM: // If I am logged as admin of this institution, I can view all requesters from this institution
@ -1460,7 +1460,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
" AND ((1<<crs_requests.Role)&%u)<>0" " AND ((1<<crs_requests.Role)&%u)<>0"
" ORDER BY crs_requests.RequestTime DESC", " ORDER BY crs_requests.RequestTime DESC",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_GetDBStrFromScope (HieLvl_DEG), Hie_GetDBStrFromLevel (HieLvl_DEG),
Gbl.Hierarchy.Ctr.CtrCod, Gbl.Hierarchy.Ctr.CtrCod,
RolesSelected); RolesSelected);
case Rol_CTR_ADM: // If I am logged as admin of this center , I can view all requesters from this center case Rol_CTR_ADM: // If I am logged as admin of this center , I can view all requesters from this center
@ -1568,7 +1568,7 @@ unsigned Enr_DB_GetEnrolmentRequests (MYSQL_RES **mysql_res,unsigned RolesSelect
} }
return 0; // Not reached return 0; // Not reached
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -58,11 +58,11 @@ unsigned Enr_DB_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role);
unsigned Enr_DB_GetNumCrssOfUsrWithARoleNotAccepted (long UsrCod,Rol_Role_t Role); unsigned Enr_DB_GetNumCrssOfUsrWithARoleNotAccepted (long UsrCod,Rol_Role_t Role);
unsigned Enr_DB_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole, unsigned Enr_DB_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
unsigned OthersRoles); unsigned OthersRoles);
unsigned Enr_DB_GetNumUsrsInCrss (HieLvl_Level_t Scope,long Cod,unsigned Roles, unsigned Enr_DB_GetNumUsrsInCrss (HieLvl_Level_t Level,long Cod,unsigned Roles,
bool AnyUserInCourses); bool AnyUserInCourses);
unsigned Enr_DB_GetNumUsrsNotBelongingToAnyCrs (void); unsigned Enr_DB_GetNumUsrsNotBelongingToAnyCrs (void);
double Enr_DB_GetAverageNumUsrsPerCrs (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role); double Enr_DB_GetAverageNumUsrsPerCrs (HieLvl_Level_t Level,long Cod,Rol_Role_t Role);
double Enr_DB_GetAverageNumCrssPerUsr (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role); double Enr_DB_GetAverageNumCrssPerUsr (HieLvl_Level_t Level,long Cod,Rol_Role_t Role);
void Enr_DB_RemUsrFromCrs (long UsrCod,long CrsCod); void Enr_DB_RemUsrFromCrs (long UsrCod,long CrsCod);
void Enr_DB_RemUsrFromAllCrss (long UsrCod); void Enr_DB_RemUsrFromAllCrss (long UsrCod);

View File

@ -81,9 +81,9 @@ void Err_WrongActionExit (void)
/************* Write error message and exit when wrong scope *****************/ /************* Write error message and exit when wrong scope *****************/
/*****************************************************************************/ /*****************************************************************************/
void Err_WrongScopeExit (void) void Err_WrongHierarchyLevelExit (void)
{ {
Err_ShowErrorAndExit ("Wrong scope."); Err_ShowErrorAndExit ("Wrong hierarchy level.");
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -32,7 +32,7 @@ void Err_PathTooLongExit (void);
void Err_QuerySizeExceededExit (void); void Err_QuerySizeExceededExit (void);
void Err_WrongActionExit (void); void Err_WrongActionExit (void);
void Err_WrongScopeExit (void); void Err_WrongHierarchyLevelExit (void);
void Err_WrongCountrExit (void); void Err_WrongCountrExit (void);
void Err_WrongInstitExit (void); void Err_WrongInstitExit (void);
void Err_WrongCenterExit (void); void Err_WrongCenterExit (void);

View File

@ -265,12 +265,12 @@ bool Exa_DB_CheckIfSimilarExamExists (long CrsCod,long ExaCod,const char *Title)
/*****************************************************************************/ /*****************************************************************************/
/********************* Get number of courses with exams **********************/ /********************* Get number of courses with exams **********************/
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of courses with exams in this location // Returns the number of courses with exams in a given location
unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Scope) unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Level)
{ {
/***** Get number of courses with exams from database *****/ /***** Get number of courses with exams from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return DB_QueryCOUNT ("can not get number of courses with exams", return DB_QueryCOUNT ("can not get number of courses with exams",
@ -327,7 +327,7 @@ unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Scope)
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -335,12 +335,12 @@ unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Scope)
/*****************************************************************************/ /*****************************************************************************/
/**************************** Get number of exams ****************************/ /**************************** Get number of exams ****************************/
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of exams in this location // Returns the number of exams in a given location
unsigned Exa_DB_GetNumExams (HieLvl_Level_t Scope) unsigned Exa_DB_GetNumExams (HieLvl_Level_t Level)
{ {
/***** Get number of exams from database *****/ /***** Get number of exams from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return DB_QueryCOUNT ("can not get number of exams", return DB_QueryCOUNT ("can not get number of exams",
@ -397,7 +397,7 @@ unsigned Exa_DB_GetNumExams (HieLvl_Level_t Scope)
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -406,10 +406,10 @@ unsigned Exa_DB_GetNumExams (HieLvl_Level_t Scope)
/************* Get average number of questions per course exam ***************/ /************* Get average number of questions per course exam ***************/
/*****************************************************************************/ /*****************************************************************************/
double Exa_DB_GetNumQstsPerCrsExam (HieLvl_Level_t Scope) double Exa_DB_GetNumQstsPerCrsExam (HieLvl_Level_t Level)
{ {
/***** Get number of questions per exam from database *****/ /***** Get number of questions per exam from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return DB_QuerySELECTDouble ("can not get number of questions per exam", return DB_QuerySELECTDouble ("can not get number of questions per exam",
@ -490,7 +490,7 @@ double Exa_DB_GetNumQstsPerCrsExam (HieLvl_Level_t Scope)
" GROUP BY exa_set_questions.ExaCod) AS NumQstsTable", " GROUP BY exa_set_questions.ExaCod) AS NumQstsTable",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0.0; // Not reached return 0.0; // Not reached
} }
} }

View File

@ -47,9 +47,9 @@ unsigned Exa_DB_GetExamStartEnd (MYSQL_RES **mysql_res,long ExaCod);
void Exa_DB_GetExamTitle (long ExaCod,char *Title,size_t TitleSize); void Exa_DB_GetExamTitle (long ExaCod,char *Title,size_t TitleSize);
void Exa_DB_GetExamTxt (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]); void Exa_DB_GetExamTxt (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
bool Exa_DB_CheckIfSimilarExamExists (long CrsCod,long ExaCod,const char *Title); bool Exa_DB_CheckIfSimilarExamExists (long CrsCod,long ExaCod,const char *Title);
unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Scope); unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Level);
unsigned Exa_DB_GetNumExams (HieLvl_Level_t Scope); unsigned Exa_DB_GetNumExams (HieLvl_Level_t Level);
double Exa_DB_GetNumQstsPerCrsExam (HieLvl_Level_t Scope); double Exa_DB_GetNumQstsPerCrsExam (HieLvl_Level_t Level);
void Exa_DB_RemoveExam (long ExaCod); void Exa_DB_RemoveExam (long ExaCod);
void Exa_DB_RemoveAllExamsFromCrs (long CrsCod); void Exa_DB_RemoveAllExamsFromCrs (long CrsCod);

View File

@ -66,7 +66,7 @@ extern struct Globals Gbl;
static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType); static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType);
static void Fig_PutParFigureType (Fig_FigureType_t FigureType); static void Fig_PutParFigureType (Fig_FigureType_t FigureType);
static void Fig_PutParScopeFig (HieLvl_Level_t ScopeFig); static void Fig_PutParFigScope (HieLvl_Level_t Level);
/*****************************************************************************/ /*****************************************************************************/
/************************** Show use of the platform *************************/ /************************** Show use of the platform *************************/
@ -106,8 +106,8 @@ static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType)
1 << HieLvl_DEG | 1 << HieLvl_DEG |
1 << HieLvl_CRS; 1 << HieLvl_CRS;
Gbl.Scope.Default = HieLvl_SYS; Gbl.Scope.Default = HieLvl_SYS;
Sco_GetScope ("ScopeFig"); Sco_GetScope ("FigScope");
Sco_PutSelectorScope ("ScopeFig",HTM_DONT_SUBMIT_ON_CHANGE); Sco_PutSelectorScope ("FigScope",HTM_DONT_SUBMIT_ON_CHANGE);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_BR (); HTM_BR ();
@ -152,7 +152,7 @@ void Fig_PutIconToShowFigure (Fig_FigureType_t FigureType)
Sco_AdjustScope (); Sco_AdjustScope ();
/***** Put icon to show figure *****/ /***** Put icon to show figure *****/
Figures.Scope = Gbl.Scope.Current; Figures.Level = Gbl.Scope.Current;
Figures.FigureType = FigureType; Figures.FigureType = FigureType;
Lay_PutContextualLinkOnlyIcon (ActSeeUseGbl,NULL, Lay_PutContextualLinkOnlyIcon (ActSeeUseGbl,NULL,
Fig_PutParsFigures,&Figures, Fig_PutParsFigures,&Figures,
@ -167,7 +167,7 @@ void Fig_PutParsFigures (void *Figures)
{ {
if (Figures) if (Figures)
{ {
Fig_PutParScopeFig (((struct Fig_Figures *) Figures)->Scope); Fig_PutParFigScope (((struct Fig_Figures *) Figures)->Level);
Fig_PutParFigureType (((struct Fig_Figures *) Figures)->FigureType); Fig_PutParFigureType (((struct Fig_Figures *) Figures)->FigureType);
} }
} }
@ -185,9 +185,9 @@ static void Fig_PutParFigureType (Fig_FigureType_t FigureType)
/********* Put hidden parameter for the type of figure (statistic) ***********/ /********* Put hidden parameter for the type of figure (statistic) ***********/
/*****************************************************************************/ /*****************************************************************************/
static void Fig_PutParScopeFig (HieLvl_Level_t ScopeFig) static void Fig_PutParFigScope (HieLvl_Level_t Level)
{ {
Sco_PutParScope ("ScopeFig",ScopeFig); Sco_PutParScope ("FigScope",Level);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -76,7 +76,7 @@ typedef enum
struct Fig_Figures struct Fig_Figures
{ {
HieLvl_Level_t Scope; HieLvl_Level_t Level;
Fig_FigureType_t FigureType; Fig_FigureType_t FigureType;
}; };

View File

@ -39,7 +39,7 @@
/*****************************************************************************/ /*****************************************************************************/
void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure, void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
FigCch_Type_t Type,const void *ValuePtr) FigCch_Type_t Type,const void *ValuePtr)
{ {
/***** Trivial check *****/ /***** Trivial check *****/
@ -50,11 +50,11 @@ void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure,
switch (Type) switch (Type)
{ {
case FigCch_UNSIGNED: case FigCch_UNSIGNED:
Fig_DB_UpdateUnsignedFigureIntoCache (Figure,Scope,Cod, Fig_DB_UpdateUnsignedFigureIntoCache (Figure,Level,Cod,
*((unsigned *) ValuePtr)); *((unsigned *) ValuePtr));
break; break;
case FigCch_DOUBLE: case FigCch_DOUBLE:
Fig_DB_UpdateDoubleFigureIntoCache (Figure,Scope,Cod, Fig_DB_UpdateDoubleFigureIntoCache (Figure,Level,Cod,
*((double *) ValuePtr)); *((double *) ValuePtr));
break; break;
} }
@ -66,7 +66,7 @@ void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure,
// Return true is figure is found (if figure is cached and recently updated) // Return true is figure is found (if figure is cached and recently updated)
bool FigCch_GetFigureFromCache (FigCch_FigureCached_t Figure, bool FigCch_GetFigureFromCache (FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
FigCch_Type_t Type,void *ValuePtr) FigCch_Type_t Type,void *ValuePtr)
{ {
/* The higher the level, the longer a value remains cached */ /* The higher the level, the longer a value remains cached */
@ -97,11 +97,11 @@ bool FigCch_GetFigureFromCache (FigCch_FigureCached_t Figure,
/***** Trivial check *****/ /***** Trivial check *****/
if (Figure == FigCch_UNKNOWN || // Unknown figure if (Figure == FigCch_UNKNOWN || // Unknown figure
Scope == HieLvl_UNK) // Unknown scope Level == HieLvl_UNK) // Unknown scope
return false; return false;
/***** Get figure's value if cached and recent *****/ /***** Get figure's value if cached and recent *****/
if (Fig_DB_GetFigureFromCache (&mysql_res,Figure,Scope,Cod,Type,TimeCached[Scope])) if (Fig_DB_GetFigureFromCache (&mysql_res,Figure,Level,Cod,Type,TimeCached[Level]))
{ {
/* Get row */ /* Get row */
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);

View File

@ -111,10 +111,10 @@ typedef enum
/*****************************************************************************/ /*****************************************************************************/
void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure, void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
FigCch_Type_t Type,const void *ValuePtr); FigCch_Type_t Type,const void *ValuePtr);
bool FigCch_GetFigureFromCache (FigCch_FigureCached_t Figure, bool FigCch_GetFigureFromCache (FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
FigCch_Type_t Type,void *ValuePtr); FigCch_Type_t Type,void *ValuePtr);
#endif #endif

View File

@ -34,7 +34,7 @@
/*****************************************************************************/ /*****************************************************************************/
void Fig_DB_UpdateUnsignedFigureIntoCache (FigCch_FigureCached_t Figure, void Fig_DB_UpdateUnsignedFigureIntoCache (FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
unsigned Value) unsigned Value)
{ {
DB_QueryREPLACE ("can not update cached figure value", DB_QueryREPLACE ("can not update cached figure value",
@ -43,7 +43,7 @@ void Fig_DB_UpdateUnsignedFigureIntoCache (FigCch_FigureCached_t Figure,
" VALUES" " VALUES"
" (%u,'%s',%ld,%u,'0.0')", " (%u,'%s',%ld,%u,'0.0')",
(unsigned) Figure, (unsigned) Figure,
Sco_GetDBStrFromScope (Scope), Hie_GetDBStrFromLevel (Level),
Cod, Cod,
Value); Value);
} }
@ -53,7 +53,7 @@ void Fig_DB_UpdateUnsignedFigureIntoCache (FigCch_FigureCached_t Figure,
/*****************************************************************************/ /*****************************************************************************/
void Fig_DB_UpdateDoubleFigureIntoCache (FigCch_FigureCached_t Figure, void Fig_DB_UpdateDoubleFigureIntoCache (FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
double Value) double Value)
{ {
Str_SetDecimalPointToUS (); // To write the decimal point as a dot Str_SetDecimalPointToUS (); // To write the decimal point as a dot
@ -63,20 +63,19 @@ void Fig_DB_UpdateDoubleFigureIntoCache (FigCch_FigureCached_t Figure,
" VALUES" " VALUES"
" (%u,'%s',%ld,0,'%.15lg')", " (%u,'%s',%ld,0,'%.15lg')",
(unsigned) Figure, (unsigned) Figure,
Sco_GetDBStrFromScope (Scope), Hie_GetDBStrFromLevel (Level),
Cod, Cod,
Value); Value);
Str_SetDecimalPointToLocal (); // Return to local system Str_SetDecimalPointToLocal (); // Return to local system
} }
/***** Get figure's value if cached and recent *****/
/*****************************************************************************/ /*****************************************************************************/
/************************** Get figure from cache ****************************/ /************************** Get figure from cache ****************************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Fig_DB_GetFigureFromCache (MYSQL_RES **mysql_res, unsigned Fig_DB_GetFigureFromCache (MYSQL_RES **mysql_res,
FigCch_FigureCached_t Figure, FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
FigCch_Type_t Type,time_t TimeCached) FigCch_Type_t Type,time_t TimeCached)
{ {
static const char *Field[FigCch_NUM_TYPES] = static const char *Field[FigCch_NUM_TYPES] =
@ -94,6 +93,6 @@ unsigned Fig_DB_GetFigureFromCache (MYSQL_RES **mysql_res,
" AND Cod=%ld" " AND Cod=%ld"
" AND LastUpdate>FROM_UNIXTIME(UNIX_TIMESTAMP()-%lu)", " AND LastUpdate>FROM_UNIXTIME(UNIX_TIMESTAMP()-%lu)",
Field[Type], Field[Type],
(unsigned) Figure,Sco_GetDBStrFromScope (Scope),Cod, (unsigned) Figure,Hie_GetDBStrFromLevel (Level),Cod,
TimeCached); TimeCached);
} }

View File

@ -37,15 +37,15 @@
/*****************************************************************************/ /*****************************************************************************/
void Fig_DB_UpdateUnsignedFigureIntoCache (FigCch_FigureCached_t Figure, void Fig_DB_UpdateUnsignedFigureIntoCache (FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
unsigned Value); unsigned Value);
void Fig_DB_UpdateDoubleFigureIntoCache (FigCch_FigureCached_t Figure, void Fig_DB_UpdateDoubleFigureIntoCache (FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
double Value); double Value);
unsigned Fig_DB_GetFigureFromCache (MYSQL_RES **mysql_res, unsigned Fig_DB_GetFigureFromCache (MYSQL_RES **mysql_res,
FigCch_FigureCached_t Figure, FigCch_FigureCached_t Figure,
HieLvl_Level_t Scope,long Cod, HieLvl_Level_t Level,long Cod,
FigCch_Type_t Type,time_t TimeCached); FigCch_Type_t Type,time_t TimeCached);
#endif #endif

View File

@ -401,7 +401,7 @@ unsigned Fol_DB_GetNumFollowinFollowers (unsigned Fol)
Gbl.Hierarchy.Crs.CrsCod, Gbl.Hierarchy.Crs.CrsCod,
FieldDB[Fol]); FieldDB[Fol]);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -508,7 +508,7 @@ double Fol_DB_GetNumFollowedPerFollower (unsigned Fol)
FieldDB[Fol], FieldDB[Fol],
FieldDB[1 - Fol]); FieldDB[1 - Fol]);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0.0; // Not reached return 0.0; // Not reached
} }
} }
@ -663,7 +663,7 @@ unsigned Fol_DB_GetRankingFollowers (MYSQL_RES **mysql_res)
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -3330,7 +3330,7 @@ void For_GetAndShowForumStats (void)
For_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Crs.CrsCod,&FiguresForum); For_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Crs.CrsCod,&FiguresForum);
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
} }

View File

@ -126,7 +126,7 @@ unsigned For_DB_GetNumPstsOfUsrInForum (const struct For_Forum *Forum,
/************* Remove all threads and posts in forums of a scope *************/ /************* Remove all threads and posts in forums of a scope *************/
/*****************************************************************************/ /*****************************************************************************/
void For_DB_RemoveForums (HieLvl_Level_t Scope,long HieCod) void For_DB_RemoveForums (HieLvl_Level_t Level,long HieCod)
{ {
static const struct static const struct
{ {
@ -156,8 +156,8 @@ void For_DB_RemoveForums (HieLvl_Level_t Scope,long HieCod)
" AND for_threads.HieCod=%ld" " AND for_threads.HieCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod" " AND for_threads.ThrCod=for_posts.ThrCod"
" AND for_posts.PstCod=for_disabled.PstCod", " AND for_posts.PstCod=for_disabled.PstCod",
ForumType[Scope].Usrs, ForumType[Level].Usrs,
ForumType[Scope].Tchs, ForumType[Level].Tchs,
HieCod); HieCod);
/***** Remove posts *****/ /***** Remove posts *****/
@ -171,8 +171,8 @@ void For_DB_RemoveForums (HieLvl_Level_t Scope,long HieCod)
" for_threads.ForumType=%u)" " for_threads.ForumType=%u)"
" AND for_threads.HieCod=%ld" " AND for_threads.HieCod=%ld"
" AND for_threads.ThrCod=for_posts.ThrCod", " AND for_threads.ThrCod=for_posts.ThrCod",
ForumType[Scope].Usrs, ForumType[Level].Usrs,
ForumType[Scope].Tchs, ForumType[Level].Tchs,
HieCod); HieCod);
/***** Remove threads read *****/ /***** Remove threads read *****/
@ -186,8 +186,8 @@ void For_DB_RemoveForums (HieLvl_Level_t Scope,long HieCod)
" for_threads.ForumType=%u)" " for_threads.ForumType=%u)"
" AND for_threads.HieCod=%ld" " AND for_threads.HieCod=%ld"
" AND for_threads.ThrCod=for_read.ThrCod", " AND for_threads.ThrCod=for_read.ThrCod",
ForumType[Scope].Usrs, ForumType[Level].Usrs,
ForumType[Scope].Tchs, ForumType[Level].Tchs,
HieCod); HieCod);
/***** Remove threads *****/ /***** Remove threads *****/
@ -198,8 +198,8 @@ void For_DB_RemoveForums (HieLvl_Level_t Scope,long HieCod)
" OR" " OR"
" for_threads.ForumType=%u)" " for_threads.ForumType=%u)"
" AND HieCod=%ld", " AND HieCod=%ld",
ForumType[Scope].Usrs, ForumType[Level].Usrs,
ForumType[Scope].Tchs, ForumType[Level].Tchs,
HieCod); HieCod);
} }

View File

@ -39,7 +39,7 @@ unsigned For_DB_GetNumThrsInForumNewerThan (const struct For_Forum *Forum,
const char *Time); const char *Time);
unsigned For_DB_GetNumPstsOfUsrInForum (const struct For_Forum *Forum, unsigned For_DB_GetNumPstsOfUsrInForum (const struct For_Forum *Forum,
long UsrCod); long UsrCod);
void For_DB_RemoveForums (HieLvl_Level_t Scope,long HieCod); void For_DB_RemoveForums (HieLvl_Level_t Level,long HieCod);
//------------------------------- Posts --------------------------------------- //------------------------------- Posts ---------------------------------------
long For_DB_InsertForumPst (long ThrCod,long UsrCod, long For_DB_InsertForumPst (long ThrCod,long UsrCod,

View File

@ -33,12 +33,6 @@
#include "swad_parameter_code.h" #include "swad_parameter_code.h"
#include "swad_resource_database.h" #include "swad_resource_database.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
/**************************** Get link to thread *****************************/ /**************************** Get link to thread *****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -274,10 +274,10 @@ bool Gam_DB_CheckIfSimilarGameExists (const struct Gam_Game *Game)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of courses with games in this location // Returns the number of courses with games in this location
unsigned Gam_DB_GetNumCoursesWithGames (HieLvl_Level_t Scope) unsigned Gam_DB_GetNumCoursesWithGames (HieLvl_Level_t Level)
{ {
/***** Get number of courses with games from database *****/ /***** Get number of courses with games from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -349,10 +349,10 @@ unsigned Gam_DB_GetNumCoursesWithGames (HieLvl_Level_t Scope)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of games in this location // Returns the number of games in this location
unsigned Gam_DB_GetNumGames (HieLvl_Level_t Scope) unsigned Gam_DB_GetNumGames (HieLvl_Level_t Level)
{ {
/***** Get number of games from database *****/ /***** Get number of games from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -652,10 +652,10 @@ unsigned Gam_DB_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd)
/***************** Get average number of questions per game ******************/ /***************** Get average number of questions per game ******************/
/*****************************************************************************/ /*****************************************************************************/
double Gam_DB_GetNumQstsPerGame (HieLvl_Level_t Scope) double Gam_DB_GetNumQstsPerGame (HieLvl_Level_t Level)
{ {
/***** Get number of questions per game from database *****/ /***** Get number of questions per game from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return return
@ -742,7 +742,7 @@ double Gam_DB_GetNumQstsPerGame (HieLvl_Level_t Scope)
" GROUP BY gam_questions.GamCod) AS NumQstsTable", " GROUP BY gam_questions.GamCod) AS NumQstsTable",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0.0; // Not reached return 0.0; // Not reached
} }
} }

View File

@ -47,8 +47,8 @@ unsigned Gam_DB_GetGameDataByCod (MYSQL_RES **mysql_res,long GamCod);
void Gam_DB_GetGameTitle (long GamCod,char *Title,size_t TitleSize); void Gam_DB_GetGameTitle (long GamCod,char *Title,size_t TitleSize);
void Gam_DB_GetGameTxt (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1]); void Gam_DB_GetGameTxt (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
bool Gam_DB_CheckIfSimilarGameExists (const struct Gam_Game *Game); bool Gam_DB_CheckIfSimilarGameExists (const struct Gam_Game *Game);
unsigned Gam_DB_GetNumCoursesWithGames (HieLvl_Level_t Scope); unsigned Gam_DB_GetNumCoursesWithGames (HieLvl_Level_t Level);
unsigned Gam_DB_GetNumGames (HieLvl_Level_t Scope); unsigned Gam_DB_GetNumGames (HieLvl_Level_t Level);
void Gam_DB_RemoveGame (long GamCod); void Gam_DB_RemoveGame (long GamCod);
void Gam_DB_RemoveCrsGames (long CrsCod); void Gam_DB_RemoveCrsGames (long CrsCod);
@ -67,7 +67,7 @@ unsigned Gam_DB_GetQstIndFromQstCod (long GamCod,long QstCod);
unsigned Gam_DB_GetMaxQuestionIndexInGame (long GamCod); unsigned Gam_DB_GetMaxQuestionIndexInGame (long GamCod);
unsigned Gam_DB_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd); unsigned Gam_DB_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd);
unsigned Gam_DB_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd); unsigned Gam_DB_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd);
double Gam_DB_GetNumQstsPerGame (HieLvl_Level_t Scope); double Gam_DB_GetNumQstsPerGame (HieLvl_Level_t Level);
unsigned Gam_DB_GetTstTagsPresentInAGame (MYSQL_RES **mysql_res,long GamCod); unsigned Gam_DB_GetTstTagsPresentInAGame (MYSQL_RES **mysql_res,long GamCod);
unsigned Gam_DB_GetNumAnswersOfQstsInGame (MYSQL_RES **mysql_res,long GamCod); unsigned Gam_DB_GetNumAnswersOfQstsInGame (MYSQL_RES **mysql_res,long GamCod);

View File

@ -89,17 +89,23 @@ struct Globals
{ {
HieLvl_Level_t Level; // Current level in the hierarchy: system, country, institution, center, degree or course HieLvl_Level_t Level; // Current level in the hierarchy: system, country, institution, center, degree or course
long Cod; // Code of the current country, institution, center, degree or course long Cod; // Code of the current country, institution, center, degree or course
struct ListCountries Ctys;// List of countries struct Cty_ListCtys Ctys; // List of countries
struct Cty_Countr Cty; // Current country struct Cty_Countr Cty; // Current country
struct ListInstits Inss; // List of institutions in current country struct Ins_ListInss Inss; // List of institutions in current country
struct Ins_Instit Ins; // Current institution struct Ins_Instit Ins; // Current institution
struct ListCenters Ctrs; // List of centers in current institution struct Ctr_ListCtrs Ctrs; // List of centers in current institution
struct Ctr_Center Ctr; // Current center struct Ctr_Center Ctr; // Current center
struct ListDegrees Degs; // List of degrees in current center struct Deg_ListDegs Degs; // List of degrees in current center
struct Deg_Degree Deg; // Current degree struct Deg_Degree Deg; // Current degree
struct Crs_ListCourses Crss; // List of courses in current degree struct Crs_ListCrss Crss; // List of courses in current degree
struct Crs_Course Crs; // Current course. Aditional info about course is stored in Gbl.Crs. struct Crs_Course Crs; // Current course. Aditional info about course is stored in Gbl.Crs.
} Hierarchy; } Hierarchy;
struct
{
HieLvl_Level_t Current;
HieLvl_Level_t Default;
unsigned Allowed;
} Scope;
struct struct
{ {
bool IsWebService; // Must generate HTML output (IsWebService==false) or SOAP-XML output (IsWebService==true)? bool IsWebService; // Must generate HTML output (IsWebService==false) or SOAP-XML output (IsWebService==true)?
@ -227,12 +233,6 @@ struct Globals
char FileNamePhoto[NAME_MAX + 1]; // File name (with no path and no .jpg) of the temporary file with the selected face char FileNamePhoto[NAME_MAX + 1]; // File name (with no path and no .jpg) of the temporary file with the selected face
Enr_RegRemOneUsrAction_t RegRemAction; // Enrolment action Enr_RegRemOneUsrAction_t RegRemAction; // Enrolment action
} Usrs; } Usrs;
struct
{
HieLvl_Level_t Current;
HieLvl_Level_t Default;
unsigned Allowed;
} Scope;
struct struct
{ {
char PathPriv[PATH_MAX + 1]; // Absolute path to the private directory of the course char PathPriv[PATH_MAX + 1]; // Absolute path to the private directory of the course

View File

@ -523,22 +523,22 @@ void Hie_SetHierarchyFromUsrLastHierarchy (void)
Hie_ResetHierarchy (); Hie_ResetHierarchy ();
/***** Copy last hierarchy scope and code to current hierarchy *****/ /***** Copy last hierarchy scope and code to current hierarchy *****/
switch (Gbl.Usrs.Me.UsrLast.LastHie.Scope) switch (Gbl.Usrs.Me.UsrLast.LastHie.Level)
{ {
case HieLvl_CTY: // Country case HieLvl_CTY: // Country
Gbl.Hierarchy.Cty.CtyCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod; Gbl.Hierarchy.Cty.CtyCod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
break; break;
case HieLvl_INS: // Institution case HieLvl_INS: // Institution
Gbl.Hierarchy.Ins.InsCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod; Gbl.Hierarchy.Ins.InsCod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
break; break;
case HieLvl_CTR: // Center case HieLvl_CTR: // Center
Gbl.Hierarchy.Ctr.CtrCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod; Gbl.Hierarchy.Ctr.CtrCod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
break; break;
case HieLvl_DEG: // Degree case HieLvl_DEG: // Degree
Gbl.Hierarchy.Deg.DegCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod; Gbl.Hierarchy.Deg.DegCod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
break; break;
case HieLvl_CRS: // Course case HieLvl_CRS: // Course
Gbl.Hierarchy.Crs.CrsCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod; Gbl.Hierarchy.Crs.CrsCod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
break; break;
default: default:
break; break;
@ -760,7 +760,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
} }
break; break;
default: // There are no administrators in other scopes default: // There are no administrators in other scopes
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
} }
HTM_TD_End (); HTM_TD_End ();
@ -1041,7 +1041,7 @@ static void Hie_GetAndShowHierarchyWithInss (void)
case HieLvl_CRS: case HieLvl_CRS:
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
} }
@ -1082,7 +1082,7 @@ static void Hie_GetAndShowHierarchyWithCtrs (void)
case HieLvl_CRS: case HieLvl_CRS:
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
} }
@ -1127,7 +1127,7 @@ static void Hie_GetAndShowHierarchyWithDegs (void)
case HieLvl_CRS: case HieLvl_CRS:
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
} }
@ -1176,7 +1176,7 @@ static void Hie_GetAndShowHierarchyWithCrss (void)
case HieLvl_CRS: case HieLvl_CRS:
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
} }
@ -1265,7 +1265,7 @@ static void Hie_GetAndShowHierarchyTotal (void)
case HieLvl_CRS: case HieLvl_CRS:
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
} }

View File

@ -334,7 +334,7 @@ void HieCfg_QR (ParCod_Param_t ParCode,long HieCod)
/************************ Number of users in courses *************************/ /************************ Number of users in courses *************************/
/*****************************************************************************/ /*****************************************************************************/
void HieCfg_NumUsrsInCrss (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role) void HieCfg_NumUsrsInCrss (HieLvl_Level_t Level,long Cod,Rol_Role_t Role)
{ {
extern const char *Txt_Users_in_courses; extern const char *Txt_Users_in_courses;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
@ -349,7 +349,7 @@ void HieCfg_NumUsrsInCrss (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role)
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
HTM_Unsigned (Enr_GetCachedNumUsrsInCrss (Scope,Cod, HTM_Unsigned (Enr_GetCachedNumUsrsInCrss (Level,Cod,
Role == Rol_UNK ? (1 << Rol_STD) | Role == Rol_UNK ? (1 << Rol_STD) |
(1 << Rol_NET) | (1 << Rol_NET) |
(1 << Rol_TCH) : // Any user (1 << Rol_TCH) : // Any user

View File

@ -50,6 +50,6 @@ void HieCfg_Shortcut (bool PrintView,ParCod_Param_t ParCode,long HieCod);
void HieCfg_NumCtrs (unsigned NumCtrs,bool PutForm); void HieCfg_NumCtrs (unsigned NumCtrs,bool PutForm);
void HieCfg_NumCtrsWithMap (unsigned NumCtrs,unsigned NumCtrsWithMap); void HieCfg_NumCtrsWithMap (unsigned NumCtrs,unsigned NumCtrsWithMap);
void HieCfg_QR (ParCod_Param_t ParCode,long HieCod); void HieCfg_QR (ParCod_Param_t ParCode,long HieCod);
void HieCfg_NumUsrsInCrss (HieLvl_Level_t Scope,long Cod,Rol_Role_t Role); void HieCfg_NumUsrsInCrss (HieLvl_Level_t Level,long Cod,Rol_Role_t Role);
#endif #endif

View File

@ -34,7 +34,7 @@
/******************* Get number of countries with users **********************/ /******************* Get number of countries with users **********************/
/*****************************************************************************/ /*****************************************************************************/
void Hie_DB_BuildSubquery (char SubQuery[128],HieLvl_Level_t Scope,long Cod) void Hie_DB_BuildSubquery (char SubQuery[128],HieLvl_Level_t Level,long HieCod)
{ {
static const char *Format[HieLvl_NUM_LEVELS] = static const char *Format[HieLvl_NUM_LEVELS] =
{ {
@ -47,8 +47,8 @@ void Hie_DB_BuildSubquery (char SubQuery[128],HieLvl_Level_t Scope,long Cod)
[HieLvl_CRS] = "crs_users.CrsCod=%ld AND ", // Course [HieLvl_CRS] = "crs_users.CrsCod=%ld AND ", // Course
}; };
if (Cod > 0) if (HieCod > 0)
sprintf (SubQuery,Format[Scope],Cod); sprintf (SubQuery,Format[Level],HieCod);
else else
SubQuery[0] = '\0'; SubQuery[0] = '\0';
} }
@ -97,8 +97,8 @@ unsigned Hie_DB_GetInsCtrDegAdminBy (MYSQL_RES **mysql_res,long UsrCod)
" AND usr_admins.Cod=deg_degrees.DegCod)" " AND usr_admins.Cod=deg_degrees.DegCod)"
" ORDER BY S," " ORDER BY S,"
"FullName", "FullName",
(unsigned) HieLvl_SYS,UsrCod,Sco_GetDBStrFromScope (HieLvl_SYS), (unsigned) HieLvl_SYS,UsrCod,Hie_GetDBStrFromLevel (HieLvl_SYS),
(unsigned) HieLvl_INS,UsrCod,Sco_GetDBStrFromScope (HieLvl_INS), (unsigned) HieLvl_INS,UsrCod,Hie_GetDBStrFromLevel (HieLvl_INS),
(unsigned) HieLvl_CTR,UsrCod,Sco_GetDBStrFromScope (HieLvl_CTR), (unsigned) HieLvl_CTR,UsrCod,Hie_GetDBStrFromLevel (HieLvl_CTR),
(unsigned) HieLvl_DEG,UsrCod,Sco_GetDBStrFromScope (HieLvl_DEG)); (unsigned) HieLvl_DEG,UsrCod,Hie_GetDBStrFromLevel (HieLvl_DEG));
} }

View File

@ -33,7 +33,7 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Hie_DB_BuildSubquery (char SubQuery[128],HieLvl_Level_t Scope,long Cod); void Hie_DB_BuildSubquery (char SubQuery[128],HieLvl_Level_t Level,long HieCod);
unsigned Hie_DB_GetInsCtrDegAdminBy (MYSQL_RES **mysql_res,long UsrCod); unsigned Hie_DB_GetInsCtrDegAdminBy (MYSQL_RES **mysql_res,long UsrCod);
#endif #endif

View File

@ -360,7 +360,7 @@ unsigned Ind_DB_GetTableOfCourses (MYSQL_RES **mysql_res,
"crs_courses.FullName", "crs_courses.FullName",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -1635,7 +1635,7 @@ unsigned Ins_GetCachedNumInssInCty (long CtyCod)
unsigned Ins_GetCachedNumInssWithCtrs (void) unsigned Ins_GetCachedNumInssWithCtrs (void)
{ {
unsigned NumInssWithCtrs; unsigned NumInssWithCtrs;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of institutions with centers from cache *****/ /***** Get number of institutions with centers from cache *****/
if (!FigCch_GetFigureFromCache (FigCch_NUM_INSS_WITH_CTRS,Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigCch_NUM_INSS_WITH_CTRS,Gbl.Scope.Current,Cod,
@ -1657,7 +1657,7 @@ unsigned Ins_GetCachedNumInssWithCtrs (void)
unsigned Ins_GetCachedNumInssWithDegs (void) unsigned Ins_GetCachedNumInssWithDegs (void)
{ {
unsigned NumInssWithDegs; unsigned NumInssWithDegs;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of institutions with degrees from cache *****/ /***** Get number of institutions with degrees from cache *****/
if (!FigCch_GetFigureFromCache (FigCch_NUM_INSS_WITH_DEGS,Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigCch_NUM_INSS_WITH_DEGS,Gbl.Scope.Current,Cod,
@ -1679,7 +1679,7 @@ unsigned Ins_GetCachedNumInssWithDegs (void)
unsigned Ins_GetCachedNumInssWithCrss (void) unsigned Ins_GetCachedNumInssWithCrss (void)
{ {
unsigned NumInssWithCrss; unsigned NumInssWithCrss;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of institutions with courses from cache *****/ /***** Get number of institutions with courses from cache *****/
if (!FigCch_GetFigureFromCache (FigCch_NUM_INSS_WITH_CRSS,Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigCch_NUM_INSS_WITH_CRSS,Gbl.Scope.Current,Cod,
@ -1707,7 +1707,7 @@ unsigned Ins_GetCachedNumInssWithUsrs (Rol_Role_t Role)
[Rol_TCH] = FigCch_NUM_INSS_WITH_TCHS, // Teachers [Rol_TCH] = FigCch_NUM_INSS_WITH_TCHS, // Teachers
}; };
unsigned NumInssWithUsrs; unsigned NumInssWithUsrs;
long Cod = Sco_GetCurrentCod (); long Cod = Hie_GetCurrentCod ();
/***** Get number of institutions with users from cache *****/ /***** Get number of institutions with users from cache *****/
if (!FigCch_GetFigureFromCache (FigureInss[Role],Gbl.Scope.Current,Cod, if (!FigCch_GetFigureFromCache (FigureInss[Role],Gbl.Scope.Current,Cod,
@ -2010,7 +2010,7 @@ void Ins_GetAndShowInstitutionsStats (void)
/***** Form to select type of list used to display degree photos *****/ /***** Form to select type of list used to display degree photos *****/
Set_GetAndUpdatePrefsAboutUsrList (); Set_GetAndUpdatePrefsAboutUsrList ();
Figures.Scope = Gbl.Scope.Current; Figures.Level = Gbl.Scope.Current;
Figures.FigureType = Fig_INSTITS; Figures.FigureType = Fig_INSTITS;
Usr_ShowFormsToSelectUsrListType (Fig_PutParsFigures,&Figures); Usr_ShowFormsToSelectUsrListType (Fig_PutParsFigures,&Figures);

View File

@ -61,7 +61,7 @@ typedef enum
} Ins_Order_t; } Ins_Order_t;
#define Ins_ORDER_DEFAULT Ins_ORDER_BY_NUM_USRS #define Ins_ORDER_DEFAULT Ins_ORDER_BY_NUM_USRS
struct ListInstits struct Ins_ListInss
{ {
unsigned Num; // Number of institutions unsigned Num; // Number of institutions
struct Ins_Instit *Lst; // List of institutions struct Ins_Instit *Lst; // List of institutions

View File

@ -382,7 +382,7 @@ unsigned Ins_DB_GetInssOrderedByNumCtrs (MYSQL_RES **mysql_res)
" GROUP BY InsCod", " GROUP BY InsCod",
Gbl.Hierarchy.Ins.InsCod); Gbl.Hierarchy.Ins.InsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -435,7 +435,7 @@ unsigned Ins_DB_GetInssOrderedByNumDegs (MYSQL_RES **mysql_res)
" ORDER BY N DESC", " ORDER BY N DESC",
Gbl.Hierarchy.Ins.InsCod); Gbl.Hierarchy.Ins.InsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -494,7 +494,7 @@ unsigned Ins_DB_GetInssOrderedByNumCrss (MYSQL_RES **mysql_res)
" ORDER BY N DESC", " ORDER BY N DESC",
Gbl.Hierarchy.Ins.InsCod); Gbl.Hierarchy.Ins.InsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -560,7 +560,7 @@ unsigned Ins_DB_GetInssOrderedByNumUsrsInCrss (MYSQL_RES **mysql_res)
" ORDER BY N DESC", " ORDER BY N DESC",
Gbl.Hierarchy.Ins.InsCod); Gbl.Hierarchy.Ins.InsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -607,7 +607,7 @@ unsigned Ins_DB_GetInssOrderedByNumUsrsWhoClaimToBelongToThem (MYSQL_RES **mysql
" ORDER BY N DESC", " ORDER BY N DESC",
Gbl.Hierarchy.Ins.InsCod); Gbl.Hierarchy.Ins.InsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -656,11 +656,11 @@ unsigned Ins_DB_GetNumInssInCty (long CtyCod)
/****************** Get number of institutions with centres ******************/ /****************** Get number of institutions with centres ******************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Ins_DB_GetNumInssWithCtrs (HieLvl_Level_t Scope,long Cod) unsigned Ins_DB_GetNumInssWithCtrs (HieLvl_Level_t Level,long HieCod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,HieCod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of institutions with centers", DB_QueryCOUNT ("can not get number of institutions with centers",
@ -676,11 +676,11 @@ unsigned Ins_DB_GetNumInssWithCtrs (HieLvl_Level_t Scope,long Cod)
/****************** Get number of institutions with degrees ******************/ /****************** Get number of institutions with degrees ******************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Ins_DB_GetNumInssWithDegs (HieLvl_Level_t Scope,long Cod) unsigned Ins_DB_GetNumInssWithDegs (HieLvl_Level_t Level,long HieCod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,HieCod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of institutions with degrees", DB_QueryCOUNT ("can not get number of institutions with degrees",
@ -698,11 +698,11 @@ unsigned Ins_DB_GetNumInssWithDegs (HieLvl_Level_t Scope,long Cod)
/****************** Get number of institutions with courses ******************/ /****************** Get number of institutions with courses ******************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Ins_DB_GetNumInssWithCrss (HieLvl_Level_t Scope,long Cod) unsigned Ins_DB_GetNumInssWithCrss (HieLvl_Level_t Level,long HieCod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,HieCod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of institutions with courses", DB_QueryCOUNT ("can not get number of institutions with courses",
@ -723,11 +723,11 @@ unsigned Ins_DB_GetNumInssWithCrss (HieLvl_Level_t Scope,long Cod)
/*****************************************************************************/ /*****************************************************************************/
unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role, unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod) HieLvl_Level_t Level,long HieCod)
{ {
char SubQuery[128]; char SubQuery[128];
Hie_DB_BuildSubquery (SubQuery,Scope,Cod); Hie_DB_BuildSubquery (SubQuery,Level,HieCod);
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of institutions with users", DB_QueryCOUNT ("can not get number of institutions with users",

View File

@ -70,11 +70,11 @@ unsigned Ins_DB_SearchInss (MYSQL_RES **mysql_res,
unsigned Ins_DB_GetNumInssInCty (long CtyCod); unsigned Ins_DB_GetNumInssInCty (long CtyCod);
unsigned Ins_DB_GetNumInssWithCtrs (HieLvl_Level_t Scope,long Cod); unsigned Ins_DB_GetNumInssWithCtrs (HieLvl_Level_t Level,long HieCod);
unsigned Ins_DB_GetNumInssWithDegs (HieLvl_Level_t Scope,long Cod); unsigned Ins_DB_GetNumInssWithDegs (HieLvl_Level_t Level,long HieCod);
unsigned Ins_DB_GetNumInssWithCrss (HieLvl_Level_t Scope,long Cod); unsigned Ins_DB_GetNumInssWithCrss (HieLvl_Level_t Level,long HieCod);
unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role, unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role,
HieLvl_Level_t Scope,long Cod); HieLvl_Level_t Level,long HieCod);
unsigned Ins_DB_GetInssFromUsr (MYSQL_RES **mysql_res,long UsrCod,long CtyCod); unsigned Ins_DB_GetInssFromUsr (MYSQL_RES **mysql_res,long UsrCod,long CtyCod);
bool Ins_DB_CheckIfUsrBelongsToIns (long UsrCod,long InsCod); bool Ins_DB_CheckIfUsrBelongsToIns (long UsrCod,long InsCod);

View File

@ -62,7 +62,7 @@ static void Lgo_PutIconToRemoveLogo (Act_Action_t ActionRem);
/***************** Draw institution, center or degree logo *******************/ /***************** Draw institution, center or degree logo *******************/
/*****************************************************************************/ /*****************************************************************************/
void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText, void Lgo_DrawLogo (HieLvl_Level_t Level,long HieCod,const char *AltText,
unsigned Size,const char *Class) unsigned Size,const char *Class)
{ {
static const char *HieIcon[HieLvl_NUM_LEVELS] = static const char *HieIcon[HieLvl_NUM_LEVELS] =
@ -82,15 +82,15 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
bool ClassNotEmpty; bool ClassNotEmpty;
/***** Path to logo *****/ /***** Path to logo *****/
if (HieIcon[Scope]) // Scope is correct if (HieIcon[Level]) // Scope is correct
{ {
if (Cod > 0) // Institution, center or degree exists if (HieCod > 0) // Institution, center or degree exists
{ {
/* Degree */ /* Degree */
if (Scope == HieLvl_DEG) if (Level == HieLvl_DEG)
{ {
Folder = Cfg_FOLDER_DEG; Folder = Cfg_FOLDER_DEG;
DegCod = Cod; DegCod = HieCod;
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png", snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png",
Cfg_PATH_DEG_PUBLIC, Cfg_PATH_DEG_PUBLIC,
(unsigned) (DegCod % 100), (unsigned) (DegCod % 100),
@ -98,17 +98,17 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
(unsigned) DegCod); (unsigned) DegCod);
LogoFound = Fil_CheckIfPathExists (PathLogo); LogoFound = Fil_CheckIfPathExists (PathLogo);
if (LogoFound) if (LogoFound)
Cod = DegCod; HieCod = DegCod;
} }
/* Center */ /* Center */
if (!LogoFound && Scope != HieLvl_INS) if (!LogoFound && Level != HieLvl_INS)
{ {
Folder = Cfg_FOLDER_CTR; Folder = Cfg_FOLDER_CTR;
if (Scope == HieLvl_DEG) // && !LogoFound if (Level == HieLvl_DEG) // && !LogoFound
CtrCod = Deg_DB_GetCtrCodOfDegreeByCod (Cod); CtrCod = Deg_DB_GetCtrCodOfDegreeByCod (HieCod);
else else
CtrCod = Cod; CtrCod = HieCod;
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png", snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png",
Cfg_PATH_CTR_PUBLIC, Cfg_PATH_CTR_PUBLIC,
(unsigned) (CtrCod % 100), (unsigned) (CtrCod % 100),
@ -116,19 +116,19 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
(unsigned) CtrCod); (unsigned) CtrCod);
LogoFound = Fil_CheckIfPathExists (PathLogo); LogoFound = Fil_CheckIfPathExists (PathLogo);
if (LogoFound) if (LogoFound)
Cod = CtrCod; HieCod = CtrCod;
} }
/* Institution */ /* Institution */
if (!LogoFound) if (!LogoFound)
{ {
Folder = Cfg_FOLDER_INS; Folder = Cfg_FOLDER_INS;
if (Scope == HieLvl_DEG) // && !LogoFound if (Level == HieLvl_DEG) // && !LogoFound
InsCod = Deg_DB_GetInsCodOfDegreeByCod (Cod); InsCod = Deg_DB_GetInsCodOfDegreeByCod (HieCod);
else if (Scope == HieLvl_CTR) // && !LogoFound else if (Level == HieLvl_CTR) // && !LogoFound
InsCod = Ctr_DB_GetInsCodOfCenterByCod (Cod); InsCod = Ctr_DB_GetInsCodOfCenterByCod (HieCod);
else else
InsCod = Cod; InsCod = HieCod;
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png", snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png",
Cfg_PATH_INS_PUBLIC, Cfg_PATH_INS_PUBLIC,
(unsigned) (InsCod % 100), (unsigned) (InsCod % 100),
@ -136,7 +136,7 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
(unsigned) InsCod); (unsigned) InsCod);
LogoFound = Fil_CheckIfPathExists (PathLogo); LogoFound = Fil_CheckIfPathExists (PathLogo);
if (LogoFound) if (LogoFound)
Cod = InsCod; HieCod = InsCod;
} }
/***** Draw logo *****/ /***** Draw logo *****/
@ -149,10 +149,10 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
{ {
if (asprintf (&URL,"%s/%s/%02u/%u/logo", if (asprintf (&URL,"%s/%s/%02u/%u/logo",
Cfg_URL_SWAD_PUBLIC,Folder, Cfg_URL_SWAD_PUBLIC,Folder,
(unsigned) (Cod % 100), (unsigned) (HieCod % 100),
(unsigned) Cod) < 0) (unsigned) HieCod) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
if (asprintf (&Icon,"%u.png",(unsigned) Cod) < 0) if (asprintf (&Icon,"%u.png",(unsigned) HieCod) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
HTM_IMG (URL,Icon,AltText, HTM_IMG (URL,Icon,AltText,
@ -167,7 +167,7 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
free (URL); free (URL);
} }
else else
HTM_IMG (Cfg_URL_ICON_PUBLIC,HieIcon[Scope],AltText, HTM_IMG (Cfg_URL_ICON_PUBLIC,HieIcon[Level],AltText,
"class=\"ICO%ux%u ICO_%s_%s" "class=\"ICO%ux%u ICO_%s_%s"
"%s%s\"", "%s%s\"",
Size,Size, Size,Size,
@ -185,7 +185,7 @@ void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText,
/************* the logo of institution, center or degree ***************/ /************* the logo of institution, center or degree ***************/
/*****************************************************************************/ /*****************************************************************************/
void Lgo_PutIconToChangeLogo (HieLvl_Level_t Scope) void Lgo_PutIconToChangeLogo (HieLvl_Level_t Level)
{ {
static Act_Action_t Action[HieLvl_NUM_LEVELS] = static Act_Action_t Action[HieLvl_NUM_LEVELS] =
{ {
@ -198,7 +198,7 @@ void Lgo_PutIconToChangeLogo (HieLvl_Level_t Scope)
[HieLvl_CRS] = ActUnk, // Course [HieLvl_CRS] = ActUnk, // Course
}; };
Lay_PutContextualLinkOnlyIcon (Action[Scope],NULL, Lay_PutContextualLinkOnlyIcon (Action[Level],NULL,
NULL,NULL, NULL,NULL,
"shield-alt.svg",Ico_BLACK); "shield-alt.svg",Ico_BLACK);
} }
@ -207,7 +207,7 @@ void Lgo_PutIconToChangeLogo (HieLvl_Level_t Scope)
/**** Show a form for sending a logo of the institution, center or degree ****/ /**** Show a form for sending a logo of the institution, center or degree ****/
/*****************************************************************************/ /*****************************************************************************/
void Lgo_RequestLogo (HieLvl_Level_t Scope) void Lgo_RequestLogo (HieLvl_Level_t Level)
{ {
extern const char *Txt_Logo; extern const char *Txt_Logo;
extern const char *Txt_You_can_send_a_file_with_an_image_in_PNG_format_transparent_background_and_size_X_Y; extern const char *Txt_You_can_send_a_file_with_an_image_in_PNG_format_transparent_background_and_size_X_Y;
@ -219,7 +219,7 @@ void Lgo_RequestLogo (HieLvl_Level_t Scope)
char PathLogo[PATH_MAX + 1]; char PathLogo[PATH_MAX + 1];
/***** Set action depending on scope *****/ /***** Set action depending on scope *****/
switch (Scope) switch (Level)
{ {
case HieLvl_INS: case HieLvl_INS:
Cod = Gbl.Hierarchy.Ins.InsCod; Cod = Gbl.Hierarchy.Ins.InsCod;
@ -309,7 +309,7 @@ static void Lgo_PutIconToRemoveLogo (Act_Action_t ActionRem)
/******* Receive the logo of the current institution, center or degree *******/ /******* Receive the logo of the current institution, center or degree *******/
/*****************************************************************************/ /*****************************************************************************/
void Lgo_ReceiveLogo (HieLvl_Level_t Scope) void Lgo_ReceiveLogo (HieLvl_Level_t Level)
{ {
extern const char *Txt_The_file_is_not_X; extern const char *Txt_The_file_is_not_X;
long Cod; long Cod;
@ -322,7 +322,7 @@ void Lgo_ReceiveLogo (HieLvl_Level_t Scope)
bool WrongType = false; bool WrongType = false;
/***** Set variables depending on scope *****/ /***** Set variables depending on scope *****/
switch (Scope) switch (Level)
{ {
case HieLvl_INS: case HieLvl_INS:
Cod = Gbl.Hierarchy.Ins.InsCod; Cod = Gbl.Hierarchy.Ins.InsCod;
@ -386,14 +386,14 @@ void Lgo_ReceiveLogo (HieLvl_Level_t Scope)
/******* Remove the logo of the current institution, center or degree ********/ /******* Remove the logo of the current institution, center or degree ********/
/*****************************************************************************/ /*****************************************************************************/
void Lgo_RemoveLogo (HieLvl_Level_t Scope) void Lgo_RemoveLogo (HieLvl_Level_t Level)
{ {
long Cod; long Cod;
const char *Folder; const char *Folder;
char FileNameLogo[PATH_MAX + 1]; // Full name (including path and .png) of the destination file char FileNameLogo[PATH_MAX + 1]; // Full name (including path and .png) of the destination file
/***** Set variables depending on scope *****/ /***** Set variables depending on scope *****/
switch (Scope) switch (Level)
{ {
case HieLvl_INS: case HieLvl_INS:
Cod = Gbl.Hierarchy.Ins.InsCod; Cod = Gbl.Hierarchy.Ins.InsCod;

View File

@ -27,11 +27,11 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Lgo_DrawLogo (HieLvl_Level_t Scope,long Cod,const char *AltText, void Lgo_DrawLogo (HieLvl_Level_t Level,long HieCod,const char *AltText,
unsigned Size,const char *Class); unsigned Size,const char *Class);
void Lgo_PutIconToChangeLogo (HieLvl_Level_t Scope); void Lgo_PutIconToChangeLogo (HieLvl_Level_t Level);
void Lgo_RequestLogo (HieLvl_Level_t Scope); void Lgo_RequestLogo (HieLvl_Level_t Level);
void Lgo_ReceiveLogo (HieLvl_Level_t Scope); void Lgo_ReceiveLogo (HieLvl_Level_t Level);
void Lgo_RemoveLogo (HieLvl_Level_t Scope); void Lgo_RemoveLogo (HieLvl_Level_t Level);
#endif #endif

View File

@ -978,7 +978,7 @@ unsigned Msg_DB_GetKnownRecipients (MYSQL_RES **mysql_res,long MsgCod)
/******** (all the platform, current degree or current course) **********/ /******** (all the platform, current degree or current course) **********/
/*****************************************************************************/ /*****************************************************************************/
unsigned Msg_DB_GetNumSntMsgs (HieLvl_Level_t Scope,Msg_Status_t MsgStatus) unsigned Msg_DB_GetNumSntMsgs (HieLvl_Level_t Level,Msg_Status_t MsgStatus)
{ {
static const char *Table[Msg_NUM_STATUS] = static const char *Table[Msg_NUM_STATUS] =
{ {
@ -989,7 +989,7 @@ unsigned Msg_DB_GetNumSntMsgs (HieLvl_Level_t Scope,Msg_Status_t MsgStatus)
/***** Get the number of messages sent from this location /***** Get the number of messages sent from this location
(all the platform, current degree or current course) from database *****/ (all the platform, current degree or current course) from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) DB_GetNumRowsTable (Table[MsgStatus]); return (unsigned) DB_GetNumRowsTable (Table[MsgStatus]);
@ -1067,7 +1067,7 @@ unsigned Msg_DB_GetNumSntMsgs (HieLvl_Level_t Scope,Msg_Status_t MsgStatus)
/****** (all the platform, current degree or current course) ********/ /****** (all the platform, current degree or current course) ********/
/*****************************************************************************/ /*****************************************************************************/
unsigned Msg_DB_GetNumRcvMsgs (HieLvl_Level_t Scope,Msg_Status_t MsgStatus) unsigned Msg_DB_GetNumRcvMsgs (HieLvl_Level_t Level,Msg_Status_t MsgStatus)
{ {
static const char *Table[Msg_NUM_STATUS] = static const char *Table[Msg_NUM_STATUS] =
{ {
@ -1082,7 +1082,7 @@ unsigned Msg_DB_GetNumRcvMsgs (HieLvl_Level_t Scope,Msg_Status_t MsgStatus)
{ {
case Msg_STATUS_ALL: case Msg_STATUS_ALL:
case Msg_STATUS_DELETED: case Msg_STATUS_DELETED:
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) DB_GetNumRowsTable (Table[MsgStatus]); return (unsigned) DB_GetNumRowsTable (Table[MsgStatus]);
@ -1167,7 +1167,7 @@ unsigned Msg_DB_GetNumRcvMsgs (HieLvl_Level_t Scope,Msg_Status_t MsgStatus)
} }
return 0; return 0;
case Msg_STATUS_NOTIFIED: case Msg_STATUS_NOTIFIED:
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)

View File

@ -79,8 +79,8 @@ unsigned Msg_DB_GetRecipientsCods (MYSQL_RES **mysql_res,
long ReplyUsrCod,const char *ListRecipients); long ReplyUsrCod,const char *ListRecipients);
unsigned Msg_DB_GetNumRecipients (long MsgCod); unsigned Msg_DB_GetNumRecipients (long MsgCod);
unsigned Msg_DB_GetKnownRecipients (MYSQL_RES **mysql_res,long MsgCod); unsigned Msg_DB_GetKnownRecipients (MYSQL_RES **mysql_res,long MsgCod);
unsigned Msg_DB_GetNumSntMsgs (HieLvl_Level_t Scope,Msg_Status_t MsgStatus); unsigned Msg_DB_GetNumSntMsgs (HieLvl_Level_t Level,Msg_Status_t MsgStatus);
unsigned Msg_DB_GetNumRcvMsgs (HieLvl_Level_t Scope,Msg_Status_t MsgStatus); unsigned Msg_DB_GetNumRcvMsgs (HieLvl_Level_t Level,Msg_Status_t MsgStatus);
unsigned Msg_DB_GetNumMsgsSentByTchsCrs (long CrsCod); unsigned Msg_DB_GetNumMsgsSentByTchsCrs (long CrsCod);
unsigned Msg_DB_GetNumMsgsSentByUsr (long UsrCod); unsigned Msg_DB_GetNumMsgsSentByUsr (long UsrCod);

View File

@ -224,7 +224,7 @@ unsigned Net_DB_GetWebAndSocialNetworksStats (MYSQL_RES **mysql_res)
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -685,14 +685,14 @@ void Not_GetSummaryAndContentNotice (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
// Returns the number of (active or obsolete) notices // Returns the number of (active or obsolete) notices
// sent from this location (all the platform, current degree or current course) // sent from this location (all the platform, current degree or current course)
unsigned Not_GetNumNotices (HieLvl_Level_t Scope,Not_Status_t Status,unsigned *NumNotif) unsigned Not_GetNumNotices (HieLvl_Level_t Level,Not_Status_t Status,unsigned *NumNotif)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumNotices; unsigned NumNotices;
/***** Get number of notices from database *****/ /***** Get number of notices from database *****/
if (Not_DB_GetNumNotices (&mysql_res,Scope,Status) == 1) if (Not_DB_GetNumNotices (&mysql_res,Level,Status) == 1)
{ {
/***** Get number of notices *****/ /***** Get number of notices *****/
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
@ -726,14 +726,14 @@ unsigned Not_GetNumNotices (HieLvl_Level_t Scope,Not_Status_t Status,unsigned *N
// Returns the number of deleted notices // Returns the number of deleted notices
// sent from this location (all the platform, current degree or current course) // sent from this location (all the platform, current degree or current course)
unsigned Not_GetNumNoticesDeleted (HieLvl_Level_t Scope,unsigned *NumNotif) unsigned Not_GetNumNoticesDeleted (HieLvl_Level_t Level,unsigned *NumNotif)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumNotices; unsigned NumNotices;
/***** Get number of notices from database *****/ /***** Get number of notices from database *****/
if (Not_DB_GetNumNoticesDeleted (&mysql_res,Scope) == 1) if (Not_DB_GetNumNoticesDeleted (&mysql_res,Level) == 1)
{ {
/***** Get number of notices *****/ /***** Get number of notices *****/
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);

View File

@ -78,8 +78,8 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod);
void Not_GetSummaryAndContentNotice (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Not_GetSummaryAndContentNotice (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr, char **ContentStr,
long NotCod,bool GetContent); long NotCod,bool GetContent);
unsigned Not_GetNumNotices (HieLvl_Level_t Scope,Not_Status_t Status,unsigned *NumNotif); unsigned Not_GetNumNotices (HieLvl_Level_t Level,Not_Status_t Status,unsigned *NumNotif);
unsigned Not_GetNumNoticesDeleted (HieLvl_Level_t Scope,unsigned *NumNotif); unsigned Not_GetNumNoticesDeleted (HieLvl_Level_t Level,unsigned *NumNotif);
//-------------------------------- Figures ------------------------------------ //-------------------------------- Figures ------------------------------------
void Not_GetAndShowNoticesStats (void); void Not_GetAndShowNoticesStats (void);

View File

@ -187,9 +187,9 @@ unsigned Not_DB_GetActiveNotices (MYSQL_RES **mysql_res,long CrsCod)
/*****************************************************************************/ /*****************************************************************************/
unsigned Not_DB_GetNumNotices (MYSQL_RES **mysql_res, unsigned Not_DB_GetNumNotices (MYSQL_RES **mysql_res,
HieLvl_Level_t Scope,Not_Status_t Status) HieLvl_Level_t Level,Not_Status_t Status)
{ {
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -270,7 +270,7 @@ unsigned Not_DB_GetNumNotices (MYSQL_RES **mysql_res,
Gbl.Hierarchy.Crs.CrsCod, Gbl.Hierarchy.Crs.CrsCod,
Status); Status);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -280,9 +280,9 @@ unsigned Not_DB_GetNumNotices (MYSQL_RES **mysql_res,
/*****************************************************************************/ /*****************************************************************************/
unsigned Not_DB_GetNumNoticesDeleted (MYSQL_RES **mysql_res, unsigned Not_DB_GetNumNoticesDeleted (MYSQL_RES **mysql_res,
HieLvl_Level_t Scope) HieLvl_Level_t Level)
{ {
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -351,7 +351,7 @@ unsigned Not_DB_GetNumNoticesDeleted (MYSQL_RES **mysql_res,
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -44,9 +44,9 @@ unsigned Not_DB_ContentNotice (MYSQL_RES **mysql_res,long NotCod);
unsigned Not_DB_GetAllNotices (MYSQL_RES **mysql_res); unsigned Not_DB_GetAllNotices (MYSQL_RES **mysql_res);
unsigned Not_DB_GetActiveNotices (MYSQL_RES **mysql_res,long CrsCod); unsigned Not_DB_GetActiveNotices (MYSQL_RES **mysql_res,long CrsCod);
unsigned Not_DB_GetNumNotices (MYSQL_RES **mysql_res, unsigned Not_DB_GetNumNotices (MYSQL_RES **mysql_res,
HieLvl_Level_t Scope,Not_Status_t Status); HieLvl_Level_t Level,Not_Status_t Status);
unsigned Not_DB_GetNumNoticesDeleted (MYSQL_RES **mysql_res, unsigned Not_DB_GetNumNoticesDeleted (MYSQL_RES **mysql_res,
HieLvl_Level_t Scope); HieLvl_Level_t Level);
void Not_DB_RemoveNotice (long NotCod); void Not_DB_RemoveNotice (long NotCod);
void Not_DB_RemoveCrsNotices (long CrsCod); void Not_DB_RemoveCrsNotices (long CrsCod);

View File

@ -590,7 +590,7 @@ unsigned Ntf_DB_GetNumNotifs (MYSQL_RES **mysql_res,Ntf_NotifyEvent_t NotifyEven
Gbl.Hierarchy.Crs.CrsCod, Gbl.Hierarchy.Crs.CrsCod,
(unsigned) NotifyEvent); (unsigned) NotifyEvent);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -1996,7 +1996,7 @@ static void Pho_PutLinkToCalculateDegreeStats (const struct Pho_DegPhotos *DegPh
extern const char *Txt_Calculate_average_photo_of_THE_DEGREE_X; extern const char *Txt_Calculate_average_photo_of_THE_DEGREE_X;
extern const char *Txt_unknown_TIME; extern const char *Txt_unknown_TIME;
extern const char *Txt_time; extern const char *Txt_time;
struct ListDegrees Degs; struct Deg_ListDegs Degs;
unsigned NumDeg; unsigned NumDeg;
struct Deg_Degree Deg; struct Deg_Degree Deg;
long EstimatedTimeToComputeAvgPhotoInMicroseconds; long EstimatedTimeToComputeAvgPhotoInMicroseconds;

View File

@ -410,7 +410,7 @@ unsigned Prf_DB_GetRankingFigure (MYSQL_RES **mysql_res,const char *FldName)
FldName, FldName,
FldName); FldName);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -559,7 +559,7 @@ unsigned Prf_DB_GetRankingClicksPerDay (MYSQL_RES **mysql_res)
" LIMIT 100", " LIMIT 100",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -250,10 +250,10 @@ void Prg_DB_GetItemTxt (long ItmCod,char Txt[Cns_MAX_BYTES_TEXT + 1])
// Returns the number of courses with program items // Returns the number of courses with program items
// in this location (all the platform, current degree or current course) // in this location (all the platform, current degree or current course)
unsigned Prg_DB_GetNumCoursesWithItems (HieLvl_Level_t Scope) unsigned Prg_DB_GetNumCoursesWithItems (HieLvl_Level_t Level)
{ {
/***** Get number of courses with program items from database *****/ /***** Get number of courses with program items from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -326,9 +326,9 @@ unsigned Prg_DB_GetNumCoursesWithItems (HieLvl_Level_t Scope)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of program items in a hierarchy scope // Returns the number of program items in a hierarchy scope
unsigned Prg_DB_GetNumItems (HieLvl_Level_t Scope) unsigned Prg_DB_GetNumItems (HieLvl_Level_t Level)
{ {
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -392,7 +392,7 @@ unsigned Prg_DB_GetNumItems (HieLvl_Level_t Scope)
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -49,8 +49,8 @@ unsigned Prg_DB_GetListItems (MYSQL_RES **mysql_res);
unsigned Prg_DB_GetItemDataByCod (MYSQL_RES **mysql_res,long ItmCod); unsigned Prg_DB_GetItemDataByCod (MYSQL_RES **mysql_res,long ItmCod);
void Prg_DB_GetItemTxt (long ItmCod,char Txt[Cns_MAX_BYTES_TEXT + 1]); void Prg_DB_GetItemTxt (long ItmCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
unsigned Prg_DB_GetNumCoursesWithItems (HieLvl_Level_t Scope); unsigned Prg_DB_GetNumCoursesWithItems (HieLvl_Level_t Level);
unsigned Prg_DB_GetNumItems (HieLvl_Level_t Scope); unsigned Prg_DB_GetNumItems (HieLvl_Level_t Level);
void Prg_DB_RemoveItemRange (const struct Prg_ItemRange *ToRemove); void Prg_DB_RemoveItemRange (const struct Prg_ItemRange *ToRemove);
void Prg_DB_RemoveCrsItems (long CrsCod); void Prg_DB_RemoveCrsItems (long CrsCod);

View File

@ -689,10 +689,10 @@ long Prj_DB_GetCrsOfPrj (long PrjCod)
// Returns the number of courses with projects // Returns the number of courses with projects
// in this location (all the platform, current degree or current course) // in this location (all the platform, current degree or current course)
unsigned Prj_DB_GetNumCoursesWithProjects (HieLvl_Level_t Scope) unsigned Prj_DB_GetNumCoursesWithProjects (HieLvl_Level_t Level)
{ {
/***** Get number of courses with projects from database *****/ /***** Get number of courses with projects from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -756,7 +756,7 @@ unsigned Prj_DB_GetNumCoursesWithProjects (HieLvl_Level_t Scope)
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -766,10 +766,10 @@ unsigned Prj_DB_GetNumCoursesWithProjects (HieLvl_Level_t Scope)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of projects in this location // Returns the number of projects in this location
unsigned Prj_DB_GetNumProjects (HieLvl_Level_t Scope) unsigned Prj_DB_GetNumProjects (HieLvl_Level_t Level)
{ {
/***** Get number of projects from database *****/ /***** Get number of projects from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -833,7 +833,7 @@ unsigned Prj_DB_GetNumProjects (HieLvl_Level_t Scope)
" WHERE CrsCod=%ld", " WHERE CrsCod=%ld",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -53,8 +53,8 @@ unsigned Prj_DB_GetUsrsInPrj (MYSQL_RES **mysql_res,
long PrjCod,Prj_RoleInProject_t RoleInProject); long PrjCod,Prj_RoleInProject_t RoleInProject);
unsigned Prj_DB_GetMyRolesInPrj (MYSQL_RES **mysql_res,long PrjCod); unsigned Prj_DB_GetMyRolesInPrj (MYSQL_RES **mysql_res,long PrjCod);
long Prj_DB_GetCrsOfPrj (long PrjCod); long Prj_DB_GetCrsOfPrj (long PrjCod);
unsigned Prj_DB_GetNumCoursesWithProjects (HieLvl_Level_t Scope); unsigned Prj_DB_GetNumCoursesWithProjects (HieLvl_Level_t Level);
unsigned Prj_DB_GetNumProjects (HieLvl_Level_t Scope); unsigned Prj_DB_GetNumProjects (HieLvl_Level_t Level);
void Prj_DB_RemoveUsrFromPrj (long PrjCod,Prj_RoleInProject_t RoleInPrj,long UsrCod); void Prj_DB_RemoveUsrFromPrj (long PrjCod,Prj_RoleInProject_t RoleInPrj,long UsrCod);
void Prj_DB_RemoveUsrFromProjects (long UsrCod); void Prj_DB_RemoveUsrFromProjects (long UsrCod);

View File

@ -3643,7 +3643,7 @@ void Qst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod)
// Returns the number of test questions // Returns the number of test questions
// in this location (all the platform, current degree or current course) // in this location (all the platform, current degree or current course)
unsigned Qst_GetNumQuestions (HieLvl_Level_t Scope,Qst_AnswerType_t AnsType, unsigned Qst_GetNumQuestions (HieLvl_Level_t Level,Qst_AnswerType_t AnsType,
struct Qst_Stats *Stats) struct Qst_Stats *Stats)
{ {
extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES]; extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES];
@ -3656,7 +3656,7 @@ unsigned Qst_GetNumQuestions (HieLvl_Level_t Scope,Qst_AnswerType_t AnsType,
Stats->TotalScore = 0.0; Stats->TotalScore = 0.0;
/***** Get number of questions from database *****/ /***** Get number of questions from database *****/
if (Qst_DB_GetNumQsts (&mysql_res,Scope,AnsType)) if (Qst_DB_GetNumQsts (&mysql_res,Level,AnsType))
{ {
/***** Get number of questions *****/ /***** Get number of questions *****/
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);

View File

@ -274,7 +274,7 @@ void Qst_RemoveMediaFromAllAnsOfQst (long CrsCod,long QstCod);
void Qst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod); void Qst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod);
void Qst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod); void Qst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod);
unsigned Qst_GetNumQuestions (HieLvl_Level_t Scope,Qst_AnswerType_t AnsType, unsigned Qst_GetNumQuestions (HieLvl_Level_t Level,Qst_AnswerType_t AnsType,
struct Qst_Stats *Stats); struct Qst_Stats *Stats);
void Qst_GetTestStats (Qst_AnswerType_t AnsType,struct Qst_Stats *Stats); void Qst_GetTestStats (Qst_AnswerType_t AnsType,struct Qst_Stats *Stats);

View File

@ -595,9 +595,9 @@ unsigned Qst_DB_GetNumQstsInCrs (long CrsCod)
// in this location (all the platform, current degree or current course) // in this location (all the platform, current degree or current course)
unsigned Qst_DB_GetNumQsts (MYSQL_RES **mysql_res, unsigned Qst_DB_GetNumQsts (MYSQL_RES **mysql_res,
HieLvl_Level_t Scope,Qst_AnswerType_t AnsType) HieLvl_Level_t Level,Qst_AnswerType_t AnsType)
{ {
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
if (AnsType == Qst_ANS_UNKNOWN) // Any type if (AnsType == Qst_ANS_UNKNOWN) // Any type
@ -762,7 +762,7 @@ unsigned Qst_DB_GetNumQsts (MYSQL_RES **mysql_res,
Gbl.Hierarchy.Crs.CrsCod, Gbl.Hierarchy.Crs.CrsCod,
Qst_DB_StrAnswerTypes[AnsType]); Qst_DB_StrAnswerTypes[AnsType]);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -773,13 +773,13 @@ unsigned Qst_DB_GetNumQsts (MYSQL_RES **mysql_res,
// Returns the number of courses with test questions // Returns the number of courses with test questions
// in this location (all the platform, current degree or current course) // in this location (all the platform, current degree or current course)
unsigned Qst_DB_GetNumCrssWithQsts (HieLvl_Level_t Scope, unsigned Qst_DB_GetNumCrssWithQsts (HieLvl_Level_t Level,
Qst_AnswerType_t AnsType) Qst_AnswerType_t AnsType)
{ {
extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES]; extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES];
/***** Get number of courses with test questions from database *****/ /***** Get number of courses with test questions from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
if (AnsType == Qst_ANS_UNKNOWN) // Any type if (AnsType == Qst_ANS_UNKNOWN) // Any type
@ -920,7 +920,7 @@ unsigned Qst_DB_GetNumCrssWithQsts (HieLvl_Level_t Scope,
Gbl.Hierarchy.Crs.CrsCod, Gbl.Hierarchy.Crs.CrsCod,
Qst_DB_StrAnswerTypes[AnsType]); Qst_DB_StrAnswerTypes[AnsType]);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }
@ -931,14 +931,14 @@ unsigned Qst_DB_GetNumCrssWithQsts (HieLvl_Level_t Scope,
// Returns the number of courses with pluggable test questions // Returns the number of courses with pluggable test questions
// in this location (all the platform, current degree or current course) // in this location (all the platform, current degree or current course)
unsigned Qst_DB_GetNumCrssWithPluggableQsts (HieLvl_Level_t Scope, unsigned Qst_DB_GetNumCrssWithPluggableQsts (HieLvl_Level_t Level,
Qst_AnswerType_t AnsType) Qst_AnswerType_t AnsType)
{ {
extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES]; extern const char *Qst_DB_StrAnswerTypes[Qst_NUM_ANS_TYPES];
extern const char *Tst_DB_Pluggable[TstCfg_NUM_OPTIONS_PLUGGABLE]; extern const char *Tst_DB_Pluggable[TstCfg_NUM_OPTIONS_PLUGGABLE];
/***** Get number of courses with test questions from database *****/ /***** Get number of courses with test questions from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
if (AnsType == Qst_ANS_UNKNOWN) // Any type if (AnsType == Qst_ANS_UNKNOWN) // Any type
@ -1127,7 +1127,7 @@ unsigned Qst_DB_GetNumCrssWithPluggableQsts (HieLvl_Level_t Scope,
Qst_DB_StrAnswerTypes[AnsType], Qst_DB_StrAnswerTypes[AnsType],
Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]); Tst_DB_Pluggable[TstCfg_PLUGGABLE_YES]);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0; // Not reached return 0; // Not reached
} }
} }

View File

@ -47,10 +47,10 @@ unsigned Qst_DB_GetTrivialQst (MYSQL_RES **mysql_res,
float lowerScore,float upperScore); float lowerScore,float upperScore);
unsigned Qst_DB_GetNumQstsInCrs (long CrsCod); unsigned Qst_DB_GetNumQstsInCrs (long CrsCod);
unsigned Qst_DB_GetNumQsts (MYSQL_RES **mysql_res, unsigned Qst_DB_GetNumQsts (MYSQL_RES **mysql_res,
HieLvl_Level_t Scope,Qst_AnswerType_t AnsType); HieLvl_Level_t Level,Qst_AnswerType_t AnsType);
unsigned Qst_DB_GetNumCrssWithQsts (HieLvl_Level_t Scope, unsigned Qst_DB_GetNumCrssWithQsts (HieLvl_Level_t Level,
Qst_AnswerType_t AnsType); Qst_AnswerType_t AnsType);
unsigned Qst_DB_GetNumCrssWithPluggableQsts (HieLvl_Level_t Scope, unsigned Qst_DB_GetNumCrssWithPluggableQsts (HieLvl_Level_t Level,
Qst_AnswerType_t AnsType); Qst_AnswerType_t AnsType);
unsigned Qst_DB_GetRecentQuestions (MYSQL_RES **mysql_res, unsigned Qst_DB_GetRecentQuestions (MYSQL_RES **mysql_res,

View File

@ -177,10 +177,10 @@ bool Rub_DB_CheckIfSimilarRubricExists (const struct Rub_Rubric *Rubric)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of courses with rubrics in this location // Returns the number of courses with rubrics in this location
unsigned Rub_DB_GetNumCoursesWithRubrics (HieLvl_Level_t Scope) unsigned Rub_DB_GetNumCoursesWithRubrics (HieLvl_Level_t Level)
{ {
/***** Get number of courses with rubrics from database *****/ /***** Get number of courses with rubrics from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -250,12 +250,12 @@ unsigned Rub_DB_GetNumCoursesWithRubrics (HieLvl_Level_t Scope)
/*****************************************************************************/ /*****************************************************************************/
/*************************** Get number of rubrics ***************************/ /*************************** Get number of rubrics ***************************/
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rubrics in this location // Returns the number of rubrics in a given location
unsigned Rub_DB_GetNumRubrics (HieLvl_Level_t Scope) unsigned Rub_DB_GetNumRubrics (HieLvl_Level_t Level)
{ {
/***** Get number of rubrics from database *****/ /***** Get number of rubrics from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return (unsigned) return (unsigned)
@ -690,10 +690,10 @@ bool Rub_DB_CheckIfSimilarCriterionExists (const struct RubCri_Criterion *Criter
/**************** Get average number of criteria per rubric ******************/ /**************** Get average number of criteria per rubric ******************/
/*****************************************************************************/ /*****************************************************************************/
double Rub_DB_GetNumCriteriaPerRubric (HieLvl_Level_t Scope) double Rub_DB_GetNumCriteriaPerRubric (HieLvl_Level_t Level)
{ {
/***** Get number of criteria per rubric from database *****/ /***** Get number of criteria per rubric from database *****/
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
return return
@ -780,7 +780,7 @@ double Rub_DB_GetNumCriteriaPerRubric (HieLvl_Level_t Scope)
" GROUP BY rub_criteria.RubCod) AS NumCriteriaTable", " GROUP BY rub_criteria.RubCod) AS NumCriteriaTable",
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return 0.0; // Not reached return 0.0; // Not reached
} }
} }

View File

@ -47,8 +47,8 @@ unsigned Rub_DB_GetRubricDataByCod (MYSQL_RES **mysql_res,long RubCod);
void Rub_DB_GetRubricTitle (long RubCod,char *Title,size_t TitleSize); void Rub_DB_GetRubricTitle (long RubCod,char *Title,size_t TitleSize);
void Rub_DB_GetRubricTxt (struct Rub_Rubric *Rubric); void Rub_DB_GetRubricTxt (struct Rub_Rubric *Rubric);
bool Rub_DB_CheckIfSimilarRubricExists (const struct Rub_Rubric *Rubric); bool Rub_DB_CheckIfSimilarRubricExists (const struct Rub_Rubric *Rubric);
unsigned Rub_DB_GetNumCoursesWithRubrics (HieLvl_Level_t Scope); unsigned Rub_DB_GetNumCoursesWithRubrics (HieLvl_Level_t Level);
unsigned Rub_DB_GetNumRubrics (HieLvl_Level_t Scope); unsigned Rub_DB_GetNumRubrics (HieLvl_Level_t Level);
void Rub_DB_RemoveRubric (long RubCod); void Rub_DB_RemoveRubric (long RubCod);
void Rub_DB_RemoveCrsRubrics (long CrsCod); void Rub_DB_RemoveCrsRubrics (long CrsCod);
@ -76,7 +76,7 @@ unsigned Rub_DB_GetCriterionDataByCod (MYSQL_RES **mysql_res,long CriCod);
bool Rub_DB_CheckIfSimilarCriterionExists (const struct RubCri_Criterion *Criterion, bool Rub_DB_CheckIfSimilarCriterionExists (const struct RubCri_Criterion *Criterion,
const char Title[RubCri_MAX_BYTES_TITLE + 1]); const char Title[RubCri_MAX_BYTES_TITLE + 1]);
double Rub_DB_GetNumCriteriaPerRubric (HieLvl_Level_t Scope); double Rub_DB_GetNumCriteriaPerRubric (HieLvl_Level_t Level);
void Rub_DB_RemoveCriterionFromRubric (const struct RubCri_Criterion *Criterion); void Rub_DB_RemoveCriterionFromRubric (const struct RubCri_Criterion *Criterion);
void Rub_DB_RemoveRubricCriteria (long RubCod); void Rub_DB_RemoveRubricCriteria (long RubCod);

View File

@ -52,7 +52,7 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan
extern const char *Txt_Center; extern const char *Txt_Center;
extern const char *Txt_Degree; extern const char *Txt_Degree;
extern const char *Txt_Course; extern const char *Txt_Course;
HieLvl_Level_t Scope; HieLvl_Level_t Level;
unsigned ScopeUnsigned; unsigned ScopeUnsigned;
bool WriteScope; bool WriteScope;
static const char **TxtScope[HieLvl_NUM_LEVELS] = static const char **TxtScope[HieLvl_NUM_LEVELS] =
@ -78,14 +78,14 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan
"id=\"%s\" name=\"%s\" class=\"INPUT_%s\"", "id=\"%s\" name=\"%s\" class=\"INPUT_%s\"",
ParName,ParName,The_GetSuffix ()); ParName,ParName,The_GetSuffix ());
for (Scope = (HieLvl_Level_t) 1; for (Level = (HieLvl_Level_t) 1;
Scope <= (HieLvl_Level_t) (HieLvl_NUM_LEVELS - 1); Level <= (HieLvl_Level_t) (HieLvl_NUM_LEVELS - 1);
Scope++) Level++)
if ((Gbl.Scope.Allowed & (1 << Scope))) if ((Gbl.Scope.Allowed & (1 << Level)))
{ {
/* Don't put forbidden options in selectable list */ /* Don't put forbidden options in selectable list */
WriteScope = false; WriteScope = false;
switch (Scope) switch (Level)
{ {
case HieLvl_SYS: case HieLvl_SYS:
WriteScope = true; WriteScope = true;
@ -117,13 +117,13 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan
if (WriteScope) if (WriteScope)
{ {
/***** Write allowed option *****/ /***** Write allowed option *****/
ScopeUnsigned = (unsigned) Scope; ScopeUnsigned = (unsigned) Level;
HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned, HTM_OPTION (HTM_Type_UNSIGNED,&ScopeUnsigned,
Scope == Gbl.Scope.Current ? HTM_OPTION_SELECTED : Level == Gbl.Scope.Current ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED, HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED, HTM_OPTION_ENABLED,
"%s: %s", "%s: %s",
*TxtScope[Scope],TxtName[Scope]); *TxtScope[Level],TxtName[Level]);
} }
} }
@ -134,15 +134,15 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan
/********************** Put hidden parameter scope ***************************/ /********************** Put hidden parameter scope ***************************/
/*****************************************************************************/ /*****************************************************************************/
void Sco_PutParCurrentScope (void *Scope) void Sco_PutParCurrentScope (void *Level)
{ {
if (Scope) if (Level)
Sco_PutParScope ("ScopeUsr",*((HieLvl_Level_t *) Scope)); Sco_PutParScope ("ScopeUsr",*((HieLvl_Level_t *) Level));
} }
void Sco_PutParScope (const char *ParName,HieLvl_Level_t Scope) void Sco_PutParScope (const char *ParName,HieLvl_Level_t Level)
{ {
Par_PutParUnsigned (NULL,ParName,(unsigned) Scope); Par_PutParUnsigned (NULL,ParName,(unsigned) Level);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -284,27 +284,27 @@ HieLvl_Level_t Sco_GetScopeFromUnsignedStr (const char *UnsignedStr)
} }
/*****************************************************************************/ /*****************************************************************************/
/*********************** Get scope from database string **********************/ /***************** Get hierarchy level from database string ******************/
/*****************************************************************************/ /*****************************************************************************/
HieLvl_Level_t Sco_GetScopeFromDBStr (const char *ScopeDBStr) HieLvl_Level_t Hie_GetLevelFromDBStr (const char *LevelDBStr)
{ {
HieLvl_Level_t Scope; HieLvl_Level_t Level;
for (Scope = (HieLvl_Level_t) 0; for (Level = (HieLvl_Level_t) 0;
Scope <= (HieLvl_Level_t) (HieLvl_NUM_LEVELS - 1); Level <= (HieLvl_Level_t) (HieLvl_NUM_LEVELS - 1);
Scope++) Level++)
if (!strcmp (Sco_GetDBStrFromScope (Scope),ScopeDBStr)) if (!strcmp (Hie_GetDBStrFromLevel (Level),LevelDBStr))
return Scope; return Level;
return HieLvl_UNK; return HieLvl_UNK;
} }
/*****************************************************************************/ /*****************************************************************************/
/*********************** Get database string from source *********************/ /****************** Get database string from hierarchy level *****************/
/*****************************************************************************/ /*****************************************************************************/
const char *Sco_GetDBStrFromScope (HieLvl_Level_t Scope) const char *Hie_GetDBStrFromLevel (HieLvl_Level_t Level)
{ {
static const char *Sco_ScopeDB[HieLvl_NUM_LEVELS] = static const char *Sco_ScopeDB[HieLvl_NUM_LEVELS] =
{ {
@ -317,17 +317,17 @@ const char *Sco_GetDBStrFromScope (HieLvl_Level_t Scope)
[HieLvl_CRS] = "Crs", [HieLvl_CRS] = "Crs",
}; };
if (Scope >= HieLvl_NUM_LEVELS) if (Level >= HieLvl_NUM_LEVELS)
Scope = HieLvl_UNK; Level = HieLvl_UNK;
return Sco_ScopeDB[Scope]; return Sco_ScopeDB[Level];
} }
/*****************************************************************************/ /*****************************************************************************/
/**************************** Get current scope code *************************/ /************************** Get current hierarchy code ***********************/
/*****************************************************************************/ /*****************************************************************************/
long Sco_GetCurrentCod (void) long Hie_GetCurrentCod (void)
{ {
switch (Gbl.Scope.Current) switch (Gbl.Scope.Current)
{ {
@ -344,7 +344,7 @@ long Sco_GetCurrentCod (void)
case HieLvl_CRS: case HieLvl_CRS:
return Gbl.Hierarchy.Crs.CrsCod; return Gbl.Hierarchy.Crs.CrsCod;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
return -1L; // Not reached return -1L; // Not reached
} }
} }

View File

@ -37,8 +37,8 @@
/*****************************************************************************/ /*****************************************************************************/
void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChange); void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChange);
void Sco_PutParCurrentScope (void *Scope); void Sco_PutParCurrentScope (void *Level);
void Sco_PutParScope (const char *ParName,HieLvl_Level_t Scope); void Sco_PutParScope (const char *ParName,HieLvl_Level_t Level);
void Sco_GetScope (const char *ParName); void Sco_GetScope (const char *ParName);
void Sco_AdjustScope (void); void Sco_AdjustScope (void);
@ -46,9 +46,9 @@ void Sco_SetScopesForListingGuests (void);
void Sco_SetScopesForListingStudents (void); void Sco_SetScopesForListingStudents (void);
HieLvl_Level_t Sco_GetScopeFromUnsignedStr (const char *UnsignedStr); HieLvl_Level_t Sco_GetScopeFromUnsignedStr (const char *UnsignedStr);
HieLvl_Level_t Sco_GetScopeFromDBStr (const char *ScopeDBStr); HieLvl_Level_t Hie_GetLevelFromDBStr (const char *LevelDBStr);
const char *Sco_GetDBStrFromScope (HieLvl_Level_t Scope); const char *Hie_GetDBStrFromLevel (HieLvl_Level_t Level);
long Sco_GetCurrentCod (void); long Hie_GetCurrentCod (void);
#endif #endif

View File

@ -594,10 +594,10 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
HidVis_GroupClass[Surveys->Svy.Status.HiddenOrVisible], HidVis_GroupClass[Surveys->Svy.Status.HiddenOrVisible],
The_GetSuffix ()); The_GetSuffix ());
HTM_TxtColonNBSP (Txt_Scope); HTM_TxtColonNBSP (Txt_Scope);
switch (Surveys->Svy.Scope) switch (Surveys->Svy.Level)
{ {
case HieLvl_UNK: // Unknown case HieLvl_UNK: // Unknown
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
case HieLvl_SYS: // System case HieLvl_SYS: // System
HTM_Txt (Cfg_PLATFORM_SHORT_NAME); HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
@ -634,7 +634,7 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
HTM_DIV_End (); HTM_DIV_End ();
/* Groups whose users can answer this survey */ /* Groups whose users can answer this survey */
if (Surveys->Svy.Scope == HieLvl_CRS) if (Surveys->Svy.Level == HieLvl_CRS)
if (Gbl.Crs.Grps.NumGrps) if (Gbl.Crs.Grps.NumGrps)
Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (&Surveys->Svy); Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (&Surveys->Svy);
@ -665,8 +665,8 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
The_ChangeRowColor (); The_ChangeRowColor ();
/***** Mark possible notification as seen *****/ /***** Mark possible notification as seen *****/
if (Surveys->Svy.Scope == HieLvl_CRS) // Only course surveys are notified if (Surveys->Svy.Level == HieLvl_CRS) // Only course surveys are notified
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_SURVEY,Surveys->Svy.Cod); Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_SURVEY,Surveys->Svy.HieCod);
if (ShowOnlyThisSvyComplete) if (ShowOnlyThisSvyComplete)
{ {
@ -1138,11 +1138,11 @@ void Svy_GetSurveyDataByCod (struct Svy_Survey *Svy)
Svy->SvyCod = Str_ConvertStrCodToLongCod (row[0]); Svy->SvyCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get survey scope (row[1]) */ /* Get survey scope (row[1]) */
if ((Svy->Scope = Sco_GetScopeFromDBStr (row[1])) == HieLvl_UNK) if ((Svy->Level = Hie_GetLevelFromDBStr (row[1])) == HieLvl_UNK)
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
/* Get code of the country, institution, center, degree or course (row[2]) */ /* Get code of the country, institution, center, degree or course (row[2]) */
Svy->Cod = Str_ConvertStrCodToLongCod (row[2]); Svy->HieCod = Str_ConvertStrCodToLongCod (row[2]);
/* Get whether the survey is hidden (row[3]) */ /* Get whether the survey is hidden (row[3]) */
Svy->Status.HiddenOrVisible = (row[3][0] == 'Y') ? HidVis_HIDDEN : Svy->Status.HiddenOrVisible = (row[3][0] == 'Y') ? HidVis_HIDDEN :
@ -1174,28 +1174,28 @@ void Svy_GetSurveyDataByCod (struct Svy_Survey *Svy)
Svy->Status.IAmLoggedWithAValidRoleToAnswer = (Svy->Roles & (1 << Gbl.Usrs.Me.Role.Logged)); Svy->Status.IAmLoggedWithAValidRoleToAnswer = (Svy->Roles & (1 << Gbl.Usrs.Me.Role.Logged));
/* Do I belong to valid groups to answer this survey? */ /* Do I belong to valid groups to answer this survey? */
switch (Svy->Scope) switch (Svy->Level)
{ {
case HieLvl_UNK: // Unknown case HieLvl_UNK: // Unknown
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
case HieLvl_SYS: // System case HieLvl_SYS: // System
Svy->Status.IBelongToScope = Gbl.Usrs.Me.Logged; Svy->Status.IBelongToScope = Gbl.Usrs.Me.Logged;
break; break;
case HieLvl_CTY: // Country case HieLvl_CTY: // Country
Svy->Status.IBelongToScope = Cty_CheckIfIBelongToCty (Svy->Cod); Svy->Status.IBelongToScope = Cty_CheckIfIBelongToCty (Svy->HieCod);
break; break;
case HieLvl_INS: // Institution case HieLvl_INS: // Institution
Svy->Status.IBelongToScope = Ins_CheckIfIBelongToIns (Svy->Cod); Svy->Status.IBelongToScope = Ins_CheckIfIBelongToIns (Svy->HieCod);
break; break;
case HieLvl_CTR: // Center case HieLvl_CTR: // Center
Svy->Status.IBelongToScope = Ctr_CheckIfIBelongToCtr (Svy->Cod); Svy->Status.IBelongToScope = Ctr_CheckIfIBelongToCtr (Svy->HieCod);
break; break;
case HieLvl_DEG: // Degree case HieLvl_DEG: // Degree
Svy->Status.IBelongToScope = Deg_CheckIfIBelongToDeg (Svy->Cod); Svy->Status.IBelongToScope = Deg_CheckIfIBelongToDeg (Svy->HieCod);
break; break;
case HieLvl_CRS: // Course case HieLvl_CRS: // Course
Svy->Status.IBelongToScope = Enr_CheckIfIBelongToCrs (Svy->Cod) && Svy->Status.IBelongToScope = Enr_CheckIfIBelongToCrs (Svy->HieCod) &&
Svy_DB_CheckIfICanDoThisSurveyBasedOnGrps (Svy->SvyCod); Svy_DB_CheckIfICanDoThisSurveyBasedOnGrps (Svy->SvyCod);
break; break;
} }
@ -1216,12 +1216,12 @@ void Svy_GetSurveyDataByCod (struct Svy_Survey *Svy)
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
Svy->Status.ICanViewResults = (Svy->Scope == HieLvl_CRS || Svy->Status.ICanViewResults = (Svy->Level == HieLvl_CRS ||
Svy->Scope == HieLvl_DEG || Svy->Level == HieLvl_DEG ||
Svy->Scope == HieLvl_CTR || Svy->Level == HieLvl_CTR ||
Svy->Scope == HieLvl_INS || Svy->Level == HieLvl_INS ||
Svy->Scope == HieLvl_CTY || Svy->Level == HieLvl_CTY ||
Svy->Scope == HieLvl_SYS) && Svy->Level == HieLvl_SYS) &&
(Svy->NumQsts != 0) && (Svy->NumQsts != 0) &&
Svy->Status.HiddenOrVisible == HidVis_VISIBLE && Svy->Status.HiddenOrVisible == HidVis_VISIBLE &&
Svy->Status.Open && Svy->Status.Open &&
@ -1233,59 +1233,59 @@ void Svy_GetSurveyDataByCod (struct Svy_Survey *Svy)
break; break;
case Rol_NET: case Rol_NET:
Svy->Status.ICanViewResults = Svy->Status.ICanViewResults =
Svy->Status.ICanViewComments = (Svy->Scope == HieLvl_CRS || Svy->Status.ICanViewComments = (Svy->Level == HieLvl_CRS ||
Svy->Scope == HieLvl_DEG || Svy->Level == HieLvl_DEG ||
Svy->Scope == HieLvl_CTR || Svy->Level == HieLvl_CTR ||
Svy->Scope == HieLvl_INS || Svy->Level == HieLvl_INS ||
Svy->Scope == HieLvl_CTY || Svy->Level == HieLvl_CTY ||
Svy->Scope == HieLvl_SYS) && Svy->Level == HieLvl_SYS) &&
Svy->NumQsts != 0 && Svy->NumQsts != 0 &&
!Svy->Status.ICanAnswer; !Svy->Status.ICanAnswer;
Svy->Status.ICanEdit = false; Svy->Status.ICanEdit = false;
break; break;
case Rol_TCH: case Rol_TCH:
Svy->Status.ICanViewResults = Svy->Status.ICanViewResults =
Svy->Status.ICanViewComments = (Svy->Scope == HieLvl_CRS || Svy->Status.ICanViewComments = (Svy->Level == HieLvl_CRS ||
Svy->Scope == HieLvl_DEG || Svy->Level == HieLvl_DEG ||
Svy->Scope == HieLvl_CTR || Svy->Level == HieLvl_CTR ||
Svy->Scope == HieLvl_INS || Svy->Level == HieLvl_INS ||
Svy->Scope == HieLvl_CTY || Svy->Level == HieLvl_CTY ||
Svy->Scope == HieLvl_SYS) && Svy->Level == HieLvl_SYS) &&
Svy->NumQsts != 0 && Svy->NumQsts != 0 &&
!Svy->Status.ICanAnswer; !Svy->Status.ICanAnswer;
Svy->Status.ICanEdit = Svy->Scope == HieLvl_CRS; // && Svy->Status.IBelongToScope Svy->Status.ICanEdit = Svy->Level == HieLvl_CRS; // && Svy->Status.IBelongToScope
break; break;
case Rol_DEG_ADM: case Rol_DEG_ADM:
Svy->Status.ICanViewResults = Svy->Status.ICanViewResults =
Svy->Status.ICanViewComments = (Svy->Scope == HieLvl_DEG || Svy->Status.ICanViewComments = (Svy->Level == HieLvl_DEG ||
Svy->Scope == HieLvl_CTR || Svy->Level == HieLvl_CTR ||
Svy->Scope == HieLvl_INS || Svy->Level == HieLvl_INS ||
Svy->Scope == HieLvl_CTY || Svy->Level == HieLvl_CTY ||
Svy->Scope == HieLvl_SYS) && Svy->Level == HieLvl_SYS) &&
(Svy->NumQsts != 0) && (Svy->NumQsts != 0) &&
!Svy->Status.ICanAnswer; !Svy->Status.ICanAnswer;
Svy->Status.ICanEdit = Svy->Scope == HieLvl_DEG && Svy->Status.ICanEdit = Svy->Level == HieLvl_DEG &&
Svy->Status.IBelongToScope; Svy->Status.IBelongToScope;
break; break;
case Rol_CTR_ADM: case Rol_CTR_ADM:
Svy->Status.ICanViewResults = Svy->Status.ICanViewResults =
Svy->Status.ICanViewComments = (Svy->Scope == HieLvl_CTR || Svy->Status.ICanViewComments = (Svy->Level == HieLvl_CTR ||
Svy->Scope == HieLvl_INS || Svy->Level == HieLvl_INS ||
Svy->Scope == HieLvl_CTY || Svy->Level == HieLvl_CTY ||
Svy->Scope == HieLvl_SYS) && Svy->Level == HieLvl_SYS) &&
(Svy->NumQsts != 0) && (Svy->NumQsts != 0) &&
!Svy->Status.ICanAnswer; !Svy->Status.ICanAnswer;
Svy->Status.ICanEdit = Svy->Scope == HieLvl_CTR && Svy->Status.ICanEdit = Svy->Level == HieLvl_CTR &&
Svy->Status.IBelongToScope; Svy->Status.IBelongToScope;
break; break;
case Rol_INS_ADM: case Rol_INS_ADM:
Svy->Status.ICanViewResults = Svy->Status.ICanViewResults =
Svy->Status.ICanViewComments = (Svy->Scope == HieLvl_INS || Svy->Status.ICanViewComments = (Svy->Level == HieLvl_INS ||
Svy->Scope == HieLvl_CTY || Svy->Level == HieLvl_CTY ||
Svy->Scope == HieLvl_SYS) && Svy->Level == HieLvl_SYS) &&
(Svy->NumQsts != 0) && (Svy->NumQsts != 0) &&
!Svy->Status.ICanAnswer; !Svy->Status.ICanAnswer;
Svy->Status.ICanEdit = Svy->Scope == HieLvl_INS && Svy->Status.ICanEdit = Svy->Level == HieLvl_INS &&
Svy->Status.IBelongToScope; Svy->Status.IBelongToScope;
break; break;
case Rol_SYS_ADM: case Rol_SYS_ADM:
@ -1304,7 +1304,7 @@ void Svy_GetSurveyDataByCod (struct Svy_Survey *Svy)
{ {
/* Initialize to empty survey */ /* Initialize to empty survey */
Svy->SvyCod = -1L; Svy->SvyCod = -1L;
Svy->Scope = HieLvl_UNK; Svy->Level = HieLvl_UNK;
Svy->Roles = 0; Svy->Roles = 0;
Svy->UsrCod = -1L; Svy->UsrCod = -1L;
Svy->TimeUTC[Dat_STR_TIME] = Svy->TimeUTC[Dat_STR_TIME] =
@ -1650,7 +1650,7 @@ void Svy_ReqCreatOrEditSvy (void)
/* Initialize to empty survey */ /* Initialize to empty survey */
Surveys.Svy.SvyCod = -1L; Surveys.Svy.SvyCod = -1L;
Surveys.Svy.Scope = HieLvl_UNK; Surveys.Svy.Level = HieLvl_UNK;
Surveys.Svy.Roles = (1 << Rol_STD); Surveys.Svy.Roles = (1 << Rol_STD);
Surveys.Svy.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; Surveys.Svy.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Surveys.Svy.TimeUTC[Dat_STR_TIME] = Dat_GetStartExecutionTimeUTC (); Surveys.Svy.TimeUTC[Dat_STR_TIME] = Dat_GetStartExecutionTimeUTC ();
@ -1800,52 +1800,52 @@ static void Svy_SetDefaultAndAllowedScope (struct Svy_Survey *Svy)
case Rol_TCH: // Teachers only can edit course surveys case Rol_TCH: // Teachers only can edit course surveys
if (Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected if (Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
{ {
if (Svy->Scope == HieLvl_UNK) // Scope not defined if (Svy->Level == HieLvl_UNK) // Scope not defined
Svy->Scope = HieLvl_CRS; Svy->Level = HieLvl_CRS;
if (Svy->Scope == HieLvl_CRS) if (Svy->Level == HieLvl_CRS)
{ {
Gbl.Scope.Default = Svy->Scope; Gbl.Scope.Default = Svy->Level;
Gbl.Scope.Allowed = 1 << HieLvl_CRS; Gbl.Scope.Allowed = 1 << HieLvl_CRS;
ICanEdit = true; ICanEdit = true;
} }
} }
break; break;
case Rol_DEG_ADM: // Degree admins only can edit degree surveys case Rol_DEG_ADM: // Degree admins only can edit degree surveys
if (Svy->Scope == HieLvl_UNK) // Scope not defined if (Svy->Level == HieLvl_UNK) // Scope not defined
Svy->Scope = HieLvl_DEG; Svy->Level = HieLvl_DEG;
if (Svy->Scope == HieLvl_DEG) if (Svy->Level == HieLvl_DEG)
{ {
Gbl.Scope.Default = Svy->Scope; Gbl.Scope.Default = Svy->Level;
Gbl.Scope.Allowed = 1 << HieLvl_DEG; Gbl.Scope.Allowed = 1 << HieLvl_DEG;
ICanEdit = true; ICanEdit = true;
} }
break; break;
case Rol_CTR_ADM: // Center admins only can edit center surveys case Rol_CTR_ADM: // Center admins only can edit center surveys
if (Svy->Scope == HieLvl_UNK) // Scope not defined if (Svy->Level == HieLvl_UNK) // Scope not defined
Svy->Scope = HieLvl_CTR; Svy->Level = HieLvl_CTR;
if (Svy->Scope == HieLvl_CTR) if (Svy->Level == HieLvl_CTR)
{ {
Gbl.Scope.Default = Svy->Scope; Gbl.Scope.Default = Svy->Level;
Gbl.Scope.Allowed = 1 << HieLvl_CTR; Gbl.Scope.Allowed = 1 << HieLvl_CTR;
ICanEdit = true; ICanEdit = true;
} }
break; break;
case Rol_INS_ADM: // Institution admins only can edit institution surveys case Rol_INS_ADM: // Institution admins only can edit institution surveys
if (Svy->Scope == HieLvl_UNK) // Scope not defined if (Svy->Level == HieLvl_UNK) // Scope not defined
Svy->Scope = HieLvl_INS; Svy->Level = HieLvl_INS;
if (Svy->Scope == HieLvl_INS) if (Svy->Level == HieLvl_INS)
{ {
Gbl.Scope.Default = Svy->Scope; Gbl.Scope.Default = Svy->Level;
Gbl.Scope.Allowed = 1 << HieLvl_INS; Gbl.Scope.Allowed = 1 << HieLvl_INS;
ICanEdit = true; ICanEdit = true;
} }
break; break;
case Rol_SYS_ADM:// System admins can edit any survey case Rol_SYS_ADM:// System admins can edit any survey
if (Svy->Scope == HieLvl_UNK) // Scope not defined if (Svy->Level == HieLvl_UNK) // Scope not defined
Svy->Scope = (Gbl.Hierarchy.Level < HieLvl_NUM_LEVELS && Svy->Level = (Gbl.Hierarchy.Level < HieLvl_NUM_LEVELS &&
Gbl.Hierarchy.Level != HieLvl_UNK) ? Gbl.Hierarchy.Level : Gbl.Hierarchy.Level != HieLvl_UNK) ? Gbl.Hierarchy.Level :
HieLvl_SYS; HieLvl_SYS;
Gbl.Scope.Default = Svy->Scope; Gbl.Scope.Default = Svy->Level;
Gbl.Scope.Allowed = 1 << HieLvl_SYS | Gbl.Scope.Allowed = 1 << HieLvl_SYS |
1 << HieLvl_CTY | 1 << HieLvl_CTY |
1 << HieLvl_INS | 1 << HieLvl_INS |
@ -1952,7 +1952,7 @@ void Svy_ReceiveFormSurvey (void)
ItsANewSurvey = ((NewSvy.SvyCod = ParCod_GetPar (ParCod_Svy)) <= 0); ItsANewSurvey = ((NewSvy.SvyCod = ParCod_GetPar (ParCod_Svy)) <= 0);
if (ItsANewSurvey) if (ItsANewSurvey)
NewSvy.Scope = HieLvl_UNK; NewSvy.Level = HieLvl_UNK;
else else
{ {
/* Get data of the old (current) survey from database */ /* Get data of the old (current) survey from database */
@ -1960,7 +1960,7 @@ void Svy_ReceiveFormSurvey (void)
Svy_GetSurveyDataByCod (&OldSvy); Svy_GetSurveyDataByCod (&OldSvy);
if (!OldSvy.Status.ICanEdit) if (!OldSvy.Status.ICanEdit)
Err_NoPermissionExit (); Err_NoPermissionExit ();
NewSvy.Scope = OldSvy.Scope; NewSvy.Level = OldSvy.Level;
} }
/***** Get scope *****/ /***** Get scope *****/
@ -1970,46 +1970,46 @@ void Svy_ReceiveFormSurvey (void)
{ {
case HieLvl_SYS: case HieLvl_SYS:
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
NewSvy.Scope = HieLvl_SYS; NewSvy.Level = HieLvl_SYS;
NewSvy.Cod = -1L; NewSvy.HieCod = -1L;
break; break;
case HieLvl_CTY: case HieLvl_CTY:
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
NewSvy.Scope = HieLvl_CTY; NewSvy.Level = HieLvl_CTY;
NewSvy.Cod = Gbl.Hierarchy.Cty.CtyCod; NewSvy.HieCod = Gbl.Hierarchy.Cty.CtyCod;
break; break;
case HieLvl_INS: case HieLvl_INS:
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM && if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
Gbl.Usrs.Me.Role.Logged != Rol_INS_ADM) Gbl.Usrs.Me.Role.Logged != Rol_INS_ADM)
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
NewSvy.Scope = HieLvl_INS; NewSvy.Level = HieLvl_INS;
NewSvy.Cod = Gbl.Hierarchy.Ins.InsCod; NewSvy.HieCod = Gbl.Hierarchy.Ins.InsCod;
break; break;
case HieLvl_CTR: case HieLvl_CTR:
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM && if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
Gbl.Usrs.Me.Role.Logged != Rol_CTR_ADM) Gbl.Usrs.Me.Role.Logged != Rol_CTR_ADM)
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
NewSvy.Scope = HieLvl_CTR; NewSvy.Level = HieLvl_CTR;
NewSvy.Cod = Gbl.Hierarchy.Ctr.CtrCod; NewSvy.HieCod = Gbl.Hierarchy.Ctr.CtrCod;
break; break;
case HieLvl_DEG: case HieLvl_DEG:
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM && if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
Gbl.Usrs.Me.Role.Logged != Rol_DEG_ADM) Gbl.Usrs.Me.Role.Logged != Rol_DEG_ADM)
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
NewSvy.Scope = HieLvl_DEG; NewSvy.Level = HieLvl_DEG;
NewSvy.Cod = Gbl.Hierarchy.Deg.DegCod; NewSvy.HieCod = Gbl.Hierarchy.Deg.DegCod;
break; break;
case HieLvl_CRS: case HieLvl_CRS:
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM && if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
Gbl.Usrs.Me.Role.Logged != Rol_TCH) Gbl.Usrs.Me.Role.Logged != Rol_TCH)
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
NewSvy.Scope = HieLvl_CRS; NewSvy.Level = HieLvl_CRS;
NewSvy.Cod = Gbl.Hierarchy.Crs.CrsCod; NewSvy.HieCod = Gbl.Hierarchy.Crs.CrsCod;
break; break;
default: default:
Err_WrongScopeExit (); Err_WrongHierarchyLevelExit ();
break; break;
} }
@ -2067,7 +2067,7 @@ void Svy_ReceiveFormSurvey (void)
Svy_ReqCreatOrEditSvy (); Svy_ReqCreatOrEditSvy ();
/***** Notify by email about the new survey *****/ /***** Notify by email about the new survey *****/
if (NewSvy.Scope == HieLvl_CRS) // Notify only the surveys for a course, not for a degree or global if (NewSvy.Level == HieLvl_CRS) // Notify only the surveys for a course, not for a degree or global
if ((NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_SURVEY,NewSvy.SvyCod))) if ((NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_SURVEY,NewSvy.SvyCod)))
Svy_DB_UpdateNumUsrsNotifiedByEMailAboutSurvey (NewSvy.SvyCod,NumUsrsToBeNotifiedByEMail); Svy_DB_UpdateNumUsrsNotifiedByEMailAboutSurvey (NewSvy.SvyCod,NumUsrsToBeNotifiedByEMail);
@ -2200,23 +2200,23 @@ static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Svy_Survey *Svy)
/************* (country, institution, center, degree or course) **************/ /************* (country, institution, center, degree or course) **************/
/*****************************************************************************/ /*****************************************************************************/
void Svy_RemoveSurveys (HieLvl_Level_t Scope,long Cod) void Svy_RemoveSurveys (HieLvl_Level_t Level,long HieCod)
{ {
/***** Remove all users in surveys *****/ /***** Remove all users in surveys *****/
Svy_DB_RemoveUsrsWhoHaveAnsweredSvysIn (Scope,Cod); Svy_DB_RemoveUsrsWhoHaveAnsweredSvysIn (Level,HieCod);
/***** Remove all answers and comments in surveys *****/ /***** Remove all answers and comments in surveys *****/
Svy_DB_RemoveAnswersSvysIn (Scope,Cod); Svy_DB_RemoveAnswersSvysIn (Level,HieCod);
Svy_DB_RemoveCommentsSvysIn (Scope,Cod); Svy_DB_RemoveCommentsSvysIn (Level,HieCod);
/***** Remove all questions in surveys *****/ /***** Remove all questions in surveys *****/
Svy_DB_RemoveQstsSvysIn (Scope,Cod); Svy_DB_RemoveQstsSvysIn (Level,HieCod);
/***** Remove all groups *****/ /***** Remove all groups *****/
Svy_DB_RemoveGrpsSvysIn (Scope,Cod); Svy_DB_RemoveGrpsSvysIn (Level,HieCod);
/***** Remove all surveys *****/ /***** Remove all surveys *****/
Svy_DB_RemoveSvysIn (Scope,Cod); Svy_DB_RemoveSvysIn (Level,HieCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3327,14 +3327,14 @@ static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod)
// Returns the number of surveys for courses // Returns the number of surveys for courses
// in this location (all the platform, current degree or current course) // in this location (all the platform, current degree or current course)
unsigned Svy_GetNumCrsSurveys (HieLvl_Level_t Scope,unsigned *NumNotif) unsigned Svy_GetNumCrsSurveys (HieLvl_Level_t Level,unsigned *NumNotif)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumSurveys; unsigned NumSurveys;
/***** Get number of surveys from database *****/ /***** Get number of surveys from database *****/
if (Svy_DB_GetNumCrsSurveys (&mysql_res,Scope)) if (Svy_DB_GetNumCrsSurveys (&mysql_res,Level))
{ {
/***** Get number of surveys *****/ /***** Get number of surveys *****/
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);

View File

@ -43,8 +43,8 @@
struct Svy_Survey struct Svy_Survey
{ {
long SvyCod; long SvyCod;
HieLvl_Level_t Scope; HieLvl_Level_t Level;
long Cod; // Country, institution, center, degree or course code long HieCod; // Country, institution, center, degree or course code
unsigned Roles; // Example: if survey can be made by students, Roles == (1 << Rol_STD) unsigned Roles; // Example: if survey can be made by students, Roles == (1 << Rol_STD)
long UsrCod; long UsrCod;
char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1]; char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1];
@ -121,7 +121,7 @@ void Svy_ResetSurvey (void);
void Svy_HideSurvey (void); void Svy_HideSurvey (void);
void Svy_UnhideSurvey (void); void Svy_UnhideSurvey (void);
void Svy_ReceiveFormSurvey (void); void Svy_ReceiveFormSurvey (void);
void Svy_RemoveSurveys (HieLvl_Level_t Scope,long Cod); void Svy_RemoveSurveys (HieLvl_Level_t Level,long Cod);
void Svy_ReqEditQuestion (void); void Svy_ReqEditQuestion (void);
void Svy_ReceiveQst (void); void Svy_ReceiveQst (void);
@ -131,7 +131,7 @@ void Svy_RemoveQst (void);
void Svy_ReceiveSurveyAnswers (void); void Svy_ReceiveSurveyAnswers (void);
unsigned Svy_GetNumCrsSurveys (HieLvl_Level_t Scope,unsigned *NumNotif); unsigned Svy_GetNumCrsSurveys (HieLvl_Level_t Level,unsigned *NumNotif);
//-------------------------------- Figures ------------------------------------ //-------------------------------- Figures ------------------------------------
void Svy_GetAndShowSurveysStats (void); void Svy_GetAndShowSurveysStats (void);

Some files were not shown because too many files have changed in this diff Show More