本文整理汇总了PHP中Notification::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::all方法的具体用法?PHP Notification::all怎么用?PHP Notification::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* @before _secure
*/
public function index()
{
$this->seo(array("title" => "Dashboard", "description" => "Stats for your Data"));
$view = $this->getActionView();
$commissions = [];
$start = RM::get("start", date("Y-m-d", strtotime('now')));
$end = RM::get("end", date("Y-m-d", strtotime('now')));
$today = date('Y-m-d');
$yesterday = date('Y-m-d', strtotime("-1 day"));
$perf = Shared\Services\User::livePerf($this->user, $today, $today);
$yestPerf = Shared\Services\User::livePerf($this->user, $yesterday, $yesterday);
$notifications = Notification::all(["org_id = ?" => $this->org->id, "meta = ?" => ['$in' => ['all', $this->user->_id]]], [], "created", "desc", 5, 1);
$total = Performance::total(['start' => date("Y-m-d", strtotime('-365 day')), 'end' => date("Y-m-d", strtotime('-2 day'))], $this->user);
$view->set("start", date("Y-m-d", strtotime('-7 day')))->set("end", date("Y-m-d", strtotime('now')))->set("notifications", $notifications)->set("total", $total)->set("yestPerf", $yestPerf)->set("performance", $perf);
}
示例2: array
<?php
//les variables comme posts et tests ne sont pas transmise,
$res->notificationsNumber = Notification::all(array('conditions' => array('to_user_id' => $res->user->id, 'status' => 0)))->count;
$res->useTemplate();
示例3: notification
/**
* @before _secure
*/
public function notification()
{
$this->seo(array("title" => "Notification"));
$view = $this->getActionView();
$fields = ['_id', 'name'];
$arr = User::all(['org_id' => $this->org->_id, 'type' => 'publisher'], $fields);
$publishers = User::objectArr($arr, $fields);
$arr = User::all(['org_id' => $this->org->_id, 'type' => 'advertiser'], $fields);
$advertisers = User::objectArr($arr, $fields);
$view->set('publishers', $publishers)->set('advertisers', $advertisers);
switch (RM::post("action")) {
case 'save':
$meta = RM::post("meta", "all");
$message = RM::post("message");
$success = "Saved Successfully";
if ($meta !== "all" && (!in_array($meta, array_keys($publishers)) && !in_array($meta, array_keys($advertisers)))) {
$view->set('message', "Invalid Request!!");
break;
} else {
if ($meta !== "all") {
// send mail to the user
$usr = User::first(['_id' => $meta], ['name', 'email']);
\Shared\Services\Smtp::sendMail($this->org, ['template' => 'notification', 'user' => $usr, 'notification' => $message, 'to' => [$usr->email], 'subject' => "Notification from " . $this->org->name]);
$success .= " And Mail sent";
}
}
$n = new Notification(["org_id" => $this->org->id, "message" => $message, "target" => RM::post("target"), "meta" => $meta]);
$n->save();
$view->set("message", $success);
break;
}
if (RM::type() === 'DELETE') {
$id = RM::get("id");
$n = Notification::first(["org_id = ?" => $this->org->id, "id = ?" => $id]);
if ($n) {
$n->delete();
$view->set("message", "Deleted Successfully");
} else {
$view->set("message", "Notification does not exist");
}
}
$notifications = Notification::all(["org_id = ?" => $this->org->id], [], "created", "desc");
$view->set("notifications", $notifications);
}
示例4: array
<?php
$res->notifications = Notification::all(array('conditions' => array('to_user_id' => $res->user->id, 'status' => 0), 'limit' => 5))->asArray();
$res->useTemplate();