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

Data Fields

 $ilTabs
 
 $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)
 {} More...
 
 editQuestion (ilPropertyFormGUI $form=null)
 
 buildEditForm ()
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_QuestionPreview (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 buildEditForm ()
 

Private Member Functions

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

Private Attributes

 $rbacsystem
 

Additional Inherited Members

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

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

assLongMenuGUI::__construct (   $id = -1)

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

References $ilTabs, $lng, and $rbacsystem.

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  }

Member Function Documentation

◆ buildEditForm()

assLongMenuGUI::buildEditForm ( )
protected
Returns
ilPropertyFormGUI

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

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

Referenced by editQuestion(), and writePostData().

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

◆ editQuestion()

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

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

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

Referenced by writePostData().

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

◆ getAfterParticipationSuppressionQuestionPostVars()

assLongMenuGUI::getAfterParticipationSuppressionQuestionPostVars ( )

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

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

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

Returns
string[]

Implements ilGuiQuestionScoringAdjustable.

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

References array.

513  {
514  return array();
515  }
Create styles array
The data for the language used.

◆ getAggregatedAnswersView()

assLongMenuGUI::getAggregatedAnswersView (   $relevant_answers)

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

Parameters
array$relevant_answers
Returns
string

Implements ilGuiQuestionScoringAdjustable.

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

References assQuestionGUI\$tpl, array, and object.

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

◆ getCommand()

assLongMenuGUI::getCommand (   $cmd)

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

References $cmd.

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

◆ getLongMenuTextWithInputFieldsInsteadOfGaps()

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

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

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

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

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

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

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

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

◆ getSelectGapTemplate()

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

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

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

Referenced by getLongMenuTextWithInputFieldsInsteadOfGaps().

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

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

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

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

◆ getSpecificFeedbackOutput()

assLongMenuGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

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

References assLongMenu\GAP_PLACEHOLDER, and object.

Referenced by getSolutionOutput().

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

◆ getTestOutput()

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

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

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

367  {
368  $user_solution = array();
369  if ($active_id)
370  {
371  $solutions = NULL;
372  include_once "./Modules/Test/classes/class.ilObjTest.php";
373  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
374  {
375  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
376  }
377  $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
378  foreach ($solutions as $idx => $solution_value)
379  {
380  $user_solution[$solution_value["value1"]] = $solution_value["value2"];
381  }
382  }
383 
384  // generate the question output
385  include_once "./Services/UICore/classes/class.ilTemplate.php";
386  $template = new ilTemplate("tpl.il_as_qpl_longmenu_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
387 
388  $question_text = $this->object->getQuestion();
389  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, TRUE));
390  $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
391  $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
392  $template->setVariable('AUTOCOMPLETE_LENGTH',$this->object->getMinAutoComplete());
393  $question_output = $template->get();
394  $page_output = $this->outQuestionPage("", $is_postponed, $active_id, $question_output);
395  return $page_output;
396  }
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution=array(), $solution=false, $graphical=false)
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
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.
+ Here is the call graph for this function:

◆ getTextGapTemplate()

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

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

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

Referenced by getLongMenuTextWithInputFieldsInsteadOfGaps().

608  {
609  $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_text_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
610  if($solution)
611  {
612  $tpl->setVariable('DISABLED', 'disabled');
613  $tpl->setVariable('JS_IGNORE', '_ignore');
614  if($graphical)
615  {
616  if($ok)
617  {
618  $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
619  $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
620  }
621  else
622  {
623  $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
624  $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
625  }
626  }
627  }
628  $tpl->setVariable('VALUE', $value);
629  $tpl->setVariable('KEY', $key);
630 
631  return $tpl->get();
632  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
+ 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.

References $pass, and array.

Referenced by getSolutionOutput().

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

◆ populateAnswerSpecificFormPart()

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

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

Referenced by buildEditForm().

253  {
254  return $form;
255  }
+ Here is the caller graph for this function:

◆ populateQuestionSpecificFormPart()

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

Implements ilGuiQuestionScoringAdjustable.

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

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, assLongMenu\MIN_LENGTH_AUTOCOMPLETE, object, and ilFormPropertyGUI\setRequired().

Referenced by buildEditForm().

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

public

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

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

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

◆ writePostData()

assLongMenuGUI::writePostData (   $always = false)
protected

{}

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

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

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

◆ writeQuestionSpecificPostData()

assLongMenuGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

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

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

Implements ilGuiQuestionScoringAdjustable.

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

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

Referenced by writePostData().

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

Field Documentation

◆ $ilTabs

assLongMenuGUI::$ilTabs

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: