ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
assLongMenuGUI Class Reference
+ Inheritance diagram for assLongMenuGUI:
+ Collaboration diagram for assLongMenuGUI:

Public Member Functions

 __construct ($id=-1)
 
 getCommand ($cmd)
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 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 ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getOutputMode ()
 
 setOutputMode ($outputMode)
 
 isPdfOutputMode ()
 
 isContentEditingOutputMode ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
_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...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 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 OUTPUT_MODE_SCREEN = 'outModeScreen'
 
const OUTPUT_MODE_PDF = 'outModePdf'
 
const OUTPUT_MODE_CONTENT_EDITING = 'outModeUsrSol'
 

Protected Member Functions

 getUserSolution ($active_id, $pass)
 
 editQuestion (ilPropertyFormGUI $form=null)
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 getPreviousSolutionProvidedMessage ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 isLastSolutionSubmitAuthorized ($active_id, $pass)
 fetches solutions from database and prefers intermediate solutions, but falls back to authorized solutions. More...
 
 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)
 
 getTestOutputSolutions ($activeId, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 

Private Member Functions

 buildEditForm ()
 
 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 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...
 

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 ( )
private
Returns
ilPropertyFormGUI

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

124 {
125 $form = $this->buildBasicEditFormObject();
126
127 $this->addQuestionFormCommandButtons($form);
128
129 $this->addBasicQuestionFormProperties($form);
130
132 $this->populateAnswerSpecificFormPart($form);
133
134 $this->populateTaxonomyFormSection($form);
135
136 return $form;
137 }
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 108 of file class.assLongMenuGUI.php.

109 {
110 if( $form === null )
111 {
112 $form = $this->buildEditForm();
113 }
114
115 $this->getQuestionTemplate();
116 $this->tpl->addCss('Modules/Test/templates/default/ta.css');
117
118 $this->tpl->setVariable("QUESTION_DATA", $this->ctrl->getHTML($form));
119 }
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 515 of file class.assLongMenuGUI.php.

516 {
517 return array();
518 }

◆ 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 528 of file class.assLongMenuGUI.php.

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

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

340 {
341 $user_solution = is_object($this->getPreviewSession()) ? (array)$this->getPreviewSession()->getParticipantsSolution() : array();
342 $user_solution = array_values($user_solution);
343
344 include_once "./Services/UICore/classes/class.ilTemplate.php";
345 $template = new ilTemplate("tpl.il_as_qpl_longmenu_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
346
347 $question_text = $this->object->getQuestion();
348 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, TRUE));
349 $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
350 $template->setVariable('AUTOCOMPLETE_LENGTH',$this->object->getMinAutoComplete());
351 $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
352
353 $question_output = $template->get();
354 if (!$show_question_only)
355 {
356 $question_output = $this->getILIASPage($question_output);
357 }
358 return $question_output;
359 }
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 637 of file class.assLongMenuGUI.php.

638 {
639 $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_select_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
640 $tpl->setVariable('KEY', $key);
641 if($solution)
642 {
643 $tpl->setVariable('DISABLED', 'disabled');
644 $tpl->setVariable('JS_IGNORE', '_ignore');
645 $tpl->setCurrentBlock('best_solution');
646 if($user_value == -1)
647 {
648 $tpl->setVariable("SOLUTION", $this->lng->txt("please_select"));
649 }
650 else
651 {
652 $tpl->setVariable('SOLUTION', $user_value);
653 }
654 if($graphical)
655 {
656 if($ok)
657 {
658 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
659 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
660 }
661 else
662 {
663 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
664 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
665 }
666 }
667 $tpl->parseCurrentBlock();
668 }
669 else
670 {
671 $tpl->setVariable("PLEASE_SELECT", $this->lng->txt("please_select"));
672 foreach($answers as $value)
673 {
674 $tpl->setCurrentBlock('select_option');
675 $tpl->setVariable('VALUE', $value);
676 if($value == $user_value)
677 {
678 $tpl->setVariable('SELECTED', 'selected');
679 }
680 $tpl->parseCurrentBlock();
681 }
682 }
683 return $tpl->get();
684 }
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 274 of file class.assLongMenuGUI.php.

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

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

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 363 of file class.assLongMenuGUI.php.

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

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

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->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 }
getTestOutputSolutions($activeId, $pass)

References $pass, and assQuestionGUI\getTestOutputSolutions().

Referenced by getSolutionOutput().

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

◆ populateAnswerSpecificFormPart()

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

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

257 {
258 return $form;
259 }

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 142 of file class.assLongMenuGUI.php.

143 {
144 $long_menu_text = new ilTextAreaInputGUI($this->lng->txt("longmenu_text"), 'longmenu_text');
145 $long_menu_text->setRequired(true);
146 //$long_menu_text->setInfo($this->lng->txt("longmenu_hint"));
147 $long_menu_text->setRows( 10 );
148 $long_menu_text->setCols( 80 );
149 if (!$this->object->getSelfAssessmentEditingMode())
150 {
151 if( $this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT )
152 {
153 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
154 $long_menu_text->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
155 $long_menu_text->addPlugin("latex");
156 $long_menu_text->addButton("latex");
157 $long_menu_text->addButton("pastelatex");
158 $long_menu_text->setRTESupport($this->object->getId(), "qpl", "assessment");
159 $long_menu_text->setUseRte(TRUE);
160 }
161 }
162 else
163 {
164 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
166 $long_menu_text->setUseTagsForRteOnly(false);
167 }
168
169 $long_menu_text->setValue($this->object->prepareTextareaOutput($this->object->getLongMenuTextValue()));
170 $form->addItem($long_menu_text);
171
172 $tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool");
173 $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
174 $tpl->parseCurrentBlock();
175 $button = new ilCustomInputGUI('&nbsp;','');
176 $button->setHtml($tpl->get());
177 $form->addItem($button);
178
179 require_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
180 $modal = ilModalGUI::getInstance();
181 $modal->setHeading('');
182 $modal->setId("ilGapModal");
183 //$modal->setBackdrop(ilModalGUI::BACKDROP_OFF);
184 $modal->setBody('');
185
186 $min_auto_complete = new ilNumberInputGUI($this->lng->txt("min_auto_complete"), 'min_auto_complete');
187
188 $auto_complete = $this->object->getMinAutoComplete();
189 if($auto_complete == 0)
190 {
192 }
193 $min_auto_complete->setValue($auto_complete);
194 $min_auto_complete->setMinValue(1);
195 $min_auto_complete->setMaxValue(99);
196 $min_auto_complete->setSize(5);
197 $form->addItem($min_auto_complete);
198
199 $hidden_text = new ilHiddenInputGUI('hidden_text_files');
200 $form->addItem($hidden_text);
201
202 $hidden_correct = new ilHiddenInputGUI('hidden_correct_answers');
203 $form->addItem($hidden_correct);
204
205 $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
206 if(is_array($_POST) && array_key_exists('hidden_text_files', $_POST))
207 {
208 $tpl->setVariable('CORRECT_ANSWERS', $_POST['hidden_correct_answers']);
209 $tpl->setVariable('ALL_ANSWERS', $_POST['hidden_text_files']);
210 }
211 else
212 {
213 $tpl->setVariable('CORRECT_ANSWERS', $this->object->getJsonStructure());
214 $tpl->setVariable('ALL_ANSWERS', $this->object->getAnswersObject());
215 }
216 $tpl->setVariable('MAX_INPUT_FIELDS', assLongMenu::MAX_INPUT_FIELDS);
217 $tpl->setVariable('GAP_PLACEHOLDER', assLongMenu::GAP_PLACEHOLDER);
218 $tpl->setVariable('SELECT_BOX', $this->lng->txt('insert_gap'));
219 $tpl->setVariable("SELECT", $this->lng->txt('answers_select'));
220 $tpl->setVariable("TEXT", $this->lng->txt('answers_text_box'));
221 $tpl->setVariable("POINTS", $this->lng->txt('points'));
222 $tpl->setVariable("INFO_TEXT_UPLOAD", $this->lng->txt('info_text_upload'));
223 $tpl->setVariable("MANUAL_EDITING", $this->lng->txt('manual_editing'));
224 $tpl->setVariable("CORRECT_ANSWER_TXT", $this->lng->txt('correct_answers'));
225 $tpl->setVariable("ANSWER_OPTIONS_TXT", $this->lng->txt('answer_options'));
226 $tpl->setVariable("ANSWERS_TXT", $this->lng->txt('answers'));
227 $tpl->setVariable("TYPE_TXT", $this->lng->txt('type'));
228 $tpl->setVariable("EDIT_TXT", $this->lng->txt('edit'));
229 $tpl->setVariable("ADD_ANSWER_TXT", $this->lng->txt('add_answers'));
230 $tpl->setVariable('POINTS_ERROR', $this->lng->txt('enter_enough_positive_points'));
231 $tpl->setVariable('AUTOCOMPLETE_ERROR', $this->lng->txt('autocomplete_error'));
232 $tpl->setVariable('MISSING_VALUE', $this->lng->txt('msg_input_is_required'));
233 $tpl->setVariable('SAVE', $this->lng->txt('save'));
234 $tpl->setVariable('CANCEL', $this->lng->txt('cancel'));
235 require_once("Services/Form/classes/class.ilTagInputGUI.php");
236 $tag_input = new ilTagInputGUI();
237 $tag_input->setTypeAhead(true);
238 $tag_input->setPostVar('taggable');
239 $tag_input->setJsSelfInit(false);
240 $tag_input->setTypeAheadMinLength(1);
241 $tpl->setVariable("TAGGING_PROTOTYPE", $tag_input->render(''));
242
243 $tpl->setVariable("MY_MODAL", $modal->getHTML());
244
245 $tpl->parseCurrentBlock();
246 $button = new ilCustomInputGUI('&nbsp;','');
247 $button->setHtml($tpl->get());
248 $form->addItem($button);
249 return $form;
250 }
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.
& _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.
$_POST['username']
Definition: cron.php:12

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 407 of file class.assLongMenuGUI.php.

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

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

Parameters
bool$always
Returns
integer A positive value, if one of the required fields wasn't set, else 0

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

77 {
78 $form = $this->buildEditForm();
79 $form->setValuesByPost();
82 $custom_check = $this->object->checkQuestionCustomPart();
83 if( !$form->checkInput() || !$custom_check)
84 {
85 if(!$custom_check)
86 {
87 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
88 }
89 $this->editQuestion($form);
90 return 1;
91 }
93 return 0;
94 }
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 96 of file class.assLongMenuGUI.php.

97 {
98 $this->object->setLongMenuTextValue(ilUtil::stripSlashesRecursive($_POST['longmenu_text']));
99 $this->object->setAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_text_files'])));
100 $this->object->setCorrectAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_correct_answers'])));
101 $this->object->setAnswerType(ilUtil::stripSlashesRecursive($_POST['long_menu_type']));
102 $this->object->setQuestion($_POST['question']);
103 $this->object->setLongMenuTextValue($_POST["longmenu_text"]);
104 $this->object->setMinAutoComplete((int)$_POST["min_auto_complete"]);
106 }
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: