ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
assLongMenuGUI Class Reference
+ Inheritance diagram for assLongMenuGUI:
+ Collaboration diagram for assLongMenuGUI:

Public Member Functions

 __construct ($id=-1)
 
 getCommand ($cmd)
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 
 populateAnswerSpecificFormPart (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. More...
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 getTestOutput ($active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
 getLongMenuTextWithInputFieldsInsteadOfGaps ($user_solution=array(), $solution=false, $graphical=false)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilTemplate $tpl)
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 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)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 

Data Fields

 $lng
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 

Protected Member Functions

 getUserSolution ($active_id, $pass)
 
 writePostData ($always=false)
 {Evaluates a posted edit form and writes the form data in the question object.
Returns
integer A positive value, if one of the required fields wasn't set, else 0
} More...
 
 editQuestion (ilPropertyFormGUI $form=null)
 
 buildEditForm ()
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_QuestionPreview (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 buildEditForm ()
 

Private Member Functions

 getTextGapTemplate ($key, $value, $solution, $ok=false, $graphical=false)
 
 getSelectGapTemplate ($key, $answers, $user_value, $solution, $ok=false, $graphical=false)
 

Private Attributes

 $rbacsystem
 
 $ilTabs
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 
- Protected Attributes inherited from assQuestionGUI
 $editForm
 

Detailed Description

Definition at line 15 of file class.assLongMenuGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assLongMenuGUI::__construct (   $id = -1)

Definition at line 20 of file class.assLongMenuGUI.php.

21 {
22 parent::__construct();
23 include_once './Modules/TestQuestionPool/classes/class.assLongMenu.php';
24 $this->object = new assLongMenu();
25 if ($id >= 0)
26 {
27 $this->object->loadFromDb($id);
28 }
29 global $rbacsystem, $ilTabs, $lng;
30 $this->rbacsystem = $rbacsystem;
31 $this->ilTabs = $ilTabs;
32 $this->lng = $lng;
33 }

References $ilTabs, $lng, and $rbacsystem.

Member Function Documentation

◆ buildEditForm()

assLongMenuGUI::buildEditForm ( )
protected
Returns
ilPropertyFormGUI

Reimplemented from assQuestionGUI.

Definition at line 118 of file class.assLongMenuGUI.php.

119 {
120 $form = $this->buildBasicEditFormObject();
121
122 $this->addQuestionFormCommandButtons($form);
123
124 $this->addBasicQuestionFormProperties($form);
125
127 $this->populateAnswerSpecificFormPart($form);
128
129 $this->populateTaxonomyFormSection($form);
130
131 return $form;
132 }
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...

References assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), assQuestionGUI\buildBasicEditFormObject(), populateAnswerSpecificFormPart(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by editQuestion(), and writePostData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editQuestion()

assLongMenuGUI::editQuestion ( ilPropertyFormGUI  $form = null)
protected

Definition at line 103 of file class.assLongMenuGUI.php.

104 {
105 if( $form === null )
106 {
107 $form = $this->buildEditForm();
108 }
109
110 $this->getQuestionTemplate();
111 $this->tpl->addCss('Modules/Test/templates/default/ta.css');
112
113 $this->tpl->setVariable("QUESTION_DATA", $this->ctrl->getHTML($form));
114 }
getQuestionTemplate()
get question template

References buildEditForm(), and assQuestionGUI\getQuestionTemplate().

Referenced by writePostData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionQuestionPostVars()

assLongMenuGUI::getAfterParticipationSuppressionQuestionPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiQuestionScoringAdjustable.

Definition at line 512 of file class.assLongMenuGUI.php.

513 {
514 return array();
515 }

◆ getAggregatedAnswersView()

assLongMenuGUI::getAggregatedAnswersView (   $relevant_answers)

Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface.

Parameters
array$relevant_answers
Returns
string

Implements ilGuiQuestionScoringAdjustable.

Definition at line 525 of file class.assLongMenuGUI.php.

526 {
527 $overview = array();
528 $aggregation = array();
529 foreach ($relevant_answers as $answer)
530 {
531 $overview[$answer['active_fi']][$answer['pass']][$answer['value1']] = $answer['value2'];
532 }
533
534 foreach($overview as $active)
535 {
536 foreach ($active as $answer)
537 {
538 foreach ($answer as $option => $value)
539 {
540 $aggregation[$option][$value] = $aggregation[$option][$value] + 1;
541 }
542 }
543 }
544 $tpl = new ilTemplate('tpl.il_as_aggregated_long_menu_answers_table.html', true, true, "Modules/TestQuestionPool");
545 $json = json_decode($this->object->getJsonStructure());
546 foreach ($json as $key => $value)
547 {
548 $tpl->setVariable('TITLE','Longmenu '. ($key+1));
549 if(array_key_exists($key, $aggregation))
550 {
551 $aggregate = $aggregation[$key];
552 foreach($aggregate as $answer => $counts)
553 {
554 $tpl->setVariable('OPTION',$answer);
555 $tpl->setVariable('COUNT',$counts);
556 $tpl->parseCurrentBlock();
557 }
558 }
559 }
560
561 return $tpl->get();
562 }
special template class to simplify handling of ITX/PEAR

References assQuestionGUI\$tpl.

◆ getCommand()

assLongMenuGUI::getCommand (   $cmd)

Reimplemented from assQuestionGUI.

Definition at line 63 of file class.assLongMenuGUI.php.

64 {
65 return $cmd;
66 }
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ getLongMenuTextWithInputFieldsInsteadOfGaps()

assLongMenuGUI::getLongMenuTextWithInputFieldsInsteadOfGaps (   $user_solution = array(),
  $solution = false,
  $graphical = false 
)

Definition at line 564 of file class.assLongMenuGUI.php.

565 {
566 $return_value = '';
567 $text_array = preg_split("/\\[".assLongMenu::GAP_PLACEHOLDER." (\\d+)\\]/", $this->object->getLongMenuTextValue());
568 $correct_answers = $this->object->getCorrectAnswers();
569 $answers = $this->object->getAnswers();
570 foreach($text_array as $key => $value)
571 {
572 $answer_is_correct = false;
573 $user_value = '';
574 $return_value .= $value;
575 if($key < sizeof($text_array) - 1 )
576 {
577 if($correct_answers[$key][2] == assLongMenu::ANSWER_TYPE_TEXT_VAL)
578 {
579 if(array_key_exists($key,$user_solution))
580 {
581 $user_value = $user_solution[$key];
582 if(in_array($user_value, $correct_answers[$key][0]))
583 {
584 $answer_is_correct = true;
585 }
586 }
587
588 $return_value .= $this->getTextGapTemplate($key, $user_value, $solution, $answer_is_correct, $graphical);
589 }
590 else if($correct_answers[$key][2] == assLongMenu::ANSWER_TYPE_SELECT_VAL)
591 {
592 if(array_key_exists($key,$user_solution))
593 {
594 $user_value = $user_solution[$key];
595 if(in_array($user_value, $correct_answers[$key][0]))
596 {
597 $answer_is_correct = true;
598 }
599 }
600 $return_value .= $this->getSelectGapTemplate($key, $answers[$key], $user_value, $solution, $answer_is_correct, $graphical);
601 }
602 }
603 }
604 return $return_value;
605 }
getSelectGapTemplate($key, $answers, $user_value, $solution, $ok=false, $graphical=false)
getTextGapTemplate($key, $value, $solution, $ok=false, $graphical=false)
const ANSWER_TYPE_TEXT_VAL
const ANSWER_TYPE_SELECT_VAL

References assLongMenu\ANSWER_TYPE_SELECT_VAL, assLongMenu\ANSWER_TYPE_TEXT_VAL, assLongMenu\GAP_PLACEHOLDER, getSelectGapTemplate(), and getTextGapTemplate().

Referenced by getPreview(), getSolutionOutput(), and getTestOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPreview()

assLongMenuGUI::getPreview (   $show_question_only = FALSE,
  $showInlineFeedback = false 
)

Reimplemented from assQuestionGUI.

Definition at line 335 of file class.assLongMenuGUI.php.

336 {
337 $user_solution = is_object($this->getPreviewSession()) ? (array)$this->getPreviewSession()->getParticipantsSolution() : array();
338 $user_solution = array_values($user_solution);
339
340 include_once "./Services/UICore/classes/class.ilTemplate.php";
341 $template = new ilTemplate("tpl.il_as_qpl_longmenu_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
342
343 $question_text = $this->object->getQuestion();
344 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, TRUE));
345 $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
346 $template->setVariable('AUTOCOMPLETE_LENGTH',$this->object->getMinAutoComplete());
347 $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
348
349 $question_output = $template->get();
350 if (!$show_question_only)
351 {
352 $question_output = $this->getILIASPage($question_output);
353 }
354 return $question_output;
355 }
getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution=array(), $solution=false, $graphical=false)
getILIASPage($html="")
Returns the ILIAS Page around a question.

