From e0de75d16074ca4b8ead5d4961a3c35cfadd1671 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 5 Feb 2016 16:47:54 +0100 Subject: [PATCH] add method getNotifications() --- SeedDMS_Core/Core/inc.ClassGroup.php | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/SeedDMS_Core/Core/inc.ClassGroup.php b/SeedDMS_Core/Core/inc.ClassGroup.php index 88535dad0..dc86ba64a 100644 --- a/SeedDMS_Core/Core/inc.ClassGroup.php +++ b/SeedDMS_Core/Core/inc.ClassGroup.php @@ -321,5 +321,34 @@ class SeedDMS_Core_Group { return $status; } /* }}} */ + + /** + * Get all notifications of group + * + * @param integer $type type of item (T_DOCUMENT or T_FOLDER) + * @return array array of notifications + */ + function getNotificationsByGroup($type=0) { /* {{{ */ + $db = $this->_dms->getDB(); + $queryStr = "SELECT `tblNotify`.* FROM `tblNotify` ". + "WHERE `tblNotify`.`groupID` = ". $this->_id; + if($type) { + $queryStr .= " AND `tblNotify`.`targetType` = ". (int) $type; + } + + $resArr = $db->getResultArray($queryStr); + if (is_bool($resArr) && !$resArr) + return false; + + $notifications = array(); + foreach ($resArr as $row) { + $not = new SeedDMS_Core_Notification($row["target"], $row["targetType"], $row["userID"], $row["groupID"]); + $not->setDMS($this); + array_push($notifications, $not); + } + + return $notifications; + } /* }}} */ + } ?>