当前位置: 首页>>代码示例>>PHP>>正文


PHP Notification::find_by_id方法代码示例

本文整理汇总了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();
}
开发者ID:aluck19,项目名称:assignment2Do,代码行数:26,代码来源:delete_notification.php

示例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();
}
开发者ID:aluck19,项目名称:assignment2Do,代码行数:30,代码来源:delete_request.php

示例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';
开发者ID:Ghaji,项目名称:transcripts,代码行数:31,代码来源:my_notification_details.php


注:本文中的Notification::find_by_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。