Esempio n. 1
0
 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;
         }
     }
 }
Esempio n. 2
0
 function handle(&$params)
 {
     // retrieve the message contents for -job_note_id
     $app = Dataface_Application::getInstance();
     $query = $app->getQuery();
     $auth =& Dataface_AuthenticationTool::getInstance();
     $user =& $auth->getLoggedInUser();
     $note_id = $query['-job_note_id'];
     require_once 'inc/SweteDb.class.php';
     require_once 'inc/SweteJobInbox.class.php';
     $message = SweteJobInbox::getMessageStatic($note_id, $user->val('username'));
     echo nl2br($message->note_content);
 }
Esempio n. 3
0
 function handle(&$params)
 {
     // delete the message for -job_note_id
     try {
         $app = Dataface_Application::getInstance();
         $query = $app->getQuery();
         $note_id = $query['-job_note_id'];
         $jobNote =& df_get_record("job_notes", array('JobNoteId' => $note_id));
         if (!$jobNote->checkPermission('delete')) {
             throw new Exception("You do not have permission to delete this note", E_USER_ERROR);
         }
         require_once 'inc/SweteDb.class.php';
         require_once 'inc/SweteJobInbox.class.php';
         SweteJobInbox::deleteMessage($note_id);
     } catch (Exception $e) {
         if ($e->getCode() == E_USER_ERROR) {
             echo $e->getMessage();
         } else {
             throw $e;
         }
     }
 }