mirror of https://github.com/acanas/swad-core.git
Version 22.39: Oct 02, 2022 Code refactoring and changes in layout of attendance events.
This commit is contained in:
parent
a33d4f9206
commit
660af0abcc
|
@ -92,14 +92,12 @@ static void Att_PutButtonToCreateNewAttEvent (struct Att_Events *Events);
|
||||||
static void Att_PutParamsToCreateNewAttEvent (void *Events);
|
static void Att_PutParamsToCreateNewAttEvent (void *Events);
|
||||||
static void Att_PutParamsToListUsrsAttendance (void *Events);
|
static void Att_PutParamsToListUsrsAttendance (void *Events);
|
||||||
|
|
||||||
static void Att_ShowOneAttEvent (struct Att_Events *Events,
|
static void Att_ShowOneAttEventRow (struct Att_Events *Events,
|
||||||
struct Att_Event *Event,
|
bool ShowOnlyThisAttEventComplete);
|
||||||
bool ShowOnlyThisAttEventComplete);
|
|
||||||
static void Att_WriteAttEventAuthor (struct Att_Event *Event);
|
static void Att_WriteAttEventAuthor (struct Att_Event *Event);
|
||||||
static Dat_StartEndTime_t Att_GetParamAttOrder (void);
|
static Dat_StartEndTime_t Att_GetParamAttOrder (void);
|
||||||
|
|
||||||
static void Att_PutFormsToRemEditOneAttEvent (struct Att_Events *Events,
|
static void Att_PutFormsToRemEditOneAttEvent (struct Att_Events *Events,
|
||||||
const struct Att_Event *Event,
|
|
||||||
const char *Anchor);
|
const char *Anchor);
|
||||||
static void Att_PutParams (void *Events);
|
static void Att_PutParams (void *Events);
|
||||||
static void Att_GetListAttEvents (struct Att_Events *Events,
|
static void Att_GetListAttEvents (struct Att_Events *Events,
|
||||||
|
@ -118,8 +116,7 @@ static void Att_ShowEvent (struct Att_Events *Events);
|
||||||
static void Att_PutIconsOneAtt (void *Events);
|
static void Att_PutIconsOneAtt (void *Events);
|
||||||
|
|
||||||
static void Att_ListAttOnlyMeAsStudent (struct Att_Event *Event);
|
static void Att_ListAttOnlyMeAsStudent (struct Att_Event *Event);
|
||||||
static void Att_ListAttStudents (struct Att_Events *Events,
|
static void Att_ListAttStudents (struct Att_Events *Events);
|
||||||
struct Att_Event *Event);
|
|
||||||
static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
|
static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
|
||||||
struct Usr_Data *UsrDat,
|
struct Usr_Data *UsrDat,
|
||||||
struct Att_Event *Event);
|
struct Att_Event *Event);
|
||||||
|
@ -146,22 +143,22 @@ static void Att_PutIconsStdsAttList (void *Events);
|
||||||
static void Att_PutParamsToPrintStdsList (void *Events);
|
static void Att_PutParamsToPrintStdsList (void *Events);
|
||||||
|
|
||||||
static void Att_PutButtonToShowDetails (const struct Att_Events *Events);
|
static void Att_PutButtonToShowDetails (const struct Att_Events *Events);
|
||||||
static void Att_ListEventsToSelect (const struct Att_Events *Events,
|
static void Att_ListEventsToSelect (struct Att_Events *Events,
|
||||||
Att_TypeOfView_t TypeOfView);
|
Att_TypeOfView_t TypeOfView);
|
||||||
static void Att_PutIconToViewAttEvents (__attribute__((unused)) void *Args);
|
static void Att_PutIconToViewAttEvents (__attribute__((unused)) void *Args);
|
||||||
static void Att_PutIconToEditAttEvents (__attribute__((unused)) void *Args);
|
static void Att_PutIconToEditAttEvents (__attribute__((unused)) void *Args);
|
||||||
static void Att_ListUsrsAttendanceTable (const struct Att_Events *Events,
|
static void Att_ListUsrsAttendanceTable (struct Att_Events *Events,
|
||||||
Att_TypeOfView_t TypeOfView,
|
Att_TypeOfView_t TypeOfView,
|
||||||
unsigned NumUsrsInList,
|
unsigned NumUsrsInList,
|
||||||
long *LstSelectedUsrCods);
|
long *LstSelectedUsrCods);
|
||||||
static void Att_WriteTableHeadSeveralAttEvents (const struct Att_Events *Events);
|
static void Att_WriteTableHeadSeveralAttEvents (struct Att_Events *Events);
|
||||||
static void Att_WriteRowUsrSeveralAttEvents (const struct Att_Events *Events,
|
static void Att_WriteRowUsrSeveralAttEvents (const struct Att_Events *Events,
|
||||||
unsigned NumUsr,struct Usr_Data *UsrDat);
|
unsigned NumUsr,struct Usr_Data *UsrDat);
|
||||||
static void Att_PutCheckOrCross (bool Present);
|
static void Att_PutCheckOrCross (bool Present);
|
||||||
static void Att_ListStdsWithAttEventsDetails (const struct Att_Events *Events,
|
static void Att_ListStdsWithAttEventsDetails (struct Att_Events *Events,
|
||||||
unsigned NumUsrsInList,
|
unsigned NumUsrsInList,
|
||||||
long *LstSelectedUsrCods);
|
long *LstSelectedUsrCods);
|
||||||
static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
|
static void Att_ListAttEventsForAStd (struct Att_Events *Events,
|
||||||
unsigned NumUsr,struct Usr_Data *UsrDat);
|
unsigned NumUsr,struct Usr_Data *UsrDat);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -174,7 +171,7 @@ static void Att_ResetEvents (struct Att_Events *Events)
|
||||||
Events->Num = 0; // Number of attendance events
|
Events->Num = 0; // Number of attendance events
|
||||||
Events->Lst = NULL; // List of attendance events
|
Events->Lst = NULL; // List of attendance events
|
||||||
Events->SelectedOrder = Att_ORDER_DEFAULT;
|
Events->SelectedOrder = Att_ORDER_DEFAULT;
|
||||||
Events->AttCod = -1L;
|
Events->Event.AttCod = -1L;
|
||||||
Events->ShowDetails = false;
|
Events->ShowDetails = false;
|
||||||
Events->StrAttCodsSelected = NULL;
|
Events->StrAttCodsSelected = NULL;
|
||||||
Events->CurrentPage = 0;
|
Events->CurrentPage = 0;
|
||||||
|
@ -292,9 +289,16 @@ static void Att_ShowAllAttEvents (struct Att_Events *Events)
|
||||||
for (NumAttEvent = Pagination.FirstItemVisible, The_ResetRowColor ();
|
for (NumAttEvent = Pagination.FirstItemVisible, The_ResetRowColor ();
|
||||||
NumAttEvent <= Pagination.LastItemVisible;
|
NumAttEvent <= Pagination.LastItemVisible;
|
||||||
NumAttEvent++, The_ChangeRowColor ())
|
NumAttEvent++, The_ChangeRowColor ())
|
||||||
Att_ShowOneAttEvent (Events,
|
{
|
||||||
&Events->Lst[NumAttEvent - 1],
|
/***** Get data of this attendance event *****/
|
||||||
false);
|
Events->Event.AttCod = Events->Lst[NumAttEvent - 1].AttCod;
|
||||||
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Events->Event);
|
||||||
|
Events->Event.NumStdsTotal = Att_DB_GetNumStdsTotalWhoAreInAttEvent (Events->Event.AttCod);
|
||||||
|
|
||||||
|
/***** Show one attendance event *****/
|
||||||
|
Att_ShowOneAttEventRow (Events,
|
||||||
|
false); // Don't show only this event
|
||||||
|
}
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
@ -443,9 +447,8 @@ static void Att_PutParamsToListUsrsAttendance (void *Events)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Only Event->AttCod must be filled
|
// Only Event->AttCod must be filled
|
||||||
|
|
||||||
static void Att_ShowOneAttEvent (struct Att_Events *Events,
|
static void Att_ShowOneAttEventRow (struct Att_Events *Events,
|
||||||
struct Att_Event *Event,
|
bool ShowOnlyThisAttEventComplete)
|
||||||
bool ShowOnlyThisAttEventComplete)
|
|
||||||
{
|
{
|
||||||
extern const char *Txt_View_event;
|
extern const char *Txt_View_event;
|
||||||
char *Anchor = NULL;
|
char *Anchor = NULL;
|
||||||
|
@ -454,32 +457,20 @@ static void Att_ShowOneAttEvent (struct Att_Events *Events,
|
||||||
Dat_StartEndTime_t StartEndTime;
|
Dat_StartEndTime_t StartEndTime;
|
||||||
char Description[Cns_MAX_BYTES_TEXT + 1];
|
char Description[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
|
||||||
/***** Get data of this attendance event *****/
|
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (Event);
|
|
||||||
Event->NumStdsTotal = Att_DB_GetNumStdsTotalWhoAreInAttEvent (Event->AttCod);
|
|
||||||
|
|
||||||
/***** Set anchor string *****/
|
/***** Set anchor string *****/
|
||||||
Frm_SetAnchorStr (Event->AttCod,&Anchor);
|
Frm_SetAnchorStr (Events->Event.AttCod,&Anchor);
|
||||||
|
|
||||||
/***** Write first row of data of this attendance event *****/
|
/***** Write first row of data of this attendance event *****/
|
||||||
/* Forms to remove/edit this attendance event */
|
/* Forms to remove/edit this attendance event */
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
if (ShowOnlyThisAttEventComplete)
|
if (!ShowOnlyThisAttEventComplete)
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL\"");
|
{
|
||||||
else
|
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL %s\"",
|
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL %s\"",
|
||||||
The_GetColorRows ());
|
The_GetColorRows ());
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
Att_PutFormsToRemEditOneAttEvent (Events,Anchor);
|
||||||
{
|
HTM_TD_End ();
|
||||||
case Rol_TCH:
|
|
||||||
case Rol_SYS_ADM:
|
|
||||||
Att_PutFormsToRemEditOneAttEvent (Events,Event,Anchor);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Start/end date/time */
|
/* Start/end date/time */
|
||||||
UniqueId++;
|
UniqueId++;
|
||||||
|
@ -492,21 +483,21 @@ static void Att_ShowOneAttEvent (struct Att_Events *Events,
|
||||||
if (ShowOnlyThisAttEventComplete)
|
if (ShowOnlyThisAttEventComplete)
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"LB %s_%s\"",
|
HTM_TD_Begin ("id=\"%s\" class=\"LB %s_%s\"",
|
||||||
Id,
|
Id,
|
||||||
Event->Hidden ? (Event->Open ? "DATE_GREEN_LIGHT" :
|
Events->Event.Hidden ? (Events->Event.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT") :
|
"DATE_RED_LIGHT") :
|
||||||
(Event->Open ? "DATE_GREEN" :
|
(Events->Event.Open ? "DATE_GREEN" :
|
||||||
"DATE_RED"),
|
"DATE_RED"),
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"LB %s_%s %s\"",
|
HTM_TD_Begin ("id=\"%s\" class=\"LB %s_%s %s\"",
|
||||||
Id,
|
Id,
|
||||||
Event->Hidden ? (Event->Open ? "DATE_GREEN_LIGHT" :
|
Events->Event.Hidden ? (Events->Event.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT") :
|
"DATE_RED_LIGHT") :
|
||||||
(Event->Open ? "DATE_GREEN" :
|
(Events->Event.Open ? "DATE_GREEN" :
|
||||||
"DATE_RED"),
|
"DATE_RED"),
|
||||||
The_GetSuffix (),
|
The_GetSuffix (),
|
||||||
The_GetColorRows ());
|
The_GetColorRows ());
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Event->TimeUTC[StartEndTime],
|
Dat_WriteLocalDateHMSFromUTC (Id,Events->Event.TimeUTC[StartEndTime],
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||||
true,true,true,0x7);
|
true,true,true,0x7);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -519,7 +510,7 @@ static void Att_ShowOneAttEvent (struct Att_Events *Events,
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
||||||
HTM_ARTICLE_Begin (Anchor);
|
HTM_ARTICLE_Begin (Anchor);
|
||||||
Att_PutLinkAttEvent (Event,Txt_View_event,Event->Title);
|
Att_PutLinkAttEvent (&Events->Event,Txt_View_event,Events->Event.Title);
|
||||||
HTM_ARTICLE_End ();
|
HTM_ARTICLE_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
@ -529,10 +520,10 @@ static void Att_ShowOneAttEvent (struct Att_Events *Events,
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("class=\"RT %s\"",The_GetColorRows ());
|
HTM_TD_Begin ("class=\"RT %s\"",The_GetColorRows ());
|
||||||
HTM_SPAN_Begin ("class=\"%s_%s\"",
|
HTM_SPAN_Begin ("class=\"%s_%s\"",
|
||||||
Event->Hidden ? "ASG_TITLE_LIGHT" :
|
Events->Event.Hidden ? "ASG_TITLE_LIGHT" :
|
||||||
"ASG_TITLE",
|
"ASG_TITLE",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
HTM_Unsigned (Event->NumStdsTotal);
|
HTM_Unsigned (Events->Event.NumStdsTotal);
|
||||||
HTM_SPAN_End ();
|
HTM_SPAN_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
@ -546,11 +537,11 @@ static void Att_ShowOneAttEvent (struct Att_Events *Events,
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ());
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ());
|
||||||
Att_WriteAttEventAuthor (Event);
|
Att_WriteAttEventAuthor (&Events->Event);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Text of the attendance event */
|
/* Text of the attendance event */
|
||||||
Att_DB_GetAttEventDescription (Event->AttCod,Description);
|
Att_DB_GetAttEventDescription (Events->Event.AttCod,Description);
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Description,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
Description,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
||||||
ALn_InsertLinks (Description,Cns_MAX_BYTES_TEXT,60); // Insert links
|
ALn_InsertLinks (Description,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||||
|
@ -559,11 +550,11 @@ static void Att_ShowOneAttEvent (struct Att_Events *Events,
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ());
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ());
|
||||||
if (Gbl.Crs.Grps.NumGrps)
|
if (Gbl.Crs.Grps.NumGrps)
|
||||||
Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (Event);
|
Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (&Events->Event);
|
||||||
|
|
||||||
HTM_DIV_Begin ("class=\"%s_%s\"",
|
HTM_DIV_Begin ("class=\"%s_%s\"",
|
||||||
Event->Hidden ? "DAT_LIGHT" :
|
Events->Event.Hidden ? "DAT_LIGHT" :
|
||||||
"DAT",
|
"DAT",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
HTM_Txt (Description);
|
HTM_Txt (Description);
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
@ -603,7 +594,6 @@ static Dat_StartEndTime_t Att_GetParamAttOrder (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Att_PutFormsToRemEditOneAttEvent (struct Att_Events *Events,
|
static void Att_PutFormsToRemEditOneAttEvent (struct Att_Events *Events,
|
||||||
const struct Att_Event *Event,
|
|
||||||
const char *Anchor)
|
const char *Anchor)
|
||||||
{
|
{
|
||||||
static Act_Action_t ActionHideUnhide[2] =
|
static Act_Action_t ActionHideUnhide[2] =
|
||||||
|
@ -612,20 +602,42 @@ static void Att_PutFormsToRemEditOneAttEvent (struct Att_Events *Events,
|
||||||
[true ] = ActUnhAtt, // Hidden ==> action to unhide
|
[true ] = ActUnhAtt, // Hidden ==> action to unhide
|
||||||
};
|
};
|
||||||
|
|
||||||
Events->AttCod = Event->AttCod;
|
if (Att_CheckIfICanEditAttEvents ())
|
||||||
|
{
|
||||||
|
/***** Icon to remove attendance event *****/
|
||||||
|
Ico_PutContextualIconToRemove (ActReqRemAtt,NULL,
|
||||||
|
Att_PutParams,Events);
|
||||||
|
|
||||||
/***** Icon to remove attendance event *****/
|
/***** Icon to hide/unhide attendance event *****/
|
||||||
Ico_PutContextualIconToRemove (ActReqRemAtt,NULL,
|
Ico_PutContextualIconToHideUnhide (ActionHideUnhide,Anchor,
|
||||||
Att_PutParams,Events);
|
Att_PutParams,Events,
|
||||||
|
Events->Event.Hidden);
|
||||||
|
|
||||||
/***** Icon to hide/unhide attendance event *****/
|
/***** Icon to edit attendance event *****/
|
||||||
Ico_PutContextualIconToHideUnhide (ActionHideUnhide,Anchor,
|
Ico_PutContextualIconToEdit (ActEdiOneAtt,NULL,
|
||||||
Att_PutParams,Events,
|
Att_PutParams,Events);
|
||||||
Event->Hidden);
|
}
|
||||||
|
|
||||||
/***** Icon to edit attendance event *****/
|
/***** Icon to get resource link *****/
|
||||||
Ico_PutContextualIconToEdit (ActEdiOneAtt,NULL,
|
if (PrgRsc_CheckIfICanGetLink ())
|
||||||
Att_PutParams,Events);
|
Ico_PutContextualIconToGetLink (ActReqLnkAtt,NULL,
|
||||||
|
Att_PutParams,Events);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************* Check if I can edit calls for exams *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
bool Att_CheckIfICanEditAttEvents (void)
|
||||||
|
{
|
||||||
|
static const bool ICanEditAttEvents[Rol_NUM_ROLES] =
|
||||||
|
{
|
||||||
|
[Rol_TCH ] = true,
|
||||||
|
[Rol_SYS_ADM] = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return ICanEditAttEvents[Gbl.Usrs.Me.Role.Logged];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -638,7 +650,7 @@ static void Att_PutParams (void *Events)
|
||||||
|
|
||||||
if (Events)
|
if (Events)
|
||||||
{
|
{
|
||||||
Att_PutParamAttCod (((struct Att_Events *) Events)->AttCod);
|
Att_PutParamAttCod (((struct Att_Events *) Events)->Event.AttCod);
|
||||||
Dat_PutHiddenParamOrder (((struct Att_Events *) Events)->SelectedOrder);
|
Dat_PutHiddenParamOrder (((struct Att_Events *) Events)->SelectedOrder);
|
||||||
WhichGroups = Grp_GetParamWhichGroups ();
|
WhichGroups = Grp_GetParamWhichGroups ();
|
||||||
Grp_PutParamWhichGroups (&WhichGroups);
|
Grp_PutParamWhichGroups (&WhichGroups);
|
||||||
|
@ -773,8 +785,6 @@ static void Att_ResetAttendanceEvent (struct Att_Event *Event)
|
||||||
{
|
{
|
||||||
Event->AttCod = -1L;
|
Event->AttCod = -1L;
|
||||||
Event->NumStdsTotal = 0;
|
Event->NumStdsTotal = 0;
|
||||||
Event->NumStdsFromList = 0;
|
|
||||||
Event->Selected = false;
|
|
||||||
}
|
}
|
||||||
Event->CrsCod = -1L;
|
Event->CrsCod = -1L;
|
||||||
Event->Hidden = false;
|
Event->Hidden = false;
|
||||||
|
@ -809,7 +819,7 @@ static void Att_FreeListAttEvents (struct Att_Events *Events)
|
||||||
static void Att_PutParamSelectedAttCod (void *Events)
|
static void Att_PutParamSelectedAttCod (void *Events)
|
||||||
{
|
{
|
||||||
if (Events)
|
if (Events)
|
||||||
Att_PutParamAttCod (((struct Att_Events *) Events)->AttCod);
|
Att_PutParamAttCod (((struct Att_Events *) Events)->Event.AttCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Att_PutParamAttCod (long AttCod)
|
void Att_PutParamAttCod (long AttCod)
|
||||||
|
@ -1466,7 +1476,7 @@ void Att_SeeOneAttEvent (void)
|
||||||
Att_ResetEvents (&Events);
|
Att_ResetEvents (&Events);
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Events.AttCod = Att_GetParamAttCod ()) < 0)
|
if ((Events.Event.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Err_WrongEventExit ();
|
Err_WrongEventExit ();
|
||||||
|
|
||||||
/***** Show event *****/
|
/***** Show event *****/
|
||||||
|
@ -1477,35 +1487,34 @@ static void Att_ShowEvent (struct Att_Events *Events)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_USERS_Attendance;
|
extern const char *Hlp_USERS_Attendance;
|
||||||
extern const char *Txt_Event;
|
extern const char *Txt_Event;
|
||||||
struct Att_Event Event;
|
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Events->SelectedOrder = Att_GetParamAttOrder ();
|
Events->SelectedOrder = Att_GetParamAttOrder ();
|
||||||
Grp_GetParamWhichGroups ();
|
Grp_GetParamWhichGroups ();
|
||||||
Events->CurrentPage = Pag_GetParamPagNum (Pag_ATT_EVENTS);
|
Events->CurrentPage = Pag_GetParamPagNum (Pag_ATT_EVENTS);
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
/***** Get data of this attendance event *****/
|
||||||
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Events->Event);
|
||||||
|
Events->Event.NumStdsTotal = Att_DB_GetNumStdsTotalWhoAreInAttEvent (Events->Event.AttCod);
|
||||||
|
|
||||||
|
/***** Show attendance event inside a box *****/
|
||||||
Box_BoxTableBegin (NULL,Txt_Event,
|
Box_BoxTableBegin (NULL,Txt_Event,
|
||||||
Att_PutIconsOneAtt,Events,
|
Att_PutIconsOneAtt,Events,
|
||||||
Hlp_USERS_Attendance,Box_NOT_CLOSABLE,2);
|
Hlp_USERS_Attendance,Box_NOT_CLOSABLE,2);
|
||||||
|
Att_ShowOneAttEventRow (Events,
|
||||||
/***** Show attendance event *****/
|
true); // Show only this event
|
||||||
Event.AttCod = Events->AttCod;
|
|
||||||
Att_ShowOneAttEvent (Events,&Event,true);
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_BoxTableEnd ();
|
Box_BoxTableEnd ();
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
Att_ListAttOnlyMeAsStudent (&Event);
|
Att_ListAttOnlyMeAsStudent (&Events->Event);
|
||||||
break;
|
break;
|
||||||
case Rol_NET:
|
case Rol_NET:
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
/***** Show list of students *****/
|
/***** Show list of students *****/
|
||||||
Att_ListAttStudents (Events,&Event);
|
Att_ListAttStudents (Events);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1518,10 +1527,16 @@ static void Att_ShowEvent (struct Att_Events *Events)
|
||||||
|
|
||||||
static void Att_PutIconsOneAtt (void *Events)
|
static void Att_PutIconsOneAtt (void *Events)
|
||||||
{
|
{
|
||||||
/***** Put icon to get resource link *****/
|
char *Anchor = NULL;
|
||||||
if (PrgRsc_CheckIfICanGetLink ())
|
|
||||||
Ico_PutContextualIconToGetLink (ActReqLnkAtt,NULL,
|
/***** Set anchor string *****/
|
||||||
Att_PutParams,Events);
|
Frm_SetAnchorStr (((struct Att_Events *) Events)->Event.AttCod,&Anchor);
|
||||||
|
|
||||||
|
/***** Put icons to edit resource link *****/
|
||||||
|
Att_PutFormsToRemEditOneAttEvent ((struct Att_Events *) Events,Anchor);
|
||||||
|
|
||||||
|
/***** Free anchor string *****/
|
||||||
|
Frm_FreeAnchorStr (Anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1592,8 +1607,7 @@ static void Att_ListAttOnlyMeAsStudent (struct Att_Event *Event)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Event must be filled before calling this function
|
// Event must be filled before calling this function
|
||||||
|
|
||||||
static void Att_ListAttStudents (struct Att_Events *Events,
|
static void Att_ListAttStudents (struct Att_Events *Events)
|
||||||
struct Att_Event *Event)
|
|
||||||
{
|
{
|
||||||
extern const char *Hlp_USERS_Attendance;
|
extern const char *Hlp_USERS_Attendance;
|
||||||
extern const char *Txt_Attendance;
|
extern const char *Txt_Attendance;
|
||||||
|
@ -1632,7 +1646,7 @@ static void Att_ListAttStudents (struct Att_Events *Events,
|
||||||
|
|
||||||
/* Begin form */
|
/* Begin form */
|
||||||
Frm_BeginForm (ActRecAttStd);
|
Frm_BeginForm (ActRecAttStd);
|
||||||
Att_PutParamAttCod (Event->AttCod);
|
Att_PutParamAttCod (Events->Event.AttCod);
|
||||||
Grp_PutParamsCodGrps ();
|
Grp_PutParamsCodGrps ();
|
||||||
|
|
||||||
/* Begin table */
|
/* Begin table */
|
||||||
|
@ -1661,7 +1675,7 @@ static void Att_ListAttStudents (struct Att_Events *Events,
|
||||||
/* Get list of user's IDs */
|
/* Get list of user's IDs */
|
||||||
ID_GetListIDsFromUsrCod (&UsrDat);
|
ID_GetListIDsFromUsrCod (&UsrDat);
|
||||||
|
|
||||||
Att_WriteRowUsrToCallTheRoll (NumUsr + 1,&UsrDat,Event);
|
Att_WriteRowUsrToCallTheRoll (NumUsr + 1,&UsrDat,&Events->Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End table */
|
/* End table */
|
||||||
|
@ -1945,7 +1959,6 @@ void Att_RegisterMeAsStdInAttEvent (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Your_comment_has_been_updated;
|
extern const char *Txt_Your_comment_has_been_updated;
|
||||||
struct Att_Events Events;
|
struct Att_Events Events;
|
||||||
struct Att_Event Event;
|
|
||||||
bool Present;
|
bool Present;
|
||||||
char *ParamName;
|
char *ParamName;
|
||||||
char CommentStd[Cns_MAX_BYTES_TEXT + 1];
|
char CommentStd[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
@ -1955,14 +1968,14 @@ void Att_RegisterMeAsStdInAttEvent (void)
|
||||||
Att_ResetEvents (&Events);
|
Att_ResetEvents (&Events);
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Event.AttCod = Att_GetParamAttCod ()) < 0)
|
if ((Events.Event.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Err_WrongEventExit ();
|
Err_WrongEventExit ();
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Event); // This checks that event belong to current course
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Events.Event); // This checks that event belong to current course
|
||||||
|
|
||||||
if (Event.Open)
|
if (Events.Event.Open)
|
||||||
{
|
{
|
||||||
/***** Get comments for this student *****/
|
/***** Get comments for this student *****/
|
||||||
Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Event.AttCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Events.Event.AttCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
CommentStd,CommentTch);
|
CommentStd,CommentTch);
|
||||||
if (asprintf (&ParamName,"CommentStd%s",Gbl.Usrs.Me.UsrDat.EnUsrCod) < 0)
|
if (asprintf (&ParamName,"CommentStd%s",Gbl.Usrs.Me.UsrDat.EnUsrCod) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
|
@ -1973,18 +1986,17 @@ void Att_RegisterMeAsStdInAttEvent (void)
|
||||||
CommentStd[0] ||
|
CommentStd[0] ||
|
||||||
CommentTch[0])
|
CommentTch[0])
|
||||||
/***** Register student *****/
|
/***** Register student *****/
|
||||||
Att_DB_RegUsrInAttEventChangingComments (Event.AttCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
Att_DB_RegUsrInAttEventChangingComments (Events.Event.AttCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Present,CommentStd,CommentTch);
|
Present,CommentStd,CommentTch);
|
||||||
else
|
else
|
||||||
/***** Remove student *****/
|
/***** Remove student *****/
|
||||||
Att_DB_RemoveUsrFromAttEvent (Event.AttCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
Att_DB_RemoveUsrFromAttEvent (Events.Event.AttCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Write final message *****/
|
/***** Write final message *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Your_comment_has_been_updated);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Your_comment_has_been_updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Show the attendance event again *****/
|
/***** Show the attendance event again *****/
|
||||||
Events.AttCod = Event.AttCod;
|
|
||||||
Att_ShowEvent (&Events);
|
Att_ShowEvent (&Events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2006,7 +2018,6 @@ void Att_RegisterStudentsInAttEvent (void)
|
||||||
extern const char *Txt_Presents;
|
extern const char *Txt_Presents;
|
||||||
extern const char *Txt_Absents;
|
extern const char *Txt_Absents;
|
||||||
struct Att_Events Events;
|
struct Att_Events Events;
|
||||||
struct Att_Event Event;
|
|
||||||
unsigned NumUsr;
|
unsigned NumUsr;
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
bool Present;
|
bool Present;
|
||||||
|
@ -2021,9 +2032,9 @@ void Att_RegisterStudentsInAttEvent (void)
|
||||||
Att_ResetEvents (&Events);
|
Att_ResetEvents (&Events);
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Event.AttCod = Att_GetParamAttCod ()) < 0)
|
if ((Events.Event.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Err_WrongEventExit ();
|
Err_WrongEventExit ();
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Event); // This checks that event belong to current course
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Events.Event); // This checks that event belong to current course
|
||||||
|
|
||||||
/***** Get groups selected *****/
|
/***** Get groups selected *****/
|
||||||
Grp_GetParCodsSeveralGrpsToShowUsrs ();
|
Grp_GetParCodsSeveralGrpsToShowUsrs ();
|
||||||
|
@ -2081,7 +2092,7 @@ void Att_RegisterStudentsInAttEvent (void)
|
||||||
NumUsr++)
|
NumUsr++)
|
||||||
{
|
{
|
||||||
/***** Get comments for this student *****/
|
/***** Get comments for this student *****/
|
||||||
Att_CheckIfUsrIsPresentInAttEventAndGetComments (Event.AttCod,
|
Att_CheckIfUsrIsPresentInAttEventAndGetComments (Events.Event.AttCod,
|
||||||
Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod,
|
Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod,
|
||||||
CommentStd,
|
CommentStd,
|
||||||
CommentTch);
|
CommentTch);
|
||||||
|
@ -2097,11 +2108,11 @@ void Att_RegisterStudentsInAttEvent (void)
|
||||||
CommentStd[0] ||
|
CommentStd[0] ||
|
||||||
CommentTch[0])
|
CommentTch[0])
|
||||||
/***** Register student *****/
|
/***** Register student *****/
|
||||||
Att_DB_RegUsrInAttEventChangingComments (Event.AttCod,Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod,
|
Att_DB_RegUsrInAttEventChangingComments (Events.Event.AttCod,Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod,
|
||||||
Present,CommentStd,CommentTch);
|
Present,CommentStd,CommentTch);
|
||||||
else
|
else
|
||||||
/***** Remove student *****/
|
/***** Remove student *****/
|
||||||
Att_DB_RemoveUsrFromAttEvent (Event.AttCod,Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod);
|
Att_DB_RemoveUsrFromAttEvent (Events.Event.AttCod,Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod);
|
||||||
|
|
||||||
if (Present)
|
if (Present)
|
||||||
NumStdsPresent++;
|
NumStdsPresent++;
|
||||||
|
@ -2123,7 +2134,6 @@ void Att_RegisterStudentsInAttEvent (void)
|
||||||
Usr_ShowWarningNoUsersFound (Rol_STD);
|
Usr_ShowWarningNoUsersFound (Rol_STD);
|
||||||
|
|
||||||
/***** Show the attendance event again *****/
|
/***** Show the attendance event again *****/
|
||||||
Events.AttCod = Event.AttCod;
|
|
||||||
Att_ShowEvent (&Events);
|
Att_ShowEvent (&Events);
|
||||||
|
|
||||||
/***** Free memory for list of groups selected *****/
|
/***** Free memory for list of groups selected *****/
|
||||||
|
@ -2671,7 +2681,7 @@ static void Att_PutButtonToShowDetails (const struct Att_Events *Events)
|
||||||
/********** Write list of those attendance events that have students *********/
|
/********** Write list of those attendance events that have students *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Att_ListEventsToSelect (const struct Att_Events *Events,
|
static void Att_ListEventsToSelect (struct Att_Events *Events,
|
||||||
Att_TypeOfView_t TypeOfView)
|
Att_TypeOfView_t TypeOfView)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Events;
|
extern const char *Txt_Events;
|
||||||
|
@ -2729,8 +2739,9 @@ static void Att_ListEventsToSelect (const struct Att_Events *Events,
|
||||||
NumAttEvent++, UniqueId++, The_ChangeRowColor ())
|
NumAttEvent++, UniqueId++, The_ChangeRowColor ())
|
||||||
{
|
{
|
||||||
/* Get data of the attendance event from database */
|
/* Get data of the attendance event from database */
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Events->Lst[NumAttEvent]);
|
Events->Event.AttCod = Events->Lst[NumAttEvent].AttCod;
|
||||||
Events->Lst[NumAttEvent].NumStdsTotal = Att_DB_GetNumStdsTotalWhoAreInAttEvent (Events->Lst[NumAttEvent].AttCod);
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Events->Event);
|
||||||
|
Events->Event.NumStdsTotal = Att_DB_GetNumStdsTotalWhoAreInAttEvent (Events->Event.AttCod);
|
||||||
|
|
||||||
/* Write a row for this event */
|
/* Write a row for this event */
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
@ -2740,7 +2751,7 @@ static void Att_ListEventsToSelect (const struct Att_Events *Events,
|
||||||
The_GetColorRows ());
|
The_GetColorRows ());
|
||||||
HTM_INPUT_CHECKBOX ("AttCods",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("AttCods",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"Event%u\" value=\"%ld\"%s",
|
"id=\"Event%u\" value=\"%ld\"%s",
|
||||||
NumAttEvent,Events->Lst[NumAttEvent].AttCod,
|
NumAttEvent,Events->Event.AttCod,
|
||||||
Events->Lst[NumAttEvent].Selected ? " checked=\"checked\"" :
|
Events->Lst[NumAttEvent].Selected ? " checked=\"checked\"" :
|
||||||
"");
|
"");
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -2762,7 +2773,7 @@ static void Att_ListEventsToSelect (const struct Att_Events *Events,
|
||||||
HTM_SPAN_Begin ("id=\"%s\"",Id);
|
HTM_SPAN_Begin ("id=\"%s\"",Id);
|
||||||
HTM_SPAN_End ();
|
HTM_SPAN_End ();
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Events->Lst[NumAttEvent].TimeUTC[Dat_STR_TIME],
|
Dat_WriteLocalDateHMSFromUTC (Id,Events->Event.TimeUTC[Dat_STR_TIME],
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
||||||
true,true,true,0x7);
|
true,true,true,0x7);
|
||||||
free (Id);
|
free (Id);
|
||||||
|
@ -2771,13 +2782,13 @@ static void Att_ListEventsToSelect (const struct Att_Events *Events,
|
||||||
HTM_TD_Begin ("class=\"LT DAT_%s %s\"",
|
HTM_TD_Begin ("class=\"LT DAT_%s %s\"",
|
||||||
The_GetSuffix (),
|
The_GetSuffix (),
|
||||||
The_GetColorRows ());
|
The_GetColorRows ());
|
||||||
HTM_Txt (Events->Lst[NumAttEvent].Title);
|
HTM_Txt (Events->Event.Title);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"RT DAT_%s %s\"",
|
HTM_TD_Begin ("class=\"RT DAT_%s %s\"",
|
||||||
The_GetSuffix (),
|
The_GetSuffix (),
|
||||||
The_GetColorRows ());
|
The_GetColorRows ());
|
||||||
HTM_Unsigned (Events->Lst[NumAttEvent].NumStdsTotal);
|
HTM_Unsigned (Events->Event.NumStdsTotal);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -2830,7 +2841,7 @@ static void Att_PutIconToEditAttEvents (__attribute__((unused)) void *Args)
|
||||||
/************ Show table with attendances for every user in list *************/
|
/************ Show table with attendances for every user in list *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Att_ListUsrsAttendanceTable (const struct Att_Events *Events,
|
static void Att_ListUsrsAttendanceTable (struct Att_Events *Events,
|
||||||
Att_TypeOfView_t TypeOfView,
|
Att_TypeOfView_t TypeOfView,
|
||||||
unsigned NumUsrsInList,
|
unsigned NumUsrsInList,
|
||||||
long *LstSelectedUsrCods)
|
long *LstSelectedUsrCods)
|
||||||
|
@ -2923,7 +2934,7 @@ static void Att_ListUsrsAttendanceTable (const struct Att_Events *Events,
|
||||||
/* Write table heading for listing of students in several attendance events **/
|
/* Write table heading for listing of students in several attendance events **/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Att_WriteTableHeadSeveralAttEvents (const struct Att_Events *Events)
|
static void Att_WriteTableHeadSeveralAttEvents (struct Att_Events *Events)
|
||||||
{
|
{
|
||||||
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
extern const char *Txt_Attendance;
|
extern const char *Txt_Attendance;
|
||||||
|
@ -2942,13 +2953,14 @@ static void Att_WriteTableHeadSeveralAttEvents (const struct Att_Events *Events)
|
||||||
if (Events->Lst[NumAttEvent].Selected)
|
if (Events->Lst[NumAttEvent].Selected)
|
||||||
{
|
{
|
||||||
/***** Get data of this attendance event *****/
|
/***** Get data of this attendance event *****/
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Events->Lst[NumAttEvent]);
|
Events->Event.AttCod = Events->Lst[NumAttEvent].AttCod;
|
||||||
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Events->Event);
|
||||||
|
|
||||||
/***** Put link to this attendance event *****/
|
/***** Put link to this attendance event *****/
|
||||||
HTM_TH_Begin (HTM_HEAD_CENTER);
|
HTM_TH_Begin (HTM_HEAD_CENTER);
|
||||||
snprintf (StrNumAttEvent,sizeof (StrNumAttEvent),"%u",NumAttEvent + 1);
|
snprintf (StrNumAttEvent,sizeof (StrNumAttEvent),"%u",NumAttEvent + 1);
|
||||||
Att_PutLinkAttEvent (&Events->Lst[NumAttEvent],
|
Att_PutLinkAttEvent (&Events->Event,
|
||||||
Events->Lst[NumAttEvent].Title,
|
Events->Event.Title,
|
||||||
StrNumAttEvent);
|
StrNumAttEvent);
|
||||||
HTM_TH_End ();
|
HTM_TH_End ();
|
||||||
}
|
}
|
||||||
|
@ -3078,7 +3090,7 @@ static void Att_PutCheckOrCross (bool Present)
|
||||||
/**************** List the students with details and comments ****************/
|
/**************** List the students with details and comments ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Att_ListStdsWithAttEventsDetails (const struct Att_Events *Events,
|
static void Att_ListStdsWithAttEventsDetails (struct Att_Events *Events,
|
||||||
unsigned NumUsrsInList,
|
unsigned NumUsrsInList,
|
||||||
long *LstSelectedUsrCods)
|
long *LstSelectedUsrCods)
|
||||||
{
|
{
|
||||||
|
@ -3127,7 +3139,7 @@ static void Att_ListStdsWithAttEventsDetails (const struct Att_Events *Events,
|
||||||
/*************** Write list of attendance events for a student ***************/
|
/*************** Write list of attendance events for a student ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
|
static void Att_ListAttEventsForAStd (struct Att_Events *Events,
|
||||||
unsigned NumUsr,struct Usr_Data *UsrDat)
|
unsigned NumUsr,struct Usr_Data *UsrDat)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Student_comment;
|
extern const char *Txt_Student_comment;
|
||||||
|
@ -3206,15 +3218,16 @@ static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
|
||||||
if (Events->Lst[NumAttEvent].Selected)
|
if (Events->Lst[NumAttEvent].Selected)
|
||||||
{
|
{
|
||||||
/***** Get data of the attendance event from database *****/
|
/***** Get data of the attendance event from database *****/
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Events->Lst[NumAttEvent]);
|
Events->Event.AttCod = Events->Lst[NumAttEvent].AttCod;
|
||||||
Events->Lst[NumAttEvent].NumStdsTotal = Att_DB_GetNumStdsTotalWhoAreInAttEvent (Events->Lst[NumAttEvent].AttCod);
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Events->Event);
|
||||||
|
Events->Event.NumStdsTotal = Att_DB_GetNumStdsTotalWhoAreInAttEvent (Events->Event.AttCod);
|
||||||
|
|
||||||
/***** Get comments for this student *****/
|
/***** Get comments for this student *****/
|
||||||
Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Events->Lst[NumAttEvent].AttCod,UsrDat->UsrCod,CommentStd,CommentTch);
|
Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Events->Event.AttCod,UsrDat->UsrCod,CommentStd,CommentTch);
|
||||||
ShowCommentStd = CommentStd[0];
|
ShowCommentStd = CommentStd[0];
|
||||||
ShowCommentTch = CommentTch[0] &&
|
ShowCommentTch = CommentTch[0] &&
|
||||||
(Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
(Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
||||||
Events->Lst[NumAttEvent].CommentTchVisible);
|
Events->Event.CommentTchVisible);
|
||||||
|
|
||||||
/***** Write a row for this event *****/
|
/***** Write a row for this event *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
@ -3241,8 +3254,8 @@ static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
|
||||||
HTM_SPAN_Begin ("id=\"%s\"",Id);
|
HTM_SPAN_Begin ("id=\"%s\"",Id);
|
||||||
HTM_SPAN_End ();
|
HTM_SPAN_End ();
|
||||||
HTM_BR ();
|
HTM_BR ();
|
||||||
HTM_Txt (Events->Lst[NumAttEvent].Title);
|
HTM_Txt (Events->Event.Title);
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Events->Lst[NumAttEvent].TimeUTC[Dat_STR_TIME],
|
Dat_WriteLocalDateHMSFromUTC (Id,Events->Event.TimeUTC[Dat_STR_TIME],
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
||||||
true,true,true,0x7);
|
true,true,true,0x7);
|
||||||
free (Id);
|
free (Id);
|
||||||
|
|
|
@ -58,19 +58,22 @@ struct Att_Event
|
||||||
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
||||||
bool CommentTchVisible;
|
bool CommentTchVisible;
|
||||||
|
|
||||||
/* Fields computed, not associated to the event in database */
|
/* Field computed, not associated to the event in database */
|
||||||
unsigned NumStdsTotal; // Number total of students who have assisted to the event
|
unsigned NumStdsTotal; // Number total of students who have assisted to the event
|
||||||
unsigned NumStdsFromList; // Number of students (taken from a list) who has assisted to the event
|
|
||||||
bool Selected; // I have selected this attendance event
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Att_Events
|
struct Att_Events
|
||||||
{
|
{
|
||||||
bool LstIsRead; // Is the list already read from database, or it needs to be read?
|
bool LstIsRead; // Is the list already read from database, or it needs to be read?
|
||||||
unsigned Num; // Number of attendance events
|
unsigned Num; // Number of attendance events
|
||||||
struct Att_Event *Lst; // List of attendance events
|
struct
|
||||||
|
{
|
||||||
|
long AttCod; // Attendance event code
|
||||||
|
unsigned NumStdsFromList; // Number of students (taken from a list) who has assisted to the event
|
||||||
|
bool Selected; // I have selected this attendance event
|
||||||
|
} *Lst; // List of attendance events
|
||||||
Dat_StartEndTime_t SelectedOrder;
|
Dat_StartEndTime_t SelectedOrder;
|
||||||
long AttCod;
|
struct Att_Event Event; // Selected/current event
|
||||||
bool ShowDetails;
|
bool ShowDetails;
|
||||||
char *StrAttCodsSelected;
|
char *StrAttCodsSelected;
|
||||||
unsigned CurrentPage;
|
unsigned CurrentPage;
|
||||||
|
@ -81,6 +84,9 @@ struct Att_Events
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Att_SeeAttEvents (void);
|
void Att_SeeAttEvents (void);
|
||||||
|
|
||||||
|
bool Att_CheckIfICanEditAttEvents (void);
|
||||||
|
|
||||||
void Att_RequestCreatOrEditAttEvent (void);
|
void Att_RequestCreatOrEditAttEvent (void);
|
||||||
bool Att_GetDataOfAttEventByCod (struct Att_Event *Event);
|
bool Att_GetDataOfAttEventByCod (struct Att_Event *Event);
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams,
|
||||||
Cfe_TypeViewCallForExam_t TypeViewCallForExam,
|
Cfe_TypeViewCallForExam_t TypeViewCallForExam,
|
||||||
bool HighLight);
|
bool HighLight);
|
||||||
static void Cfe_PutIconsCallForExam (void *CallsForExams);
|
static void Cfe_PutIconsCallForExam (void *CallsForExams);
|
||||||
|
|
||||||
static void Cfe_PutParamExaCodToEdit (void *ExaCod);
|
static void Cfe_PutParamExaCodToEdit (void *ExaCod);
|
||||||
|
|
||||||
static void Cfe_GetNotifContentCallForExam (const struct Cfe_CallsForExams *CallsForExams,
|
static void Cfe_GetNotifContentCallForExam (const struct Cfe_CallsForExams *CallsForExams,
|
||||||
|
@ -618,65 +619,58 @@ static void Cfe_ListCallsForExams (struct Cfe_CallsForExams *CallsForExams,
|
||||||
unsigned NumExaAnn;
|
unsigned NumExaAnn;
|
||||||
long ExaCod;
|
long ExaCod;
|
||||||
bool HighLight;
|
bool HighLight;
|
||||||
bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
|
|
||||||
|
|
||||||
/***** Get calls for exams (the most recent first)
|
/***** Get calls for exams (the most recent first)
|
||||||
in current course from database *****/
|
in current course from database *****/
|
||||||
NumExaAnns = Cfe_DB_GetCallsForExamsInCurrentCrs (&mysql_res,ICanEdit);
|
NumExaAnns = Cfe_DB_GetCallsForExamsInCurrentCrs (&mysql_res);
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
if (ICanEdit)
|
Box_BoxBegin (NULL,Txt_Calls_for_exams,
|
||||||
Box_BoxBegin (NULL,Txt_Calls_for_exams,
|
Cfe_PutIconsCallsForExams,NULL,
|
||||||
Cfe_PutIconsCallsForExams,NULL,
|
Hlp_ASSESSMENT_Calls_for_exams,Box_NOT_CLOSABLE);
|
||||||
Hlp_ASSESSMENT_Calls_for_exams,Box_NOT_CLOSABLE);
|
|
||||||
else
|
|
||||||
Box_BoxBegin (NULL,Txt_Calls_for_exams,
|
|
||||||
NULL,NULL,
|
|
||||||
Hlp_ASSESSMENT_Calls_for_exams,Box_NOT_CLOSABLE);
|
|
||||||
|
|
||||||
if (NumExaAnns)
|
|
||||||
/***** List the existing calls for exams *****/
|
/***** List the existing calls for exams *****/
|
||||||
for (NumExaAnn = 0;
|
if (NumExaAnns)
|
||||||
NumExaAnn < NumExaAnns;
|
for (NumExaAnn = 0;
|
||||||
NumExaAnn++)
|
NumExaAnn < NumExaAnns;
|
||||||
{
|
NumExaAnn++)
|
||||||
/***** Get the code of the call for exam (row[0]) *****/
|
|
||||||
if ((ExaCod = DB_GetNextCode (mysql_res)) <= 0)
|
|
||||||
Err_WrongCallForExamExit ();
|
|
||||||
|
|
||||||
/***** Allocate memory for the call for exam *****/
|
|
||||||
Cfe_AllocMemCallForExam (CallsForExams);
|
|
||||||
|
|
||||||
/***** Read the data of the call for exam *****/
|
|
||||||
Cfe_GetDataCallForExamFromDB (CallsForExams,ExaCod);
|
|
||||||
|
|
||||||
/***** Show call for exam *****/
|
|
||||||
HighLight = false;
|
|
||||||
if (ExaCod == CallsForExams->HighlightExaCod)
|
|
||||||
HighLight = true;
|
|
||||||
else if (CallsForExams->HighlightDate[0])
|
|
||||||
{
|
{
|
||||||
if (!strcmp (CallsForExams->CallForExam.ExamDate.YYYYMMDD,
|
/***** Get the code of the call for exam (row[0]) *****/
|
||||||
CallsForExams->HighlightDate))
|
if ((ExaCod = DB_GetNextCode (mysql_res)) <= 0)
|
||||||
|
Err_WrongCallForExamExit ();
|
||||||
|
|
||||||
|
/***** Allocate memory for the call for exam *****/
|
||||||
|
Cfe_AllocMemCallForExam (CallsForExams);
|
||||||
|
|
||||||
|
/***** Read the data of the call for exam *****/
|
||||||
|
Cfe_GetDataCallForExamFromDB (CallsForExams,ExaCod);
|
||||||
|
|
||||||
|
/***** Show call for exam *****/
|
||||||
|
HighLight = false;
|
||||||
|
if (ExaCod == CallsForExams->HighlightExaCod)
|
||||||
HighLight = true;
|
HighLight = true;
|
||||||
|
else if (CallsForExams->HighlightDate[0])
|
||||||
|
{
|
||||||
|
if (!strcmp (CallsForExams->CallForExam.ExamDate.YYYYMMDD,
|
||||||
|
CallsForExams->HighlightDate))
|
||||||
|
HighLight = true;
|
||||||
|
}
|
||||||
|
Cfe_ShowCallForExam (CallsForExams,ExaCod,TypeViewCallForExam,
|
||||||
|
HighLight);
|
||||||
|
|
||||||
|
/***** Free memory of the call for exam *****/
|
||||||
|
Cfe_FreeMemCallForExam (CallsForExams);
|
||||||
}
|
}
|
||||||
Cfe_ShowCallForExam (CallsForExams,ExaCod,TypeViewCallForExam,
|
else
|
||||||
HighLight);
|
Ale_ShowAlert (Ale_INFO,Txt_No_calls_for_exams_of_X,
|
||||||
|
Gbl.Hierarchy.Crs.FullName);
|
||||||
|
|
||||||
/***** Free memory of the call for exam *****/
|
/***** Free structure that stores the query result *****/
|
||||||
Cfe_FreeMemCallForExam (CallsForExams);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
|
||||||
else
|
|
||||||
Ale_ShowAlert (Ale_INFO,Txt_No_calls_for_exams_of_X,
|
|
||||||
Gbl.Hierarchy.Crs.FullName);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Button to create a new call for exam *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
if (Cfe_CheckIfICanEditCallsForExams ())
|
||||||
|
Cfe_PutButtonToCreateNewCallForExam ();
|
||||||
/***** Button to create a new call for exam *****/
|
|
||||||
if (ICanEdit)
|
|
||||||
Cfe_PutButtonToCreateNewCallForExam ();
|
|
||||||
|
|
||||||
/***** End box *****/
|
/***** End box *****/
|
||||||
Box_BoxEnd ();
|
Box_BoxEnd ();
|
||||||
|
@ -688,10 +682,11 @@ static void Cfe_ListCallsForExams (struct Cfe_CallsForExams *CallsForExams,
|
||||||
|
|
||||||
static void Cfe_PutIconsCallsForExams (__attribute__((unused)) void *Args)
|
static void Cfe_PutIconsCallsForExams (__attribute__((unused)) void *Args)
|
||||||
{
|
{
|
||||||
/***** Put icon to create a new call for exam *****/
|
/***** Icon to create a new call for exam *****/
|
||||||
Ico_PutContextualIconToAdd (ActEdiCfe,NULL,NULL,NULL);
|
if (Cfe_CheckIfICanEditCallsForExams ())
|
||||||
|
Ico_PutContextualIconToAdd (ActEdiCfe,NULL,NULL,NULL);
|
||||||
|
|
||||||
/***** Link to get resource link *****/
|
/***** Icon to get resource link *****/
|
||||||
if (PrgRsc_CheckIfICanGetLink ())
|
if (PrgRsc_CheckIfICanGetLink ())
|
||||||
Ico_PutContextualIconToGetLink (ActReqLnkCfe,NULL,
|
Ico_PutContextualIconToGetLink (ActReqLnkCfe,NULL,
|
||||||
NULL,NULL);
|
NULL,NULL);
|
||||||
|
@ -1493,8 +1488,7 @@ static void Cfe_PutIconsCallForExam (void *CallsForExams)
|
||||||
|
|
||||||
if (CallsForExams)
|
if (CallsForExams)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
if (Cfe_CheckIfICanEditCallsForExams ())
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
|
|
||||||
{
|
{
|
||||||
/***** Icon to remove call for exam *****/
|
/***** Icon to remove call for exam *****/
|
||||||
Ico_PutContextualIconToRemove (ActReqRemCfe,NULL,
|
Ico_PutContextualIconToRemove (ActReqRemCfe,NULL,
|
||||||
|
@ -1534,6 +1528,21 @@ static void Cfe_PutIconsCallForExam (void *CallsForExams)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************* Check if I can edit calls for exams *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
bool Cfe_CheckIfICanEditCallsForExams (void)
|
||||||
|
{
|
||||||
|
static const bool ICanEditCallsForExams[Rol_NUM_ROLES] =
|
||||||
|
{
|
||||||
|
[Rol_TCH ] = true,
|
||||||
|
[Rol_SYS_ADM] = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return ICanEditCallsForExams[Gbl.Usrs.Me.Role.Logged];
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Param with the code of a call for exam ********************/
|
/***************** Param with the code of a call for exam ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -128,6 +128,9 @@ void Cfe_ListCallsForExamsCod (void);
|
||||||
void Cfe_ListCallsForExamsDay (void);
|
void Cfe_ListCallsForExamsDay (void);
|
||||||
|
|
||||||
void Cfe_CreateListCallsForExams (struct Cfe_CallsForExams *CallsForExams);
|
void Cfe_CreateListCallsForExams (struct Cfe_CallsForExams *CallsForExams);
|
||||||
|
|
||||||
|
bool Cfe_CheckIfICanEditCallsForExams (void);
|
||||||
|
|
||||||
void Cfe_PutHiddenParamExaCod (long ExaCod);
|
void Cfe_PutHiddenParamExaCod (long ExaCod);
|
||||||
long Cfe_GetParamExaCod (void);
|
long Cfe_GetParamExaCod (void);
|
||||||
|
|
||||||
|
|
|
@ -80,12 +80,12 @@ long Cfe_DB_CreateCallForExam (const struct Cfe_CallForExam *CallForExam)
|
||||||
/**************** Get all calls for exams in current course ******************/
|
/**************** Get all calls for exams in current course ******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
unsigned Cfe_DB_GetCallsForExamsInCurrentCrs (MYSQL_RES **mysql_res,bool ICanEdit)
|
unsigned Cfe_DB_GetCallsForExamsInCurrentCrs (MYSQL_RES **mysql_res)
|
||||||
{
|
{
|
||||||
char SubQueryStatus[64];
|
char SubQueryStatus[64];
|
||||||
|
|
||||||
/***** Build subquery about status depending on my role *****/
|
/***** Build subquery about status depending on my role *****/
|
||||||
if (ICanEdit)
|
if (Cfe_CheckIfICanEditCallsForExams ())
|
||||||
sprintf (SubQueryStatus,"Status<>%u",
|
sprintf (SubQueryStatus,"Status<>%u",
|
||||||
(unsigned) Cfe_DELETED_CALL_FOR_EXAM);
|
(unsigned) Cfe_DELETED_CALL_FOR_EXAM);
|
||||||
else
|
else
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
long Cfe_DB_CreateCallForExam (const struct Cfe_CallForExam *CallForExam);
|
long Cfe_DB_CreateCallForExam (const struct Cfe_CallForExam *CallForExam);
|
||||||
|
|
||||||
unsigned Cfe_DB_GetCallsForExamsInCurrentCrs (MYSQL_RES **mysql_res,bool ICanEdit);
|
unsigned Cfe_DB_GetCallsForExamsInCurrentCrs (MYSQL_RES **mysql_res);
|
||||||
unsigned Cfe_DB_GetVisibleCallsForExamsInCurrentCrs (MYSQL_RES **mysql_res);
|
unsigned Cfe_DB_GetVisibleCallsForExamsInCurrentCrs (MYSQL_RES **mysql_res);
|
||||||
unsigned Cfe_DB_GetFutureCallsForExamsInCurrentCrs (MYSQL_RES **mysql_res);
|
unsigned Cfe_DB_GetFutureCallsForExamsInCurrentCrs (MYSQL_RES **mysql_res);
|
||||||
unsigned Cfe_DB_GetDataCallForExam (MYSQL_RES **mysql_res,long ExaCod);
|
unsigned Cfe_DB_GetDataCallForExam (MYSQL_RES **mysql_res,long ExaCod);
|
||||||
|
|
|
@ -606,11 +606,13 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate
|
||||||
|
|
||||||
TODO: Attach pdf files in multimedia.
|
TODO: Attach pdf files in multimedia.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 22.38 (2022-10-02)"
|
#define Log_PLATFORM_VERSION "SWAD 22.39 (2022-10-02)"
|
||||||
#define CSS_FILE "swad22.35.css"
|
#define CSS_FILE "swad22.35.css"
|
||||||
#define JS_FILE "swad21.100.js"
|
#define JS_FILE "swad21.100.js"
|
||||||
/*
|
/*
|
||||||
Version 22.38.1: Oct 02, 2022 TODO: El botón de "Poner encuesta a cero" debería salir dentro del diálogo, igual que el de borrar encuesta. (? lines)
|
Version 22.39.2: Oct 02, 2022 TODO: El botón de "Eliminar evento" debería salir dentro del diálogo. (? lines)
|
||||||
|
Version 22.39.1: Oct 02, 2022 TODO: El botón de "Poner encuesta a cero" debería salir dentro del diálogo, igual que el de borrar encuesta. (? lines)
|
||||||
|
Version 22.39: Oct 02, 2022 Code refactoring and changes in layout of attendance events. (332537 lines)
|
||||||
Version 22.38: Oct 02, 2022 Code refactoring and changes in layout of surveys. (332518 lines)
|
Version 22.38: Oct 02, 2022 Code refactoring and changes in layout of surveys. (332518 lines)
|
||||||
Version 22.37.2: Oct 01, 2022 Fixed minor issues in layout. (332526 lines)
|
Version 22.37.2: Oct 01, 2022 Fixed minor issues in layout. (332526 lines)
|
||||||
Version 22.37.1: Oct 01, 2022 Fixed issues in exams and games. (332525 lines)
|
Version 22.37.1: Oct 01, 2022 Fixed issues in exams and games. (332525 lines)
|
||||||
|
|
Loading…
Reference in New Issue