public function screen_reply_message() { $message_id = ""; $btn1 = ""; $btn2 = ""; $reset = ""; if (isset($_POST['message_id'])) { $_SESSION['message_id'] = $_POST['message_id']; } $this->make_message_form(); if ($this->action == "form") { $MessageModel = new MessageModel(); $message_data = $MessageModel->get_message_message_id($_SESSION['message_id']); $subject = "Re:" . $message_data['subject']; $body = "\n----------<" . $message_data['reg_date'] . ">----------\n"; $body .= $message_data['body']; $body = str_replace('<br />', "", $body); $body = str_replace("\n", "\n" . '>', $body); $body = "\n\n\n" . $body; $this->form->setDefaults(array('subject' => $subject, 'body' => $body)); $this->title = "返信画面"; $this->next_type = "reply_message"; $this->next_action = "confirm"; $this->file = "reply_message.tpl"; $btn1 = "確認"; } else { if ($this->action == "confirm" && isset($_POST['submit1']) && $_POST['submit1'] == "確認") { $this->form->freeze(); $this->title = "返信画面"; $this->message = "<font color='red'>下記をお送りしても宜しいでしょうか?</font>"; $this->next_type = "reply_message"; $this->next_action = "complete"; $this->file = "reply_message.tpl"; $btn1 = "OK"; $btn2 = "戻る"; } else { if ($this->action == "complete" && isset($_POST['submit2']) && $_POST['submit2'] == "戻る") { $this->title = "返信画面"; $this->next_type = "reply_message"; $this->next_action = "confirm"; $this->file = "reply_message.tpl"; $btn1 = "確認"; } else { if ($this->action == "complete" && isset($_POST['submit1']) && $_POST['submit1'] == "OK") { $this->title = "送信完了"; $this->message = "メッセージの送信が完了しました"; $data = $this->form->getSubmitValues(); $MessageModel = new MessageModel(); $message_data = $MessageModel->get_message_message_id($_SESSION['message_id']); //返信済みとmessageに記録 $MessageModel->modify_message_re_message_id($_SESSION['message_id']); //DBの文字制限 subject:100文字/body:1250文字までの容量 $message_data['subject'] = mb_strimwidth($data['subject'], 0, 100 * 2); $message_data['body'] = mb_strimwidth($data['body'], 0, 1000 * 2); //DBへの登録 $MessageModel->regist_member_message($message_data); $this->file = "message.tpl"; unset($_SESSION['message_id']); } } } } $this->form->addElement('submit', 'submit1', $btn1); $this->form->addElement('submit', 'submit2', $btn2); $this->form->addElement('reset', 'reset', $reset); $this->view_display(); }