ILIAS  release_7 Revision v7.30-3-g800a261c036
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)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 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)
 
 getSpecificFeedbackOutput ($userSolution)
 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)
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevant_answers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 execute command More...
 
 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 (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 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="", $inlineFeedbackEnabled=false)
 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 ($userSolution)
 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)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 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 ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 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
 
 $request
 
 $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...
 
 trimArrayRecursive (array $data)
 
 editQuestion (ilPropertyFormGUI $form=null)
 
 buildEditForm ()
 
- Protected Member Functions inherited from assQuestionGUI
 hasSpecialQuestionCommands ()
 
 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)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 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_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 addSaveOnEnterOnLoadCode ()
 

Private Member Functions

 verifyAnswerOptions ()
 
 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
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
 $ctrl
 
 $editForm
 
 $use_intermediate_solution = false
 

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 {
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 $DIC;
30 $rbacsystem = $DIC['rbacsystem'];
31 $ilTabs = $DIC['ilTabs'];
32 $lng = $DIC['lng'];
33 $this->rbacsystem = $rbacsystem;
34 $this->ilTabs = $ilTabs;
35 $this->lng = $lng;
36 }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, $ilTabs, $lng, $rbacsystem, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildEditForm()

assLongMenuGUI::buildEditForm ( )
protected
Returns
ilPropertyFormGUI

Reimplemented from assQuestionGUI.

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

148 {
149 $form = $this->buildBasicEditFormObject();
150
151 $this->addQuestionFormCommandButtons($form);
152
153 $this->addBasicQuestionFormProperties($form);
154
156 $this->populateAnswerSpecificFormPart($form);
157
158 $this->populateTaxonomyFormSection($form);
159
160 return $form;
161 }
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 134 of file class.assLongMenuGUI.php.

135 {
136 if ($form === null) {
137 $form = $this->buildEditForm();
138 }
139
140 $this->getQuestionTemplate();
141
142 $this->tpl->setVariable("QUESTION_DATA", $this->ctrl->getHTML($form));
143 }
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 473 of file class.assLongMenuGUI.php.

474 {
475 return array();
476 }

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

487 {
488 $overview = array();
489 $aggregation = array();
490 foreach ($relevant_answers as $answer) {
491 $overview[$answer['active_fi']][$answer['pass']][$answer['value1']] = $answer['value2'];
492 }
493
494 foreach ($overview as $active) {
495 foreach ($active as $answer) {
496 foreach ($answer as $option => $value) {
497 $aggregation[$option][$value] = $aggregation[$option][$value] + 1;
498 }
499 }
500 }
501 $tpl = new ilTemplate('tpl.il_as_aggregated_longmenu_question_answers_table.html', true, true, "Modules/TestQuestionPool");
502 $json = json_decode($this->object->getJsonStructure());
503 foreach ($json as $key => $value) {
504 $tpl->setVariable('TITLE', 'Longmenu ' . ($key + 1));
505 if (array_key_exists($key, $aggregation)) {
506 $aggregate = $aggregation[$key];
507 foreach ($aggregate as $answer => $counts) {
508 $tpl->setVariable('OPTION', $answer);
509 $tpl->setVariable('COUNT', $counts);
510 $tpl->parseCurrentBlock();
511 }
512 }
513 }
514
515 return $tpl->get();
516 }
special template class to simplify handling of ITX/PEAR

References assQuestionGUI\$tpl.

◆ getAnswerFrequencyTableGUI()

assLongMenuGUI::getAnswerFrequencyTableGUI (   $parentGui,
  $parentCmd,
  $relevantAnswers,
  $questionIndex 
)
Parameters
$parentGui
$parentCmd
$relevantAnswers
$questionIndex
Returns
ilAnswerFrequencyStatisticTableGUI

Reimplemented from assQuestionGUI.

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

644 {
645 global $DIC; /* @var ILIAS\DI\Container $DIC */
646
647 $table = parent::getAnswerFrequencyTableGUI(
648 $parentGui,
649 $parentCmd,
650 $relevantAnswers,
651 $questionIndex
652 );
653
654 $table->setTitle(sprintf(
655 $DIC->language()->txt('tst_corrections_answers_tbl_subindex'),
656 $DIC->language()->txt('longmenu') . ' ' . ($questionIndex + 1)
657 ));
658
659 return $table;
660 }

