mirror of https://github.com/acanas/swad-core.git
Version 15.21.1
This commit is contained in:
parent
51d9385403
commit
5dc75275fc
53
js/swad.js
53
js/swad.js
|
@ -110,17 +110,24 @@ function setLocalDateTimeFormFromUTC(id,secsSince1970UTC) {
|
|||
// Set UTC time from local date-time form fields
|
||||
function setUTCFromLocalDateTimeForm(id) {
|
||||
var d = new Date;
|
||||
var Year = document.getElementById(id+'Year' ).value;
|
||||
var Month = document.getElementById(id+'Month' ).value;
|
||||
var Day = document.getElementById(id+'Day' ).value;
|
||||
|
||||
// Important: set year first in order to work properly with leap years
|
||||
d.setFullYear(document.getElementById(id+'Year' ).value);
|
||||
d.setMonth (document.getElementById(id+'Month' ).value-1);
|
||||
d.setDate (document.getElementById(id+'Day' ).value);
|
||||
d.setHours (document.getElementById(id+'Hour' ).value);
|
||||
d.setMinutes (document.getElementById(id+'Minute').value);
|
||||
d.setSeconds (document.getElementById(id+'Second').value);
|
||||
d.setMilliseconds(0);
|
||||
|
||||
document.getElementById(id+'TimeUTC').value = d.getTime() / 1000;
|
||||
if (Year == 0 || Month == 0 || Day == 0)
|
||||
document.getElementById(id+'TimeUTC').value = 0;
|
||||
else {
|
||||
// Important: set year first in order to work properly with leap years
|
||||
d.setFullYear(Year);
|
||||
d.setMonth (Month-1);
|
||||
d.setDate (Day);
|
||||
d.setHours (document.getElementById(id+'Hour' ).value);
|
||||
d.setMinutes (document.getElementById(id+'Minute').value);
|
||||
d.setSeconds (document.getElementById(id+'Second').value);
|
||||
d.setMilliseconds(0);
|
||||
|
||||
document.getElementById(id+'TimeUTC').value = d.getTime() / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust a date form correcting days in the month
|
||||
|
@ -151,16 +158,24 @@ function adjustDateForm (id) {
|
|||
}
|
||||
|
||||
// Set a the date in a date form to a specified date
|
||||
function setDateTo (elem,Day,Month,Year) {
|
||||
document.getElementById('StartYear' ).options[Year ].selected = true;
|
||||
document.getElementById('StartMonth').options[Month].selected = true;
|
||||
adjustDateForm (elem.form.StartDay,elem.form.StartMonth,elem.form.StartYear)
|
||||
document.getElementById('StartDay' ).options[Day ].selected = true;
|
||||
function setDateTo (Day,Month,Year) {
|
||||
document.getElementById('StartYear' ).options[Year ].selected = true;
|
||||
document.getElementById('StartMonth' ).options[Month].selected = true;
|
||||
adjustDateForm ('Start')
|
||||
document.getElementById('StartDay' ).options[Day ].selected = true;
|
||||
document.getElementById('StartHour' ).options[0 ].selected = true;
|
||||
document.getElementById('StartMinute').options[0 ].selected = true;
|
||||
document.getElementById('StartSecond').options[0 ].selected = true;
|
||||
setUTCFromLocalDateTimeForm('Start');
|
||||
|
||||
document.getElementById('EndYear' ).options[Year ].selected = true;
|
||||
document.getElementById('EndMonth').options[Month].selected = true;
|
||||
adjustDateForm (elem.form.EndDay,elem.form.EndMonth,elem.form.EndYear)
|
||||
document.getElementById('EndDay' ).options[Day ].selected = true;
|
||||
document.getElementById('EndYear' ).options[Year ].selected = true;
|
||||
document.getElementById('EndMonth' ).options[Month].selected = true;
|
||||
adjustDateForm ('End')
|
||||
document.getElementById('EndDay' ).options[Day ].selected = true;
|
||||
document.getElementById('EndHour' ).options[23 ].selected = true;
|
||||
document.getElementById('EndMinute' ).options[59 ].selected = true;
|
||||
document.getElementById('EndSecond' ).options[59 ].selected = true;
|
||||
setUTCFromLocalDateTimeForm('End');
|
||||
}
|
||||
|
||||
// Write clock in client local time updated every minute
|
||||
|
|
|
@ -2160,7 +2160,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActSeeTst */{ 29,-1,TabAss,ActReqTst ,0x118,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Tst_ShowNewTestExam ,NULL},
|
||||
/* ActAssTst */{ 98,-1,TabAss,ActReqTst ,0x118,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Tst_AssessTestExam ,NULL},
|
||||
|
||||
/* ActEdiTstQst */{ 104,-1,TabAss,ActReqTst ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Tst_ShowFormAskEditTsts ,NULL},
|
||||
/* ActEdiTstQst */{ 104,-1,TabAss,ActReqTst ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,Tst_SetIniEndDates ,Tst_ShowFormAskEditTsts ,NULL},
|
||||
/* ActEdiOneTstQst */{ 105,-1,TabAss,ActReqTst ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Tst_ShowFormEditOneQst ,NULL},
|
||||
/* ActReqImpTstQst */{1007,-1,TabAss,ActReqTst ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,TsI_ShowFormImportQstsFromXML ,NULL},
|
||||
/* ActImpTstQst */{1008,-1,TabAss,ActReqTst ,0x110,0x100,0x000,Act_CONTENT_DATA,Act_MAIN_WINDOW,NULL ,TsI_ImportQstsFromXML ,NULL},
|
||||
|
|
|
@ -108,11 +108,12 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.21 (2015/10/25)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.21.1 (2015/10/26)"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 15.21.1: Oct 26, 2015 New forms to enter range of date-times in statistic and test. (186313 lines)
|
||||
Version 15.21: Oct 25, 2015 New forms to enter range of date-times in statistic and test. Not finished. (186549 lines)
|
||||
Version 15.20.2: Oct 24, 2015 Code refactoring related to date-times forms. (186294 lines)
|
||||
Version 15.20.1: Oct 24, 2015 Detailed clics are displayed in client local date-time. (186333 lines)
|
||||
|
|
286
swad_date.c
286
swad_date.c
|
@ -67,10 +67,6 @@ static void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id,
|
|||
time_t TimeUTC,
|
||||
unsigned FirstYear,unsigned LastYear,
|
||||
bool SubmitFormOnChange,bool Disabled);
|
||||
static void Dat_WriteFormClientLocalDateTimeFromYMDhms (const char *Id,
|
||||
struct Date *DateSelected,
|
||||
unsigned FirstYear,unsigned LastYear,
|
||||
bool SubmitFormOnChange,bool Disabled);
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Get current time ******************************/
|
||||
|
@ -118,7 +114,12 @@ time_t Dat_GetUNIXTimeFromStr (const char *Str)
|
|||
{
|
||||
time_t Time;
|
||||
|
||||
if (sscanf (Str,"%ld",&Time) != 1)
|
||||
if (Str[0])
|
||||
{
|
||||
if (sscanf (Str,"%ld",&Time) != 1)
|
||||
Time = (time_t) 0;
|
||||
}
|
||||
else
|
||||
Time = (time_t) 0;
|
||||
|
||||
return Time;
|
||||
|
@ -222,63 +223,6 @@ void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr)
|
|||
/*************** Show forms to enter initial and ending dates ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Dat_WriteFormIniEndDates (void)
|
||||
{
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
extern const char *Txt_Start_date;
|
||||
extern const char *Txt_End_date;
|
||||
extern const char *Txt_Yesterday;
|
||||
extern const char *Txt_Today;
|
||||
|
||||
/***** Start date *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s:"
|
||||
"</td>"
|
||||
"<td class=\"LEFT_MIDDLE\">",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Start_date);
|
||||
Dat_WriteFormDate (Cfg_LOG_START_YEAR,Gbl.Now.Date.Year,"Start",
|
||||
&(Gbl.DateRange.DateIni),
|
||||
false,false);
|
||||
|
||||
/***** "Yesterday" and "Today" buttons *****/
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"<td rowspan=\"2\" class=\"LEFT_MIDDLE\">"
|
||||
"<input type=\"button\" name=\"Yesterday\" value=\"%s\""
|
||||
" onclick=\"setDateTo(this,%u,%u,%u)\" />"
|
||||
"<input type=\"button\" name=\"Today\" value=\"%s\""
|
||||
" onclick=\"setDateTo(this,%u,%u,%u)\" />"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Txt_Yesterday,
|
||||
Gbl.Yesterday.Day,
|
||||
Gbl.Yesterday.Month,
|
||||
Gbl.Yesterday.Year - Cfg_LOG_START_YEAR + 1,
|
||||
Txt_Today,
|
||||
Gbl.Now.Date.Day,
|
||||
Gbl.Now.Date.Month,
|
||||
Gbl.Now.Date.Year - Cfg_LOG_START_YEAR + 1);
|
||||
|
||||
/***** End date *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s:"
|
||||
"</td>"
|
||||
"<td class=\"LEFT_MIDDLE\">",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_End_date);
|
||||
Dat_WriteFormDate (Cfg_LOG_START_YEAR,Gbl.Now.Date.Year,"End",
|
||||
&(Gbl.DateRange.DateEnd),
|
||||
false,false);
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Show forms to enter initial and ending dates ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (void)
|
||||
{
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
|
@ -296,19 +240,19 @@ void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (void)
|
|||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Start_date);
|
||||
/* Date-time */
|
||||
Dat_WriteFormClientLocalDateTimeFromYMDhms ("Start",
|
||||
&Gbl.DateRange.DateIni,
|
||||
Cfg_LOG_START_YEAR,
|
||||
Gbl.Now.Date.Year,
|
||||
false,false);
|
||||
Dat_WriteFormClientLocalDateTimeFromTimeUTC ("Start",
|
||||
Gbl.DateRange.TimeUTC[0],
|
||||
Cfg_LOG_START_YEAR,
|
||||
Gbl.Now.Date.Year,
|
||||
false,false);
|
||||
|
||||
/***** "Yesterday" and "Today" buttons *****/
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"<td rowspan=\"2\" class=\"LEFT_MIDDLE\">"
|
||||
"<input type=\"button\" name=\"Yesterday\" value=\"%s\""
|
||||
" onclick=\"setDateTo(this,%u,%u,%u)\" />"
|
||||
" onclick=\"setDateTo(%u,%u,%u);\" />"
|
||||
"<input type=\"button\" name=\"Today\" value=\"%s\""
|
||||
" onclick=\"setDateTo(this,%u,%u,%u)\" />"
|
||||
" onclick=\"setDateTo(%u,%u,%u);\" />"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Txt_Yesterday,
|
||||
|
@ -329,11 +273,11 @@ void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (void)
|
|||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_End_date);
|
||||
/* Date-time */
|
||||
Dat_WriteFormClientLocalDateTimeFromYMDhms ("End",
|
||||
&Gbl.DateRange.DateEnd,
|
||||
Cfg_LOG_START_YEAR,
|
||||
Gbl.Now.Date.Year,
|
||||
false,false);
|
||||
Dat_WriteFormClientLocalDateTimeFromTimeUTC ("End",
|
||||
Gbl.DateRange.TimeUTC[1],
|
||||
Cfg_LOG_START_YEAR,
|
||||
Gbl.Now.Date.Year,
|
||||
false,false);
|
||||
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
|
@ -552,200 +496,6 @@ static void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id,
|
|||
Id,(long) TimeUTC,Id);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Show a form to enter a date ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Dat_WriteFormClientLocalDateTimeFromYMDhms (const char *Id,
|
||||
struct Date *DateSelected,
|
||||
unsigned FirstYear,unsigned LastYear,
|
||||
bool SubmitFormOnChange,bool Disabled)
|
||||
{
|
||||
extern const char *Txt_MONTHS_SMALL[12];
|
||||
unsigned Day;
|
||||
unsigned Month;
|
||||
unsigned Year;
|
||||
unsigned Hour;
|
||||
unsigned Minute;
|
||||
unsigned Second;
|
||||
unsigned NumDaysSelectedMonth = (DateSelected->Month == 0) ? 31 :
|
||||
((DateSelected->Month == 2) ? Dat_GetNumDaysFebruary (DateSelected->Year) :
|
||||
Dat_NumDaysMonth[DateSelected->Month]);
|
||||
struct Time TimeSelected; // Put hour, minute and second in struct Date
|
||||
TimeSelected.Hour = 0;
|
||||
TimeSelected.Minute = 0;
|
||||
TimeSelected.Second = 0;
|
||||
|
||||
/***** Start table *****/
|
||||
fprintf (Gbl.F.Out,"<table>"
|
||||
"<tr>");
|
||||
|
||||
/***** Year *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
"<select id=\"%sYear\" name=\"%sYear\""
|
||||
" onchange=\""
|
||||
"adjustDateForm('%s');"
|
||||
"setUTCFromLocalDateTimeForm('%s');",
|
||||
Id,Id,Id,Id);
|
||||
if (SubmitFormOnChange)
|
||||
fprintf (Gbl.F.Out,"document.getElementById('%s').submit();",
|
||||
Gbl.FormId);
|
||||
fprintf (Gbl.F.Out,"\"");
|
||||
if (Disabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out,"><option value=\"0\">-</option>");
|
||||
for (Year = FirstYear;
|
||||
Year <= LastYear;
|
||||
Year++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",Year);
|
||||
if (Year == DateSelected->Year)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%u</option>",Year);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</td>");
|
||||
|
||||
/***** Month *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
"<select id=\"%sMonth\" name=\"%sMonth\""
|
||||
" onchange=\""
|
||||
"adjustDateForm('%s');"
|
||||
"setUTCFromLocalDateTimeForm('%s');",
|
||||
Id,Id,Id,Id);
|
||||
if (SubmitFormOnChange)
|
||||
fprintf (Gbl.F.Out,"document.getElementById('%s').submit();",
|
||||
Gbl.FormId);
|
||||
fprintf (Gbl.F.Out,"\"");
|
||||
if (Disabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out,"><option value=\"0\">-</option>");
|
||||
for (Month = 1;
|
||||
Month <= 12;
|
||||
Month++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",Month);
|
||||
if (Month == DateSelected->Month)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",Txt_MONTHS_SMALL[Month - 1]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</td>");
|
||||
|
||||
/***** Day *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
"<select id=\"%sDay\" name=\"%sDay\""
|
||||
" onchange=\"setUTCFromLocalDateTimeForm('%s');",
|
||||
Id,Id,Id);
|
||||
if (SubmitFormOnChange)
|
||||
fprintf (Gbl.F.Out,"document.getElementById('%s').submit();",
|
||||
Gbl.FormId);
|
||||
fprintf (Gbl.F.Out,"\"");
|
||||
if (Disabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out,">"
|
||||
"<option value=\"0\">-</option>");
|
||||
for (Day = 1;
|
||||
Day <= NumDaysSelectedMonth;
|
||||
Day++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",Day);
|
||||
if (Day == DateSelected->Day)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%u</option>",Day);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</td>");
|
||||
|
||||
/***** Hour *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">, "
|
||||
"<select id=\"%sHour\" name=\"%sHour\""
|
||||
" onchange=\"setUTCFromLocalDateTimeForm('%s');",
|
||||
Id,Id,Id);
|
||||
if (SubmitFormOnChange)
|
||||
fprintf (Gbl.F.Out,"document.getElementById('%s').submit();",
|
||||
Gbl.FormId);
|
||||
fprintf (Gbl.F.Out,"\"");
|
||||
if (Disabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out,">");
|
||||
for (Hour = 0;
|
||||
Hour <= 23;
|
||||
Hour++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",Hour);
|
||||
if (Hour == TimeSelected.Hour)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%02u h</option>",Hour);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</td>");
|
||||
|
||||
/***** Minute *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
||||
"<select id=\"%sMinute\" name=\"%sMinute\""
|
||||
" onchange=\"setUTCFromLocalDateTimeForm('%s');",
|
||||
Id,Id,Id);
|
||||
if (SubmitFormOnChange)
|
||||
fprintf (Gbl.F.Out,"document.getElementById('%s').submit();",
|
||||
Gbl.FormId);
|
||||
fprintf (Gbl.F.Out,"\"");
|
||||
if (Disabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out,">");
|
||||
for (Minute = 0;
|
||||
Minute <= 59;
|
||||
Minute++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",Minute);
|
||||
if (Minute == TimeSelected.Minute)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%02u '</option>",Minute);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</td>");
|
||||
|
||||
/***** Second *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
||||
"<select id=\"%sSecond\" name=\"%sSecond\""
|
||||
" onchange=\"setUTCFromLocalDateTimeForm('%s');",
|
||||
Id,Id,Id);
|
||||
if (SubmitFormOnChange)
|
||||
fprintf (Gbl.F.Out,"document.getElementById('%s').submit();",
|
||||
Gbl.FormId);
|
||||
fprintf (Gbl.F.Out,"\"");
|
||||
if (Disabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out,">");
|
||||
for (Second = 0;
|
||||
Second <= 59;
|
||||
Second++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",Second);
|
||||
if (Second == TimeSelected.Second)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%02u "</option>",Second);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</td>");
|
||||
|
||||
/***** End table *****/
|
||||
fprintf (Gbl.F.Out,"</tr>"
|
||||
"</table>");
|
||||
|
||||
/***** Hidden field with UTC time (seconds since 1970) used to send time *****/
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\" id=\"%sTimeUTC\" name=\"%sTimeUTC\" value=\"0\" />",
|
||||
Id,Id);
|
||||
|
||||
/***** Script to set UTC time from selectors with local date and time *****/
|
||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
||||
"setUTCFromLocalDateTimeForm('%s');"
|
||||
"adjustDateForm('%s');"
|
||||
"</script>",
|
||||
Id,Id);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Get an hour-minute time from a form ***********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -77,7 +77,6 @@ void Dat_ShowClientLocalTime (void);
|
|||
void Dat_GetLocalTimeFromClock (const time_t *clock);
|
||||
void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr);
|
||||
|
||||
void Dat_WriteFormIniEndDates (void);
|
||||
void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (void);
|
||||
void Dat_PutFormStartEndClientLocalDateTimes (time_t TimeUTC[2]);
|
||||
|
||||
|
|
|
@ -393,13 +393,6 @@ void Gbl_InitializeGlobals (void)
|
|||
|
||||
Gbl.Usrs.ClassPhoto.Cols = Usr_CLASS_PHOTO_COLS_DEF;
|
||||
|
||||
Gbl.DateRange.DateIni.Year = Cfg_LOG_START_YEAR;
|
||||
Gbl.DateRange.DateIni.Month = Cfg_LOG_START_MONTH;
|
||||
Gbl.DateRange.DateIni.Day = Cfg_LOG_START_DAY;
|
||||
Gbl.DateRange.DateEnd.Year = Gbl.Now.Date.Year;
|
||||
Gbl.DateRange.DateEnd.Month = Gbl.Now.Date.Month;
|
||||
Gbl.DateRange.DateEnd.Day = Gbl.Now.Date.Day;
|
||||
|
||||
Gbl.Stat.ClicksGroupedBy = Sta_CLICKS_CRS_PER_USR;
|
||||
Gbl.Stat.CountType = Sta_TOTAL_CLICKS;
|
||||
Gbl.Stat.Role = Sta_IDENTIFIED_USRS;
|
||||
|
|
|
@ -506,7 +506,6 @@ void Sta_AskShowCrsHits (void)
|
|||
"</tr>");
|
||||
|
||||
/***** Initial and final dates of the search *****/
|
||||
// Dat_WriteFormIniEndDates ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
|
||||
/***** Selection of action *****/
|
||||
|
@ -644,7 +643,6 @@ void Sta_AskShowGblHits (void)
|
|||
Lay_StartRoundFrameTable (NULL,2,Txt_Statistics_of_all_visits);
|
||||
|
||||
/***** Start and end dates for the search *****/
|
||||
// Dat_WriteFormIniEndDates ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
|
||||
/***** Users' roles whose accesses we want to see *****/
|
||||
|
@ -801,29 +799,8 @@ static void Sta_WriteSelectorAction (void)
|
|||
|
||||
void Sta_SetIniEndDates (void)
|
||||
{
|
||||
extern const unsigned Dat_NumDaysMonth[1+12]; // Declaration in swad_date.c
|
||||
|
||||
Gbl.DateRange.DateEnd.Day = Gbl.Now.Date.Day;
|
||||
Gbl.DateRange.DateEnd.Month = Gbl.Now.Date.Month;
|
||||
Gbl.DateRange.DateEnd.Year = Gbl.Now.Date.Year;
|
||||
|
||||
if (Gbl.DateRange.DateEnd.Day >= Cfg_DAYS_IN_RECENT_LOG)
|
||||
{
|
||||
Gbl.DateRange.DateIni.Year = Gbl.DateRange.DateEnd.Year;
|
||||
Gbl.DateRange.DateIni.Month = Gbl.DateRange.DateEnd.Month;
|
||||
Gbl.DateRange.DateIni.Day = Gbl.DateRange.DateEnd.Day - (Cfg_DAYS_IN_RECENT_LOG-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gbl.DateRange.DateIni.Year = (Gbl.DateRange.DateEnd.Month == 1) ? Gbl.DateRange.DateEnd.Year - 1 :
|
||||
Gbl.DateRange.DateEnd.Year;
|
||||
Gbl.DateRange.DateIni.Month = (Gbl.DateRange.DateEnd.Month == 1) ? 12 :
|
||||
Gbl.DateRange.DateEnd.Month - 1;
|
||||
Gbl.DateRange.DateIni.Day = ((Gbl.DateRange.DateIni.Month == 2) ? Dat_GetNumDaysFebruary (Gbl.DateRange.DateIni.Year) :
|
||||
Dat_NumDaysMonth[Gbl.DateRange.DateIni.Month]) +
|
||||
Gbl.DateRange.DateEnd.Day -
|
||||
(Cfg_DAYS_IN_RECENT_LOG-1);
|
||||
}
|
||||
Gbl.DateRange.TimeUTC[0] = Gbl.TimeStartExecution - ((Cfg_DAYS_IN_RECENT_LOG - 1) * 24 * 60 * 60);
|
||||
Gbl.DateRange.TimeUTC[1] = Gbl.TimeStartExecution;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
14
swad_test.c
14
swad_test.c
|
@ -1079,6 +1079,17 @@ static void Tst_UpdateLastAccTst (void)
|
|||
DB_QueryUPDATE (Query,"can not update time and number of questions of this test");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Set end date to current date ************/
|
||||
/************ and set initial date to end date minus several days ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Tst_SetIniEndDates (void)
|
||||
{
|
||||
Gbl.DateRange.TimeUTC[0] = (time_t) 0;
|
||||
Gbl.DateRange.TimeUTC[1] = Gbl.TimeStartExecution;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Select tags and dates for edition of the self-assessment test *******/
|
||||
/*****************************************************************************/
|
||||
|
@ -1120,7 +1131,6 @@ void Tst_ShowFormAskEditTsts (void)
|
|||
/***** Starting and ending dates in the search *****/
|
||||
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\""
|
||||
" style=\"margin:0 auto;\">");
|
||||
// Dat_WriteFormIniEndDates ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
fprintf (Gbl.F.Out,"</table>"
|
||||
"</div>");
|
||||
|
@ -5949,7 +5959,6 @@ void Tst_SelUsrsToSeeUsrsTstExams (void)
|
|||
"</tr>");
|
||||
|
||||
/***** Starting and ending dates in the search *****/
|
||||
// Dat_WriteFormIniEndDates ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
|
||||
fprintf (Gbl.F.Out,"</table>");
|
||||
|
@ -5992,7 +6001,6 @@ void Tst_SelDatesToSeeMyTstExams (void)
|
|||
|
||||
/***** Starting and ending dates in the search *****/
|
||||
Lay_StartRoundFrameTable (NULL,2,Txt_Exams);
|
||||
// Dat_WriteFormIniEndDates ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
|
||||
/***** Send button and end frame *****/
|
||||
|
|
|
@ -124,6 +124,8 @@ void Tst_ShowNewTestExam (void);
|
|||
void Tst_AssessTestExam (void);
|
||||
void Tst_WriteQstStem (const char *Stem,const char *ClassStem);
|
||||
void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback);
|
||||
|
||||
void Tst_SetIniEndDates (void);
|
||||
void Tst_ShowFormAskEditTsts (void);
|
||||
void Tst_ListQuestionsToEdit (void);
|
||||
void Tst_WriteParamEditQst (void);
|
||||
|
|
Loading…
Reference in New Issue