Пример #1
0
 public function getAllSurveys()
 {
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('s' => 'Survey'), array('*'))->where('s.language = ?', $_SESSION['System']['lng']);
     $stmt = $db->query($select);
     $results = $stmt->fetchAll();
     $surveys = array();
     foreach ($results as $result) {
         $datePublished = split(' ', $result['date_published']);
         $dateExpired = split(' ', $result['date_expired']);
         $survey = new SxCms_Survey();
         $survey->setId($result['survey_id'])->setLanguage($result['language'])->setTitle($result['title'])->setDescription($result['description'])->setDatePublished($datePublished[0])->setTimePublished($datePublished[1])->setDateExpired($dateExpired[0])->setTimeExpired($dateExpired[1]);
         $surveys[] = $survey;
     }
     return $surveys;
 }