References $DIC.

◆ getAnswersFrequency()

assLongMenuGUI::getAnswersFrequency (   $relevant_answers,
  $questionIndex 
)

Reimplemented from assQuestionGUI.

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

621 {
622 $answers = [];
623
624 foreach ($relevant_answers as $row) {
625 if ($row['value1'] != $questionIndex) {
626 continue;
627 }
628
629 if (!isset($answers[$row['value2']])) {
630 //$label = $this->getAnswerTextLabel($row['value1'], $row['value2']);
631
632 $answers[$row['value2']] = array(
633 'answer' => $row['value2'], 'frequency' => 0
634 );
635 }
636
637 $answers[$row['value2']]['frequency']++;
638 }
639
640 return $answers;
641 }

◆ getCommand()

assLongMenuGUI::getCommand (   $cmd)

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

66 {
67 return $cmd;
68 }

◆ getLongMenuTextWithInputFieldsInsteadOfGaps()

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

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

519 {
520 $return_value = '';
521 $text_array = preg_split("/\\[" . assLongMenu::GAP_PLACEHOLDER . " (\\d+)\\]/", $this->object->getLongMenuTextValue());
522 $correct_answers = $this->object->getCorrectAnswers();
523 $answers = $this->object->getAnswers();
524 foreach ($text_array as $key => $value) {
525 $answer_is_correct = false;
526 $user_value = '';
527 $return_value .= $this->object->prepareTextareaOutput($value, true);
528 if ($key < sizeof($text_array) - 1) {
529 if (!array_key_exists($key, $correct_answers)) {
530 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('longmenu_answeroptions_differ'));
531 continue;
532 }
533 if ($correct_answers[$key][2] == assLongMenu::ANSWER_TYPE_TEXT_VAL) {
534 if (array_key_exists($key, $user_solution)) {
535 $user_value = $user_solution[$key];
536 if (in_array($user_value, $correct_answers[$key][0])) {
537 $answer_is_correct = true;
538 }
539 }
540
541 $return_value .= $this->getTextGapTemplate($key, $user_value, $solution, $answer_is_correct, $graphical);
542 } elseif ($correct_answers[$key][2] == assLongMenu::ANSWER_TYPE_SELECT_VAL) {
543 if (array_key_exists($key, $user_solution)) {
544 $user_value = $user_solution[$key];
545 if (in_array($user_value, $correct_answers[$key][0])) {
546 $answer_is_correct = true;
547 }
548 }
549 $return_value .= $this->getSelectGapTemplate($key, $answers[$key], $user_value, $solution, $answer_is_correct, $graphical);
550 }
551 }
552 }
553 return $return_value;
554 }
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 377 of file class.assLongMenuGUI.php.

378 {
379 $user_solution = is_object($this->getPreviewSession()) ? (array) $this->getPreviewSession()->getParticipantsSolution() : array();
380 $user_solution = array_values($user_solution);
381
382 include_once "./Services/UICore/classes/class.ilTemplate.php";
383 $template = new ilTemplate("tpl.il_as_qpl_longmenu_question_output.html", true, true, "Modules/TestQuestionPool");
384
385 $question_text = $this->object->getQuestion();
386 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
387 $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
388 $template->setVariable('AUTOCOMPLETE_LENGTH', $this->object->getMinAutoComplete());
389 $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
390
391 $question_output = $template->get();
392 if (!$show_question_only) {
393 $question_output = $this->getILIASPage($question_output);
394 }
395 return $question_output;
396 }
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 578 of file class.assLongMenuGUI.php.

