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


PHP Notification::send方法代码示例

本文整理汇总了PHP中Notification::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::send方法的具体用法?PHP Notification::send怎么用?PHP Notification::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notification的用法示例。


在下文中一共展示了Notification::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 function send()
 {
     DB::escapePost();
     $model = new Notification();
     $model->send();
     $this->redirect('/notification/');
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:7,代码来源:NotificationController.php

示例2: action_create

 public function action_create()
 {
     $json = Input::json();
     $project = Config::get('project');
     $comment = new Comment(array('project_id' => $project->id, 'officer_id' => Auth::officer()->id));
     $comment->body = $json->body;
     $comment->save();
     foreach ($comment->project->officers as $officer) {
         if (Auth::officer()->id != $officer->id) {
             Notification::send("Comment", array('comment' => $comment, 'target_id' => $officer->user->id));
         }
     }
     return Response::json($comment->to_array());
 }
开发者ID:ajb,项目名称:rfpez,代码行数:14,代码来源:comments.php

示例3: sendNotification

 public static function sendNotification($type, $date, $tracker, $message)
 {
     if ($type == 'warning') {
         $header_message = 'Предупреждение.';
     }
     if ($type == 'notification') {
         $header_message = 'Обновление.';
     }
     $settingEmail = Database::getSetting('email');
     if (!empty($settingEmail)) {
         if ($type == 'warning') {
             if (Database::getSetting('send_warning')) {
                 Notification::send($settingEmail, $date, $tracker, $message, $header_message);
             }
         }
         if ($type == 'notification') {
             if (Database::getSetting('send')) {
                 Notification::send($settingEmail, $date, $tracker, $message, $header_message);
             }
         }
     }
 }
开发者ID:MorS25,项目名称:TorrentMonitor,代码行数:22,代码来源:Notification.class.php

示例4: raiseEvent

 /**
  * Raise a notification event event
  *
  * @param $event           the event raised for the itemtype
  * @param $item            the object which raised the event
  * @param $options array   of options used
  * @param $label           used for debugEvent() (default '')
  **/
 static function raiseEvent($event, $item, $options = array(), $label = '')
 {
     global $CFG_GLPI;
     //If notifications are enabled in GLPI's configuration
     if ($CFG_GLPI["use_mailing"]) {
         $email_processed = array();
         $email_notprocessed = array();
         //Get template's information
         $template = new NotificationTemplate();
         $notificationtarget = NotificationTarget::getInstance($item, $event, $options);
         if (!$notificationtarget) {
             return false;
         }
         $entity = $notificationtarget->getEntity();
         //Foreach notification
         foreach (Notification::getNotificationsByEventAndType($event, $item->getType(), $entity) as $data) {
             $targets = getAllDatasFromTable('glpi_notificationtargets', 'notifications_id = ' . $data['id']);
             $notificationtarget->clearAddressesList();
             //Process more infos (for example for tickets)
             $notificationtarget->addAdditionnalInfosForTarget();
             $template->getFromDB($data['notificationtemplates_id']);
             $template->resetComputedTemplates();
             //Set notification's signature (the one which corresponds to the entity)
             $template->setSignature(Notification::getMailingSignature($entity));
             $notify_me = false;
             if (Session::isCron()) {
                 // Cron notify me
                 $notify_me = true;
             } else {
                 // Not cron see my pref
                 $notify_me = $_SESSION['glpinotification_to_myself'];
             }
             //Foreach notification targets
             foreach ($targets as $target) {
                 //Get all users affected by this notification
                 $notificationtarget->getAddressesByTarget($target, $options);
                 foreach ($notificationtarget->getTargets() as $user_email => $users_infos) {
                     if ($label || $notificationtarget->validateSendTo($event, $users_infos, $notify_me)) {
                         //If the user have not yet been notified
                         if (!isset($email_processed[$users_infos['language']][$users_infos['email']])) {
                             //If ther user's language is the same as the template's one
                             if (isset($email_notprocessed[$users_infos['language']][$users_infos['email']])) {
                                 unset($email_notprocessed[$users_infos['language']][$users_infos['email']]);
                             }
                             $options['item'] = $item;
                             if ($tid = $template->getTemplateByLanguage($notificationtarget, $users_infos, $event, $options)) {
                                 //Send notification to the user
                                 if ($label == '') {
                                     $datas = $template->getDataToSend($notificationtarget, $tid, $users_infos, $options);
                                     $datas['_notificationtemplates_id'] = $data['notificationtemplates_id'];
                                     $datas['_itemtype'] = $item->getType();
                                     $datas['_items_id'] = $item->getID();
                                     $datas['_entities_id'] = $entity;
                                     Notification::send($datas);
                                 } else {
                                     $notificationtarget->getFromDB($target['id']);
                                     echo "<tr class='tab_bg_2'><td>" . $label . "</td>";
                                     echo "<td>" . $notificationtarget->getNameID() . "</td>";
                                     echo "<td>" . sprintf(__('%1$s (%2$s)'), $template->getName(), $users_infos['language']) . "</td>";
                                     echo "<td>" . $users_infos['email'] . "</td>";
                                     echo "</tr>";
                                 }
                                 $email_processed[$users_infos['language']][$users_infos['email']] = $users_infos;
                             } else {
                                 $email_notprocessed[$users_infos['language']][$users_infos['email']] = $users_infos;
                             }
                         }
                     }
                 }
             }
         }
     }
     unset($email_processed);
     unset($email_notprocessed);
     $template = null;
     return true;
 }
开发者ID:kipman,项目名称:glpi,代码行数:85,代码来源:notificationevent.class.php

示例5: sendUpdateNotification

	function sendUpdateNotification($activities = array()){
		$notif = new Notification();
		$params = $this->getNotificationParams($activities);
		if(!isset($params['project_ccs']) || empty($params['project_ccs']))
			return TRUE;
			
		if($notif->getByName('ProjectUpdated') === FALSE){
			$this->error = "SI_Project::update() : ".$notif->getLastError()."\n";
			return FALSE;
		}
		if($notif->prepare($params) === FALSE){
			$this->error = "SI_Project::update() : ".$notif->getLastError()."\n";
			return FALSE;
		}
		if($notif->send() === FALSE){
			$this->error = "SI_Project::update() : ".$notif->getLastError()."\n";
			return FALSE;
		}

		return TRUE;
	}
开发者ID:nanoprime,项目名称:sureinvoice,代码行数:21,代码来源:SI_Project.php

示例6: die

<?php

/* For licensing terms, see /license.txt */
/**
 * @package chamilo.notification
 * @author Julio Montoya <gugli100@gmail.com>
 */
/**
 * Initialization
 */
if (PHP_SAPI != 'cli') {
    die('Run this script through the command line or comment this line in the code');
}
$language_file = array('userInfo');
require_once '../inc/global.inc.php';
/**
 * Notification sending
 */
$notify = new Notification();
$notify->send();
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:20,代码来源:notification.php

示例7: cron

/**
 * called by cli/cron.php
 */
function cron() {

	// If called by a regular cron job it's no problem to skip it sometimes.
	if (BN=="cron.php") {
		if (!cron_lock()) return;
	} else {
		while (!cron_lock()) {
			echo "Waiting for lock ...\n";
			sleep(5);
		}
	}

	$sql_period = "SELECT *,
			debate             <= now() AS debate_now,
			preparation        <= now() AS preparation_now,
			voting             <= now() AS voting_now,
			ballot_assignment  <= now() AS ballot_assignment_now,
			ballot_preparation <= now() AS ballot_preparation_now,
			counting           <= now() AS counting_now
		FROM period";
	$result_period = DB::query($sql_period);
	while ( $period = DB::fetch_object($result_period, "Period") ) {
		/** @var Period $period */
		DB::to_bool($period->debate_now);
		DB::to_bool($period->preparation_now);
		DB::to_bool($period->voting_now);
		DB::to_bool($period->ballot_assignment_now);
		DB::to_bool($period->ballot_preparation_now);
		DB::to_bool($period->counting_now);

		$issues_start_debate = array();
		$issues_start_voting = array();
		$issues_finished_voting = array();

		// ballots
		switch ($period->state) {

			// ballot assignment
		case "ballot_application":
			if (!$period->ballot_assignment_now) break;

			$period->assign_members_to_ballots();

			$sql_ballot = "SELECT * FROM ballot WHERE period=".intval($period->id);
			$result_ballot = DB::query($sql_ballot);
			while ( $ballot = DB::fetch_object($result_ballot, "Ballot") ) {

				// notification to the ballot agents whether the ballot was approved
				// TODO: more than one ballot agent
				$notification = new Notification("ballot_approved");
				$notification->period = $period;
				$notification->ballot = $ballot;
				$sql = "SELECT member FROM offlinevoter WHERE ballot = ".intval($ballot->id)." AND agent = TRUE";
				$recipients = DB::fetchfieldarray($sql);
				$notification->send($recipients);

				if (!$ballot->approved) continue;

				// notification to the members to which ballots they were assigned
				$notification = new Notification("ballot_assigned");
				$notification->period = $period;
				$notification->ballot = $ballot;
				$sql = "SELECT member FROM offlinevoter WHERE ballot = ".intval($ballot->id);
				$recipients = DB::fetchfieldarray($sql);
				$notification->send($recipients);

			}

			$period->state = "ballot_assignment";
			$period->update(["state"]);

			break;

			// ballot preparation
		case "ballot_assignment":
			if (!$period->ballot_preparation_now) break;

			// final upload of the complete postal and ballot voters
			if ( upload_voters($period, true) ) {
				$period->state = "ballot_preparation";
				$period->update(["state"]);
			}

			// ballot_preparation is the final state.
		}


		// proposals and issues
		$sql_issue = "SELECT * FROM issue
			WHERE period=".intval($period->id)."
			AND state NOT IN ('finished', 'cancelled')";
		$result_issue = DB::query($sql_issue);
		while ( $issue = DB::fetch_object($result_issue, "Issue") ) {
			/** @var Issue $issue */

			switch ($issue->state) {

//.........这里部分代码省略.........
开发者ID:ppschweiz,项目名称:basisentscheid,代码行数:101,代码来源:functions_cli.php

示例8: move_to_issue

	/**
	 * move the proposal to a different issue
	 *
	 * @param integer $new_issue_id
	 */
	public function move_to_issue($new_issue_id) {

		DB::transaction_start();
		$this->read();

		if ( !$this->allowed_move_to_issue() ) {
			DB::transaction_rollback();
			warning(_("Moving this proposal is not allowed anymore."));
			redirect();
		};

		$options = $this->options_move_to_issue();
		if (!isset($options[$new_issue_id])) {
			DB::transaction_rollback();
			warning(_("The selected option is not available."));
			redirect();
		}

		$old_issue = $this->issue();

		if ($new_issue_id) {
			$new_issue = new Issue($new_issue_id);
			if (!$new_issue->id) {
				DB::transaction_rollback();
				warning(_("The issue does not exist."));
				redirect();
			}
		} else {
			// create a new empty issue
			$new_issue = new Issue;
			$new_issue->area   = $old_issue->area;
			$new_issue->period = $old_issue->period;
			$new_issue->state  = $old_issue->state;
			// If the old issue reached offline voting, the new issue gets offline voting unseen the number of offline voting demanders.
			$new_issue->votingmode_reached = $old_issue->votingmode_reached;
			$new_issue->debate_started = $old_issue->debate_started;
			$new_issue->create();
		}

		$this->issue = $new_issue->id;

		if ( ! $this->update(['issue']) ) {
			DB::transaction_rollback();
			return;
		}

		DB::transaction_commit();

		// cancel empty issue
		if ( ! $old_issue->proposals() ) $old_issue->cancel();

		// send notification
		$notification = new Notification("proposal_moved");
		$notification->issue_old = $old_issue;
		$notification->issue     = $new_issue;
		$notification->proposal  = $this;
		// votingmode voters of both issues
		$sql = "SELECT DISTINCT member FROM votingmode_token WHERE issue=".intval($old_issue->id)." OR issue=".intval($new_issue->id);
		$recipients = DB::fetchfieldarray($sql);
		// supporters and proponents of the proposal
		$sql = "SELECT DISTINCT member FROM supporter WHERE proposal=".intval($this->id);
		$recipients = array_unique(array_merge($recipients, DB::fetchfieldarray($sql)));
		$notification->send($recipients);

	}
开发者ID:ppschweiz,项目名称:basisentscheid,代码行数:70,代码来源:Proposal.php

示例9: action_add_collaborator

 public function action_add_collaborator()
 {
     $project = Config::get('project');
     $input = Input::json();
     $email = $input->User->email;
     $user = User::where_email($email)->first();
     if (!$user) {
         $user = User::new_officer_from_invite($email, Auth::user(), $project);
         if (!$user) {
             return Response::make('400', '400');
         }
         $send_email = false;
     } else {
         $send_email = true;
     }
     if ($user->officer->collaborates_on($project->id)) {
         return Response::json(array("status" => "already exists"));
     }
     $project->officers()->attach($user->officer->id);
     Notification::send("ProjectCollaboratorAdded", array("project" => $project, "officer" => $user->officer, "actor_id" => Auth::user()->id), $send_email);
     return Response::json($user->officer->to_array());
 }
开发者ID:ajb,项目名称:rfpez,代码行数:22,代码来源:projects.php

示例10: award

 public function award($message)
 {
     $this->awarded_at = new \DateTime();
     $this->awarded_message = $message;
     $this->awarded_by = Auth::officer()->id;
     $this->save();
     Notification::send("Award", array('actor_id' => Auth::user()->id, 'bid' => $this));
     // Dismiss all the other bids.
     foreach ($this->project->bids as $bid) {
         if ($bid->id != $this->id && !$bid->dismissed_at) {
             $bid->dismiss();
         }
     }
     if (trim($message) != "") {
         Mailer::send("BidAwarded", array('bid' => $this));
     }
 }
开发者ID:ajb,项目名称:rfpez,代码行数:17,代码来源:bid.php

示例11: add

	/**
	 * wrapper for create()
	 *
	 * @param Proposal $proposal
	 */
	function add(Proposal $proposal) {

		if (mb_strlen($this->title) > self::title_length) {
			$this->title = limitstr($this->title, self::title_length);
			warning(sprintf(_("The title has been truncated to the maximum allowed length of %d characters!"), self::title_length));
		}
		if (mb_strlen($this->content) > self::content_length) {
			$this->content = limitstr($this->content, self::content_length);
			warning(sprintf(_("The content has been truncated to the maximum allowed length of %d characters!"), self::content_length));
		}

		if (Login::$member) $this->member = Login::$member->id;
		$this->session = self::session_id();
		$this->create();

		// notification to authors of all parent comments
		$recipients = array();
		$parent = $this->parent;
		while ( $parent > 0 ) { // "pro"/"contra"/"discussion" will be converted to 0
			$comment = new Comment($parent);
			if ($comment->member) $recipients[] = $comment->member;
			$parent = $comment->parent;
		}
		$notification = new Notification("reply");
		$notification->proposal = $proposal;
		$notification->comment = $this;
		$notification->send($recipients);

		// notification according to notify settings
		$notification = new Notification("comment");
		$notification->proposal = $proposal;
		$notification->comment = $this;
		$notification->send([], $recipients);

	}
开发者ID:ppschweiz,项目名称:basisentscheid,代码行数:40,代码来源:Comment.php

示例12: sendEmail

	function sendEmail($notification = 'InvoiceEmail'){
		$notif = new Notification();
		$params = $this->getNotificationParams();
//		if(!isset($params['invoice_emails']) || empty($params['invoice_emails']))
//			return TRUE;
			
		if($notif->getByName($notification) === FALSE){
			$this->error = "SI_Invoice::sendEmail() : ".$notif->getLastError()."\n";
			return FALSE;
		}
		if($notif->prepare($params) === FALSE){
			$this->error = "SI_Invoice::sendEmail() : ".$notif->getLastError()."\n";
			return FALSE;
		}
		
		// Setup attachment
		$pdf_file = $this->getPDF();
		if($pdf_file === FALSE)
			return FALSE;
			
		$my_company = SureInvoice::getMyCompany();
		$filename = 'invoice_'.$this->id.'.pdf';
		if(!empty($my_company->name)){
			$normalized_name = str_replace(array(',','.',' ',"\t","'",'"'), '_', $my_company->name);
			$filename = $normalized_name.'_'.$this->id.'.pdf';
		}
		$attachments[0]['data'] = $pdf_file;
		$attachments[0]['name'] = $filename;
		$attachments[0]['type'] = 'application/pdf';
		$attachments[0]['encoding'] = 'base64';
		if($notif->send($attachments) === FALSE){
			$this->error = "SI_Invoice::sendEmail() : ".$notif->getLastError()."\n";
			return FALSE;
		}

		// Update sent_ts
		$this->sent_ts = time();
		if($this->update() === FALSE){
			$this->error = "SI_Invoice::sendEmail(): Email sent, error updating sent timestamp: ".$this->getLastError();
			return FALSE;	
		}
		
		return TRUE;
	}
开发者ID:nanoprime,项目名称:sureinvoice,代码行数:44,代码来源:SI_Invoice.php

示例13: proposal_admitted

	/**
	 * will be called after a proposal gets admitted
	 *
	 * @param Proposal $admitted_proposal
	 */
	public function proposal_admitted(Proposal $admitted_proposal) {

		$admitted_proposals = array($admitted_proposal);

		// admit other proposals too, if they reached the quorum due to the now lower level
		foreach ( $this->proposals() as $proposal ) {
			/** @var $proposal Proposal */
			if ($proposal->id==$admitted_proposal->id) continue;
			if ( $proposal->submitted and !$proposal->quorum_reached and $proposal->supporters >= $proposal->quorum_required() ) {
				// admit proposal
				$proposal->quorum_reached = true;
				$proposal->state = "admitted";
				$proposal->update(["quorum_reached", "state"], "admitted=now()");
				$admitted_proposals[] = $proposal;
			}
		}

		// send notification
		$notification = new Notification("admitted");
		$notification->issue = $this;
		$notification->proposals = $admitted_proposals;
		$notification->send();

		/* for now admins do the selection of the periods manually

		// The period has already been set by another proposal in the same issue.
		if ($this->period) return;

		// select the next period, which has not yet started
		$sql = "SELECT id FROM period
			WHERE ngroup=".intval($this->period()->ngroup)."
				AND debate > now()
			ORDER BY debate
			LIMIT 1";
		$this->period = DB::fetchfield($sql);
		if ($this->period) {
			$this->update(["period"]);
		} else {
			// Error
		}

		*/

	}
开发者ID:ppschweiz,项目名称:basisentscheid,代码行数:49,代码来源:Issue.php

示例14: __construct

 public function __construct($action_type, $taken_by, $action_id, $notify_uid = null)
 {
     Notification::send($action_type, $taken_by, $action_id, $notify_uid);
 }
开发者ID:Anpix,项目名称:rede-social,代码行数:4,代码来源:Notification.php

示例15: updateUser


//.........这里部分代码省略.........
         unset($post['passwordc']);
     }
     // Check authorization for submitted fields, if the value has been changed
     foreach ($post as $name => $value) {
         if ($name == "groups" || isset($target_user->{$name}) && $post[$name] != $target_user->{$name}) {
             // Check authorization
             if (!$this->_app->user->checkAccess('update_account_setting', ['user' => $target_user, 'property' => $name])) {
                 $ms->addMessageTranslated("danger", "ACCESS_DENIED");
                 $this->_app->halt(403);
             }
         } else {
             if (!isset($target_user->{$name})) {
                 $ms->addMessageTranslated("danger", "NO_DATA");
                 $this->_app->halt(400);
             }
         }
     }
     // Check that we are not disabling the master account
     if ($target_user->id == $this->_app->config('user_id_master') && isset($post['flag_enabled']) && $post['flag_enabled'] == "0") {
         $ms->addMessageTranslated("danger", "ACCOUNT_DISABLE_MASTER");
         $this->_app->halt(403);
     }
     // Check that the email address is not in use
     if (isset($post['email']) && $post['email'] != $target_user->email && UserLoader::exists($post['email'], 'email')) {
         $ms->addMessageTranslated("danger", "ACCOUNT_EMAIL_IN_USE", $post);
         $this->_app->halt(400);
     }
     // Sanitize
     $rf->sanitize();
     // Validate, and halt on validation errors.
     if (!$rf->validate()) {
         $this->_app->halt(400);
     }
     // Remove passwordc
     $rf->removeFields(['passwordc']);
     // Get the filtered data
     $data = $rf->data();
     // Update user groups
     if (isset($data['groups'])) {
         foreach ($data['groups'] as $group_id => $is_member) {
             if ($is_member == "1" && !isset($groups[$group_id])) {
                 $target_user->addGroup($group_id);
             } else {
                 if ($is_member == "0" && isset($groups[$group_id])) {
                     $target_user->removeGroup($group_id);
                 }
             }
         }
         unset($data['groups']);
     }
     // Hash password
     if (isset($data['password'])) {
         $data['password'] = Authentication::hashPassword($data['password']);
     }
     // Update the user and generate success messages
     foreach ($data as $name => $value) {
         if ($value != $target_user->{$name}) {
             $target_user->{$name} = $value;
             // Custom success messages (optional)
             if ($name == "flag_enabled") {
                 if ($value == "1") {
                     $ms->addMessageTranslated("success", "ACCOUNT_ENABLE_SUCCESSFUL", ["user_name" => $target_user->user_name]);
                 } else {
                     $ms->addMessageTranslated("success", "ACCOUNT_DISABLE_SUCCESSFUL", ["user_name" => $target_user->user_name]);
                 }
             }
             if ($name == "flag_verified") {
                 $ms->addMessageTranslated("success", "ACCOUNT_MANUALLY_ACTIVATED", ["user_name" => $target_user->user_name]);
             }
         }
     }
     // If we're generating a password reset, create the corresponding event and shoot off an email
     if (isset($data['flag_password_reset']) && $data['flag_password_reset'] == "1") {
         // Recheck auth
         if (!$this->_app->user->checkAccess('update_account_setting', ['user' => $target_user, 'property' => 'flag_password_reset'])) {
             $ms->addMessageTranslated("danger", "ACCESS_DENIED");
             $this->_app->halt(403);
         }
         // New password reset event - bypass any rate limiting
         $target_user->newEventPasswordReset();
         $target_user->save();
         // Email the user asking to confirm this change password request
         $twig = $this->_app->view()->getEnvironment();
         $template = $twig->loadTemplate("mail/password-reset.twig");
         $notification = new Notification($template);
         $notification->fromWebsite();
         // Automatically sets sender and reply-to
         $notification->addEmailRecipient($target_user->email, $target_user->display_name, ["user" => $target_user, "request_date" => date("Y-m-d H:i:s")]);
         try {
             $notification->send();
         } catch (\Exception\phpmailerException $e) {
             $ms->addMessageTranslated("danger", "MAIL_ERROR");
             error_log('Mailer Error: ' . $e->errorMessage());
             $this->_app->halt(500);
         }
         $ms->addMessageTranslated("success", "FORGOTPASS_REQUEST_SENT", ["user_name" => $target_user->user_name]);
     }
     $ms->addMessageTranslated("success", "ACCOUNT_DETAILS_UPDATED", ["user_name" => $target_user->user_name]);
     $target_user->save();
 }
开发者ID:popiazaza,项目名称:UserFrosting,代码行数:101,代码来源:UserController.php


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