contributions/confirmations/behaviour/commands/confirmations/create.cmd.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Create a confirmation 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup Confirmations 00007 */ 00008 00009 class CreateConfirmationsCommand extends CommandChain { 00010 /** 00011 * Execute this command 00012 */ 00013 protected function do_execute() { 00014 $ret = new Status(); 00015 00016 $confirmation = new DAOConfirmations(); 00017 $params = $this->get_params(); 00018 $params['code'] = Common::create_token(); // Tokens must not be unique! 00019 $params['expirationdate'] = Arr::get_item($params, 'expirationdate', time() + GyroDate::ONE_DAY); // 24 hours default expiration 00020 00021 Load::commands('generics/create'); 00022 $cmd = new CreateCommand('confirmations', $params); 00023 $ret->merge($cmd->execute()); 00024 $this->set_result($cmd->get_result()); 00025 00026 if ($ret->is_ok()) { 00027 $confirmation = $this->get_result(); 00028 $handler = $confirmation->create_handler(); 00029 $ret->merge($handler->created()); 00030 } 00031 00032 //$this->set_result($confirmation); 00033 return $ret; 00034 } 00035 }