References assQuestionGUI\getILIASPage(), getLongMenuTextWithInputFieldsInsteadOfGaps(), and assQuestionGUI\getPreviewSession().

+ Here is the call graph for this function:

◆ getSelectGapTemplate()

assLongMenuGUI::getSelectGapTemplate (   $key,
  $answers,
  $user_value,
  $solution,
  $ok = false,
  $graphical = false 
)
private

Definition at line 634 of file class.assLongMenuGUI.php.

635 {
636 $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_select_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
637 $tpl->setVariable('KEY', $key);
638 if($solution)
639 {
640 $tpl->setVariable('DISABLED', 'disabled');
641 $tpl->setVariable('JS_IGNORE', '_ignore');
642 $tpl->setCurrentBlock('best_solution');
643 if($user_value == -1)
644 {
645 $tpl->setVariable("SOLUTION", $this->lng->txt("please_select"));
646 }
647 else
648 {
649 $tpl->setVariable('SOLUTION', $user_value);
650 }
651 if($graphical)
652 {
653 if($ok)
654 {
655 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
656 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
657 }
658 else
659 {
660 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
661 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
662 }
663 }
664 $tpl->parseCurrentBlock();
665 }
666 else
667 {
668 $tpl->setVariable("PLEASE_SELECT", $this->lng->txt("please_select"));
669 foreach($answers as $value)
670 {
671 $tpl->setCurrentBlock('select_option');
672 $tpl->setVariable('VALUE', $value);
673 if($value == $user_value)
674 {
675 $tpl->setVariable('SELECTED', 'selected');
676 }
677 $tpl->parseCurrentBlock();
678 }
679 }
680 return $tpl->get();
681 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $ok, assQuestionGUI\$tpl, and ilUtil\getImagePath().

Referenced by getLongMenuTextWithInputFieldsInsteadOfGaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSolutionOutput()

assLongMenuGUI::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.

Parameters
integer$active_idThe active user id
integer$passThe test pass
boolean$graphicalOutputShow visual feedback for right/wrong answers
boolean$result_outputShow the reached points for parts of the question
boolean$show_question_onlyShow the question without the ILIAS content around
boolean$show_feedbackShow the question feedback
boolean$show_correct_solutionShow the correct solution instead of the user solution
boolean$show_manual_scoringShow specific information for the manual scoring output
Returns
The solution output of the question as HTML code

Reimplemented from assQuestionGUI.

Definition at line 270 of file class.assLongMenuGUI.php.

281 {
282 include_once "./Services/UICore/classes/class.ilTemplate.php";
283 $template = new ilTemplate("tpl.il_as_qpl_lome_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
284
285 if($show_question_text)
286 {
287 $question_text = $this->object->getQuestion();
288 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, TRUE));
289 }
290 if (($active_id > 0) && (!$show_correct_solution))
291 {
292 $correct_solution = $this->getUserSolution($active_id, $pass);
293 }
294 else
295 {
296 $correct_solution = $this->object->getCorrectAnswersForQuestionSolution($this->object->getId());
297 }
298 $template->setVariable('LONGMENU_TEXT_SOLUTION', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($correct_solution, true, $graphicalOutput));
299 $solution_template = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
300 $question_output = $template->get();
301 $feedback = '';
302 if($show_feedback)
303 {
304 if( !$this->isTestPresentationContext() )
305 {
306 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
307 $feedback .= strlen($fb) ? $fb : '';
308 }
309
310 $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
311 $feedback .= strlen($fb) ? $fb : '';
312 }
313 if (strlen($feedback))
314 {
315 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
317 );
318
319 $solution_template->setVariable("ILC_FB_CSS_CLASS", $cssClass);
320 $solution_template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
321 }
322
323 $solution_template->setVariable("SOLUTION_OUTPUT", $question_output);
324
325 $solution_output = $solution_template->get();
326
327 if (!$show_question_only)
328 {
329 $solution_output = $this->getILIASPage($solution_output);
330 }
331
332 return $solution_output;
333 }
getUserSolution($active_id, $pass)
getSpecificFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
hasCorrectSolution($activeId, $passIndex)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.

References $pass, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), getLongMenuTextWithInputFieldsInsteadOfGaps(), getSpecificFeedbackOutput(), getUserSolution(), assQuestionGUI\hasCorrectSolution(), and assQuestionGUI\isTestPresentationContext().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assLongMenuGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

Definition at line 477 of file class.assLongMenuGUI.php.

478 {
479 if( !$this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0) )
480 {
481 return '';
482 }
483
484 $feedback = '<table class="test_specific_feedback"><tbody>';
485 $gaps = $this->object->getCorrectAnswers();
486 foreach ($gaps as $index => $answer)
487 {
488 $caption = assLongMenu::GAP_PLACEHOLDER . ' ';
489 $caption .= $index + 1 .': ';
490
491 $feedback .= '<tr><td>';
492
493 $feedback .= $caption .'</td><td>';
494 $feedback .= $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
495 $this->object->getId(), $index
496 ) . '</td> </tr>';
497 }
498 $feedback .= '</tbody></table>';
499 return $this->object->prepareTextareaOutput($feedback, TRUE);
500 }

References assLongMenu\GAP_PLACEHOLDER.

Referenced by getSolutionOutput().

+ Here is the caller graph for this function:

◆ getTestOutput()

assLongMenuGUI::getTestOutput (   $active_id,
  $pass,
  $is_postponed = FALSE,
  $use_post_solutions = FALSE,
  $show_feedback = FALSE 
)

Reimplemented from assQuestionGUI.

Definition at line 359 of file class.assLongMenuGUI.php.

367 {
368 $user_solution = array();
369 if ($active_id)
370 {
371 $solutions = NULL;
372 include_once "./Modules/Test/classes/class.ilObjTest.php";
373 if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
374 {
375 if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
376 }
377 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
378 foreach ($solutions as $idx => $solution_value)
379 {
380 $user_solution[$solution_value["value1"]] = $solution_value["value2"];
381 }
382 }
383
384 // generate the question output
385 include_once "./Services/UICore/classes/class.ilTemplate.php";
386 $template = new ilTemplate("tpl.il_as_qpl_longmenu_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
387
388 $question_text = $this->object->getQuestion();
389 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, TRUE));
390 $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
391 $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
392 $template->setVariable('AUTOCOMPLETE_LENGTH',$this->object->getMinAutoComplete());
393 $question_output = $template->get();
394 $page_output = $this->outQuestionPage("", $is_postponed, $active_id, $question_output);
395 return $page_output;
396 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
static _getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.

References $pass, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), getLongMenuTextWithInputFieldsInsteadOfGaps(), and assQuestionGUI\outQuestionPage().

+ Here is the call graph for this function:

◆ getTextGapTemplate()

assLongMenuGUI::getTextGapTemplate (   $key,
  $value,
  $solution,
  $ok = false,
  $graphical = false 
)
private

Definition at line 607 of file class.assLongMenuGUI.php.

608 {
609 $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_text_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
610 if($solution)
611 {
612 $tpl->setVariable('DISABLED', 'disabled');
613 $tpl->setVariable('JS_IGNORE', '_ignore');
614 if($graphical)
615 {
616 if($ok)
617 {
618 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
619 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
620 }
621 else
622 {
623 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
624 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
625 }
626 }
627 }
628 $tpl->setVariable('VALUE', $value);
629 $tpl->setVariable('KEY', $key);
630
631 return $tpl->get();
632 }

References $ok, assQuestionGUI\$tpl, and ilUtil\getImagePath().

Referenced by getLongMenuTextWithInputFieldsInsteadOfGaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserSolution()

assLongMenuGUI::getUserSolution (   $active_id,
  $pass 
)
protected
Parameters
$active_id
$pass
Returns
array

Definition at line 40 of file class.assLongMenuGUI.php.

41 {
42 $user_solution = array();
43 if($active_id)
44 {
45 // hey: prevPassSolutions - obsolete due to central check
46 #$solutions = NULL;
47 #include_once "./Modules/Test/classes/class.ilObjTest.php";
48 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
49 #{
50 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
51 #}
52 $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
53 // hey.
54 foreach($solutions as $idx => $solution_value)
55 {
56 $user_solution[$solution_value["value1"]] = $solution_value["value2"];
57 }
58 return $user_solution;
59 }
60 return $user_solution;
61 }

References $pass.

Referenced by getSolutionOutput().

+ Here is the caller graph for this function:

◆ populateAnswerSpecificFormPart()

assLongMenuGUI::populateAnswerSpecificFormPart ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Definition at line 252 of file class.assLongMenuGUI.php.

253 {
254 return $form;
255 }

Referenced by buildEditForm().

+ Here is the caller graph for this function:

◆ populateQuestionSpecificFormPart()

assLongMenuGUI::populateQuestionSpecificFormPart ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Implements ilGuiQuestionScoringAdjustable.

Definition at line 137 of file class.assLongMenuGUI.php.

138 {
139 $long_menu_text = new ilTextAreaInputGUI($this->lng->txt("longmenu_text"), 'longmenu_text');
140 $long_menu_text->setRequired(true);
141 //$long_menu_text->setInfo($this->lng->txt("longmenu_hint"));
142 $long_menu_text->setRows( 10 );
143 $long_menu_text->setCols( 80 );
144 if (!$this->object->getSelfAssessmentEditingMode())
145 {
146 if( $this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT )
147 {
148 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
149 $long_menu_text->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
150 $long_menu_text->addPlugin("latex");
151 $long_menu_text->addButton("latex");
152 $long_menu_text->addButton("pastelatex");
153 $long_menu_text->setRTESupport($this->object->getId(), "qpl", "assessment");
154 $long_menu_text->setUseRte(TRUE);
155 }
156 }
157 else
158 {
159 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
161 $long_menu_text->setUseTagsForRteOnly(false);
162 }
163
164 $long_menu_text->setValue($this->object->prepareTextareaOutput($this->object->getLongMenuTextValue()));
165 $form->addItem($long_menu_text);
166
167 $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool");
168 $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
169 $tpl->parseCurrentBlock();
170 $button = new ilCustomInputGUI('&nbsp;','');
171 $button->setHtml($tpl->get());
172 $form->addItem($button);
173
174 require_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
175 $modal = ilModalGUI::getInstance();
176 $modal->setHeading('');
177 $modal->setId("ilGapModal");
178 //$modal->setBackdrop(ilModalGUI::BACKDROP_OFF);
179 $modal->setBody('');
180
181 $min_auto_complete = new ilNumberInputGUI($this->lng->txt("min_auto_complete"), 'min_auto_complete');
182
183 $auto_complete = $this->object->getMinAutoComplete();
184 if($auto_complete == 0)
185 {
187 }
188 $min_auto_complete->setValue($auto_complete);
189 $min_auto_complete->setMinValue(1);
190 $min_auto_complete->setMaxValue(99);
191 $min_auto_complete->setSize(5);
192 $form->addItem($min_auto_complete);
193
194 $hidden_text = new ilHiddenInputGUI('hidden_text_files');
195 $form->addItem($hidden_text);
196
197 $hidden_correct = new ilHiddenInputGUI('hidden_correct_answers');
198 $form->addItem($hidden_correct);
199
200 $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
201 if(is_array($_POST) && array_key_exists('hidden_text_files', $_POST))
202 {
203 $tpl->setVariable('CORRECT_ANSWERS', $_POST['hidden_correct_answers']);
204 $tpl->setVariable('ALL_ANSWERS', $_POST['hidden_text_files']);
205 }
206 else
207 {
208 $tpl->setVariable('CORRECT_ANSWERS', $this->object->getJsonStructure());
209 $tpl->setVariable('ALL_ANSWERS', $this->object->getAnswersObject());
210 }
211 $tpl->setVariable('MAX_INPUT_FIELDS', assLongMenu::MAX_INPUT_FIELDS);
212 $tpl->setVariable('GAP_PLACEHOLDER', assLongMenu::GAP_PLACEHOLDER);
213 $tpl->setVariable('SELECT_BOX', $this->lng->txt('insert_gap'));
214 $tpl->setVariable("SELECT", $this->lng->txt('answers_select'));
215 $tpl->setVariable("TEXT", $this->lng->txt('answers_text_box'));
216 $tpl->setVariable("POINTS", $this->lng->txt('points'));
217 $tpl->setVariable("INFO_TEXT_UPLOAD", $this->lng->txt('info_text_upload'));
218 $tpl->setVariable("TXT_BROWSE", $this->lng->txt('select_file'));
219 $tpl->setVariable("MANUAL_EDITING", $this->lng->txt('manual_editing'));
220 $tpl->setVariable("CORRECT_ANSWER_TXT", $this->lng->txt('correct_answers'));
221 $tpl->setVariable("ANSWER_OPTIONS_TXT", $this->lng->txt('answer_options'));
222 $tpl->setVariable("ANSWERS_TXT", $this->lng->txt('answers'));
223 $tpl->setVariable("TYPE_TXT", $this->lng->txt('type'));
224 $tpl->setVariable("EDIT_TXT", $this->lng->txt('edit'));
225 $tpl->setVariable("ADD_ANSWER_TXT", $this->lng->txt('add_answers'));
226 $tpl->setVariable('POINTS_ERROR', $this->lng->txt('enter_enough_positive_points'));
227 $tpl->setVariable('AUTOCOMPLETE_ERROR', $this->lng->txt('autocomplete_error'));
228 $tpl->setVariable('MISSING_VALUE', $this->lng->txt('msg_input_is_required'));
229 $tpl->setVariable('SAVE', $this->lng->txt('save'));
230 $tpl->setVariable('CANCEL', $this->lng->txt('cancel'));
231 require_once("Services/Form/classes/class.ilTagInputGUI.php");
232 $tag_input = new ilTagInputGUI();
233 $tag_input->setTypeAhead(true);
234 $tag_input->setPostVar('taggable');
235 $tag_input->setJsSelfInit(false);
236 $tag_input->setTypeAheadMinLength(1);
237 $tpl->setVariable("TAGGING_PROTOTYPE", $tag_input->render(''));
238
239 $tpl->setVariable("MY_MODAL", $modal->getHTML());
240
241 $tpl->parseCurrentBlock();
242 $button = new ilCustomInputGUI('&nbsp;','');
243 $button->setHtml($tpl->get());
244 $form->addItem($button);
245 return $form;
246 }
$_POST["username"]
const MIN_LENGTH_AUTOCOMPLETE
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
constant for additional content editing mode "default"
static getSelfAssessmentTags()
Get tags allowed in question tags in self assessment mode.
This class represents a custom property in a property form.
This class represents a hidden form property in a property form.
static getInstance()
Get instance.
This class represents a number property in a property form.
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a tag list property in a property form.
This class represents a text area property in a property form.

References $_POST, assQuestionGUI\$tpl, ilObjAdvancedEditing\_getUsedHTMLTags(), ilPropertyFormGUI\addItem(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT, assLongMenu\GAP_PLACEHOLDER, ilModalGUI\getInstance(), ilAssSelfAssessmentQuestionFormatter\getSelfAssessmentTags(), assLongMenu\MAX_INPUT_FIELDS, and assLongMenu\MIN_LENGTH_AUTOCOMPLETE.

Referenced by buildEditForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setQuestionTabs()

assLongMenuGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

@access public

Reimplemented from assQuestionGUI.

Definition at line 404 of file class.assLongMenuGUI.php.

405 {
406 $this->ilTabs->clearTargets();
407
408 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
409 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
410 $q_type = $this->object->getQuestionType();
411
412 if (strlen($q_type))
413 {
414 $classname = $q_type . "GUI";
415 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
416 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
417 }
418
419 if ($_GET["q_id"])
420 {
421 if ($this->rbacsystem->checkAccess('write', $_GET["ref_id"]))
422 {
423 // edit page
424 $this->ilTabs->addTarget("edit_page",
425 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
426 array("edit", "insert", "exec_pg"),
427 "", "", $force_active);
428 }
429
430 $this->addTab_QuestionPreview($this->ilTabs);
431 }
432
433 $force_active = false;
434 if ($this->rbacsystem->checkAccess('write', $_GET["ref_id"]))
435 {
436 $url = "";
437 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
438 $commands = $_POST["cmd"];
439 if (is_array($commands))
440 {
441 foreach ($commands as $key => $value)
442 {
443 if (preg_match("/^delete_.*/", $key, $matches))
444 {
445 $force_active = true;
446 }
447 }
448 }
449 // edit question properties
450 $this->ilTabs->addTarget("edit_question",
451 $url,
452 array("editQuestion", "save", "saveEdit", "addkvp", "removekvp", "originalSyncForm"),
453 $classname, "", $force_active);
454 }
455
456 // add tab for question feedback within common class assQuestionGUI
457 $this->addTab_QuestionFeedback($this->ilTabs);
458
459 // add tab for question hint within common class assQuestionGUI
460 $this->addTab_QuestionHints($this->ilTabs);
461
462 // add tab for question's suggested solution within common class assQuestionGUI
463 $this->addTab_SuggestedSolution($this->ilTabs, $classname);
464
465 // Assessment of questions sub menu entry
466 if ($_GET["q_id"])
467 {
468 $this->ilTabs->addTarget("statistics",
469 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
470 array("assessment"),
471 $classname, "");
472 }
473
474 $this->addBackTab($this->ilTabs);
475 }
$_GET["client_id"]
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addBackTab(ilTabsGUI $ilTabs)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
$url
Definition: shib_logout.php:72

References $_GET, $_POST, $url, assQuestionGUI\addBackTab(), assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), assQuestionGUI\addTab_QuestionPreview(), and assQuestionGUI\addTab_SuggestedSolution().

