mirror of https://github.com/acanas/swad-core.git
Version 20.94.3: Jun 18, 2021 Queries moved to module swad_group_database.
This commit is contained in:
parent
e1db62661b
commit
ac7223fb08
|
@ -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.2 (2021-06-18)"
|
#define Log_PLATFORM_VERSION "SWAD 20.94.3 (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.3: Jun 18, 2021 Queries moved to module swad_group_database. (313602 lines)
|
||||||
Version 20.94.2: Jun 18, 2021 Queries moved to module swad_group_database. (313557 lines)
|
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)
|
||||||
|
|
63
swad_group.c
63
swad_group.c
|
@ -4350,13 +4350,8 @@ void Grp_RenameGroupType (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Update the table changing old name by new name */
|
/***** Update the table changing old name by new name *****/
|
||||||
DB_QueryUPDATE ("can not update the type of a group",
|
Grp_DB_RenameGrpTyp (Gbl.Crs.Grps.GrpTyp.GrpTypCod,NewNameGrpTyp);
|
||||||
"UPDATE grp_types"
|
|
||||||
" SET GrpTypName='%s'"
|
|
||||||
" WHERE GrpTypCod=%ld",
|
|
||||||
NewNameGrpTyp,
|
|
||||||
Gbl.Crs.Grps.GrpTyp.GrpTypCod);
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
AlertType = Ale_SUCCESS;
|
AlertType = Ale_SUCCESS;
|
||||||
|
@ -4436,13 +4431,8 @@ void Grp_RenameGroup (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Update the table changing old name by new name */
|
/***** Update the table changing old name by new name *****/
|
||||||
DB_QueryUPDATE ("can not update the name of a group",
|
Grp_DB_RenameGrp (Gbl.Crs.Grps.GrpCod,NewNameGrp);
|
||||||
"UPDATE grp_groups"
|
|
||||||
" SET GrpName='%s'"
|
|
||||||
" WHERE GrpCod=%ld",
|
|
||||||
NewNameGrp,
|
|
||||||
Gbl.Crs.Grps.GrpCod);
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
AlertType = Ale_SUCCESS;
|
AlertType = Ale_SUCCESS;
|
||||||
|
@ -4645,14 +4635,14 @@ void Grp_ShowFormToSelWhichGrps (Act_Action_t Action,
|
||||||
HTM_DIV_Begin ("class=\"%s\"",
|
HTM_DIV_Begin ("class=\"%s\"",
|
||||||
WhichGrps == Gbl.Crs.Grps.WhichGrps ? "PREF_ON" :
|
WhichGrps == Gbl.Crs.Grps.WhichGrps ? "PREF_ON" :
|
||||||
"PREF_OFF");
|
"PREF_OFF");
|
||||||
Frm_BeginForm (Action);
|
Frm_BeginForm (Action);
|
||||||
Par_PutHiddenParamUnsigned (NULL,"WhichGrps",(unsigned) WhichGrps);
|
Par_PutHiddenParamUnsigned (NULL,"WhichGrps",(unsigned) WhichGrps);
|
||||||
if (FuncParams) // Extra parameters depending on the action
|
if (FuncParams) // Extra parameters depending on the action
|
||||||
FuncParams (Args);
|
FuncParams (Args);
|
||||||
Ico_PutSettingIconLink (WhichGrps == Grp_MY_GROUPS ? "mysitemap.png" :
|
Ico_PutSettingIconLink (WhichGrps == Grp_MY_GROUPS ? "mysitemap.png" :
|
||||||
"sitemap.svg",
|
"sitemap.svg",
|
||||||
Txt_GROUP_WHICH_GROUPS[WhichGrps]);
|
Txt_GROUP_WHICH_GROUPS[WhichGrps]);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4720,29 +4710,12 @@ Grp_WhichGroups_t Grp_GetParamWhichGroups (void)
|
||||||
|
|
||||||
void Grp_DB_RemoveCrsGrps (long CrsCod)
|
void Grp_DB_RemoveCrsGrps (long CrsCod)
|
||||||
{
|
{
|
||||||
/***** Remove all the users in groups in the course *****/
|
/***** Remove all users in groups in the course *****/
|
||||||
DB_QueryDELETE ("can not remove users from groups of a course",
|
Grp_DB_RemoveUsrsInGrpsOfCrs (CrsCod);
|
||||||
"DELETE FROM grp_users"
|
|
||||||
" USING grp_types,"
|
|
||||||
"grp_groups,"
|
|
||||||
"grp_users"
|
|
||||||
" WHERE grp_types.CrsCod=%ld"
|
|
||||||
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
|
||||||
" AND grp_groups.GrpCod=grp_users.GrpCod",
|
|
||||||
CrsCod);
|
|
||||||
|
|
||||||
/***** Remove all the groups in the course *****/
|
/***** Remove all groups in the course *****/
|
||||||
DB_QueryDELETE ("can not remove groups of a course",
|
Grp_DB_RemoveGrpsInCrs (CrsCod);
|
||||||
"DELETE FROM grp_groups"
|
|
||||||
" USING grp_types,"
|
|
||||||
"grp_groups"
|
|
||||||
" WHERE grp_types.CrsCod=%ld"
|
|
||||||
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod",
|
|
||||||
CrsCod);
|
|
||||||
|
|
||||||
/***** Remove all the group types in the course *****/
|
/***** Remove all group types in the course *****/
|
||||||
DB_QueryDELETE ("can not remove types of group of a course",
|
Grp_DB_RemoveGrpTypesInCrs (CrsCod);
|
||||||
"DELETE FROM grp_types"
|
|
||||||
" WHERE CrsCod=%ld",
|
|
||||||
CrsCod);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -502,6 +502,36 @@ void Grp_DB_ClearMustBeOpened (long GrpTypCod)
|
||||||
GrpTypCod);
|
GrpTypCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*************************** Rename a group type *****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Grp_DB_RenameGrpTyp (long GrpTypCod,
|
||||||
|
const char NewNameGrpTyp[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1])
|
||||||
|
{
|
||||||
|
DB_QueryUPDATE ("can not update the type of a group",
|
||||||
|
"UPDATE grp_types"
|
||||||
|
" SET GrpTypName='%s'"
|
||||||
|
" WHERE GrpTypCod=%ld",
|
||||||
|
NewNameGrpTyp,
|
||||||
|
GrpTypCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****************************** Rename a group *******************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Grp_DB_RenameGrp (long GrpCod,
|
||||||
|
const char NewNameGrp[Grp_MAX_BYTES_GROUP_NAME + 1])
|
||||||
|
{
|
||||||
|
DB_QueryUPDATE ("can not update the name of a group",
|
||||||
|
"UPDATE grp_groups"
|
||||||
|
" SET GrpName='%s'"
|
||||||
|
" WHERE GrpCod=%ld",
|
||||||
|
NewNameGrp,
|
||||||
|
GrpCod);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********************** Register a user in a group **************************/
|
/*********************** Register a user in a group **************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -561,3 +591,47 @@ void Grp_DB_RemUsrFromAllGrps (long UsrCod)
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Remove all users in groups in a course *****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Grp_DB_RemoveUsrsInGrpsOfCrs (long CrsCod)
|
||||||
|
{
|
||||||
|
DB_QueryDELETE ("can not remove users from groups of a course",
|
||||||
|
"DELETE FROM grp_users"
|
||||||
|
" USING grp_types,"
|
||||||
|
"grp_groups,"
|
||||||
|
"grp_users"
|
||||||
|
" WHERE grp_types.CrsCod=%ld"
|
||||||
|
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod"
|
||||||
|
" AND grp_groups.GrpCod=grp_users.GrpCod",
|
||||||
|
CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********************** Remove all groups in a course ***********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Grp_DB_RemoveGrpsInCrs (long CrsCod)
|
||||||
|
{
|
||||||
|
DB_QueryDELETE ("can not remove groups of a course",
|
||||||
|
"DELETE FROM grp_groups"
|
||||||
|
" USING grp_types,"
|
||||||
|
"grp_groups"
|
||||||
|
" WHERE grp_types.CrsCod=%ld"
|
||||||
|
" AND grp_types.GrpTypCod=grp_groups.GrpTypCod",
|
||||||
|
CrsCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Remove all group types in a course *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Grp_DB_RemoveGrpTypesInCrs (long CrsCod)
|
||||||
|
{
|
||||||
|
DB_QueryDELETE ("can not remove types of group of a course",
|
||||||
|
"DELETE FROM grp_types"
|
||||||
|
" WHERE CrsCod=%ld",
|
||||||
|
CrsCod);
|
||||||
|
}
|
||||||
|
|
|
@ -79,10 +79,19 @@ bool Grp_DB_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Co
|
||||||
void Grp_DB_OpenGrpsOfType (long GrpTypCod);
|
void Grp_DB_OpenGrpsOfType (long GrpTypCod);
|
||||||
void Grp_DB_ClearMustBeOpened (long GrpTypCod);
|
void Grp_DB_ClearMustBeOpened (long GrpTypCod);
|
||||||
|
|
||||||
|
void Grp_DB_RenameGrpTyp (long GrpTypCod,
|
||||||
|
const char NewNameGrpTyp[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1]);
|
||||||
|
void Grp_DB_RenameGrp (long GrpCod,
|
||||||
|
const char NewNameGrp[Grp_MAX_BYTES_GROUP_NAME + 1]);
|
||||||
|
|
||||||
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_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);
|
||||||
|
|
||||||
|
void Grp_DB_RemoveUsrsInGrpsOfCrs (long CrsCod);
|
||||||
|
void Grp_DB_RemoveGrpsInCrs (long CrsCod);
|
||||||
|
void Grp_DB_RemoveGrpTypesInCrs (long CrsCod);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue