-
Notifications
You must be signed in to change notification settings - Fork 36
/
modules_controller.php
54 lines (45 loc) · 1.28 KB
/
modules_controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
*
*
*/
class ModulesController extends ManagementAppController{
var $name = 'Modules';
function beforeFilter() {
parent::beforeFilter();
}
function admin_index() {
$modules = $this->paginate();
$this->set(compact('modules'));
}
function admin_add() {
if (!empty($this->data)) {
$this->Module->create();
if ($this->Module->saveAll($this->data)) {
$this->Session->setFlash('Your moodule has been saved.');
$this->redirect(array('action' => 'index'));
}
}
$positions = $this->Module->Position->find('list');
$groups = $this->Module->Group->find('list');
$routes = ClassRegistry::init('Core.Route')->find('list');
$this->set(compact('positions', 'groups', 'routes'));
}
function admin_edit($id = null) {
if (!$id) {
$this->Session->setFlash(__('That module could not be found', true), true);
$this->redirect($this->referer());
}
if (!empty($this->data)) {
if ($this->Module->save($this->data)) {
$this->Session->setFlash(__('Your module has been saved.', true));
$this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(__('Your module could not be saved.', true));
}
if ($id && empty($this->data)) {
$this->data = $this->Module->read(null, $id);
}
}
}
?>