ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 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)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 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 21 of file class.assLongMenuGUI.php.

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

References $id, $ilTabs, $lng, and $rbacsystem.

Member Function Documentation

◆ buildEditForm()

assLongMenuGUI::buildEditForm ( )
protected
Returns
ilPropertyFormGUI

Reimplemented from assQuestionGUI.

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

114 {
116
118
120
123
125
126 return $form;
127 }
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,...
if(isset($_POST['submit'])) $form

References $form, 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 99 of file class.assLongMenuGUI.php.

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

References $form, 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 493 of file class.assLongMenuGUI.php.

494 {
495 return array();
496 }

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

507 {
508 $overview = array();
509 $aggregation = array();
510 foreach ($relevant_answers as $answer) {
511 $overview[$answer['active_fi']][$answer['pass']][$answer['value1']] = $answer['value2'];
512 }
513
514 foreach ($overview as $active) {
515 foreach ($active as $answer) {
516 foreach ($answer as $option => $value) {
517 $aggregation[$option][$value] = $aggregation[$option][$value] + 1;
518 }
519 }
520 }
521 $tpl = new ilTemplate('tpl.il_as_aggregated_long_menu_answers_table.html', true, true, "Modules/TestQuestionPool");
522 $json = json_decode($this->object->getJsonStructure());
523 foreach ($json as $key => $value) {
524 $tpl->setVariable('TITLE', 'Longmenu ' . ($key+1));
525 if (array_key_exists($key, $aggregation)) {
526 $aggregate = $aggregation[$key];
527 foreach ($aggregate as $answer => $counts) {
528 $tpl->setVariable('OPTION', $answer);
529 $tpl->setVariable('COUNT', $counts);
530 $tpl->parseCurrentBlock();
531 }
532 }
533 }
534
535 return $tpl->get();
536 }
special template class to simplify handling of ITX/PEAR
$key
Definition: croninfo.php:18

References $key, and assQuestionGUI\$tpl.

◆ getCommand()

assLongMenuGUI::getCommand (   $cmd)

Reimplemented from assQuestionGUI.

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

62 {
63 return $cmd;
64 }

◆ getLongMenuTextWithInputFieldsInsteadOfGaps()

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

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

539 {
540 $return_value = '';
541 $text_array = preg_split("/\\[" . assLongMenu::GAP_PLACEHOLDER . " (\\d+)\\]/", $this->object->getLongMenuTextValue());
542 $correct_answers = $this->object->getCorrectAnswers();
543 $answers = $this->object->getAnswers();
544 foreach ($text_array as $key => $value) {
545 $answer_is_correct = false;
546 $user_value = '';
547 $return_value .= $value;
548 if ($key < sizeof($text_array) - 1) {
549 if ($correct_answers[$key][2] == assLongMenu::ANSWER_TYPE_TEXT_VAL) {
550 if (array_key_exists($key, $user_solution)) {
551 $user_value = $user_solution[$key];
552 if (in_array($user_value, $correct_answers[$key][0])) {
553 $answer_is_correct = true;
554 }
555 }
556
557 $return_value .= $this->getTextGapTemplate($key, $user_value, $solution, $answer_is_correct, $graphical);
558 } elseif ($correct_answers[$key][2] == assLongMenu::ANSWER_TYPE_SELECT_VAL) {
559 if (array_key_exists($key, $user_solution)) {
560 $user_value = $user_solution[$key];
561 if (in_array($user_value, $correct_answers[$key][0])) {
562 $answer_is_correct = true;
563 }
564 }
565 $return_value .= $this->getSelectGapTemplate($key, $answers[$key], $user_value, $solution, $answer_is_correct, $graphical);
566 }
567 }
568 }
569 return $return_value;
570 }
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 $key, 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 314 of file class.assLongMenuGUI.php.

315 {
316 $user_solution = is_object($this->getPreviewSession()) ? (array) $this->getPreviewSession()->getParticipantsSolution() : array();
317 $user_solution = array_values($user_solution);
318
319 include_once "./Services/UICore/classes/class.ilTemplate.php";
320 $template = new ilTemplate("tpl.il_as_qpl_longmenu_output.html", true, true, "Modules/TestQuestionPool");
321
322 $question_text = $this->object->getQuestion();
323 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, true));
324 $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
325 $template->setVariable('AUTOCOMPLETE_LENGTH', $this->object->getMinAutoComplete());
326 $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
327
328 $question_output = $template->get();
329 if (!$show_question_only) {
330 $question_output = $this->getILIASPage($question_output);
331 }
332 return $question_output;
333 }
getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution=array(), $solution=false, $graphical=false)
getILIASPage($html="")
Returns the ILIAS Page around a question.
$template

