Example #1
0
 /**
  * Return one and only one instance of the object
  */
 public static function instance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #2
0
 public function indexAction()
 {
     $polls = Model_Table_Poll::instance()->fetchAll();
     $this->view->polls = array();
     foreach ($polls as $poll) {
         $options = $poll->findDependentRowset('Model_Table_Poll_Option');
         $this->view->polls[$poll->id]['question'] = $poll->question;
         $this->view->polls[$poll->id]['options'] = $options->toArray();
     }
 }
Example #3
0
 /**
  * Retrieve all polls
  *
  * @return struct polls
  */
 public static function getAllPolls()
 {
     $polls = Model_Table_Poll::instance()->fetchAll();
     $ret = array();
     foreach ($polls as $poll) {
         foreach ($poll->findDependentRowset('Model_Table_Poll_Option') as $option) {
             $ret[$poll->question][$option->key] = $option->text;
         }
     }
     return $ret;
 }