<?php require_once "../../includes/initialize.php"; if (!$session->is_logged_in() || $_SESSION['role'] != "admin" && $_SESSION['role'] != "moderator") { redirect_to("login.php"); } // must have an ID if (empty($_GET['id'])) { $session->message("No notification ID was provided."); redirect_to('index.php'); } $notification = Notification::find_by_id($_GET['id']); if ($notification && $notification->delete()) { //to get the username for the notification $request = Request::find_by_id($notification->request_id); $user = User::find_by_id($request->user_id); $first_name = $user->first_name; $session->message("Notification by {$first_name} was deleted."); redirect_to('index.php'); } else { $session->message("Notification could not be deleted."); redirect_to('index.php'); } if (isset($database)) { $database->close_connection(); }
<?php require_once "../../includes/initialize.php"; if (!$session->is_logged_in()) { redirect_to("login.php"); } // must have an ID if (empty($_GET['id'])) { $session->message("No request ID was provided."); redirect_to('index.php'); } $request = Request::find_by_id($_GET['id']); if ($request && $request->delete()) { $rq_subject = ucfirst($request->subject); if (empty($rq_subjectq)) { $rq_subject = "No subject"; } //delete the notificaiton if request is deleted $notification = Notification::find_by_id($request->id); if ($notification->delete() == true) { $session->message("The request \"{$rq_subject}\" was deleted."); redirect_to('list_requests.php'); } } else { $session->message("The request could not be deleted."); redirect_to('list_requests.php'); } if (isset($database)) { $database->close_connection(); }
<?php require_once "inc/initialize.php"; require_once "inc/vendor/autoload.php"; use Carbon\Carbon; $dt = Carbon::now(); if (!$session->is_logged_in()) { redirect_to("index.php"); } # Instance of Carbon Class with the current time $date_now = new Carbon('now'); $label = customDecrypt($_GET['note']); if ($label) { $note_details = Notification::find_by_id($label); if ($note_details->status == 1) { $notification = new Notification(); $notification->db_fields = array('id', 'applicant_id', 'title', 'content', 'sender_admin_id', 'created_at', 'updated_at', 'status', 'visible'); $notification->id = $note_id; // $notification->read_date = $dt ; $notification->status = 2; $notification->save(); } } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>University of Jos, Nigeria - Transcript System</title> <?php require_once LIB_PATH . DS . 'javascript.php';