Exemple #1
0
 /**
  * メッセージを送信
  */
 public function message_compose()
 {
     if ($this->is_post() && $this->verify()) {
         try {
             $to_maintainer = C(OpenpearMaintainer)->find_get(Q::eq('name', $this->in_vars('to')));
             $message = new OpenpearMessage();
             $message->cp($this->vars());
             $message->maintainer_to_id($to_maintainer->id());
             $message->maintainer_from_id($this->user()->id());
             switch ($this->in_vars('action')) {
                 case 'confirm':
                     $this->put_block($this->map_arg('confirm_template'));
                     $this->vars('confirm', $message);
                     break;
                 case 'do':
                 default:
                     $message->save();
                     $this->redirect_by_map("success_redirect");
                     break;
             }
         } catch (NotfoundDaoException $e) {
             $this->not_found();
         } catch (Exception $e) {
             C($message)->rollback();
             Log::debug($e);
         }
     }
 }