4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
33 parent::__construct();
34 include_once
"./Modules/TestQuestionPool/classes/class.assOrderingHorizontal.php";
39 $this->
object->loadFromDb($id);
57 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
78 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
80 $form->setFormAction($this->ctrl->getFormAction($this));
82 $form->setMultipart(FALSE);
83 $form->setTableWidth(
"100%");
84 $form->setId(
"orderinghorizontal");
98 $form->setValuesByPost();
100 $form->setValuesByPost();
101 if (
$errors) $checkonly =
false;
104 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
108 function outQuestionForTest($formaction, $active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
110 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $use_post_solutions, $show_feedback);
111 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
112 $this->tpl->setVariable(
"FORMACTION", $formaction);
131 $graphicalOutput = FALSE,
132 $result_output = FALSE,
133 $show_question_only = TRUE,
134 $show_feedback = FALSE,
135 $show_correct_solution = FALSE,
136 $show_manual_scoring = FALSE,
137 $show_question_text = TRUE
141 $template =
new ilTemplate(
"tpl.il_as_qpl_orderinghorizontal_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
144 if (($active_id > 0) && (!$show_correct_solution))
146 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
147 if (strlen($solutions[0][
"value1"]))
149 $elements = split(
"{::}", $solutions[0][
"value1"]);
150 foreach ($elements as $id => $element)
152 $template->setCurrentBlock(
"element");
153 $template->setVariable(
"ELEMENT_ID",
"e$id");
155 $template->parseCurrentBlock();
158 $solutionvalue = str_replace(
"{::}",
" ", $solutions[0][
"value1"]);
162 $elements = $this->
object->getOrderingElements();
163 foreach ($elements as $id => $element)
165 $template->setCurrentBlock(
"element");
166 $template->setVariable(
"ELEMENT_ID",
"e$id");
168 $template->parseCurrentBlock();
170 $solutionvalue = join($this->object->getOrderingElements(),
" ");
173 if (($active_id > 0) && (!$show_correct_solution))
175 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
176 if ($graphicalOutput)
179 if ($reached_points == $this->object->getMaximumPoints())
181 $template->setCurrentBlock(
"icon_ok");
183 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
184 $template->parseCurrentBlock();
188 $template->setCurrentBlock(
"icon_ok");
189 if ($reached_points > 0)
192 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
197 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
199 $template->parseCurrentBlock();
205 $reached_points = $this->
object->getPoints();
210 $resulttext = ($reached_points == 1) ?
"(%s " . $this->lng->txt(
"point") .
")" :
"(%s " . $this->lng->txt(
"points") .
")";
211 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $reached_points));
213 if($show_question_text==
true)
215 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
218 if ($this->object->textsize >= 10) echo $template->setVariable(
"STYLE",
" style=\"font-size: " . $this->object->textsize .
"%;\"");
220 $questionoutput = $template->get();
221 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
222 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
229 $feedback .= strlen($fb) ? $fb :
'';
232 $feedback .= strlen($fb) ? $fb :
'';
234 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $feedback,
true ));
235 $solutionoutput = $solutiontemplate->get();
236 if (!$show_question_only)
239 $solutionoutput =
'<div class="ilc_question_Standard">'.$solutionoutput. $feedback.
"</div>" ;
241 return $solutionoutput;
246 $template =
new ilTemplate(
"tpl.il_as_qpl_orderinghorizontal_preview.html",TRUE, TRUE,
"Modules/TestQuestionPool");
247 $elements = $this->
object->getRandomOrderingElements();
248 foreach ($elements as $id => $element)
250 $template->setCurrentBlock(
"element");
251 $template->setVariable(
"ELEMENT_ID",
"e$id");
254 $template->parseCurrentBlock();
256 if ($this->object->textsize >= 10) echo $template->setVariable(
"STYLE",
" style=\"font-size: " . $this->object->textsize .
"%;\"");
257 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
258 $questionoutput = $template->get();
259 if (!$show_question_only)
264 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
266 $this->tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
267 return $questionoutput;
270 function getTestOutput($active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
273 $template =
new ilTemplate(
"tpl.il_as_qpl_orderinghorizontal_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
274 $elements = $this->
object->getRandomOrderingElements();
279 include_once
"./Modules/Test/classes/class.ilObjTest.php";
284 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
285 if (count($solutions) == 1)
287 $elements = split(
"{::}", $solutions[0][
"value1"]);
292 $this->
object->moveRight(
$_SESSION[
'qst_selection'], $active_id,
$pass);
294 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
295 if (count($solutions) == 1)
297 $elements = split(
"{::}", $solutions[0][
"value1"]);
300 if (count($solutions) == 0)
302 $_SESSION[
'qst_ordering_horizontal_elements'] = $elements;
306 unset(
$_SESSION[
'qst_ordering_horizontal_elements']);
309 foreach ($elements as $id => $element)
311 $template->setCurrentBlock(
"element");
312 $template->setVariable(
"ELEMENT_ID",
"e_" . $this->object->getId() .
"_$id");
315 $this->ctrl->setParameterByClass(
'iltestoutputgui',
'qst_selection', $idx);
317 $url = $this->ctrl->getLinkTargetByClass(
'iltestoutputgui',
'gotoQuestion');
318 $template->setVariable(
"MOVE_RIGHT", $url);
319 $template->setVariable(
"TEXT_MOVE_RIGHT", $this->lng->txt(
'move_right'));
321 $template->parseCurrentBlock();
323 if ($this->object->textsize >= 10) echo $template->setVariable(
"STYLE",
" style=\"font-size: " . $this->object->textsize .
"%;\"");
324 $template->setVariable(
"VALUE_ORDERRESULT",
' value="' . join($elements,
'{::}') .
'"');
325 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
326 $questionoutput = $template->get();
327 if (!$show_question_only)
332 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
334 $this->tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
335 $questionoutput = $template->get();
336 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
347 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
348 $errors = $this->feedback(
true);
349 $this->
object->saveFeedbackGeneric(0,
$_POST[
"feedback_incomplete"]);
350 $this->
object->saveFeedbackGeneric(1,
$_POST[
"feedback_complete"]);
351 $this->
object->cleanupMediaObjectUsage();
352 parent::saveFeedback();
364 global $rbacsystem, $ilTabs;
366 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
367 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
368 $q_type = $this->
object->getQuestionType();
372 $classname = $q_type .
"GUI";
373 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
374 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
379 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
382 $ilTabs->addTarget(
"edit_page",
383 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
384 array(
"edit",
"insert",
"exec_pg"),
385 "",
"", $force_active);
389 $ilTabs->addTarget(
"preview",
390 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"preview"),
392 "ilAssQuestionPageGUI",
"", $force_active);
395 $force_active =
false;
396 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
399 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
400 $commands =
$_POST[
"cmd"];
401 if (is_array($commands))
403 foreach ($commands as $key => $value)
405 if (preg_match(
"/^suggestrange_.*/", $key, $matches))
407 $force_active =
true;
412 $ilTabs->addTarget(
"edit_question",
414 array(
"editQuestion",
"save",
"saveEdit",
"originalSyncForm"),
415 $classname,
"", $force_active);
426 $ilTabs->addTarget(
"solution_hint",
427 $this->ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
428 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
429 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution" 439 $ilTabs->addTarget(
"statistics",
440 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
445 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
450 global $___test_express_mode;
452 if (!
$_GET[
'test_express_mode'] && !$___test_express_mode) {
453 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
457 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
462 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));
468 $output =
'<table class="ilTstSpecificFeedbackTable"><tbody>';
470 if(strpos($this->object->getOrderText(),
'::'))
472 $answers = explode(
'::', $this->object->getOrderText());
474 $answers = explode(
' ', $this->object->getOrderText());
477 foreach($answers as $idx => $answer)
479 $feedback = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
480 $this->object->getId(), $idx
483 $output .=
"<tr><td><b><i>{$answer}</i></b></td><td>{$feedback}</td></tr>";
486 $output .=
'</tbody></table>';
488 return $this->
object->prepareTextareaOutput($output, TRUE);
493 $this->
object->setTextSize(
$_POST[
"textsize"] );
494 $this->
object->setOrderText(
$_POST[
"ordertext"] );
495 $this->
object->setPoints(
$_POST[
"points"] );
509 return array(
'ordertext',
'textsize');
516 $ordertext->
setValue( $this->object->prepareTextareaOutput( $this->object->getOrderText() ) );
517 $ordertext->setRequired( TRUE );
518 $ordertext->setInfo( sprintf( $this->lng->txt(
"ordertext_info" ), $this->
object->separator ) );
519 $ordertext->setRows( 10 );
520 $ordertext->setCols( 80 );
523 $textsize =
new ilNumberInputGUI($this->lng->txt(
"textsize" ),
"textsize");
524 $textsize->
setValue( $this->object->getTextSize() );
525 $textsize->setInfo( $this->lng->txt(
"textsize_info" ) );
526 $textsize->setSize( 6 );
527 $textsize->setMinValue( 10 );
528 $textsize->setRequired( FALSE );
536 if ($this->object->getPoints() == null)
538 $points->setValue(
"1" );
542 $points->setValue( $this->object->getPoints() );
544 $points->setRequired( TRUE );
545 $points->setSize( 3 );
546 $points->setMinValue( 0.0 );
547 $points->setMinvalueShouldBeGreater(
true );
562 foreach($relevant_answers as
$pass)
564 $passes[$pass[
'active_fi'].
'-'.$pass[
'pass']] =
'-';
566 $passcount = count($passes);
568 foreach($relevant_answers as $pass)
570 $actives[$pass[
'active_fi']] = $pass[
'active_fi'];
572 $usercount = count($actives);
573 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_header.html',
true,
true,
"Modules/TestQuestionPool");
574 $tpl->setVariable(
'HEADERTEXT', $this->lng->txt(
'overview'));
575 $tpl->setVariable(
'NUMBER_OF_USERS_INFO', $this->lng->txt(
'number_of_users'));
576 $tpl->setVariable(
'NUMBER_OF_USERS', $usercount);
577 $tpl->setVariable(
'NUMBER_OF_PASSES_INFO', $this->lng->txt(
'number_of_passes'));
578 $tpl->setVariable(
'NUMBER_OF_PASSES', $passcount);
580 $header =
$tpl->get();
586 return $header . $variants ;
591 $aggregate = array();
592 foreach($relevant_answers_chosen as $answer)
594 $answer = str_replace($this->object->getAnswerSeparator(),
' - ', $answer);
595 if (in_array($answer[
'value1'], $aggregate))
597 $aggregate[$answer[
'value1']] = $aggregate[$answer[
'value1']]+1;
601 $aggregate[$answer[
'value1']] = 1;
615 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html',
true,
true,
"Modules/TestQuestionPool");
616 $tpl->setVariable(
'OPTION_HEADER', $this->lng->txt(
'answer_variant' ) );
617 $tpl->setVariable(
'COUNT_HEADER', $this->lng->txt(
'count' ) );
618 $tpl->setVariable(
'AGGREGATION_HEADER', $this->lng->txt(
'aggregated_answers_variants' ) );
619 foreach ($aggregate as $key => $line_data)
621 $tpl->setCurrentBlock(
'aggregaterow' );
622 $tpl->setVariable(
'COUNT', $line_data );
623 $tpl->setVariable(
'OPTION', $key );
624 $tpl->parseCurrentBlock();
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
Class for horizontal ordering questions.
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
getPreview($show_question_only=FALSE)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
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.
saveFeedback()
Saves the feedback for a single choice question.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
outQuestionForTest($formaction, $active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
setValue($a_value)
Set Value.
The assOrderingHorizontalGUI class encapsulates the GUI representation for horizontal ordering questi...
getQuestionTemplate()
get question template
renderAggregateView($aggregate)
getTestOutput($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
writeQuestionGenericPostData()
static getReturnToPageLink($q_id=null)
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)
special template class to simplify handling of ITX/PEAR
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
aggregateAnswers($relevant_answers_chosen, $answer_defined_on_question)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
writeQuestionSpecificPostData($always=true)
Extracts the question specific values from $_POST and applies them to the data object.
getSpecificFeedbackOutput($active_id, $pass)
Basic GUI class for assessment questions.
setErrorMessage($errormessage)
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
static initDragDropAnimation()
init drag & drop and animation
saveTaxonomyAssignments()
__construct($id=-1)
assOrderingHorizontalGUI constructor
setQuestionTabs()
Sets the ILIAS tabs for this question type.
This class represents a text area property in a property form.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
Interface ilGuiQuestionScoringAdjustable.
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
writePostData($always=false)
Evaluates a posted edit form and writes the form data in the question object.