contributions/usermanagement.notifications/behaviour/commands/users/notify.cmd.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Send a notification to user 00004 */ 00005 class NotifyUsersCommand extends CommandTransactional { 00006 /** 00007 * Returns title of command. 00008 */ 00009 public function get_name() { 00010 return 'notify'; 00011 } 00012 00013 /** 00014 * Aktually do something :) 00015 */ 00016 protected function do_execute() { 00017 $ret = new Status(); 00018 00019 Load::models('notifications', 'notificationsexceptions'); 00020 $user = $this->get_instance(); 00021 $params = $this->get_params(); 00022 $created = false; 00023 if (!NotificationsExceptions::excluded($user->id, Arr::get_item($params, 'source', ''), Arr::get_item($params, 'source_id', ''))) { 00024 $ret->merge(Notifications::create($user, $params, $created)); 00025 } 00026 return $ret; 00027 } 00028 }