Skip to content

Commit

Permalink
adding modules managment code
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Jan 18, 2010
1 parent ce4ebe2 commit 85f94b7
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
48 changes: 48 additions & 0 deletions infinitas/management/controllers/modules_controller.php
@@ -0,0 +1,48 @@
<?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'));
}
}
}

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);
}
}
}
?>
9 changes: 9 additions & 0 deletions infinitas/management/models/module.php
@@ -0,0 +1,9 @@
<?php
/**
*
*
*/
class Module extends ManagementAppModel{
var $name = 'Module';
}
?>

0 comments on commit 85f94b7

Please sign in to comment.