diff --git a/sql/cambios.sql b/sql/cambios.sql
index 59f4c59ab..4fba0a084 100644
--- a/sql/cambios.sql
+++ b/sql/cambios.sql
@@ -13105,6 +13105,6 @@ SELECT MIN(QstInd) FROM gam_questions WHERE GamCod=47 AND QstInd>5;
-
+SELECT NotifyEvent,FromUsrCod,InsCod,CtrCod,DegCod,CrsCod,Cod,UNIX_TIMESTAMP(TimeNotif),Status FROM notif WHERE ToUsrCod=1346 ORDER BY TimeNotif DESC;
\ No newline at end of file
diff --git a/swad_API.c b/swad_API.c
index 5184bd38f..5c6cc20ce 100644
--- a/swad_API.c
+++ b/swad_API.c
@@ -1032,7 +1032,7 @@ int swad__loginBySessionKey (struct soap *soap,
/***** Get course (row[2]) *****/
Gbl.Hierarchy.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[2]);
- Crs_GetDataOfCourseByCod (&Gbl.Hierarchy.Crs);
+ Crs_GetDataOfCourseByCod (&Gbl.Hierarchy.Crs,Crs_GET_BASIC_DATA);
loginBySessionKeyOut->courseCode = (int) Gbl.Hierarchy.Crs.CrsCod;
Str_Copy (loginBySessionKeyOut->courseName,Gbl.Hierarchy.Crs.FullName,
Hie_MAX_BYTES_FULL_NAME);
@@ -1043,7 +1043,7 @@ int swad__loginBySessionKey (struct soap *soap,
/***** Get degree (row[1]) *****/
Gbl.Hierarchy.Deg.DegCod = Str_ConvertStrCodToLongCod (row[1]);
- Deg_GetDataOfDegreeByCod (&Gbl.Hierarchy.Deg);
+ Deg_GetDataOfDegreeByCod (&Gbl.Hierarchy.Deg,Deg_GET_BASIC_DATA);
loginBySessionKeyOut->degreeCode = (int) Gbl.Hierarchy.Deg.DegCod;
Str_Copy (loginBySessionKeyOut->degreeName,Gbl.Hierarchy.Deg.FullName,
Hie_MAX_BYTES_FULL_NAME);
@@ -2998,7 +2998,7 @@ int swad__getNotifications (struct soap *soap,
getNotificationsOut->notificationsArray.__ptr[NumNotif].notifCode = (int) NtfCod;
/* Get notification event type (row[1]) */
- NotifyEvent = Ntf_GetNotifyEventFromDB ((const char *) row[1]);
+ NotifyEvent = Ntf_GetNotifyEventFromStr ((const char *) row[1]);
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType =
(char *) soap_malloc (Gbl.soap,Ntf_MAX_BYTES_NOTIFY_EVENT + 1);
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType,
@@ -3013,7 +3013,7 @@ int swad__getNotifications (struct soap *soap,
/* Get course (row[7]) */
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[7]);
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
/* Get user's code of the user who caused the event (row[3]) */
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[3]);
@@ -3066,11 +3066,11 @@ int swad__getNotifications (struct soap *soap,
/* Get centre (row[5]) */
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[5]);
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
/* Get degree (row[6]) */
Deg.DegCod = Str_ConvertStrCodToLongCod (row[6]);
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
/* Get message/post/... code (row[8]) */
Cod = Str_ConvertStrCodToLongCod (row[8]);
diff --git a/swad_centre.c b/swad_centre.c
index a44f2ef1d..81866c146 100644
--- a/swad_centre.c
+++ b/swad_centre.c
@@ -203,7 +203,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
Gbl.ColorRows[Gbl.RowEvenOdd];
/* Get data of centre */
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
/* Centre logo and full name */
HTM_TR_Begin (NULL);
@@ -1155,7 +1155,8 @@ void Ctr_GetListCentres (long InsCod)
/************************ Get data of centre by code *************************/
/*****************************************************************************/
-bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
+bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr,
+ Ctr_GetExtraData_t GetExtraData)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@@ -1233,14 +1234,18 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
if (sscanf (row[7],"%u",&Ctr->NumUsrsWhoClaimToBelongToCtr) != 1)
Ctr->NumUsrsWhoClaimToBelongToCtr = 0;
- /* Get number of degrees in this centre */
- Ctr->Degs.Num = Deg_GetNumDegsInCtr (Ctr->CtrCod);
+ /* Get extra data */
+ if (GetExtraData == Ctr_GET_EXTRA_DATA)
+ {
+ /* Get number of degrees in this centre */
+ Ctr->Degs.Num = Deg_GetNumDegsInCtr (Ctr->CtrCod);
- /* Get number of courses in this centre */
- Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod);
+ /* Get number of courses in this centre */
+ Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod);
- /* Get number of users in courses of this centre */
- Ctr->NumUsrs = Usr_GetNumUsrsInCrssOfCtr (Rol_UNK,Ctr->CtrCod); // Here Rol_UNK means "all users"
+ /* Get number of users in courses of this centre */
+ Ctr->NumUsrs = Usr_GetNumUsrsInCrssOfCtr (Rol_UNK,Ctr->CtrCod); // Here Rol_UNK means "all users"
+ }
/* Set return value */
CtrFound = true;
@@ -1742,7 +1747,7 @@ void Ctr_RemoveCentre (void)
Ctr_EditingCtr->CtrCod = Ctr_GetAndCheckParamOtherCtrCod (1);
/***** Get data of the centre from database *****/
- Ctr_GetDataOfCentreByCod (Ctr_EditingCtr);
+ Ctr_GetDataOfCentreByCod (Ctr_EditingCtr,Ctr_GET_EXTRA_DATA);
/***** Check if this centre has teachers *****/
if (Ctr_EditingCtr->Degs.Num ||
@@ -1883,7 +1888,7 @@ void Ctr_ChangeCtrPlc (void)
NewPlcCod = Plc_GetParamPlcCod ();
/***** Get data of centre from database *****/
- Ctr_GetDataOfCentreByCod (Ctr_EditingCtr);
+ Ctr_GetDataOfCentreByCod (Ctr_EditingCtr,Ctr_GET_BASIC_DATA);
/***** Update place in table of centres *****/
Ctr_UpdateCtrPlcDB (Ctr_EditingCtr->CtrCod,NewPlcCod);
@@ -2000,7 +2005,7 @@ static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFull
Par_GetParToText (ParamName,NewCtrName,MaxBytes);
/***** Get from the database the old names of the centre *****/
- Ctr_GetDataOfCentreByCod (Ctr);
+ Ctr_GetDataOfCentreByCod (Ctr,Ctr_GET_BASIC_DATA);
/***** Check if new name is empty *****/
if (!NewCtrName[0])
@@ -2086,7 +2091,7 @@ void Ctr_ChangeCtrWWW (void)
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Get data of centre *****/
- Ctr_GetDataOfCentreByCod (Ctr_EditingCtr);
+ Ctr_GetDataOfCentreByCod (Ctr_EditingCtr,Ctr_GET_BASIC_DATA);
/***** Check if new WWW is empty *****/
if (NewWWW[0])
@@ -2177,7 +2182,7 @@ void Ctr_ChangeCtrStatus (void)
Status = Ctr_GetStatusBitsFromStatusTxt (StatusTxt); // New status
/***** Get data of centre *****/
- Ctr_GetDataOfCentreByCod (Ctr_EditingCtr);
+ Ctr_GetDataOfCentreByCod (Ctr_EditingCtr,Ctr_GET_BASIC_DATA);
/***** Update status in table of centres *****/
DB_QueryUPDATE ("can not update the status of a centre",
@@ -2905,7 +2910,7 @@ void Ctr_ListCtrsFound (MYSQL_RES **mysql_res,unsigned NumCtrs)
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get data of centre */
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_EXTRA_DATA);
/* Write data of this centre */
Ctr_ListOneCentreForSeeing (&Ctr,NumCtr);
diff --git a/swad_centre.h b/swad_centre.h
index 7dc3578b9..414bd19d5 100644
--- a/swad_centre.h
+++ b/swad_centre.h
@@ -83,6 +83,12 @@ typedef enum
} Ctr_Order_t;
#define Ctr_ORDER_DEFAULT Ctr_ORDER_BY_CENTRE
+typedef enum
+ {
+ Ctr_GET_BASIC_DATA,
+ Ctr_GET_EXTRA_DATA,
+ } Ctr_GetExtraData_t;
+
/*****************************************************************************/
/****************************** Public prototypes ****************************/
/*****************************************************************************/
@@ -101,7 +107,8 @@ void Ctr_EditCentres (void);
void Ctr_PutIconToViewCentres (void);
void Ctr_GetListCentres (long InsCod);
-bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr);
+bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr,
+ Ctr_GetExtraData_t GetExtraData);
long Ctr_GetInsCodOfCentreByCod (long CtrCod);
void Ctr_GetShortNameOfCentreByCod (struct Centre *Ctr);
void Ctr_FreeListCentres (void);
diff --git a/swad_changelog.h b/swad_changelog.h
index 508f4c11c..1446fdad9 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -490,13 +490,15 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 19.93.3 (2019-12-16)"
+#define Log_PLATFORM_VERSION "SWAD 19.94 (2019-12-17)"
#define CSS_FILE "swad19.90.1.css"
#define JS_FILE "swad19.91.1.js"
/*
// TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.)
// TODO: Impedir la creación y edición de proyectos si no son editables.
+ Version 19.94: Dec 17, 2019 Code optimization getting time to generate page.
+ Code optimizations getting data of courses, degrees and centres. (? lines)
Version 19.93.3: Dec 16, 2019 Fixed minor bugs. (249132 lines)
Version 19.93.2: Dec 16, 2019 Code refactoring. (249130 lines)
Version 19.93.1: Dec 15, 2019 Code refactoring. (249122 lines)
diff --git a/swad_chat.c b/swad_chat.c
index edca6cf88..e203d3720 100644
--- a/swad_chat.c
+++ b/swad_chat.c
@@ -175,7 +175,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
{
/* Get data of this degree */
Deg.DegCod = Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod;
- if (!Deg_GetDataOfDegreeByCod (&Deg))
+ if (!Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Degree not found.");
/* Link to the room of this degree */
@@ -206,7 +206,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
if ((Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
{
/* Get data of this course */
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
/* Link to the room of this course */
IsLastItemInLevel[2] = (NumRow == NumRows - 1);
@@ -521,7 +521,7 @@ void Cht_OpenChatWindow (void)
/* Get data of this degree */
Deg.DegCod = Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod;
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
snprintf (ThisRoomShortName,sizeof (ThisRoomShortName),
"%s",
@@ -557,7 +557,7 @@ void Cht_OpenChatWindow (void)
/* Get data of this course */
Crs.CrsCod = Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (ThisRoomShortName,sizeof (ThisRoomShortName),
"%s",
diff --git a/swad_course.c b/swad_course.c
index 9b5a7169e..26b23d313 100644
--- a/swad_course.c
+++ b/swad_course.c
@@ -656,7 +656,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Get data of this centre *****/
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[0]);
- if (!Ctr_GetDataOfCentreByCod (&Ctr))
+ if (!Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Centre not found.");
/***** Write link to centre *****/
@@ -690,7 +690,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Get data of this degree *****/
Deg.DegCod = Str_ConvertStrCodToLongCod (row[0]);
- if (!Deg_GetDataOfDegreeByCod (&Deg))
+ if (!Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Degree not found.");
/***** Write link to degree *****/
@@ -724,7 +724,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Get data of this course *****/
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]);
- if (!Crs_GetDataOfCourseByCod (&Crs))
+ if (!Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Course not found.");
/***** Write link to course *****/
@@ -1009,6 +1009,14 @@ static void Crs_GetListCoursesInCurrentDegree (Crs_WhatCourses_t WhatCourses)
/* Get next course */
row = mysql_fetch_row (mysql_res);
Crs_GetDataOfCourseFromRow (Crs,row);
+
+ /* Get number of users in this course */
+ Crs->NumUsrs[Rol_STD] = Usr_GetNumUsrsInCrs (Rol_STD,Crs->CrsCod);
+ Crs->NumUsrs[Rol_NET] = Usr_GetNumUsrsInCrs (Rol_NET,Crs->CrsCod);
+ Crs->NumUsrs[Rol_TCH] = Usr_GetNumUsrsInCrs (Rol_TCH,Crs->CrsCod);
+ Crs->NumUsrs[Rol_UNK] = Crs->NumUsrs[Rol_STD] +
+ Crs->NumUsrs[Rol_NET] +
+ Crs->NumUsrs[Rol_TCH];
}
}
@@ -1570,8 +1578,8 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
static bool Crs_CheckIfICanEdit (struct Course *Crs)
{
return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM || // I am a degree administrator or higher
- ((Crs->Status & Crs_STATUS_BIT_PENDING) != 0 && // Course is not yet activated
- Gbl.Usrs.Me.UsrDat.UsrCod == Crs->RequesterUsrCod)); // I am the requester
+ ((Crs->Status & Crs_STATUS_BIT_PENDING) != 0 && // Course is not yet activated
+ Gbl.Usrs.Me.UsrDat.UsrCod == Crs->RequesterUsrCod)); // I am the requester
}
/*****************************************************************************/
@@ -1806,17 +1814,16 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status)
extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course;
extern const char *Txt_The_year_X_is_not_allowed;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
- struct Degree Deg;
/***** Get parameters from form *****/
/* Set course degree */
- Deg.DegCod = Crs_EditingCrs->DegCod = Gbl.Hierarchy.Deg.DegCod;
+ // Deg.DegCod =
+ Crs_EditingCrs->DegCod = Gbl.Hierarchy.Deg.DegCod;
/* Get parameters of the new course */
Crs_GetParamsNewCourse (Crs_EditingCrs);
/***** Check if year is correct *****/
- Deg_GetDataOfDegreeByCod (&Deg);
if (Crs_EditingCrs->Year <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
{
if (Crs_EditingCrs->ShrtName[0] &&
@@ -1913,7 +1920,7 @@ void Crs_RemoveCourse (void)
Crs_EditingCrs->CrsCod = Crs_GetAndCheckParamOtherCrsCod (1);
/***** Get data of the course from database *****/
- Crs_GetDataOfCourseByCod (Crs_EditingCrs);
+ Crs_GetDataOfCourseByCod (Crs_EditingCrs,Crs_GET_EXTRA_DATA);
if (Crs_CheckIfICanEdit (Crs_EditingCrs))
{
@@ -1940,7 +1947,8 @@ void Crs_RemoveCourse (void)
/********************* Get data of a course from its code ********************/
/*****************************************************************************/
-bool Crs_GetDataOfCourseByCod (struct Course *Crs)
+bool Crs_GetDataOfCourseByCod (struct Course *Crs,
+ Crs_GetExtraData_t GetExtraData)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@@ -1971,6 +1979,18 @@ bool Crs_GetDataOfCourseByCod (struct Course *Crs)
row = mysql_fetch_row (mysql_res);
Crs_GetDataOfCourseFromRow (Crs,row);
+ /* Get extra data */
+ if (GetExtraData == Crs_GET_EXTRA_DATA)
+ {
+ /* Get number of users in this course */
+ Crs->NumUsrs[Rol_STD] = Usr_GetNumUsrsInCrs (Rol_STD,Crs->CrsCod);
+ Crs->NumUsrs[Rol_NET] = Usr_GetNumUsrsInCrs (Rol_NET,Crs->CrsCod);
+ Crs->NumUsrs[Rol_TCH] = Usr_GetNumUsrsInCrs (Rol_TCH,Crs->CrsCod);
+ Crs->NumUsrs[Rol_UNK] = Crs->NumUsrs[Rol_STD] +
+ Crs->NumUsrs[Rol_NET] +
+ Crs->NumUsrs[Rol_TCH];
+ }
+
/* Set return value */
CrsFound = true;
}
@@ -2016,14 +2036,6 @@ static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row)
/***** Get the full name of the course (row[7]) *****/
Str_Copy (Crs->FullName,row[7],
Hie_MAX_BYTES_FULL_NAME);
-
- /***** Get number of users *****/
- Crs->NumUsrs[Rol_STD] = Usr_GetNumUsrsInCrs (Rol_STD,Crs->CrsCod);
- Crs->NumUsrs[Rol_NET] = Usr_GetNumUsrsInCrs (Rol_NET,Crs->CrsCod);
- Crs->NumUsrs[Rol_TCH] = Usr_GetNumUsrsInCrs (Rol_TCH,Crs->CrsCod);
- Crs->NumUsrs[Rol_UNK] = Crs->NumUsrs[Rol_STD] +
- Crs->NumUsrs[Rol_NET] +
- Crs->NumUsrs[Rol_TCH];
}
/*****************************************************************************/
@@ -2101,7 +2113,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
{
/***** Get course data *****/
Crs.CrsCod = CrsCod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_EXTRA_DATA);
/***** Remove all the students in the course *****/
Enr_RemAllStdsInCrs (&Crs);
@@ -2286,7 +2298,7 @@ void Crs_ChangeInsCrsCod (void)
Par_GetParToText ("InsCrsCod",NewInstitutionalCrsCod,Crs_MAX_BYTES_INSTITUTIONAL_CRS_COD);
/* Get data of the course */
- Crs_GetDataOfCourseByCod (Crs_EditingCrs);
+ Crs_GetDataOfCourseByCod (Crs_EditingCrs,Crs_GET_BASIC_DATA);
if (Crs_CheckIfICanEdit (Crs_EditingCrs))
{
@@ -2326,7 +2338,7 @@ void Crs_ChangeCrsDegInConfig (void)
if (NewDeg.DegCod != Gbl.Hierarchy.Crs.DegCod)
{
/***** Get data of new degree *****/
- Deg_GetDataOfDegreeByCod (&NewDeg);
+ Deg_GetDataOfDegreeByCod (&NewDeg,Deg_GET_BASIC_DATA);
/***** If name of course was in database in the new degree... *****/
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Crs.ShrtName,-1L,
@@ -2446,7 +2458,6 @@ void Crs_ChangeCrsYear (void)
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_The_year_of_the_course_X_has_changed;
extern const char *Txt_The_year_X_is_not_allowed;
- struct Degree Deg;
char YearStr[2 + 1];
unsigned NewYear;
@@ -2461,13 +2472,10 @@ void Crs_ChangeCrsYear (void)
Par_GetParToText ("OthCrsYear",YearStr,2);
NewYear = Deg_ConvStrToYear (YearStr);
- Crs_GetDataOfCourseByCod (Crs_EditingCrs);
+ Crs_GetDataOfCourseByCod (Crs_EditingCrs,Crs_GET_BASIC_DATA);
if (Crs_CheckIfICanEdit (Crs_EditingCrs))
{
- Deg.DegCod = Crs_EditingCrs->DegCod;
- Deg_GetDataOfDegreeByCod (&Deg);
-
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
{
/***** If name of course was in database in the new year... *****/
@@ -2610,7 +2618,7 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
Par_GetParToText (ParamName,NewCrsName,MaxBytes);
/***** Get from the database the data of the degree *****/
- Crs_GetDataOfCourseByCod (Crs);
+ Crs_GetDataOfCourseByCod (Crs,Crs_GET_BASIC_DATA);
if (Crs_CheckIfICanEdit (Crs))
{
@@ -2713,7 +2721,7 @@ void Crs_ChangeCrsStatus (void)
Status = Crs_GetStatusBitsFromStatusTxt (StatusTxt); // New status
/***** Get data of course *****/
- Crs_GetDataOfCourseByCod (Crs_EditingCrs);
+ Crs_GetDataOfCourseByCod (Crs_EditingCrs,Crs_GET_BASIC_DATA);
/***** Update status in table of courses *****/
DB_QueryUPDATE ("can not update the status of a course",
@@ -3129,7 +3137,7 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
/***** Get degree code (row[0]) *****/
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
Lay_ShowErrorAndExit ("Wrong code of degree.");
- if (!Deg_GetDataOfDegreeByCod (&Deg))
+ if (!Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Degree not found.");
/***** Get course code (row[1]) *****/
diff --git a/swad_course.h b/swad_course.h
index 7ba1a91d3..57080d0fc 100644
--- a/swad_course.h
+++ b/swad_course.h
@@ -88,6 +88,12 @@ struct Course
unsigned NumUsrs[Rol_NUM_ROLES]; // Number of users
};
+typedef enum
+ {
+ Crs_GET_BASIC_DATA,
+ Crs_GET_EXTRA_DATA,
+ } Crs_GetExtraData_t;
+
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
@@ -114,7 +120,8 @@ void Crs_RecFormReqCrs (void);
void Crs_RecFormNewCrs (void);
void Crs_RemoveCourse (void);
-bool Crs_GetDataOfCourseByCod (struct Course *Crs);
+bool Crs_GetDataOfCourseByCod (struct Course *Crs,
+ Crs_GetExtraData_t GetExtraData);
void Crs_RemoveCourseCompletely (long CrsCod);
void Crs_ChangeInsCrsCodInConfig (void);
void Crs_ChangeInsCrsCod (void);
diff --git a/swad_degree.c b/swad_degree.c
index 9b1f9c52e..dd9a5686e 100644
--- a/swad_degree.c
+++ b/swad_degree.c
@@ -206,7 +206,7 @@ void Deg_SeeDegWithPendingCrss (void)
Gbl.ColorRows[Gbl.RowEvenOdd];
/* Get data of degree */
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
HTM_TR_Begin (NULL);
@@ -1194,10 +1194,6 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg)
const char *TxtClassStrong;
const char *BgColor;
Deg_StatusTxt_t StatusTxt;
- unsigned NumCrss;
-
- /***** Get number of courses in this degree *****/
- NumCrss = Crs_GetNumCrssInDeg (Deg->DegCod);
/***** Get data of type of degree of this degree *****/
DegTyp.DegTypCod = Deg->DegTypCod;
@@ -1222,10 +1218,10 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg)
/***** Put tip if degree has courses *****/
HTM_TD_Begin ("class=\"%s CM %s\" title=\"%s\"",
TxtClassNormal,BgColor,
- NumCrss ? Txt_DEGREE_With_courses :
- Txt_DEGREE_Without_courses);
- HTM_Txt (NumCrss ? "✓" :
- " ");
+ Deg->Crss.Num ? Txt_DEGREE_With_courses :
+ Txt_DEGREE_Without_courses);
+ HTM_Txt (Deg->Crss.Num ? "✓" :
+ " ");
HTM_TD_End ();
/***** Number of degree in this list *****/
@@ -1246,7 +1242,7 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg)
/***** Current number of courses in this degree *****/
HTM_TD_Begin ("class=\"%s RM %s\"",TxtClassNormal,BgColor);
- HTM_Unsigned (NumCrss);
+ HTM_Unsigned (Deg->Crss.Num);
HTM_TD_End ();
/***** Degree status *****/
@@ -1429,7 +1425,7 @@ void Deg_GetListDegsOfCurrentCtr (void)
/***** Create list with degrees of this centre *****/
if ((Gbl.Hierarchy.Ctr.Degs.Lst = (struct Degree *) calloc (Gbl.Hierarchy.Ctr.Degs.Num,
- sizeof (struct Degree))) == NULL)
+ sizeof (struct Degree))) == NULL)
Lay_NotEnoughMemoryExit ();
/***** Get the degrees of this centre *****/
@@ -1565,10 +1561,10 @@ void Deg_RemoveDegree (void)
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1);
/***** Get data of degree *****/
- Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
+ Deg_GetDataOfDegreeByCod (Deg_EditingDeg,Deg_GET_EXTRA_DATA);
/***** Check if this degree has courses *****/
- if (Crs_GetNumCrssInDeg (Deg_EditingDeg->DegCod)) // Degree has courses ==> don't remove
+ if (Deg_EditingDeg->Crss.Num) // Degree has courses ==> don't remove
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree);
else // Degree has no courses ==> remove it
@@ -1623,7 +1619,8 @@ long Deg_GetAndCheckParamOtherDegCod (long MinCodAllowed)
/*****************************************************************************/
// Returns true if degree found
-bool Deg_GetDataOfDegreeByCod (struct Degree *Deg)
+bool Deg_GetDataOfDegreeByCod (struct Degree *Deg,
+ Deg_GetExtraData_t GetExtraData)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@@ -1653,6 +1650,11 @@ bool Deg_GetDataOfDegreeByCod (struct Degree *Deg)
row = mysql_fetch_row (mysql_res);
Deg_GetDataOfDegreeFromRow (Deg,row);
+ /* Get extra data */
+ if (GetExtraData == Deg_GET_EXTRA_DATA)
+ /* Get number of courses in this degree */
+ Deg->Crss.Num = Crs_GetNumCrssInDeg (Deg->DegCod);
+
/* Set return value */
DegFound = true;
}
@@ -1933,7 +1935,7 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
Par_GetParToText (ParamName,NewDegName,MaxBytes);
/***** Get data of degree *****/
- Deg_GetDataOfDegreeByCod (Deg);
+ Deg_GetDataOfDegreeByCod (Deg,Deg_GET_BASIC_DATA);
/***** Check if new name is empty *****/
if (!NewDegName[0])
@@ -2017,7 +2019,7 @@ void Deg_ChangeDegCtrInConfig (void)
if (NewCtr.CtrCod != Gbl.Hierarchy.Deg.CtrCod)
{
/***** Get data of new centre *****/
- Ctr_GetDataOfCentreByCod (&NewCtr);
+ Ctr_GetDataOfCentreByCod (&NewCtr,Ctr_GET_BASIC_DATA);
/***** Check if it already exists a degree with the same name in the new centre *****/
if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Gbl.Hierarchy.Deg.ShrtName,Gbl.Hierarchy.Deg.DegCod,NewCtr.CtrCod))
@@ -2092,7 +2094,7 @@ void Deg_ChangeDegreeType (void)
NewDegTypCod = DT_GetAndCheckParamOtherDegTypCod (1);
/***** Get data of degree *****/
- Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
+ Deg_GetDataOfDegreeByCod (Deg_EditingDeg,Deg_GET_BASIC_DATA);
/***** Update the table of degrees changing old type by new type *****/
DB_QueryUPDATE ("can not update the type of a degree",
@@ -2128,7 +2130,7 @@ void Deg_ChangeDegWWW (void)
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Get data of degree *****/
- Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
+ Deg_GetDataOfDegreeByCod (Deg_EditingDeg,Deg_GET_BASIC_DATA);
/***** Check if new WWW is empty *****/
if (NewWWW[0])
@@ -2219,7 +2221,7 @@ void Deg_ChangeDegStatus (void)
Status = Deg_GetStatusBitsFromStatusTxt (StatusTxt); // New status
/***** Get data of degree *****/
- Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
+ Deg_GetDataOfDegreeByCod (Deg_EditingDeg,Deg_GET_BASIC_DATA);
/***** Update status in table of degrees *****/
DB_QueryUPDATE ("can not update the status of a degree",
@@ -2491,7 +2493,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
if (Ctr.CtrCod > 0)
{
/* Get data of centre */
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
/* Write centre logo and name */
Ctr_DrawCentreLogoAndNameWithLink (&Ctr,ActSeeCtrInf,
@@ -2503,7 +2505,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
if (Deg.DegCod > 0)
{
/* Get data of degree */
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
/* Write degree logo and name */
Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeDegInf,
@@ -2562,7 +2564,7 @@ void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumDegs)
Deg.DegCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get data of degree */
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_EXTRA_DATA);
/* Write data of this degree */
Deg_ListOneDegreeForSeeing (&Deg,NumDeg);
diff --git a/swad_degree.h b/swad_degree.h
index 6d584c454..80cdc5658 100644
--- a/swad_degree.h
+++ b/swad_degree.h
@@ -89,6 +89,12 @@ struct ListDegrees
struct Degree *Lst; // List of degrees
};
+typedef enum
+ {
+ Deg_GET_BASIC_DATA,
+ Deg_GET_EXTRA_DATA,
+ } Deg_GetExtraData_t;
+
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
@@ -122,7 +128,8 @@ void Deg_RemoveDegree (void);
void Deg_PutParamDegCod (long DegCod);
long Deg_GetAndCheckParamOtherDegCod (long MinCodAllowed);
-bool Deg_GetDataOfDegreeByCod (struct Degree *Deg);
+bool Deg_GetDataOfDegreeByCod (struct Degree *Deg,
+ Deg_GetExtraData_t GetExtraData);
void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg);
long Deg_GetCtrCodOfDegreeByCod (long DegCod);
long Deg_GetInsCodOfDegreeByCod (long DegCod);
diff --git a/swad_enrolment.c b/swad_enrolment.c
index 1564ebc05..8f4d24fd5 100644
--- a/swad_enrolment.c
+++ b/swad_enrolment.c
@@ -2829,9 +2829,9 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
HTM_TD_End ();
/***** Link to course *****/
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
Deg.DegCod = Crs.DegCod;
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
HTM_TD_Begin ("class=\"DAT LT\"");
Frm_StartFormGoTo (ActSeeCrsInf);
Crs_PutParamCrsCod (Crs.CrsCod);
diff --git a/swad_exam.c b/swad_exam.c
index c69cf9126..2c1b38b07 100644
--- a/swad_exam.c
+++ b/swad_exam.c
@@ -1615,11 +1615,11 @@ static void Exa_GetNotifContentExamAnnouncement (char **ContentStr)
/***** Get data of course *****/
Crs.CrsCod = Gbl.ExamAnns.ExaDat.CrsCod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
/***** Get data of degree *****/
Deg.DegCod = Crs.DegCod;
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
/***** Get data of institution *****/
Ins.InsCod = Deg_GetInsCodOfDegreeByCod (Deg.DegCod);
diff --git a/swad_file_browser.c b/swad_file_browser.c
index 291fa742b..b134a1f21 100644
--- a/swad_file_browser.c
+++ b/swad_file_browser.c
@@ -6850,7 +6850,7 @@ static void Brw_WriteCurrentClipboard (void)
{
case Brw_ADMI_DOC_INS:
Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
- Ins_GetDataOfInstitutionByCod (&Ins,false);
+ Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_documents_management_area,
@@ -6858,7 +6858,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_SHR_INS:
Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
- Ins_GetDataOfInstitutionByCod (&Ins,false);
+ Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_shared_files_area,
@@ -6866,7 +6866,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_DOC_CTR:
Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_documents_management_area,
@@ -6874,7 +6874,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_SHR_CTR:
Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_shared_files_area,
@@ -6882,7 +6882,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_DOC_DEG:
Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_documents_management_area,
@@ -6890,7 +6890,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_SHR_DEG:
Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_shared_files_area,
@@ -6898,7 +6898,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_DOC_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_documents_management_area,
@@ -6908,7 +6908,7 @@ static void Brw_WriteCurrentClipboard (void)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s, %s %s %s",
Txt_documents_management_area,
@@ -6917,7 +6917,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_TCH_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_teachers_files_area,
@@ -6927,7 +6927,7 @@ static void Brw_WriteCurrentClipboard (void)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s, %s %s %s",
Txt_teachers_files_area,
@@ -6936,7 +6936,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_SHR_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_shared_files_area,
@@ -6946,7 +6946,7 @@ static void Brw_WriteCurrentClipboard (void)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s, %s %s %s",
Txt_shared_files_area,
@@ -6955,7 +6955,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_ASG_USR:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s, %s %s",
Txt_assignments_area,
@@ -6964,7 +6964,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_WRK_USR:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s, %s %s",
Txt_works_area,
@@ -6973,7 +6973,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_ASG_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
Usr_UsrDataConstructor (&UsrDat);
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
@@ -6986,7 +6986,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_WRK_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
Usr_UsrDataConstructor (&UsrDat);
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
@@ -7003,7 +7003,7 @@ static void Brw_WriteCurrentClipboard (void)
Prj.PrjCod = Gbl.FileBrowser.Clipboard.Cod;
Prj_GetDataOfProjectByCod (&Prj);
Crs.CrsCod = Prj.CrsCod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s, %s %s",
Gbl.FileBrowser.Clipboard.FileBrowser == Brw_ADMI_DOC_PRJ ? Txt_project_documents :
@@ -7014,7 +7014,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_MRK_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s",
Txt_marks_management_area,
@@ -7024,7 +7024,7 @@ static void Brw_WriteCurrentClipboard (void)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s %s, %s %s %s",
Txt_marks_management_area,
@@ -7865,7 +7865,7 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_DOC_INS:
case Brw_ADMI_SHR_INS:
Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
- if (Ins_GetDataOfInstitutionByCod (&Ins,false))
+ if (Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%02u/%u/%s",
Cfg_PATH_INS_PRIVATE,
@@ -7878,7 +7878,7 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_DOC_CTR:
case Brw_ADMI_SHR_CTR:
Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
- if (Ctr_GetDataOfCentreByCod (&Ctr))
+ if (Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%02u/%u/%s",
Cfg_PATH_CTR_PRIVATE,
@@ -7891,7 +7891,7 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_DOC_DEG:
case Brw_ADMI_SHR_DEG:
Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
- if (Deg_GetDataOfDegreeByCod (&Deg))
+ if (Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%02u/%u/%s",
Cfg_PATH_DEG_PRIVATE,
@@ -7906,7 +7906,7 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_SHR_CRS:
case Brw_ADMI_MRK_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- if (Crs_GetDataOfCourseByCod (&Crs))
+ if (Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Crs.CrsCod,
@@ -7921,7 +7921,7 @@ static void Brw_PasteClipboard (void)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
- if (Crs_GetDataOfCourseByCod (&Crs))
+ if (Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%ld/%s/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Crs.CrsCod,Cfg_FOLDER_GRP,
@@ -7933,7 +7933,7 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_ASG_CRS:
case Brw_ADMI_WRK_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- if (Crs_GetDataOfCourseByCod (&Crs))
+ if (Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA))
{
Usr_UsrDataConstructor (&UsrDat);
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
@@ -7952,7 +7952,7 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_ASG_USR:
case Brw_ADMI_WRK_USR:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
- if (Crs_GetDataOfCourseByCod (&Crs))
+ if (Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%ld/%s/%02u/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Crs.CrsCod,Cfg_FOLDER_USR,
@@ -7966,7 +7966,7 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_ASS_PRJ:
PrjCod = Gbl.FileBrowser.Clipboard.Cod;
Crs.CrsCod = Prj_GetCourseOfProject (PrjCod);
- if (Crs_GetDataOfCourseByCod (&Crs))
+ if (Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%ld/%s/%02u/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Crs.CrsCod,Cfg_FOLDER_PRJ,
@@ -11059,7 +11059,7 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
*CrsCod = -1L;
*DegCod = -1L;
*CtrCod = Ctr.CtrCod = Cod;
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
*InsCod = Ctr.InsCod;
break;
case Brw_ADMI_DOC_DEG:
@@ -11068,9 +11068,9 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
*GrpCod = -1L;
*CrsCod = -1L;
*DegCod = Deg.DegCod = Cod;
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
*CtrCod = Ctr.CtrCod = Deg.CtrCod;
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
*InsCod = Ctr.InsCod;
break;
case Brw_ADMI_DOC_CRS:
@@ -11082,11 +11082,11 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
/* Cod stores the course code */
*GrpCod = -1L;
*CrsCod = Crs.CrsCod = Cod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
*DegCod = Deg.DegCod = Crs.DegCod;
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
*CtrCod = Ctr.CtrCod = Deg.CtrCod;
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
*InsCod = Ctr.InsCod;
break;
case Brw_ADMI_DOC_GRP:
@@ -11097,11 +11097,11 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
*GrpCod = GrpDat.GrpCod = Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
*CrsCod = Crs.CrsCod = GrpDat.CrsCod;
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
*DegCod = Deg.DegCod = Crs.DegCod;
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
*CtrCod = Ctr.CtrCod = Deg.CtrCod;
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
*InsCod = Ctr.InsCod;
break;
case Brw_ADMI_DOC_PRJ:
@@ -11109,11 +11109,11 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
/* Cod stores the project code */
*GrpCod = -1L;
*CrsCod = Crs.CrsCod = Prj_GetCourseOfProject (Cod);
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
*DegCod = Deg.DegCod = Crs.DegCod;
- Deg_GetDataOfDegreeByCod (&Deg);
+ Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA);
*CtrCod = Ctr.CtrCod = Deg.CtrCod;
- Ctr_GetDataOfCentreByCod (&Ctr);
+ Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA);
*InsCod = Ctr.InsCod;
break;
default:
@@ -11717,7 +11717,7 @@ void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat)
row = mysql_fetch_row (mysql_res);
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get data of course */
- Crs_GetDataOfCourseByCod (&Crs);
+ Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA);
Brw_RemoveUsrWorksInCrs (UsrDat,&Crs);
NumCrssWorksRemoved++;
}
diff --git a/swad_forum.c b/swad_forum.c
index 74a5b7794..7d27b3e54 100644
--- a/swad_forum.c
+++ b/swad_forum.c
@@ -2179,14 +2179,14 @@ void For_SetForumName (struct Forum *Forum,
break;
case For_FORUM_CENTRE_USRS:
Ctr.CtrCod = Forum->Location;
- if (!Ctr_GetDataOfCentreByCod (&Ctr))
+ if (!Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Centre not found.");
Str_Copy (ForumName,Ctr.ShrtName,
For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_CENTRE_TCHS:
Ctr.CtrCod = Forum->Location;
- if (!Ctr_GetDataOfCentreByCod (&Ctr))
+ if (!Ctr_GetDataOfCentreByCod (&Ctr,Ctr_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Centre not found.");
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
"%s%s",Ctr.ShrtName,
@@ -2195,14 +2195,14 @@ void For_SetForumName (struct Forum *Forum,
break;
case For_FORUM_DEGREE_USRS:
Deg.DegCod = Forum->Location;
- if (!Deg_GetDataOfDegreeByCod (&Deg))
+ if (!Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Degree not found.");
Str_Copy (ForumName,Deg.ShrtName,
For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_DEGREE_TCHS:
Deg.DegCod = Forum->Location;
- if (!Deg_GetDataOfDegreeByCod (&Deg))
+ if (!Deg_GetDataOfDegreeByCod (&Deg,Deg_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Degree not found.");
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
"%s%s",Deg.ShrtName,
@@ -2211,14 +2211,14 @@ void For_SetForumName (struct Forum *Forum,
break;
case For_FORUM_COURSE_USRS:
Crs.CrsCod = Forum->Location;
- if (!Crs_GetDataOfCourseByCod (&Crs))
+ if (!Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Course not found.");
Str_Copy (ForumName,Crs.ShrtName,
For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_COURSE_TCHS:
Crs.CrsCod = Forum->Location;
- if (!Crs_GetDataOfCourseByCod (&Crs))
+ if (!Crs_GetDataOfCourseByCod (&Crs,Crs_GET_BASIC_DATA))
Lay_ShowErrorAndExit ("Course not found.");
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
"%s%s",Crs.ShrtName,
diff --git a/swad_hierarchy.c b/swad_hierarchy.c
index 967af21c0..9f0fd089d 100644
--- a/swad_hierarchy.c
+++ b/swad_hierarchy.c
@@ -541,7 +541,7 @@ void Hie_InitHierarchy (void)
/***** If course code is available, get course data *****/
if (Gbl.Hierarchy.Crs.CrsCod > 0)
{
- if (Crs_GetDataOfCourseByCod (&Gbl.Hierarchy.Crs)) // Course found
+ if (Crs_GetDataOfCourseByCod (&Gbl.Hierarchy.Crs,Crs_GET_BASIC_DATA)) // Course found
Gbl.Hierarchy.Deg.DegCod = Gbl.Hierarchy.Crs.DegCod;
else
Hie_ResetHierarchy ();
@@ -550,7 +550,7 @@ void Hie_InitHierarchy (void)
/***** If degree code is available, get degree data *****/
if (Gbl.Hierarchy.Deg.DegCod > 0)
{
- if (Deg_GetDataOfDegreeByCod (&Gbl.Hierarchy.Deg)) // Degree found
+ if (Deg_GetDataOfDegreeByCod (&Gbl.Hierarchy.Deg,Deg_GET_BASIC_DATA)) // Degree found
{
Gbl.Hierarchy.Ctr.CtrCod = Gbl.Hierarchy.Deg.CtrCod;
Gbl.Hierarchy.Ins.InsCod = Deg_GetInsCodOfDegreeByCod (Gbl.Hierarchy.Deg.DegCod);
@@ -562,7 +562,7 @@ void Hie_InitHierarchy (void)
/***** If centre code is available, get centre data *****/
if (Gbl.Hierarchy.Ctr.CtrCod > 0)
{
- if (Ctr_GetDataOfCentreByCod (&Gbl.Hierarchy.Ctr)) // Centre found
+ if (Ctr_GetDataOfCentreByCod (&Gbl.Hierarchy.Ctr,Ctr_GET_BASIC_DATA)) // Centre found
Gbl.Hierarchy.Ins.InsCod = Gbl.Hierarchy.Ctr.InsCod;
else
Hie_ResetHierarchy ();
diff --git a/swad_layout.c b/swad_layout.c
index fb8519c43..b1f51efe4 100644
--- a/swad_layout.c
+++ b/swad_layout.c
@@ -1332,7 +1332,7 @@ void Lay_ShowErrorAndExit (const char *Txt)
/***** Page is generated (except