mirror of https://github.com/acanas/swad-core.git
Version 20.94.2: Jun 18, 2021 Queries moved to module swad_group_database.
This commit is contained in:
parent
e18dd65470
commit
e1db62661b
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.94.1 (2021-06-17)"
|
#define Log_PLATFORM_VERSION "SWAD 20.94.2 (2021-06-18)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.69.1.js"
|
#define JS_FILE "swad20.69.1.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 20.94.2: Jun 18, 2021 Queries moved to module swad_group_database. (313557 lines)
|
||||||
Version 20.94.1: Jun 17, 2021 Queries moved to module swad_group_database. (313511 lines)
|
Version 20.94.1: Jun 17, 2021 Queries moved to module swad_group_database. (313511 lines)
|
||||||
Version 20.94: Jun 17, 2021 New module swad_group_database for database queries related to groups. (313489 lines)
|
Version 20.94: Jun 17, 2021 New module swad_group_database for database queries related to groups. (313489 lines)
|
||||||
Version 20.93: Jun 17, 2021 Code refactoring. (313382 lines)
|
Version 20.93: Jun 17, 2021 Code refactoring. (313382 lines)
|
||||||
|
|
176
swad_group.c
176
swad_group.c
|
@ -1218,12 +1218,7 @@ static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod)
|
||||||
bool ItsMe = Usr_ItsMe (UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||||
|
|
||||||
/***** Remove user from group *****/
|
/***** Remove user from group *****/
|
||||||
DB_QueryDELETE ("can not remove a user from a group",
|
Grp_DB_RemoveUsrFromGrp (UsrCod,GrpCod);
|
||||||
"DELETE FROM grp_users"
|
|
||||||
" WHERE GrpCod=%ld"
|
|
||||||
" AND UsrCod=%ld",
|
|
||||||
GrpCod,
|
|
||||||
UsrCod);
|
|
||||||
|
|
||||||
/***** Flush caches *****/
|
/***** Flush caches *****/
|
||||||
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
||||||
|
@ -1967,49 +1962,49 @@ static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
|
||||||
/* Put radio item or checkbox to select the group */
|
/* Put radio item or checkbox to select the group */
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
if (IBelongToThisGroup)
|
if (IBelongToThisGroup)
|
||||||
HTM_TD_Begin ("class=\"LM LIGHT_BLUE\"");
|
HTM_TD_Begin ("class=\"LM LIGHT_BLUE\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("class=\"LM\"");
|
HTM_TD_Begin ("class=\"LM\"");
|
||||||
|
|
||||||
snprintf (StrGrpCod,sizeof (StrGrpCod),"GrpCod%ld",GrpTyp->GrpTypCod);
|
snprintf (StrGrpCod,sizeof (StrGrpCod),"GrpCod%ld",GrpTyp->GrpTypCod);
|
||||||
if (Gbl.Usrs.Me.Role.Logged == Rol_STD && // If I am a student
|
if (Gbl.Usrs.Me.Role.Logged == Rol_STD && // If I am a student
|
||||||
!GrpTyp->MultipleEnrolment && // ...and the enrolment is single
|
!GrpTyp->MultipleEnrolment && // ...and the enrolment is single
|
||||||
GrpTyp->NumGrps > 1) // ...and there are more than one group
|
GrpTyp->NumGrps > 1) // ...and there are more than one group
|
||||||
{
|
{
|
||||||
/* Put a radio item */
|
/* Put a radio item */
|
||||||
if (GrpTyp->MandatoryEnrolment)
|
if (GrpTyp->MandatoryEnrolment)
|
||||||
HTM_INPUT_RADIO (StrGrpCod,false,
|
HTM_INPUT_RADIO (StrGrpCod,false,
|
||||||
"id=\"Grp%ld\" value=\"%ld\"%s%s",
|
"id=\"Grp%ld\" value=\"%ld\"%s%s",
|
||||||
Grp->GrpCod,Grp->GrpCod,
|
Grp->GrpCod,Grp->GrpCod,
|
||||||
IBelongToThisGroup ? " checked=\"checked\"" : "", // Group selected?
|
IBelongToThisGroup ? " checked=\"checked\"" : "", // Group selected?
|
||||||
ICanChangeMySelectionForThisGrp ? "" :
|
ICanChangeMySelectionForThisGrp ? "" :
|
||||||
IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
|
IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
|
||||||
" disabled=\"disabled\""); // I can not register
|
" disabled=\"disabled\""); // I can not register
|
||||||
else // If the enrolment is not mandatory, I can select no groups
|
else // If the enrolment is not mandatory, I can select no groups
|
||||||
HTM_INPUT_RADIO (StrGrpCod,false,
|
HTM_INPUT_RADIO (StrGrpCod,false,
|
||||||
"id=\"Grp%ld\" value=\"%ld\"%s%s"
|
"id=\"Grp%ld\" value=\"%ld\"%s%s"
|
||||||
" onclick=\"selectUnselectRadio(this,this.form.GrpCod%ld,%u)\"",
|
" onclick=\"selectUnselectRadio(this,this.form.GrpCod%ld,%u)\"",
|
||||||
Grp->GrpCod,Grp->GrpCod,
|
Grp->GrpCod,Grp->GrpCod,
|
||||||
IBelongToThisGroup ? " checked=\"checked\"" : "", // Group selected?
|
IBelongToThisGroup ? " checked=\"checked\"" : "", // Group selected?
|
||||||
ICanChangeMySelectionForThisGrp ? "" :
|
ICanChangeMySelectionForThisGrp ? "" :
|
||||||
IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
|
IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
|
||||||
" disabled=\"disabled\"", // I can not register
|
" disabled=\"disabled\"", // I can not register
|
||||||
GrpTyp->GrpTypCod,GrpTyp->NumGrps);
|
GrpTyp->GrpTypCod,GrpTyp->NumGrps);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* Put a checkbox item */
|
/* Put a checkbox item */
|
||||||
HTM_INPUT_CHECKBOX (StrGrpCod,HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX (StrGrpCod,HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"Grp%ld\" value=\"%ld\"%s%s",
|
"id=\"Grp%ld\" value=\"%ld\"%s%s",
|
||||||
Grp->GrpCod,Grp->GrpCod,
|
Grp->GrpCod,Grp->GrpCod,
|
||||||
IBelongToThisGroup ? " checked=\"checked\"" : "",
|
IBelongToThisGroup ? " checked=\"checked\"" : "",
|
||||||
ICanChangeMySelectionForThisGrp ? "" :
|
ICanChangeMySelectionForThisGrp ? "" :
|
||||||
IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
|
IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
|
||||||
" disabled=\"disabled\""); // I can not register
|
" disabled=\"disabled\""); // I can not register
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
Grp_WriteRowGrp (Grp,IBelongToThisGroup);
|
Grp_WriteRowGrp (Grp,IBelongToThisGroup);
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -2649,6 +2644,11 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned long NumGrpTyp;
|
unsigned long NumGrpTyp;
|
||||||
|
static unsigned (*Grp_DB_GetGrpTypesInCurrentCrs[Grp_NUM_WHICH_GROUP_TYPES]) (MYSQL_RES **mysql_res) =
|
||||||
|
{
|
||||||
|
[Grp_ONLY_GROUP_TYPES_WITH_GROUPS] = Grp_DB_GetGrpTypesWithGrpsInCurrentCrs,
|
||||||
|
[Grp_ALL_GROUP_TYPES ] = Grp_DB_GetAllGrpTypesInCurrentCrs,
|
||||||
|
};
|
||||||
|
|
||||||
if (++Gbl.Crs.Grps.GrpTypes.NestedCalls > 1) // If list is created yet, there's nothing to do
|
if (++Gbl.Crs.Grps.GrpTypes.NestedCalls > 1) // If list is created yet, there's nothing to do
|
||||||
return;
|
return;
|
||||||
|
@ -2657,61 +2657,8 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
||||||
if open time is in the past *****/
|
if open time is in the past *****/
|
||||||
Grp_OpenGroupsAutomatically ();
|
Grp_OpenGroupsAutomatically ();
|
||||||
|
|
||||||
/***** Get group types with groups + groups types without groups from database *****/
|
/***** Get group types from database *****/
|
||||||
// The tables in the second part of the UNION requires ALIAS in order to LOCK TABLES when registering in groups
|
Gbl.Crs.Grps.GrpTypes.Num = Grp_DB_GetGrpTypesInCurrentCrs[WhichGroupTypes] (&mysql_res);
|
||||||
switch (WhichGroupTypes)
|
|
||||||
{
|
|
||||||
case Grp_ONLY_GROUP_TYPES_WITH_GROUPS:
|
|
||||||
Gbl.Crs.Grps.GrpTypes.Num = (unsigned)
|
|
||||||
DB_QuerySELECT (&mysql_res,"can not get types of group of a course",
|
|
||||||
"SELECT grp_types.GrpTypCod," // row[0]
|
|
||||||
"grp_types.GrpTypName," // row[1]
|
|
||||||
"grp_types.Mandatory," // row[2]
|
|
||||||
"grp_types.Multiple," // row[3]
|
|
||||||
"grp_types.MustBeOpened," // row[4]
|
|
||||||
"UNIX_TIMESTAMP(grp_types.OpenTime)," // row[5]
|
|
||||||
"COUNT(grp_groups.GrpCod)" // row[6]
|
|
||||||
" FROM grp_types,"
|
|
||||||
"grp_groups"
|
|
||||||
" WHERE grp_types.CrsCod=%ld"
|
|
||||||
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
|
||||||
" GROUP BY grp_types.GrpTypCod"
|
|
||||||
" ORDER BY grp_types.GrpTypName",
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
|
||||||
break;
|
|
||||||
case Grp_ALL_GROUP_TYPES:
|
|
||||||
Gbl.Crs.Grps.GrpTypes.Num = (unsigned)
|
|
||||||
DB_QuerySELECT (&mysql_res,"can not get types of group of a course",
|
|
||||||
"(SELECT grp_types.GrpTypCod," // row[0]
|
|
||||||
"grp_types.GrpTypName AS GrpTypName," // row[1]
|
|
||||||
"grp_types.Mandatory," // row[2]
|
|
||||||
"grp_types.Multiple," // row[3]
|
|
||||||
"grp_types.MustBeOpened," // row[4]
|
|
||||||
"UNIX_TIMESTAMP(grp_types.OpenTime)," // row[5]
|
|
||||||
"COUNT(grp_groups.GrpCod)" // row[6]
|
|
||||||
" FROM grp_types,"
|
|
||||||
"grp_groups"
|
|
||||||
" WHERE grp_types.CrsCod=%ld"
|
|
||||||
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
|
||||||
" GROUP BY grp_types.GrpTypCod)"
|
|
||||||
" UNION "
|
|
||||||
"(SELECT GrpTypCod," // row[0]
|
|
||||||
"GrpTypName," // row[1]
|
|
||||||
"Mandatory," // row[2]
|
|
||||||
"Multiple," // row[3]
|
|
||||||
"MustBeOpened," // row[4]
|
|
||||||
"UNIX_TIMESTAMP(OpenTime)," // row[5]
|
|
||||||
"0"
|
|
||||||
" FROM grp_types"
|
|
||||||
" WHERE CrsCod=%ld"
|
|
||||||
" AND GrpTypCod NOT IN"
|
|
||||||
" (SELECT GrpTypCod"
|
|
||||||
" FROM grp_groups))"
|
|
||||||
" ORDER BY GrpTypName",
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Get group types *****/
|
/***** Get group types *****/
|
||||||
Gbl.Crs.Grps.GrpTypes.NumGrpsTotal = 0;
|
Gbl.Crs.Grps.GrpTypes.NumGrpsTotal = 0;
|
||||||
|
@ -2780,37 +2727,20 @@ void Grp_OpenGroupsAutomatically (void)
|
||||||
long GrpTypCod;
|
long GrpTypCod;
|
||||||
|
|
||||||
/***** Find group types to be opened *****/
|
/***** Find group types to be opened *****/
|
||||||
NumGrpTypes = (unsigned)
|
NumGrpTypes = Grp_DB_GetGrpTypesInCurrentCrsToBeOpened (&mysql_res);
|
||||||
DB_QuerySELECT (&mysql_res,"can not get the types of group to be opened",
|
|
||||||
"SELECT GrpTypCod"
|
|
||||||
" FROM grp_types"
|
|
||||||
" WHERE CrsCod=%ld"
|
|
||||||
" AND MustBeOpened='Y'"
|
|
||||||
" AND OpenTime<=NOW()",
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
|
||||||
|
|
||||||
for (NumGrpTyp = 0;
|
for (NumGrpTyp = 0;
|
||||||
NumGrpTyp < NumGrpTypes;
|
NumGrpTyp < NumGrpTypes;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
{
|
{
|
||||||
/* Get next group TYPE */
|
/* Get next group type */
|
||||||
if ((GrpTypCod = DB_GetNextCode (mysql_res)) > 0)
|
if ((GrpTypCod = DB_GetNextCode (mysql_res)) > 0)
|
||||||
{
|
{
|
||||||
/***** Open all the closed groups in this course the must be opened
|
/***** Open all the closed groups of this type that are closed ****/
|
||||||
and with open time in the past ****/
|
Grp_DB_OpenGrpsOfType (GrpTypCod);
|
||||||
DB_QueryUPDATE ("can not open groups",
|
|
||||||
"UPDATE grp_groups"
|
|
||||||
" SET Open='Y'"
|
|
||||||
" WHERE GrpTypCod=%ld"
|
|
||||||
" AND Open='N'",
|
|
||||||
GrpTypCod);
|
|
||||||
|
|
||||||
/***** To not try to open groups again, set MustBeOpened to false *****/
|
/***** To not try to open groups again, set MustBeOpened to false *****/
|
||||||
DB_QueryUPDATE ("can not update the opening of a type of group",
|
Grp_DB_ClearMustBeOpened (GrpTypCod);
|
||||||
"UPDATE grp_types"
|
|
||||||
" SET MustBeOpened='N'"
|
|
||||||
" WHERE GrpTypCod=%ld",
|
|
||||||
GrpTypCod);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
/******************************* Public types ********************************/
|
/******************************* Public types ********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define Grp_NUM_WHICH_GROUP_TYPES 2
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Grp_ONLY_GROUP_TYPES_WITH_GROUPS,
|
Grp_ONLY_GROUP_TYPES_WITH_GROUPS,
|
||||||
|
|
|
@ -280,6 +280,85 @@ bool Grp_DB_CheckIfIBelongToGrpsOfType (long GrpTypCod)
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod) != 0);
|
Gbl.Usrs.Me.UsrDat.UsrCod) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************** Get group types with groups in current course ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Grp_DB_GetGrpTypesWithGrpsInCurrentCrs (MYSQL_RES **mysql_res)
|
||||||
|
{
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get types of group of a course",
|
||||||
|
"SELECT grp_types.GrpTypCod," // row[0]
|
||||||
|
"grp_types.GrpTypName," // row[1]
|
||||||
|
"grp_types.Mandatory," // row[2]
|
||||||
|
"grp_types.Multiple," // row[3]
|
||||||
|
"grp_types.MustBeOpened," // row[4]
|
||||||
|
"UNIX_TIMESTAMP(grp_types.OpenTime)," // row[5]
|
||||||
|
"COUNT(grp_groups.GrpCod)" // row[6]
|
||||||
|
" FROM grp_types,"
|
||||||
|
"grp_groups"
|
||||||
|
" WHERE grp_types.CrsCod=%ld"
|
||||||
|
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
||||||
|
" GROUP BY grp_types.GrpTypCod"
|
||||||
|
" ORDER BY grp_types.GrpTypName",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********** Get group types with or without groups in current course *********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Grp_DB_GetAllGrpTypesInCurrentCrs (MYSQL_RES **mysql_res)
|
||||||
|
{
|
||||||
|
// The tables in the second part of the UNION requires ALIAS in order to LOCK TABLES when registering in groups
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get types of group of a course",
|
||||||
|
"(SELECT grp_types.GrpTypCod," // row[0]
|
||||||
|
"grp_types.GrpTypName AS GrpTypName," // row[1]
|
||||||
|
"grp_types.Mandatory," // row[2]
|
||||||
|
"grp_types.Multiple," // row[3]
|
||||||
|
"grp_types.MustBeOpened," // row[4]
|
||||||
|
"UNIX_TIMESTAMP(grp_types.OpenTime)," // row[5]
|
||||||
|
"COUNT(grp_groups.GrpCod)" // row[6]
|
||||||
|
" FROM grp_types,"
|
||||||
|
"grp_groups"
|
||||||
|
" WHERE grp_types.CrsCod=%ld"
|
||||||
|
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
||||||
|
" GROUP BY grp_types.GrpTypCod)"
|
||||||
|
" UNION "
|
||||||
|
"(SELECT GrpTypCod," // row[0]
|
||||||
|
"GrpTypName," // row[1]
|
||||||
|
"Mandatory," // row[2]
|
||||||
|
"Multiple," // row[3]
|
||||||
|
"MustBeOpened," // row[4]
|
||||||
|
"UNIX_TIMESTAMP(OpenTime)," // row[5]
|
||||||
|
"0"
|
||||||
|
" FROM grp_types"
|
||||||
|
" WHERE CrsCod=%ld"
|
||||||
|
" AND GrpTypCod NOT IN"
|
||||||
|
" (SELECT GrpTypCod"
|
||||||
|
" FROM grp_groups))"
|
||||||
|
" ORDER BY GrpTypName",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Get group types in current course that must be opened ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned Grp_DB_GetGrpTypesInCurrentCrsToBeOpened (MYSQL_RES **mysql_res)
|
||||||
|
{
|
||||||
|
return (unsigned)
|
||||||
|
DB_QuerySELECT (mysql_res,"can not get the types of group to be opened",
|
||||||
|
"SELECT GrpTypCod"
|
||||||
|
" FROM grp_types"
|
||||||
|
" WHERE CrsCod=%ld"
|
||||||
|
" AND MustBeOpened='Y'"
|
||||||
|
" AND OpenTime<=NOW()",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********** Query the number of groups that hay in this course **************/
|
/*********** Query the number of groups that hay in this course **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -396,6 +475,33 @@ bool Grp_DB_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Co
|
||||||
Field,Cod) != 0);
|
Field,Cod) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Open all the closed groups of a tyoe *******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Grp_DB_OpenGrpsOfType (long GrpTypCod)
|
||||||
|
{
|
||||||
|
DB_QueryUPDATE ("can not open groups",
|
||||||
|
"UPDATE grp_groups"
|
||||||
|
" SET Open='Y'"
|
||||||
|
" WHERE GrpTypCod=%ld"
|
||||||
|
" AND Open='N'",
|
||||||
|
GrpTypCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Set type of group to not be opened *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Grp_DB_ClearMustBeOpened (long GrpTypCod)
|
||||||
|
{
|
||||||
|
DB_QueryUPDATE ("can not update the opening of a type of group",
|
||||||
|
"UPDATE grp_types"
|
||||||
|
" SET MustBeOpened='N'"
|
||||||
|
" WHERE GrpTypCod=%ld",
|
||||||
|
GrpTypCod);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********************** Register a user in a group **************************/
|
/*********************** Register a user in a group **************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -411,6 +517,20 @@ void Grp_DB_AddUsrToGrp (long UsrCod,long GrpCod)
|
||||||
UsrCod);
|
UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************* Remove a user from a group ************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Grp_DB_RemoveUsrFromGrp (long UsrCod,long GrpCod)
|
||||||
|
{
|
||||||
|
DB_QueryDELETE ("can not remove a user from a group",
|
||||||
|
"DELETE FROM grp_users"
|
||||||
|
" WHERE GrpCod=%ld"
|
||||||
|
" AND UsrCod=%ld",
|
||||||
|
GrpCod,
|
||||||
|
UsrCod);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************** Remove a user of all the groups of a course *****************/
|
/*************** Remove a user of all the groups of a course *****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -61,6 +61,11 @@ unsigned Grp_DB_CountNumUsrsInNoGrpsOfType (Rol_Role_t Role,long GrpTypCod);
|
||||||
|
|
||||||
bool Grp_DB_CheckIfIBelongToGrpsOfType (long GrpTypCod);
|
bool Grp_DB_CheckIfIBelongToGrpsOfType (long GrpTypCod);
|
||||||
|
|
||||||
|
unsigned Grp_DB_GetGrpTypesWithGrpsInCurrentCrs (MYSQL_RES **mysql_res);
|
||||||
|
unsigned Grp_DB_GetAllGrpTypesInCurrentCrs (MYSQL_RES **mysql_res);
|
||||||
|
|
||||||
|
unsigned Grp_DB_GetGrpTypesInCurrentCrsToBeOpened (MYSQL_RES **mysql_res);
|
||||||
|
|
||||||
unsigned Grp_DB_CountNumGrpsInCurrentCrs (void);
|
unsigned Grp_DB_CountNumGrpsInCurrentCrs (void);
|
||||||
unsigned Grp_DB_CountNumGrpsInThisCrsOfType (long GrpTypCod);
|
unsigned Grp_DB_CountNumGrpsInThisCrsOfType (long GrpTypCod);
|
||||||
unsigned Grp_DB_GetGrpsOfType (MYSQL_RES **mysql_res,long GrpTypCod);
|
unsigned Grp_DB_GetGrpsOfType (MYSQL_RES **mysql_res,long GrpTypCod);
|
||||||
|
@ -71,8 +76,12 @@ bool Grp_DB_CheckIfAssociatedToGrp (const char *Table,const char *Field,
|
||||||
long Cod,long GrpCod);
|
long Cod,long GrpCod);
|
||||||
bool Grp_DB_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod);
|
bool Grp_DB_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod);
|
||||||
|
|
||||||
|
void Grp_DB_OpenGrpsOfType (long GrpTypCod);
|
||||||
|
void Grp_DB_ClearMustBeOpened (long GrpTypCod);
|
||||||
|
|
||||||
void Grp_DB_AddUsrToGrp (long UsrCod,long GrpCod);
|
void Grp_DB_AddUsrToGrp (long UsrCod,long GrpCod);
|
||||||
|
|
||||||
|
void Grp_DB_RemoveUsrFromGrp (long UsrCod,long GrpCod);
|
||||||
void Grp_DB_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod);
|
void Grp_DB_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod);
|
||||||
void Grp_DB_RemUsrFromAllGrps (long UsrCod);
|
void Grp_DB_RemUsrFromAllGrps (long UsrCod);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue