4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiAnswerScoringAdjustable.php';
7 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
33 parent::__construct();
34 include_once
"./Modules/TestQuestionPool/classes/class.assSingleChoice.php";
38 $this->
object->loadFromDb($id);
51 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
54 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
76 return (
$_POST[
'types'] == 0) ? true :
false;
79 $lastChange = $this->
object->getLastChange();
80 if (empty($lastChange) && !isset(
$_POST[
'types']))
83 return $this->
object->getMultilineAnswerSetting() ? false :
true;
88 return $this->
object->isSingleline;
101 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
103 $form->setFormAction($this->ctrl->getFormAction($this));
108 $form->setMultipart(TRUE);
112 $form->setMultipart(FALSE);
114 $form->setTableWidth(
"100%");
115 $form->setId(
"asssinglechoice");
130 $form->setValuesByPost();
131 $errors = !$form->checkInput();
132 $form->setValuesByPost();
133 if (
$errors) $checkonly =
false;
136 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
146 $position = key(
$_POST[
'cmd'][
'uploadchoice']);
156 $position = key(
$_POST[
'cmd'][
'removeimagechoice']);
158 $this->
object->removeAnswerImage($position);
168 $position = key(
$_POST[
'cmd'][
'addchoice']);
169 $this->
object->addAnswer(
"", 0, $position+1);
179 $position = key(
$_POST[
'cmd'][
'removechoice']);
180 $this->
object->deleteAnswer($position);
200 $graphicalOutput = FALSE,
201 $result_output = FALSE,
202 $show_question_only = TRUE,
203 $show_feedback = FALSE,
204 $show_correct_solution = FALSE,
205 $show_manual_scoring = FALSE,
206 $show_question_text = TRUE
214 if (($active_id > 0) && (!$show_correct_solution))
216 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
217 foreach ($solutions as $idx => $solution_value)
219 $user_solution = $solution_value[
"value1"];
226 foreach ($this->object->answers as $index => $answer)
228 if ($answer->getPoints() > $max_points)
230 $max_points = $answer->getPoints();
231 $found_index = $index;
234 $user_solution = $found_index;
237 include_once
"./Services/UICore/classes/class.ilTemplate.php";
238 $template =
new ilTemplate(
"tpl.il_as_qpl_mc_sr_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
239 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
240 foreach ($keys as $answer_id)
242 $answer = $this->
object->answers[$answer_id];
243 if (($active_id > 0) && (!$show_correct_solution))
245 if ($graphicalOutput)
249 if (strcmp($user_solution, $answer_id) == 0)
251 if ($answer->getPoints() == $this->
object->getMaximumPoints())
261 $template->setCurrentBlock(
"icon_ok");
263 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
264 $template->parseCurrentBlock();
268 $template->setCurrentBlock(
"icon_not_ok");
269 if ($answer->getPoints() > 0)
272 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
277 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
279 $template->parseCurrentBlock();
282 if (strlen($user_solution) == 0)
284 $template->setCurrentBlock(
"icon_not_ok");
286 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
287 $template->parseCurrentBlock();
291 if (strlen($answer->getImage()))
293 $template->setCurrentBlock(
"answer_image");
294 if ($this->object->getThumbSize())
296 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getImage());
300 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
302 $alt = $answer->getImage();
303 if (strlen($answer->getAnswertext()))
305 $alt = $answer->getAnswertext();
307 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
310 $template->parseCurrentBlock();
316 $template->setCurrentBlock(
"answer_row");
317 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
321 if (strcmp($user_solution, $answer_id) == 0)
324 $template->setVariable(
"SOLUTION_ALT", $this->lng->txt(
"checked"));
329 $template->setVariable(
"SOLUTION_ALT", $this->lng->txt(
"unchecked"));
334 $template->setVariable(
'QID', $this->object->getId());
335 $template->setVariable(
'SUFFIX', $show_correct_solution ?
'bestsolution' :
'usersolution');
336 $template->setVariable(
'SOLUTION_VALUE', $answer_id);
337 if (strcmp($user_solution, $answer_id) == 0)
339 $template->setVariable(
'SOLUTION_CHECKED',
'checked');
345 $points = $this->
object->answers[$answer_id]->getPoints();
346 $resulttext = ($points == 1) ?
"(%s " . $this->lng->txt(
"point") .
")" :
"(%s " . $this->lng->txt(
"points") .
")";
347 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $points));
349 $template->parseCurrentBlock();
351 $questiontext = $this->
object->getQuestion();
352 if ($show_question_text==
true)
354 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
356 $questionoutput = $template->get();
358 if (strlen($feedback))
364 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
365 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $feedback,
true ));
367 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
369 $solutionoutput = $solutiontemplate->get();
370 if (!$show_question_only)
375 return $solutionoutput;
378 public function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
383 include_once
"./Services/UICore/classes/class.ilTemplate.php";
384 $template =
new ilTemplate(
"tpl.il_as_qpl_mc_sr_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
385 foreach ($keys as $answer_id)
387 $answer = $this->
object->answers[$answer_id];
388 if (strlen($answer->getImage()))
390 if ($this->object->getThumbSize())
392 $template->setCurrentBlock(
"preview");
393 $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
394 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
396 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getImage());
397 list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
398 $alt = $answer->getImage();
399 if (strlen($answer->getAnswertext()))
401 $alt = $answer->getAnswertext();
403 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
406 $template->parseCurrentBlock();
410 $template->setCurrentBlock(
"answer_image");
411 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
412 list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
413 $alt = $answer->getImage();
414 if (strlen($answer->getAnswertext()))
416 $alt = $answer->getAnswertext();
418 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
419 $template->setVariable(
"ATTR", $attr);
422 $template->parseCurrentBlock();
429 $template->setCurrentBlock(
"answer_row");
430 $template->setVariable(
"QID", $this->object->getId().
'ID');
431 $template->setVariable(
"ANSWER_ID", $answer_id);
432 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
437 if (strcmp($user_solution, $answer_id) == 0)
439 $template->setVariable(
"CHECKED_ANSWER",
" checked=\"checked\"");
443 $template->parseCurrentBlock();
445 $questiontext = $this->
object->getQuestion();
446 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
447 $questionoutput = $template->get();
448 if (!$show_question_only)
453 return $questionoutput;
457 function getTestOutput($active_id,
$pass, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
468 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 469 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 471 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 475 foreach ($solutions as $idx => $solution_value)
477 $user_solution = $solution_value[
"value1"];
482 include_once
"./Services/UICore/classes/class.ilTemplate.php";
483 $template =
new ilTemplate(
"tpl.il_as_qpl_mc_sr_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
484 foreach ($keys as $answer_id)
486 $answer = $this->
object->answers[$answer_id];
487 if (strlen($answer->getImage()))
489 if ($this->object->getThumbSize())
491 $template->setCurrentBlock(
"preview");
492 $template->setVariable(
"URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
493 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
495 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->
object->getThumbPrefix() . $answer->getImage());
496 list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
497 $alt = $answer->getImage();
498 if (strlen($answer->getAnswertext()))
500 $alt = $answer->getAnswertext();
502 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
505 $template->parseCurrentBlock();
509 $template->setCurrentBlock(
"answer_image");
510 $template->setVariable(
"ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
511 list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
512 $alt = $answer->getImage();
513 if (strlen($answer->getAnswertext()))
515 $alt = $answer->getAnswertext();
517 $alt = preg_replace(
"/<[^>]*?>/",
"", $alt);
518 $template->setVariable(
"ATTR", $attr);
521 $template->parseCurrentBlock();
526 $feedbackOutputRequired =
false;
528 switch( $this->object->getSpecificFeedbackSetting() )
531 $feedbackOutputRequired =
true;
535 if (strcmp($user_solution, $answer_id) == 0)
537 $feedbackOutputRequired =
true;
542 if ($this->object->getAnswer($answer_id)->getPoints() > 0)
544 $feedbackOutputRequired =
true;
549 if($feedbackOutputRequired)
551 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
552 $this->object->getId(), $answer_id
556 $template->setCurrentBlock(
"feedback");
557 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $fb,
true ));
558 $template->parseCurrentBlock();
562 $template->setCurrentBlock(
"answer_row");
563 $template->setVariable(
"ANSWER_ID", $answer_id);
564 $template->setVariable(
"ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
565 if (strcmp($user_solution, $answer_id) == 0)
567 $template->setVariable(
"CHECKED_ANSWER",
" checked=\"checked\"");
569 $template->parseCurrentBlock();
571 $questiontext = $this->
object->getQuestion();
572 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
573 $questionoutput = $template->get();
574 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
587 global $rbacsystem, $ilTabs;
589 $ilTabs->clearTargets();
591 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
592 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
593 $q_type = $this->
object->getQuestionType();
597 $classname = $q_type .
"GUI";
598 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
599 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
604 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
607 $ilTabs->addTarget(
"edit_page",
608 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
609 array(
"edit",
"insert",
"exec_pg"),
610 "",
"", $force_active);
616 $force_active =
false;
617 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
620 if ($classname)
$url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
622 $ilTabs->addTarget(
"edit_question",
624 array(
"editQuestion",
"save",
"saveEdit",
"addchoice",
"removechoice",
"removeimagechoice",
"uploadchoice",
"originalSyncForm"),
625 $classname,
"", $force_active);
640 $ilTabs->addTarget(
"statistics",
641 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
656 $choiceKeys = array_keys($this->object->answers);
658 if( $this->object->getShuffle() )
660 $choiceKeys = $this->
object->getShuffler()->shuffle($choiceKeys);
670 return $this->
object->prepareTextareaOutput($output, TRUE);
675 $this->
object->setShuffle(
$_POST[
"shuffle"] );
676 $this->
object->setMultilineAnswerSetting(
$_POST[
"types"] );
677 if (is_array(
$_POST[
'choice'][
'imagename'] ) &&
$_POST[
"types"] == 1)
679 $this->
object->isSingleline =
true;
684 $this->
object->isSingleline = (
$_POST[
"types"] == 0) ?
true :
false;
686 $this->
object->setThumbSize( (strlen(
$_POST[
"thumb_size"] )) ?
$_POST[
"thumb_size"] :
"" );
695 $shuffle->setChecked( $this->object->getShuffle() );
696 $shuffle->setRequired( FALSE );
699 if ($this->object->getId())
702 $hidden->setValue( $this->object->getId() );
706 if (!$this->object->getSelfAssessmentEditingMode())
711 $types->setValue( ($isSingleline) ? 0 : 1 );
712 $types->setOptions( array(
713 0 => $this->lng->txt(
'answers_singleline' ),
714 1 => $this->lng->txt(
'answers_multiline' ),
723 $thumb_size =
new ilNumberInputGUI($this->lng->txt(
"thumb_size" ),
"thumb_size");
724 $thumb_size->
setSuffix($this->lng->txt(
"thumb_size_unit_pixel"));
725 $thumb_size->setMinValue( 20 );
726 $thumb_size->setDecimals( 0 );
727 $thumb_size->setSize( 6 );
728 $thumb_size->setInfo( $this->lng->txt(
'thumb_size_info' ) );
729 $thumb_size->setValue( $this->object->getThumbSize() );
730 $thumb_size->setRequired(
false );
753 $this->
object->flushAnswers();
754 if ($this->object->isSingleline)
756 foreach (
$_POST[
'choice'][
'answer'] as $index => $answertext)
760 $picturefile =
$_POST[
'choice'][
'imagename'][$index];
761 $file_org_name = $_FILES[
'choice'][
'name'][
'image'][$index];
762 $file_temp_name = $_FILES[
'choice'][
'tmp_name'][
'image'][$index];
764 if (strlen( $file_temp_name ))
767 $suffix = strtolower( array_pop( explode(
".", $file_org_name ) ) );
768 if (in_array( $suffix, array(
"jpg",
"jpeg",
"png",
"gif" ) ))
771 $filename = $this->
object->createNewImageFileName( $file_org_name );
772 if ($this->object->setImageFile(
$filename, $file_temp_name ) == 0)
779 $this->
object->addAnswer( $answertext,
$_POST[
'choice'][
'points'][$index], $index, $picturefile );
784 foreach (
$_POST[
'choice'][
'answer'] as $index => $answer)
786 $answertext = $answer;
787 $this->
object->addAnswer( $answertext,
$_POST[
'choice'][
'points'][$index], $index );
797 include_once
"./Modules/TestQuestionPool/classes/class.ilSingleChoiceWizardInputGUI.php";
800 $choices->setQuestionObject( $this->
object );
801 $choices->setSingleline( $isSingleline );
802 $choices->setAllowMove(
false );
803 if ($this->object->getSelfAssessmentEditingMode())
805 $choices->setSize( 40 );
806 $choices->setMaxLength( 800 );
808 if ($this->object->getAnswerCount() == 0)
809 $this->object->addAnswer(
"", 0, 0 );
810 $choices->setValues( $this->object->getAnswers() );
839 $this->
aggregateAnswers( $relevant_answers, $this->object->getAnswers() ) )->get();
844 $aggregate = array();
845 foreach ($answers_defined_on_question as $answer)
847 $aggregated_info_for_answer = array();
848 $aggregated_info_for_answer[
'answertext'] = $answer->getAnswerText();
849 $aggregated_info_for_answer[
'count_checked'] = 0;
851 foreach ($relevant_answers_chosen as $relevant_answer)
853 if ($relevant_answer[
'value1'] == $answer->getOrder())
855 $aggregated_info_for_answer[
'count_checked']++;
858 $aggregated_info_for_answer[
'count_unchecked'] =
859 ceil(count($relevant_answers_chosen) / count($answers_defined_on_question))
860 - $aggregated_info_for_answer[
'count_checked'];
862 $aggregate[] = $aggregated_info_for_answer;
874 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html',
true,
true,
"Modules/TestQuestionPool");
876 $tpl->setCurrentBlock(
'headercell');
877 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_answer_header'));
878 $tpl->parseCurrentBlock();
880 $tpl->setCurrentBlock(
'headercell');
881 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_frequency_header'));
882 $tpl->parseCurrentBlock();
884 foreach ($aggregate as $line_data)
886 $tpl->setCurrentBlock(
'aggregaterow' );
887 $tpl->setVariable(
'OPTION', $line_data[
'answertext'] );
888 $tpl->setVariable(
'COUNT', $line_data[
'count_checked'] );
889 $tpl->parseCurrentBlock();
896 $feedbackOutputRequired =
false;
898 switch($this->object->getSpecificFeedbackSetting())
901 $feedbackOutputRequired =
true;
905 if(strcmp($user_solution, $answer_id) == 0)
907 $feedbackOutputRequired =
true;
912 if($this->object->getAnswer($answer_id)->getPoints() > 0)
914 $feedbackOutputRequired =
true;
919 if($feedbackOutputRequired)
921 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
924 $template->setCurrentBlock(
"feedback");
925 $template->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($fb,
true));
926 $template->parseCurrentBlock();
isTestPresentationContext()
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
aggregateAnswers($relevant_answers_chosen, $answers_defined_on_question)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
writePostData($always=false)
Evaluates a posted edit form and writes the form data in the question object.
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
setQuestionTabs()
Sets the ILIAS tabs for this question type.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
populateInlineFeedback($template, $answer_id, $user_solution)
getTestOutputSolutions($activeId, $pass)
renderAggregateView($aggregate)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
getQuestionTemplate()
get question template
const CSS_CLASS_FEEDBACK_CORRECT
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
getSolutionOutput( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
Get the question solution output.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getTestOutput($active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
writeQuestionGenericPostData()
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
getILIASPage($html="")
Returns the ILIAS Page around a question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class for single choice questions.
special template class to simplify handling of ITX/PEAR
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
removechoice()
Remove an answer.
const CSS_CLASS_FEEDBACK_WRONG
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
isContentEditingOutputMode()
Basic GUI class for assessment questions.
static getHtmlPath($relative_path)
get url of path
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
saveTaxonomyAssignments()
addchoice()
Add a new answer.
addBackTab(ilTabsGUI $ilTabs)
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
Interface ilGuiAnswerScoringAdjustable.
Single choice question GUI representation.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
getSpecificFeedbackOutput($active_id, $pass)
__construct($id=-1)
assSingleChoiceGUI constructor
removeimagechoice()
Remove an image.
Interface ilGuiQuestionScoringAdjustable.
getEditAnswersSingleLine($checkonly=false)
Get the single/multiline editing of answers.
uploadchoice()
Upload an image.
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.