/var/www/vhosts/ihelp.ro/httpdocs/src/Controller/Admin
Edit: /var/www/vhosts/ihelp.ro/httpdocs/src/Controller/Admin/SponsorsActivitiesController.php (4003B)
paginate($this->SponsorsActivities);
$this->set(compact('sponsorsActivities'));
}
/**
* View method
*
* @param string|null $id Sponsors Activity id.
* @return \Cake\Http\Response|null|void Renders view
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$sponsorsActivity = $this->SponsorsActivities->get($id, [
'contain' => [],
]);
$this->set(compact('sponsorsActivity'));
}
/**
* Add method
*
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
*/
public function add()
{
$sponsorId = $this->request->getQuery('sponsor_id');
$sponsorsActivity = $this->SponsorsActivities->newEmptyEntity();
if ($this->request->is('post')) {
$data = $this->request->getData();
$data['sponsor_id'] = $sponsorId;
$sponsorsActivity = $this->SponsorsActivities->patchEntity($sponsorsActivity, $data);
if ($this->SponsorsActivities->save($sponsorsActivity)) {
$this->Flash->success(__('The sponsors activity has been saved.'));
return $this->redirect(['controller' => 'Sponsors', 'action' => 'edit', $sponsorId]);
}
$this->Flash->error(__('The sponsors activity could not be saved. Please, try again.'));
}
$this->set(compact('sponsorsActivity'));
}
/**
* Edit method
*
* @param string|null $id Sponsors Activity id.
* @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null)
{
$sponsorsActivity = $this->SponsorsActivities->get($id, [
'contain' => [],
]);
$sponsorId = $sponsorsActivity->sponsor_id;
if ($this->request->is(['patch', 'post', 'put'])) {
$sponsorsActivity = $this->SponsorsActivities->patchEntity($sponsorsActivity, $this->request->getData());
if ($this->SponsorsActivities->save($sponsorsActivity)) {
$this->Flash->success(__('The sponsors activity has been saved.'));
return $this->redirect(['controller' => 'Sponsors', 'action' => 'edit', $sponsorId]);
}
$this->Flash->error(__('The sponsors activity could not be saved. Please, try again.'));
}
$this->set(compact('sponsorsActivity'));
}
/**
* Delete method
*
* @param string|null $id Sponsors Activity id.
* @return \Cake\Http\Response|null|void Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$sponsorsActivity = $this->SponsorsActivities->get($id);
$sponsorId = $sponsorsActivity->sponsor_id;
if ($this->SponsorsActivities->delete($sponsorsActivity)) {
$this->Flash->success(__('The sponsors activity has been deleted.'));
} else {
$this->Flash->error(__('The sponsors activity could not be deleted. Please, try again.'));
}
return $this->redirect(['controller' => 'Sponsors', 'action' => 'edit', $sponsorId]);
}
}