.

MailNotificationsCommand Class Reference

Send a notification mail, if necessary. More...

Inheritance diagram for MailNotificationsCommand:
CommandChain CommandBase ICommand IAction ISerializable

List of all members.

Protected Member Functions

  create_mail_command ($notification)
  do_execute ()

Detailed Description

Send a notification mail, if necessary.

Definition at line 5 of file mail.cmd.php.


Member Function Documentation

MailNotificationsCommand::create_mail_command ( notification  )  [protected]

Definition at line 19 of file mail.cmd.php.

00019                                                               {
00020                 Load::commands('generics/mail');
00021                 $templates = array(
00022                         'notifications/mail/single_' . strtolower($notification->source),
00023                         'notifications/mail/single'
00024                 );
00025                 $cmd = new MailCommand(
00026                         $notification->get_title(),
00027                         $notification->get_user()->email,
00028                         $templates,
00029                         array(
00030                                 'notification' => $notification
00031                         )
00032                 );      
00033                 return $cmd;
00034         }
MailNotificationsCommand::do_execute (  )  [protected]

Reimplemented from CommandChain.

Definition at line 6 of file mail.cmd.php.

00006                                         {
00007                 $ret = new Status();
00008                 $n = $this->get_instance();
00009                 Load::models('notificationssettings');
00010                 $settings = NotificationsSettings::get_for_user($n->id_user);
00011                 if ($settings === false || $settings->should_notification_be_processed($n, NotificationsSettings::TYPE_MAIL)) {
00012                         $this->append($this->create_mail_command($n));
00013                         $n->add_sent_as(Notifications::DELIVER_MAIL);
00014                         $this->append(CommandsFactory::create_command($n, 'update', array()));
00015                 }
00016                 return $ret;
00017         }

The documentation for this class was generated from the following file:
  • contributions/usermanagement.notifications/behaviour/commands/notifications/mail.cmd.php