Store event alarm status by event uid + user id. Attention: database schema changed!
This commit is contained in:
parent
839adb2c26
commit
394fb8f56d
3 changed files with 22 additions and 10 deletions
|
@ -13,7 +13,7 @@
|
|||
+ View: 3.3: Display modes (agenda / day / week / month)
|
||||
+ Day / Week / Month
|
||||
+ List (Agenda) view
|
||||
- Add selection for date range
|
||||
+ Add selection for date range
|
||||
- Individual days selection
|
||||
+ Show list of calendars in a (hideable) drawer
|
||||
+ View: 3.1: Folder list
|
||||
|
@ -39,6 +39,7 @@
|
|||
+ Colors for calendars should be user-configurable
|
||||
+ ICS parser/generator (http://code.google.com/p/qcal/)
|
||||
|
||||
- Script to send event alarms by email (in cronjob)
|
||||
- Export *with* attachments
|
||||
- Remember last visited view
|
||||
- Create/manage invdividual views
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
|
||||
CREATE TABLE IF NOT EXISTS `kolab_alarms` (
|
||||
`event_id` VARCHAR(255) NOT NULL,
|
||||
`user_id` int(10) UNSIGNED NOT NULL,
|
||||
`notifyat` DATETIME DEFAULT NULL,
|
||||
`dismissed` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(`event_id`)
|
||||
PRIMARY KEY(`event_id`),
|
||||
CONSTRAINT `fk_kolab_alarms_user_id` FOREIGN KEY (`user_id`)
|
||||
REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) /*!40000 ENGINE=INNODB */;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `itipinvitations` (
|
||||
|
|
|
@ -786,11 +786,13 @@ class kolab_driver extends calendar_driver
|
|||
if (!empty($events)) {
|
||||
$event_ids = array_map(array($this->rc->db, 'quote'), array_keys($events));
|
||||
$result = $this->rc->db->query(sprintf(
|
||||
"SELECT * FROM kolab_alarms
|
||||
WHERE event_id IN (%s)",
|
||||
join(',', $event_ids),
|
||||
$this->rc->db->now()
|
||||
));
|
||||
"SELECT * FROM kolab_alarms
|
||||
WHERE event_id IN (%s) AND user_id=?",
|
||||
join(',', $event_ids),
|
||||
$this->rc->db->now()
|
||||
),
|
||||
$this->rc->user->ID
|
||||
);
|
||||
|
||||
while ($result && ($e = $this->rc->db->fetch_assoc($result))) {
|
||||
$dbdata[$e['event_id']] = $e;
|
||||
|
@ -820,16 +822,22 @@ class kolab_driver extends calendar_driver
|
|||
public function dismiss_alarm($event_id, $snooze = 0)
|
||||
{
|
||||
// delete old alarm entry
|
||||
$this->rc->db->query("DELETE FROM kolab_alarms WHERE event_id=?", $event_id);
|
||||
$this->rc->db->query(
|
||||
"DELETE FROM kolab_alarms
|
||||
WHERE event_id=? AND user_id=?",
|
||||
$event_id,
|
||||
$this->rc->user->ID
|
||||
);
|
||||
|
||||
// set new notifyat time or unset if not snoozed
|
||||
$notifyat = $snooze > 0 ? date('Y-m-d H:i:s', time() + $snooze) : null;
|
||||
|
||||
$query = $this->rc->db->query(
|
||||
"INSERT INTO kolab_alarms
|
||||
(event_id, dismissed, notifyat)
|
||||
VALUES(?, ?, ?)",
|
||||
(event_id, user_id, dismissed, notifyat)
|
||||
VALUES(?, ?, ?, ?)",
|
||||
$event_id,
|
||||
$this->rc->user->ID,
|
||||
$snooze > 0 ? 0 : 1,
|
||||
$notifyat
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue