contributions/usermanagement/behaviour/commands/users/status.any.cmd.php
Go to the documentation of this file.00001 <?php 00002 Load::commands('generics/status.any'); 00003 00004 /** 00005 * Command to set status 00006 * 00007 * Notifies user of change by sending a mail 00008 * 00009 * @author Gerd Riesselmann 00010 * @ingroup Usermanagement 00011 */ 00012 class StatusAnyUsersCommand extends StatusAnyCommand { 00013 /** 00014 * Check if command can be executed 00015 * 00016 * @param mixed $user 00017 * @param IStatusHolder $inst 00018 * @param mixed $new_status 00019 * @return bool 00020 */ 00021 protected function do_can_execute_status($user, IStatusHolder $inst, $new_status) { 00022 return $new_status != Users::STATUS_UNCONFIRMED; 00023 } 00024 00025 /** 00026 * Change status 00027 * 00028 * @return Status 00029 */ 00030 protected function do_execute() { 00031 $ret = new Status(); 00032 $ret->merge(parent::do_execute()); 00033 if ($ret->is_ok()) { 00034 $user = $this->get_instance(); 00035 $new_status = tr($this->get_params(), 'users'); 00036 //Cas: ist das hier korrekt? 00037 if (Config::has_feature(ConfigUsermanagement::MAIL_STATUSCHANGE)) { 00038 Load::commands('generics/mail'); 00039 $cmd = new MailCommand( 00040 tr('Your account was set to "%status%"', 'users', array('%status%' => $new_status)), 00041 $user->email, 00042 'users/mail/statuschange', 00043 array('new_status' => $new_status) 00044 ); 00045 $this->append($cmd); 00046 } 00047 } 00048 return $ret; 00049 } 00050 }