function handle(&$params) { // mark the message as read, if hasn't been read yet -job_note_id try { $app = Dataface_Application::getInstance(); $query = $app->getQuery(); $auth =& Dataface_AuthenticationTool::getInstance(); $user =& $auth->getLoggedInUser(); $note_id = $query['-job_note_id']; $jobNote =& df_get_record("job_notes", array('JobNoteId' => $note_id)); $job =& df_get_record("jobs", array('job_id' => $jobNote->val('job_id'))); if (!$job->checkPermission('read message')) { throw new Exception("You do not have permission to read this note", E_USER_ERROR); } require_once 'inc/SweteDb.class.php'; require_once 'inc/SweteJobInbox.class.php'; SweteJobInbox::setReadStatic($note_id, $user->val('username')); } catch (Exception $e) { if ($e->getCode() == E_USER_ERROR) { echo $e->getMessage(); } else { throw $e; } } }