55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
class EmailsController extends AppController {
|
|
|
|
var $name = 'Emails';
|
|
var $helpers = array('Html', 'Form', 'Number', 'Ajax', 'Text', 'Link');
|
|
var $components = array('RequestHandler');
|
|
function index() {
|
|
$this->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 frame($id = null) {
|
|
$this->set('id', $id);
|
|
$this->set('attachments', $this->Email->EmailAttachment->findAllByEmailId($id));
|
|
}
|
|
|
|
function show($id = null) {
|
|
$this->layout = 'minimal';
|
|
$this->set('email', $this->Email->read(null, $id));
|
|
|
|
}
|
|
/* Violates DRY. Should probably clean this up at some point */
|
|
function printview($id = null) {
|
|
$this->layout = 'minimal';
|
|
$this->set('email', $this->Email->read(null, $id));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
?>
|