Add email notifications

This commit is contained in:
Frédéric Guillot
2014-08-15 17:23:41 -07:00
parent c539bdc8ab
commit 9eeded33f6
240 changed files with 23410 additions and 308 deletions

View File

@@ -20,6 +20,14 @@ class Comment extends Base
*/
const TABLE = 'comments';
/**
* Events
*
* @var string
*/
const EVENT_UPDATE = 'comment.update';
const EVENT_CREATE = 'comment.create';
/**
* Get all comments for a given task
*
@@ -95,7 +103,14 @@ class Comment extends Base
{
$values['date'] = time();
return $this->db->table(self::TABLE)->save($values);
if ($this->db->table(self::TABLE)->save($values)) {
$values['id'] = $this->db->getConnection()->getLastId();
$this->event->trigger(self::EVENT_CREATE, $values);
return true;
}
return false;
}
/**
@@ -107,10 +122,14 @@ class Comment extends Base
*/
public function update(array $values)
{
return $this->db
$result = $this->db
->table(self::TABLE)
->eq('id', $values['id'])
->update(array('comment' => $values['comment']));
$this->event->trigger(self::EVENT_UPDATE, $values);
return $result;
}
/**