.

DigestNotificationssettingsCommand Class Reference

Send a digest based upon settings. More...

Inheritance diagram for DigestNotificationssettingsCommand:
CommandBase ICommand IAction ISerializable

List of all members.

Public Member Functions

  execute ()
  Aktually do something :).
  get_name ()
  Returns title of command.

Detailed Description

Send a digest based upon settings.

Definition at line 7 of file digest.cmd.php.


Member Function Documentation

DigestNotificationssettingsCommand::execute (  ) 

Aktually do something :).

Reimplemented from CommandBase.

Definition at line 18 of file digest.cmd.php.

00018                                   {
00019                 $ret = parent::execute();
00020                 
00021                 /* @var $settings DAONotificationssettings */
00022                 $settings = $this->get_instance();
00023                 $user = $settings->get_user();
00024                 $nots = array();
00025                 $dao = NotificationsSettings::create_digest_adapter($settings);
00026                 $dao->find();
00027                 while($dao->fetch()) {
00028                         if ($settings->should_notification_be_processed($dao, NotificationsSettings::TYPE_DIGEST)) {
00029                                 $n = clone($dao);
00030                                 $nots[] = $n;
00031                                 $n->add_sent_as(Notifications::DELIVER_DIGEST);
00032                                 $cmd = CommandsFactory::create_command($n, 'update', array());
00033                                 $cmd->execute();
00034                         }
00035                 }
00036                 if (count($nots)) {
00037                         $cmd = new MailCommand(
00038                                 tr('Your %appname Notifications', 'notifications', array('%appname' => Config::get_value(Config::TITLE))),
00039                                 $user->email,
00040                                 'notifications/mail/digest',
00041                                 array(
00042                                         'notifications' => $nots,
00043                                         'user' => $user,
00044                                         'settings' => $settings
00045                                 )
00046                         );
00047                         $ret->merge($cmd->execute());
00048                 }
00049                 if ($ret->is_ok()) {
00050                         $settings->digest_last_sent = time();
00051                         $ret->merge($settings->update());                       
00052                 }
00053                 
00054                 return $ret;
00055         }
DigestNotificationssettingsCommand::get_name (  ) 

Returns title of command.

Reimplemented from CommandBase.

Definition at line 11 of file digest.cmd.php.

00011                                    {
00012                 return 'digest';
00013         }

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