References $template, 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 594 of file class.assLongMenuGUI.php.

595 {
596 $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_select_gap.html", true, true, "Modules/TestQuestionPool");
597 $tpl->setVariable('KEY', $key);
598 if ($solution) {
599 $tpl->setVariable('DISABLED', 'disabled');
600 $tpl->setVariable('JS_IGNORE', '_ignore');
601 $tpl->setCurrentBlock('best_solution');
602 if ($user_value == -1) {
603 $tpl->setVariable("SOLUTION", $this->lng->txt("please_select"));
604 } else {
605 $tpl->setVariable('SOLUTION', $user_value);
606 }
607 if ($graphical) {
608 if ($ok) {
609 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
610 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
611 } else {
612 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
613 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
614 }
615 }
616 $tpl->parseCurrentBlock();
617 } else {
618 $tpl->setVariable("PLEASE_SELECT", $this->lng->txt("please_select"));
619 foreach ($answers as $value) {
620 $tpl->setCurrentBlock('select_option');
621 $tpl->setVariable('VALUE', $value);
622 if ($value == $user_value) {
623 $tpl->setVariable('SELECTED', 'selected');
624 }
625 $tpl->parseCurrentBlock();
626 }
627 }
628 return $tpl->get();
629 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $key, $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 257 of file class.assLongMenuGUI.php.

267 {
268 include_once "./Services/UICore/classes/class.ilTemplate.php";
269 $template = new ilTemplate("tpl.il_as_qpl_lome_question_output_solution.html", true, true, "Modules/TestQuestionPool");
270
271 if ($show_question_text) {
272 $question_text = $this->object->getQuestion();
273 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, true));
274 }
275 if (($active_id > 0) && (!$show_correct_solution)) {
276 $correct_solution = $this->getUserSolution($active_id, $pass);
277 } else {
278 $correct_solution = $this->object->getCorrectAnswersForQuestionSolution($this->object->getId());
279 }
280 $template->setVariable('LONGMENU_TEXT_SOLUTION', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($correct_solution, true, $graphicalOutput));
281 $solution_template = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
282 $question_output = $template->get();
283 $feedback = '';
284 if ($show_feedback) {
285 if (!$this->isTestPresentationContext()) {
286 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
287 $feedback .= strlen($fb) ? $fb : '';
288 }
289
290 $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
291 $feedback .= strlen($fb) ? $fb : '';
292 }
293 if (strlen($feedback)) {
294 $cssClass = (
295 $this->hasCorrectSolution($active_id, $pass) ?
297 );
298
299 $solution_template->setVariable("ILC_FB_CSS_CLASS", $cssClass);
300 $solution_template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
301 }
302
303 $solution_template->setVariable("SOLUTION_OUTPUT", $question_output);
304
305 $solution_output = $solution_template->get();
306
307 if (!$show_question_only) {
308 $solution_output = $this->getILIASPage($solution_output);
309 }
310
311 return $solution_output;
312 }
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, $template, 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 459 of file class.assLongMenuGUI.php.

460 {
461 if (!$this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0)) {
462 return '';
463 }
464
465 $feedback = '<table class="test_specific_feedback"><tbody>';
466 $gaps = $this->object->getCorrectAnswers();
467 foreach ($gaps as $index => $answer) {
468 $caption = assLongMenu::GAP_PLACEHOLDER . ' ';
469 $caption .= $index + 1 . ': ';
470
471 $feedback .= '<tr><td>';
472
473 $feedback .= $caption . '</td><td>';
474 $feedback .= $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
475 $this->object->getId(),
476 $index
477 ) . '</td> </tr>';
478 }
479 $feedback .= '</tbody></table>';
480 return $this->object->prepareTextareaOutput($feedback, true);
481 }
$index
Definition: metadata.php:60

References $index, and 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 337 of file class.assLongMenuGUI.php.

345 {
346 $user_solution = array();
347 if ($active_id) {
348 $solutions = null;
349 include_once "./Modules/Test/classes/class.ilObjTest.php";
350 if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
351 if (is_null($pass)) {
352 $pass = ilObjTest::_getPass($active_id);
353 }
354 }
355 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
356 foreach ($solutions as $idx => $solution_value) {
357 $user_solution[$solution_value["value1"]] = $solution_value["value2"];
358 }
359 }
360
361 // generate the question output
362 include_once "./Services/UICore/classes/class.ilTemplate.php";
363 $template = new ilTemplate("tpl.il_as_qpl_longmenu_output.html", true, true, "Modules/TestQuestionPool");
364
365 $question_text = $this->object->getQuestion();
366 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, true));
367 $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
368 $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
369 $template->setVariable('AUTOCOMPLETE_LENGTH', $this->object->getMinAutoComplete());
370 $question_output = $template->get();
371 $page_output = $this->outQuestionPage("", $is_postponed, $active_id, $question_output);
372 return $page_output;
373 }
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, $template, 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 572 of file class.assLongMenuGUI.php.

