 |
Today |
Tomorrow |
This
Week |
This
Month |
Next Alarm |
[%todaycnt = DBI.query("select count(*) cnt from notes where owner = ? and alarm_on = 1 and date(alarm) = current_date", profile.userid).get().cnt%]
[%tomorrowcnt = DBI.query("select count(*) cnt from notes where owner = ? and alarm_on = 1 and date(alarm) = date_add(current_date, interval 1 day)", profile.userid).get().cnt%]
[%thisweekcnt = DBI.query("select count(*) cnt from notes where owner = ? and alarm_on = 1 and DATE_FORMAT(alarm, '%v') = DATE_FORMAT(CURRENT_DATE, '%v')", profile.userid).get().cnt%]
[%monthcnt = DBI.query("select count(*) cnt from notes where owner = ? and alarm_on = 1 and month(alarm) = month(current_date) and year(alarm) = year(current_date)", profile.userid).get().cnt%]
[%overdue = []%]
[%FOREACH note = DBI.query("
select *, UNIX_TIMESTAMP(current_timestamp) - UNIX_TIMESTAMP(alarm) due,
date_format(alarm,'%d/%m/%Y %H:%i (%a)') alarm
from notes
where alarm_on = 1 and owner = ? and (UNIX_TIMESTAMP(current_timestamp) - UNIX_TIMESTAMP(alarm)) >= 0
order by alarm
",profile.userid)%]
[%overdue.push(note)%]
[%END%]
[%period = []%]
[%IF pars.period%]
[%condition = ''%]
[%SWITCH pars.period%]
[%CASE "Today"%]
[%condition = "and date(alarm) = current_date"%]
[%CASE "Tomorrow"%]
[%condition = "and date(alarm) = date_add(current_date, interval 1 day)"%]
[%CASE "This Week"%]
[%condition = "and DATE_FORMAT(alarm, '%v') = DATE_FORMAT(CURRENT_DATE, '%v')"%]
[%CASE "This Month"%]
[%condition = "and month(alarm) = month(current_date) and year(alarm) = year(current_date)"%]
[%END%]
[%FOREACH note = DBI.query("
select *, UNIX_TIMESTAMP(current_timestamp) - UNIX_TIMESTAMP(alarm) due,
date_format(alarm,'%d/%m/%Y %H:%i (%a)') alarm
from notes
where alarm_on = 1 and owner = ? $condition
order by alarm
",profile.userid)%]
[%period.push(note)%]
[%END%]
[%END%]
[%todaycnt%]
|
[%tomorrowcnt%]
|
[%thisweekcnt%]
|
[%monthcnt%]
|
[%nextnote = DBI.query("select *,date_format(alarm,'%d/%m/%Y %H:%i (%a)') falarm from notes where alarm > current_timestamp and alarm_on = 1 order by alarm limit 1;").get()%]
[%IF nextnote%]
[%nextnote.subject%]
-
[%nextnote.falarm%]
-
[%repeat_drop.${nextnote.repeattime}%]
[%ELSE%]
N/a
[%END%] |
[%IF ! pars.period%]
Overdue |
[%IF overdue.size%]
[%ELSE%]
No overdue alarms.
[%END%] |
[%END%]
[%IF pars.period%]
List of
[%pars.period%]
Alarms |
[%IF period.size%]
[%FOREACH note = period%]
[%note.subject%]
|
[%priority_drop.${note.priority}%]
|
[%IF note.due > 0%]
Overdue:
[%ELSE%]
Due in:
[%END%]
[%stringtimefull(note.due)%] |
[%note.alarm%]
-
[%repeat_drop.${note.repeattime}%] |
[%END%]
[%ELSE%]
No alarms.
[%END%]
|
[%END%]
Calendar View New Alarm / Note Notes |
|