54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
|
|
<?php
|
||
|
|
class ContactCategoriesController extends AppController {
|
||
|
|
|
||
|
|
var $name = 'ContactCategories';
|
||
|
|
var $helpers = array('Html', 'Form');
|
||
|
|
|
||
|
|
function index() {
|
||
|
|
$this->ContactCategory->recursive = 0;
|
||
|
|
$this->set('contactCategories', $this->paginate());
|
||
|
|
}
|
||
|
|
|
||
|
|
function view($id = null) {
|
||
|
|
if (!$id) {
|
||
|
|
$this->Session->setFlash(__('Invalid ContactCategory.', true));
|
||
|
|
$this->redirect(array('action'=>'index'));
|
||
|
|
}
|
||
|
|
$this->set('contactCategory', $this->ContactCategory->read(null, $id));
|
||
|
|
}
|
||
|
|
|
||
|
|
function add() {
|
||
|
|
if (!empty($this->data)) {
|
||
|
|
$this->ContactCategory->create();
|
||
|
|
if ($this->ContactCategory->save($this->data)) {
|
||
|
|
$this->Session->setFlash(__('The ContactCategory has been saved', true));
|
||
|
|
$this->redirect(array('action'=>'index'));
|
||
|
|
} else {
|
||
|
|
$this->Session->setFlash(__('The ContactCategory could not be saved. Please, try again.', true));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function edit($id = null) {
|
||
|
|
if (!$id && empty($this->data)) {
|
||
|
|
$this->Session->setFlash(__('Invalid ContactCategory', true));
|
||
|
|
$this->redirect(array('action'=>'index'));
|
||
|
|
}
|
||
|
|
if (!empty($this->data)) {
|
||
|
|
if ($this->ContactCategory->save($this->data)) {
|
||
|
|
$this->Session->setFlash(__('The ContactCategory has been saved', true));
|
||
|
|
$this->redirect(array('action'=>'index'));
|
||
|
|
} else {
|
||
|
|
$this->Session->setFlash(__('The ContactCategory could not be saved. Please, try again.', true));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (empty($this->data)) {
|
||
|
|
$this->data = $this->ContactCategory->read(null, $id);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
?>
|