573 {
574 $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_text_gap.html", true, true, "Modules/TestQuestionPool");
575 if ($solution) {
576 $tpl->setVariable('DISABLED', 'disabled');
577 $tpl->setVariable('JS_IGNORE', '_ignore');
578 if ($graphical) {
579 if ($ok) {
580 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
581 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
582 } else {
583 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
584 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
585 }
586 }
587 }
588 $tpl->setVariable('VALUE', $value);
589 $tpl->setVariable('KEY', $key);
590
591 return $tpl->get();
592 }

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

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

240 {
241 return $form;
242 }

References $form.

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

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

References $_POST, $form, assQuestionGUI\$tpl, ilObjAdvancedEditing\_getUsedHTMLTags(), 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 381 of file class.assLongMenuGUI.php.

382 {
383 $this->ilTabs->clearTargets();
384
385 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
386 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
387 $q_type = $this->object->getQuestionType();
388
389 if (strlen($q_type)) {
390 $classname = $q_type . "GUI";
391 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
392 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
393 }
394
395 if ($_GET["q_id"]) {
396 if ($this->rbacsystem->checkAccess('write', $_GET["ref_id"])) {
397 // edit page
398 $this->ilTabs->addTarget(
399 "edit_page",
400 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
401 array("edit", "insert", "exec_pg"),
402 "",
403 "",
404 $force_active
405 );
406 }
407
408 $this->addTab_QuestionPreview($this->ilTabs);
409 }
410
411 $force_active = false;
412 if ($this->rbacsystem->checkAccess('write', $_GET["ref_id"])) {
413 $url = "";
414 if ($classname) {
415 $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
416 }
417 $commands = $_POST["cmd"];
418 if (is_array($commands)) {
419 foreach ($commands as $key => $value) {
420 if (preg_match("/^delete_.*/", $key, $matches)) {
421 $force_active = true;
422 }
423 }
424 }
425 // edit question properties
426 $this->ilTabs->addTarget(
427 "edit_question",
428 $url,
429 array("editQuestion", "save", "saveEdit", "addkvp", "removekvp", "originalSyncForm"),
430 $classname,
431 "",
432 $force_active
433 );
434 }
435
436 // add tab for question feedback within common class assQuestionGUI
437 $this->addTab_QuestionFeedback($this->ilTabs);
438
439 // add tab for question hint within common class assQuestionGUI
440 $this->addTab_QuestionHints($this->ilTabs);
441
442 // add tab for question's suggested solution within common class assQuestionGUI
443 $this->addTab_SuggestedSolution($this->ilTabs, $classname);
444
445 // Assessment of questions sub menu entry
446 if ($_GET["q_id"]) {
447 $this->ilTabs->addTarget(
448 "statistics",
449 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
450 array("assessment"),
451 $classname,
452 ""
453 );
454 }
455
456 $this->addBackTab($this->ilTabs);
457 }
$_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

References $_GET, $_POST, $key, $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 69 of file class.assLongMenuGUI.php.

70 {
71 $form = $this->buildEditForm();
72 $form->setValuesByPost();
75 $custom_check = $this->object->checkQuestionCustomPart();
76 if (!$form->checkInput() || !$custom_check) {
77 if (!$custom_check) {
78 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
79 }
80 $this->editQuestion($form);
81 return 1;
82 }
84 return 0;
85 }
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 $form, 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 87 of file class.assLongMenuGUI.php.

88 {
89 $this->object->setLongMenuTextValue(ilUtil::stripSlashesRecursive($_POST['longmenu_text']));
90 $this->object->setAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_text_files'])));
91 $this->object->setCorrectAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_correct_answers'])));
92 $this->object->setAnswerType(ilUtil::stripSlashesRecursive($_POST['long_menu_type']));
93 $this->object->setQuestion($_POST['question']);
94 $this->object->setLongMenuTextValue($_POST["longmenu_text"]);
95 $this->object->setMinAutoComplete((int) $_POST["min_auto_complete"]);
97 }
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 18 of file class.assLongMenuGUI.php.

Referenced by __construct().

◆ $lng

assLongMenuGUI::$lng

Definition at line 19 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: