mirror of https://github.com/acanas/swad-core.git
Version 23.23.1: Oct 03, 2023 Removed unused code in user's hierarchy.
This commit is contained in:
parent
c5ebcbd902
commit
f92040dec2
|
@ -1760,58 +1760,6 @@ static void Ctr_FormToGoToMap (struct Hie_Node *Ctr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/***** Get all my centers (those of my courses) and store them in a list *****/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*
|
|
||||||
void Ctr_GetMyCenters (void)
|
|
||||||
{
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumCtr;
|
|
||||||
unsigned NumCtrs;
|
|
||||||
long CtrCod;
|
|
||||||
|
|
||||||
***** If my centers are yet filled, there's nothing to do *****
|
|
||||||
if (!Gbl.Usrs.Me.Hierarchy[Hie_CTR].Filled)
|
|
||||||
{
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTR].Num = 0;
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTR].Nodes = NULL;
|
|
||||||
|
|
||||||
***** Get my centers from database *****
|
|
||||||
NumCtrs = Ctr_DB_GetCtrsFromUsr (&mysql_res,
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,-1L);
|
|
||||||
if (NumCtrs)
|
|
||||||
{
|
|
||||||
if ((Gbl.Usrs.Me.Hierarchy[Hie_CTR].Nodes = malloc (NumCtrs *
|
|
||||||
sizeof (*Gbl.Usrs.Me.Hierarchy[Hie_CTR].Nodes))) == NULL)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
for (NumCtr = 0;
|
|
||||||
NumCtr < NumCtrs;
|
|
||||||
NumCtr++)
|
|
||||||
{
|
|
||||||
* Get next center *
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
* Get center code *
|
|
||||||
if ((CtrCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
|
|
||||||
{
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTR].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_CTR].Num].HieCod = CtrCod;
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTR].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_CTR].Num].MaxRole = Rol_ConvertUnsignedStrToRole (row[1]);
|
|
||||||
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTR].Num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
***** Free structure that stores the query result *****
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
***** Set boolean that indicates that my centers are yet filled *****
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTR].Filled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********************** Check if I belong to a center ***********************/
|
/*********************** Check if I belong to a center ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1821,7 +1769,6 @@ bool Ctr_CheckIfIBelongToCtr (long CtrCod)
|
||||||
unsigned NumMyCtr;
|
unsigned NumMyCtr;
|
||||||
|
|
||||||
/***** Fill the list with the centers I belong to *****/
|
/***** Fill the list with the centers I belong to *****/
|
||||||
// Ctr_GetMyCenters ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CTR);
|
Hie_GetMyHierarchy (Hie_CTR);
|
||||||
|
|
||||||
/***** Check if the center passed as parameter is any of my centers *****/
|
/***** Check if the center passed as parameter is any of my centers *****/
|
||||||
|
|
|
@ -73,7 +73,6 @@ 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);
|
||||||
|
|
||||||
// void Ctr_GetMyCenters (void);
|
|
||||||
bool Ctr_CheckIfIBelongToCtr (long CtrCod);
|
bool Ctr_CheckIfIBelongToCtr (long CtrCod);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -720,14 +720,13 @@ unsigned Ctr_DB_GetCtrsWithCoordsInCurrentIns (MYSQL_RES **mysql_res)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Get the centers of a user from database *******************/
|
/********************** Get my centers from database *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Returns the number of rows of the result
|
// Returns the number of rows of the result
|
||||||
|
|
||||||
unsigned Ctr_DB_GetCtrsFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod)
|
unsigned Ctr_DB_GetMyCtrs (MYSQL_RES **mysql_res,long PrtCod)
|
||||||
{
|
{
|
||||||
/***** Get from database the centers a user belongs to *****/
|
if (PrtCod > 0)
|
||||||
if (HieCod > 0)
|
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not check the centers a user belongs to",
|
DB_QuerySELECT (mysql_res,"can not check the centers a user belongs to",
|
||||||
"SELECT ctr_centers.CtrCod," // row[0]
|
"SELECT ctr_centers.CtrCod," // row[0]
|
||||||
|
@ -743,8 +742,8 @@ unsigned Ctr_DB_GetCtrsFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod)
|
||||||
" AND ctr_centers.InsCod=%ld"
|
" AND ctr_centers.InsCod=%ld"
|
||||||
" GROUP BY ctr_centers.CtrCod"
|
" GROUP BY ctr_centers.CtrCod"
|
||||||
" ORDER BY ctr_centers.ShortName",
|
" ORDER BY ctr_centers.ShortName",
|
||||||
UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
HieCod);
|
PrtCod);
|
||||||
else
|
else
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not check the centers a user belongs to",
|
DB_QuerySELECT (mysql_res,"can not check the centers a user belongs to",
|
||||||
|
@ -760,7 +759,7 @@ unsigned Ctr_DB_GetCtrsFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod)
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" GROUP BY ctr_centers.CtrCod"
|
" GROUP BY ctr_centers.CtrCod"
|
||||||
" ORDER BY ctr_centers.ShortName",
|
" ORDER BY ctr_centers.ShortName",
|
||||||
UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -85,7 +85,7 @@ void Ctr_DB_GetAvgCoordAndZoomInCurrentIns (struct Map_Coordinates *Coord,unsign
|
||||||
unsigned Ctr_DB_GetCtrsWithCoords (MYSQL_RES **mysql_res);
|
unsigned Ctr_DB_GetCtrsWithCoords (MYSQL_RES **mysql_res);
|
||||||
unsigned Ctr_DB_GetCtrsWithCoordsInCurrentIns (MYSQL_RES **mysql_res);
|
unsigned Ctr_DB_GetCtrsWithCoordsInCurrentIns (MYSQL_RES **mysql_res);
|
||||||
|
|
||||||
unsigned Ctr_DB_GetCtrsFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod);
|
unsigned Ctr_DB_GetMyCtrs (MYSQL_RES **mysql_res,long PrtCod);
|
||||||
bool Ctr_DB_CheckIfUsrBelongsToCtr (long UsrCod,long HieCod,
|
bool Ctr_DB_CheckIfUsrBelongsToCtr (long UsrCod,long HieCod,
|
||||||
bool CountOnlyAcceptedCourses);
|
bool CountOnlyAcceptedCourses);
|
||||||
unsigned Ctr_DB_GetNumUsrsWhoClaimToBelongToCtr (long CtrCod);
|
unsigned Ctr_DB_GetNumUsrsWhoClaimToBelongToCtr (long CtrCod);
|
||||||
|
|
|
@ -632,12 +632,13 @@ 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 (2023-10-03)"
|
#define Log_PLATFORM_VERSION "SWAD 23.23.1 (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.23: Oct 03, 2023 Code refactoring un user's hierarchy. (336620 lines)
|
Version 23.23.1: Oct 03, 2023 Removed unused code in user's hierarchy. (336349 lines)
|
||||||
Version 23.22: Oct 03, 2023 Code refactoring un user's hierarchy. (336518 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.21: Oct 03, 2023 User's hierarchy is allocated dinamically. (336598 lines)
|
Version 23.21: Oct 03, 2023 User's hierarchy is allocated dinamically. (336598 lines)
|
||||||
Version 23.20.1: Oct 02, 2023 Fixed minor CSS issue in games and exams. (336576 lines)
|
Version 23.20.1: Oct 02, 2023 Fixed minor CSS issue in games and exams. (336576 lines)
|
||||||
Version 23.20: Sep 29, 2023 Removed button to change between view and edit mode in in file browser. (336571 lines)
|
Version 23.20: Sep 29, 2023 Removed button to change between view and edit mode in in file browser. (336571 lines)
|
||||||
|
|
|
@ -126,7 +126,6 @@ void Cht_ShowListOfAvailableChatRooms (void)
|
||||||
char ThisRoomFullName[Cht_MAX_BYTES_ROOM_FULL_NAME + 1];
|
char ThisRoomFullName[Cht_MAX_BYTES_ROOM_FULL_NAME + 1];
|
||||||
|
|
||||||
/***** Fill the list with the degrees I belong to *****/
|
/***** Fill the list with the degrees I belong to *****/
|
||||||
// Deg_GetMyDegrees ();
|
|
||||||
Hie_GetMyHierarchy (Hie_DEG);
|
Hie_GetMyHierarchy (Hie_DEG);
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
|
@ -407,9 +406,7 @@ void Cht_OpenChatWindow (void)
|
||||||
Err_ShowErrorAndExit ("Wrong code of chat room.");
|
Err_ShowErrorAndExit ("Wrong code of chat room.");
|
||||||
|
|
||||||
/***** Fill the lists with the degrees and courses I belong to *****/
|
/***** Fill the lists with the degrees and courses I belong to *****/
|
||||||
// Deg_GetMyDegrees ();
|
|
||||||
Hie_GetMyHierarchy (Hie_DEG);
|
Hie_GetMyHierarchy (Hie_DEG);
|
||||||
// Enr_GetMyCourses ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CRS);
|
Hie_GetMyHierarchy (Hie_CRS);
|
||||||
|
|
||||||
/***** Build my user's name *****/
|
/***** Build my user's name *****/
|
||||||
|
|
|
@ -1774,57 +1774,6 @@ static void Cty_FormToGoToMap (struct Hie_Node *Cty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**** Get all my countries (those of my courses) and store them in a list ****/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*
|
|
||||||
void Cty_GetMyCountrs (void)
|
|
||||||
{
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumCty;
|
|
||||||
unsigned NumCtys;
|
|
||||||
long CtyCod;
|
|
||||||
|
|
||||||
***** If my countries are yet filled, there's nothing to do *****
|
|
||||||
if (!Gbl.Usrs.Me.Hierarchy[Hie_CTY].Filled)
|
|
||||||
{
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTY].Num = 0;
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTY].Nodes = NULL;
|
|
||||||
|
|
||||||
***** Get my countries from database *****
|
|
||||||
NumCtys = Cty_DB_GetCtysFromUsr (&mysql_res,Gbl.Usrs.Me.UsrDat.UsrCod,-1L);
|
|
||||||
if (NumCtys)
|
|
||||||
{
|
|
||||||
if ((Gbl.Usrs.Me.Hierarchy[Hie_CTY].Nodes = malloc (NumCtys *
|
|
||||||
sizeof (*Gbl.Usrs.Me.Hierarchy[Hie_CTY].Nodes))) == NULL)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
for (NumCty = 0;
|
|
||||||
NumCty < NumCtys;
|
|
||||||
NumCty++)
|
|
||||||
{
|
|
||||||
* Get next country *
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
* Get country code *
|
|
||||||
if ((CtyCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
|
|
||||||
{
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTY].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_CTY].Num].HieCod = CtyCod;
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTY].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_CTY].Num].MaxRole = Rol_ConvertUnsignedStrToRole (row[1]);
|
|
||||||
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTY].Num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
***** Free structure that stores the query result *****
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
***** Set boolean that indicates that my institutions are yet filled *****
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CTY].Filled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************** Check if I belong to a country **********************/
|
/********************** Check if I belong to a country **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1834,7 +1783,6 @@ bool Cty_CheckIfIBelongToCty (long CtyCod)
|
||||||
unsigned NumMyCty;
|
unsigned NumMyCty;
|
||||||
|
|
||||||
/***** Fill the list with the institutions I belong to *****/
|
/***** Fill the list with the institutions I belong to *****/
|
||||||
// Cty_GetMyCountrs ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CTY);
|
Hie_GetMyHierarchy (Hie_CTY);
|
||||||
|
|
||||||
/***** Check if the country passed as parameter is any of my countries *****/
|
/***** Check if the country passed as parameter is any of my countries *****/
|
||||||
|
|
|
@ -84,7 +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);
|
||||||
|
|
||||||
// void Cty_GetMyCountrs (void);
|
|
||||||
bool Cty_CheckIfIBelongToCty (long CtyCod);
|
bool Cty_CheckIfIBelongToCty (long CtyCod);
|
||||||
|
|
||||||
void Cty_FlushCacheNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
void Cty_FlushCacheNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
||||||
|
|
|
@ -595,12 +595,12 @@ void Cty_DB_UpdateCtyMapAttr (const char NewMapAttribution[Med_MAX_BYTES_ATTRIBU
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************** Get the countries of a user from database ******************/
|
/********************* Get my countries from database ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Returns the number of rows of the result
|
// Returns the number of rows of the result
|
||||||
|
|
||||||
unsigned Cty_DB_GetCtysFromUsr (MYSQL_RES **mysql_res,
|
unsigned Cty_DB_GetMyCtys (MYSQL_RES **mysql_res,
|
||||||
long UsrCod,__attribute__((unused)) long HieCod)
|
__attribute__((unused)) long PrtCod)
|
||||||
{
|
{
|
||||||
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ unsigned Cty_DB_GetCtysFromUsr (MYSQL_RES **mysql_res,
|
||||||
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
" GROUP BY cty_countrs.CtyCod"
|
" GROUP BY cty_countrs.CtyCod"
|
||||||
" ORDER BY cty_countrs.Name_%s",
|
" ORDER BY cty_countrs.Name_%s",
|
||||||
UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,8 @@ bool Cty_DB_CheckIfMapIsAvailable (long CtyCod);
|
||||||
void Cty_DB_UpdateCtyField (long CtyCod,const char *FldName,const char *FldValue);
|
void Cty_DB_UpdateCtyField (long CtyCod,const char *FldName,const char *FldValue);
|
||||||
void Cty_DB_UpdateCtyMapAttr (const char NewMapAttribution[Med_MAX_BYTES_ATTRIBUTION + 1]);
|
void Cty_DB_UpdateCtyMapAttr (const char NewMapAttribution[Med_MAX_BYTES_ATTRIBUTION + 1]);
|
||||||
|
|
||||||
unsigned Cty_DB_GetCtysFromUsr (MYSQL_RES **mysql_res,
|
unsigned Cty_DB_GetMyCtys (MYSQL_RES **mysql_res,
|
||||||
long UsrCod,__attribute__((unused)) long HieCod);
|
__attribute__((unused)) long PrtCod);
|
||||||
unsigned Cty_DB_GetNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
unsigned Cty_DB_GetNumUsrsWhoDontClaimToBelongToAnyCty (void);
|
||||||
unsigned Cty_DB_GetNumUsrsWhoClaimToBelongToAnotherCty (void);
|
unsigned Cty_DB_GetNumUsrsWhoClaimToBelongToAnotherCty (void);
|
||||||
unsigned Cty_DB_GetNumUsrsWhoClaimToBelongToCty (long CtyCod);
|
unsigned Cty_DB_GetNumUsrsWhoClaimToBelongToCty (long CtyCod);
|
||||||
|
|
|
@ -199,7 +199,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||||
HTM_LI_End ();
|
HTM_LI_End ();
|
||||||
|
|
||||||
/***** Get my countries *****/
|
/***** Get my countries *****/
|
||||||
NumCtys = Cty_DB_GetCtysFromUsr (&mysql_resCty,Gbl.Usrs.Me.UsrDat.UsrCod,-1L);
|
NumCtys = Cty_DB_GetMyCtys (&mysql_resCty,-1L);
|
||||||
for (NumCty = 0;
|
for (NumCty = 0;
|
||||||
NumCty < NumCtys;
|
NumCty < NumCtys;
|
||||||
NumCty++)
|
NumCty++)
|
||||||
|
@ -231,9 +231,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||||
HTM_LI_End ();
|
HTM_LI_End ();
|
||||||
|
|
||||||
/***** Get my institutions in this country *****/
|
/***** Get my institutions in this country *****/
|
||||||
NumInss = Ins_DB_GetInssFromUsr (&mysql_resIns,
|
NumInss = Ins_DB_GetMyInss (&mysql_resIns,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Hie[Hie_CTY].HieCod);
|
||||||
Hie[Hie_CTY].HieCod);
|
|
||||||
for (NumIns = 0;
|
for (NumIns = 0;
|
||||||
NumIns < NumInss;
|
NumIns < NumInss;
|
||||||
NumIns++)
|
NumIns++)
|
||||||
|
@ -268,9 +267,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||||
HTM_LI_End ();
|
HTM_LI_End ();
|
||||||
|
|
||||||
/***** Get my centers in this institution *****/
|
/***** Get my centers in this institution *****/
|
||||||
NumCtrs = Ctr_DB_GetCtrsFromUsr (&mysql_resCtr,
|
NumCtrs = Ctr_DB_GetMyCtrs (&mysql_resCtr,Hie[Hie_INS].HieCod);
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
Hie[Hie_INS].HieCod);
|
|
||||||
for (NumCtr = 0;
|
for (NumCtr = 0;
|
||||||
NumCtr < NumCtrs;
|
NumCtr < NumCtrs;
|
||||||
NumCtr++)
|
NumCtr++)
|
||||||
|
@ -305,9 +302,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||||
HTM_LI_End ();
|
HTM_LI_End ();
|
||||||
|
|
||||||
/***** Get my degrees in this center *****/
|
/***** Get my degrees in this center *****/
|
||||||
NumDegs = Deg_DB_GetDegsFromUsr (&mysql_resDeg,
|
NumDegs = Deg_DB_GetMyDegs (&mysql_resDeg,Hie[Hie_CTR].HieCod);
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
Hie[Hie_CTR].HieCod);
|
|
||||||
for (NumDeg = 0;
|
for (NumDeg = 0;
|
||||||
NumDeg < NumDegs;
|
NumDeg < NumDegs;
|
||||||
NumDeg++)
|
NumDeg++)
|
||||||
|
@ -575,7 +570,6 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void)
|
||||||
|
|
||||||
/***** Fill the list with the courses I belong to, if not filled *****/
|
/***** Fill the list with the courses I belong to, if not filled *****/
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
// Enr_GetMyCourses ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CRS);
|
Hie_GetMyHierarchy (Hie_CRS);
|
||||||
|
|
||||||
/***** Begin form *****/
|
/***** Begin form *****/
|
||||||
|
@ -1955,7 +1949,6 @@ static void Crs_PutButtonToRegisterInCrs (void)
|
||||||
void Crs_ReqSelectOneOfMyCourses (void)
|
void Crs_ReqSelectOneOfMyCourses (void)
|
||||||
{
|
{
|
||||||
/***** Fill the list with the courses I belong to, if not filled *****/
|
/***** Fill the list with the courses I belong to, if not filled *****/
|
||||||
// Enr_GetMyCourses ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CRS);
|
Hie_GetMyHierarchy (Hie_CRS);
|
||||||
|
|
||||||
/***** Select one of my courses *****/
|
/***** Select one of my courses *****/
|
||||||
|
|
|
@ -1642,58 +1642,6 @@ static void Deg_EditingDegreeDestructor (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/***** Get all my degrees (those of my courses) and store them in a list *****/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*
|
|
||||||
void Deg_GetMyDegrees (void)
|
|
||||||
{
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumDeg;
|
|
||||||
unsigned NumDegs;
|
|
||||||
long DegCod;
|
|
||||||
|
|
||||||
***** If my degrees are yet filled, there's nothing to do *****
|
|
||||||
if (!Gbl.Usrs.Me.Hierarchy[Hie_DEG].Filled)
|
|
||||||
{
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num = 0;
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_DEG].Nodes = NULL;
|
|
||||||
|
|
||||||
***** Get my degrees from database *****
|
|
||||||
NumDegs = Deg_DB_GetDegsFromUsr (&mysql_res,
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,-1L);
|
|
||||||
if (NumDegs)
|
|
||||||
{
|
|
||||||
if ((Gbl.Usrs.Me.Hierarchy[Hie_DEG].Nodes = malloc (NumDegs *
|
|
||||||
sizeof (*Gbl.Usrs.Me.Hierarchy[Hie_DEG].Nodes))) == NULL)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
for (NumDeg = 0;
|
|
||||||
NumDeg < NumDegs;
|
|
||||||
NumDeg++)
|
|
||||||
{
|
|
||||||
* Get next degree *
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
* Get degree code *
|
|
||||||
if ((DegCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
|
|
||||||
{
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_DEG].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num].HieCod = DegCod;
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_DEG].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num].MaxRole = Rol_ConvertUnsignedStrToRole (row[1]);
|
|
||||||
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
***** Free structure that stores the query result *****
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
***** Set boolean that indicates that my degrees are yet filled *****
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_DEG].Filled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********************** Check if I belong to a degree ***********************/
|
/*********************** Check if I belong to a degree ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1703,7 +1651,6 @@ bool Deg_CheckIfIBelongToDeg (long DegCod)
|
||||||
unsigned NumMyDeg;
|
unsigned NumMyDeg;
|
||||||
|
|
||||||
/***** Fill the list with the degrees I belong to *****/
|
/***** Fill the list with the degrees I belong to *****/
|
||||||
// Deg_GetMyDegrees ();
|
|
||||||
Hie_GetMyHierarchy (Hie_DEG);
|
Hie_GetMyHierarchy (Hie_DEG);
|
||||||
|
|
||||||
/***** Check if the degree passed as parameter is any of my degrees *****/
|
/***** Check if the degree passed as parameter is any of my degrees *****/
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
// void Deg_GetMyDegrees (void);
|
|
||||||
bool Deg_CheckIfIBelongToDeg (long DegCod);
|
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],
|
||||||
|
|
|
@ -757,13 +757,13 @@ void Deg_DB_UpdateDegStatus (long DegCod,Hie_Status_t NewStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Get the degrees of a user from database *******************/
|
/********************** Get my degrees from database *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Returns the number of rows of the result
|
// Returns the number of rows of the result
|
||||||
|
|
||||||
unsigned Deg_DB_GetDegsFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod)
|
unsigned Deg_DB_GetMyDegs (MYSQL_RES **mysql_res,long PrtCod)
|
||||||
{
|
{
|
||||||
if (HieCod > 0)
|
if (PrtCod > 0)
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not check the degrees a user belongs to",
|
DB_QuerySELECT (mysql_res,"can not check the degrees a user belongs to",
|
||||||
"SELECT deg_degrees.DegCod," // row[0]
|
"SELECT deg_degrees.DegCod," // row[0]
|
||||||
|
@ -777,8 +777,8 @@ unsigned Deg_DB_GetDegsFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod)
|
||||||
" AND deg_degrees.CtrCod=%ld"
|
" AND deg_degrees.CtrCod=%ld"
|
||||||
" GROUP BY deg_degrees.DegCod"
|
" GROUP BY deg_degrees.DegCod"
|
||||||
" ORDER BY deg_degrees.ShortName",
|
" ORDER BY deg_degrees.ShortName",
|
||||||
UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
HieCod);
|
PrtCod);
|
||||||
else
|
else
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not check the degrees a user belongs to",
|
DB_QuerySELECT (mysql_res,"can not check the degrees a user belongs to",
|
||||||
|
@ -792,7 +792,7 @@ unsigned Deg_DB_GetDegsFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod)
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" GROUP BY deg_degrees.DegCod"
|
" GROUP BY deg_degrees.DegCod"
|
||||||
" ORDER BY deg_degrees.ShortName",
|
" ORDER BY deg_degrees.ShortName",
|
||||||
UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -80,7 +80,7 @@ void Deg_DB_UpdateDegTyp (long DegCod,long NewDegTypCod);
|
||||||
void Deg_DB_UpdateDegWWW (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
void Deg_DB_UpdateDegWWW (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
||||||
void Deg_DB_UpdateDegStatus (long DegCod,Hie_Status_t NewStatus);
|
void Deg_DB_UpdateDegStatus (long DegCod,Hie_Status_t NewStatus);
|
||||||
|
|
||||||
unsigned Deg_DB_GetDegsFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod);
|
unsigned Deg_DB_GetMyDegs (MYSQL_RES **mysql_res,long HieCod);
|
||||||
unsigned Deg_DB_GetUsrMainDeg (MYSQL_RES **mysql_res,long UsrCod);
|
unsigned Deg_DB_GetUsrMainDeg (MYSQL_RES **mysql_res,long UsrCod);
|
||||||
bool Deg_DB_CheckIfUsrBelongsToDeg (long UsrCod,long HieCod,
|
bool Deg_DB_CheckIfUsrBelongsToDeg (long UsrCod,long HieCod,
|
||||||
bool CountOnlyAcceptedCourses);
|
bool CountOnlyAcceptedCourses);
|
||||||
|
|
|
@ -3189,7 +3189,6 @@ static void Enr_EffectivelyRemUsrFromCrs (struct Usr_Data *UsrDat,
|
||||||
|
|
||||||
/* Fill the list with the courses I belong to */
|
/* Fill the list with the courses I belong to */
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Filled = false;
|
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Filled = false;
|
||||||
// Enr_GetMyCourses ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CRS);
|
Hie_GetMyHierarchy (Hie_CRS);
|
||||||
|
|
||||||
/* Set my roles */
|
/* Set my roles */
|
||||||
|
@ -3222,70 +3221,6 @@ static void Enr_EffectivelyRemUsrFromCrs (struct Usr_Data *UsrDat,
|
||||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*************** Get all my courses and store them in a list *****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*
|
|
||||||
void Enr_GetMyCourses (void)
|
|
||||||
{
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumCrss;
|
|
||||||
unsigned NumCrs;
|
|
||||||
long CrsCod;
|
|
||||||
|
|
||||||
***** Trivial check 1: if my courses are already filled, there's nothing to do *****
|
|
||||||
if (Gbl.Usrs.Me.Hierarchy[Hie_CRS].Filled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
***** Trivial check 2: if user's code is not set, don't query database *****
|
|
||||||
if (Gbl.Usrs.Me.UsrDat.UsrCod <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
***** Remove temporary table with my courses *****
|
|
||||||
Enr_DB_DropTmpTableMyCourses ();
|
|
||||||
|
|
||||||
***** Create temporary table with my courses *****
|
|
||||||
Enr_DB_CreateTmpTableMyCourses ();
|
|
||||||
|
|
||||||
***** Get my courses from database *****
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Num = 0;
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Nodes = NULL;
|
|
||||||
|
|
||||||
NumCrss = Enr_DB_GetMyCourses (&mysql_res);
|
|
||||||
if (NumCrss)
|
|
||||||
{
|
|
||||||
if ((Gbl.Usrs.Me.Hierarchy[Hie_CRS].Nodes = malloc (NumCrss *
|
|
||||||
sizeof (*Gbl.Usrs.Me.Hierarchy[Hie_CRS].Nodes))) == NULL)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
for (NumCrs = 0;
|
|
||||||
NumCrs < NumCrss;
|
|
||||||
NumCrs++)
|
|
||||||
{
|
|
||||||
* Get next course *
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
* Get course code (row[0]) *
|
|
||||||
if ((CrsCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
|
|
||||||
{
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_CRS].Num].HieCod = CrsCod;
|
|
||||||
|
|
||||||
* Get role (row[1]) and degree code (row[2]) *
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_CRS].Num].MaxRole = Rol_ConvertUnsignedStrToRole (row[1]);
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_CRS].Num].PrtCod = Str_ConvertStrCodToLongCod (row[2]);
|
|
||||||
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
***** Free structure that stores the query result *****
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
***** Set boolean that indicates that my courses are already filled *****
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Filled = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********************** Check if I belong to a course ***********************/
|
/*********************** Check if I belong to a course ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3295,7 +3230,6 @@ bool Enr_CheckIfIBelongToCrs (long CrsCod)
|
||||||
unsigned NumMyCrs;
|
unsigned NumMyCrs;
|
||||||
|
|
||||||
/***** Fill the list with the courses I belong to *****/
|
/***** Fill the list with the courses I belong to *****/
|
||||||
// Enr_GetMyCourses ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CRS);
|
Hie_GetMyHierarchy (Hie_CRS);
|
||||||
|
|
||||||
/***** Check if the course passed as parameter is any of my courses *****/
|
/***** Check if the course passed as parameter is any of my courses *****/
|
||||||
|
|
|
@ -137,7 +137,6 @@ void Enr_CreateNewUsr2 (void);
|
||||||
void Enr_ModifyUsr1 (void);
|
void Enr_ModifyUsr1 (void);
|
||||||
void Enr_ModifyUsr2 (void);
|
void Enr_ModifyUsr2 (void);
|
||||||
|
|
||||||
// void Enr_GetMyCourses (void);
|
|
||||||
bool Enr_CheckIfIBelongToCrs (long CrsCod);
|
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);
|
||||||
|
|
|
@ -101,9 +101,8 @@ void Enr_DB_CreateTmpTableMyCourses (void)
|
||||||
/************************* Get my courses from database **********************/
|
/************************* Get my courses from database **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
unsigned Enr_DB_GetMyCourses (MYSQL_RES **mysql_res,
|
unsigned Enr_DB_GetMyCrss (MYSQL_RES **mysql_res,
|
||||||
__attribute__((unused)) long UsrCod,
|
__attribute__((unused)) long PrtCod)
|
||||||
__attribute__((unused)) long HieCod)
|
|
||||||
{
|
{
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get which courses you belong to",
|
DB_QuerySELECT (mysql_res,"can not get which courses you belong to",
|
||||||
|
@ -172,7 +171,6 @@ bool Enr_DB_CheckIfUsrBelongsToCrs (long UsrCod,long HieCod,
|
||||||
bool Enr_DB_CheckIfUsrSharesAnyOfMyCrs (long UsrCod)
|
bool Enr_DB_CheckIfUsrSharesAnyOfMyCrs (long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Fill the list with the courses I belong to (if not already filled) *****/
|
/***** Fill the list with the courses I belong to (if not already filled) *****/
|
||||||
// Enr_GetMyCourses ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CRS);
|
Hie_GetMyHierarchy (Hie_CRS);
|
||||||
|
|
||||||
/***** Check if user shares any course with me *****/
|
/***** Check if user shares any course with me *****/
|
||||||
|
@ -203,7 +201,6 @@ bool Enr_DB_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod)
|
||||||
/***** 2. Slow check: Get if user shares any course with me
|
/***** 2. Slow check: Get if user shares any course with me
|
||||||
with a different role, from database *****/
|
with a different role, from database *****/
|
||||||
/* Fill the list with the courses I belong to (if not already filled) */
|
/* Fill the list with the courses I belong to (if not already filled) */
|
||||||
// Enr_GetMyCourses ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CRS);
|
Hie_GetMyHierarchy (Hie_CRS);
|
||||||
|
|
||||||
/* Remove temporary table if exists */
|
/* Remove temporary table if exists */
|
||||||
|
|
|
@ -40,9 +40,8 @@ void Enr_DB_InsertUsrInCurrentCrs (long UsrCod,long CrsCod,Rol_Role_t NewRole,
|
||||||
void Enr_DB_AcceptUsrInCrs (long UsrCod,long CrsCod);
|
void Enr_DB_AcceptUsrInCrs (long UsrCod,long CrsCod);
|
||||||
|
|
||||||
void Enr_DB_CreateTmpTableMyCourses (void);
|
void Enr_DB_CreateTmpTableMyCourses (void);
|
||||||
unsigned Enr_DB_GetMyCourses (MYSQL_RES **mysql_res,
|
unsigned Enr_DB_GetMyCrss (MYSQL_RES **mysql_res,
|
||||||
__attribute__((unused)) long UsrCod,
|
__attribute__((unused)) long PrtCod);
|
||||||
__attribute__((unused)) long HieCod);
|
|
||||||
void Enr_DB_DropTmpTableMyCourses (void);
|
void Enr_DB_DropTmpTableMyCourses (void);
|
||||||
unsigned Enr_DB_GetMyCoursesNames (MYSQL_RES **mysql_res);
|
unsigned Enr_DB_GetMyCoursesNames (MYSQL_RES **mysql_res);
|
||||||
|
|
||||||
|
|
|
@ -1238,7 +1238,6 @@ void For_ShowForumList (struct For_Forums *Forums)
|
||||||
Forums->Thread.ToMove = For_DB_GetThrInMyClipboard ();
|
Forums->Thread.ToMove = For_DB_GetThrInMyClipboard ();
|
||||||
|
|
||||||
/***** Fill the list with the institutions I belong to *****/
|
/***** Fill the list with the institutions I belong to *****/
|
||||||
// Ins_GetMyInstits ();
|
|
||||||
Hie_GetMyHierarchy (Hie_INS);
|
Hie_GetMyHierarchy (Hie_INS);
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
|
@ -1327,9 +1326,7 @@ void For_ShowForumList (struct For_Forums *Forums)
|
||||||
IsLastItemInLevel);
|
IsLastItemInLevel);
|
||||||
|
|
||||||
/* Get my centers in this institution from database */
|
/* Get my centers in this institution from database */
|
||||||
NumCtrs = Ctr_DB_GetCtrsFromUsr (&mysql_resCtr,
|
NumCtrs = Ctr_DB_GetMyCtrs (&mysql_resCtr,InsCod);
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
InsCod);
|
|
||||||
for (NumCtr = 0;
|
for (NumCtr = 0;
|
||||||
NumCtr < NumCtrs;
|
NumCtr < NumCtrs;
|
||||||
NumCtr++)
|
NumCtr++)
|
||||||
|
@ -1345,9 +1342,7 @@ void For_ShowForumList (struct For_Forums *Forums)
|
||||||
IsLastItemInLevel) > 0)
|
IsLastItemInLevel) > 0)
|
||||||
{
|
{
|
||||||
/* Get my degrees in this institution from database */
|
/* Get my degrees in this institution from database */
|
||||||
NumDegs = Deg_DB_GetDegsFromUsr (&mysql_resDeg,
|
NumDegs = Deg_DB_GetMyDegs (&mysql_resDeg,CtrCod);
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
CtrCod);
|
|
||||||
for (NumDeg = 0;
|
for (NumDeg = 0;
|
||||||
NumDeg < NumDegs;
|
NumDeg < NumDegs;
|
||||||
NumDeg++)
|
NumDeg++)
|
||||||
|
|
|
@ -975,13 +975,13 @@ void Hie_GetMyHierarchy (Hie_Level_t Level)
|
||||||
unsigned NumNodes;
|
unsigned NumNodes;
|
||||||
long HieCod;
|
long HieCod;
|
||||||
static unsigned (*GetNodesFromDB[Hie_NUM_LEVELS]) (MYSQL_RES **mysql_res,
|
static unsigned (*GetNodesFromDB[Hie_NUM_LEVELS]) (MYSQL_RES **mysql_res,
|
||||||
long UsrCod,long HieCod) =
|
long PrtCod) =
|
||||||
{
|
{
|
||||||
[Hie_CTY] = Cty_DB_GetCtysFromUsr,
|
[Hie_CTY] = Cty_DB_GetMyCtys,
|
||||||
[Hie_INS] = Ins_DB_GetInssFromUsr,
|
[Hie_INS] = Ins_DB_GetMyInss,
|
||||||
[Hie_CTR] = Ctr_DB_GetCtrsFromUsr,
|
[Hie_CTR] = Ctr_DB_GetMyCtrs,
|
||||||
[Hie_DEG] = Deg_DB_GetDegsFromUsr,
|
[Hie_DEG] = Deg_DB_GetMyDegs,
|
||||||
[Hie_CRS] = Enr_DB_GetMyCourses,
|
[Hie_CRS] = Enr_DB_GetMyCrss,
|
||||||
};
|
};
|
||||||
|
|
||||||
/***** Trivial check 1: if list of nodes is already filled, there's nothing to do *****/
|
/***** Trivial check 1: if list of nodes is already filled, there's nothing to do *****/
|
||||||
|
@ -1004,8 +1004,7 @@ void Hie_GetMyHierarchy (Hie_Level_t Level)
|
||||||
Gbl.Usrs.Me.Hierarchy[Level].Nodes = NULL;
|
Gbl.Usrs.Me.Hierarchy[Level].Nodes = NULL;
|
||||||
|
|
||||||
/***** Get my courses/degrees/centers/institutions/countries from database *****/
|
/***** Get my courses/degrees/centers/institutions/countries from database *****/
|
||||||
NumNodes = GetNodesFromDB[Level] (&mysql_res,Gbl.Usrs.Me.UsrDat.UsrCod,-1L);
|
if ((NumNodes = GetNodesFromDB[Level] (&mysql_res,-1L)))
|
||||||
if (NumNodes)
|
|
||||||
{
|
{
|
||||||
if ((Gbl.Usrs.Me.Hierarchy[Level].Nodes = malloc (NumNodes *
|
if ((Gbl.Usrs.Me.Hierarchy[Level].Nodes = malloc (NumNodes *
|
||||||
sizeof (*Gbl.Usrs.Me.Hierarchy[Level].Nodes))) == NULL)
|
sizeof (*Gbl.Usrs.Me.Hierarchy[Level].Nodes))) == NULL)
|
||||||
|
|
|
@ -1683,59 +1683,6 @@ static void Ins_FormToGoToMap (struct Hie_Node *Ins)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/** Get all my institutions (those of my courses) and store them in a list ***/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*
|
|
||||||
void Ins_GetMyInstits (void)
|
|
||||||
{
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumIns;
|
|
||||||
unsigned NumInss;
|
|
||||||
long InsCod;
|
|
||||||
|
|
||||||
***** If my institutions are yet filled, there's nothing to do *****
|
|
||||||
if (!Gbl.Usrs.Me.Hierarchy[Hie_INS].Filled)
|
|
||||||
{
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_INS].Num = 0;
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_INS].Nodes = NULL;
|
|
||||||
|
|
||||||
***** Get my institutions from database *****
|
|
||||||
NumInss = Ins_DB_GetInssFromUsr (&mysql_res,
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,-1L);
|
|
||||||
if (NumInss)
|
|
||||||
{
|
|
||||||
if ((Gbl.Usrs.Me.Hierarchy[Hie_INS].Nodes = malloc (NumInss *
|
|
||||||
sizeof (*Gbl.Usrs.Me.Hierarchy[Hie_INS].Nodes))) == NULL)
|
|
||||||
Err_NotEnoughMemoryExit ();
|
|
||||||
for (NumIns = 0;
|
|
||||||
NumIns < NumInss;
|
|
||||||
NumIns++)
|
|
||||||
{
|
|
||||||
* Get next institution *
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
* Get institution code *
|
|
||||||
if ((InsCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
|
|
||||||
{
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_INS].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_INS].Num].HieCod = InsCod;
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_INS].Nodes[Gbl.Usrs.Me.Hierarchy[Hie_INS].Num].MaxRole = Rol_ConvertUnsignedStrToRole (row[1]);
|
|
||||||
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_INS].Num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
***** Free structure that stores the query result *****
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
***** Set boolean that indicates that my institutions are yet filled *****
|
|
||||||
Gbl.Usrs.Me.Hierarchy[Hie_INS].Filled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Check if I belong to an institution ********************/
|
/******************** Check if I belong to an institution ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1745,7 +1692,6 @@ bool Ins_CheckIfIBelongToIns (long InsCod)
|
||||||
unsigned NumMyIns;
|
unsigned NumMyIns;
|
||||||
|
|
||||||
/***** Fill the list with the institutions I belong to *****/
|
/***** Fill the list with the institutions I belong to *****/
|
||||||
// Ins_GetMyInstits ();
|
|
||||||
Hie_GetMyHierarchy (Hie_INS);
|
Hie_GetMyHierarchy (Hie_INS);
|
||||||
|
|
||||||
/***** Check if the institution passed as parameter is any of my institutions *****/
|
/***** Check if the institution passed as parameter is any of my institutions *****/
|
||||||
|
|
|
@ -70,7 +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);
|
||||||
|
|
||||||
// void Ins_GetMyInstits (void);
|
|
||||||
bool Ins_CheckIfIBelongToIns (long InsCod);
|
bool Ins_CheckIfIBelongToIns (long InsCod);
|
||||||
|
|
||||||
void Ins_PutParInsCod (void *InsCod);
|
void Ins_PutParInsCod (void *InsCod);
|
||||||
|
|
|
@ -756,13 +756,13 @@ unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************** Get the institutions of a user from database *****************/
|
/******************* Get my institutions from database ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Returns the number of rows of the result
|
// Returns the number of rows of the result
|
||||||
|
|
||||||
unsigned Ins_DB_GetInssFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod)
|
unsigned Ins_DB_GetMyInss (MYSQL_RES **mysql_res,long PrtCod)
|
||||||
{
|
{
|
||||||
if (HieCod > 0)
|
if (PrtCod > 0)
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get the institutions a user belongs to",
|
DB_QuerySELECT (mysql_res,"can not get the institutions a user belongs to",
|
||||||
"SELECT ins_instits.InsCod," // row[0]
|
"SELECT ins_instits.InsCod," // row[0]
|
||||||
|
@ -780,8 +780,8 @@ unsigned Ins_DB_GetInssFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod)
|
||||||
" AND ins_instits.CtyCod=%ld"
|
" AND ins_instits.CtyCod=%ld"
|
||||||
" GROUP BY ins_instits.InsCod"
|
" GROUP BY ins_instits.InsCod"
|
||||||
" ORDER BY ins_instits.ShortName",
|
" ORDER BY ins_instits.ShortName",
|
||||||
UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
HieCod);
|
PrtCod);
|
||||||
else
|
else
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get the institutions a user belongs to",
|
DB_QuerySELECT (mysql_res,"can not get the institutions a user belongs to",
|
||||||
|
@ -799,7 +799,7 @@ unsigned Ins_DB_GetInssFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod)
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" GROUP BY ins_instits.InsCod"
|
" GROUP BY ins_instits.InsCod"
|
||||||
" ORDER BY ins_instits.ShortName",
|
" ORDER BY ins_instits.ShortName",
|
||||||
UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -77,7 +77,7 @@ unsigned Ins_DB_GetNumInssWithCrss (Hie_Level_t Level,long HieCod);
|
||||||
unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role,
|
unsigned Ins_DB_GetNumInnsWithUsrs (Rol_Role_t Role,
|
||||||
Hie_Level_t Level,long HieCod);
|
Hie_Level_t Level,long HieCod);
|
||||||
|
|
||||||
unsigned Ins_DB_GetInssFromUsr (MYSQL_RES **mysql_res,long UsrCod,long HieCod);
|
unsigned Ins_DB_GetMyInss (MYSQL_RES **mysql_res,long HieCod);
|
||||||
bool Ins_DB_CheckIfUsrBelongsToIns (long UsrCod,long HieCod,
|
bool Ins_DB_CheckIfUsrBelongsToIns (long UsrCod,long HieCod,
|
||||||
bool CountOnlyAcceptedCourses);
|
bool CountOnlyAcceptedCourses);
|
||||||
unsigned Ins_DB_GetNumUsrsWhoClaimToBelongToIns (long InsCod);
|
unsigned Ins_DB_GetNumUsrsWhoClaimToBelongToIns (long InsCod);
|
||||||
|
|
|
@ -257,7 +257,6 @@ Rol_Role_t Rol_GetMyMaxRoleInIns (long InsCod)
|
||||||
if (InsCod > 0)
|
if (InsCod > 0)
|
||||||
{
|
{
|
||||||
/***** Fill the list with the institutions I belong to (if not already filled) *****/
|
/***** Fill the list with the institutions I belong to (if not already filled) *****/
|
||||||
// Ins_GetMyInstits ();
|
|
||||||
Hie_GetMyHierarchy (Hie_INS);
|
Hie_GetMyHierarchy (Hie_INS);
|
||||||
|
|
||||||
/***** Check if the institution passed as parameter is any of my institutions *****/
|
/***** Check if the institution passed as parameter is any of my institutions *****/
|
||||||
|
@ -282,7 +281,6 @@ Rol_Role_t Rol_GetMyMaxRoleInCtr (long CtrCod)
|
||||||
if (CtrCod > 0)
|
if (CtrCod > 0)
|
||||||
{
|
{
|
||||||
/***** Fill the list with the centers I belong to (if not already filled) *****/
|
/***** Fill the list with the centers I belong to (if not already filled) *****/
|
||||||
// Ctr_GetMyCenters ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CTR);
|
Hie_GetMyHierarchy (Hie_CTR);
|
||||||
|
|
||||||
/***** Check if the center passed as parameter is any of my centers *****/
|
/***** Check if the center passed as parameter is any of my centers *****/
|
||||||
|
@ -309,7 +307,6 @@ Rol_Role_t Rol_GetMyMaxRoleInDeg (long DegCod)
|
||||||
return Rol_UNK;
|
return Rol_UNK;
|
||||||
|
|
||||||
/***** Fill the list with the degrees I belong to (if not already filled) *****/
|
/***** Fill the list with the degrees I belong to (if not already filled) *****/
|
||||||
// Deg_GetMyDegrees ();
|
|
||||||
Hie_GetMyHierarchy (Hie_DEG);
|
Hie_GetMyHierarchy (Hie_DEG);
|
||||||
|
|
||||||
/***** Check if the degree passed as parameter is any of my degrees *****/
|
/***** Check if the degree passed as parameter is any of my degrees *****/
|
||||||
|
@ -346,7 +343,6 @@ Rol_Role_t Rol_GetMyRoleInCrs (long CrsCod)
|
||||||
|
|
||||||
/***** 3. Slow check: get my role from list of my courses *****/
|
/***** 3. Slow check: get my role from list of my courses *****/
|
||||||
/* Fill the list with the courses I belong to (if not already filled) */
|
/* Fill the list with the courses I belong to (if not already filled) */
|
||||||
// Enr_GetMyCourses ();
|
|
||||||
Hie_GetMyHierarchy (Hie_CRS);
|
Hie_GetMyHierarchy (Hie_CRS);
|
||||||
|
|
||||||
/* Check if the current course is any of my courses */
|
/* Check if the current course is any of my courses */
|
||||||
|
|
Loading…
Reference in New Issue