本文整理汇总了PHP中Evaluation::fetchAllQuestions方法的典型用法代码示例。如果您正苦于以下问题:PHP Evaluation::fetchAllQuestions方法的具体用法?PHP Evaluation::fetchAllQuestions怎么用?PHP Evaluation::fetchAllQuestions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evaluation
的用法示例。
在下文中一共展示了Evaluation::fetchAllQuestions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _fetchQuestions
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);
}
示例2: rosterAction
//.........这里部分代码省略.........
// questions needed by attached evaluations
foreach ($responselist as $responserow) {
if ($responserow['training_id'] > $row['id']) {
break;
}
// speed up, its sorted
if ($responserow['training_id'] != $row['id']) {
continue;
}
// found a valid training/repsonse combo, lets attach the answers and questions to the training results for EZness
if (!isset($row['questions'])) {
$row['questions'] = array();
}
// get ans
foreach ($answers as $key => $value) {
if ($value['evaluation_response_id'] == $responserow['evaluation_response_id']) {
if (!isset($row['answers'])) {
$row['answers'][$responserow['evaluation_id']][$responserow['evaluation_response_id']] = array('');
}
// training['answers'][response_id][question_id] => answer
$row['answers'][$responserow['evaluation_id']][$responserow['evaluation_response_id']][$value['evaluation_question_id']] = $value['value_text'] ? $value['value_text'] : $value['value_int'];
}
}
// get q
$question_lookup[] = $responserow['evaluation_id'];
}
// get all questions (usually a larger table than responses)
foreach (array_unique($question_lookup) as $eval_id) {
if (!trim($eval_id)) {
continue;
}
if (!isset($questionz[$eval_id])) {
// fetch once
$questionz[$eval_id] = @Evaluation::fetchAllQuestions($eval_id)->toArray();
}
}
// evals now in rowRay['answers'], questions in $questionz
//end evaluations
/* Trainers */
$trainers = @TrainingToTrainer::getTrainers($row['id'])->toArray();
if ($trainers) {
echo '
<table border="1" style="border-collapse:collapse;" cellpadding="3">
<caption style="text-align:left;"><em>' . t('Course') . ' ' . t('Trainers') . '</em></caption>
<tr>
<th>' . $this->tr('Last Name') . '</th>
<th>' . $this->tr('First Name') . '</th>
<th>' . t('Days') . '</th>
</tr>
';
foreach ($trainers as $tRow) {
echo "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t<td>{$tRow['last_name']}</td>\r\n\t\t\t\t\t<td>{$tRow['first_name']}</td>\r\n\t\t\t\t\t<td>{$tRow['duration_days']}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t";
}
echo '</table><br>';
}
$persons = @PersonToTraining::getParticipants($row['id'])->toArray();
echo '
<table border="1" style="border-collapse:collapse;" cellpadding="3">
<caption style="text-align:left;"><em>' . t('Course Participants') . '</em></caption>
<tr>';
$headers = array();
$headers[] = $this->tr('Last Name');
if ($this->setting('display_middle_name')) {
$headers[] = $this->tr('Middle Name');
}
$headers[] = $this->tr('First Name');