579 {
580 $tpl = new ilTemplate("tpl.il_as_qpl_longmenu_question_select_gap.html", true, true, "Modules/TestQuestionPool");
581 $tpl->setVariable('KEY', $key);
582 if ($solution) {
583 $tpl->setVariable('DISABLED', 'disabled');
584 $tpl->setVariable('JS_IGNORE', '_ignore');
585 $tpl->setCurrentBlock('best_solution');
586 if ($user_value == -1) {
587 $tpl->setVariable("SOLUTION", $this->lng->txt("please_select"));
588 } else {
589 $tpl->setVariable('SOLUTION', $user_value);
590 }
591 if ($graphical) {
592 if ($ok) {
593 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
594 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
595 } else {
596 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
597 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
598 }
599 }
600 $tpl->parseCurrentBlock();
601 } else {
602 $tpl->setVariable("PLEASE_SELECT", $this->lng->txt("please_select"));
603 foreach ($answers as $value) {
604 $tpl->setCurrentBlock('select_option');
605 $tpl->setVariable('VALUE', $value);
606 if ($value == $user_value) {
607 $tpl->setVariable('SELECTED', 'selected');
608 }
609 $tpl->parseCurrentBlock();
610 }
611 }
612 return $tpl->get();
613 }
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 321 of file class.assLongMenuGUI.php.

331 {
332 include_once "./Services/UICore/classes/class.ilTemplate.php";
333 $template = new ilTemplate("tpl.il_as_qpl_longmenu_question_output_solution.html", true, true, "Modules/TestQuestionPool");
334
335 if ($show_question_text) {
336 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
337 }
338 if (($active_id > 0) && (!$show_correct_solution)) {
339 $correct_solution = $this->getUserSolution($active_id, $pass);
340 } else {
341 $correct_solution = $this->object->getCorrectAnswersForQuestionSolution($this->object->getId());
342 }
343 $template->setVariable('LONGMENU_TEXT_SOLUTION', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($correct_solution, true, $graphicalOutput));
344 $solution_template = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
345 $question_output = $template->get();
346 $feedback = '';
347 if ($show_feedback) {
348 if (!$this->isTestPresentationContext()) {
349 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
350 $feedback .= strlen($fb) ? $fb : '';
351 }
352
353 $fb = $this->getSpecificFeedbackOutput(array());
354 $feedback .= strlen($fb) ? $fb : '';
355 }
356 if (strlen($feedback)) {
357 $cssClass = (
358 $this->hasCorrectSolution($active_id, $pass) ?
360 );
361
362 $solution_template->setVariable("ILC_FB_CSS_CLASS", $cssClass);
363 $solution_template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
364 }
365
366 $solution_template->setVariable("SOLUTION_OUTPUT", $question_output);
367
368 $solution_output = $solution_template->get();
369
370 if (!$show_question_only) {
371 $solution_output = $this->getILIASPage($solution_output);
372 }
373
374 return $solution_output;
375 }
getUserSolution($active_id, $pass)
getSpecificFeedbackOutput($userSolution)
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 (   $userSolution)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
array$userSolution($userSolution[<value1>] = <value2>)
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

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

439 {
440 if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
441 return '';
442 }
443
444 $feedback = '<table class="test_specific_feedback"><tbody>';
445 $gaps = $this->object->getCorrectAnswers();
446 foreach ($gaps as $index => $answer) {
447 $caption = assLongMenu::GAP_PLACEHOLDER . ' ';
448 $caption .= $index + 1 . ': ';
449
450 $feedback .= '<tr><td>';
451
452 $feedback .= $caption . '</td><td>';
453 $feedback .= $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
454 $this->object->getId(),
455 0,
456 $index
457 ) . '</td> </tr>';
458 }
459 $feedback .= '</tbody></table>';
460 return $this->object->prepareTextareaOutput($feedback, true);
461 }
$index
Definition: metadata.php:128

References $index, and assLongMenu\GAP_PLACEHOLDER.

Referenced by getSolutionOutput().

+ Here is the caller graph for this function:

◆ getSubQuestionsIndex()

assLongMenuGUI::getSubQuestionsIndex ( )

Reimplemented from assQuestionGUI.

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

616 {
617 return array_keys($this->object->getAnswers());
618 }

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

