summaryrefslogtreecommitdiffstats
path: root/application/classes/model/poll.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/classes/model/poll.php')
-rw-r--r--application/classes/model/poll.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/application/classes/model/poll.php b/application/classes/model/poll.php
new file mode 100644
index 0000000..a2cfe08
--- /dev/null
+++ b/application/classes/model/poll.php
@@ -0,0 +1,13 @@
+<?php
+class Poll_Model extends ORM{
+ public $has_many=array('options');
+
+ public function get($property){
+ if ($property == 'total_votes') {
+ $total=0;
+ foreach($this->options->find_all() as $option)
+ $total += $option->votes;
+ return $total;
+ }
+ }
+} \ No newline at end of file