mirror of
https://github.com/acanas/swad-core.git
synced 2024-05-31 22:05:23 +02:00
Version 23.24: Oct 03, 2023 Code refactoring in user's hierarchy.
This commit is contained in:
parent
f92040dec2
commit
2f5fd84097
|
@ -1760,26 +1760,6 @@ static void Ctr_FormToGoToMap (struct Hie_Node *Ctr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********************** Check if I belong to a center ***********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Ctr_CheckIfIBelongToCtr (long CtrCod)
|
|
||||||
{
|
|
||||||
unsigned NumMyCtr;
|
|
||||||
|
|
||||||
/***** Fill the list with the centers I belong to *****/
|
|
||||||
Hie_GetMyHierarchy (Hie_CTR);
|
|
||||||
|
|
||||||
/***** Check if the center passed as parameter is any of my centers *****/
|
|
||||||
for (NumMyCtr = 0;
|
|
||||||
NumMyCtr < Gbl.Usrs.Me.Hierarchy[Hie_CTR].Num;
|
|
||||||
NumMyCtr++)
|
|
||||||
if (Gbl.Usrs.Me.Hierarchy[Hie_CTR].Nodes[NumMyCtr].HieCod == CtrCod)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Write parameter with code of center ********************/
|
/******************** Write parameter with code of center ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -73,6 +73,4 @@ unsigned Ctr_GetCachedNumCtrsWithUsrs (Rol_Role_t Role);
|
||||||
|
|
||||||
void Ctr_ListCtrsFound (MYSQL_RES **mysql_res,unsigned NumCtrs);
|
void Ctr_ListCtrsFound (MYSQL_RES **mysql_res,unsigned NumCtrs);
|
||||||
|
|
||||||
bool Ctr_CheckIfIBelongToCtr (long CtrCod);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -632,10 +632,11 @@ TODO: Francisco Javier Fern
|
||||||
Me sale este error, no sé si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
|
Me sale este error, no sé si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
|
||||||
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 23.23.1 (2023-10-03)"
|
#define Log_PLATFORM_VERSION "SWAD 23.24 (2023-10-03)"
|
||||||
#define CSS_FILE "swad23.16.1.css"
|
#define CSS_FILE "swad23.16.1.css"
|
||||||
#define JS_FILE "swad22.49.js"
|
#define JS_FILE "swad22.49.js"
|
||||||
/*
|
/*
|
||||||
|
Version 23.24: Oct 03, 2023 Code refactoring in user's hierarchy. (336276 lines)
|
||||||
Version 23.23.1: Oct 03, 2023 Removed unused code in user's hierarchy. (336349 lines)
|
Version 23.23.1: Oct 03, 2023 Removed unused code in user's hierarchy. (336349 lines)
|
||||||
Version 23.23: Oct 03, 2023 Code refactoring in user's hierarchy. (336620 lines)
|
Version 23.23: Oct 03, 2023 Code refactoring in user's hierarchy. (336620 lines)
|
||||||
Version 23.22: Oct 03, 2023 Code refactoring in user's hierarchy. (336518 lines)
|
Version 23.22: Oct 03, 2023 Code refactoring in user's hierarchy. (336518 lines)
|
||||||
|
|
|
@ -1774,26 +1774,6 @@ static void Cty_FormToGoToMap (struct Hie_Node *Cty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********************** Check if I belong to a country **********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Cty_CheckIfIBelongToCty (long CtyCod)
|
|
||||||
{
|
|
||||||
unsigned NumMyCty;
|
|
||||||
|
|
||||||
/***** Fill the list with the institutions I belong to *****/
|
|
||||||
Hie_GetMyHierarchy (Hie_CTY);
|
|
||||||
|
|
||||||
/***** Check if the country passed as parameter is any of my countries *****/
|
|
||||||
for (NumMyCty = 0;
|
|
||||||
NumMyCty < Gbl.Usrs.Me.Hierarchy[Hie_CTY].Num;
|
|
||||||
NumMyCty++)
|
|
||||||
if (Gbl.Usrs.Me.Hierarchy[Hie_CTY].Nodes[NumMyCty].HieCod == CtyCod)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******* Get number of users who don't claim to belong to any country ********/
|
/******* Get number of users who don't claim to belong to any country ********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -84,8 +84,6 @@ unsigned Cty_GetCachedNumCtysWithUsrs (Rol_Role_t Role);
|
||||||
|
|
||||||
void Cty_ListCtysFound (MYSQL_RES **mysql_res,unsigned NumCtys);
|
void Cty_ListCtysFound (MYSQL_RES **mysql_res,unsigned NumCtys);
|
||||||
|
|
||||||
bool Cty_CheckIfIBelongToCty (long CtyCod);
|
|
||||||
|
|
||||||
void Cty_FlushCacheNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
void Cty_FlushCacheNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
||||||
unsigned Cty_GetCachedNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
unsigned Cty_GetCachedNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
||||||
unsigned Cty_GetNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
unsigned Cty_GetNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
||||||
|
|
|
@ -744,8 +744,8 @@ static bool Crs_ListCoursesOfAYearForSeeing (unsigned Year)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this course is one of my courses */
|
/* Check if this course is one of my courses */
|
||||||
BgColor = (Enr_CheckIfIBelongToCrs (Crs->HieCod)) ? "BG_HIGHLIGHT" :
|
BgColor = (Hie_CheckIfIBelongTo (Hie_CRS,Crs->HieCod)) ? "BG_HIGHLIGHT" :
|
||||||
The_GetColorRows ();
|
The_GetColorRows ();
|
||||||
|
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
|
|
@ -1642,26 +1642,6 @@ static void Deg_EditingDegreeDestructor (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********************** Check if I belong to a degree ***********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Deg_CheckIfIBelongToDeg (long DegCod)
|
|
||||||
{
|
|
||||||
unsigned NumMyDeg;
|
|
||||||
|
|
||||||
/***** Fill the list with the degrees I belong to *****/
|
|
||||||
Hie_GetMyHierarchy (Hie_DEG);
|
|
||||||
|
|
||||||
/***** Check if the degree passed as parameter is any of my degrees *****/
|
|
||||||
for (NumMyDeg = 0;
|
|
||||||
NumMyDeg < Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num;
|
|
||||||
NumMyDeg++)
|
|
||||||
if (Gbl.Usrs.Me.Hierarchy[Hie_DEG].Nodes[NumMyDeg].HieCod == DegCod)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********* Get the degree in which a user is enroled in more courses *********/
|
/********* Get the degree in which a user is enroled in more courses *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -83,7 +83,6 @@ unsigned Deg_GetCachedNumDegsWithUsrs (Rol_Role_t Role);
|
||||||
|
|
||||||
void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumCrss);
|
void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumCrss);
|
||||||
|
|
||||||
bool Deg_CheckIfIBelongToDeg (long DegCod);
|
|
||||||
void Deg_GetUsrMainDeg (long UsrCod,
|
void Deg_GetUsrMainDeg (long UsrCod,
|
||||||
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1],
|
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1],
|
||||||
Rol_Role_t *MaxRole);
|
Rol_Role_t *MaxRole);
|
||||||
|
|
|
@ -3221,27 +3221,6 @@ static void Enr_EffectivelyRemUsrFromCrs (struct Usr_Data *UsrDat,
|
||||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********************** Check if I belong to a course ***********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Enr_CheckIfIBelongToCrs (long CrsCod)
|
|
||||||
{
|
|
||||||
unsigned NumMyCrs;
|
|
||||||
|
|
||||||
/***** Fill the list with the courses I belong to *****/
|
|
||||||
Hie_GetMyHierarchy (Hie_CRS);
|
|
||||||
|
|
||||||
/***** Check if the course passed as parameter is any of my courses *****/
|
|
||||||
for (NumMyCrs = 0;
|
|
||||||
NumMyCrs < Gbl.Usrs.Me.Hierarchy[Hie_CRS].Num;
|
|
||||||
NumMyCrs++)
|
|
||||||
if (Gbl.Usrs.Me.Hierarchy[Hie_CRS].Nodes[NumMyCrs].HieCod == CrsCod)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***** Check if user belongs (no matter if he/she has accepted or not) *******/
|
/***** Check if user belongs (no matter if he/she has accepted or not) *******/
|
||||||
/***** to the current course *******/
|
/***** to the current course *******/
|
||||||
|
|
|
@ -137,7 +137,6 @@ void Enr_CreateNewUsr2 (void);
|
||||||
void Enr_ModifyUsr1 (void);
|
void Enr_ModifyUsr1 (void);
|
||||||
void Enr_ModifyUsr2 (void);
|
void Enr_ModifyUsr2 (void);
|
||||||
|
|
||||||
bool Enr_CheckIfIBelongToCrs (long CrsCod);
|
|
||||||
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);
|
||||||
|
|
|
@ -1261,7 +1261,7 @@ void For_ShowForumList (struct For_Forums *Forums)
|
||||||
if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
|
if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
|
||||||
ICanSeeInsForum = true;
|
ICanSeeInsForum = true;
|
||||||
else
|
else
|
||||||
ICanSeeInsForum = Ins_CheckIfIBelongToIns (Gbl.Hierarchy.Node[Hie_INS].HieCod);
|
ICanSeeInsForum = Hie_CheckIfIBelongTo (Hie_INS,Gbl.Hierarchy.Node[Hie_INS].HieCod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ICanSeeInsForum = false;
|
ICanSeeInsForum = false;
|
||||||
|
@ -1274,7 +1274,7 @@ void For_ShowForumList (struct For_Forums *Forums)
|
||||||
if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
|
if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
|
||||||
ICanSeeCtrForum = true;
|
ICanSeeCtrForum = true;
|
||||||
else
|
else
|
||||||
ICanSeeCtrForum = Ctr_CheckIfIBelongToCtr (Gbl.Hierarchy.Node[Hie_CTR].HieCod);
|
ICanSeeCtrForum = Hie_CheckIfIBelongTo (Hie_CTR,Gbl.Hierarchy.Node[Hie_CTR].HieCod);
|
||||||
|
|
||||||
/***** Links to forums of current institution *****/
|
/***** Links to forums of current institution *****/
|
||||||
if (For_WriteLinksToInsForums (Forums,Gbl.Hierarchy.Node[Hie_INS].HieCod,
|
if (For_WriteLinksToInsForums (Forums,Gbl.Hierarchy.Node[Hie_INS].HieCod,
|
||||||
|
@ -1285,7 +1285,7 @@ void For_ShowForumList (struct For_Forums *Forums)
|
||||||
if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
|
if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
|
||||||
ICanSeeDegForum = true;
|
ICanSeeDegForum = true;
|
||||||
else
|
else
|
||||||
ICanSeeDegForum = Deg_CheckIfIBelongToDeg (Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
ICanSeeDegForum = Hie_CheckIfIBelongTo (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
||||||
|
|
||||||
/***** Links to forums of current center *****/
|
/***** Links to forums of current center *****/
|
||||||
if (For_WriteLinksToCtrForums (Forums,
|
if (For_WriteLinksToCtrForums (Forums,
|
||||||
|
|
|
@ -1040,6 +1040,26 @@ void Hie_GetMyHierarchy (Hie_Level_t Level)
|
||||||
Gbl.Usrs.Me.Hierarchy[Level].Filled = true;
|
Gbl.Usrs.Me.Hierarchy[Level].Filled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****** Check if I belong to a course/degree/center/institution/country ******/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
bool Hie_CheckIfIBelongTo (Hie_Level_t Level,long HieCod)
|
||||||
|
{
|
||||||
|
unsigned NumMyNode;
|
||||||
|
|
||||||
|
/***** Fill the list with the centers I belong to *****/
|
||||||
|
Hie_GetMyHierarchy (Level);
|
||||||
|
|
||||||
|
/***** Check if the node passed as parameter is any of my nodes *****/
|
||||||
|
for (NumMyNode = 0;
|
||||||
|
NumMyNode < Gbl.Usrs.Me.Hierarchy[Level].Num;
|
||||||
|
NumMyNode++)
|
||||||
|
if (Gbl.Usrs.Me.Hierarchy[Level].Nodes[NumMyNode].HieCod == HieCod)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Flush cache that stores if a user belongs to a node of the hierarchy ****/
|
/*** Flush cache that stores if a user belongs to a node of the hierarchy ****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -67,6 +67,7 @@ void Hie_FreeList (Hie_Level_t Level);
|
||||||
void Hie_ResetMyHierarchy (void);
|
void Hie_ResetMyHierarchy (void);
|
||||||
void Hie_FreeMyHierarchy (void);
|
void Hie_FreeMyHierarchy (void);
|
||||||
void Hie_GetMyHierarchy (Hie_Level_t Level);
|
void Hie_GetMyHierarchy (Hie_Level_t Level);
|
||||||
|
bool Hie_CheckIfIBelongTo (Hie_Level_t Level,long HieCod);
|
||||||
|
|
||||||
void Hie_FlushCacheUsrBelongsTo (Hie_Level_t Level);
|
void Hie_FlushCacheUsrBelongsTo (Hie_Level_t Level);
|
||||||
bool Hie_CheckIfUsrBelongsTo (Hie_Level_t Level,long UsrCod,long HieCod,
|
bool Hie_CheckIfUsrBelongsTo (Hie_Level_t Level,long UsrCod,long HieCod,
|
||||||
|
|
|
@ -1683,26 +1683,6 @@ static void Ins_FormToGoToMap (struct Hie_Node *Ins)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******************** Check if I belong to an institution ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Ins_CheckIfIBelongToIns (long InsCod)
|
|
||||||
{
|
|
||||||
unsigned NumMyIns;
|
|
||||||
|
|
||||||
/***** Fill the list with the institutions I belong to *****/
|
|
||||||
Hie_GetMyHierarchy (Hie_INS);
|
|
||||||
|
|
||||||
/***** Check if the institution passed as parameter is any of my institutions *****/
|
|
||||||
for (NumMyIns = 0;
|
|
||||||
NumMyIns < Gbl.Usrs.Me.Hierarchy[Hie_INS].Num;
|
|
||||||
NumMyIns++)
|
|
||||||
if (Gbl.Usrs.Me.Hierarchy[Hie_INS].Nodes[NumMyIns].HieCod == InsCod)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Write parameter with code of institution ******************/
|
/***************** Write parameter with code of institution ******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -70,8 +70,6 @@ unsigned Ins_GetCachedNumInssWithUsrs (Rol_Role_t Role);
|
||||||
|
|
||||||
void Ins_ListInssFound (MYSQL_RES **mysql_res,unsigned NumInss);
|
void Ins_ListInssFound (MYSQL_RES **mysql_res,unsigned NumInss);
|
||||||
|
|
||||||
bool Ins_CheckIfIBelongToIns (long InsCod);
|
|
||||||
|
|
||||||
void Ins_PutParInsCod (void *InsCod);
|
void Ins_PutParInsCod (void *InsCod);
|
||||||
|
|
||||||
//-------------------------------- Figures ------------------------------------
|
//-------------------------------- Figures ------------------------------------
|
||||||
|
|
|
@ -143,7 +143,7 @@ void Rol_SetMyRoles (void)
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||||
Gbl.Usrs.Me.IBelongToCurrentDeg = true;
|
Gbl.Usrs.Me.IBelongToCurrentDeg = true;
|
||||||
else
|
else
|
||||||
Gbl.Usrs.Me.IBelongToCurrentDeg = Deg_CheckIfIBelongToDeg (Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
Gbl.Usrs.Me.IBelongToCurrentDeg = Hie_CheckIfIBelongTo (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
|
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
|
||||||
|
@ -154,7 +154,7 @@ void Rol_SetMyRoles (void)
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentDeg)
|
if (Gbl.Usrs.Me.IBelongToCurrentDeg)
|
||||||
Gbl.Usrs.Me.IBelongToCurrentCtr = true;
|
Gbl.Usrs.Me.IBelongToCurrentCtr = true;
|
||||||
else
|
else
|
||||||
Gbl.Usrs.Me.IBelongToCurrentCtr = Ctr_CheckIfIBelongToCtr (Gbl.Hierarchy.Node[Hie_CTR].HieCod);
|
Gbl.Usrs.Me.IBelongToCurrentCtr = Hie_CheckIfIBelongTo (Hie_CTR,Gbl.Hierarchy.Node[Hie_CTR].HieCod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
|
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
|
||||||
|
@ -165,7 +165,7 @@ void Rol_SetMyRoles (void)
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCtr)
|
if (Gbl.Usrs.Me.IBelongToCurrentCtr)
|
||||||
Gbl.Usrs.Me.IBelongToCurrentIns = true;
|
Gbl.Usrs.Me.IBelongToCurrentIns = true;
|
||||||
else
|
else
|
||||||
Gbl.Usrs.Me.IBelongToCurrentIns = Ins_CheckIfIBelongToIns (Gbl.Hierarchy.Node[Hie_INS].HieCod);
|
Gbl.Usrs.Me.IBelongToCurrentIns = Hie_CheckIfIBelongTo (Hie_INS,Gbl.Hierarchy.Node[Hie_INS].HieCod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Gbl.Usrs.Me.IBelongToCurrentIns = false;
|
Gbl.Usrs.Me.IBelongToCurrentIns = false;
|
||||||
|
|
|
@ -965,16 +965,16 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
||||||
// ...but not belonging to the current course *********
|
// ...but not belonging to the current course *********
|
||||||
*ScopesAllowed = 1 << Hie_SYS;
|
*ScopesAllowed = 1 << Hie_SYS;
|
||||||
*HiddenAllowed = 0;
|
*HiddenAllowed = 0;
|
||||||
if (Cty_CheckIfIBelongToCty (Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_CTY,Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_CTY;
|
*ScopesAllowed |= 1 << Hie_CTY;
|
||||||
if (Ins_CheckIfIBelongToIns (Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_INS,Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_INS;
|
*ScopesAllowed |= 1 << Hie_INS;
|
||||||
if (Ctr_CheckIfIBelongToCtr (Gbl.Hierarchy.Node[Hie_CTR].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_CTR,Gbl.Hierarchy.Node[Hie_CTR].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_CTR;
|
*ScopesAllowed |= 1 << Hie_CTR;
|
||||||
if (Deg_CheckIfIBelongToDeg (Gbl.Hierarchy.Node[Hie_DEG].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod))
|
||||||
*ScopesAllowed |= 1 << Hie_DEG;
|
*ScopesAllowed |= 1 << Hie_DEG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -983,16 +983,16 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
||||||
case Rol_STD: // Student in current course **************************
|
case Rol_STD: // Student in current course **************************
|
||||||
*ScopesAllowed = 1 << Hie_SYS;
|
*ScopesAllowed = 1 << Hie_SYS;
|
||||||
*HiddenAllowed = 0;
|
*HiddenAllowed = 0;
|
||||||
if (Cty_CheckIfIBelongToCty (Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_CTY,Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_CTY;
|
*ScopesAllowed |= 1 << Hie_CTY;
|
||||||
if (Ins_CheckIfIBelongToIns (Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_INS,Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_INS;
|
*ScopesAllowed |= 1 << Hie_INS;
|
||||||
if (Ctr_CheckIfIBelongToCtr (Gbl.Hierarchy.Node[Hie_CTR].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_CTR,Gbl.Hierarchy.Node[Hie_CTR].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_CTR;
|
*ScopesAllowed |= 1 << Hie_CTR;
|
||||||
if (Deg_CheckIfIBelongToDeg (Gbl.Hierarchy.Node[Hie_DEG].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_DEG;
|
*ScopesAllowed |= 1 << Hie_DEG;
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||||
|
@ -1006,16 +1006,16 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
||||||
case Rol_TCH: // Teacher in current course **************************
|
case Rol_TCH: // Teacher in current course **************************
|
||||||
*ScopesAllowed = 1 << Hie_SYS;
|
*ScopesAllowed = 1 << Hie_SYS;
|
||||||
*HiddenAllowed = 0;
|
*HiddenAllowed = 0;
|
||||||
if (Cty_CheckIfIBelongToCty (Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_CTY,Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_CTY;
|
*ScopesAllowed |= 1 << Hie_CTY;
|
||||||
if (Ins_CheckIfIBelongToIns (Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_INS,Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_INS;
|
*ScopesAllowed |= 1 << Hie_INS;
|
||||||
if (Ctr_CheckIfIBelongToCtr (Gbl.Hierarchy.Node[Hie_CTR].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_CTR,Gbl.Hierarchy.Node[Hie_CTR].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_CTR;
|
*ScopesAllowed |= 1 << Hie_CTR;
|
||||||
if (Deg_CheckIfIBelongToDeg (Gbl.Hierarchy.Node[Hie_DEG].HieCod))
|
if (Hie_CheckIfIBelongTo (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod))
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << Hie_DEG;
|
*ScopesAllowed |= 1 << Hie_DEG;
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||||
|
@ -1167,28 +1167,22 @@ void Svy_GetSurveyDataByCod (struct Svy_Survey *Svy)
|
||||||
/* Do I belong to valid groups to answer this survey? */
|
/* Do I belong to valid groups to answer this survey? */
|
||||||
switch (Svy->Level)
|
switch (Svy->Level)
|
||||||
{
|
{
|
||||||
case Hie_UNK: // Unknown
|
|
||||||
Err_WrongHierarchyLevelExit ();
|
|
||||||
break;
|
|
||||||
case Hie_SYS: // System
|
case Hie_SYS: // System
|
||||||
Svy->Status.IBelongToScope = Gbl.Usrs.Me.Logged;
|
Svy->Status.IBelongToScope = Gbl.Usrs.Me.Logged;
|
||||||
break;
|
break;
|
||||||
case Hie_CTY: // Country
|
case Hie_CTY: // Country
|
||||||
Svy->Status.IBelongToScope = Cty_CheckIfIBelongToCty (Svy->HieCod);
|
|
||||||
break;
|
|
||||||
case Hie_INS: // Institution
|
case Hie_INS: // Institution
|
||||||
Svy->Status.IBelongToScope = Ins_CheckIfIBelongToIns (Svy->HieCod);
|
|
||||||
break;
|
|
||||||
case Hie_CTR: // Center
|
case Hie_CTR: // Center
|
||||||
Svy->Status.IBelongToScope = Ctr_CheckIfIBelongToCtr (Svy->HieCod);
|
|
||||||
break;
|
|
||||||
case Hie_DEG: // Degree
|
case Hie_DEG: // Degree
|
||||||
Svy->Status.IBelongToScope = Deg_CheckIfIBelongToDeg (Svy->HieCod);
|
Svy->Status.IBelongToScope = Hie_CheckIfIBelongTo (Svy->Level,Svy->HieCod);
|
||||||
break;
|
break;
|
||||||
case Hie_CRS: // Course
|
case Hie_CRS: // Course
|
||||||
Svy->Status.IBelongToScope = Enr_CheckIfIBelongToCrs (Svy->HieCod) &&
|
Svy->Status.IBelongToScope = Hie_CheckIfIBelongTo (Svy->Level,Svy->HieCod) &&
|
||||||
Svy_DB_CheckIfICanDoThisSurveyBasedOnGrps (Svy->SvyCod);
|
Svy_DB_CheckIfICanDoThisSurveyBasedOnGrps (Svy->SvyCod);
|
||||||
break;
|
break;
|
||||||
|
default: // Unknown
|
||||||
|
Err_WrongHierarchyLevelExit ();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Have I answered this survey? */
|
/* Have I answered this survey? */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user