408 {
409 $user_solution = array();
410 if ($active_id) {
411 $solutions = null;
412 include_once "./Modules/Test/classes/class.ilObjTest.php";
413 if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
414 if (is_null($pass)) {
415 $pass = ilObjTest::_getPass($active_id);
416 }
417 }
418 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
419 foreach ($solutions as $idx => $solution_value) {
420 $user_solution[$solution_value["value1"]] = $solution_value["value2"];
421 }
422 }
423
424 // generate the question output
425 include_once "./Services/UICore/classes/class.ilTemplate.php";
426 $template = new ilTemplate("tpl.il_as_qpl_longmenu_question_output.html", true, true, "Modules/TestQuestionPool");
427
428 $question_text = $this->object->getQuestion();
429 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
430 $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
431 $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
432 $template->setVariable('AUTOCOMPLETE_LENGTH', $this->object->getMinAutoComplete());
433 $question_output = $template->get();
434 $page_output = $this->outQuestionPage("", $is_postponed, $active_id, $question_output);
435 return $page_output;
436 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
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 556 of file class.assLongMenuGUI.php.

557 {
558 $tpl = new ilTemplate("tpl.il_as_qpl_longmenu_question_text_gap.html", true, true, "Modules/TestQuestionPool");
559 if ($solution) {
560 $tpl->setVariable('DISABLED', 'disabled');
561 $tpl->setVariable('JS_IGNORE', '_ignore');
562 if ($graphical) {
563 if ($ok) {
564 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
565 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
566 } else {
567 $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
568 $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
569 }
570 }
571 }
572 $tpl->setVariable('VALUE', $value);
573 $tpl->setVariable('KEY', $key);
574
575 return $tpl->get();
576 }

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

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

References $pass, and assQuestionGUI\getUseIntermediateSolution().

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

294 {
295 return $form;
296 }

Referenced by buildEditForm().

+ Here is the caller graph for this function:

◆ populateCorrectionsFormProperties()

assLongMenuGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

Reimplemented from assQuestionGUI.

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

663 {
664 $correctAnswers = $this->object->getCorrectAnswers();
665
666 foreach ($this->object->getAnswers() as $lmIndex => $lm) {
667 $lmValues = array(
668 'answers_all' => array(0 => $lm),
669 'answers_all_count' => count($lm),
670 'answers_correct' => $correctAnswers[$lmIndex][0]
671 );
672
673 $lmPoints = $correctAnswers[$lmIndex][1];
674
676 $section->setTitle($this->lng->txt('longmenu') . ' ' . ($lmIndex + 1));
677 $form->addItem($section);
678
680 $this->lng->txt('answers'),
681 'longmenu_' . $lmIndex
682 );
683
684 $lmInput->setRequired(true);
685
686 $lmInput->setValues($lmValues);
687
688 $form->addItem($lmInput);
689
690 $pointsInp = new ilNumberInputGUI($this->lng->txt("points"), 'points_' . $lmIndex);
691 $pointsInp->setRequired(true);
692 $pointsInp->allowDecimals(true);
693 $pointsInp->setSize(4);
694 $pointsInp->setMinValue(0);
695 $pointsInp->setMinvalueShouldBeGreater(false);
696 $pointsInp->setValue($lmPoints);
697 $form->addItem($pointsInp);
698 }
699 }
$section
Definition: Utf8Test.php:83
This class represents a section header in a property form.
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).

References $section, and ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

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

Implements ilGuiQuestionScoringAdjustable.

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

