本文整理汇总了PHP中Notification::find_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::find_by_id方法的具体用法?PHP Notification::find_by_id怎么用?PHP Notification::find_by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::find_by_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect_to
<?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();
}
示例2: redirect_to
<?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();
}
示例3: redirect_to
<?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';