Email->recursive = 0; $this->set('emails', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid Email.', true)); $this->redirect(array('action'=>'index')); } $this->set('email', $this->Email->read(null, $id)); } function add() { if (!empty($this->data)) { $this->Email->create(); if ($this->Email->save($this->data)) { $this->Session->setFlash(__('The Email has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Email could not be saved. Please, try again.', true)); } } $enquiries = $this->Email->Enquiry->find('list'); $this->set(compact('enquiries')); } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid Email', true)); $this->redirect(array('action'=>'index')); } if (!empty($this->data)) { if ($this->Email->save($this->data)) { $this->Session->setFlash(__('The Email has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Email could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Email->read(null, $id); } $enquiries = $this->Email->Enquiry->find('list'); $this->set(compact('enquiries')); } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for Email', true)); $this->redirect(array('action'=>'index')); } if ($this->Email->del($id)) { $this->Session->setFlash(__('Email deleted', true)); $this->redirect(array('action'=>'index')); } } } ?>