From d67d7c54e65e80d1b484490e42dbecb969aa7686 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 3 Oct 2015 12:09:27 -0400 Subject: Add web notifications --- app/Helper/Form.php | 20 ++++++++++++++++++++ app/Helper/User.php | 11 +++++++++++ 2 files changed, 31 insertions(+) (limited to 'app/Helper') diff --git a/app/Helper/Form.php b/app/Helper/Form.php index 83e3b113..a37cc81a 100644 --- a/app/Helper/Form.php +++ b/app/Helper/Form.php @@ -103,6 +103,26 @@ class Form extends \Core\Base return ''; } + /** + * Display a checkboxes group + * + * @access public + * @param string $name Field name + * @param array $options Options + * @param array $values Form values + * @return string + */ + public function checkboxes($name, array $options, array $values = array()) + { + $html = ''; + + foreach ($options as $value => $label) { + $html .= $this->checkbox($name.'['.$value.']', $label, $value, isset($values[$name]) && in_array($value, $values[$name])); + } + + return $html; + } + /** * Display a checkbox field * diff --git a/app/Helper/User.php b/app/Helper/User.php index 3108a79a..6b7d6f73 100644 --- a/app/Helper/User.php +++ b/app/Helper/User.php @@ -10,6 +10,17 @@ namespace Helper; */ class User extends \Core\Base { + /** + * Return true if the logged user as unread notifications + * + * @access public + * @return boolean + */ + public function hasNotifications() + { + return $this->webNotification->hasNotifications($this->userSession->getId()); + } + /** * Get initials from a user * -- cgit v1.2.3