mirror of https://github.com/acanas/swad-core.git
Version 18.48
This commit is contained in:
parent
1316de7f26
commit
664c0f4d5e
180
swad_action.c
180
swad_action.c
|
@ -1529,7 +1529,6 @@ Profile:
|
|||
1332. ActChgPriPho Change privacy of my photo
|
||||
1333. ActChgPriPrf Change privacy of my public profile
|
||||
|
||||
1334. ActReqEdiMyIns Request the edition of my institution, centre and department
|
||||
1335. ActChgCtyMyIns Change the country of my institution
|
||||
1336. ActChgMyIns Change my institution
|
||||
1337. ActChgMyCtr Change my centre
|
||||
|
@ -3108,7 +3107,6 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActChgPriPho */{ 774,-1,TabUnk,ActEdiPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pho_ChangePhotoVisibility ,NULL},
|
||||
/* ActChgPriPrf */{1404,-1,TabUnk,ActEdiPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_ChangeProfileVisibility ,NULL},
|
||||
|
||||
/* ActReqEdiMyIns */{1165,-1,TabUnk,ActReqEdiRecSha ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rec_ShowMySharedRecordAndMore ,NULL},
|
||||
/* ActChgCtyMyIns */{1166,-1,TabUnk,ActReqEdiRecSha ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rec_ChgCountryOfMyInstitution ,NULL},
|
||||
/* ActChgMyIns */{1167,-1,TabUnk,ActReqEdiRecSha ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rec_UpdateMyInstitution ,NULL},
|
||||
/* ActChgMyCtr */{1168,-1,TabUnk,ActReqEdiRecSha ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rec_UpdateMyCentre ,NULL},
|
||||
|
@ -4308,7 +4306,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
-1, // #1162 (obsolete action)
|
||||
ActCreUsrAcc, // #1163
|
||||
ActSeeOneNot, // #1164
|
||||
ActReqEdiMyIns, // #1165
|
||||
-1, // #1165 (obsolete action)
|
||||
ActChgCtyMyIns, // #1166
|
||||
ActChgMyIns, // #1167
|
||||
ActChgMyCtr, // #1168
|
||||
|
@ -5147,9 +5145,10 @@ void Act_AdjustCurrentAction (void)
|
|||
{
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Action to log out */
|
||||
case ActLogOut:
|
||||
case ActFrmMyAcc:
|
||||
case ActChgMyPwd:
|
||||
/* Actions related with my account */
|
||||
case ActFrmMyAcc: case ActChgMyPwd: case ActChgMyNck: case ActChgMyMai:
|
||||
break;
|
||||
default:
|
||||
Gbl.Action.Act = ActFrmMyAcc;
|
||||
|
@ -5158,7 +5157,7 @@ void Act_AdjustCurrentAction (void)
|
|||
}
|
||||
}
|
||||
|
||||
/***** Just after login *****/
|
||||
/***** Just after login, check if my password seems good *****/
|
||||
if (Gbl.Action.Act == ActLogIn)
|
||||
if (!Pwd_FastCheckIfPasswordSeemsGood (Gbl.Usrs.Me.LoginPlainPassword))
|
||||
/* If my login password is not enough secure,
|
||||
|
@ -5176,10 +5175,10 @@ void Act_AdjustCurrentAction (void)
|
|||
{
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Action to log out */
|
||||
case ActLogOut:
|
||||
case ActFrmMyAcc:
|
||||
case ActChgMyPwd:
|
||||
case ActChgMyNck:
|
||||
/* Actions related with my account */
|
||||
case ActFrmMyAcc: case ActChgMyPwd: case ActChgMyNck: case ActChgMyMai:
|
||||
break;
|
||||
default:
|
||||
Gbl.Action.Act = ActFrmMyAcc;
|
||||
|
@ -5196,10 +5195,12 @@ void Act_AdjustCurrentAction (void)
|
|||
Gbl.Usrs.Me.UsrDat.CtyCod <= 0)
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Action to log out */
|
||||
case ActLogOut:
|
||||
case ActFrmMyAcc:
|
||||
case ActChgMyPwd:
|
||||
case ActChgMyNck:
|
||||
/* Actions related with my account */
|
||||
case ActFrmMyAcc: case ActChgMyPwd: case ActChgMyNck: case ActChgMyMai:
|
||||
/* Actions related with my record card */
|
||||
case ActReqEdiRecSha: case ActChgMyData: case ActChgCtyMyIns: case ActChgMyIns:
|
||||
break;
|
||||
default:
|
||||
Gbl.Action.Act = ActReqEdiRecSha;
|
||||
|
@ -5220,14 +5221,15 @@ void Act_AdjustCurrentAction (void)
|
|||
Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0)))
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Action to log out */
|
||||
case ActLogOut:
|
||||
case ActFrmMyAcc:
|
||||
case ActChgMyPwd:
|
||||
case ActChgMyNck:
|
||||
case ActReqEdiRecSha:
|
||||
/* Actions related with my account */
|
||||
case ActFrmMyAcc: case ActChgMyPwd: case ActChgMyNck: case ActChgMyMai:
|
||||
/* Actions related with my record card */
|
||||
case ActReqEdiRecSha: case ActChgMyData: case ActChgCtyMyIns: case ActChgMyIns:
|
||||
break;
|
||||
default:
|
||||
Gbl.Action.Act = ActReqEdiMyIns;
|
||||
Gbl.Action.Act = ActReqEdiRecSha;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
|
@ -5237,12 +5239,14 @@ void Act_AdjustCurrentAction (void)
|
|||
Gbl.Usrs.Me.UsrDat.ProfileVisibility == Pri_VISIBILITY_UNKNOWN)
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Action to log out */
|
||||
case ActLogOut:
|
||||
case ActFrmMyAcc:
|
||||
case ActChgMyPwd:
|
||||
case ActChgMyNck:
|
||||
case ActReqEdiRecSha:
|
||||
case ActReqEdiMyIns:
|
||||
/* Actions related with my account */
|
||||
case ActFrmMyAcc: case ActChgMyPwd: case ActChgMyNck: case ActChgMyMai:
|
||||
/* Actions related with my record card */
|
||||
case ActReqEdiRecSha: case ActChgMyData: case ActChgCtyMyIns: case ActChgMyIns:
|
||||
/* Action to edit privacy */
|
||||
case ActEdiPri:
|
||||
break;
|
||||
default:
|
||||
Gbl.Action.Act = ActEdiPri;
|
||||
|
@ -5260,19 +5264,44 @@ void Act_AdjustCurrentAction (void)
|
|||
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role)
|
||||
{
|
||||
case Rol_STD:
|
||||
Gbl.Action.Act = ActReqAccEnrStd;
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Actions related with enrolment as student */
|
||||
case ActReqAccEnrStd: case ActAccEnrStd: case ActRemMe_Std:
|
||||
return;
|
||||
default:
|
||||
Gbl.Action.Act = ActReqAccEnrStd;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case Rol_NET:
|
||||
Gbl.Action.Act = ActReqAccEnrNET;
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Actions related with enrolment as non-editing teacher */
|
||||
case ActReqAccEnrNET: case ActAccEnrNET: case ActRemMe_NET:
|
||||
return;
|
||||
default:
|
||||
Gbl.Action.Act = ActReqAccEnrNET;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case Rol_TCH:
|
||||
Gbl.Action.Act = ActReqAccEnrTch;
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Actions related with enrolment as teacher */
|
||||
case ActReqAccEnrTch: case ActAccEnrTch: case ActRemMe_Tch:
|
||||
return;
|
||||
default:
|
||||
Gbl.Action.Act = ActReqAccEnrTch;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
|
||||
/***** Depending on the role I am logged... *****/
|
||||
|
@ -5281,47 +5310,54 @@ void Act_AdjustCurrentAction (void)
|
|||
case Rol_STD:
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
case ActLogIn:
|
||||
case ActLogInNew:
|
||||
case ActMnu:
|
||||
/* Action to log out */
|
||||
case ActLogOut:
|
||||
case ActFrmMyAcc:
|
||||
case ActChgMyPwd:
|
||||
case ActChgMyNck:
|
||||
case ActReqEdiRecSha:
|
||||
case ActReqEdiMyIns:
|
||||
/* Actions related with my account */
|
||||
case ActFrmMyAcc: case ActChgMyPwd: case ActChgMyNck: case ActChgMyMai:
|
||||
/* Actions related with my record card */
|
||||
case ActReqEdiRecSha: case ActChgMyData: case ActChgCtyMyIns: case ActChgMyIns:
|
||||
/* Action to edit privacy */
|
||||
case ActEdiPri:
|
||||
case ActReqSelGrp:
|
||||
/* Actions related with my group registration */
|
||||
case ActReqSelGrp: case ActChgGrp:
|
||||
case ActReqMdfOneStd: // A student use this action to remove him/herself from current course
|
||||
case ActSeeCrsTT:
|
||||
case ActPrnCrsTT:
|
||||
case ActChgCrsTT1stDay:
|
||||
// These last actions are allowed in order to students could see/print timetable before register in groups
|
||||
/* Actions allowed in order to students could see/print timetable before register in groups */
|
||||
case ActSeeCrsTT: case ActPrnCrsTT: case ActChgCrsTT1stDay:
|
||||
break;
|
||||
default:
|
||||
/* If there are some group types with mandatory enrolment and groups in this course,
|
||||
and I don't belong to any of those groups,
|
||||
the the only action possible is show a form to register in groups */
|
||||
if (Grp_NumGrpTypesMandatIDontBelongAsStd ()) // To do: if this query is too slow ==> put it only when login.
|
||||
{
|
||||
Gbl.Action.Act = ActReqSelGrp;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
/* If there are some group types with groups in wich I must register,
|
||||
the the only action possible is show a form to register in groups */
|
||||
if (Gbl.Action.Act == ActLogIn) // Only when login...
|
||||
if (Grp_ThereAreGrpTypesIMustRegister ()) // ...because this query is slow
|
||||
{
|
||||
Gbl.Action.Act = ActReqSelGrp;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
|
||||
/* If I have no photo, and current action is not available for unknown users,
|
||||
then update number of clicks without photo */
|
||||
if (!Gbl.Usrs.Me.MyPhotoExists)
|
||||
if (!(Act_Actions[Gbl.Action.Act].PermissionCrsIfIBelong & (1 << Rol_UNK)) && // If current action is not available for unknown users...
|
||||
Gbl.Action.Act != ActReqMyPho) // ...and current action is not ActReqMyPho...
|
||||
if ((Gbl.Usrs.Me.NumAccWithoutPhoto = Pho_UpdateMyClicksWithoutPhoto ()) > Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
||||
{
|
||||
/* If limit of clicks has been reached,
|
||||
the only action possible is show a form to send my photo */
|
||||
Gbl.Action.Act = ActReqMyPho;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
if (!(Act_Actions[Gbl.Action.Act].PermissionCrsIfIBelong & (1 << Rol_UNK))) // If current action is not available for unknown users...
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Actions related to sending my photo */
|
||||
case ActReqMyPho: case ActDetMyPho: case ActUpdMyPho:
|
||||
break;
|
||||
default:
|
||||
if ((Gbl.Usrs.Me.NumAccWithoutPhoto =
|
||||
Pho_UpdateMyClicksWithoutPhoto ()) > Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
||||
{
|
||||
/* If limit of clicks has been reached,
|
||||
the only action possible is show a form to send my photo */
|
||||
Gbl.Action.Act = ActReqMyPho;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5332,16 +5368,22 @@ void Act_AdjustCurrentAction (void)
|
|||
case Rol_NET:
|
||||
break;
|
||||
case Rol_TCH:
|
||||
if (Gbl.Action.Act == ActReqTst ||
|
||||
Gbl.Action.Act == ActEdiTstQst)
|
||||
/***** If current course has tests and pluggable is unknown,
|
||||
the only action possible is configure tests *****/
|
||||
if (Tst_CheckIfCourseHaveTestsAndPluggableIsUnknown ())
|
||||
{
|
||||
Gbl.Action.Act = ActCfgTst;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
/* Actions related with test configuration */
|
||||
case ActCfgTst: case ActRcvCfgTst:
|
||||
break;
|
||||
default:
|
||||
/***** If current course has tests and pluggable is unknown,
|
||||
the only action possible is configure tests *****/
|
||||
if (Tst_CheckIfCourseHaveTestsAndPluggableIsUnknown ())
|
||||
{
|
||||
Gbl.Action.Act = ActCfgTst;
|
||||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -5358,6 +5400,6 @@ void Act_AdjustCurrentAction (void)
|
|||
Tab_SetCurrentTab ();
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ typedef enum
|
|||
|
||||
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
||||
|
||||
#define Act_NUM_ACTIONS (1 + 8 + 59 + 38 + 12 + 42 + 36 + 19 + 110 + 157 + 437 + 165 + 168 + 15 + 67)
|
||||
#define Act_NUM_ACTIONS (1 + 8 + 59 + 38 + 12 + 42 + 36 + 19 + 110 + 157 + 437 + 165 + 168 + 15 + 66)
|
||||
|
||||
#define Act_MAX_ACTION_COD 1752
|
||||
|
||||
|
@ -1562,37 +1562,36 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
#define ActChgPriPho (ActSeeMyUsgRep + 39)
|
||||
#define ActChgPriPrf (ActSeeMyUsgRep + 40)
|
||||
|
||||
#define ActReqEdiMyIns (ActSeeMyUsgRep + 41)
|
||||
#define ActChgCtyMyIns (ActSeeMyUsgRep + 42)
|
||||
#define ActChgMyIns (ActSeeMyUsgRep + 43)
|
||||
#define ActChgMyCtr (ActSeeMyUsgRep + 44)
|
||||
#define ActChgMyDpt (ActSeeMyUsgRep + 45)
|
||||
#define ActChgMyOff (ActSeeMyUsgRep + 46)
|
||||
#define ActChgMyOffPho (ActSeeMyUsgRep + 47)
|
||||
#define ActChgCtyMyIns (ActSeeMyUsgRep + 41)
|
||||
#define ActChgMyIns (ActSeeMyUsgRep + 42)
|
||||
#define ActChgMyCtr (ActSeeMyUsgRep + 43)
|
||||
#define ActChgMyDpt (ActSeeMyUsgRep + 44)
|
||||
#define ActChgMyOff (ActSeeMyUsgRep + 45)
|
||||
#define ActChgMyOffPho (ActSeeMyUsgRep + 46)
|
||||
|
||||
#define ActReqEdiMyNet (ActSeeMyUsgRep + 48)
|
||||
#define ActChgMyNet (ActSeeMyUsgRep + 49)
|
||||
#define ActReqEdiMyNet (ActSeeMyUsgRep + 47)
|
||||
#define ActChgMyNet (ActSeeMyUsgRep + 48)
|
||||
|
||||
#define ActChgThe (ActSeeMyUsgRep + 50)
|
||||
#define ActReqChgLan (ActSeeMyUsgRep + 51)
|
||||
#define ActChgLan (ActSeeMyUsgRep + 52)
|
||||
#define ActChg1stDay (ActSeeMyUsgRep + 53)
|
||||
#define ActChgDatFmt (ActSeeMyUsgRep + 54)
|
||||
#define ActChgCol (ActSeeMyUsgRep + 55)
|
||||
#define ActHidLftCol (ActSeeMyUsgRep + 56)
|
||||
#define ActHidRgtCol (ActSeeMyUsgRep + 57)
|
||||
#define ActShoLftCol (ActSeeMyUsgRep + 58)
|
||||
#define ActShoRgtCol (ActSeeMyUsgRep + 59)
|
||||
#define ActChgIco (ActSeeMyUsgRep + 60)
|
||||
#define ActChgMnu (ActSeeMyUsgRep + 61)
|
||||
#define ActChgNtfPrf (ActSeeMyUsgRep + 62)
|
||||
#define ActChgThe (ActSeeMyUsgRep + 49)
|
||||
#define ActReqChgLan (ActSeeMyUsgRep + 50)
|
||||
#define ActChgLan (ActSeeMyUsgRep + 51)
|
||||
#define ActChg1stDay (ActSeeMyUsgRep + 52)
|
||||
#define ActChgDatFmt (ActSeeMyUsgRep + 53)
|
||||
#define ActChgCol (ActSeeMyUsgRep + 54)
|
||||
#define ActHidLftCol (ActSeeMyUsgRep + 55)
|
||||
#define ActHidRgtCol (ActSeeMyUsgRep + 56)
|
||||
#define ActShoLftCol (ActSeeMyUsgRep + 57)
|
||||
#define ActShoRgtCol (ActSeeMyUsgRep + 58)
|
||||
#define ActChgIco (ActSeeMyUsgRep + 59)
|
||||
#define ActChgMnu (ActSeeMyUsgRep + 60)
|
||||
#define ActChgNtfPrf (ActSeeMyUsgRep + 61)
|
||||
|
||||
#define ActPrnUsrQR (ActSeeMyUsgRep + 63)
|
||||
#define ActPrnUsrQR (ActSeeMyUsgRep + 62)
|
||||
|
||||
#define ActPrnMyTT (ActSeeMyUsgRep + 64)
|
||||
#define ActEdiTut (ActSeeMyUsgRep + 65)
|
||||
#define ActChgTut (ActSeeMyUsgRep + 66)
|
||||
#define ActChgMyTT1stDay (ActSeeMyUsgRep + 67)
|
||||
#define ActPrnMyTT (ActSeeMyUsgRep + 63)
|
||||
#define ActEdiTut (ActSeeMyUsgRep + 64)
|
||||
#define ActChgTut (ActSeeMyUsgRep + 65)
|
||||
#define ActChgMyTT1stDay (ActSeeMyUsgRep + 66)
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** Public types *******************************/
|
||||
|
|
|
@ -381,6 +381,8 @@ ALTER TABLE debug ENGINE=MyISAM;
|
|||
OPTIMIZE TABLE debug;
|
||||
*/
|
||||
|
||||
// TODO: Editar todas mis webs al mismo tiempo poniendo al final un botón "Guardar cambios"
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -400,10 +402,15 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.47 (2019-02-17)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.48 (2019-02-18)"
|
||||
#define CSS_FILE "swad18.41.1.css"
|
||||
#define JS_FILE "swad18.32.1.js"
|
||||
/*
|
||||
Version 18.48: Feb 18, 2019 Fixed bugs in actions related to account.
|
||||
Fixed bug related with groups. (237589 lines)
|
||||
1 change necessary in database:
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod='1165';
|
||||
|
||||
Version 18.47: Feb 17, 2019 Code refactoring related to alerts. (237494 lines)
|
||||
Version 18.46.12: Feb 16, 2019 Code refactoring related to error and alerts. (237627 lines)
|
||||
Version 18.46.11: Feb 16, 2019 Code refactoring related to alerts. (237701 lines)
|
||||
|
|
86
swad_group.c
86
swad_group.c
|
@ -3495,50 +3495,102 @@ bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Get the number of types of group with mandatory enrolment *****/
|
||||
/**** that have any group open and with any vacant *****/
|
||||
/**** and I don't belong to any of these groups as student *****/
|
||||
/****** Are there any group types with groups in wich I must register? *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Grp_NumGrpTypesMandatIDontBelongAsStd (void)
|
||||
bool Grp_ThereAreGrpTypesIMustRegister (void)
|
||||
{
|
||||
unsigned NumGrpTypes;
|
||||
unsigned NumGrpTypesEmptyIMustRegister;
|
||||
unsigned NumGrpTypesNotEmptyIMustRegister;
|
||||
|
||||
/***** Get the number of types of groups with mandatory enrolment
|
||||
which I don't belong to as student, from database *****/
|
||||
NumGrpTypes =
|
||||
(unsigned) DB_QueryCOUNT ("can not get the number of types of group"
|
||||
" of mandatory registration"
|
||||
" to which you don't belong to",
|
||||
/*****
|
||||
Number of group types:
|
||||
- with mandatory registration
|
||||
- with groups:
|
||||
- open
|
||||
- not full
|
||||
- empty
|
||||
*****/
|
||||
NumGrpTypesEmptyIMustRegister =
|
||||
(unsigned) DB_QueryCOUNT ("can not get group types I must register",
|
||||
// Mandatory group types open, which admit students
|
||||
" SELECT COUNT(DISTINCT crs_grp_types.GrpTypCod)"
|
||||
" FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.Mandatory='Y'" // Mandatory registration
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.Open='Y'" // Open
|
||||
" AND crs_grp.MaxStudents>0" // Admits students
|
||||
// Empty, without students
|
||||
" AND crs_grp_types.GrpTypCod NOT IN"
|
||||
// Mandatory group types open, which admit students, with students
|
||||
" (SELECT DISTINCT crs_grp_types.GrpTypCod"
|
||||
" FROM crs_grp_types,crs_grp,crs_grp_usr,crs_usr"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.Mandatory='Y'" // Mandatory registration
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.Open='Y'" // Open
|
||||
" AND crs_grp.MaxStudents>0" // Admits students
|
||||
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u)",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
(unsigned) Rol_STD);
|
||||
if (NumGrpTypesEmptyIMustRegister)
|
||||
return true;
|
||||
|
||||
/*****
|
||||
Number of group types:
|
||||
- with mandatory registration
|
||||
- with groups:
|
||||
- open
|
||||
- not full
|
||||
- not empty
|
||||
- to which I don't belong
|
||||
*****/
|
||||
NumGrpTypesNotEmptyIMustRegister =
|
||||
(unsigned) DB_QueryCOUNT ("can not get group types I must register",
|
||||
// Number of group types
|
||||
"SELECT COUNT(DISTINCT GrpTypCod) FROM"
|
||||
|
||||
// Mandatory group types open, which admit students, not full
|
||||
" (SELECT crs_grp_types.GrpTypCod AS GrpTypCod,"
|
||||
"COUNT(*) AS NumStudents,"
|
||||
"crs_grp.MaxStudents as MaxStudents"
|
||||
" FROM crs_grp_types,crs_grp,crs_grp_usr,crs_usr"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.Mandatory='Y'"
|
||||
" AND crs_grp_types.Mandatory='Y'" // Mandatory registration
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.Open='Y'"
|
||||
" AND crs_grp.Open='Y'" // Open
|
||||
" AND crs_grp.MaxStudents>0" // Admits students
|
||||
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.Role=%u"
|
||||
" GROUP BY crs_grp.GrpCod"
|
||||
" HAVING NumStudents<MaxStudents) AS grp_types_open_not_full"
|
||||
" HAVING NumStudents<MaxStudents)" // Not full
|
||||
" AS mand_grp_types_open_not_full"
|
||||
" WHERE GrpTypCod NOT IN"
|
||||
|
||||
// Mandatory group types to which I already belong
|
||||
" (SELECT DISTINCT crs_grp_types.GrpTypCod"
|
||||
" FROM crs_grp_types,crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.Mandatory='Y'"
|
||||
" AND crs_grp_types.Mandatory='Y'" // Mandatory registration
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod"
|
||||
" AND crs_grp.Open='Y'" // Open
|
||||
" AND crs_grp.MaxStudents>0" // Admits students
|
||||
" AND crs_grp.GrpCod=crs_grp_usr.GrpCod"
|
||||
" AND crs_grp_usr.UsrCod=%ld)",
|
||||
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
(unsigned) Rol_STD,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
return NumGrpTypes;
|
||||
return (NumGrpTypesNotEmptyIMustRegister > 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -186,7 +186,7 @@ bool Grp_GetIfIBelongToGrp (long GrpCod);
|
|||
void Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs (void);
|
||||
bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat);
|
||||
|
||||
unsigned Grp_NumGrpTypesMandatIDontBelongAsStd (void);
|
||||
bool Grp_ThereAreGrpTypesIMustRegister (void);
|
||||
void Grp_GetLstCodGrpsWithFileZonesIBelong (struct ListCodGrps *LstGrps);
|
||||
void Grp_GetNamesGrpsStdBelongsTo (long GrpTypCod,long UsrCod,char *GrpNames);
|
||||
void Grp_RecFormNewGrpTyp (void);
|
||||
|
|
Loading…
Reference in New Issue