summaryrefslogtreecommitdiffstats
path: root/application/classes/controller/polls.php
diff options
context:
space:
mode:
authorRoman Tsiupa <draconyster@gmail.com>2013-01-18 23:07:50 +0200
committerRoman Tsiupa <draconyster@gmail.com>2013-01-18 23:07:50 +0200
commitcde8cc7986f7cec810e34eed4c2feda88acfe970 (patch)
tree5114becb6a3a8e71508ad169f19d7d79116a758b /application/classes/controller/polls.php
parent65a7f45a570dde73e1ca1fefc1af15491772e8fc (diff)
downloadPHPixie-origin/ormwith.zip
PHPixie-origin/ormwith.tar.gz
PHPixie-origin/ormwith.tar.bz2
Request paersing with .htaccess disabledorigin/ormwith
Diffstat (limited to 'application/classes/controller/polls.php')
-rw-r--r--application/classes/controller/polls.php59
1 files changed, 0 insertions, 59 deletions
diff --git a/application/classes/controller/polls.php b/application/classes/controller/polls.php
deleted file mode 100644
index c15be88..0000000
--- a/application/classes/controller/polls.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-class Polls_Controller extends Controller {
-
- public $view;
- public $template;
-
- public function before() {
- $this->view = View::get('main');
- $this->template=$this->request->param('action');
- }
- public function action_index(){
- $this->view->polls = ORM::factory('poll')->find_all();
- }
-
- public function action_poll() {
-
- if ($this->request->method == 'POST') {
- $option_id = $this->request->post('option');
- $option = ORM::factory('option')->where('id', $option_id)->find();
- $option->votes += 1;
- $option->save();
- $this->response-> redirect('/polls/poll/'.$option->poll->id);
- $this->execute=false;
- return;
- }
-
- $id=$this->request->param('id');
- $this->view->poll = ORM::factory('poll')->where('id', $id)->find();
-
- }
-
- public function action_add(){
- if ($this->request->method == 'POST') {
- $poll = ORM::factory('poll');
- $poll->question = $this->request->post('question');
- $poll->save();
- foreach($this->request->post('options') as $text) {
- if (empty($text))
- continue;
- $option = ORM::factory('option');
- $option->text = $text;
- $option->save();
- $poll->add('options',$option);
- }
- $this->response->redirect('/polls/');
- return;
- }
-
- $this->template='add';
- }
-
- public function after() {
- $this->view->template=Misc::find_file('views',$this->template);
- $this->response->body=$this->view->render();
- }
-
-
-}
-?> \ No newline at end of file