本文整理汇总了PHP中Answer::selectComment方法的典型用法代码示例。如果您正苦于以下问题:PHP Answer::selectComment方法的具体用法?PHP Answer::selectComment怎么用?PHP Answer::selectComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Answer
的用法示例。
在下文中一共展示了Answer::selectComment方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manage_answer
//.........这里部分代码省略.........
$exe_info = Event::get_exercise_results_by_attempt($exeId);
$exe_info = isset($exe_info[$exeId]) ? $exe_info[$exeId] : null;
$params = array();
$params['course_id'] = $course_id;
$params['session_id'] = api_get_session_id();
$params['user_id'] = isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id();
$params['exercise_id'] = isset($exe_info['exe_exo_id']) ? $exe_info['exe_exo_id'] : $this->id;
$params['question_id'] = $questionId;
$params['exe_id'] = isset($exe_info['exe_id']) ? $exe_info['exe_id'] : $exeId;
$nano = new Nanogong($params);
//probably this attempt came in an exercise all question by page
if ($feedback_type == 0) {
$nano->replace_with_real_exe($exeId);
}
}
$user_answer = '';
// Get answer list for matching
$sql = "SELECT id_auto, id, answer\n FROM {$table_ans}\n WHERE c_id = {$course_id} AND question_id = {$questionId}";
$res_answer = Database::query($sql);
$answerMatching = array();
while ($real_answer = Database::fetch_array($res_answer)) {
$answerMatching[$real_answer['id_auto']] = $real_answer['answer'];
}
$real_answers = array();
$quiz_question_options = Question::readQuestionOption($questionId, $course_id);
$organs_at_risk_hit = 0;
$questionScore = 0;
if ($debug) {
error_log('Start answer loop ');
}
$answer_correct_array = array();
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerComment = $objAnswerTmp->selectComment($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$answerWeighting = (double) $objAnswerTmp->selectWeighting($answerId);
$answerAutoId = $objAnswerTmp->selectAutoId($answerId);
$answer_correct_array[$answerId] = (bool) $answerCorrect;
if ($debug) {
error_log("answer auto id: {$answerAutoId} ");
error_log("answer correct: {$answerCorrect} ");
}
// Delineation
$delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1);
$answer_delineation_destination = $objAnswerTmp->selectDestination(1);
switch ($answerType) {
// for unique answer
case UNIQUE_ANSWER:
case UNIQUE_ANSWER_IMAGE:
case UNIQUE_ANSWER_NO_OPTION:
if ($from_database) {
$sql = "SELECT answer FROM {$TBL_TRACK_ATTEMPT}\n WHERE\n exe_id = '" . $exeId . "' AND\n question_id= '" . $questionId . "'";
$result = Database::query($sql);
$choice = Database::result($result, 0, "answer");
$studentChoice = $choice == $answerAutoId ? 1 : 0;
if ($studentChoice) {
$questionScore += $answerWeighting;
$totalScore += $answerWeighting;
}
} else {
$studentChoice = $choice == $answerAutoId ? 1 : 0;
if ($studentChoice) {
$questionScore += $answerWeighting;
$totalScore += $answerWeighting;
}
}
示例2: Answer
<td class='even'><b>$langAnswer</b></td>
</tr>";
} else {
echo "<tr class='even'>
<td><b>$langElementList</b></td>
<td><b>$langCorrespondsTo</b></td>
</tr>";
}
}
// construction of the Answer object
$objAnswerTmp = new Answer($questionId);
$nbrAnswers = $objAnswerTmp->selectNbrAnswers();
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerComment = $objAnswerTmp->selectComment($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$answerWeighting = $objAnswerTmp->selectWeighting($answerId);
// support for math symbols
$answer = mathfilter($answer, 12, "$webDir/courses/mathimg/");
$answerComment = mathfilter($answerComment, 12, "$webDir/courses/mathimg/");
switch ($answerType) {
// for unique answer
case UNIQUE_ANSWER : $studentChoice = ($choice == $answerId) ? 1 : 0;
if ($studentChoice) {
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
break;
// for multiple answers
示例3: showQuestion
//.........这里部分代码省略.........
$header .= Display::tag('th', $item);
}
} else {
$header .= Display::tag('th', $item);
}
}
if ($show_comment) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="table table-hover table-striped">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
if ($show_comment) {
if (in_array($answerType, array(MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION, GLOBAL_MULTIPLE_ANSWER))) {
$header = Display::tag('th', get_lang('Options'));
if ($exercise_feedback == EXERCISE_FEEDBACK_TYPE_END) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="table table-hover table-striped">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
}
$matching_correct_answer = 0;
$user_choice_array = array();
if (!empty($user_choice)) {
foreach ($user_choice as $item) {
$user_choice_array[] = $item['answer'];
}
}
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$numAnswer = $objAnswerTmp->selectAutoId($answerId);
$comment = $objAnswerTmp->selectComment($answerId);
$attributes = array();
// Unique answer
if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) {
$input_id = 'choice-' . $questionId . '-' . $answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
} else {
$attributes = array('id' => $input_id);
}
if ($debug_mark_answer) {
if ($answerCorrect) {
$attributes['checked'] = 1;
$attributes['selected'] = 1;
}
}
if ($show_comment) {
$s .= '<tr><td>';
}
if ($answerType == UNIQUE_ANSWER_IMAGE) {
if ($show_comment) {
if (empty($comment)) {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image" style="text-align: center">';
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">';
}
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">';
}
}
$answer = Security::remove_XSS($answer, STUDENT);
$s .= Display::input('hidden', 'choice2[' . $questionId . ']', '0');
$answer_input = null;
示例4: showQuestion
//.........这里部分代码省略.........
$header .= Display::tag('th', $item);
}
} else {
$header .= Display::tag('th', $item);
}
}
if ($show_comment) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="table table-hover table-striped">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
if ($show_comment) {
if (in_array($answerType, array(MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION, GLOBAL_MULTIPLE_ANSWER))) {
$header = Display::tag('th', get_lang('Options'));
if ($exercise_feedback == EXERCISE_FEEDBACK_TYPE_END) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="table table-hover table-striped">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
}
$matching_correct_answer = 0;
$user_choice_array = array();
if (!empty($user_choice)) {
foreach ($user_choice as $item) {
$user_choice_array[] = $item['answer'];
}
}
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$numAnswer = $objAnswerTmp->selectAutoId($answerId);
$comment = $objAnswerTmp->selectComment($answerId);
$attributes = array();
// Unique answer
if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) {
$input_id = 'choice-' . $questionId . '-' . $answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
} else {
$attributes = array('id' => $input_id);
}
if ($debug_mark_answer) {
if ($answerCorrect) {
$attributes['checked'] = 1;
$attributes['selected'] = 1;
}
}
if ($show_comment) {
$s .= '<tr><td>';
}
if ($answerType == UNIQUE_ANSWER_IMAGE) {
if ($show_comment) {
if (empty($comment)) {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image" style="text-align: center">';
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">';
}
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">';
}
}
$answer = Security::remove_XSS($answer, STUDENT);
$s .= Display::input('hidden', 'choice2[' . $questionId . ']', '0');
$answer_input = null;
示例5: showQuestion
//.........这里部分代码省略.........
$header .= Display::tag('th', $item);
}
} else {
$header .= Display::tag('th', $item);
}
}
if ($show_comment) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="data_table">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
if ($show_comment) {
if (in_array($answerType, array(MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, GLOBAL_MULTIPLE_ANSWER))) {
$header = Display::tag('th', get_lang('Options'));
if ($exercise_feedback == EXERCISE_FEEDBACK_TYPE_END) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="data_table">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
}
$matching_correct_answer = 0;
$user_choice_array = array();
if (!empty($user_choice)) {
foreach ($user_choice as $item) {
$user_choice_array[] = $item['answer'];
}
}
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$numAnswer = $objAnswerTmp->selectAutoId($answerId);
$comment = $objAnswerTmp->selectComment($answerId);
$attributes = array();
// Unique answer
if ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) {
$input_id = 'choice-' . $questionId . '-' . $answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
} else {
$attributes = array('id' => $input_id);
}
if ($debug_mark_answer) {
if ($answerCorrect) {
$attributes['checked'] = 1;
$attributes['selected'] = 1;
}
}
$answer = Security::remove_XSS($answer, STUDENT);
$s .= Display::input('hidden', 'choice2[' . $questionId . ']', '0');
$answer_input = '<label class="radio">';
$answer_input .= Display::input('radio', 'choice[' . $questionId . ']', $numAnswer, $attributes);
$answer_input .= $answer;
$answer_input .= '</label>';
if ($show_comment) {
$s .= '<tr><td>';
$s .= $answer_input;
$s .= '</td>';
$s .= '<td>';
$s .= $comment;
$s .= '</td>';
$s .= '</tr>';
} else {
$s .= $answer_input;
}
示例6: showQuestion
//.........这里部分代码省略.........
$lines_count = 1;
// a counter for matching-type answers
if ($answerType == MULTIPLE_ANSWER_TRUE_FALSE || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
$header = Display::tag('th', get_lang('Options'));
foreach ($objQuestionTmp->options as $item) {
$header .= Display::tag('th', $item);
}
if ($show_comment) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="data_table">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
if ($show_comment) {
if (in_array($answerType, array(MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, GLOBAL_MULTIPLE_ANSWER))) {
$header = Display::tag('th', get_lang('Options'));
if ($exercise_feedback == EXERCISE_FEEDBACK_TYPE_END) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="data_table">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
}
$matching_correct_answer = 0;
$user_choice_array = array();
if (!empty($user_choice)) {
foreach ($user_choice as $item) {
$user_choice_array[] = $item['answer'];
}
}
foreach ($objAnswerTmp->answer as $answerId => $answer_item) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$comment = $objAnswerTmp->selectComment($answerId);
//$numAnswer = $objAnswerTmp->selectAutoId($answerId);
$numAnswer = $answerId;
$attributes = array();
// Unique answer
if (in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION))) {
$input_id = 'choice-' . $questionId . '-' . $answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
} else {
$attributes = array('id' => $input_id);
}
if ($debug_mark_answer) {
if ($answerCorrect) {
$attributes['checked'] = 1;
$attributes['selected'] = 1;
}
}
$answer = Security::remove_XSS($answer);
$s .= Display::input('hidden', 'choice2[' . $questionId . ']', '0');
$answer_input = null;
if ($answerType == UNIQUE_ANSWER_IMAGE) {
$attributes['style'] = 'display:none';
$answer_input .= '<div id="answer' . $questionId . $numAnswer . '" style="float:left" class="highlight_image_default highlight_image">';
}
$answer_input .= '<label class="radio">';
$answer_input .= Display::input('radio', 'choice[' . $questionId . ']', $numAnswer, $attributes);
$answer_input .= $answer;
$answer_input .= '</label>';
if ($answerType == UNIQUE_ANSWER_IMAGE) {
$answer_input .= "</div>";
}
if ($show_comment) {
示例7: array
$choice = $exerciseResult[$questionid];
$destination = array();
$comment = '';
$next = 1;
$_SESSION['hotspot_coord'] = array();
$_SESSION['hotspot_dest'] = array();
$overlap_color = $missing_color = $excess_color = false;
$organs_at_risk_hit = 0;
$wrong_results = false;
$hot_spot_load = false;
$questionScore = 0;
$totalScore = 0;
if (!empty($choice_value)) {
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerComment = $objAnswerTmp->selectComment($answerId);
$answerDestination = $objAnswerTmp->selectDestination($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$answerWeighting = $objAnswerTmp->selectWeighting($answerId);
$numAnswer = $objAnswerTmp->selectAutoId($answerId);
//delineation
$delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1);
$answer_delineation_destination = $objAnswerTmp->selectDestination(1);
if ($dbg_local > 0) {
error_log(__LINE__ . ' answerId: ' . $answerId . '(' . $answerType . ') - user delineation_cord: ' . $delineation_cord . ' - $answer_delineation_destination: ' . $answer_delineation_destination, 0);
}
switch ($answerType) {
// for unique answer
case UNIQUE_ANSWER:
$studentChoice = $choice_value == $numAnswer ? 1 : 0;
if ($studentChoice) {