167 {
168 $long_menu_text = new ilTextAreaInputGUI($this->lng->txt("longmenu_text"), 'longmenu_text');
169 $long_menu_text->setRequired(true);
170 //$long_menu_text->setInfo($this->lng->txt("longmenu_hint"));
171 $long_menu_text->setRows(10);
172 $long_menu_text->setCols(80);
173 if (!$this->object->getSelfAssessmentEditingMode()) {
174 if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_RTE) {
175 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
176 $long_menu_text->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
177 $long_menu_text->addPlugin("latex");
178 $long_menu_text->addButton("latex");
179 $long_menu_text->addButton("pastelatex");
180 $long_menu_text->setRTESupport($this->object->getId(), "qpl", "assessment");
181 $long_menu_text->setUseRte(true);
182 }
183 } else {
184 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
186 $long_menu_text->setUseTagsForRteOnly(false);
187 }
188
189 $long_menu_text->setValue($this->object->getLongMenuTextValue());
190 $form->addItem($long_menu_text);
191
192 $tpl = new ilTemplate("tpl.il_as_qpl_longmenu_question_gap_button_code.html", true, true, "Modules/TestQuestionPool");
193 $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
194 $tpl->parseCurrentBlock();
195 $button = new ilCustomInputGUI('&nbsp;', '');
196 $button->setHtml($tpl->get());
197 $form->addItem($button);
198
199 require_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
200 $modal = ilModalGUI::getInstance();
201 $modal->setHeading('');
202 $modal->setId("ilGapModal");
203 //$modal->setBackdrop(ilModalGUI::BACKDROP_OFF);
204 $modal->setBody('');
205
206 $min_auto_complete = new ilNumberInputGUI($this->lng->txt("min_auto_complete"), 'min_auto_complete');
207
208 $auto_complete = $this->object->getMinAutoComplete();
209 if ($auto_complete == 0) {
211 }
212 $min_auto_complete->setValue($auto_complete);
213 $min_auto_complete->setMinValue(1);
214 $min_auto_complete->setMaxValue(99);
215 $min_auto_complete->setSize(5);
216 $form->addItem($min_auto_complete);
217 // identical scoring
218 $identical_scoring = new ilCheckboxInputGUI($this->lng->txt("identical_scoring"), "identical_scoring");
219 $identical_scoring->setValue(1);
220 $identical_scoring->setChecked($this->object->getIdenticalScoring());
221 $identical_scoring->setInfo($this->lng->txt('identical_scoring_desc'));
222 $identical_scoring->setRequired(false);
223 $form->addItem($identical_scoring);
224 $hidden_text = new ilHiddenInputGUI('hidden_text_files');
225 $form->addItem($hidden_text);
226
227 $hidden_correct = new ilHiddenInputGUI('hidden_correct_answers');
228 $form->addItem($hidden_correct);
229
230 $long_menu_language = [
231 'edit' => '[' . $this->lng->txt('edit') . ']',
232 'type' => $this->lng->txt('type'),
233 'answers' => $this->lng->txt('answers'),
234 'answer_options' => $this->lng->txt('answer_options'),
235 'correct_answers' => $this->lng->txt('correct_answers'),
236 'add_answers' => '[' . $this->lng->txt('add_answers') . ']',
237 'manual_editing' => $this->lng->txt('manual_editing')
238 ];
239
240 $question_parts = [
241 'list' => json_decode($this->object->getJsonStructure()),
242 'gap_placeholder' => assLongMenu::GAP_PLACEHOLDER,
243 'last_updated_element' => 0,
244 'replacement_word' => '',
245 'filereader_usable' => false,
246 'max_input_fields' => assLongMenu::MAX_INPUT_FIELDS
247 ];
248 $answers = $this->object->getAnswersObject();
249
250 if (is_array($_POST) && array_key_exists('hidden_text_files', $_POST)) {
251 $question_parts['list'] = json_decode($_POST['hidden_correct_answers']);
252 $answers = $_POST['hidden_text_files'];
253 }
254
255 $this->tpl->addJavaScript('./Modules/TestQuestionPool/templates/default/longMenuQuestionGapBuilder.js');
256 $this->tpl->addJavaScript('./Modules/TestQuestionPool/templates/default/longMenuQuestion.js');
257 $tpl = new ilTemplate("tpl.il_as_qpl_longmenu_question_gap.html", true, true, "Modules/TestQuestionPool");
258 $tpl->setVariable('SELECT_BOX', $this->lng->txt('insert_gap'));
259 $tpl->setVariable("SELECT", $this->lng->txt('answers_select'));
260 $tpl->setVariable("TEXT", $this->lng->txt('answers_text_box'));
261 $tpl->setVariable("POINTS", $this->lng->txt('points'));
262 $tpl->setVariable("INFO_TEXT_UPLOAD", $this->lng->txt('info_text_upload'));
263 $tpl->setVariable("TXT_BROWSE", $this->lng->txt('select_file'));
264 $tpl->setVariable('POINTS_ERROR', $this->lng->txt('enter_enough_positive_points'));
265 $tpl->setVariable('AUTOCOMPLETE_ERROR', $this->lng->txt('autocomplete_error'));
266 $tpl->setVariable('MISSING_VALUE', $this->lng->txt('msg_input_is_required'));
267 $tpl->setVariable('SAVE', $this->lng->txt('save'));
268 $tpl->setVariable('CANCEL', $this->lng->txt('cancel'));
269 $tag_input = new ilTagInputGUI();
270 $tag_input->setTypeAhead(true);
271 $tag_input->setPostVar('taggable');
272 $tag_input->setJsSelfInit(false);
273 $tag_input->setTypeAheadMinLength(1);
274 $tpl->setVariable("TAGGING_PROTOTYPE", $tag_input->render(''));
275
276 $tpl->setVariable("MY_MODAL", $modal->getHTML());
277
278 $tpl->parseCurrentBlock();
279 $this->tpl->addOnLoadCode('longMenuQuestion.Init(' .
280 json_encode($long_menu_language) . ', ' .
281 json_encode($question_parts) . ', ' .
282 $answers . ');');
283 $button = new ilCustomInputGUI('&nbsp;', '');
284 $button->setHtml($tpl->get());
285 $form->addItem($button);
286 return $form;
287 }
$_POST["username"]
const MIN_LENGTH_AUTOCOMPLETE
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
constant for additional content editing mode "default"
static getSelfAssessmentTags()
Get tags allowed in question tags in self assessment mode.
This class represents a checkbox property in a property form.
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.
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, assQuestionGUI\$tpl, ilObjAdvancedEditing\_getUsedHTMLTags(), ilPropertyFormGUI\addItem(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, 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:

◆ saveCorrectionsFormProperties()

assLongMenuGUI::saveCorrectionsFormProperties ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

Reimplemented from assQuestionGUI.

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

705 {
706 $correctAnswers = $this->object->getCorrectAnswers();
707
708 foreach ($this->object->getAnswers() as $lmIndex => $lm) {
709 $pointsInput = (float) $form->getInput('points_' . $lmIndex);
710 $correctAnswersInput = (array) $form->getInput('longmenu_' . $lmIndex . '_tags');
711
712 foreach ($correctAnswersInput as $idx => $answer) {
713 if (in_array($answer, $lm)) {
714 continue;
715 }
716
717 unset($correctAnswersInput[$idx]);
718 }
719
720 $correctAnswersInput = array_values($correctAnswersInput);
721
722 $correctAnswers[$lmIndex][0] = $correctAnswersInput;
723 $correctAnswers[$lmIndex][1] = $pointsInput;
724 }
725
726 $this->object->setCorrectAnswers($correctAnswers);
727 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ supportsIntermediateSolutionOutput()

assLongMenuGUI::supportsIntermediateSolutionOutput ( )

Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution()

Returns
bool

Reimplemented from assQuestionGUI.

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

304 {
305 return true;
306 }

◆ trimArrayRecursive()

assLongMenuGUI::trimArrayRecursive ( array  $data)
protected

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

123 {
124 foreach ($data as $k => $v) {
125 if (is_array($v)) {
126 $data[$k] = $this->trimArrayRecursive($v);
127 } else {
128 $data[$k] = trim($v);
129 }
130 }
131 return $data;
132 }
trimArrayRecursive(array $data)
$data
Definition: storeScorm.php:23

References $data, and trimArrayRecursive().

Referenced by trimArrayRecursive(), and writeQuestionSpecificPostData().

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

◆ verifyAnswerOptions()

assLongMenuGUI::verifyAnswerOptions ( )
private

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

106 : bool
107 {
108 $longmenu_text = $_POST['longmenu_text'] ?? '';
109 $hidden_text_files = $_POST['hidden_text_files'] ?? '';
110 $answer_options_from_text = preg_split(
111 "/\\[" . assLongMenu::GAP_PLACEHOLDER . " (\\d+)\\]/",
112 $longmenu_text
113 );
114 $answer_options_from_files = json_decode(ilUtil::stripSlashes($hidden_text_files));
115 if (count($answer_options_from_text) - 1 !== count($answer_options_from_files)) {
116 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('longmenu_answeroptions_differ'));
117 return false;
118 }
119 return true;
120 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, assLongMenu\GAP_PLACEHOLDER, and ilUtil\stripSlashes().

Referenced by writePostData().

+ Here is the call graph for this function:
+ Here is the caller 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 73 of file class.assLongMenuGUI.php.

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

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

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

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: