");
for (FirstDayOfWeek = 0; // Monday
FirstDayOfWeek <= 6; // Sunday
FirstDayOfWeek++)
if (Cal_DayIsValidAsFirstDayOfWeek[FirstDayOfWeek])
{
fprintf (Gbl.F.Out,"
",
FirstDayOfWeek == Gbl.Prefs.FirstDayOfWeek ? "PREF_ON" :
"PREF_OFF");
Frm_StartForm (Action);
Par_PutHiddenParamUnsigned ("FirstDayOfWeek",FirstDayOfWeek);
if (FuncParams) // Extra parameters depending on the action
FuncParams ();
snprintf (Gbl.Title,sizeof (Gbl.Title),
"%s: %s",
Txt_First_day_of_the_week,Txt_DAYS_SMALL[FirstDayOfWeek]);
snprintf (Icon,sizeof (Icon),
"first-day-of-week-%u.png",
FirstDayOfWeek);
Ico_PutPrefIconLink (Icon,Gbl.Title);
Frm_EndForm ();
fprintf (Gbl.F.Out,"
");
}
fprintf (Gbl.F.Out,"
");
}
/*****************************************************************************/
/************************* Change first day of week **************************/
/*****************************************************************************/
void Cal_ChangeFirstDayOfWeek (void)
{
/***** Get param with icon set *****/
Gbl.Prefs.FirstDayOfWeek = Cal_GetParamFirstDayOfWeek ();
/***** Store icon first day of week database *****/
if (Gbl.Usrs.Me.Logged)
DB_QueryUPDATE ("can not update your preference about first day of week",
"UPDATE usr_data SET FirstDayOfWeek=%u"
" WHERE UsrCod=%ld",
Gbl.Prefs.FirstDayOfWeek,
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Set preferences from current IP *****/
Pre_SetPrefsFromIP ();
}
/*****************************************************************************/
/*********************** Get parameter with icon set *************************/
/*****************************************************************************/
static unsigned Cal_GetParamFirstDayOfWeek (void)
{
unsigned FirstDayOfWeek;
FirstDayOfWeek = (unsigned)
Par_GetParToUnsignedLong ("FirstDayOfWeek",
0,
6,
Cal_FIRST_DAY_OF_WEEK_DEFAULT);
if (!Cal_DayIsValidAsFirstDayOfWeek[FirstDayOfWeek])
FirstDayOfWeek = Cal_FIRST_DAY_OF_WEEK_DEFAULT;
return FirstDayOfWeek;
}
/*****************************************************************************/
/******************** Get first day of week from string **********************/
/*****************************************************************************/
unsigned Cal_GetFirstDayOfWeekFromStr (const char *Str)
{
unsigned UnsignedNum;
if (sscanf (Str,"%u",&UnsignedNum) == 1)
if (Cal_DayIsValidAsFirstDayOfWeek[UnsignedNum])
return (Dat_Format_t) UnsignedNum;
return Cal_FIRST_DAY_OF_WEEK_DEFAULT;
}
/*****************************************************************************/
/***************************** Draw current month ****************************/
/*****************************************************************************/
void Cal_DrawCurrentMonth (void)
{
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
char ParamsStr[Frm_MAX_BYTES_PARAMS_STR];
/***** Get list of holidays *****/
if (!Gbl.Hlds.LstIsRead)
{
Gbl.Hlds.SelectedOrder = Hld_ORDER_BY_START_DATE;
Hld_GetListHolidays ();
}
/***** Draw the month in JavaScript *****/
/* JavaScript will write HTML here */
fprintf (Gbl.F.Out,"