mirror of https://github.com/acanas/swad-core.git
Version 21.37.1: Oct 20, 2021 Code refactoring in attendance.
This commit is contained in:
parent
2e7d0b099b
commit
776174d0f1
|
@ -2715,11 +2715,9 @@ int swad__sendAttendanceEvent (struct soap *soap,
|
||||||
/* User's code (really not used) */
|
/* User's code (really not used) */
|
||||||
Event.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
Event.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
|
||||||
/* startTime */
|
/* startTime and endTime */
|
||||||
Event.TimeUTC[Att_START_TIME] = (time_t) startTime;
|
Event.TimeUTC[Dat_STR_TIME] = (time_t) startTime;
|
||||||
|
Event.TimeUTC[Dat_END_TIME] = (time_t) endTime;
|
||||||
/* endTime */
|
|
||||||
Event.TimeUTC[Att_END_TIME ] = (time_t) endTime;
|
|
||||||
|
|
||||||
/* Are teacher's comments visible? */
|
/* Are teacher's comments visible? */
|
||||||
Event.CommentTchVisible = (commentsTeachersVisible ? true :
|
Event.CommentTchVisible = (commentsTeachersVisible ? true :
|
||||||
|
|
|
@ -742,8 +742,8 @@ bool Att_GetDataOfAttEventByCod (struct Att_Event *Event)
|
||||||
Event->UsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
Event->UsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||||
|
|
||||||
/* Get start date (row[4]) and end date (row[5]) in UTC time */
|
/* Get start date (row[4]) and end date (row[5]) in UTC time */
|
||||||
Event->TimeUTC[Att_START_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
Event->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||||
Event->TimeUTC[Att_END_TIME ] = Dat_GetUNIXTimeFromStr (row[5]);
|
Event->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||||
|
|
||||||
/* Get whether the attendance event is open or closed (row(6)) */
|
/* Get whether the attendance event is open or closed (row(6)) */
|
||||||
Event->Open = (row[6][0] == '1');
|
Event->Open = (row[6][0] == '1');
|
||||||
|
@ -778,8 +778,8 @@ static void Att_ResetAttendanceEvent (struct Att_Event *Event)
|
||||||
Event->CrsCod = -1L;
|
Event->CrsCod = -1L;
|
||||||
Event->Hidden = false;
|
Event->Hidden = false;
|
||||||
Event->UsrCod = -1L;
|
Event->UsrCod = -1L;
|
||||||
Event->TimeUTC[Att_START_TIME] =
|
Event->TimeUTC[Dat_STR_TIME] =
|
||||||
Event->TimeUTC[Att_END_TIME ] = (time_t) 0;
|
Event->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
||||||
Event->Open = false;
|
Event->Open = false;
|
||||||
Event->Title[0] = '\0';
|
Event->Title[0] = '\0';
|
||||||
Event->CommentTchVisible = false;
|
Event->CommentTchVisible = false;
|
||||||
|
@ -1010,8 +1010,8 @@ void Att_RequestCreatOrEditAttEvent (void)
|
||||||
/* Initialize some fields */
|
/* Initialize some fields */
|
||||||
Event.CrsCod = Gbl.Hierarchy.Crs.CrsCod;
|
Event.CrsCod = Gbl.Hierarchy.Crs.CrsCod;
|
||||||
Event.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
Event.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
Event.TimeUTC[Att_START_TIME] = Gbl.StartExecutionTimeUTC;
|
Event.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
Event.TimeUTC[Att_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
Event.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
||||||
Event.Open = true;
|
Event.Open = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1213,8 +1213,8 @@ void Att_ReceiveFormAttEvent (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Get start/end date-times *****/
|
/***** Get start/end date-times *****/
|
||||||
ReceivedAtt.TimeUTC[Att_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
ReceivedAtt.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||||
ReceivedAtt.TimeUTC[Att_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
ReceivedAtt.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||||
|
|
||||||
/***** Get boolean parameter that indicates if teacher's comments are visible by students *****/
|
/***** Get boolean parameter that indicates if teacher's comments are visible by students *****/
|
||||||
ReceivedAtt.CommentTchVisible = Par_GetParToBool ("ComTchVisible");
|
ReceivedAtt.CommentTchVisible = Par_GetParToBool ("ComTchVisible");
|
||||||
|
@ -1226,10 +1226,10 @@ void Att_ReceiveFormAttEvent (void)
|
||||||
Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||||
|
|
||||||
/***** Adjust dates *****/
|
/***** Adjust dates *****/
|
||||||
if (ReceivedAtt.TimeUTC[Att_START_TIME] == 0)
|
if (ReceivedAtt.TimeUTC[Dat_STR_TIME] == 0)
|
||||||
ReceivedAtt.TimeUTC[Att_START_TIME] = Gbl.StartExecutionTimeUTC;
|
ReceivedAtt.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
||||||
if (ReceivedAtt.TimeUTC[Att_END_TIME] == 0)
|
if (ReceivedAtt.TimeUTC[Dat_END_TIME] == 0)
|
||||||
ReceivedAtt.TimeUTC[Att_END_TIME] = ReceivedAtt.TimeUTC[Att_START_TIME] + 2 * 60 * 60; // +2 hours // TODO: 2 * 60 * 60 should be in a #define in swad_config.h
|
ReceivedAtt.TimeUTC[Dat_END_TIME] = ReceivedAtt.TimeUTC[Dat_STR_TIME] + 2 * 60 * 60; // +2 hours // TODO: 2 * 60 * 60 should be in a #define in swad_config.h
|
||||||
|
|
||||||
/***** Check if title is correct *****/
|
/***** Check if title is correct *****/
|
||||||
if (ReceivedAtt.Title[0]) // If there's an attendance event title
|
if (ReceivedAtt.Title[0]) // If there's an attendance event title
|
||||||
|
@ -2733,7 +2733,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[Att_START_TIME],
|
Dat_WriteLocalDateHMSFromUTC (Id,Events->Lst[NumAttEvent].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);
|
||||||
|
@ -3180,7 +3180,7 @@ static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
|
||||||
HTM_SPAN_End ();
|
HTM_SPAN_End ();
|
||||||
HTM_BR ();
|
HTM_BR ();
|
||||||
HTM_Txt (Events->Lst[NumAttEvent].Title);
|
HTM_Txt (Events->Lst[NumAttEvent].Title);
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Events->Lst[NumAttEvent].TimeUTC[Att_START_TIME],
|
Dat_WriteLocalDateHMSFromUTC (Id,Events->Lst[NumAttEvent].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);
|
||||||
|
|
|
@ -37,13 +37,6 @@
|
||||||
#define Att_MAX_CHARS_ATTENDANCE_EVENT_TITLE (128 - 1) // 127
|
#define Att_MAX_CHARS_ATTENDANCE_EVENT_TITLE (128 - 1) // 127
|
||||||
#define Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE ((Att_MAX_CHARS_ATTENDANCE_EVENT_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
#define Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE ((Att_MAX_CHARS_ATTENDANCE_EVENT_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||||
|
|
||||||
#define Att_NUM_DATES 2
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
Att_START_TIME = 0,
|
|
||||||
Att_END_TIME = 1,
|
|
||||||
} Att_StartOrEndTime_t;
|
|
||||||
|
|
||||||
#define Att_NUM_ORDERS_NEWEST_OLDEST 2
|
#define Att_NUM_ORDERS_NEWEST_OLDEST 2
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -60,7 +53,7 @@ struct Att_Event
|
||||||
long CrsCod;
|
long CrsCod;
|
||||||
bool Hidden;
|
bool Hidden;
|
||||||
long UsrCod;
|
long UsrCod;
|
||||||
time_t TimeUTC[Att_NUM_DATES];
|
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||||
bool Open;
|
bool Open;
|
||||||
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
||||||
bool CommentTchVisible;
|
bool CommentTchVisible;
|
||||||
|
|
|
@ -221,8 +221,8 @@ long Att_DB_CreateAttEvent (const struct Att_Event *Event,const char *Descriptio
|
||||||
Event->Hidden ? 'Y' :
|
Event->Hidden ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Event->TimeUTC[Att_START_TIME],
|
Event->TimeUTC[Dat_STR_TIME],
|
||||||
Event->TimeUTC[Att_END_TIME ],
|
Event->TimeUTC[Dat_END_TIME],
|
||||||
Event->CommentTchVisible ? 'Y' :
|
Event->CommentTchVisible ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Event->Title,
|
Event->Title,
|
||||||
|
@ -247,8 +247,8 @@ void Att_DB_UpdateAttEvent (const struct Att_Event *Event,const char *Descriptio
|
||||||
" AND CrsCod=%ld", // Extra check
|
" AND CrsCod=%ld", // Extra check
|
||||||
Event->Hidden ? 'Y' :
|
Event->Hidden ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Event->TimeUTC[Att_START_TIME],
|
Event->TimeUTC[Dat_STR_TIME],
|
||||||
Event->TimeUTC[Att_END_TIME ],
|
Event->TimeUTC[Dat_END_TIME],
|
||||||
Event->CommentTchVisible ? 'Y' :
|
Event->CommentTchVisible ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Event->Title,
|
Event->Title,
|
||||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 21.37 (2021-10-19)"
|
#define Log_PLATFORM_VERSION "SWAD 21.37.1 (2021-10-20)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.69.1.js"
|
#define JS_FILE "swad20.69.1.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 21.37.1: Oct 20, 2021 Code refactoring in attendance. (320361 lines)
|
||||||
Version 21.37: Oct 19, 2021 New module swad_statistic_database for database queries related to statistics of accesses to platform. (320363 lines)
|
Version 21.37: Oct 19, 2021 New module swad_statistic_database for database queries related to statistics of accesses to platform. (320363 lines)
|
||||||
Version 21.36: Oct 18, 2021 New module swad_setting_database for database queries related to user's settings / preferences. (320253 lines)
|
Version 21.36: Oct 18, 2021 New module swad_setting_database for database queries related to user's settings / preferences. (320253 lines)
|
||||||
Version 21.35.1: Oct 18, 2021 Queries moved to module swad_file_database. (320175 lines)
|
Version 21.35.1: Oct 18, 2021 Queries moved to module swad_file_database. (320175 lines)
|
||||||
|
|
|
@ -86,7 +86,7 @@ typedef enum
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Dat_STR_TIME = 0,
|
Dat_STR_TIME = 0,
|
||||||
Dat_END_TIME = 1,
|
Dat_END_TIME = 1,
|
||||||
} Dat_StartEndTime_t;
|
} Dat_StartEndTime_t;
|
||||||
|
|
||||||
#define Dat_NUM_FORM_SECONDS 2
|
#define Dat_NUM_FORM_SECONDS 2
|
||||||
|
|
529
swad_survey.c
529
swad_survey.c
|
@ -249,76 +249,76 @@ static void Svy_ListAllSurveys (struct Svy_Surveys *Surveys)
|
||||||
Svy_PutIconsListSurveys,Surveys,
|
Svy_PutIconsListSurveys,Surveys,
|
||||||
Hlp_ASSESSMENT_Surveys,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Surveys,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Select whether show only my groups or all groups *****/
|
/***** Select whether show only my groups or all groups *****/
|
||||||
if (Gbl.Crs.Grps.NumGrps)
|
if (Gbl.Crs.Grps.NumGrps)
|
||||||
{
|
|
||||||
Set_BeginSettingsHead ();
|
|
||||||
Grp_ShowFormToSelWhichGrps (ActSeeAllSvy,
|
|
||||||
Svy_ParamsWhichGroupsToShow,Surveys);
|
|
||||||
Set_EndSettingsHead ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Write links to pages *****/
|
|
||||||
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,&Pagination,
|
|
||||||
Surveys,-1L);
|
|
||||||
|
|
||||||
if (Surveys->Num)
|
|
||||||
{
|
|
||||||
/***** Table head *****/
|
|
||||||
HTM_TABLE_BeginWideMarginPadding (5);
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
|
||||||
|
|
||||||
for (Order = Dat_STR_TIME;
|
|
||||||
Order <= Dat_END_TIME;
|
|
||||||
Order++)
|
|
||||||
{
|
{
|
||||||
HTM_TH_Begin (1,1,"LM");
|
Set_BeginSettingsHead ();
|
||||||
|
Grp_ShowFormToSelWhichGrps (ActSeeAllSvy,
|
||||||
/* Form to change order */
|
Svy_ParamsWhichGroupsToShow,Surveys);
|
||||||
Frm_BeginForm (ActSeeAllSvy);
|
Set_EndSettingsHead ();
|
||||||
WhichGroups = Grp_GetParamWhichGroups ();
|
|
||||||
Grp_PutParamWhichGroups (&WhichGroups);
|
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Surveys->CurrentPage);
|
|
||||||
Dat_PutHiddenParamOrder (Order);
|
|
||||||
HTM_BUTTON_SUBMIT_Begin (Txt_START_END_TIME_HELP[Order],
|
|
||||||
"BT_LINK TIT_TBL",NULL);
|
|
||||||
if (Order == Surveys->SelectedOrder)
|
|
||||||
HTM_U_Begin ();
|
|
||||||
HTM_Txt (Txt_START_END_TIME[Order]);
|
|
||||||
if (Order == Surveys->SelectedOrder)
|
|
||||||
HTM_U_End ();
|
|
||||||
HTM_BUTTON_End ();
|
|
||||||
Frm_EndForm ();
|
|
||||||
|
|
||||||
HTM_TH_End ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HTM_TH (1,1,"LM",Txt_Survey);
|
/***** Write links to pages *****/
|
||||||
HTM_TH (1,1,"CM",Txt_Status);
|
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,&Pagination,
|
||||||
|
Surveys,-1L);
|
||||||
|
|
||||||
HTM_TR_End ();
|
if (Surveys->Num)
|
||||||
|
{
|
||||||
|
/***** Table head *****/
|
||||||
|
HTM_TABLE_BeginWideMarginPadding (5);
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/***** Write all surveys *****/
|
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
|
||||||
for (NumSvy = Pagination.FirstItemVisible;
|
|
||||||
NumSvy <= Pagination.LastItemVisible;
|
|
||||||
NumSvy++)
|
|
||||||
Svy_ShowOneSurvey (Surveys,Surveys->LstSvyCods[NumSvy - 1],false);
|
|
||||||
|
|
||||||
/***** End table *****/
|
for (Order = Dat_STR_TIME;
|
||||||
HTM_TABLE_End ();
|
Order <= Dat_END_TIME;
|
||||||
}
|
Order++)
|
||||||
else // No surveys created
|
{
|
||||||
Ale_ShowAlert (Ale_INFO,Txt_No_surveys);
|
HTM_TH_Begin (1,1,"LM");
|
||||||
|
|
||||||
/***** Write again links to pages *****/
|
/* Form to change order */
|
||||||
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,&Pagination,
|
Frm_BeginForm (ActSeeAllSvy);
|
||||||
Surveys,-1L);
|
WhichGroups = Grp_GetParamWhichGroups ();
|
||||||
|
Grp_PutParamWhichGroups (&WhichGroups);
|
||||||
|
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Surveys->CurrentPage);
|
||||||
|
Dat_PutHiddenParamOrder (Order);
|
||||||
|
HTM_BUTTON_SUBMIT_Begin (Txt_START_END_TIME_HELP[Order],
|
||||||
|
"BT_LINK TIT_TBL",NULL);
|
||||||
|
if (Order == Surveys->SelectedOrder)
|
||||||
|
HTM_U_Begin ();
|
||||||
|
HTM_Txt (Txt_START_END_TIME[Order]);
|
||||||
|
if (Order == Surveys->SelectedOrder)
|
||||||
|
HTM_U_End ();
|
||||||
|
HTM_BUTTON_End ();
|
||||||
|
Frm_EndForm ();
|
||||||
|
|
||||||
/***** Button to create a new survey *****/
|
HTM_TH_End ();
|
||||||
if (Svy_CheckIfICanCreateSvy ())
|
}
|
||||||
Svy_PutButtonToCreateNewSvy (Surveys);
|
|
||||||
|
HTM_TH (1,1,"LM",Txt_Survey);
|
||||||
|
HTM_TH (1,1,"CM",Txt_Status);
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Write all surveys *****/
|
||||||
|
for (NumSvy = Pagination.FirstItemVisible;
|
||||||
|
NumSvy <= Pagination.LastItemVisible;
|
||||||
|
NumSvy++)
|
||||||
|
Svy_ShowOneSurvey (Surveys,Surveys->LstSvyCods[NumSvy - 1],false);
|
||||||
|
|
||||||
|
/***** End table *****/
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
}
|
||||||
|
else // No surveys created
|
||||||
|
Ale_ShowAlert (Ale_INFO,Txt_No_surveys);
|
||||||
|
|
||||||
|
/***** Write again links to pages *****/
|
||||||
|
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,&Pagination,
|
||||||
|
Surveys,-1L);
|
||||||
|
|
||||||
|
/***** Button to create a new survey *****/
|
||||||
|
if (Svy_CheckIfICanCreateSvy ())
|
||||||
|
Svy_PutButtonToCreateNewSvy (Surveys);
|
||||||
|
|
||||||
/***** End box *****/
|
/***** End box *****/
|
||||||
Box_BoxEnd ();
|
Box_BoxEnd ();
|
||||||
|
@ -384,7 +384,7 @@ static void Svy_PutButtonToCreateNewSvy (struct Svy_Surveys *Surveys)
|
||||||
|
|
||||||
Frm_BeginForm (ActFrmNewSvy);
|
Frm_BeginForm (ActFrmNewSvy);
|
||||||
Svy_PutParamsToCreateNewSvy (Surveys);
|
Svy_PutParamsToCreateNewSvy (Surveys);
|
||||||
Btn_PutConfirmButton (Txt_New_survey);
|
Btn_PutConfirmButton (Txt_New_survey);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,218 +491,218 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
|
||||||
/***** Write first row of data of this assignment *****/
|
/***** Write first row of data of this assignment *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Forms to remove/edit this assignment */
|
/* Forms to remove/edit this assignment */
|
||||||
if (ShowOnlyThisSvyComplete)
|
if (ShowOnlyThisSvyComplete)
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL\"");
|
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
if (Svy.Status.ICanEdit)
|
if (Svy.Status.ICanEdit)
|
||||||
Svy_PutFormsToRemEditOneSvy (Surveys,&Svy,Anchor);
|
Svy_PutFormsToRemEditOneSvy (Surveys,&Svy,Anchor);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Start date/time */
|
/* Start date/time */
|
||||||
UniqueId++;
|
UniqueId++;
|
||||||
if (asprintf (&Id,"svy_date_start_%u",UniqueId) < 0)
|
if (asprintf (&Id,"svy_date_start_%u",UniqueId) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
if (ShowOnlyThisSvyComplete)
|
if (ShowOnlyThisSvyComplete)
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT\"",
|
HTM_TD_Begin ("id=\"%s\" class=\"%s LT\"",
|
||||||
Id,
|
Id,
|
||||||
Svy.Status.Visible ? (Svy.Status.Open ? "DATE_GREEN" :
|
Svy.Status.Visible ? (Svy.Status.Open ? "DATE_GREEN" :
|
||||||
"DATE_RED") :
|
"DATE_RED") :
|
||||||
(Svy.Status.Open ? "DATE_GREEN_LIGHT" :
|
(Svy.Status.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT"));
|
"DATE_RED_LIGHT"));
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
||||||
Id,
|
Id,
|
||||||
Svy.Status.Visible ? (Svy.Status.Open ? "DATE_GREEN" :
|
Svy.Status.Visible ? (Svy.Status.Open ? "DATE_GREEN" :
|
||||||
"DATE_RED") :
|
"DATE_RED") :
|
||||||
(Svy.Status.Open ? "DATE_GREEN_LIGHT" :
|
(Svy.Status.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT"),
|
"DATE_RED_LIGHT"),
|
||||||
Gbl.RowEvenOdd);
|
Gbl.RowEvenOdd);
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Svy.TimeUTC[Svy_START_TIME],
|
Dat_WriteLocalDateHMSFromUTC (Id,Svy.TimeUTC[Svy_START_TIME],
|
||||||
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 ();
|
||||||
free (Id);
|
free (Id);
|
||||||
|
|
||||||
/* End date/time */
|
/* End date/time */
|
||||||
if (asprintf (&Id,"svy_date_end_%u",UniqueId) < 0)
|
if (asprintf (&Id,"svy_date_end_%u",UniqueId) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
if (ShowOnlyThisSvyComplete)
|
if (ShowOnlyThisSvyComplete)
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT\"",
|
HTM_TD_Begin ("id=\"%s\" class=\"%s LT\"",
|
||||||
Id,
|
Id,
|
||||||
Svy.Status.Visible ? (Svy.Status.Open ? "DATE_GREEN" :
|
Svy.Status.Visible ? (Svy.Status.Open ? "DATE_GREEN" :
|
||||||
"DATE_RED") :
|
"DATE_RED") :
|
||||||
(Svy.Status.Open ? "DATE_GREEN_LIGHT" :
|
(Svy.Status.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT"));
|
"DATE_RED_LIGHT"));
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
HTM_TD_Begin ("id=\"%s\" class=\"%s LT COLOR%u\"",
|
||||||
Id,
|
Id,
|
||||||
Svy.Status.Visible ? (Svy.Status.Open ? "DATE_GREEN" :
|
Svy.Status.Visible ? (Svy.Status.Open ? "DATE_GREEN" :
|
||||||
"DATE_RED") :
|
"DATE_RED") :
|
||||||
(Svy.Status.Open ? "DATE_GREEN_LIGHT" :
|
(Svy.Status.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT"),
|
"DATE_RED_LIGHT"),
|
||||||
Gbl.RowEvenOdd);
|
Gbl.RowEvenOdd);
|
||||||
Dat_WriteLocalDateHMSFromUTC (Id,Svy.TimeUTC[Svy_END_TIME],
|
Dat_WriteLocalDateHMSFromUTC (Id,Svy.TimeUTC[Svy_END_TIME],
|
||||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||||
true,false,true,0x7);
|
true,false,true,0x7);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
free (Id);
|
free (Id);
|
||||||
|
|
||||||
/* Survey title */
|
|
||||||
if (ShowOnlyThisSvyComplete)
|
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
|
||||||
else
|
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
HTM_ARTICLE_Begin (Anchor);
|
|
||||||
Frm_BeginForm (ActSeeSvy);
|
|
||||||
Svy_PutParamSvyCod (SvyCod);
|
|
||||||
Svy_PutHiddenParamSvyOrder (Surveys->SelectedOrder);
|
|
||||||
WhichGroups = Grp_GetParamWhichGroups ();
|
|
||||||
Grp_PutParamWhichGroups (&WhichGroups);
|
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Surveys->CurrentPage);
|
|
||||||
HTM_BUTTON_SUBMIT_Begin (Txt_View_survey,
|
|
||||||
Svy.Status.Visible ? "BT_LINK LT ASG_TITLE" :
|
|
||||||
"BT_LINK LT ASG_TITLE_LIGHT",
|
|
||||||
NULL);
|
|
||||||
HTM_Txt (Svy.Title);
|
|
||||||
HTM_BUTTON_End ();
|
|
||||||
Frm_EndForm ();
|
|
||||||
HTM_ARTICLE_End ();
|
|
||||||
|
|
||||||
/* Number of questions and number of distinct users who have already answered this survey */
|
|
||||||
HTM_DIV_Begin ("class=\"%s\"",
|
|
||||||
Svy.Status.Visible ? "ASG_GRP" :
|
|
||||||
"ASG_GRP_LIGHT");
|
|
||||||
HTM_TxtColonNBSP (Txt_Number_of_questions);
|
|
||||||
HTM_Unsigned (Svy.NumQsts);
|
|
||||||
HTM_Txt ("; ");
|
|
||||||
HTM_TxtColonNBSP (Txt_Number_of_users);
|
|
||||||
HTM_Unsigned (Svy.NumUsrs);
|
|
||||||
HTM_DIV_End ();
|
|
||||||
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/* Status of the survey */
|
|
||||||
if (ShowOnlyThisSvyComplete)
|
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"LT\"");
|
|
||||||
else
|
|
||||||
HTM_TD_Begin ("rowspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
|
||||||
Svy_WriteStatus (&Svy);
|
|
||||||
|
|
||||||
if (!ShowOnlyThisSvyComplete)
|
|
||||||
{
|
|
||||||
/* Possible button to answer this survey */
|
|
||||||
if (Svy.Status.ICanAnswer)
|
|
||||||
{
|
|
||||||
HTM_DIV_Begin ("class=\"BUTTONS_AFTER_ALERT\"");
|
|
||||||
|
|
||||||
|
/* Survey title */
|
||||||
|
if (ShowOnlyThisSvyComplete)
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
else
|
||||||
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
HTM_ARTICLE_Begin (Anchor);
|
||||||
Frm_BeginForm (ActSeeSvy);
|
Frm_BeginForm (ActSeeSvy);
|
||||||
Svy_PutParamSvyCod (Svy.SvyCod);
|
Svy_PutParamSvyCod (SvyCod);
|
||||||
Svy_PutHiddenParamSvyOrder (Surveys->SelectedOrder);
|
Svy_PutHiddenParamSvyOrder (Surveys->SelectedOrder);
|
||||||
WhichGroups = Grp_GetParamWhichGroups ();
|
WhichGroups = Grp_GetParamWhichGroups ();
|
||||||
Grp_PutParamWhichGroups (&WhichGroups);
|
Grp_PutParamWhichGroups (&WhichGroups);
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Surveys->CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Surveys->CurrentPage);
|
||||||
Btn_PutCreateButtonInline (Txt_Answer_survey);
|
HTM_BUTTON_SUBMIT_Begin (Txt_View_survey,
|
||||||
|
Svy.Status.Visible ? "BT_LINK LT ASG_TITLE" :
|
||||||
|
"BT_LINK LT ASG_TITLE_LIGHT",
|
||||||
|
NULL);
|
||||||
|
HTM_Txt (Svy.Title);
|
||||||
|
HTM_BUTTON_End ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
HTM_ARTICLE_End ();
|
||||||
|
|
||||||
HTM_DIV_End ();
|
/* Number of questions and number of distinct users who have already answered this survey */
|
||||||
}
|
HTM_DIV_Begin ("class=\"%s\"",
|
||||||
/* Possible button to see the result of the survey */
|
Svy.Status.Visible ? "ASG_GRP" :
|
||||||
else if (Svy.Status.ICanViewResults)
|
"ASG_GRP_LIGHT");
|
||||||
|
HTM_TxtColonNBSP (Txt_Number_of_questions);
|
||||||
|
HTM_Unsigned (Svy.NumQsts);
|
||||||
|
HTM_Txt ("; ");
|
||||||
|
HTM_TxtColonNBSP (Txt_Number_of_users);
|
||||||
|
HTM_Unsigned (Svy.NumUsrs);
|
||||||
|
HTM_DIV_End ();
|
||||||
|
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Status of the survey */
|
||||||
|
if (ShowOnlyThisSvyComplete)
|
||||||
|
HTM_TD_Begin ("rowspan=\"2\" class=\"LT\"");
|
||||||
|
else
|
||||||
|
HTM_TD_Begin ("rowspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
Svy_WriteStatus (&Svy);
|
||||||
|
|
||||||
|
if (!ShowOnlyThisSvyComplete)
|
||||||
{
|
{
|
||||||
HTM_DIV_Begin ("class=\"BUTTONS_AFTER_ALERT\"");
|
/* Possible button to answer this survey */
|
||||||
|
if (Svy.Status.ICanAnswer)
|
||||||
|
{
|
||||||
|
HTM_DIV_Begin ("class=\"BUTTONS_AFTER_ALERT\"");
|
||||||
|
|
||||||
Frm_BeginForm (ActSeeSvy);
|
Frm_BeginForm (ActSeeSvy);
|
||||||
Svy_PutParamSvyCod (Svy.SvyCod);
|
Svy_PutParamSvyCod (Svy.SvyCod);
|
||||||
Svy_PutHiddenParamSvyOrder (Surveys->SelectedOrder);
|
Svy_PutHiddenParamSvyOrder (Surveys->SelectedOrder);
|
||||||
WhichGroups = Grp_GetParamWhichGroups ();
|
WhichGroups = Grp_GetParamWhichGroups ();
|
||||||
Grp_PutParamWhichGroups (&WhichGroups);
|
Grp_PutParamWhichGroups (&WhichGroups);
|
||||||
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Surveys->CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Surveys->CurrentPage);
|
||||||
Btn_PutConfirmButtonInline (Txt_View_results);
|
Btn_PutCreateButtonInline (Txt_Answer_survey);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
}
|
||||||
|
/* Possible button to see the result of the survey */
|
||||||
|
else if (Svy.Status.ICanViewResults)
|
||||||
|
{
|
||||||
|
HTM_DIV_Begin ("class=\"BUTTONS_AFTER_ALERT\"");
|
||||||
|
|
||||||
|
Frm_BeginForm (ActSeeSvy);
|
||||||
|
Svy_PutParamSvyCod (Svy.SvyCod);
|
||||||
|
Svy_PutHiddenParamSvyOrder (Surveys->SelectedOrder);
|
||||||
|
WhichGroups = Grp_GetParamWhichGroups ();
|
||||||
|
Grp_PutParamWhichGroups (&WhichGroups);
|
||||||
|
Pag_PutHiddenParamPagNum (Pag_SURVEYS,Surveys->CurrentPage);
|
||||||
|
Btn_PutConfirmButtonInline (Txt_View_results);
|
||||||
|
Frm_EndForm ();
|
||||||
|
|
||||||
|
HTM_DIV_End ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Write second row of data of this survey *****/
|
/***** Write second row of data of this survey *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* 1st column: Author of the survey */
|
/* 1st column: Author of the survey */
|
||||||
if (ShowOnlyThisSvyComplete)
|
if (ShowOnlyThisSvyComplete)
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
Svy_WriteAuthor (&Svy);
|
Svy_WriteAuthor (&Svy);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* 2nd column: Scope, Users, Groups and Text */
|
/* 2nd column: Scope, Users, Groups and Text */
|
||||||
if (ShowOnlyThisSvyComplete)
|
if (ShowOnlyThisSvyComplete)
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
/* Scope of the survey */
|
/* Scope of the survey */
|
||||||
HTM_DIV_Begin ("class=\"%s\"",Svy.Status.Visible ? "ASG_GRP" :
|
HTM_DIV_Begin ("class=\"%s\"",Svy.Status.Visible ? "ASG_GRP" :
|
||||||
"ASG_GRP_LIGHT");
|
"ASG_GRP_LIGHT");
|
||||||
HTM_TxtColonNBSP (Txt_Scope);
|
HTM_TxtColonNBSP (Txt_Scope);
|
||||||
switch (Svy.Scope)
|
switch (Svy.Scope)
|
||||||
{
|
{
|
||||||
case HieLvl_UNK: // Unknown
|
case HieLvl_UNK: // Unknown
|
||||||
Err_WrongScopeExit ();
|
Err_WrongScopeExit ();
|
||||||
break;
|
break;
|
||||||
case HieLvl_SYS: // System
|
case HieLvl_SYS: // System
|
||||||
HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
|
HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
|
||||||
break;
|
break;
|
||||||
case HieLvl_CTY: // Country
|
case HieLvl_CTY: // Country
|
||||||
HTM_TxtF ("%s %s",Txt_Country,Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
HTM_TxtF ("%s %s",Txt_Country,Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
|
||||||
break;
|
break;
|
||||||
case HieLvl_INS: // Institution
|
case HieLvl_INS: // Institution
|
||||||
HTM_TxtF ("%s %s",Txt_Institution,Gbl.Hierarchy.Ins.ShrtName);
|
HTM_TxtF ("%s %s",Txt_Institution,Gbl.Hierarchy.Ins.ShrtName);
|
||||||
break;
|
break;
|
||||||
case HieLvl_CTR: // Center
|
case HieLvl_CTR: // Center
|
||||||
HTM_TxtF ("%s %s",Txt_Center,Gbl.Hierarchy.Ctr.ShrtName);
|
HTM_TxtF ("%s %s",Txt_Center,Gbl.Hierarchy.Ctr.ShrtName);
|
||||||
break;
|
break;
|
||||||
case HieLvl_DEG: // Degree
|
case HieLvl_DEG: // Degree
|
||||||
HTM_TxtF ("%s %s",Txt_Degree,Gbl.Hierarchy.Deg.ShrtName);
|
HTM_TxtF ("%s %s",Txt_Degree,Gbl.Hierarchy.Deg.ShrtName);
|
||||||
break;
|
break;
|
||||||
case HieLvl_CRS: // Course
|
case HieLvl_CRS: // Course
|
||||||
HTM_TxtF ("%s %s",Txt_Course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_Course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
||||||
/* Users' roles who can answer the survey */
|
/* Users' roles who can answer the survey */
|
||||||
HTM_DIV_Begin ("class=\"%s\"",Svy.Status.Visible ? "ASG_GRP" :
|
HTM_DIV_Begin ("class=\"%s\"",Svy.Status.Visible ? "ASG_GRP" :
|
||||||
"ASG_GRP_LIGHT");
|
"ASG_GRP_LIGHT");
|
||||||
HTM_TxtColon (Txt_Users);
|
HTM_TxtColon (Txt_Users);
|
||||||
HTM_BR ();
|
HTM_BR ();
|
||||||
Rol_WriteSelectorRoles (1 << Rol_STD |
|
Rol_WriteSelectorRoles (1 << Rol_STD |
|
||||||
1 << Rol_NET |
|
1 << Rol_NET |
|
||||||
1 << Rol_TCH,
|
1 << Rol_TCH,
|
||||||
Svy.Roles,
|
Svy.Roles,
|
||||||
true,false);
|
true,false);
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
||||||
/* Groups whose users can answer this survey */
|
/* Groups whose users can answer this survey */
|
||||||
if (Svy.Scope == HieLvl_CRS)
|
if (Svy.Scope == HieLvl_CRS)
|
||||||
if (Gbl.Crs.Grps.NumGrps)
|
if (Gbl.Crs.Grps.NumGrps)
|
||||||
Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (&Svy);
|
Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (&Svy);
|
||||||
|
|
||||||
/* Text of the survey */
|
/* Text of the survey */
|
||||||
Svy_GetSurveyTxtFromDB (Svy.SvyCod,Txt);
|
Svy_GetSurveyTxtFromDB (Svy.SvyCod,Txt);
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
||||||
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||||
HTM_DIV_Begin ("class=\"PAR %s\"",Svy.Status.Visible ? "DAT" :
|
HTM_DIV_Begin ("class=\"PAR %s\"",Svy.Status.Visible ? "DAT" :
|
||||||
"DAT_LIGHT");
|
"DAT_LIGHT");
|
||||||
HTM_Txt (Txt);
|
HTM_Txt (Txt);
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
@ -710,9 +710,9 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
|
||||||
if (ShowOnlyThisSvyComplete)
|
if (ShowOnlyThisSvyComplete)
|
||||||
{
|
{
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
HTM_TD_Begin ("colspan=\"5\"");
|
HTM_TD_Begin ("colspan=\"5\"");
|
||||||
Svy_ListSvyQuestions (Surveys,&Svy);
|
Svy_ListSvyQuestions (Surveys,&Svy);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -936,8 +936,12 @@ static void Svy_GetListSurveys (struct Svy_Surveys *Surveys)
|
||||||
char *SubQuery[HieLvl_NUM_LEVELS];
|
char *SubQuery[HieLvl_NUM_LEVELS];
|
||||||
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
|
static const char *OrderBySubQuery[Dat_NUM_START_END_TIME] =
|
||||||
{
|
{
|
||||||
[Dat_STR_TIME] = "StartTime DESC,EndTime DESC,Title DESC",
|
[Dat_STR_TIME] = "StartTime DESC,"
|
||||||
[Dat_END_TIME] = "EndTime DESC,StartTime DESC,Title DESC",
|
"EndTime DESC,"
|
||||||
|
"Title DESC",
|
||||||
|
[Dat_END_TIME] = "EndTime DESC,"
|
||||||
|
"StartTime DESC,"
|
||||||
|
"Title DESC",
|
||||||
};
|
};
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
unsigned long NumRows;
|
unsigned long NumRows;
|
||||||
|
@ -1223,7 +1227,7 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
||||||
if (Gbl.Hierarchy.Cty.CtyCod > 0) // Country selected
|
if (Gbl.Hierarchy.Cty.CtyCod > 0) // Country selected
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << HieLvl_CTY;
|
*ScopesAllowed |= 1 << HieLvl_CTY;
|
||||||
*HiddenAllowed |= 1 << HieLvl_CTY; // A system admin can view hidden country surveys
|
*HiddenAllowed |= 1 << HieLvl_CTY; // A system admin can view hidden country surveys
|
||||||
if (Gbl.Hierarchy.Ins.InsCod > 0) // Institution selected
|
if (Gbl.Hierarchy.Ins.InsCod > 0) // Institution selected
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << HieLvl_INS;
|
*ScopesAllowed |= 1 << HieLvl_INS;
|
||||||
|
@ -1235,7 +1239,7 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
||||||
if (Gbl.Hierarchy.Deg.DegCod > 0) // Degree selected
|
if (Gbl.Hierarchy.Deg.DegCod > 0) // Degree selected
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << HieLvl_DEG;
|
*ScopesAllowed |= 1 << HieLvl_DEG;
|
||||||
*HiddenAllowed |= 1 << HieLvl_DEG; // A system admin can view hidden degree surveys
|
*HiddenAllowed |= 1 << HieLvl_DEG; // A system admin can view hidden degree surveys
|
||||||
if (Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
|
if (Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
|
||||||
{
|
{
|
||||||
*ScopesAllowed |= 1 << HieLvl_CRS;
|
*ScopesAllowed |= 1 << HieLvl_CRS;
|
||||||
|
@ -1300,11 +1304,10 @@ void Svy_GetDataOfSurveyByCod (struct Svy_Survey *Svy)
|
||||||
/* Get author of the survey (row[5]) */
|
/* Get author of the survey (row[5]) */
|
||||||
Svy->UsrCod = Str_ConvertStrCodToLongCod (row[5]);
|
Svy->UsrCod = Str_ConvertStrCodToLongCod (row[5]);
|
||||||
|
|
||||||
/* Get start date (row[6] holds the start UTC time) */
|
/* Get start date (row[6] holds the start UTC time)
|
||||||
Svy->TimeUTC[Att_START_TIME] = Dat_GetUNIXTimeFromStr (row[6]);
|
and end date (row[7] holds the end UTC time) */
|
||||||
|
Svy->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[6]);
|
||||||
/* Get end date (row[7] holds the end UTC time) */
|
Svy->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[7]);
|
||||||
Svy->TimeUTC[Att_END_TIME ] = Dat_GetUNIXTimeFromStr (row[7]);
|
|
||||||
|
|
||||||
/* Get whether the survey is open or closed (row(8)) */
|
/* Get whether the survey is open or closed (row(8)) */
|
||||||
Svy->Status.Open = (row[8][0] == '1');
|
Svy->Status.Open = (row[8][0] == '1');
|
||||||
|
|
Loading…
Reference in New Issue