ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
assImagemapQuestionGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assImagemapQuestionGUI:
+ Collaboration diagram for assImagemapQuestionGUI:

Public Member Functions

 __construct ($id=-1)
 assImagemapQuestionGUI constructor More...
 
 getCommand ($cmd)
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 editQuestion (ilPropertyFormGUI $form=null)
 
 populateAnswerSpecificFormPart (\ilPropertyFormGUI $form)
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 addRect ()
 
 addCircle ()
 
 addPoly ()
 
 saveShape ()
 Saves a shape of the area editor. More...
 
 areaEditor ($shape='')
 
 back ()
 
 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 (array $userSolution)
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView (array $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...
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 hasInlineFeedback ()
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 geCommentsPanelHTML ()
 
 executeCommand ()
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext (string $presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled (bool $previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose (string $renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext (string $editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI (?ilTestQuestionNavigationGUI $navigationGUI)
 
 setTaxonomyIds (array $taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder (\ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd (string $questionActionCmd)
 
 getQuestionActionCmd ()
 
 assessment ()
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 
 getILIASPage (string $html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 
 cancel ()
 
 originalSyncForm (string $return_to="", string $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 
 save ()
 
 saveReturn ()
 
 apply ()
 
 getContextPath ($cont_obj, int $a_endnode_id, int $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber (int $nr)
 
 getSequenceNumber ()
 
 setQuestionCount (int $a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage (string $errormessage)
 
 addErrorMessage (string $errormessage)
 
 outAdditionalOutput ()
 Why are you here? Some magic for plugins? More...
 
 getQuestionType ()
 
 getAsValueAttribute (string $a_value)
 
 addNewIdListener ($a_object, string $a_method, string $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners (int $a_new_id)
 
 addQuestionFormCommandButtons (ilPropertyFormGUI $form)
 
 addBasicQuestionFormProperties (ilPropertyFormGUI $form)
 
 getGenericFeedbackOutput (int $active_id, ?int $pass)
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput (array $userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 suggestedsolution ()
 
 outSolutionExplorer ()
 
 saveSuggestedSolutionType ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, string $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)
 
 renderSolutionOutput (mixed $user_solutions, int $active_id, int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest (string $formaction, int $active_id, ?int $pass, bool $is_question_postponed=false, $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFrequencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 isInLearningModuleContext ()
 
 setInLearningModuleContext (bool $flag)
 
 getAutoSavedSolutionOutput (int $active_id, int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
- Public Member Functions inherited from ilGuiAnswerScoringAdjustable
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 

Protected Member Functions

 deleteImage ()
 
 writePostData (bool $always=false)
 {} More...
 
 buildEditForm ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 buildAreaLinkTarget ($currentSelection, $areaIndex)
 
 buildSelectionParameter ($currentSelection, $areaIndex=null)
 
 renderAggregateView ($answeringFequencies)
 
 aggregateAnswers ($givenSolutionRows, $existingAnswerOptions)
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
- Protected Member Functions inherited from assQuestionGUI
 hasSpecialQuestionCommands ()
 
 writePostData (bool $always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm (ilPropertyFormGUI $form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 addNumberOfTriesToFormIfNecessary (ilPropertyFormGUI $form)
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 genericFeedbackOutputBuilder (string $feedback_correct, string $feedback_incorrect, int $active_id, ?int $pass)
 
 getTypeOptions ()
 
 createSuggestedSolutionLinkingTo (string $type, string $target)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 
 addTab_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 generateCorrectnessIconsForCorrectness (int $correctness)
 
 getSuggestedSolutionsRepo ()
 
 cleanupAnswerText (array $answer_text, bool $is_rte)
 sk - 12.05.2023: This is one more of those that we need, but don't want. More...
 
 addSaveOnEnterOnLoadCode ()
 

Private Attributes

 $linecolor
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI (string $question_type='', int $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants (string $guiClassName, string $cmdConstantNameBegin='CMD_')
 
static prepareTextareaOutput (?string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output where latex code may be in it If the text is HTML-free, CHR(13) will be converted to a line break. More...
 
- 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 CORRECTNESS_NOT_OK = 0
 
const CORRECTNESS_MOSTLY_OK = 1
 
const CORRECTNESS_OK = 2
 
const ALLOWED_PLAIN_TEXT_TAGS = "<em>, <strong>"
 sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI. More...
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
assQuestion $object
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
 $error
 
string $errormessage
 
int $sequence_no
 sequence number in test More...
 
int $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 Attributes inherited from assQuestionGUI
const SUGGESTED_SOLUTION_COMMANDS_CANCEL = 'cancelSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_SAVE = 'saveSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_DEFAULT = 'suggestedsolution'
 
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
ilLogger $logger
 
ILIAS TestQuestionPool QuestionInfoService $questioninfo
 
ILIAS Notes GUIService $notes_gui
 
ilCtrl $ctrl
 
Refinery $refinery
 
ilPropertyFormGUI $editForm
 
ILIAS TestQuestionPool InternalRequestService $request
 
bool $parent_type_is_lm = false
 
assQuestionSuggestedSolutionsDatabaseRepository $suggestedsolution_repo = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Image map question GUI representation

The assImagemapQuestionGUI class encapsulates the GUI representation for image map questions.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

assImagemapQuestionGUI: ilPropertyFormGUI, ilFormPropertyDispatchGUI

Definition at line 36 of file class.assImagemapQuestionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assImagemapQuestionGUI::__construct (   $id = -1)

assImagemapQuestionGUI constructor

The constructor takes possible arguments an creates an instance of the assImagemapQuestionGUI object.

Parameters
integer$idThe database id of a image map question object.

Definition at line 47 of file class.assImagemapQuestionGUI.php.

References $id, and ILIAS\MetaData\Repository\Validation\Data\__construct().

48  {
50  $this->object = new assImagemapQuestion();
51  if ($id >= 0) {
52  $this->object->loadFromDb($id);
53  }
54  $this->linecolor = '#' . (new ilSetting('assessment'))->get('imap_line_color') ?? 'FF0000';
55  }
__construct(VocabulariesInterface $vocabularies)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

Member Function Documentation

◆ addCircle()

assImagemapQuestionGUI::addCircle ( )

Definition at line 229 of file class.assImagemapQuestionGUI.php.

References areaEditor().

229  : void
230  {
231  $this->areaEditor('circle');
232  }
+ Here is the call graph for this function:

◆ addPoly()

assImagemapQuestionGUI::addPoly ( )

Definition at line 234 of file class.assImagemapQuestionGUI.php.

References areaEditor().

234  : void
235  {
236  $this->areaEditor('poly');
237  }
+ Here is the call graph for this function:

◆ addRect()

assImagemapQuestionGUI::addRect ( )

Definition at line 224 of file class.assImagemapQuestionGUI.php.

References areaEditor().

224  : void
225  {
226  $this->areaEditor('rect');
227  }
+ Here is the call graph for this function:

◆ aggregateAnswers()

assImagemapQuestionGUI::aggregateAnswers (   $givenSolutionRows,
  $existingAnswerOptions 
)
protected

Definition at line 846 of file class.assImagemapQuestionGUI.php.

Referenced by getAggregatedAnswersView(), and getAnswersFrequency().

846  : array
847  {
848  $answeringFequencies = array();
849 
850  foreach ($existingAnswerOptions as $answerIndex => $answerOption) {
851  $answeringFequencies[$answerIndex] = 0;
852  }
853 
854  foreach ($givenSolutionRows as $solutionRow) {
855  $answeringFequencies[$solutionRow['value1']]++;
856  }
857 
858  return $answeringFequencies;
859  }
+ Here is the caller graph for this function:

◆ areaEditor()

assImagemapQuestionGUI::areaEditor (   $shape = '')

Definition at line 266 of file class.assImagemapQuestionGUI.php.

References Vendor\Package\$c, $linecolor, ilImagemapPreview\addArea(), ILIAS\Repository\ctrl(), assQuestionGUI\getQuestionTemplate(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by addCircle(), addPoly(), and addRect().

266  : void
267  {
268  $shape = (strlen($shape)) ? $shape : $_POST['shape'];
269 
270  $this->getQuestionTemplate();
271 
272  $editorTpl = new ilTemplate('tpl.il_as_qpl_imagemap_question.html', true, true, 'Modules/TestQuestionPool');
273 
274  $coords = array();
275  $mapcoords = $this->request->raw('image');
276  if ($mapcoords != null && isset($mapcoords['mapcoords']) && is_array($mapcoords['mapcoords'])) {
277  foreach ($mapcoords['mapcoords'] as $value) {
278  array_push($coords, $value);
279  }
280  }
281  $cmd = $this->request->raw('cmd');
282  if ($cmd != null && array_key_exists('areaEditor', $cmd) && is_array($cmd['areaEditor']['image'])) {
283  array_push($coords, $cmd['areaEditor']['image'][0] . "," . $cmd['areaEditor']['image'][1]);
284  }
285  foreach ($coords as $value) {
286  $editorTpl->setCurrentBlock("hidden");
287  $editorTpl->setVariable("HIDDEN_NAME", 'image[mapcoords][]');
288  $editorTpl->setVariable("HIDDEN_VALUE", $value);
289  $editorTpl->parseCurrentBlock();
290  }
291 
292  $editorTpl->setCurrentBlock("hidden");
293  $editorTpl->setVariable("HIDDEN_NAME", 'shape');
294  $editorTpl->setVariable("HIDDEN_VALUE", $shape);
295  $editorTpl->parseCurrentBlock();
296 
297  $preview = new ilImagemapPreview($this->object->getImagePath() . $this->object->getImageFilename());
298  foreach ($this->object->answers as $index => $answer) {
299  $preview->addArea($index, $answer->getArea(), $answer->getCoords(), $answer->getAnswertext(), "", "", true, $this->linecolor);
300  }
301  $hidearea = false;
302  $disabled_save = " disabled=\"disabled\"";
303  $c = "";
304  switch ($shape) {
305  case "rect":
306  if (count($coords) == 0) {
307  $this->tpl->setOnScreenMessage('info', $this->lng->txt("rectangle_click_tl_corner"));
308  } elseif (count($coords) == 1) {
309  $this->tpl->setOnScreenMessage('info', $this->lng->txt("rectangle_click_br_corner"));
310  $preview->addPoint($preview->getAreaCount(), join(",", $coords), true, "blue");
311  } elseif (count($coords) == 2) {
312  $c = join(",", $coords);
313  $hidearea = true;
314  $disabled_save = "";
315  }
316  break;
317  case "circle":
318  if (count($coords) == 0) {
319  $this->tpl->setOnScreenMessage('info', $this->lng->txt("circle_click_center"));
320  } elseif (count($coords) == 1) {
321  $this->tpl->setOnScreenMessage('info', $this->lng->txt("circle_click_circle"));
322  $preview->addPoint($preview->getAreaCount(), join(",", $coords), true, "blue");
323  } elseif (count($coords) == 2) {
324  if (preg_match("/(\d+)\s*,\s*(\d+)\s+(\d+)\s*,\s*(\d+)/", $coords[0] . " " . $coords[1], $matches)) {
325  $c = "$matches[1],$matches[2]," . (int) sqrt((($matches[3] - $matches[1]) * ($matches[3] - $matches[1])) + (($matches[4] - $matches[2]) * ($matches[4] - $matches[2])));
326  }
327  $hidearea = true;
328  $disabled_save = "";
329  }
330  break;
331  case "poly":
332  if (count($coords) == 0) {
333  $this->tpl->setOnScreenMessage('info', $this->lng->txt("polygon_click_starting_point"));
334  } elseif (count($coords) == 1) {
335  $this->tpl->setOnScreenMessage('info', $this->lng->txt("polygon_click_next_point"));
336  $preview->addPoint($preview->getAreaCount(), implode(",", $coords), true, "blue");
337  } elseif (count($coords) > 1) {
338  $this->tpl->setOnScreenMessage('info', $this->lng->txt("polygon_click_next_or_save"));
339  $disabled_save = "";
340  $c = implode(",", $coords);
341  }
342  break;
343  }
344  if (strlen($c)) {
345  $preview->addArea($preview->getAreaCount(), $shape, $c, $_POST["shapetitle"] ?? '', "", "", true, "blue");
346  }
347  $preview->createPreview();
348  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename()) . "?img=" . time();
349  if (!$hidearea) {
350  $editorTpl->setCurrentBlock("maparea");
351  $editorTpl->setVariable("IMAGE_SOURCE", "$imagepath");
352  $editorTpl->setVariable("IMAGEMAP_NAME", "image");
353  $editorTpl->parseCurrentBlock();
354  } else {
355  $editorTpl->setCurrentBlock("imagearea");
356  $editorTpl->setVariable("IMAGE_SOURCE", "$imagepath");
357  $editorTpl->setVariable("ALT_IMAGE", $this->lng->txt("imagemap"));
358  $editorTpl->parseCurrentBlock();
359  }
360 
361  if (isset($_POST['shapetitle']) && $_POST['shapetitle'] != '') {
362  $editorTpl->setCurrentBlock("shapetitle");
363  $editorTpl->setVariable("VALUE_SHAPETITLE", $_POST["shapetitle"]);
364  $editorTpl->parseCurrentBlock();
365  }
366 
367  $editorTpl->setVariable("TEXT_IMAGEMAP", $this->lng->txt("imagemap"));
368  $editorTpl->setVariable("TEXT_SHAPETITLE", $this->lng->txt("ass_imap_hint"));
369  $editorTpl->setVariable("CANCEL", $this->lng->txt("cancel"));
370  $editorTpl->setVariable("SAVE", $this->lng->txt("save"));
371  $editorTpl->setVariable("DISABLED_SAVE", $disabled_save);
372  switch ($shape) {
373  case "rect":
374  $editorTpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this, 'addRect'));
375  break;
376  case 'circle':
377  $editorTpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this, 'addCircle'));
378  break;
379  case 'poly':
380  $editorTpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this, 'addPoly'));
381  break;
382  }
383 
384  $this->tpl->setVariable('QUESTION_DATA', $editorTpl->get());
385  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addArea( $index, $shape, $coords, $title="", $href="", $target="", $visible=true, $linecolor="red", $bordercolor="white", $fillcolor="#FFFFFFA0")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ back()

assImagemapQuestionGUI::back ( )

Definition at line 387 of file class.assImagemapQuestionGUI.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

387  : void
388  {
389  $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_cancel'), true);
390  $this->ctrl->redirect($this, 'editQuestion');
391  }
+ Here is the call graph for this function:

◆ buildAreaLinkTarget()

assImagemapQuestionGUI::buildAreaLinkTarget (   $currentSelection,
  $areaIndex 
)
protected

Definition at line 721 of file class.assImagemapQuestionGUI.php.

References ilUtil\appendUrlParameterString(), buildSelectionParameter(), ILIAS\Repository\ctrl(), assQuestionGUI\getQuestionActionCmd(), and assQuestionGUI\getTargetGuiClass().

Referenced by getTestOutput().

721  : string
722  {
723  $href = $this->ctrl->getLinkTargetByClass(
724  $this->getTargetGuiClass(),
725  $this->getQuestionActionCmd()
726  );
727 
729  $href,
730  $this->buildSelectionParameter($currentSelection, $areaIndex)
731  );
732 
733  return $href;
734  }
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
buildSelectionParameter($currentSelection, $areaIndex=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildEditForm()

assImagemapQuestionGUI::buildEditForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 151 of file class.assImagemapQuestionGUI.php.

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

Referenced by editQuestion(), and writePostData().

152  {
153  $form = $this->buildBasicEditFormObject();
154 
155  $this->addBasicQuestionFormProperties($form);
156  $this->populateQuestionSpecificFormPart($form);
157  $this->populateTaxonomyFormSection($form);
158  $this->addQuestionFormCommandButtons($form);
159 
160  return $form;
161  }
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildSelectionParameter()

assImagemapQuestionGUI::buildSelectionParameter (   $currentSelection,
  $areaIndex = null 
)
protected

Definition at line 736 of file class.assImagemapQuestionGUI.php.

References assQuestion\implodeKeyValues(), and ILIAS\Repository\object().

Referenced by buildAreaLinkTarget(), and getPreviousSolutionConfirmationCheckboxHtml().

736  : string
737  {
738  if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
739  $reuseSelection = array();
740 
741  if ($areaIndex === null) {
742  $reuseSelection = $currentSelection;
743  } elseif ($this->object->getIsMultipleChoice()) {
744  if (!in_array($areaIndex, $currentSelection)) {
745  $reuseSelection[] = $areaIndex;
746  }
747 
748  foreach (array_diff($currentSelection, array($areaIndex)) as $otherSelectedArea) {
749  $reuseSelection[] = $otherSelectedArea;
750  }
751  } else {
752  $reuseSelection[] = $areaIndex;
753  }
754 
755  $selection = assQuestion::implodeKeyValues($reuseSelection);
756  $action = 'reuseSelection';
757  } elseif ($areaIndex !== null) {
758  if (!$this->object->getIsMultipleChoice() || !in_array($areaIndex, $currentSelection)) {
759  $areaAction = 'selImage';
760  } else {
761  $areaAction = 'remImage';
762  }
763 
764  $selection = $areaIndex;
765  $action = $areaAction;
766  } else {
767  return '';
768  }
769 
770  return "{$action}={$selection}";
771  }
static implodeKeyValues(array $keyValues)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ completeTestOutputFormAction()

assImagemapQuestionGUI::completeTestOutputFormAction (   $formAction,
  $active_id,
  $pass 
)
protected

Definition at line 395 of file class.assImagemapQuestionGUI.php.

396  {
397  $info = $this->object->getTestOutputSolutions($active_id, $pass);
398 
399  if (count($info)) {
400  if ($info[0]['value1'] !== "") {
401  $formAction .= "&selImage=" . $info[0]['value1'];
402  }
403  }
404 
405  return $formAction;
406  }

◆ deleteImage()

assImagemapQuestionGUI::deleteImage ( )
protected

Definition at line 69 of file class.assImagemapQuestionGUI.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

69  : void
70  {
71  $this->object->deleteImage();
72  $this->object->saveToDb();
73  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
74  $this->ctrl->redirect($this, 'editQuestion');
75  }
+ Here is the call graph for this function:

◆ editQuestion()

assImagemapQuestionGUI::editQuestion ( ilPropertyFormGUI  $form = null)
Parameters
ilPropertyFormGUI | null$form

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

References buildEditForm(), ILIAS\Repository\ctrl(), and assQuestionGUI\getQuestionTemplate().

Referenced by writePostData().

166  : void
167  {
168  if (null === $form) {
169  $form = $this->buildEditForm();
170  }
171 
172  $this->getQuestionTemplate();
173 
174  $this->tpl->setVariable('QUESTION_DATA', $this->ctrl->getHTML($form));
175  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionAnswerPostVars()

assImagemapQuestionGUI::getAfterParticipationSuppressionAnswerPostVars ( )

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 ilGuiAnswerScoringAdjustable.

Definition at line 805 of file class.assImagemapQuestionGUI.php.

805  : array
806  {
807  return array();
808  }

◆ getAfterParticipationSuppressionQuestionPostVars()

assImagemapQuestionGUI::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 819 of file class.assImagemapQuestionGUI.php.

819  : array
820  {
821  return array();
822  }

◆ getAggregatedAnswersView()

assImagemapQuestionGUI::getAggregatedAnswersView ( array  $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 867 of file class.assImagemapQuestionGUI.php.

References aggregateAnswers(), ILIAS\Repository\object(), and renderAggregateView().

867  : string
868  {
869  return $this->renderAggregateView(
870  $this->aggregateAnswers($relevant_answers, $this->object->getAnswers())
871  );
872  }
renderAggregateView($answeringFequencies)
aggregateAnswers($givenSolutionRows, $existingAnswerOptions)
+ Here is the call graph for this function:

◆ getAnswersFrequency()

assImagemapQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Definition at line 895 of file class.assImagemapQuestionGUI.php.

References aggregateAnswers(), and ILIAS\Repository\object().

895  : array
896  {
897  $agg = $this->aggregateAnswers($relevantAnswers, $this->object->getAnswers());
898 
899  $answers = array();
900 
901  foreach ($this->object->getAnswers() as $answerIndex => $ans) {
902  $answers[] = array(
903  'answer' => $ans->getAnswerText(),
904  'frequency' => $agg[$answerIndex]
905  );
906  }
907 
908  return $answers;
909  }
aggregateAnswers($givenSolutionRows, $existingAnswerOptions)
+ Here is the call graph for this function:

◆ getCommand()

assImagemapQuestionGUI::getCommand (   $cmd)

Definition at line 57 of file class.assImagemapQuestionGUI.php.

References ILIAS\Repository\ctrl().

58  {
59  if (isset($_POST["imagemap"]) ||
60  isset($_POST["imagemap_x"]) ||
61  isset($_POST["imagemap_y"])) {
62  $this->ctrl->setCmd("getCoords");
63  $cmd = "getCoords";
64  }
65 
66  return $cmd;
67  }
+ Here is the call graph for this function:

◆ getPreview()

assImagemapQuestionGUI::getPreview (   $show_question_only = false,
  $showInlineFeedback = false 
)

Definition at line 594 of file class.assImagemapQuestionGUI.php.

References $linecolor, ilImagemapPreview\addArea(), ILIAS\Repository\ctrl(), assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), assQuestionGUI\getQuestionActionCmd(), assQuestionGUI\getTargetGuiClass(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilWACSignedPath\signFile().

594  : string
595  {
596  if (is_object($this->getPreviewSession())) {
597  $user_solution = array();
598 
599  if (is_array($this->getPreviewSession()->getParticipantsSolution())) {
600  $user_solution = array_values($this->getPreviewSession()->getParticipantsSolution());
601  }
602 
603  $preview = new ilImagemapPreview($this->object->getImagePath() . $this->object->getImageFilename());
604  foreach ($user_solution as $idx => $solution_value) {
605  if ($solution_value !== '') {
606  $preview->addArea($solution_value, $this->object->answers[$solution_value]->getArea(), $this->object->answers[$solution_value]->getCoords(), $this->object->answers[$solution_value]->getAnswertext(), "", "", true, $this->linecolor);
607  }
608  }
609  $preview->createPreview();
610  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
611  } else {
612  $user_solution = array();
613  $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
614  }
615 
616  // generate the question output
617  $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", true, true, "Modules/TestQuestionPool");
618 
619  if ($this->getQuestionActionCmd() && !is_null($this->getTargetGuiClass())) {
620  $hrefArea = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd());
621  } else {
622  $hrefArea = null;
623  }
624 
625  foreach ($this->object->answers as $answer_id => $answer) {
626  $parameter = "&amp;selImage=$answer_id";
627  if (is_array($user_solution) && in_array($answer_id, $user_solution)) {
628  $parameter = "&amp;remImage=$answer_id";
629  }
630 
631  if ($hrefArea) {
632  $template->setCurrentBlock("imagemap_area_href");
633  $template->setVariable("HREF_AREA", $hrefArea . $parameter);
634  $template->parseCurrentBlock();
635  }
636 
637  $template->setCurrentBlock("imagemap_area");
638  $template->setVariable("SHAPE", $answer->getArea());
639  $template->setVariable("COORDS", $answer->getCoords());
640  $template->setVariable("ALT", ilLegacyFormElementsUtil::prepareFormOutput($answer->getAnswertext()));
641  $template->setVariable("TITLE", ilLegacyFormElementsUtil::prepareFormOutput($answer->getAnswertext()));
642  $template->parseCurrentBlock();
643  }
644  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
645  $template->setVariable("IMG_SRC", ilWACSignedPath::signFile($imagepath));
646  $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
647  $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
648  $questionoutput = $template->get();
649  if (!$show_question_only) {
650  // get page object output
651  $questionoutput = $this->getILIASPage($questionoutput);
652  }
653  return $questionoutput;
654  }
static prepareFormOutput($a_str, bool $a_strip=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
static signFile(string $path_to_file)
addArea( $index, $shape, $coords, $title="", $href="", $target="", $visible=true, $linecolor="red", $bordercolor="white", $fillcolor="#FFFFFFA0")
+ Here is the call graph for this function:

◆ getPreviousSolutionConfirmationCheckboxHtml()

assImagemapQuestionGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

Definition at line 874 of file class.assImagemapQuestionGUI.php.

References $DIC, assQuestionGUI\$tpl, ilUtil\appendUrlParameterString(), buildSelectionParameter(), ILIAS\Repository\ctrl(), ilGlobalPageTemplate\get(), assQuestionGUI\getQuestionActionCmd(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilGlobalPageTemplate\setVariable().

874  : string
875  {
876  if (!count($this->object->currentSolution)) {
877  return '';
878  }
879 
880  global $DIC;
881  $button = $DIC->ui()->factory()->link()->standard(
882  $this->lng->txt('use_previous_solution'),
884  $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd()),
885  $this->buildSelectionParameter($this->object->currentSolution, null)
886  )
887  );
888 
889  $tpl = new ilTemplate('tpl.tst_question_additional_behaviour_checkbox.html', true, true, 'Modules/TestQuestionPool');
890  $tpl->setVariable('BUTTON', $DIC->ui()->renderer()->render($button));
891 
892  return $tpl->get();
893  }
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
ilGlobalPageTemplate $tpl
global $DIC
Definition: feed.php:28
buildSelectionParameter($currentSelection, $areaIndex=null)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
+ Here is the call graph for this function:

◆ getSolutionOutput()

assImagemapQuestionGUI::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
string The solution output of the question as HTML code

Definition at line 422 of file class.assImagemapQuestionGUI.php.

References $linecolor, ilImagemapPreview\addArea(), ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\generateCorrectnessIconsForCorrectness(), assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareTextareaOutput(), assQuestionGUI\renderSolutionOutput(), and ilWACSignedPath\signFile().

432  : string {
433  $user_solutions = array();
434 
435 
436  if (($active_id > 0) && (!$show_correct_solution)) {
437  $user_solutions = $this->object->getSolutionValues($active_id, $pass);
438  } else {
439  if (!$this->object->getIsMultipleChoice()) {
440  $found_index = -1;
441  $max_points = 0;
442  foreach ($this->object->answers as $index => $answer) {
443  if ($answer->getPoints() > $max_points) {
444  $max_points = $answer->getPoints();
445  $found_index = $index;
446  }
447  }
448  array_push($user_solutions, array("value1" => $found_index));
449  } else {
450  // take the correct solution instead of the user solution
451  foreach ($this->object->answers as $index => $answer) {
452  $points_checked = $answer->getPoints();
453  $points_unchecked = $answer->getPointsUnchecked();
454  if ($points_checked > $points_unchecked) {
455  if ($points_checked > 0) {
456  array_push($user_solutions, array("value1" => $index));
457  }
458  }
459  }
460  }
461  }
462 
463  $show_inline_feedback = false;
464  return $this->renderSolutionOutput(
465  $user_solutions,
466  $active_id,
467  $pass,
468  $graphicalOutput,
469  $result_output,
470  $show_question_only,
471  $show_feedback,
472  $show_correct_solution,
473  $show_manual_scoring,
474  $show_question_text,
475  false,
476  $show_inline_feedback,
477  );
478  }
renderSolutionOutput(mixed $user_solutions, int $active_id, int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assImagemapQuestionGUI::getSpecificFeedbackOutput ( array  $userSolution)

Definition at line 773 of file class.assImagemapQuestionGUI.php.

References ILIAS\Repository\object(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

773  : string
774  {
775  if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
776  return '';
777  }
778 
779  $output = '<table class="test_specific_feedback"><tbody>';
780 
781  foreach ($this->object->getAnswers() as $idx => $answer) {
782  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
783  $this->object->getId(),
784  0,
785  $idx
786  );
787 
788  $output .= "<tr><td>{$answer->getAnswerText()}</td><td>{$feedback}</td></tr>";
789  }
790 
791  $output .= '</tbody></table>';
792 
794  }
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:

◆ getTestOutput()

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

Definition at line 657 of file class.assImagemapQuestionGUI.php.

References $linecolor, ilImagemapPreview\addArea(), buildAreaLinkTarget(), ILIAS\Repository\ctrl(), assQuestionGUI\getTargetGuiClass(), ILIAS\Repository\lng(), ILIAS\Repository\object(), assQuestionGUI\outQuestionPage(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilWACSignedPath\signFile().

657  : string
658  // hey.
659  {
660  if ($active_id) {
661  $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
662  // hey.
663 
664  $userSelection = array();
665  $selectionIndex = 0;
666 
667  $preview = new ilImagemapPreview($this->object->getImagePath() . $this->object->getImageFilename());
668 
669  foreach ($solutions as $idx => $solution_value) {
670  if ($solution_value['value1'] !== null) {
671  $preview->addArea($solution_value['value1'], $this->object->answers[$solution_value['value1']]->getArea(), $this->object->answers[$solution_value['value1']]->getCoords(), $this->object->answers[$solution_value['value1']]->getAnswertext(), "", "", true, $this->linecolor);
672  $userSelection[$selectionIndex] = $solution_value['value1'];
673 
674  $selectionIndex = $this->object->getIsMultipleChoice() ? ++$selectionIndex : $selectionIndex;
675  }
676  }
677 
678  $preview->createPreview();
679 
680  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
681  } else {
682  $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
683  }
684 
685  // generate the question output
686  $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", true, true, "Modules/TestQuestionPool");
687  $this->ctrl->setParameterByClass($this->getTargetGuiClass(), "formtimestamp", time());
688  foreach ($this->object->answers as $answer_id => $answer) {
689  $template->setCurrentBlock("imagemap_area");
690  $template->setVariable("HREF_AREA", $this->buildAreaLinkTarget($userSelection, $answer_id));
691  $template->setVariable("SHAPE", $answer->getArea());
692  $template->setVariable("COORDS", $answer->getCoords());
693  $template->setVariable("ALT", ilLegacyFormElementsUtil::prepareFormOutput($answer->getAnswertext()));
694  $template->setVariable("TITLE", ilLegacyFormElementsUtil::prepareFormOutput($answer->getAnswertext()));
695  $template->parseCurrentBlock();
696  if ($show_feedback) {
697  if (!$this->object->getIsMultipleChoice() && count($userSelection) && current($userSelection) == $answer_id) {
698  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
699  $this->object->getId(),
700  0,
701  $answer_id
702  );
703  if ($feedback !== '') {
704  $template->setCurrentBlock("feedback");
705  $template->setVariable("FEEDBACK", $feedback);
706  $template->parseCurrentBlock();
707  }
708  }
709  }
710  }
711  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
712  $template->setVariable("IMG_SRC", ilWACSignedPath::signFile($imagepath));
713  $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
714  $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
715  $questionoutput = $template->get();
716  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
717  return $pageoutput;
718  }
static prepareFormOutput($a_str, bool $a_strip=false)
buildAreaLinkTarget($currentSelection, $areaIndex)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
static signFile(string $path_to_file)
addArea( $index, $shape, $coords, $title="", $href="", $target="", $visible=true, $linecolor="red", $bordercolor="white", $fillcolor="#FFFFFFA0")
+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assImagemapQuestionGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 177 of file class.assImagemapQuestionGUI.php.

178  {
179  return $form; // Nothing to do here since selectable areas are handled in question-specific-form part
180  // due to their immediate dependency to the image. I decide to not break up the interfaces
181  // more just to support this very rare case. tl;dr: See the issue, ignore it.
182  }

◆ populateCorrectionsFormProperties()

assImagemapQuestionGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

Definition at line 911 of file class.assImagemapQuestionGUI.php.

References $linecolor, ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilImagemapFileInputGUI\setPointsUncheckedFieldEnabled().

911  : void
912  {
913  $image = new ilImagemapCorrectionsInputGUI($this->lng->txt('image'), 'image');
914  $image->setPointsUncheckedFieldEnabled($this->object->getIsMultipleChoice());
915  $image->setRequired(true);
916 
917  if (strlen($this->object->getImageFilename())) {
918  $image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename());
919  $image->setValue($this->object->getImageFilename());
920  $image->setAreas($this->object->getAnswers());
921  $assessmentSetting = new ilSetting("assessment");
922  $linecolor = (strlen(
923  $assessmentSetting->get("imap_line_color")
924  )) ? "\"#" . $assessmentSetting->get("imap_line_color") . "\"" : "\"#FF0000\"";
925  $image->setLineColor($linecolor);
926  $image->setImagePath($this->object->getImagePath());
927  $image->setImagePathWeb($this->object->getImagePathWeb());
928  }
929  $form->addItem($image);
930  }
setPointsUncheckedFieldEnabled($pointsUncheckedFieldEnabled)
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assImagemapQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 184 of file class.assImagemapQuestionGUI.php.

References $linecolor, ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), assImagemapQuestion\MODE_MULTIPLE_CHOICE, assImagemapQuestion\MODE_SINGLE_CHOICE, ILIAS\Repository\object(), ilImagemapFileInputGUI\setPointsUncheckedFieldEnabled(), ilFormPropertyGUI\setRequired(), and ilRadioGroupInputGUI\setValue().

Referenced by buildEditForm().

185  {
186  $radioGroup = new ilRadioGroupInputGUI($this->lng->txt('tst_imap_qst_mode'), 'is_multiple_choice');
187  $radioGroup->setValue((string) ((int) ($this->object->getIsMultipleChoice())));
188  $modeSingleChoice = new ilRadioOption(
189  $this->lng->txt('tst_imap_qst_mode_sc'),
191  );
192  $modeMultipleChoice = new ilRadioOption(
193  $this->lng->txt('tst_imap_qst_mode_mc'),
195  );
196  $radioGroup->addOption($modeSingleChoice);
197  $radioGroup->addOption($modeMultipleChoice);
198  $form->addItem($radioGroup);
199 
200  $image = new ilImagemapFileInputGUI($this->lng->txt('image'), 'image');
201  $image->setPointsUncheckedFieldEnabled($this->object->getIsMultipleChoice());
202  $image->setRequired(true);
203 
204  if (strlen($this->object->getImageFilename())) {
205  $image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename());
206  $image->setValue($this->object->getImageFilename());
207  $image->setAreas($this->object->getAnswers());
208  $assessmentSetting = new ilSetting("assessment");
209  $linecolor = (strlen(
210  $assessmentSetting->get("imap_line_color")
211  )) ? "\"#" . $assessmentSetting->get("imap_line_color") . "\"" : "\"#FF0000\"";
212  $image->setLineColor($linecolor);
213  $image->setImagePath($this->object->getImagePath());
214  $image->setImagePathWeb($this->object->getImagePathWeb());
215  }
216  $form->addItem($image);
217 
218  $imagemapfile = new ilHtmlImageMapFileInputGUI($this->lng->txt('add_imagemap'), 'imagemapfile');
219  $imagemapfile->setRequired(false);
220  $form->addItem($imagemapfile);
221  return $form;
222  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents an image map file property in a property form.
This class represents a property in a property form.
setRequired(bool $a_required)
setPointsUncheckedFieldEnabled($pointsUncheckedFieldEnabled)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderAggregateView()

assImagemapQuestionGUI::renderAggregateView (   $answeringFequencies)
protected

Definition at line 824 of file class.assImagemapQuestionGUI.php.

References assQuestionGUI\$tpl, ilGlobalPageTemplate\get(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilGlobalPageTemplate\parseCurrentBlock(), ilGlobalPageTemplate\setCurrentBlock(), and ilGlobalPageTemplate\setVariable().

Referenced by getAggregatedAnswersView().

824  : string
825  {
826  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
827 
828  $tpl->setCurrentBlock('headercell');
829  $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_answer_header'));
831 
832  $tpl->setCurrentBlock('headercell');
833  $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_frequency_header'));
835 
836  foreach ($answeringFequencies as $answerIndex => $answeringFrequency) {
837  $tpl->setCurrentBlock('aggregaterow');
838  $tpl->setVariable('OPTION', $this->object->getAnswer($answerIndex)->getAnswerText());
839  $tpl->setVariable('COUNT', $answeringFrequency);
841  }
842 
843  return $tpl->get();
844  }
setCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Parses the given block.
ilGlobalPageTemplate $tpl
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

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

Definition at line 935 of file class.assImagemapQuestionGUI.php.

References ilPropertyFormGUI\getItemByPostVar(), and ILIAS\Repository\object().

935  : void
936  {
937  $areas = $form->getItemByPostVar('image')->getAreas();
938 
939  foreach ($this->object->getAnswers() as $index => $answer) {
940  if ($this->object->getIsMultipleChoice()) {
941  $answer->setPointsUnchecked((float) $areas[$index]->getPointsUnchecked());
942  }
943 
944  $answer->setPoints((float) $areas[$index]->getPoints());
945  }
946  }
getItemByPostVar(string $a_post_var)
+ Here is the call graph for this function:

◆ saveShape()

assImagemapQuestionGUI::saveShape ( )

Saves a shape of the area editor.

Definition at line 242 of file class.assImagemapQuestionGUI.php.

References assImagemapQuestion\AVAILABLE_SHAPES, ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

242  : void
243  {
244  $coords = "";
245  switch ($_POST["shape"]) {
247  $coords = join(",", $_POST['image']['mapcoords']);
248  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_rect_added'), true);
249  break;
251  if (preg_match("/(\d+)\s*,\s*(\d+)\s+(\d+)\s*,\s*(\d+)/", $_POST['image']['mapcoords'][0] . " " . $_POST['image']['mapcoords'][1], $matches)) {
252  $coords = "$matches[1],$matches[2]," . (int) sqrt((($matches[3] - $matches[1]) * ($matches[3] - $matches[1])) + (($matches[4] - $matches[2]) * ($matches[4] - $matches[2])));
253  }
254  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_circle_added'), true);
255  break;
257  $coords = join(",", $_POST['image']['mapcoords']);
258  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_poly_added'), true);
259  break;
260  }
261  $this->object->addAnswer($_POST["shapetitle"], 0, count($this->object->getAnswers()), $coords, $_POST["shape"]);
262  $this->object->saveToDb();
263  $this->ctrl->redirect($this, 'editQuestion');
264  }
+ Here is the call graph for this function:

◆ writeAnswerSpecificPostData()

assImagemapQuestionGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

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

Implements ilGuiAnswerScoringAdjustable.

Definition at line 98 of file class.assImagemapQuestionGUI.php.

References ILIAS\Repository\ctrl(), ilPropertyFormGUI\getItemByPostVar(), and ILIAS\Repository\object().

Referenced by writePostData().

98  : void
99  {
100  if ($this->ctrl->getCmd() != 'deleteImage') {
101  $this->object->flushAnswers();
102  if (isset($_POST['image']) && is_array($_POST['image']) && is_array($_POST['image']['coords']['name'])) {
103  foreach ($_POST['image']['coords']['name'] as $idx => $name) {
104  if ($this->object->getIsMultipleChoice() && isset($_POST['image']['coords']['points_unchecked'])) {
105  $pointsUnchecked = $_POST['image']['coords']['points_unchecked'][$idx];
106  } else {
107  $pointsUnchecked = 0.0;
108  }
109 
110  $this->object->addAnswer(
111  $name,
112  $_POST['image']['coords']['points'][$idx],
113  $idx,
114  $_POST['image']['coords']['coords'][$idx],
115  $_POST['image']['coords']['shape'][$idx],
116  $pointsUnchecked
117  );
118  }
119  }
120 
121  if (strlen($_FILES['imagemapfile']['tmp_name'])) {
122  if ($this->object->getSelfAssessmentEditingMode() && $this->object->getId() < 1) {
123  $this->object->createNewQuestion();
124  }
125 
126  $this->object->uploadImagemap($form->getItemByPostVar('imagemapfile')->getShapes());
127  }
128  }
129  }
getItemByPostVar(string $a_post_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writePostData()

assImagemapQuestionGUI::writePostData ( bool  $always = false)
protected

{}

Definition at line 80 of file class.assImagemapQuestionGUI.php.

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

80  : int
81  {
82  $form = $this->buildEditForm();
83  $form->setValuesByPost();
84 
85  if (!$always && !$form->checkInput()) {
86  $this->editQuestion($form);
87  return 1;
88  }
89 
91  $this->writeQuestionSpecificPostData($form);
92  $this->writeAnswerSpecificPostData($form);
93  $this->saveTaxonomyAssignments();
94 
95  return 0;
96  }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
editQuestion(ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assImagemapQuestionGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

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

Implements ilGuiQuestionScoringAdjustable.

Definition at line 131 of file class.assImagemapQuestionGUI.php.

References ILIAS\Repository\ctrl(), assImagemapQuestion\MODE_MULTIPLE_CHOICE, and ILIAS\Repository\object().

Referenced by writePostData().

131  : void
132  {
133  if ($this->ctrl->getCmd() != 'deleteImage') {
134  if (strlen($_FILES['image']['tmp_name']) == 0) {
135  $this->object->setImageFilename($_POST["image_name"]);
136  }
137  }
138  if (strlen($_FILES['image']['tmp_name'])) {
139  if ($this->object->getSelfAssessmentEditingMode() && $this->object->getId() < 1) {
140  $this->object->createNewQuestion();
141  }
142  $this->object->setImageFilename($_FILES['image']['name'], $_FILES['image']['tmp_name']);
143  }
144 
145  $this->object->setIsMultipleChoice($_POST['is_multiple_choice'] == assImagemapQuestion::MODE_MULTIPLE_CHOICE);
146  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $linecolor


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