Created
May 25, 2017 09:03
-
-
Save residential-map-machine-user/365da4dfe414225448afa003fcf302c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller\Approval; | |
use App\Controller\AppController; | |
use Cake\ORM\TableRegistry; | |
use Cake\I18n\Time; | |
/** | |
* RestaurantReservationsManagesController Controller | |
* | |
* @property \App\Model\Table\RestaurantReservationsManagesTable $RestaurantReservationsManages | |
* | |
* @method \App\Model\Entity\RestaurantReservationsManages[] paginate($object = null, array $settings = []) | |
*/ | |
class RestaurantReservationsManagesController extends AppController | |
{ | |
/** | |
* Initialize method | |
* | |
*/ | |
public function initialize() { | |
parent::initialize(); | |
$this->RestaurantReservations = TableRegistry::get('RestaurantReservations', [ | |
'className' => 'App\Model\Table\Restaurant\RestaurantReservationsTable' | |
]); | |
} | |
/** | |
* 予約一覧画面用のアクション (表) | |
* | |
* | |
* @access public | |
* @return \Cake\Http\Response|null | |
*/ | |
public function displayAll() | |
{ | |
$now = Time::now(); | |
$afterReserve = $this->RestaurantReservations->getDayReserve($now); | |
$this->set(compact('afterReserve')); | |
} | |
/** | |
* 予約一覧画面用のアクション(座席) | |
* | |
* | |
* @access public | |
* @return \Cake\Http\Response|null | |
*/ | |
public function displaySeat() | |
{ | |
$reservations = $this->paginate($this->RestaurantReservations); | |
$this->set(compact('reservations')); | |
$this->set('_serialize', ['reservations']); | |
} | |
/** | |
* 予約一覧画面用のアクション(レジ裏) | |
* | |
* | |
* @access public | |
* @return \Cake\Http\Response|null | |
*/ | |
public function seatChart() | |
{ | |
$reservations = $this->paginate($this->RestaurantReservations); | |
$this->set(compact('reservations')); | |
$this->set('_serialize', ['reservations']); | |
} | |
/** | |
* 予約詳細画面のアクション | |
* | |
* @param string|null $id RestaurantRreservation id. | |
* @return \Cake\Http\Response|null | |
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. | |
*/ | |
public function view($id = null) | |
{ | |
//$reservation = $this->RestaurantReservations->get($id, [ | |
// 'contain' => [] | |
//]); | |
//$this->set('reservation', $reservation); | |
$this->set('_serialize', ['reservation']); | |
} | |
/** | |
* 予約追加画面用のアクション | |
* | |
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise. | |
*/ | |
public function add() | |
{ | |
$reservation = $this->RestaurantReservations->newEntity(); | |
if ($this->request->is('post')) { | |
$reservation = $this->RestaurantReservations->patchEntity($reservation, $this->request->getData()); | |
if ($this->RestaurantReservations->save($reservation)) { | |
$this->Flash->success(__('The RestaurantReservation has been saved.')); | |
return $this->redirect(['action' => 'index']); | |
} | |
$this->Flash->error(__('The RestaurantReservation could not be saved. Please, try again.')); | |
} | |
$this->set(compact('reservation')); | |
$this->set('_serialize', ['reservation']); | |
} | |
/** | |
* 予約内容編集画面用のアクション | |
* | |
* @param string|null $id RestaurantReservation id. | |
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise. | |
* @throws \Cake\Network\Exception\NotFoundException When record not found. | |
*/ | |
public function edit($id = null) | |
{ | |
//$reservation = $this->RestaurantReservations->get($id, [ | |
// 'contain' => [] | |
//]); | |
if ($this->request->is(['patch', 'post', 'put'])) { | |
$reservation = $this->RestaurantReservations->patchEntity($reservation, $this->request->getData()); | |
if ($this->RestaurantReservations->save($reservation)) { | |
$this->Flash->success(__('The RestaurantRreservation has been saved.')); | |
return $this->redirect(['action' => 'index']); | |
} | |
$this->Flash->error(__('The RestaurantReservation could not be saved. Please, try again.')); | |
} | |
$this->set(compact('reservation')); | |
$this->set('_serialize', ['reservation']); | |
} | |
/** | |
* 予約削除用のアクション | |
* | |
* @param string|null $id RestaurantReservation id. | |
* @return \Cake\Http\Response|null Redirects to index. | |
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. | |
*/ | |
public function delete($id = null) | |
{ | |
$this->request->allowMethod(['post', 'delete']); | |
$reservation = $this->RestaurantReservations->get($id); | |
if ($this->RestaurantReservations->delete($reservation)) { | |
$this->Flash->success(__('The RestaurantReservation has been deleted.')); | |
} else { | |
$this->Flash->error(__('The RestaurantReservation could not be deleted. Please, try again.')); | |
} | |
return $this->redirect(['action' => 'index']); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller\Approval; | |
use App\Controller\AppController; | |
use Cake\ORM\TableRegistry; | |
use Cake\I18n\Time; | |
/** | |
* RestaurantReservationsManagesController Controller | |
* | |
* @property \App\Model\Table\RestaurantReservationsManagesTable $RestaurantReservationsManages | |
* | |
* @method \App\Model\Entity\RestaurantReservationsManages[] paginate($object = null, array $settings = []) | |
*/ | |
class RestaurantReservationsManagesController extends AppController | |
{ | |
/** | |
* Initialize method | |
* | |
*/ | |
public function initialize() { | |
parent::initialize(); | |
$this->RestaurantReservations = TableRegistry::get('RestaurantReservations', [ | |
'className' => 'App\Model\Table\Restaurant\RestaurantReservationsTable' | |
]); | |
} | |
/** | |
* 予約一覧画面用のアクション (表) | |
* | |
* | |
* @access public | |
* @return \Cake\Http\Response|null | |
*/ | |
public function displayAll() | |
{ | |
$now = Time::now(); | |
$afterReserve = $this->RestaurantReservations->getDayReserve($now); | |
$this->set(compact('afterReserve')); | |
} | |
/** | |
* 予約一覧画面用のアクション(座席) | |
* | |
* | |
* @access public | |
* @return \Cake\Http\Response|null | |
*/ | |
public function displaySeat() | |
{ | |
$reservations = $this->paginate($this->RestaurantReservations); | |
$this->set(compact('reservations')); | |
$this->set('_serialize', ['reservations']); | |
} | |
/** | |
* 予約一覧画面用のアクション(レジ裏) | |
* | |
* | |
* @access public | |
* @return \Cake\Http\Response|null | |
*/ | |
public function seatChart() | |
{ | |
$reservations = $this->paginate($this->RestaurantReservations); | |
$this->set(compact('reservations')); | |
$this->set('_serialize', ['reservations']); | |
} | |
/** | |
* 予約詳細画面のアクション | |
* | |
* @param string|null $id RestaurantRreservation id. | |
* @return \Cake\Http\Response|null | |
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. | |
*/ | |
public function view($id = null) | |
{ | |
//$reservation = $this->RestaurantReservations->get($id, [ | |
// 'contain' => [] | |
//]); | |
//$this->set('reservation', $reservation); | |
$this->set('_serialize', ['reservation']); | |
} | |
/** | |
* 予約追加画面用のアクション | |
* | |
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise. | |
*/ | |
public function add() | |
{ | |
$reservation = $this->RestaurantReservations->newEntity(); | |
if ($this->request->is('post')) { | |
$reservation = $this->RestaurantReservations->patchEntity($reservation, $this->request->getData()); | |
if ($this->RestaurantReservations->save($reservation)) { | |
$this->Flash->success(__('The RestaurantReservation has been saved.')); | |
return $this->redirect(['action' => 'index']); | |
} | |
$this->Flash->error(__('The RestaurantReservation could not be saved. Please, try again.')); | |
} | |
$this->set(compact('reservation')); | |
$this->set('_serialize', ['reservation']); | |
} | |
/** | |
* 予約内容編集画面用のアクション | |
* | |
* @param string|null $id RestaurantReservation id. | |
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise. | |
* @throws \Cake\Network\Exception\NotFoundException When record not found. | |
*/ | |
public function edit($id = null) | |
{ | |
//$reservation = $this->RestaurantReservations->get($id, [ | |
// 'contain' => [] | |
//]); | |
if ($this->request->is(['patch', 'post', 'put'])) { | |
$reservation = $this->RestaurantReservations->patchEntity($reservation, $this->request->getData()); | |
if ($this->RestaurantReservations->save($reservation)) { | |
$this->Flash->success(__('The RestaurantRreservation has been saved.')); | |
return $this->redirect(['action' => 'index']); | |
} | |
$this->Flash->error(__('The RestaurantReservation could not be saved. Please, try again.')); | |
} | |
$this->set(compact('reservation')); | |
$this->set('_serialize', ['reservation']); | |
} | |
/** | |
* 予約削除用のアクション | |
* | |
* @param string|null $id RestaurantReservation id. | |
* @return \Cake\Http\Response|null Redirects to index. | |
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. | |
*/ | |
public function delete($id = null) | |
{ | |
$this->request->allowMethod(['post', 'delete']); | |
$reservation = $this->RestaurantReservations->get($id); | |
if ($this->RestaurantReservations->delete($reservation)) { | |
$this->Flash->success(__('The RestaurantReservation has been deleted.')); | |
} else { | |
$this->Flash->error(__('The RestaurantReservation could not be deleted. Please, try again.')); | |
} | |
return $this->redirect(['action' => 'index']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment