protected function _fetchQuestions($evaluation_id = false) { $id = $evaluation_id ? $evaluation_id : $this->getSanParam('id'); if ($id) { $ev = new Evaluation(); $source_row = $ev->findOrCreate($id); if ($source_row->id) { $title = $source_row->title; $question_rows = $ev->fetchAllQuestions($id); $qtext = array(); $qtype = array(); $qid = array(); foreach ($question_rows as $qr) { $qtext[] = $qr->question_text; $qtype[] = $qr->question_type; $qid[] = $qr->id; } $answers = $ev->fetchCustomAnswers($id); if (!is_array($answers) || empty($answers)) { $answers = array(); } } } else { $this->_redirect('error'); } return array($title, $qtext, $qtype, $qid, $answers); }