コード例 #1
0
ファイル: comment.php プロジェクト: uzura8/flockbird
 public function action_create($note_id = null)
 {
     if (!$note_id || !($note = Model_Note::find($note_id))) {
         throw new \HttpNotFoundException();
     }
     $this->check_browse_authority($note->public_flag, $note->member_id);
     // Lazy validation
     if (\Input::post('body')) {
         \Util_security::check_csrf();
         // Create a new comment
         $comment = new Model_NoteComment(array('body' => \Input::post('body'), 'note_id' => $note_id, 'member_id' => $this->u->id));
         // Save the post and the comment will save too
         if ($comment->save()) {
             \Session::set_flash('message', 'コメントしました。');
         } else {
             \Session::set_flash('error', 'コメントに失敗しました。');
         }
         \Response::redirect('note/detail/' . $note_id);
     } else {
         Controller_Note::action_detail($note_id);
     }
 }
コード例 #2
0
ファイル: notecommentlike.php プロジェクト: uzura8/flockbird
 private static function save_comment($note_id, $member_id)
 {
     $comment = new Model_NoteComment(array('body' => 'Test for note_comment_like.', 'note_id' => $note_id, 'member_id' => $member_id));
     $comment->save();
     return $comment;
 }