Example #1
0
 public function action_delete($id = null)
 {
     if (!isset($_SESSION['user_id'])) {
         return Response::redirect('login');
     }
     is_null($id) and Response::redirect('Entry');
     if ($entry = Model_Entry::find($id)) {
         $entry->delete();
     }
     Response::redirect('entry');
 }
 /**
  * 出店予約のキャンセル
  *
  * @access public
  * @param
  * @return void
  * @author shimma
  * @autho ida
  */
 public function get_cancel()
 {
     $entry_id = \Input::get('entry_id');
     $cancel = \Input::get('cancel');
     if (!$entry_id || !$cancel) {
         \Session::set_flash('notice', \STATUS_FLEAMARKET_CANCEL_FAILED);
         \Response::redirect('/mypage', 'refresh');
     }
     $entry = \Model_Entry::find($entry_id);
     if (!$this->login_user->cancelEntry($entry_id, $this->login_user->user_id)) {
         \Session::set_flash('notice', \STATUS_FLEAMARKET_CANCEL_FAILED);
     } else {
         \Session::set_flash('notice', \STATUS_FLEAMARKET_CANCEL_SUCCESS);
         $entry = \Model_Entry::find($entry_id);
         $email_template_params = array('nick_name' => $this->login_user->nick_name, 'fleamarket.name' => $entry->fleamarket->name);
         $this->login_user->sendmail('common/user_cancel_fleamarket', $email_template_params);
     }
     //処理ページを見せ1秒後にマイページにリダイレクトさせる
     $this->setLazyRedirect('/mypage');
     $view = \View::forge('mypage/cancel');
     $view->set('cancel', $cancel);
     $this->template->content = $view;
 }
 /**
  * 指定した出店予約をキャンセルする
  *
  * @access public
  * @param
  * @return void
  * @author kobayashi
  * @author ida
  */
 public function action_cancel()
 {
     $this->template = '';
     $entry_id = \Input::get('entry_id');
     $sendmail = \Input::get('sendmail');
     $status = 400;
     if (!empty($entry_id)) {
         try {
             $entry = \Model_Entry::find($entry_id);
             $entry->cancel($entry_id, $this->administrator->administrator_id);
             if ($sendmail == 1) {
                 $email_template_params = array('nick_name' => $entry->user->nick_name, 'fleamarket.name' => $entry->fleamarket->name);
                 $entry->user->sendmail('common/user_cancel_fleamarket', $email_template_params);
             }
             $status = 200;
         } catch (\SystemException $e) {
             $status = 300;
         } catch (\Exception $e) {
             $status = 400;
         }
     }
     return $this->responseJson(array('status' => $status));
 }