コード例 #1
0
ファイル: notify.php プロジェクト: netcon-source/apps
 /**
  * @brief get the number of unread notifications for the logged in user
  * @param $uid user id
  * @return number of unread notifications, 0 if not logged in
  */
 public static function getUnreadNumber($uid = null)
 {
     if (is_null($uid)) {
         if (OCP\User::isLoggedIn()) {
             $uid = OCP\User::getUser();
         } else {
             return 0;
         }
     }
     if (!isset(self::$unreadNumStmt)) {
         self::$unreadNumStmt = OCP\DB::prepare("SELECT COUNT(*) FROM *PREFIX*notifications WHERE read = 0 AND uid = ?");
     }
     return self::$unreadNumStmt->execute(array($uid))->fetchOne();
 }