function qformat_gift::answerweightparser in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/question/format/gift/format.php \qformat_gift::answerweightparser()
1 call to qformat_gift::answerweightparser()
- qformat_gift::readquestion in includes/
moodle/ question/ format/ gift/ format.php - Given the data known to define a question in this format, this function converts it into a question object suitable for processing and insertion into Moodle.
File
- includes/
moodle/ question/ format/ gift/ format.php, line 48
Class
- qformat_gift
- @package questionbank @subpackage importexport
Code
function answerweightparser(&$answer) {
$answer = substr($answer, 1);
// removes initial %
$end_position = strpos($answer, "%");
$answer_weight = substr($answer, 0, $end_position);
// gets weight as integer
$answer_weight = $answer_weight / 100;
// converts to percent
$answer = substr($answer, $end_position + 1);
// removes comment from answer
return $answer_weight;
}