+ Here is the call graph for this function:

◆ writePostData()

assLongMenuGUI::writePostData (   $always = false)
protected

{Evaluates a posted edit form and writes the form data in the question object.

Returns
integer A positive value, if one of the required fields wasn't set, else 0
}

Reimplemented from assQuestionGUI.

Definition at line 71 of file class.assLongMenuGUI.php.

72 {
73 $form = $this->buildEditForm();
74 $form->setValuesByPost();
77 $custom_check = $this->object->checkQuestionCustomPart();
78 if( !$form->checkInput() || !$custom_check)
79 {
80 if(!$custom_check)
81 {
82 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
83 }
84 $this->editQuestion($form);
85 return 1;
86 }
88 return 0;
89 }
editQuestion(ilPropertyFormGUI $form=null)
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References buildEditForm(), editQuestion(), assQuestionGUI\saveTaxonomyAssignments(), ilUtil\sendFailure(), assQuestionGUI\writeQuestionGenericPostData(), and writeQuestionSpecificPostData().

+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assLongMenuGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

Extracts the question specific values from $_POST and applies them to the data object.

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiQuestionScoringAdjustable.

Definition at line 91 of file class.assLongMenuGUI.php.

92 {
93 $this->object->setLongMenuTextValue(ilUtil::stripSlashesRecursive($_POST['longmenu_text']));
94 $this->object->setAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_text_files'])));
95 $this->object->setCorrectAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_correct_answers'])));
96 $this->object->setAnswerType(ilUtil::stripSlashesRecursive($_POST['long_menu_type']));
97 $this->object->setQuestion($_POST['question']);
98 $this->object->setLongMenuTextValue($_POST["longmenu_text"]);
99 $this->object->setMinAutoComplete((int)$_POST["min_auto_complete"]);
101 }
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.

References $_POST, assQuestionGUI\saveTaxonomyAssignments(), and ilUtil\stripSlashesRecursive().

Referenced by writePostData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ilTabs

assLongMenuGUI::$ilTabs
private

Definition at line 17 of file class.assLongMenuGUI.php.

Referenced by __construct().

◆ $lng

assLongMenuGUI::$lng

Definition at line 18 of file class.assLongMenuGUI.php.

Referenced by __construct().

◆ $rbacsystem

assLongMenuGUI::$rbacsystem
private

Definition at line 17 of file class.assLongMenuGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: