summaryrefslogtreecommitdiff
path: root/app/Helper
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-03 12:09:27 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-03 12:09:27 -0400
commitd67d7c54e65e80d1b484490e42dbecb969aa7686 (patch)
treee62446885fac0d3af5b29d409d8e9a4f6c50940e /app/Helper
parentb5a2b8f9f7ac9ef947357acd3981993159d64b52 (diff)
Add web notifications
Diffstat (limited to 'app/Helper')
-rw-r--r--app/Helper/Form.php20
-rw-r--r--app/Helper/User.php11
2 files changed, 31 insertions, 0 deletions
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
@@ -104,6 +104,26 @@ class Form extends \Core\Base
}
/**
+ * 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
*
* @access public
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
@@ -11,6 +11,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
*
* @access public