本文整理汇总了PHP中notification类的典型用法代码示例。如果您正苦于以下问题:PHP notification类的具体用法?PHP notification怎么用?PHP notification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了notification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUpdateEndorsement
public function addUpdateEndorsement($skill_endorsement_id, $skill_id, $display_user_id, $logged_user_id, $message)
{
$dbc = mysqli_connect($GLOBALS['db_servername'], $GLOBALS['db_username'], $GLOBALS['db_password'], $GLOBALS['db_name']) or die("Not connected..");
if ($skill_endorsement_id <= 0) {
$q = "INSERT INTO skill_endorsements (user_id, skill_id, endorsed_by_user_id, comments)\nVALUES (" . $display_user_id . "," . $skill_id . "," . $logged_user_id . ",'" . $message . "')";
} else {
$q = "Update skill_endorsements \n\t\t\t\t\tset \n\t\t\t\t\t\tcomments='" . $message . "',\n\t\t\t\t\t\tendorsed_on=CURRENT_TIMESTAMP\n\t\t\t\t\twhere skill_endorsement_id=" . $skill_endorsement_id;
}
//echo $q . '<br>';
$r = mysqli_query($dbc, $q);
// Get $skill_endorsement_id of the insert query
if ($skill_endorsement_id <= 0) {
$skill_endorsement_id = -1;
if ($r) {
$skill_endorsement_id = mysqli_insert_id($dbc);
}
}
mysqli_close($dbc);
// close the connection
if ($r) {
// Add notification -- endorsed
$objNotification = new notification();
$result = $objNotification->addNotification(3, $display_user_id, $logged_user_id, $skill_endorsement_id);
return true;
} else {
return false;
}
}
示例2: checknoti
public function checknoti()
{
$notifications = notification::where('user_id', Auth::user()->id)->get();
//dd(empty($notifications));
if ($notifications->count()) {
return response()->json(1);
}
return response()->json(0);
}
示例3: album
static function album($menu, $theme)
{
if (!user::active()->guest) {
$item = $theme->item();
if ($item) {
$watching = notification::is_watching($item);
$menu->append(Menu::factory("link")->id("watch")->label(t("Enable notifications for this album"))->url(url::site("notification/watch/{$item->id}?csrf=" . access::csrf_token()))->css_id($watching ? "gRemoveWatchLink" : "gAddWatchLink"));
}
}
}
示例4: site_menu
static function site_menu($menu, $theme)
{
if (!user::active()->guest) {
$item = $theme->item();
if ($item && $item->is_album() && access::can("view", $item)) {
$watching = notification::is_watching($item);
$label = $watching ? t("Remove notifications") : t("Enable notifications");
$menu->get("options_menu")->append(Menu::factory("link")->id("watch")->label($label)->css_id("gNotifyLink")->url(url::site("notification/watch/{$item->id}?csrf=" . access::csrf_token())));
}
}
}
示例5: notify
/**
* Takes notification data and sends a message or email.
* Expected data:
* - sender => stdClass (User object)
* - subject => string
* - content => string
* - contentformat => int (e.g. FORMAT_HTML). Optional; default FORMAT_PLAIN
* - notification => bool|int
* - recipients => array (Array of user objects)
* - recipientemails => array (Array of email addresses)
*
* @param array $data Notification data
* @return array
*/
public static function notify(\core\event\base $event)
{
$dataformid = $event->other['dataid'];
$man = \mod_dataform_notification_manager::instance($dataformid);
$result = false;
if ($rules = $man->get_type_rules_enabled()) {
$params = array();
$params['event'] = $event->eventname;
$params['dataformid'] = $dataformid;
$params['viewid'] = !empty($event->other['viewid']) ? $event->other['viewid'] : null;
$params['entryid'] = !empty($event->other['entryid']) ? $event->other['entryid'] : null;
foreach ($rules as $rule) {
if ($rule->is_applicable($params)) {
$notification = new notification();
$message = $notification->prepare_data($event, $rule);
$result = ($result or $notification->send_message($message));
}
}
}
return $result;
}
示例6: watch
function watch($id)
{
access::verify_csrf();
$item = ORM::factory("item", $id);
access::required("view", $item);
if (notification::is_watching($item)) {
notification::remove_watch($item);
message::success(sprintf(t("You are no longer watching %s"), $item->title));
} else {
notification::add_watch($item);
message::success(sprintf(t("You are now watching %s"), $item->title));
}
url::redirect($item->url(array(), true));
}
示例7: watch
function watch($id)
{
access::verify_csrf();
$item = ORM::factory("item", $id);
access::required("view", $item);
$watching = notification::is_watching($item);
if (!$watching) {
notification::add_watch($item);
message::success(sprintf(t("Watch Enabled on %s!"), $item->title));
} else {
notification::remove_watch($item);
message::success(sprintf(t("Watch Removed on %s!"), $item->title));
}
url::redirect($item->url());
}
示例8: mysqli_query
} else {
// echo "<script> alert('3'); </script>";
$stm = "select * from users where email='" . $email . "'";
$res = mysqli_query($conn, $stm);
if (mysqli_num_rows($res) > 0) {
// echo "<script> alert('4'); </script>";
$_SESSION['errorMess'] = 2;
echo "<meta http-equiv='refresh' content='0; url=http://32.208.103.211/chatRegistration/registerHere.php'>";
// echo "<script> alert('5'); </script>";
} else {
// echo "<script> alert('6'); </script>";
$value = 0;
$cnumber = $cc . $cnumber;
$stm = "insert into users(name, lname, email, username, password, contactNumber, activationCode,activated) values('" . $fname . "','" . $lname . "','" . $email . "','" . $uname . "','" . $password . "'," . $cnumber . "," . $activation . "," . $value . ");";
mysqli_query($conn, $stm);
// echo "<script> alert('7'); </script>";
$not = new notification();
$link = "http://32.208.103.211/chatRegistration/activateAccount.php?activationCode=" . $activation . "&email=" . $email;
$body = "Thank you for registering with us.<br><br><a href='" . $link . "'>Click here</a> to activate your account.";
$ans = $not->email("mailtosecureyou@gmail.com", "Administration", "mailtosecureyou@gmail.com", "mailstodeliver", $email, "Activation Email", $body);
$_SESSION['emailSent'] = $ans;
echo "<script> alert('" . $ans . "'); </script>";
if ($ans == 1) {
$refCode = $not->message("12035432147", $cnumber, $link);
}
// echo "<script> alert('8'); </script>";
$_SESSION['newlyRegistered'] = $uname;
echo "<meta http-equiv='refresh' content='0; url=http://32.208.103.211/chatRegistration/imageUpload.php'>";
}
}
mysqli_close($conn);
示例9: course_recurrence_handler
/**
* Function to handle course recurrence events.
*
* @param user $user CM user object representing the user in the course
*
* @return boolean TRUE is successful, otherwise FALSE
*/
public static function course_recurrence_handler($user)
{
global $CFG, $CURMAN;
require_once $CFG->dirroot . '/curriculum/lib/notifications.php';
/// Does the user receive a notification?
$sendtouser = $CURMAN->config->notify_courserecurrence_user;
$sendtorole = $CURMAN->config->notify_courserecurrence_role;
$sendtosupervisor = $CURMAN->config->notify_courserecurrence_supervisor;
/// If nobody receives a notification, we're done.
if (!$sendtouser && !$sendtorole && !$sendtosupervisor) {
return true;
}
$context = get_system_context();
/// Make sure this is a valid user.
$enroluser = new user($user->id);
if (empty($enroluser->id)) {
print_error('nouser', 'block_curr_admin');
return true;
}
$message = new notification();
/// Set up the text of the message
$text = empty($CURMAN->config->notify_courserecurrence_message) ? get_string('notifycourserecurrencemessagedef', 'block_curr_admin') : $CURMAN->config->notify_courserecurrence_message;
$search = array('%%userenrolname%%', '%%coursename%%');
$replace = array(fullname($user), $user->coursename);
$text = str_replace($search, $replace, $text);
$eventlog = new Object();
$eventlog->event = 'course_recurrence';
$eventlog->instance = $user->enrolmentid;
$eventlog->fromuserid = $user->id;
if ($sendtouser) {
$message->send_notification($text, $user, null, $eventlog);
}
$users = array();
if ($sendtorole) {
/// Get all users with the notify_courserecurrence capability.
if ($roleusers = get_users_by_capability($context, 'block/curr_admin:notify_courserecurrence')) {
$users = $users + $roleusers;
}
}
if ($sendtosupervisor) {
/// Get parent-context users.
if ($supervisors = cm_get_users_by_capability('user', $user->id, 'block/curr_admin:notify_courserecurrence')) {
$users = $users + $supervisors;
}
}
foreach ($users as $u) {
$message->send_notification($text, $u, $enroluser, $eventlog);
}
return true;
}
示例10: task_header
print "mailing to {$recipient_name} <{$email}>\n";
$content = task_header($recipient_name);
$sql = "SELECT tas.id, tas.name, pro.id, pro.name, tas.priority, tas.status, tas.due_date\r\n FROM " . $tableCollab["tasks"] . " tas, " . $tableCollab["projects"] . " pro\r\n WHERE tas.status IN (2,3) \r\n AND tas.project = pro.id\r\n AND tas.assigned_to = '{$staffid}'\r\n ORDER BY tas.due_date, tas.status";
$rows = mysql_query($sql, $res);
while ($row = mysql_fetch_row($rows)) {
if ($row[6] < $datenow) {
$content .= task_row($row, $late_task_color);
} elseif ($row[6] == $datenow) {
$content .= task_row($row, $today_task_color);
} else {
$content .= task_row($row, $normal_task_color);
}
}
$content .= task_footer();
// set up the email object
$tasknotice = new notification();
$tasknotice->From = $from_email;
$tasknotice->FromName = $from_name;
$tasknotice->Subject = $subject_txt;
$tasknotice->Body = $content;
$tasknotice->AddAddress($email);
// $tasknotice->getUserinfo($staffid,"to");
if ($send_html) {
$tasknotice->IsHTML("true");
$tasknotice->AltBody = "this message uses html entities, but you prefer plain text !";
}
// send the email
if (!$tasknotice->Send()) {
echo "Message was not sent\n";
echo "Mailer Error: " . $tasknotice->ErrorInfo . "\n\n";
}
示例11: IN
<?php
$tmpquery = "WHERE tas.id IN({$id})";
$taskNoti = new request();
$taskNoti->openTasks($tmpquery);
$tmpquery = "WHERE pro.id = '{$project}'";
$projectNoti = new request();
$projectNoti->openProjects($tmpquery);
$tmpquery = "WHERE noti.member IN({$at})";
$listNotifications = new request();
$listNotifications->openNotifications($tmpquery);
$comptListNotifications = count($listNotifications->not_id);
if ($listNotifications->not_statustaskchange[0] == "0") {
$mail = new notification();
$mail->getUserinfo($idSession, "from");
$mail->partSubject = $strings["noti_prioritytaskchange1"];
$mail->partMessage = $strings["noti_prioritytaskchange2"];
if ($projectNoti->pro_org_id[0] == "1") {
$projectNoti->pro_org_name[0] = $strings["none"];
}
$complValue = $taskNoti->tas_completion[0] > 0 ? $taskNoti->tas_completion[0] . "0 %" : $taskNoti->tas_completion[0] . " %";
$idStatus = $taskNoti->tas_status[0];
$idPriority = $taskNoti->tas_priority[0];
$body = $mail->partMessage . "\n\n" . $strings["task"] . " : " . $taskNoti->tas_name[0] . "\n" . $strings["start_date"] . " : " . $taskNoti->tas_start_date[0] . "\n" . $strings["due_date"] . " : " . $taskNoti->tas_due_date[0] . "\n" . $strings["completion"] . " : " . $complValue . "\n" . $strings["priority"] . " : {$priority[$idPriority]}\n" . $strings["status"] . " : {$status[$idStatus]}\n" . $strings["description"] . " : " . $taskNoti->tas_description[0] . "\n\n" . $strings["project"] . " : " . $projectNoti->pro_name[0] . " (" . $projectNoti->pro_id[0] . ")\n" . $strings["organization"] . " : " . $projectNoti->pro_org_name[0] . "\n\n" . $strings["noti_moreinfo"] . "\n";
if ($taskNoti->tas_mem_organization[0] == "1") {
$body .= "{$root}/general/login.php?url=tasks/viewtask.php%3Fid={$id}";
} else {
if ($taskNoti->tas_mem_organization[0] != "1" && $projectNoti->pro_published[0] == "0" && $taskNoti->tas_published[0] == "0") {
$body .= "{$root}/general/login.php?url=projects_site/home.php%3Fproject=" . $projectNoti->pro_id[0];
}
}
示例12: notification
<?php
include_once 'classes/notification.php';
if (isset($_REQUEST['user_id'])) {
$user_id = $_REQUEST['user_id'];
$objNotification = new notification();
$unreadMessageCount = $objNotification->getUnreadMessageCount($user_id);
if (isset($unreadMessageCount) && $unreadMessageCount > 0) {
echo $unreadMessageCount;
}
}
示例13: IN
}
$tmpquery = "WHERE mee.id IN({$num})";
$meetingNoti = new request();
$meetingNoti->openMeetings($tmpquery);
$tmpquery = "WHERE pro.id = '{$project}'";
$projectNoti = new request();
$projectNoti->openProjects($tmpquery);
$tmpquery = "WHERE noti.member IN({$att_mem_id_list})";
$listNotifications = new request();
$listNotifications->openNotifications($tmpquery);
$comptListNotifications = count($listNotifications->not_id);
for ($i = 0; $i < $comptListNotifications; $i++) {
if ($listNotifications->not_meetingassignment[$i] != "0") {
continue;
}
$mail = new notification();
$mail->getUserinfo($_SESSION['idSession'], "from");
$mail->partSubject = $strings["noti_meetingassignment1"];
$mail->partMessage = $strings["noti_meetingassignment2"];
if ($projectNoti->pro_org_id[0] == "1") {
$projectNoti->pro_org_name[0] = $strings["none"];
}
$idStatus = $meetingNoti->mee_status[0];
$idPriority = $meetingNoti->mee_priority[0];
$body = $mail->partMessage . "\n\n" . $strings["meeting"] . " : " . $meetingNoti->mee_name[0] . "\n" . $strings["me_agenda"] . " : " . $meetingNoti->mee_agenda[0] . "\n" . $strings["date"] . " : " . $meetingNoti->mee_date[0] . "\n" . $strings["start_time"] . " : " . $meetingNoti->mee_start_time[0] . "\n" . $strings["end_time"] . " : " . $meetingNoti->mee_end_time[0] . "\n" . $strings["me_location"] . " : " . $meetingNoti->mee_location[0] . "\n" . $strings["priority"] . " : {$priority[$idPriority]}\n" . $strings["status"] . " : {$status[$idStatus]}\n\n" . $strings["project"] . " : " . $projectNoti->pro_name[0] . " (" . $projectNoti->pro_id[0] . ")\n" . $strings["organization"] . " : " . $projectNoti->pro_org_name[0] . "\n\n" . $strings["noti_moreinfo"] . "\n";
if ($meetingNoti->mee_mem_organization[0] == "1") {
$body .= "{$root}/general/login.php?url=meetings/viewmeeting.php%3Fid={$num}";
} else {
if ($meetingNoti->mee_mem_organization[0] != "1" && $projectNoti->pro_published[0] == "0" && $meetingNoti->mee_published[0] == "0") {
$body .= "{$root}/general/login.php?url=projects_site/home.php%3Fproject=" . $projectNoti->pro_id[0];
}
示例14: session_start
session_start();
define('DOCROOT', realpath(dirname(__FILE__)) . '/');
require DOCROOT . 'dbConn.php';
$con = new dbConn();
$password = $_POST['password'];
$email = $_SESSION['email'];
require DOCROOT . 'activationAndNotifications.php';
$stm = "select pwcr from users where email = '" . $email . "';";
$res = $con->execute($stm);
if ($res->num_rows > 0) {
while ($row = $res->fetch_assoc()) {
if ($row['pwcr'] == 1) {
$stm = "update users set password = '" . $password . "' where email='" . $email . "';";
if ($con->execute($stm) === true) {
$not = new notification();
$body = "Password changed successfully.";
$not->email("mailtosecureyou@gmail.com", "Administration", "mailtosecureyou@gmail.com", "mailstodeliver", $email, "Password Changed Successfully", $body);
$stm = "update users set pcwr = 0 where email = '" . $email . "';";
$con->execute($stm);
$stm = "update users set activationCode = 0 where email = '" . $email . "';";
$con->execute($stm);
$_SESSION['homeMessage'] = "Password has been changed successfully.";
echo "<meta http-equiv='refresh' content='0; url=http://32.208.103.211/chatRegistration/index.php'>";
} else {
$_SESSION['homeMessage'] = "Link has been expired.";
echo "<meta http-equiv='refresh' content='0; url=http://32.208.103.211/chatRegistration/index.php'>";
}
}
}
}
示例15: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param notification $value A notification object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(notification $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}