diff options
author | Michael Francis <edude03@gmail.com> | 2011-05-28 13:28:16 -0400 |
---|---|---|
committer | Michael Francis <edude03@gmail.com> | 2011-05-28 13:28:16 -0400 |
commit | 2389d66da849798f8d4ec5f10e3b07c11da49185 (patch) | |
tree | e22556d12982395b469a23420c662662e3e064cc /controllers/ProfilesController.php | |
download | otakuhub-2389d66da849798f8d4ec5f10e3b07c11da49185.tar.xz |
Initial Commit
Diffstat (limited to 'controllers/ProfilesController.php')
-rw-r--r-- | controllers/ProfilesController.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/controllers/ProfilesController.php b/controllers/ProfilesController.php new file mode 100644 index 0000000..022b540 --- /dev/null +++ b/controllers/ProfilesController.php @@ -0,0 +1,41 @@ +<?php + +namespace app\controllers; + +use app\models\Profile; + +class ProfilesController extends \lithium\action\Controller { + + public function index() { + $profiles = Profile::all(); + return compact('profiles'); + } + + public function view() { + $profile = Profile::first($this->request->id); + return compact('profile'); + } + + public function add() { + $profile = Profile::create(); + + if (($this->request->data) && $profile->save($this->request->data)) { + $this->redirect(array('Profiles::view', 'args' => array($profile->id))); + } + return compact('profile'); + } + + public function edit() { + $profile = Profile::find($this->request->id); + + if (!$profile) { + $this->redirect('Profiles::index'); + } + if (($this->request->data) && $profile->save($this->request->data)) { + $this->redirect(array('Profiles::view', 'args' => array($profile->id))); + } + return compact('profile'); + } +} + +?>
\ No newline at end of file |