mirror of
https://github.com/acanas/swad-core.git
synced 2024-05-29 04:53:26 +02:00
Version 16.24
This commit is contained in:
parent
3a3b069998
commit
0e1a86e9ec
|
@ -754,7 +754,7 @@ static void Ctr_ListOneCentreForSeeing (struct Centre *Ctr,unsigned NumCtr)
|
||||||
"%u"
|
"%u"
|
||||||
"</td>",
|
"</td>",
|
||||||
TxtClassNormal,BgColor,
|
TxtClassNormal,BgColor,
|
||||||
Ctr->NumDegs);
|
Ctr->Degs.Num);
|
||||||
|
|
||||||
/***** Number of courses *****/
|
/***** Number of courses *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||||
|
@ -937,7 +937,7 @@ void Ctr_GetListCentres (long InsCod)
|
||||||
Ctr->NumUsrsWhoClaimToBelongToCtr = 0;
|
Ctr->NumUsrsWhoClaimToBelongToCtr = 0;
|
||||||
|
|
||||||
/* Get number of degrees in this centre */
|
/* Get number of degrees in this centre */
|
||||||
Ctr->NumDegs = Deg_GetNumDegsInCtr (Ctr->CtrCod);
|
Ctr->Degs.Num = Deg_GetNumDegsInCtr (Ctr->CtrCod);
|
||||||
|
|
||||||
/* Get number of courses in this centre */
|
/* Get number of courses in this centre */
|
||||||
Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod);
|
Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod);
|
||||||
|
@ -973,7 +973,8 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
|
||||||
Ctr->FullName[0] = '\0';
|
Ctr->FullName[0] = '\0';
|
||||||
Ctr->WWW[0] = '\0';
|
Ctr->WWW[0] = '\0';
|
||||||
Ctr->NumUsrsWhoClaimToBelongToCtr = 0;
|
Ctr->NumUsrsWhoClaimToBelongToCtr = 0;
|
||||||
Ctr->NumDegs = Ctr->NumCrss = 0;
|
Ctr->Degs.Num =
|
||||||
|
Ctr->NumCrss = 0;
|
||||||
Ctr->NumUsrs = 0;
|
Ctr->NumUsrs = 0;
|
||||||
|
|
||||||
/***** Check if centre code is correct *****/
|
/***** Check if centre code is correct *****/
|
||||||
|
@ -1031,7 +1032,7 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
|
||||||
Ctr->NumUsrsWhoClaimToBelongToCtr = 0;
|
Ctr->NumUsrsWhoClaimToBelongToCtr = 0;
|
||||||
|
|
||||||
/* Get number of degrees in this centre */
|
/* Get number of degrees in this centre */
|
||||||
Ctr->NumDegs = Deg_GetNumDegsInCtr (Ctr->CtrCod);
|
Ctr->Degs.Num = Deg_GetNumDegsInCtr (Ctr->CtrCod);
|
||||||
|
|
||||||
/* Get number of courses in this centre */
|
/* Get number of courses in this centre */
|
||||||
Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod);
|
Ctr->NumCrss = Crs_GetNumCrssInCtr (Ctr->CtrCod);
|
||||||
|
@ -1285,7 +1286,7 @@ static void Ctr_ListCentresForEdition (void)
|
||||||
/* Put icon to remove centre */
|
/* Put icon to remove centre */
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"BM\">");
|
"<td class=\"BM\">");
|
||||||
if (Ctr->NumDegs ||
|
if (Ctr->Degs.Num ||
|
||||||
Ctr->NumUsrsWhoClaimToBelongToCtr ||
|
Ctr->NumUsrsWhoClaimToBelongToCtr ||
|
||||||
Ctr->NumUsrs || // Centre has degrees or users ==> deletion forbidden
|
Ctr->NumUsrs || // Centre has degrees or users ==> deletion forbidden
|
||||||
!ICanEdit)
|
!ICanEdit)
|
||||||
|
@ -1439,7 +1440,7 @@ static void Ctr_ListCentresForEdition (void)
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||||
"%u"
|
"%u"
|
||||||
"</td>",
|
"</td>",
|
||||||
Ctr->NumDegs);
|
Ctr->Degs.Num);
|
||||||
|
|
||||||
/* Number of users in courses of this centre */
|
/* Number of users in courses of this centre */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||||
|
@ -1595,7 +1596,7 @@ void Ctr_RemoveCentre (void)
|
||||||
Ctr_GetDataOfCentreByCod (&Ctr);
|
Ctr_GetDataOfCentreByCod (&Ctr);
|
||||||
|
|
||||||
/***** Check if this centre has teachers *****/
|
/***** Check if this centre has teachers *****/
|
||||||
if (Ctr.NumDegs ||
|
if (Ctr.Degs.Num ||
|
||||||
Ctr.NumUsrsWhoClaimToBelongToCtr ||
|
Ctr.NumUsrsWhoClaimToBelongToCtr ||
|
||||||
Ctr.NumUsrs) // Centre has degrees or users ==> don't remove
|
Ctr.NumUsrs) // Centre has degrees or users ==> don't remove
|
||||||
Lay_ShowAlert (Lay_WARNING,Txt_To_remove_a_centre_you_must_first_remove_all_degrees_and_teachers_in_the_centre);
|
Lay_ShowAlert (Lay_WARNING,Txt_To_remove_a_centre_you_must_first_remove_all_degrees_and_teachers_in_the_centre);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "swad_action.h"
|
#include "swad_action.h"
|
||||||
#include "swad_constant.h"
|
#include "swad_constant.h"
|
||||||
|
#include "swad_degree.h"
|
||||||
#include "swad_role.h"
|
#include "swad_role.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -68,7 +69,7 @@ struct Centre
|
||||||
char FullName[Ctr_MAX_LENGTH_CENTRE_FULL_NAME+1];
|
char FullName[Ctr_MAX_LENGTH_CENTRE_FULL_NAME+1];
|
||||||
char WWW[Cns_MAX_LENGTH_WWW+1];
|
char WWW[Cns_MAX_LENGTH_WWW+1];
|
||||||
unsigned NumUsrsWhoClaimToBelongToCtr; // Number of users who claim to belong in this centre
|
unsigned NumUsrsWhoClaimToBelongToCtr; // Number of users who claim to belong in this centre
|
||||||
unsigned NumDegs; // Number of degrees in this centre
|
struct ListDegrees Degs; // List of degrees in this centre
|
||||||
unsigned NumCrss; // Number of courses in this centre
|
unsigned NumCrss; // Number of courses in this centre
|
||||||
unsigned NumUsrs; // Number of users in courses of this centre
|
unsigned NumUsrs; // Number of users in courses of this centre
|
||||||
};
|
};
|
||||||
|
|
|
@ -148,13 +148,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.23.2 (2016-10-19)"
|
#define Log_PLATFORM_VERSION "SWAD 16.24 (2016-10-20)"
|
||||||
#define CSS_FILE "swad15.229.css"
|
#define CSS_FILE "swad15.229.css"
|
||||||
#define JS_FILE "swad15.238.1.js"
|
#define JS_FILE "swad15.238.1.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 16.24: Oct 20, 2016 Code refactoring in list of degrees. (205326 lines)
|
||||||
Version 16.23.2: Oct 19, 2016 Code refactoring in course edition. (205448 lines)
|
Version 16.23.2: Oct 19, 2016 Code refactoring in course edition. (205448 lines)
|
||||||
Version 16.23.1: Oct 19, 2016 Code refactoring in degree edition. (205441 lines)
|
Version 16.23.1: Oct 19, 2016 Code refactoring in degree edition. (205441 lines)
|
||||||
Version 16.23: Oct 19, 2016 New form in degree configuration to move degree to another centre. (205434 lines)
|
Version 16.23: Oct 19, 2016 New form in degree configuration to move degree to another centre. (205434 lines)
|
||||||
|
|
|
@ -99,7 +99,6 @@ static void Crs_CreateCourse (struct Course *Crs,unsigned Status);
|
||||||
static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row);
|
static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row);
|
||||||
|
|
||||||
static void Crs_UpdateCrsDegreeDB (long CrsCod,long DegCod);
|
static void Crs_UpdateCrsDegreeDB (long CrsCod,long DegCod);
|
||||||
static bool Crs_CheckIfICanChangeCrsToNewDeg (struct Degree *NewDeg);
|
|
||||||
|
|
||||||
static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear);
|
static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear);
|
||||||
|
|
||||||
|
@ -216,32 +215,31 @@ static void Crs_Configuration (bool PrintView)
|
||||||
Txt_Degree);
|
Txt_Degree);
|
||||||
|
|
||||||
/* Get list of degrees administrated by me */
|
/* Get list of degrees administrated by me */
|
||||||
if (!PrintView)
|
|
||||||
Deg_GetListDegsAdminByMe ();
|
|
||||||
|
|
||||||
/* Put form to select degree */
|
|
||||||
if (!PrintView &&
|
if (!PrintView &&
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Num)
|
Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM) // Only centre admins, institution admins and system admin can move a course to another degree
|
||||||
{
|
{
|
||||||
|
/* Get list of degrees of the current centre */
|
||||||
|
Deg_GetListDegsOfCurrentCtr ();
|
||||||
|
|
||||||
|
/* Put form to select degree */
|
||||||
Act_FormStart (ActChgCrsDegCfg);
|
Act_FormStart (ActChgCrsDegCfg);
|
||||||
fprintf (Gbl.F.Out,"<select name=\"OthDegCod\""
|
fprintf (Gbl.F.Out,"<select name=\"OthDegCod\""
|
||||||
" class=\"INPUT_DEGREE\""
|
" class=\"INPUT_DEGREE\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\">",
|
" onchange=\"document.getElementById('%s').submit();\">",
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
for (NumDeg = 0;
|
for (NumDeg = 0;
|
||||||
NumDeg < Gbl.Usrs.Me.MyAdminDegs.Num;
|
NumDeg < Gbl.CurrentCtr.Ctr.Degs.Num;
|
||||||
NumDeg++)
|
NumDeg++)
|
||||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
|
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Lst[NumDeg].DegCod,
|
Gbl.CurrentCtr.Ctr.Degs.Lst[NumDeg].DegCod,
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Lst[NumDeg].DegCod == Gbl.CurrentDeg.Deg.DegCod ? " selected=\"selected\"" :
|
Gbl.CurrentCtr.Ctr.Degs.Lst[NumDeg].DegCod == Gbl.CurrentDeg.Deg.DegCod ? " selected=\"selected\"" :
|
||||||
"",
|
"",
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Lst[NumDeg].ShortName);
|
Gbl.CurrentCtr.Ctr.Degs.Lst[NumDeg].ShortName);
|
||||||
fprintf (Gbl.F.Out,"</select>");
|
fprintf (Gbl.F.Out,"</select>");
|
||||||
|
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
|
|
||||||
/* Free list of degrees administrated by me */
|
/* Free list of degrees of the current centre */
|
||||||
Deg_FreeListMyAdminDegs ();
|
Deg_FreeListDegs (&Gbl.CurrentCtr.Ctr.Degs);
|
||||||
}
|
}
|
||||||
else // I can not move course to another degree
|
else // I can not move course to another degree
|
||||||
fprintf (Gbl.F.Out,"%s",Gbl.CurrentDeg.Deg.FullName);
|
fprintf (Gbl.F.Out,"%s",Gbl.CurrentDeg.Deg.FullName);
|
||||||
|
@ -954,8 +952,8 @@ void Crs_ReqEditCourses (void)
|
||||||
/***** Get list of courses in this degree *****/
|
/***** Get list of courses in this degree *****/
|
||||||
Crs_GetListCoursesInDegree (Crs_ALL_COURSES_EXCEPT_REMOVED);
|
Crs_GetListCoursesInDegree (Crs_ALL_COURSES_EXCEPT_REMOVED);
|
||||||
|
|
||||||
/***** Get list of degrees administrated by me *****/
|
/***** Get list of degrees in this centre *****/
|
||||||
Deg_GetListDegsAdminByMe ();
|
Deg_GetListDegsOfCurrentCtr ();
|
||||||
|
|
||||||
/***** Put form to edit courses *****/
|
/***** Put form to edit courses *****/
|
||||||
Crs_EditCourses ();
|
Crs_EditCourses ();
|
||||||
|
@ -963,8 +961,8 @@ void Crs_ReqEditCourses (void)
|
||||||
/***** Free list of courses in this degree *****/
|
/***** Free list of courses in this degree *****/
|
||||||
Crs_FreeListCoursesInDegree (&Gbl.CurrentDeg.Deg);
|
Crs_FreeListCoursesInDegree (&Gbl.CurrentDeg.Deg);
|
||||||
|
|
||||||
/***** Free list of degrees administrated by me *****/
|
/***** Free list of degrees in this centre *****/
|
||||||
Deg_FreeListMyAdminDegs ();
|
Deg_FreeListDegs (&Gbl.CurrentCtr.Ctr.Degs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1427,13 +1425,13 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
|
||||||
" onchange=\"document.getElementById('%s').submit();\">",
|
" onchange=\"document.getElementById('%s').submit();\">",
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
for (NumDeg = 0;
|
for (NumDeg = 0;
|
||||||
NumDeg < Gbl.Usrs.Me.MyAdminDegs.Num;
|
NumDeg < Gbl.CurrentCtr.Ctr.Degs.Num;
|
||||||
NumDeg++)
|
NumDeg++)
|
||||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
|
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Lst[NumDeg].DegCod,
|
Gbl.CurrentCtr.Ctr.Degs.Lst[NumDeg].DegCod,
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Lst[NumDeg].DegCod == Gbl.CurrentDeg.Deg.DegCod ? " selected=\"selected\"" :
|
Gbl.CurrentCtr.Ctr.Degs.Lst[NumDeg].DegCod == Gbl.CurrentDeg.Deg.DegCod ? " selected=\"selected\"" :
|
||||||
"",
|
"",
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Lst[NumDeg].ShortName);
|
Gbl.CurrentCtr.Ctr.Degs.Lst[NumDeg].ShortName);
|
||||||
fprintf (Gbl.F.Out,"</select>");
|
fprintf (Gbl.F.Out,"</select>");
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
}
|
}
|
||||||
|
@ -2434,7 +2432,7 @@ void Crs_ChangeCrsDegreeInConfig (void)
|
||||||
Deg_GetDataOfDegreeByCod (&NewDeg);
|
Deg_GetDataOfDegreeByCod (&NewDeg);
|
||||||
|
|
||||||
/***** If I have permission to change course to this new degree... *****/
|
/***** If I have permission to change course to this new degree... *****/
|
||||||
if (Crs_CheckIfICanChangeCrsToNewDeg (&NewDeg))
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
{
|
{
|
||||||
/***** If name of course was in database in the new degree... *****/
|
/***** If name of course was in database in the new degree... *****/
|
||||||
if (Crs_CheckIfCourseNameExistsInCourses (NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year,
|
if (Crs_CheckIfCourseNameExistsInCourses (NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year,
|
||||||
|
@ -2519,7 +2517,7 @@ void Crs_ChangeCrsDegree (void)
|
||||||
Deg_GetDataOfDegreeByCod (&NewDeg);
|
Deg_GetDataOfDegreeByCod (&NewDeg);
|
||||||
|
|
||||||
/***** If I have permission to change course to this new degree... *****/
|
/***** If I have permission to change course to this new degree... *****/
|
||||||
if (Crs_CheckIfICanChangeCrsToNewDeg (&NewDeg))
|
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
|
||||||
{
|
{
|
||||||
/***** If name of course was in database in the new degree... *****/
|
/***** If name of course was in database in the new degree... *****/
|
||||||
if (Crs_CheckIfCourseNameExistsInCourses (NewDeg.DegCod,Crs->Year,
|
if (Crs_CheckIfCourseNameExistsInCourses (NewDeg.DegCod,Crs->Year,
|
||||||
|
@ -2569,43 +2567,6 @@ static void Crs_UpdateCrsDegreeDB (long CrsCod,long DegCod)
|
||||||
DB_QueryUPDATE (Query,"can not move course to another degree");
|
DB_QueryUPDATE (Query,"can not move course to another degree");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************* Check if I can change the course to a new degree **************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static bool Crs_CheckIfICanChangeCrsToNewDeg (struct Degree *NewDeg)
|
|
||||||
{
|
|
||||||
struct Centre NewCtr;
|
|
||||||
|
|
||||||
/***** Check if I have permission to change course to this degree *****/
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
|
||||||
{
|
|
||||||
case Rol_DEG_ADM:
|
|
||||||
return Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
Sco_SCOPE_DEG,
|
|
||||||
NewDeg->DegCod);
|
|
||||||
break;
|
|
||||||
case Rol_CTR_ADM:
|
|
||||||
return Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
Sco_SCOPE_CTR,
|
|
||||||
NewDeg->CtrCod);
|
|
||||||
break;
|
|
||||||
case Rol_INS_ADM:
|
|
||||||
/* Get data of centre of new degree */
|
|
||||||
NewCtr.CtrCod = NewDeg->CtrCod;
|
|
||||||
Ctr_GetDataOfCentreByCod (&NewCtr);
|
|
||||||
|
|
||||||
return Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
Sco_SCOPE_INS,
|
|
||||||
NewCtr.InsCod);
|
|
||||||
break;
|
|
||||||
case Rol_SYS_ADM:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********** Change the year of a course in course configuration *************/
|
/*********** Change the year of a course in course configuration *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
144
swad_degree.c
144
swad_degree.c
|
@ -102,8 +102,6 @@ static void Deg_ListDegrees (void);
|
||||||
static void Deg_PutIconToEditDegrees (void);
|
static void Deg_PutIconToEditDegrees (void);
|
||||||
static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg);
|
static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg);
|
||||||
|
|
||||||
static void Deg_GetListDegsOfCurrentCtr (void);
|
|
||||||
static void Deg_FreeListDegsOfCurrentCtr (void);
|
|
||||||
static void Deg_RecFormRequestOrCreateDeg (unsigned Status);
|
static void Deg_RecFormRequestOrCreateDeg (unsigned Status);
|
||||||
static void Deg_PutParamOtherDegCod (long DegCod);
|
static void Deg_PutParamOtherDegCod (long DegCod);
|
||||||
|
|
||||||
|
@ -1045,7 +1043,7 @@ void Deg_ShowDegsOfCurrentCtr (void)
|
||||||
Deg_ListDegrees ();
|
Deg_ListDegrees ();
|
||||||
|
|
||||||
/***** Free list of degrees and centres *****/
|
/***** Free list of degrees and centres *****/
|
||||||
Deg_FreeListDegsOfCurrentCtr ();
|
Deg_FreeListDegs (&Gbl.CurrentCtr.Ctr.Degs);
|
||||||
Ctr_FreeListCentres ();
|
Ctr_FreeListCentres ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1082,10 +1080,10 @@ static void Deg_ListDegreesForEdition (void)
|
||||||
|
|
||||||
/***** List the degrees *****/
|
/***** List the degrees *****/
|
||||||
for (NumDeg = 0;
|
for (NumDeg = 0;
|
||||||
NumDeg < Gbl.CurrentCtr.Ctr.NumDegs;
|
NumDeg < Gbl.CurrentCtr.Ctr.Degs.Num;
|
||||||
NumDeg++)
|
NumDeg++)
|
||||||
{
|
{
|
||||||
Deg = &(Gbl.CurrentCtr.LstDegs[NumDeg]);
|
Deg = &(Gbl.CurrentCtr.Ctr.Degs.Lst[NumDeg]);
|
||||||
|
|
||||||
NumCrss = Crs_GetNumCrssInDeg (Deg->DegCod);
|
NumCrss = Crs_GetNumCrssInDeg (Deg->DegCod);
|
||||||
|
|
||||||
|
@ -1617,7 +1615,7 @@ static void Deg_ListDegrees (void)
|
||||||
Lay_StartRoundFrame (NULL,Gbl.Title,ICanEdit ? Deg_PutIconToEditDegrees :
|
Lay_StartRoundFrame (NULL,Gbl.Title,ICanEdit ? Deg_PutIconToEditDegrees :
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (Gbl.CurrentCtr.Ctr.NumDegs) // There are degrees in the current centre
|
if (Gbl.CurrentCtr.Ctr.Degs.Num) // There are degrees in the current centre
|
||||||
{
|
{
|
||||||
/***** Start table *****/
|
/***** Start table *****/
|
||||||
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE_MARGIN CELLS_PAD_2\">");
|
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE_MARGIN CELLS_PAD_2\">");
|
||||||
|
@ -1625,9 +1623,9 @@ static void Deg_ListDegrees (void)
|
||||||
|
|
||||||
/***** List the degrees *****/
|
/***** List the degrees *****/
|
||||||
for (NumDeg = 0;
|
for (NumDeg = 0;
|
||||||
NumDeg < Gbl.CurrentCtr.Ctr.NumDegs;
|
NumDeg < Gbl.CurrentCtr.Ctr.Degs.Num;
|
||||||
NumDeg++)
|
NumDeg++)
|
||||||
Deg_ListOneDegreeForSeeing (&(Gbl.CurrentCtr.LstDegs[NumDeg]),NumDeg + 1);
|
Deg_ListOneDegreeForSeeing (&(Gbl.CurrentCtr.Ctr.Degs.Lst[NumDeg]),NumDeg + 1);
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
fprintf (Gbl.F.Out,"</table>");
|
fprintf (Gbl.F.Out,"</table>");
|
||||||
|
@ -1639,8 +1637,8 @@ static void Deg_ListDegrees (void)
|
||||||
if (ICanEdit)
|
if (ICanEdit)
|
||||||
{
|
{
|
||||||
Act_FormStart (ActEdiDeg);
|
Act_FormStart (ActEdiDeg);
|
||||||
Lay_PutConfirmButton (Gbl.CurrentCtr.Ctr.NumDegs ? Txt_Create_another_degree :
|
Lay_PutConfirmButton (Gbl.CurrentCtr.Ctr.Degs.Num ? Txt_Create_another_degree :
|
||||||
Txt_Create_degree);
|
Txt_Create_degree);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1779,7 +1777,7 @@ void Deg_EditDegrees (void)
|
||||||
Deg_PutFormToCreateDegree ();
|
Deg_PutFormToCreateDegree ();
|
||||||
|
|
||||||
/***** Forms to edit current degrees *****/
|
/***** Forms to edit current degrees *****/
|
||||||
if (Gbl.CurrentCtr.Ctr.NumDegs)
|
if (Gbl.CurrentCtr.Ctr.Degs.Num)
|
||||||
{
|
{
|
||||||
if (Gbl.Ctrs.Num)
|
if (Gbl.Ctrs.Num)
|
||||||
Deg_ListDegreesForEdition ();
|
Deg_ListDegreesForEdition ();
|
||||||
|
@ -1806,7 +1804,7 @@ void Deg_EditDegrees (void)
|
||||||
Ctr_FreeListCentres ();
|
Ctr_FreeListCentres ();
|
||||||
|
|
||||||
/***** Free list of degrees in the current centre *****/
|
/***** Free list of degrees in the current centre *****/
|
||||||
Deg_FreeListDegsOfCurrentCtr ();
|
Deg_FreeListDegs (&Gbl.CurrentCtr.Ctr.Degs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1855,25 +1853,11 @@ void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********************** Free list of all the degrees ************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Deg_FreeListDegs (struct ListDegrees *Degs)
|
|
||||||
{
|
|
||||||
if (Degs->Lst)
|
|
||||||
{
|
|
||||||
free ((void *) Degs->Lst);
|
|
||||||
Degs->Lst = NULL;
|
|
||||||
Degs->Num = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************ Get a list with the degrees of the current centre **************/
|
/************ Get a list with the degrees of the current centre **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Deg_GetListDegsOfCurrentCtr (void)
|
void Deg_GetListDegsOfCurrentCtr (void)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
@ -1891,121 +1875,41 @@ static void Deg_GetListDegsOfCurrentCtr (void)
|
||||||
/***** Count number of rows in result *****/
|
/***** Count number of rows in result *****/
|
||||||
if (NumRows) // Degrees found...
|
if (NumRows) // Degrees found...
|
||||||
{
|
{
|
||||||
Gbl.CurrentCtr.Ctr.NumDegs = (unsigned) NumRows;
|
Gbl.CurrentCtr.Ctr.Degs.Num = (unsigned) NumRows;
|
||||||
|
|
||||||
/***** Create list with degrees of this centre *****/
|
/***** Create list with degrees of this centre *****/
|
||||||
if ((Gbl.CurrentCtr.LstDegs = (struct Degree *) calloc (Gbl.CurrentCtr.Ctr.NumDegs,sizeof (struct Degree))) == NULL)
|
if ((Gbl.CurrentCtr.Ctr.Degs.Lst = (struct Degree *) calloc (Gbl.CurrentCtr.Ctr.Degs.Num,
|
||||||
|
sizeof (struct Degree))) == NULL)
|
||||||
Lay_ShowErrorAndExit ("Not enough memory to store degrees of a centre.");
|
Lay_ShowErrorAndExit ("Not enough memory to store degrees of a centre.");
|
||||||
|
|
||||||
/***** Get the degrees of this centre *****/
|
/***** Get the degrees of this centre *****/
|
||||||
for (NumDeg = 0;
|
for (NumDeg = 0;
|
||||||
NumDeg < Gbl.CurrentCtr.Ctr.NumDegs;
|
NumDeg < Gbl.CurrentCtr.Ctr.Degs.Num;
|
||||||
NumDeg++)
|
NumDeg++)
|
||||||
{
|
{
|
||||||
/* Get next degree */
|
/* Get next degree */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
Deg_GetDataOfDegreeFromRow (&(Gbl.CurrentCtr.LstDegs[NumDeg]),row);
|
Deg_GetDataOfDegreeFromRow (&Gbl.CurrentCtr.Ctr.Degs.Lst[NumDeg],row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Error: degrees should be found, but really they haven't be found. This never should happen.
|
else
|
||||||
Gbl.CurrentCtr.Ctr.NumDegs = 0;
|
Gbl.CurrentCtr.Ctr.Degs.Num = 0;
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Free list of degrees of the current centre ****************/
|
/*************************** Free list of degrees ****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Deg_FreeListDegsOfCurrentCtr (void)
|
void Deg_FreeListDegs (struct ListDegrees *Degs)
|
||||||
{
|
{
|
||||||
if (Gbl.CurrentCtr.LstDegs)
|
if (Degs->Lst)
|
||||||
{
|
{
|
||||||
free ((void *) Gbl.CurrentCtr.LstDegs);
|
free ((void *) Degs->Lst);
|
||||||
Gbl.CurrentCtr.LstDegs = NULL;
|
Degs->Lst = NULL;
|
||||||
Gbl.CurrentCtr.Ctr.NumDegs = 0;
|
Degs->Num = 0;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********** Create a list with the degrees administrated by me **************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Deg_GetListDegsAdminByMe (void)
|
|
||||||
{
|
|
||||||
char Query[1024];
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumDeg;
|
|
||||||
|
|
||||||
/***** Set default list *****/
|
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Num = 0;
|
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Lst = NULL;
|
|
||||||
|
|
||||||
/***** Get degrees admin by me from database *****/
|
|
||||||
switch (Gbl.Usrs.Me.LoggedRole)
|
|
||||||
{
|
|
||||||
case Rol_CTR_ADM:
|
|
||||||
case Rol_INS_ADM:
|
|
||||||
case Rol_SYS_ADM:
|
|
||||||
sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod,"
|
|
||||||
"ShortName,FullName,WWW"
|
|
||||||
" FROM degrees"
|
|
||||||
" WHERE CtrCod='%ld'"
|
|
||||||
" ORDER BY ShortName",
|
|
||||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
|
||||||
break;
|
|
||||||
case Rol_DEG_ADM:
|
|
||||||
sprintf (Query,"SELECT degrees.DegCod,degrees.CtrCod,degrees.DegTypCod,degrees.Status,degrees.RequesterUsrCod,"
|
|
||||||
"degrees.ShortName,degrees.FullName,degrees.WWW"
|
|
||||||
" FROM admin,degrees"
|
|
||||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
|
||||||
" AND admin.Cod=degrees.DegCod"
|
|
||||||
" ORDER BY degrees.ShortName",
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* I can not admin any degree */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Num = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get degrees admin by you");
|
|
||||||
|
|
||||||
/***** Count number of rows in result *****/
|
|
||||||
if (Gbl.Usrs.Me.MyAdminDegs.Num) // Degrees found...
|
|
||||||
{
|
|
||||||
/***** Create list with degrees of this type *****/
|
|
||||||
if ((Gbl.Usrs.Me.MyAdminDegs.Lst = (struct Degree *) calloc (Gbl.Usrs.Me.MyAdminDegs.Num,
|
|
||||||
sizeof (struct Degree))) == NULL)
|
|
||||||
Lay_ShowErrorAndExit ("Nout enough memory to store degrees admin by you.");
|
|
||||||
|
|
||||||
/***** Get the degrees *****/
|
|
||||||
for (NumDeg = 0;
|
|
||||||
NumDeg < Gbl.Usrs.Me.MyAdminDegs.Num;
|
|
||||||
NumDeg++)
|
|
||||||
{
|
|
||||||
/* Get next degree */
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
Deg_GetDataOfDegreeFromRow (&(Gbl.Usrs.Me.MyAdminDegs.Lst[NumDeg]),row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/***************** Free list of degrees administrated by me ******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Deg_FreeListMyAdminDegs (void)
|
|
||||||
{
|
|
||||||
if (Gbl.Usrs.Me.MyAdminDegs.Lst)
|
|
||||||
{
|
|
||||||
free ((void *) Gbl.Usrs.Me.MyAdminDegs.Lst);
|
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Lst = NULL;
|
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Num = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,9 +110,8 @@ unsigned Deg_ConvStrToYear (const char *StrYear);
|
||||||
void Deg_EditDegrees (void);
|
void Deg_EditDegrees (void);
|
||||||
|
|
||||||
void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs);
|
void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs);
|
||||||
|
void Deg_GetListDegsOfCurrentCtr (void);
|
||||||
void Deg_FreeListDegs (struct ListDegrees *Degs);
|
void Deg_FreeListDegs (struct ListDegrees *Degs);
|
||||||
void Deg_GetListDegsAdminByMe (void);
|
|
||||||
void Deg_FreeListMyAdminDegs (void);
|
|
||||||
|
|
||||||
void Deg_RecFormReqDeg (void);
|
void Deg_RecFormReqDeg (void);
|
||||||
void Deg_RecFormNewDeg (void);
|
void Deg_RecFormNewDeg (void);
|
||||||
|
|
|
@ -172,8 +172,6 @@ void Gbl_InitializeGlobals (void)
|
||||||
Gbl.Usrs.Me.MyDegrees.Filled = false;
|
Gbl.Usrs.Me.MyDegrees.Filled = false;
|
||||||
Gbl.Usrs.Me.MyCourses.Filled = false;
|
Gbl.Usrs.Me.MyCourses.Filled = false;
|
||||||
Gbl.Usrs.Me.MyCourses.Num = 0;
|
Gbl.Usrs.Me.MyCourses.Num = 0;
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Num = 0;
|
|
||||||
Gbl.Usrs.Me.MyAdminDegs.Lst = NULL;
|
|
||||||
Gbl.Usrs.Me.ConfirmEmailJustSent = false; // An e-mail to confirm my e-mail address has not just been sent
|
Gbl.Usrs.Me.ConfirmEmailJustSent = false; // An e-mail to confirm my e-mail address has not just been sent
|
||||||
|
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod = -1L;
|
Gbl.Usrs.Other.UsrDat.UsrCod = -1L;
|
||||||
|
@ -222,6 +220,8 @@ void Gbl_InitializeGlobals (void)
|
||||||
Gbl.CurrentCtr.Ctr.PlcCod = -1L;
|
Gbl.CurrentCtr.Ctr.PlcCod = -1L;
|
||||||
Gbl.CurrentCtr.Ctr.ShortName[0] = '\0';
|
Gbl.CurrentCtr.Ctr.ShortName[0] = '\0';
|
||||||
Gbl.CurrentCtr.Ctr.FullName[0] = '\0';
|
Gbl.CurrentCtr.Ctr.FullName[0] = '\0';
|
||||||
|
Gbl.CurrentCtr.Ctr.Degs.Num = 0;
|
||||||
|
Gbl.CurrentCtr.Ctr.Degs.Lst = NULL;
|
||||||
|
|
||||||
Gbl.CurrentDegTyp.DegTyp.DegTypCod = -1L;
|
Gbl.CurrentDegTyp.DegTyp.DegTypCod = -1L;
|
||||||
Gbl.CurrentDegTyp.DegTyp.DegTypName[0] = '\0';
|
Gbl.CurrentDegTyp.DegTyp.DegTypName[0] = '\0';
|
||||||
|
@ -445,7 +445,7 @@ void Gbl_Cleanup (void)
|
||||||
Grp_FreeListGrpTypesAndGrps ();
|
Grp_FreeListGrpTypesAndGrps ();
|
||||||
Grp_FreeListCodSelectedGrps ();
|
Grp_FreeListCodSelectedGrps ();
|
||||||
Crs_FreeListCoursesInDegree (&Gbl.Degs.EditingDeg);
|
Crs_FreeListCoursesInDegree (&Gbl.Degs.EditingDeg);
|
||||||
Deg_FreeListMyAdminDegs ();
|
Deg_FreeListDegs (&Gbl.CurrentCtr.Ctr.Degs);
|
||||||
DT_FreeListDegreeTypes ();
|
DT_FreeListDegreeTypes ();
|
||||||
Ins_FreeListInstitutions ();
|
Ins_FreeListInstitutions ();
|
||||||
Ctr_FreeListCentres ();
|
Ctr_FreeListCentres ();
|
||||||
|
|
|
@ -342,11 +342,6 @@ struct Globals
|
||||||
long DegCod;
|
long DegCod;
|
||||||
} Crss[Crs_MAX_COURSES_PER_USR];
|
} Crss[Crs_MAX_COURSES_PER_USR];
|
||||||
} MyCourses;
|
} MyCourses;
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned Num;
|
|
||||||
struct Degree *Lst;
|
|
||||||
} MyAdminDegs; // List of degrees administrated by me
|
|
||||||
Usr_ShowUsrsType_t ListType; // My preference about user's list type
|
Usr_ShowUsrsType_t ListType; // My preference about user's list type
|
||||||
unsigned NumFollowers; // Number of users who follow me
|
unsigned NumFollowers; // Number of users who follow me
|
||||||
unsigned NumFollowing; // Number of users I follow
|
unsigned NumFollowing; // Number of users I follow
|
||||||
|
@ -418,7 +413,6 @@ struct Globals
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct Centre Ctr;
|
struct Centre Ctr;
|
||||||
struct Degree *LstDegs; // List of degrees of current centre
|
|
||||||
} CurrentCtr;
|
} CurrentCtr;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user