mirror of
https://github.com/acanas/swad-core.git
synced 2024-05-31 22:05:23 +02:00
Version19.213
This commit is contained in:
parent
3f893eb023
commit
a07888e1e6
|
@ -2944,7 +2944,7 @@ int swad__getAttendanceUsers (struct soap *soap,
|
||||||
"Requester must be a teacher");
|
"Requester must be a teacher");
|
||||||
|
|
||||||
/***** Query list of attendance users *****/
|
/***** Query list of attendance users *****/
|
||||||
if (Att_CheckIfAttEventIsAssociatedToGrps (Event.AttCod))
|
if (Grp_CheckIfAssociatedToGrps ("att_grp","AttCod",Event.AttCod))
|
||||||
// Event for one or more groups
|
// Event for one or more groups
|
||||||
// Subquery: list of users in groups of this attendance event...
|
// Subquery: list of users in groups of this attendance event...
|
||||||
// ...who have no entry in attendance list of users
|
// ...who have no entry in attendance list of users
|
||||||
|
|
|
@ -97,7 +97,6 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod);
|
||||||
static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigned NumUsrsToBeNotifiedByEMail);
|
static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigned NumUsrsToBeNotifiedByEMail);
|
||||||
static void Asg_CreateAssignment (struct Asg_Assignment *Asg,const char *Txt);
|
static void Asg_CreateAssignment (struct Asg_Assignment *Asg,const char *Txt);
|
||||||
static void Asg_UpdateAssignment (struct Asg_Assignment *Asg,const char *Txt);
|
static void Asg_UpdateAssignment (struct Asg_Assignment *Asg,const char *Txt);
|
||||||
static bool Asg_CheckIfAsgIsAssociatedToGrps (long AsgCod);
|
|
||||||
static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod);
|
static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod);
|
||||||
static void Asg_CreateGrps (long AsgCod);
|
static void Asg_CreateGrps (long AsgCod);
|
||||||
static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Asg_Assignment *Asg);
|
static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Asg_Assignment *Asg);
|
||||||
|
@ -1352,7 +1351,8 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod)
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Asg_CheckIfAsgIsAssociatedToGrps (AsgCod) ? "" : " checked=\"checked\"");
|
Grp_CheckIfAssociatedToGrps ("asg_grp","AsgCod",AsgCod) ? "" :
|
||||||
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -1364,7 +1364,7 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod)
|
||||||
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgAttSvyMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyEvtMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
AsgCod,Grp_ASSIGNMENT);
|
AsgCod,Grp_ASSIGNMENT);
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
|
@ -1602,33 +1602,6 @@ static void Asg_UpdateAssignment (struct Asg_Assignment *Asg,const char *Txt)
|
||||||
Asg_CreateGrps (Asg->AsgCod);
|
Asg_CreateGrps (Asg->AsgCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********** Check if an assignment is associated to any group ***************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static bool Asg_CheckIfAsgIsAssociatedToGrps (long AsgCod)
|
|
||||||
{
|
|
||||||
/***** Get if an assignment is associated to a group from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not check if an assignment"
|
|
||||||
" is associated to groups",
|
|
||||||
"SELECT COUNT(*) FROM asg_grp WHERE AsgCod=%ld",
|
|
||||||
AsgCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Check if an assignment is associated to a group ****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Asg_CheckIfAsgIsAssociatedToGrp (long AsgCod,long GrpCod)
|
|
||||||
{
|
|
||||||
/***** Get if an assignment is associated to a group from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not check if an assignment"
|
|
||||||
" is associated to a group",
|
|
||||||
"SELECT COUNT(*) FROM asg_grp"
|
|
||||||
" WHERE AsgCod=%ld AND GrpCod=%ld",
|
|
||||||
AsgCod,GrpCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Remove groups of an assignment ************************/
|
/********************* Remove groups of an assignment ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -96,7 +96,6 @@ void Asg_RemoveAssignment (void);
|
||||||
void Asg_HideAssignment (void);
|
void Asg_HideAssignment (void);
|
||||||
void Asg_ShowAssignment (void);
|
void Asg_ShowAssignment (void);
|
||||||
void Asg_ReceiveFormAssignment (void);
|
void Asg_ReceiveFormAssignment (void);
|
||||||
bool Asg_CheckIfAsgIsAssociatedToGrp (long AsgCod,long GrpCod);
|
|
||||||
void Asg_RemoveGroup (long GrpCod);
|
void Asg_RemoveGroup (long GrpCod);
|
||||||
void Asg_RemoveGroupsOfType (long GrpTypCod);
|
void Asg_RemoveGroupsOfType (long GrpTypCod);
|
||||||
void Asg_RemoveCrsAssignments (long CrsCod);
|
void Asg_RemoveCrsAssignments (long CrsCod);
|
||||||
|
|
|
@ -1266,7 +1266,8 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod)
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Att_CheckIfAttEventIsAssociatedToGrps (AttCod) ? "" : " checked=\"checked\"");
|
Grp_CheckIfAssociatedToGrps ("att_grp","AttCod",AttCod) ? "" :
|
||||||
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -1278,7 +1279,7 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod)
|
||||||
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgAttSvyMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyEvtMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
AttCod,Grp_ATT_EVENT);
|
AttCod,Grp_ATT_EVENT);
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
|
@ -1452,33 +1453,6 @@ void Att_UpdateAttEvent (struct Att_Event *Event,const char *Description)
|
||||||
Att_CreateGrps (Event->AttCod);
|
Att_CreateGrps (Event->AttCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******** Check if an attendance event is associated to any group ************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Att_CheckIfAttEventIsAssociatedToGrps (long AttCod)
|
|
||||||
{
|
|
||||||
/***** Get if an attendance event is associated to a group from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not check if an attendance event"
|
|
||||||
" is associated to groups",
|
|
||||||
"SELECT COUNT(*) FROM att_grp WHERE AttCod=%ld",
|
|
||||||
AttCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********* Check if an attendance event is associated to a group *************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Att_CheckIfAttEventIsAssociatedToGrp (long AttCod,long GrpCod)
|
|
||||||
{
|
|
||||||
/***** Get if an attendance event is associated to a group from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not check if an attendance event"
|
|
||||||
" is associated to a group",
|
|
||||||
"SELECT COUNT(*) FROM att_grp"
|
|
||||||
" WHERE AttCod=%ld AND GrpCod=%ld",
|
|
||||||
AttCod,GrpCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************** Remove groups of an attendance event *********************/
|
/****************** Remove groups of an attendance event *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -100,8 +100,6 @@ void Att_ShowAttEvent (void);
|
||||||
void Att_ReceiveFormAttEvent (void);
|
void Att_ReceiveFormAttEvent (void);
|
||||||
void Att_CreateAttEvent (struct Att_Event *Event,const char *Description);
|
void Att_CreateAttEvent (struct Att_Event *Event,const char *Description);
|
||||||
void Att_UpdateAttEvent (struct Att_Event *Event,const char *Description);
|
void Att_UpdateAttEvent (struct Att_Event *Event,const char *Description);
|
||||||
bool Att_CheckIfAttEventIsAssociatedToGrps (long AttCod);
|
|
||||||
bool Att_CheckIfAttEventIsAssociatedToGrp (long AsgCod,long GrpCod);
|
|
||||||
void Att_RemoveGroupsOfType (long GrpTypCod);
|
void Att_RemoveGroupsOfType (long GrpTypCod);
|
||||||
void Att_RemoveGroup (long GrpCod);
|
void Att_RemoveGroup (long GrpCod);
|
||||||
|
|
||||||
|
|
|
@ -544,10 +544,12 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.212 (2020-05-05)"
|
#define Log_PLATFORM_VERSION "SWAD 19.213 (2020-05-06)"
|
||||||
#define CSS_FILE "swad19.193.1.css"
|
#define CSS_FILE "swad19.193.1.css"
|
||||||
#define JS_FILE "swad19.193.1.js"
|
#define JS_FILE "swad19.193.1.js"
|
||||||
/*
|
/*
|
||||||
|
Version 19.213: May 06, 2020 Edition of exam event.
|
||||||
|
Code refactoring in groups. (301327 lines)
|
||||||
Version 19.212: May 05, 2020 Icon to edit exam event. (301319 lines)
|
Version 19.212: May 05, 2020 Icon to edit exam event. (301319 lines)
|
||||||
Version 19.211: May 05, 2020 Exam events can be hidden/unhidden. (301215 lines)
|
Version 19.211: May 05, 2020 Exam events can be hidden/unhidden. (301215 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
|
|
|
@ -84,7 +84,6 @@ void ExaSet_ChangeSetTitle (void);
|
||||||
void ExaSet_ChangeNumQstsToExam (void);
|
void ExaSet_ChangeNumQstsToExam (void);
|
||||||
|
|
||||||
void Exa_ReceiveFormExam (void);
|
void Exa_ReceiveFormExam (void);
|
||||||
bool Mch_CheckIfMatchIsAssociatedToGrp (long EvtCod,long GrpCod);
|
|
||||||
|
|
||||||
unsigned ExaSet_GetNumSetsExam (long ExaCod);
|
unsigned ExaSet_GetNumSetsExam (long ExaCod);
|
||||||
unsigned ExaSet_GetNumQstsExam (long ExaCod);
|
unsigned ExaSet_GetNumQstsExam (long ExaCod);
|
||||||
|
|
|
@ -145,14 +145,18 @@ static void ExaEvt_RemoveUsrEvtResultsInCrs (long UsrCod,long CrsCod,const char
|
||||||
static void ExaEvt_PutParamsPlay (void *EvtCod);
|
static void ExaEvt_PutParamsPlay (void *EvtCod);
|
||||||
static void ExaEvt_PutParamEvtCod (long EvtCod);
|
static void ExaEvt_PutParamEvtCod (long EvtCod);
|
||||||
|
|
||||||
static void ExaEvt_PutFormNewEvent (const struct ExaEvt_Event *Event);
|
static void ExaEvt_PutFormEvent (const struct ExaEvt_Event *Event);
|
||||||
static void ExaEvt_ShowLstGrpsToCreateEvent (void);
|
static void ExaEvt_ShowLstGrpsToCreateEvent (long EvtCod);
|
||||||
|
|
||||||
static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event);
|
static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event);
|
||||||
|
static void ExaEvt_UpdateEvent (struct ExaEvt_Event *Event);
|
||||||
|
|
||||||
// static void ExaEvt_CreateIndexes (long ExaCod,long EvtCod);
|
// static void ExaEvt_CreateIndexes (long ExaCod,long EvtCod);
|
||||||
// static void ExaEvt_ReorderAnswer (long EvtCod,unsigned QstInd,
|
// static void ExaEvt_ReorderAnswer (long EvtCod,unsigned QstInd,
|
||||||
// const struct Tst_Question *Question);
|
// const struct Tst_Question *Question);
|
||||||
static void ExaEvt_CreateGrps (long EvtCod);
|
static void ExaEvt_CreateGrps (long EvtCod);
|
||||||
|
static void ExaEvt_RemoveGroups (long EvtCod);
|
||||||
|
|
||||||
static void ExaEvt_UpdateEventStatusInDB (const struct ExaEvt_Event *Event);
|
static void ExaEvt_UpdateEventStatusInDB (const struct ExaEvt_Event *Event);
|
||||||
|
|
||||||
static void ExaEvt_UpdateElapsedTimeInQuestion (const struct ExaEvt_Event *Event);
|
static void ExaEvt_UpdateElapsedTimeInQuestion (const struct ExaEvt_Event *Event);
|
||||||
|
@ -387,7 +391,7 @@ void ExaEvt_ListEvents (struct Exa_Exams *Exams,
|
||||||
ExaEvt_MAX_BYTES_TITLE);
|
ExaEvt_MAX_BYTES_TITLE);
|
||||||
|
|
||||||
/* Put form to create new event */
|
/* Put form to create new event */
|
||||||
ExaEvt_PutFormNewEvent (Event); // Form to fill in data and start playing a new exam event
|
ExaEvt_PutFormEvent (Event); // Form to create event
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ExaEvt_PutButtonNewEvent (Exams,Exam->ExaCod); // Button to create a new exam event
|
ExaEvt_PutButtonNewEvent (Exams,Exam->ExaCod); // Button to create a new exam event
|
||||||
|
@ -552,7 +556,7 @@ static void ExaEvt_ListOneOrMoreEvents (struct Exa_Exams *Exams,
|
||||||
{
|
{
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
HTM_TD_Begin ("colspan=\"8\" class=\"CT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("colspan=\"8\" class=\"CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
Ale_ShowAlert (Ale_INFO,"Form to edit this event."); // TODO: Replace by form
|
ExaEvt_PutFormEvent (&Event); // Form to edit existing event
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -663,7 +667,7 @@ static void ExaEvt_ListOneOrMoreEventsIcons (struct Exa_Exams *Exams,
|
||||||
ExaEvt_PutParamsEdit,Exams);
|
ExaEvt_PutParamsEdit,Exams);
|
||||||
|
|
||||||
/***** Icon to edit the exam event *****/
|
/***** Icon to edit the exam event *****/
|
||||||
Ico_PutContextualIconToEdit (ActEdiOneExaEvt,NULL,
|
Ico_PutContextualIconToEdit (ActEdiOneExaEvt,Anchor,
|
||||||
ExaEvt_PutParamsEdit,Exams);
|
ExaEvt_PutParamsEdit,Exams);
|
||||||
|
|
||||||
/***** End cell *****/
|
/***** End cell *****/
|
||||||
|
@ -813,19 +817,6 @@ static void ExaEvt_GetAndWriteNamesOfGrpsAssociatedToEvent (const struct ExaEvt_
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********** Check if an exam event is associated to a given group ************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool ExaEvt_CheckIfMatchIsAssociatedToGrp (long EvtCod,long GrpCod)
|
|
||||||
{
|
|
||||||
/***** Get if an exam event is associated to a group from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not check if an exam event is associated to a group",
|
|
||||||
"SELECT COUNT(*) FROM exa_groups"
|
|
||||||
" WHERE EvtCod=%ld AND GrpCod=%ld",
|
|
||||||
EvtCod,GrpCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************** Put a column for number of participants ********************/
|
/**************** Put a column for number of participants ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1450,7 +1441,7 @@ long ExaEvt_GetParamEvtCod (void)
|
||||||
/* Put a big button to play exam event (start a new exam event) as a teacher */
|
/* Put a big button to play exam event (start a new exam event) as a teacher */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaEvt_PutFormNewEvent (const struct ExaEvt_Event *Event)
|
static void ExaEvt_PutFormEvent (const struct ExaEvt_Event *Event)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ASSESSMENT_Exams_events;
|
extern const char *Hlp_ASSESSMENT_Exams_events;
|
||||||
extern const char *Txt_New_event;
|
extern const char *Txt_New_event;
|
||||||
|
@ -1462,18 +1453,23 @@ static void ExaEvt_PutFormNewEvent (const struct ExaEvt_Event *Event)
|
||||||
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
[Dat_START_TIME] = Dat_HMS_DO_NOT_SET,
|
||||||
[Dat_END_TIME ] = Dat_HMS_DO_NOT_SET
|
[Dat_END_TIME ] = Dat_HMS_DO_NOT_SET
|
||||||
};
|
};
|
||||||
bool ItsANewEvent = true; // TODO: To be used also to edit existing events
|
bool ItsANewEvent = Event->EvtCod <= 0;
|
||||||
|
|
||||||
/***** Start section for a new exam event *****/
|
/***** Start section for a new exam event *****/
|
||||||
HTM_SECTION_Begin (ExaEvt_NEW_EVENT_SECTION_ID);
|
HTM_SECTION_Begin (ExaEvt_NEW_EVENT_SECTION_ID);
|
||||||
|
|
||||||
/***** Begin form *****/
|
/***** Begin form *****/
|
||||||
Frm_StartForm (ActNewExaEvt);
|
Frm_StartForm (ItsANewEvent ? ActNewExaEvt : // New event
|
||||||
|
ActChgExaEvt); // Existing event
|
||||||
Exa_PutParamExamCod (Event->ExaCod);
|
Exa_PutParamExamCod (Event->ExaCod);
|
||||||
Exa_PutParamQstInd (0); // Start by first question in exam
|
if (!ItsANewEvent) // Existing event
|
||||||
|
ExaEvt_PutParamEvtCod (Event->EvtCod);
|
||||||
|
|
||||||
|
// Exa_PutParamQstInd (0); // Start by first question in exam
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
/***** Begin box and table *****/
|
||||||
Box_BoxTableBegin (NULL,Txt_New_event,
|
Box_BoxTableBegin (NULL,ItsANewEvent ? Txt_New_event :
|
||||||
|
Event->Title,
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
Hlp_ASSESSMENT_Exams_events,Box_NOT_CLOSABLE,2);
|
Hlp_ASSESSMENT_Exams_events,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
|
@ -1498,7 +1494,7 @@ static void ExaEvt_PutFormNewEvent (const struct ExaEvt_Event *Event)
|
||||||
SetHMS);
|
SetHMS);
|
||||||
|
|
||||||
/***** Groups *****/
|
/***** Groups *****/
|
||||||
ExaEvt_ShowLstGrpsToCreateEvent ();
|
ExaEvt_ShowLstGrpsToCreateEvent (Event->EvtCod);
|
||||||
|
|
||||||
/***** End table, send button and end box *****/
|
/***** End table, send button and end box *****/
|
||||||
if (ItsANewEvent)
|
if (ItsANewEvent)
|
||||||
|
@ -1517,7 +1513,7 @@ static void ExaEvt_PutFormNewEvent (const struct ExaEvt_Event *Event)
|
||||||
/************** Show list of groups to create a new exam event ***************/
|
/************** Show list of groups to create a new exam event ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaEvt_ShowLstGrpsToCreateEvent (void)
|
static void ExaEvt_ShowLstGrpsToCreateEvent (long EvtCod)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
||||||
extern const char *Txt_Groups;
|
extern const char *Txt_Groups;
|
||||||
|
@ -1547,8 +1543,10 @@ static void ExaEvt_ShowLstGrpsToCreateEvent (void)
|
||||||
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
|
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
|
||||||
HTM_LABEL_Begin (NULL);
|
HTM_LABEL_Begin (NULL);
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\" checked=\"checked\""
|
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||||
" onclick=\"uncheckChildren(this,'GrpCods')\"");
|
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
|
Grp_CheckIfAssociatedToGrps ("exa_groups","EvtCod",EvtCod) ? "" :
|
||||||
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -1560,9 +1558,9 @@ static void ExaEvt_ShowLstGrpsToCreateEvent (void)
|
||||||
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgAttSvyMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyEvtMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
-1L, // -1 means "New exam event"
|
EvtCod,
|
||||||
Grp_MATCH);
|
Grp_EXA_EVENT);
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
Box_BoxTableEnd ();
|
Box_BoxTableEnd ();
|
||||||
|
@ -1645,21 +1643,46 @@ void ExaEvt_RequestCreatOrEditEvent (void)
|
||||||
void ExaEvt_ReceiveFormEvent (void)
|
void ExaEvt_ReceiveFormEvent (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Created_new_event_X;
|
extern const char *Txt_Created_new_event_X;
|
||||||
|
extern const char *Txt_The_event_has_been_modified;
|
||||||
struct Exa_Exams Exams;
|
struct Exa_Exams Exams;
|
||||||
struct Exa_Exam Exam;
|
struct Exa_Exam Exam;
|
||||||
struct ExaEvt_Event Event;
|
struct ExaEvt_Event Event;
|
||||||
|
bool ItsANewEvent;
|
||||||
|
|
||||||
/***** Reset exams context *****/
|
/***** Reset exams context *****/
|
||||||
Exa_ResetExams (&Exams);
|
Exa_ResetExams (&Exams);
|
||||||
Exa_ResetExam (&Exam);
|
Exa_ResetExam (&Exam);
|
||||||
ExaEvt_ResetEvent (&Event);
|
ExaEvt_ResetEvent (&Event);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get main parameters *****/
|
||||||
/* Get context */
|
|
||||||
Exa_GetParams (&Exams);
|
Exa_GetParams (&Exams);
|
||||||
if (Exams.ExaCod <= 0)
|
if (Exams.ExaCod <= 0)
|
||||||
Lay_WrongExamExit ();
|
Lay_WrongExamExit ();
|
||||||
|
Exam.ExaCod = Exams.ExaCod;
|
||||||
|
Grp_GetParamWhichGroups ();
|
||||||
|
Event.EvtCod = ExaEvt_GetParamEvtCod ();
|
||||||
|
ItsANewEvent = (Event.EvtCod <= 0);
|
||||||
|
|
||||||
|
/***** Get exam data from database *****/
|
||||||
|
Exa_GetDataOfExamByCod (&Exam);
|
||||||
|
if (Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||||
|
Lay_WrongExamExit ();
|
||||||
|
Exams.ExaCod = Exam.ExaCod;
|
||||||
|
|
||||||
|
/***** Get event data from database *****/
|
||||||
|
if (ItsANewEvent)
|
||||||
|
/* Initialize to empty event */
|
||||||
|
ExaEvt_ResetEvent (&Event);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Get event data from database */
|
||||||
|
ExaEvt_GetDataOfEventByCod (&Event);
|
||||||
|
if (Exam.ExaCod != Event.ExaCod)
|
||||||
|
Lay_WrongExamExit ();
|
||||||
|
Exams.EvtCod = Event.EvtCod;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Get parameters from form *****/
|
||||||
/* Get event title */
|
/* Get event title */
|
||||||
Par_GetParToText ("Title",Event.Title,ExaEvt_MAX_BYTES_TITLE);
|
Par_GetParToText ("Title",Event.Title,ExaEvt_MAX_BYTES_TITLE);
|
||||||
|
|
||||||
|
@ -1670,22 +1693,21 @@ void ExaEvt_ReceiveFormEvent (void)
|
||||||
/* Get groups associated to the event */
|
/* Get groups associated to the event */
|
||||||
Grp_GetParCodsSeveralGrps ();
|
Grp_GetParCodsSeveralGrps ();
|
||||||
|
|
||||||
/***** Get exam data from database *****/
|
/***** Create/update event *****/
|
||||||
Exam.ExaCod = Exams.ExaCod;
|
if (ItsANewEvent)
|
||||||
Exa_GetDataOfExamByCod (&Exam);
|
ExaEvt_CreateEvent (&Event);
|
||||||
if (Exam.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
else
|
||||||
Lay_WrongExamExit ();
|
ExaEvt_UpdateEvent (&Event);
|
||||||
Event.ExaCod = Exams.ExaCod = Exam.ExaCod;
|
|
||||||
|
|
||||||
/***** Create a new exam event *****/
|
|
||||||
ExaEvt_CreateEvent (&Event);
|
|
||||||
|
|
||||||
/***** Free memory for list of selected groups *****/
|
/***** Free memory for list of selected groups *****/
|
||||||
Grp_FreeListCodSelectedGrps ();
|
Grp_FreeListCodSelectedGrps ();
|
||||||
|
|
||||||
/***** Write message *****/
|
/***** Write success message *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_event_X,
|
if (ItsANewEvent)
|
||||||
Event.Title);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_event_X,
|
||||||
|
Event.Title);
|
||||||
|
else
|
||||||
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_event_has_been_modified);
|
||||||
|
|
||||||
/***** Show current exam *****/
|
/***** Show current exam *****/
|
||||||
Exa_ShowOnlyOneExam (&Exams,&Exam,&Event,
|
Exa_ShowOnlyOneExam (&Exams,&Exam,&Event,
|
||||||
|
@ -1726,7 +1748,7 @@ void ExaEvt_ResumeEvent (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Create a new exam event in an exam **********************/
|
/**************************** Create a new event *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event)
|
static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event)
|
||||||
|
@ -1735,7 +1757,7 @@ static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event)
|
||||||
Event->EvtCod =
|
Event->EvtCod =
|
||||||
DB_QueryINSERTandReturnCode ("can not create exam event",
|
DB_QueryINSERTandReturnCode ("can not create exam event",
|
||||||
"INSERT exa_events "
|
"INSERT exa_events "
|
||||||
"(ExaCod,UsrCod,StartTime,EndTime,Title,"
|
"(ExaCod,UsrCod,StartTime,EndTime,Title,Hidden,"
|
||||||
"QstInd,QstCod,Showing,Countdown,"
|
"QstInd,QstCod,Showing,Countdown,"
|
||||||
"NumCols,ShowQstResults,ShowUsrResults)"
|
"NumCols,ShowQstResults,ShowUsrResults)"
|
||||||
" VALUES "
|
" VALUES "
|
||||||
|
@ -1744,6 +1766,7 @@ static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event)
|
||||||
"FROM_UNIXTIME(%ld)," // Start time
|
"FROM_UNIXTIME(%ld)," // Start time
|
||||||
"FROM_UNIXTIME(%ld)," // End time
|
"FROM_UNIXTIME(%ld)," // End time
|
||||||
"'%s'," // Title
|
"'%s'," // Title
|
||||||
|
"'%c',"
|
||||||
"0," // QstInd: Event has not started, so not the first question yet
|
"0," // QstInd: Event has not started, so not the first question yet
|
||||||
"-1," // QstCod: Non-existent question
|
"-1," // QstCod: Non-existent question
|
||||||
"'%s', " // Showing: What is being shown
|
"'%s', " // Showing: What is being shown
|
||||||
|
@ -1756,6 +1779,8 @@ static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event)
|
||||||
Event->TimeUTC[Dat_START_TIME], // Start time
|
Event->TimeUTC[Dat_START_TIME], // Start time
|
||||||
Event->TimeUTC[Dat_END_TIME ], // End time
|
Event->TimeUTC[Dat_END_TIME ], // End time
|
||||||
Event->Title,
|
Event->Title,
|
||||||
|
Event->Hidden ? 'Y' :
|
||||||
|
'N',
|
||||||
ExaEvt_ShowingStringsDB[ExaEvt_SHOWING_DEFAULT],
|
ExaEvt_ShowingStringsDB[ExaEvt_SHOWING_DEFAULT],
|
||||||
ExaEvt_NUM_COLS_DEFAULT);
|
ExaEvt_NUM_COLS_DEFAULT);
|
||||||
|
|
||||||
|
@ -1767,6 +1792,35 @@ static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event)
|
||||||
ExaEvt_CreateGrps (Event->EvtCod);
|
ExaEvt_CreateGrps (Event->EvtCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************* Update an existing event **************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaEvt_UpdateEvent (struct ExaEvt_Event *Event)
|
||||||
|
{
|
||||||
|
/***** Insert this new exam event into database *****/
|
||||||
|
DB_QueryUPDATE ("can not update exam event",
|
||||||
|
"UPDATE exa_events,exa_exams"
|
||||||
|
" SET exa_events.StartTime=FROM_UNIXTIME(%ld),"
|
||||||
|
"exa_events.EndTime=FROM_UNIXTIME(%ld),"
|
||||||
|
"exa_events.Title='%s',"
|
||||||
|
"exa_events.Hidden='%c'"
|
||||||
|
" WHERE exa_events.EvtCod=%ld"
|
||||||
|
" AND exa_events.ExaCod=exa_exams.ExaCod"
|
||||||
|
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||||
|
Event->TimeUTC[Dat_START_TIME], // Start time
|
||||||
|
Event->TimeUTC[Dat_END_TIME ], // End time
|
||||||
|
Event->Title,
|
||||||
|
Event->Hidden ? 'Y' :
|
||||||
|
'N',
|
||||||
|
Event->EvtCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
|
||||||
|
/***** Update groups associated to the exam event *****/
|
||||||
|
ExaEvt_RemoveGroups (Event->EvtCod); // Remove all groups associated to this event
|
||||||
|
if (Gbl.Crs.Grps.LstGrpsSel.NumGrps)
|
||||||
|
ExaEvt_CreateGrps (Event->EvtCod); // Associate new groups
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Create indexes for an exam event ***********************/
|
/******************** Create indexes for an exam event ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1960,6 +2014,18 @@ static void ExaEvt_CreateGrps (long EvtCod)
|
||||||
EvtCod,Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
EvtCod,Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************* Remove all groups from one event **********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void ExaEvt_RemoveGroups (long EvtCod)
|
||||||
|
{
|
||||||
|
/***** Remove all groups from one event *****/
|
||||||
|
DB_QueryDELETE ("can not remove groups associated to and event",
|
||||||
|
"DELETE FROM exa_groups WHERE EvtCod=%ld",
|
||||||
|
EvtCod);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Remove one group from all events **********************/
|
/********************* Remove one group from all events **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -134,7 +134,6 @@ void Gam_UnhideGame (void);
|
||||||
void Gam_RequestCreatOrEditGame (void);
|
void Gam_RequestCreatOrEditGame (void);
|
||||||
|
|
||||||
void Gam_ReceiveFormGame (void);
|
void Gam_ReceiveFormGame (void);
|
||||||
bool Mch_CheckIfMatchIsAssociatedToGrp (long MchCod,long GrpCod);
|
|
||||||
|
|
||||||
unsigned Gam_GetNumQstsGame (long GamCod);
|
unsigned Gam_GetNumQstsGame (long GamCod);
|
||||||
|
|
||||||
|
|
79
swad_group.c
79
swad_group.c
|
@ -35,6 +35,7 @@
|
||||||
#include "swad_attendance.h"
|
#include "swad_attendance.h"
|
||||||
#include "swad_box.h"
|
#include "swad_box.h"
|
||||||
#include "swad_database.h"
|
#include "swad_database.h"
|
||||||
|
#include "swad_exam_event.h"
|
||||||
#include "swad_form.h"
|
#include "swad_form.h"
|
||||||
#include "swad_game.h"
|
#include "swad_game.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
|
@ -120,6 +121,8 @@ static void Grp_WriteHeadingGroupTypes (void);
|
||||||
|
|
||||||
static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms);
|
static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms);
|
||||||
static void Grp_WriteHeadingGroups (void);
|
static void Grp_WriteHeadingGroups (void);
|
||||||
|
static bool Grp_CheckIfAssociatedToGrp (const char *Table,const char *Field,
|
||||||
|
long Cod,long GrpCod);
|
||||||
static void Grp_PutIconToEditGroups (__attribute__((unused)) void *Args);
|
static void Grp_PutIconToEditGroups (__attribute__((unused)) void *Args);
|
||||||
|
|
||||||
static void Grp_ShowWarningToStdsToChangeGrps (void);
|
static void Grp_ShowWarningToStdsToChangeGrps (void);
|
||||||
|
@ -1681,18 +1684,30 @@ static void Grp_WriteHeadingGroups (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******** List groups of a type **********/
|
/****** List groups of a type to edit ******/
|
||||||
/******** to edit assignments, attendance events, surveys or matches *********/
|
/****** assignments, attendance events, surveys, exam events or matches ******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Grp_ListGrpsToEditAsgAttSvyMch (struct GroupType *GrpTyp,long Cod,
|
void Grp_ListGrpsToEditAsgAttSvyEvtMch (struct GroupType *GrpTyp,long Cod,
|
||||||
Grp_AsgAttSvyGam_t Grp_AsgAttOrSvy)
|
Grp_WhichIsAssociatedToGrp_t WhichIsAssociatedToGrp)
|
||||||
{
|
{
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
const char *Table;
|
||||||
|
const char *Field;
|
||||||
|
} AssociationsToGrps[Grp_NUM_ASSOCIATIONS_TO_GROUPS] =
|
||||||
|
{
|
||||||
|
[Grp_ASSIGNMENT] = {"asg_grp" ,"AsgCod"},
|
||||||
|
[Grp_ATT_EVENT ] = {"att_grp" ,"AttCod"},
|
||||||
|
[Grp_SURVEY ] = {"svy_grp" ,"SvyCod"},
|
||||||
|
[Grp_EXA_EVENT ] = {"exa_groups","EvtCod"},
|
||||||
|
[Grp_MATCH ] = {"mch_groups","MchCod"},
|
||||||
|
};
|
||||||
struct ListCodGrps LstGrpsIBelong;
|
struct ListCodGrps LstGrpsIBelong;
|
||||||
unsigned NumGrpThisType;
|
unsigned NumGrpThisType;
|
||||||
bool IBelongToThisGroup;
|
bool IBelongToThisGroup;
|
||||||
struct Group *Grp;
|
struct Group *Grp;
|
||||||
bool AssociatedToGrp = false;
|
bool AssociatedToGrp;
|
||||||
|
|
||||||
/***** Write heading *****/
|
/***** Write heading *****/
|
||||||
Grp_WriteGrpHead (GrpTyp);
|
Grp_WriteGrpHead (GrpTyp);
|
||||||
|
@ -1709,23 +1724,12 @@ void Grp_ListGrpsToEditAsgAttSvyMch (struct GroupType *GrpTyp,long Cod,
|
||||||
Grp = &(GrpTyp->LstGrps[NumGrpThisType]);
|
Grp = &(GrpTyp->LstGrps[NumGrpThisType]);
|
||||||
IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong);
|
IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong);
|
||||||
|
|
||||||
AssociatedToGrp = false;
|
if (Cod > 0) // Cod == -1L means new item, assignment, event, survey, exam event or match
|
||||||
if (Cod > 0) // Cod == -1L means new item, assignment, event, survey or match
|
AssociatedToGrp = Grp_CheckIfAssociatedToGrp (AssociationsToGrps[WhichIsAssociatedToGrp].Table,
|
||||||
switch (Grp_AsgAttOrSvy)
|
AssociationsToGrps[WhichIsAssociatedToGrp].Field,
|
||||||
{
|
Cod,Grp->GrpCod);
|
||||||
case Grp_ASSIGNMENT:
|
else
|
||||||
AssociatedToGrp = Asg_CheckIfAsgIsAssociatedToGrp (Cod,Grp->GrpCod);
|
AssociatedToGrp = false;
|
||||||
break;
|
|
||||||
case Grp_ATT_EVENT:
|
|
||||||
AssociatedToGrp = Att_CheckIfAttEventIsAssociatedToGrp (Cod,Grp->GrpCod);
|
|
||||||
break;
|
|
||||||
case Grp_SURVEY:
|
|
||||||
AssociatedToGrp = Svy_CheckIfSvyIsAssociatedToGrp (Cod,Grp->GrpCod);
|
|
||||||
break;
|
|
||||||
case Grp_MATCH:
|
|
||||||
AssociatedToGrp = Mch_CheckIfMatchIsAssociatedToGrp (Cod,Grp->GrpCod);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Put checkbox to select the group */
|
/* Put checkbox to select the group */
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
@ -1752,6 +1756,37 @@ void Grp_ListGrpsToEditAsgAttSvyMch (struct GroupType *GrpTyp,long Cod,
|
||||||
Grp_FreeListCodGrp (&LstGrpsIBelong);
|
Grp_FreeListCodGrp (&LstGrpsIBelong);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Check if an assignment is associated to a group ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static bool Grp_CheckIfAssociatedToGrp (const char *Table,const char *Field,
|
||||||
|
long Cod,long GrpCod)
|
||||||
|
{
|
||||||
|
/***** Get if an assignment, attendance event, survey, exam event or match
|
||||||
|
is associated to a given group from database *****/
|
||||||
|
return (DB_QueryCOUNT ("can not check if associated to a group",
|
||||||
|
"SELECT COUNT(*) FROM %s"
|
||||||
|
" WHERE %s=%ld AND GrpCod=%ld",
|
||||||
|
Table,Field,Cod,GrpCod) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*************** Check if a survey is associated to any group ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
bool Grp_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod)
|
||||||
|
{
|
||||||
|
/***** Get if an assignment, attendance event, survey, exam event or match
|
||||||
|
is associated to any group from database *****/
|
||||||
|
return (DB_QueryCOUNT ("can not check if associated to groups",
|
||||||
|
"SELECT COUNT(*) FROM %s"
|
||||||
|
" WHERE %s=%ld",
|
||||||
|
Table,Field,Cod) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Show list of groups to register/remove me *****************/
|
/***************** Show list of groups to register/remove me *****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -132,13 +132,15 @@ typedef enum
|
||||||
} Grp_WhichGroups_t;
|
} Grp_WhichGroups_t;
|
||||||
#define Grp_WHICH_GROUPS_DEFAULT Grp_ALL_GROUPS
|
#define Grp_WHICH_GROUPS_DEFAULT Grp_ALL_GROUPS
|
||||||
|
|
||||||
|
#define Grp_NUM_ASSOCIATIONS_TO_GROUPS 5
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Grp_ASSIGNMENT,
|
Grp_ASSIGNMENT,
|
||||||
Grp_ATT_EVENT,
|
Grp_ATT_EVENT,
|
||||||
Grp_SURVEY,
|
Grp_SURVEY,
|
||||||
|
Grp_EXA_EVENT,
|
||||||
Grp_MATCH,
|
Grp_MATCH,
|
||||||
} Grp_AsgAttSvyGam_t;
|
} Grp_WhichIsAssociatedToGrp_t;
|
||||||
|
|
||||||
struct Grp_Groups
|
struct Grp_Groups
|
||||||
{
|
{
|
||||||
|
@ -178,9 +180,10 @@ void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGr
|
||||||
unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps);
|
unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps);
|
||||||
void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod);
|
void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod);
|
||||||
void Grp_RemUsrFromAllGrps (long UsrCod);
|
void Grp_RemUsrFromAllGrps (long UsrCod);
|
||||||
void Grp_ListGrpsToEditAsgAttSvyMch (struct GroupType *GrpTyp,long Cod,
|
void Grp_ListGrpsToEditAsgAttSvyEvtMch (struct GroupType *GrpTyp,long Cod,
|
||||||
Grp_AsgAttSvyGam_t Grp_AsgOrSvy);
|
Grp_WhichIsAssociatedToGrp_t WhichIsAssociatedToGrp);
|
||||||
|
|
||||||
|
bool Grp_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod);
|
||||||
void Grp_ReqRegisterInGrps (void);
|
void Grp_ReqRegisterInGrps (void);
|
||||||
void Grp_ShowLstGrpsToChgMyGrps (void);
|
void Grp_ShowLstGrpsToChgMyGrps (void);
|
||||||
void Grp_ShowLstGrpsToChgOtherUsrsGrps (long UsrCod);
|
void Grp_ShowLstGrpsToChgOtherUsrsGrps (long UsrCod);
|
||||||
|
|
15
swad_match.c
15
swad_match.c
|
@ -745,19 +745,6 @@ static void Mch_GetAndWriteNamesOfGrpsAssociatedToMatch (const struct Mch_Match
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************* Check if a match is associated to a given group ***************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Mch_CheckIfMatchIsAssociatedToGrp (long MchCod,long GrpCod)
|
|
||||||
{
|
|
||||||
/***** Get if a match is associated to a group from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not check if a match is associated to a group",
|
|
||||||
"SELECT COUNT(*) FROM mch_groups"
|
|
||||||
" WHERE MchCod=%ld AND GrpCod=%ld",
|
|
||||||
MchCod,GrpCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Put a column for number of players **********************/
|
/******************* Put a column for number of players **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1418,7 +1405,7 @@ static void Mch_ShowLstGrpsToCreateMatch (void)
|
||||||
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgAttSvyMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyEvtMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
-1L, // -1 means "New match"
|
-1L, // -1 means "New match"
|
||||||
Grp_MATCH);
|
Grp_MATCH);
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,6 @@ static void Svy_UpdateNumUsrsNotifiedByEMailAboutSurvey (long SvyCod,
|
||||||
unsigned NumUsrsToBeNotifiedByEMail);
|
unsigned NumUsrsToBeNotifiedByEMail);
|
||||||
static void Svy_CreateSurvey (struct Svy_Survey *Svy,const char *Txt);
|
static void Svy_CreateSurvey (struct Svy_Survey *Svy,const char *Txt);
|
||||||
static void Svy_UpdateSurvey (struct Svy_Survey *Svy,const char *Txt);
|
static void Svy_UpdateSurvey (struct Svy_Survey *Svy,const char *Txt);
|
||||||
static bool Svy_CheckIfSvyIsAssociatedToGrps (long SvyCod);
|
|
||||||
static void Svy_RemoveAllTheGrpsAssociatedToAndSurvey (long SvyCod);
|
static void Svy_RemoveAllTheGrpsAssociatedToAndSurvey (long SvyCod);
|
||||||
static void Svy_CreateGrps (long SvyCod);
|
static void Svy_CreateGrps (long SvyCod);
|
||||||
static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Svy_Survey *Svy);
|
static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Svy_Survey *Svy);
|
||||||
|
@ -2155,8 +2154,8 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod)
|
||||||
HTM_LABEL_Begin (NULL);
|
HTM_LABEL_Begin (NULL);
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s onclick=\"uncheckChildren(this,'GrpCods')\"",
|
"id=\"WholeCrs\" value=\"Y\"%s onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Svy_CheckIfSvyIsAssociatedToGrps (SvyCod) ? "" :
|
Grp_CheckIfAssociatedToGrps ("svy_grp","SvyCod",SvyCod) ? "" :
|
||||||
" checked=\"checked\"");
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -2168,8 +2167,8 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod)
|
||||||
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgAttSvyMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyEvtMch (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
SvyCod,Grp_SURVEY);
|
SvyCod,Grp_SURVEY);
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
Box_BoxTableEnd ();
|
Box_BoxTableEnd ();
|
||||||
|
@ -2416,32 +2415,6 @@ static void Svy_UpdateSurvey (struct Svy_Survey *Svy,const char *Txt)
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_survey_has_been_modified);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_survey_has_been_modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*************** Check if a survey is associated to any group ****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static bool Svy_CheckIfSvyIsAssociatedToGrps (long SvyCod)
|
|
||||||
{
|
|
||||||
/***** Get if a survey is associated to a group from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not check if a survey is associated to groups",
|
|
||||||
"SELECT COUNT(*) FROM svy_grp"
|
|
||||||
" WHERE SvyCod=%ld",
|
|
||||||
SvyCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**************** Check if a survey is associated to a group *****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Svy_CheckIfSvyIsAssociatedToGrp (long SvyCod,long GrpCod)
|
|
||||||
{
|
|
||||||
/***** Get if a survey is associated to a group from database *****/
|
|
||||||
return (DB_QueryCOUNT ("can not check if a survey is associated to a group",
|
|
||||||
"SELECT COUNT(*) FROM svy_grp"
|
|
||||||
" WHERE SvyCod=%ld AND GrpCod=%ld",
|
|
||||||
SvyCod,GrpCod) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************* Remove groups of a survey *************************/
|
/************************* Remove groups of a survey *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -108,7 +108,6 @@ void Svy_ResetSurvey (void);
|
||||||
void Svy_HideSurvey (void);
|
void Svy_HideSurvey (void);
|
||||||
void Svy_UnhideSurvey (void);
|
void Svy_UnhideSurvey (void);
|
||||||
void Svy_ReceiveFormSurvey (void);
|
void Svy_ReceiveFormSurvey (void);
|
||||||
bool Svy_CheckIfSvyIsAssociatedToGrp (long SvyCod,long GrpCod);
|
|
||||||
void Svy_RemoveGroup (long GrpCod);
|
void Svy_RemoveGroup (long GrpCod);
|
||||||
void Svy_RemoveGroupsOfType (long GrpTypCod);
|
void Svy_RemoveGroupsOfType (long GrpTypCod);
|
||||||
void Svy_RemoveSurveys (Hie_Level_t Scope,long Cod);
|
void Svy_RemoveSurveys (Hie_Level_t Scope,long Cod);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user