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';
49 parent::__construct();
50 include_once
"./Modules/TestQuestionPool/classes/class.assOrderingQuestion.php";
54 $this->
object->loadFromDb($id);
56 $this->clearAnswersOnWritingPostDataEnabled =
false;
83 $form->setValuesByPost();
87 $this->
object->saveToDb();
89 $form->ensureReprintableFormStructure($this->
object);
101 $form->setValuesByPost();
104 $this->
object->setOrderingType(
OQ_TERMS);
105 $this->
object->saveToDb();
107 $form->ensureReprintableFormStructure($this->
object);
115 $this->
object->saveToDb();
124 $this->
object->saveToDb();
131 $orderingInput = $this->
object->buildOrderingImagesInputGui();
132 $this->
object->initOrderingElementAuthoringProperties($orderingInput);
135 $form->replaceFormItemByPostVar($orderingInput);
136 $form->setValuesByPost();
142 $storedElementList = $this->
object->getOrderingElementList();
144 foreach($orderingInput->getElementList($this->object->getId()) as $submittedElement)
146 if( $submittedElement->isImageRemovalRequest() )
148 if( $this->
object->isImageFileStored($submittedElement->getContent()) )
150 $this->
object->dropImageFile($submittedElement->getContent());
153 $submittedElement->setContent(null);
156 if( $storedElementList->elementExistByRandomIdentifier($submittedElement->getRandomIdentifier()) )
158 $storedElement = $storedElementList->getElementByRandomIdentifier(
159 $submittedElement->getRandomIdentifier()
162 $submittedElement->setSolutionIdentifier($storedElement->getSolutionIdentifier());
163 $submittedElement->setIndentation($storedElement->getIndentation());
166 $replacementElemList->addElement($submittedElement);
169 $replacementElemList->saveToDb();
171 $orderingInput->setElementList( $replacementElemList );
177 $orderingInput = $this->
object->buildOrderingImagesInputGui();
178 $this->
object->initOrderingElementAuthoringProperties($orderingInput);
181 $form->replaceFormItemByPostVar($orderingInput);
182 $form->setValuesByPost();
184 if(!$orderingInput->checkInput())
190 $this->
object->getOrderingElementList()->saveToDb();
191 $orderingInput->setElementList($this->
object->getOrderingElementList());
198 $this->
object->setThumbGeometry(
$_POST[
"thumb_geometry"] );
199 $this->
object->setElementHeight(
$_POST[
"element_height"] );
201 $this->
object->setPoints(
$_POST[
"points"]);
211 #$submittedElementList = $this->object->fetchSolutionListFromFormSubmissionData($_POST); 212 $submittedElementList = $this->
object->fetchSolutionListFromSubmittedForm($form);
215 $replacementElementList->setQuestionId($this->
object->getId());
217 $currentElementList = $this->
object->getOrderingElementList();
219 foreach($submittedElementList as $submittedElement)
221 if( $this->
object->hasOrderingTypeUploadSupport() )
223 if( $submittedElement->isImageUploadAvailable() )
225 $suffix = strtolower(array_pop(explode(
".", $submittedElement->getUploadImageName())));
226 if( in_array($suffix,
array(
"jpg",
"jpeg",
"png",
"gif")) )
228 $submittedElement->setUploadImageName( $this->
object->buildHashedImageFilename(
229 $submittedElement->getUploadImageName(), true
232 $wasImageFileStored = $this->
object->storeImageFile(
233 $submittedElement->getUploadImageFile(), $submittedElement->getUploadImageName()
236 if( $wasImageFileStored )
238 if( $this->
object->isImageFileStored( $submittedElement->getContent() ) )
240 $this->
object->dropImageFile( $submittedElement->getContent() );
243 $submittedElement->setContent( $submittedElement->getUploadImageName() );
249 if( $currentElementList->elementExistByRandomIdentifier($submittedElement->getRandomIdentifier()) )
251 $storedElement = $currentElementList->getElementByRandomIdentifier(
252 $submittedElement->getRandomIdentifier()
255 $submittedElement->setSolutionIdentifier($storedElement->getSolutionIdentifier());
259 $submittedElement->setContent($storedElement->getContent());
262 if( !$this->
object->isOrderingTypeNested() )
264 $submittedElement->setIndentation($storedElement->getIndentation());
267 if( $this->
object->isImageReplaced($submittedElement, $storedElement) )
269 $this->
object->dropImageFile($storedElement->getContent());
273 $replacementElementList->addElement($submittedElement);
276 if( $this->
object->isImageOrderingType() )
278 $this->
object->handleThumbnailCreation($replacementElementList);
283 $replacementElementList->clearElementContents();
286 if( $this->
object->hasOrderingTypeUploadSupport() )
288 $obsoleteElementList = $currentElementList->getDifferenceElementList($replacementElementList);
290 foreach($obsoleteElementList as $obsoleteElement)
292 $this->
object->dropImageFile($obsoleteElement->getContent());
296 $this->
object->setOrderingElementList($replacementElementList);
302 $header->setTitle($this->lng->txt(
'oq_header_ordering_elements'));
307 $orderingElementInput = $this->
object->buildNestedOrderingElementInputGui();
311 $orderingElementInput = $this->
object->buildOrderingElementInputGui();
315 $this->
object->initOrderingElementAuthoringProperties($orderingElementInput);
317 $orderingElementInput->setElementList( $this->
object->getOrderingElementList() );
319 $form->
addItem($orderingElementInput);
326 if (!$this->
object->getSelfAssessmentEditingMode())
328 $element_height =
new ilNumberInputGUI($this->lng->txt(
"element_height" ),
"element_height");
330 $element_height->setRequired(
false );
331 $element_height->setMaxLength( 6 );
332 $element_height->setMinValue( 20 );
333 $element_height->setSize( 6 );
334 $element_height->setInfo( $this->lng->txt(
"element_height_info" ) );
335 $form->
addItem( $element_height );
338 if( $this->
object->isImageOrderingType() )
340 $geometry =
new ilNumberInputGUI($this->lng->txt(
"thumb_geometry" ),
"thumb_geometry");
342 $geometry->setRequired(
true );
343 $geometry->setMaxLength( 6 );
344 $geometry->setMinValue( 20 );
345 $geometry->setSize( 6 );
346 $geometry->setInfo( $this->lng->txt(
"thumb_geometry_info" ) );
353 $points->setValue( $this->
object->getPoints() );
354 $points->setRequired( TRUE );
355 $points->setSize( 3 );
356 $points->setMinValue( 0 );
357 $points->setMinvalueShouldBeGreater(
true );
368 $savingAllowed =
true;
377 $form->setValuesByPost();
379 if( !$form->checkInput() )
381 $form->prepareValuesReprintable($this->
object);
385 $savingAllowed =
false;
394 $form->setValuesByPost();
421 require_once
'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingQuestionAuthoringFormGUI.php';
423 $this->editForm = $form;
425 $form->setFormAction($this->ctrl->getFormAction($this));
427 $form->setMultipart(( $this->
object->getOrderingType() ==
OQ_PICTURES ) ? TRUE : FALSE);
428 $form->setTableWidth(
"100%");
429 $form->setId(
"ordering");
437 $form->addSpecificOrderingQuestionCommandButtons($this->
object);
438 $form->addGenericAssessmentQuestionCommandButtons($this->
object);
461 $graphicalOutput = FALSE,
462 $result_output = FALSE,
463 $show_question_only = TRUE,
464 $show_feedback = FALSE,
465 $forceCorrectSolution = FALSE,
466 $show_manual_scoring = FALSE,
467 $show_question_text = TRUE
470 $solutionOrderingList = $this->
object->getOrderingElementListForSolutionOutput(
471 $forceCorrectSolution, $active_id,
$pass 474 $answers_gui = $this->
object->buildNestedOrderingElementInputGui();
476 if( $forceCorrectSolution )
485 $answers_gui->setInteractionEnabled(
false);
487 $answers_gui->setElementList( $solutionOrderingList );
489 $answers_gui->setCorrectnessTrueElementList(
490 $solutionOrderingList->getParityTrueElementList($this->object->getOrderingElementList())
493 $solution_html = $answers_gui->getHTML();
495 $template =
new ilTemplate(
"tpl.il_as_qpl_nested_ordering_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
496 $template->setVariable(
'SOLUTION_OUTPUT', $solution_html);
497 if ($show_question_text==
true)
499 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
501 $questionoutput = $template->get();
503 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
504 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
513 $feedback .= strlen($fb) ? $fb :
'';
517 $feedback .= strlen($fb) ? $fb :
'';
519 if (strlen($feedback))
525 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
526 $solutiontemplate->setVariable(
"FEEDBACK", $this->
object->prepareTextareaOutput( $feedback,
true ));
530 if( $show_question_only )
532 return $solutiontemplate->get();
541 function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
545 $solutionOrderingElementList = unserialize(
551 $solutionOrderingElementList = $this->
object->getShuffledOrderingElementList();
554 $answers = $this->
object->buildNestedOrderingElementInputGui();
555 $answers->setNestingEnabled($this->
object->isOrderingTypeNested());
558 $answers->setElementList($solutionOrderingElementList);
560 $template =
new ilTemplate(
"tpl.il_as_qpl_ordering_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
562 $template->setCurrentBlock(
'nested_ordering_output');
563 $template->setVariable(
'NESTED_ORDERING', $answers->getHTML());
564 $template->parseCurrentBlock();
566 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(),
true));
568 if( $show_question_only )
570 return $template->get();
579 public function getTestOutput($activeId,
$pass, $isPostponed = FALSE, $userSolutionPost = FALSE, $inlineFeedback =
false)
582 $userSolutionPost = is_array($userSolutionPost) ? $userSolutionPost :
array();
584 $orderingGUI = $this->
object->buildNestedOrderingElementInputGui();
585 $orderingGUI->setNestingEnabled($this->
object->isOrderingTypeNested());
587 $solutionOrderingElementList = $this->
object->getSolutionOrderingElementListForTestOutput(
588 $orderingGUI, $userSolutionPost, $activeId,
$pass 591 $template =
new ilTemplate(
'tpl.il_as_qpl_ordering_output.html', TRUE, TRUE,
'Modules/TestQuestionPool');
594 $orderingGUI->setElementList( $solutionOrderingElementList );
596 $template->setCurrentBlock(
'nested_ordering_output');
597 $template->setVariable(
'NESTED_ORDERING',$orderingGUI->getHTML());
598 $template->parseCurrentBlock();
600 $template->setVariable(
'QUESTIONTEXT', $this->
object->prepareTextareaOutput($this->object->getQuestion(),
true));
602 $pageoutput = $this->
outQuestionPage(
'', $isPostponed, $activeId, $template->get());
631 global $rbacsystem, $ilTabs;
633 $ilTabs->clearTargets();
635 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
636 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
637 $q_type = $this->
object->getQuestionType();
641 $classname = $q_type .
"GUI";
642 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
643 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
648 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
651 $ilTabs->addTarget(
"edit_page",
652 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
653 array(
"edit",
"insert",
"exec_pg"),
660 $force_active =
false;
661 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
664 if ($classname)
$url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
665 $commands =
$_POST[
"cmd"];
666 if (is_array($commands))
668 foreach ($commands as $key => $value)
670 if (preg_match(
"/^delete_.*/", $key, $matches))
672 $force_active =
true;
677 $ilTabs->addTarget(
"edit_question",
679 array(
"orderNestedTerms",
"orderNestedPictures",
"editQuestion",
"save",
"saveEdit",
"addanswers",
"removeanswers",
"changeToPictures",
"uploadElementImage",
"changeToText",
"upanswers",
"downanswers",
"originalSyncForm"),
680 $classname,
"", $force_active);
695 $ilTabs->addTarget(
"statistics",
696 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
706 if( !$this->
object->feedbackOBJ->specificAnswerFeedbackExists($this->object->getOrderingElementList()) )
711 $tpl =
new ilTemplate(
'tpl.il_as_qpl_ordering_elem_fb.html',
true,
true,
'Modules/TestQuestionPool');
713 foreach( $this->
object->getOrderingElementList() as $element)
715 $feedback = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
716 $this->
object->getId(), $element->getPosition()
719 if( $this->
object->isImageOrderingType() )
721 $imgSrc = $this->
object->getImagePathWeb().$element->getContent();
722 $tpl->setCurrentBlock(
'image');
723 $tpl->setVariable(
'IMG_SRC', $imgSrc);
727 $tpl->setCurrentBlock(
'text');
729 $tpl->setVariable(
'CONTENT', $element->getContent());
730 $tpl->parseCurrentBlock();
732 $tpl->setCurrentBlock(
'element');
733 $tpl->setVariable(
'FEEDBACK', $feedback);
734 $tpl->parseCurrentBlock();
737 return $this->
object->prepareTextareaOutput(
$tpl->get(), TRUE);
756 $res = $ilDB->queryF(
'SELECT depth FROM qpl_a_ordering WHERE question_fi = %s ORDER BY solution_key ASC',
758 while(
$row = $ilDB->fetchAssoc(
$res))
760 $this->old_ordering_depth[] =
$row[
'depth'];
804 $relevant_answers, $this->
object->getOrderingElementList()
813 foreach($relevant_answers_chosen as $answer_chosen)
815 $passdata[$answer_chosen[
'active_fi'].
'-'. $answer_chosen[
'pass']][$answer_chosen[
'value2']] = $answer_chosen[
'value1'];
819 foreach($passdata as $key =>
$data)
821 $hash = md5(implode(
'-',
$data));
823 foreach ($variants as $vkey => $variant)
825 if ($variant[
'hash'] == $hash)
833 $variants[$key][
'hash'] = $hash;
834 $variants[$key][
'count'] = 1;
838 $aggregate =
array();
839 foreach ($variants as $key => $variant_entry)
841 $variant = $passdata[$key];
843 foreach($variant as $variant_key => $variant_line)
846 $aggregated_info_for_answer[
'count'] = $variant_entry[
'count'];
847 foreach ($answers_defined_on_question as $element)
851 if($this->
object->isImageOrderingType())
853 $element->setImageThumbnailPrefix($this->
object->getThumbPrefix());
854 $element->setImagePathWeb($this->
object->getImagePathWeb());
855 $element->setImagePathFs($this->
object->getImagePath());
857 $src = $element->getPresentationImageUrl();
858 $alt = $element->getContent();
859 $content =
"<img src='{$src}' alt='{$alt}' title='{$alt}'/>";
863 $content = $element->getContent();
866 $aggregated_info_for_answer[$i .
' - ' . $content]
867 = $passdata[$key][$i];
871 $aggregate[] = $aggregated_info_for_answer;
883 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html',
true,
true,
"Modules/TestQuestionPool");
885 foreach ($aggregate as $line_data)
887 $tpl->setCurrentBlock(
'aggregaterow' );
888 $count = array_shift($line_data);
890 foreach($line_data as $key => $line)
892 $html .=
'<li>'. ++$line .
' - ' .$key.
'</li>';
895 $tpl->setVariable(
'COUNT', $count );
898 $tpl->parseCurrentBlock();
isTestPresentationContext()
__construct($id=-1)
assOrderingQuestionGUI constructor
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
aggregateAnswers($relevant_answers_chosen, $answers_defined_on_question)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
getTestOutput($activeId, $pass, $isPostponed=FALSE, $userSolutionPost=FALSE, $inlineFeedback=false)
getSolutionOutput( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $forceCorrectSolution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
Get the question solution output.
renderAggregateView($aggregate)
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
Adds the answer specific form parts to a question property form gui.
static buildInstance($questionId, $orderingElements=array())
const CSS_CLASS_FEEDBACK_CORRECT
isRenderPurposePlayback()
populateTaxonomyFormSection(ilPropertyFormGUI $form)
setClearAnswersOnWritingPostDataEnabled($clearAnswersOnWritingPostDataEnabled)
$clearAnswersOnWritingPostDataEnabled
writeQuestionGenericPostData()
const ORDERING_ELEMENT_FORM_FIELD_POSTVAR
isInteractivePresentation()
const OQ_PICTURES
Ordering question constants.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
isRenderPurposeDemoplay()
getILIASPage($html="")
Returns the ILIAS Page around a question.
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
special template class to simplify handling of ITX/PEAR
isAdjustmentEditContext()
isClearAnswersOnWritingPostDataEnabled()
Ordering question GUI representation.
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
const CSS_CLASS_FEEDBACK_WRONG
Basic GUI class for assessment questions.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
Create styles array
The data for the language used.
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
persistAuthoringForm($form)
saveTaxonomyAssignments()
Create new PHPExcel object
obj_idprivate
addBackTab(ilTabsGUI $ilTabs)
writePostData($forceSaving=false)
{}
getSpecificFeedbackOutput($active_id, $pass)
Class for ordering questions.
isRenderPurposePrintPdf()
Interface ilGuiAnswerScoringAdjustable.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
Interface ilGuiQuestionScoringAdjustable.
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.