mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 17:44:56 +00:00
add method getNotifications()
This commit is contained in:
parent
ddce7c9c69
commit
d4deb0cc35
|
@ -1287,5 +1287,33 @@ class SeedDMS_Core_User {
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get all notifications of user
|
||||
*
|
||||
* @param integer $type type of item (T_DOCUMENT or T_FOLDER)
|
||||
* @return array array of notifications
|
||||
*/
|
||||
function getNotifications($type=0) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
$queryStr = "SELECT `tblNotify`.* FROM `tblNotify` ".
|
||||
"WHERE `tblNotify`.`userID` = ". $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;
|
||||
} /* }}} */
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue
Block a user