ILIAS  release_8 Revision v8.24
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 ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 getTestOutput ($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
 
 getSpecificFeedbackOutput (array $userSolution)
 Returns the answer specific feedback for the question. More...
 
 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 ()
 
 getNotesHTML ()
 
 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)
 
 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)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView (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...
 
- Public Member Functions inherited from ilGuiAnswerScoringAdjustable
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 

Protected Member Functions

 deleteImage ()
 
 writePostData (bool $always=false)
 {Evaluates a posted edit form and writes the form data in the question object.
Returns
integer A positive value, if one of the required fields wasn't set, else 0
} More...
 
 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)
 
 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)
 
 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 ($txt_output, $prepare_for_latex_output=false, $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
 
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
ILIAS Notes GUIService $notes_gui
 
ilCtrl $ctrl
 
ilPropertyFormGUI $editForm
 
ILIAS TestQuestionPool InternalRequestService $request
 

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$

@ilCtrl_Calls 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.

48 {
50 $this->object = new assImagemapQuestion();
51 if ($id >= 0) {
52 $this->object->loadFromDb($id);
53 }
54 $assessmentSetting = new ilSetting("assessment");
55 $this->linecolor = (strlen($assessmentSetting->get("imap_line_color"))) ? "#" . $assessmentSetting->get("imap_line_color") : "#FF0000";
56 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
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...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $id, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ addCircle()

assImagemapQuestionGUI::addCircle ( )

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

230 : void
231 {
232 $this->areaEditor('circle');
233 }

References areaEditor().

+ Here is the call graph for this function:

◆ addPoly()

assImagemapQuestionGUI::addPoly ( )

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

235 : void
236 {
237 $this->areaEditor('poly');
238 }

References areaEditor().

+ Here is the call graph for this function:

◆ addRect()

assImagemapQuestionGUI::addRect ( )

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

225 : void
226 {
227 $this->areaEditor('rect');
228 }

References areaEditor().

+ Here is the call graph for this function:

◆ aggregateAnswers()

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

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

814 : array
815 {
816 $answeringFequencies = array();
817
818 foreach ($existingAnswerOptions as $answerIndex => $answerOption) {
819 $answeringFequencies[$answerIndex] = 0;
820 }
821
822 foreach ($givenSolutionRows as $solutionRow) {
823 $answeringFequencies[$solutionRow['value1']]++;
824 }
825
826 return $answeringFequencies;
827 }

◆ areaEditor()

assImagemapQuestionGUI::areaEditor (   $shape = '')

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

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

References $c, $index, $preview, ILIAS\Repository\ctrl(), assQuestionGUI\getQuestionTemplate(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

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

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

◆ back()

assImagemapQuestionGUI::back ( )

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

388 : void
389 {
390 $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_cancel'), true);
391 $this->ctrl->redirect($this, 'editQuestion');
392 }

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

+ Here is the call graph for this function:

◆ buildAreaLinkTarget()

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

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

689 : string
690 {
691 $href = $this->ctrl->getLinkTargetByClass(
692 $this->getTargetGuiClass(),
693 $this->getQuestionActionCmd()
694 );
695
697 $href,
698 $this->buildSelectionParameter($currentSelection, $areaIndex)
699 );
700
701 return $href;
702 }
buildSelectionParameter($currentSelection, $areaIndex=null)
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)

References ilUtil\appendUrlParameterString(), and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ buildEditForm()

assImagemapQuestionGUI::buildEditForm ( )
protected
Returns
ilPropertyFormGUI

Reimplemented from assQuestionGUI.

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

153 {
154 $form = $this->buildBasicEditFormObject();
155
156 $this->addBasicQuestionFormProperties($form);
158 $this->populateTaxonomyFormSection($form);
159 $this->addQuestionFormCommandButtons($form);
160
161 return $form;
162 }
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
This class represents a property form user interface.

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

Referenced by editQuestion(), and writePostData().

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

◆ buildSelectionParameter()

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

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

704 : string
705 {
706 if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
707 $reuseSelection = array();
708
709 if ($areaIndex === null) {
710 $reuseSelection = $currentSelection;
711 } elseif ($this->object->getIsMultipleChoice()) {
712 if (!in_array($areaIndex, $currentSelection)) {
713 $reuseSelection[] = $areaIndex;
714 }
715
716 foreach (array_diff($currentSelection, array($areaIndex)) as $otherSelectedArea) {
717 $reuseSelection[] = $otherSelectedArea;
718 }
719 } else {
720 $reuseSelection[] = $areaIndex;
721 }
722
723 $selection = assQuestion::implodeKeyValues($reuseSelection);
724 $action = 'reuseSelection';
725 } elseif ($areaIndex !== null) {
726 if (!$this->object->getIsMultipleChoice() || !in_array($areaIndex, $currentSelection)) {
727 $areaAction = 'selImage';
728 } else {
729 $areaAction = 'remImage';
730 }
731
732 $selection = $areaIndex;
733 $action = $areaAction;
734 } else {
735 return '';
736 }
737
738 return "{$action}={$selection}";
739 }
static implodeKeyValues(array $keyValues)

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

+ Here is the call graph for this function:

◆ completeTestOutputFormAction()

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

Reimplemented from assQuestionGUI.

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

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

◆ deleteImage()

assImagemapQuestionGUI::deleteImage ( )
protected

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

70 : void
71 {
72 $this->object->deleteImage();
73 $this->object->saveToDb();
74 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
75 $this->ctrl->redirect($this, 'editQuestion');
76 }

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

+ Here is the call graph for this function:

◆ editQuestion()

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

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

167 : void
168 {
169 if (null === $form) {
170 $form = $this->buildEditForm();
171 }
172
173 $this->getQuestionTemplate();
174
175 $this->tpl->setVariable('QUESTION_DATA', $this->ctrl->getHTML($form));
176 }

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

Referenced by writePostData().

+ 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 773 of file class.assImagemapQuestionGUI.php.

773 : array
774 {
775 return array();
776 }

◆ 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 787 of file class.assImagemapQuestionGUI.php.

787 : array
788 {
789 return array();
790 }

◆ 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 835 of file class.assImagemapQuestionGUI.php.

835 : string
836 {
837 return $this->renderAggregateView(
838 $this->aggregateAnswers($relevant_answers, $this->object->getAnswers())
839 );
840 }
aggregateAnswers($givenSolutionRows, $existingAnswerOptions)
renderAggregateView($answeringFequencies)

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getAnswersFrequency()

assImagemapQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Reimplemented from assQuestionGUI.

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

862 : array
863 {
864 $agg = $this->aggregateAnswers($relevantAnswers, $this->object->getAnswers());
865
866 $answers = array();
867
868 foreach ($this->object->getAnswers() as $answerIndex => $ans) {
869 $answers[] = array(
870 'answer' => $ans->getAnswerText(),
871 'frequency' => $agg[$answerIndex]
872 );
873 }
874
875 return $answers;
876 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getCommand()

assImagemapQuestionGUI::getCommand (   $cmd)

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

59 {
60 if (isset($_POST["imagemap"]) ||
61 isset($_POST["imagemap_x"]) ||
62 isset($_POST["imagemap_y"])) {
63 $this->ctrl->setCmd("getCoords");
64 $cmd = "getCoords";
65 }
66
67 return $cmd;
68 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

561 : string
562 {
563 if (is_object($this->getPreviewSession())) {
564 $user_solution = array();
565
566 if (is_array($this->getPreviewSession()->getParticipantsSolution())) {
567 $user_solution = array_values($this->getPreviewSession()->getParticipantsSolution());
568 }
569
570 $preview = new ilImagemapPreview($this->object->getImagePath() . $this->object->getImageFilename());
571 foreach ($user_solution as $idx => $solution_value) {
572 if (strcmp($solution_value, "") != 0) {
573 $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);
574 }
575 }
576 $preview->createPreview();
577 $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
578 } else {
579 $user_solution = array();
580 $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
581 }
582
583 // generate the question output
584 $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", true, true, "Modules/TestQuestionPool");
585
586 if ($this->getQuestionActionCmd() && !is_null($this->getTargetGuiClass())) {
587 $hrefArea = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd());
588 } else {
589 $hrefArea = null;
590 }
591
592 foreach ($this->object->answers as $answer_id => $answer) {
593 $parameter = "&amp;selImage=$answer_id";
594 if (is_array($user_solution) && in_array($answer_id, $user_solution)) {
595 $parameter = "&amp;remImage=$answer_id";
596 }
597
598 if ($hrefArea) {
599 $template->setCurrentBlock("imagemap_area_href");
600 $template->setVariable("HREF_AREA", $hrefArea . $parameter);
601 $template->parseCurrentBlock();
602 }
603
604 $template->setCurrentBlock("imagemap_area");
605 $template->setVariable("SHAPE", $answer->getArea());
606 $template->setVariable("COORDS", $answer->getCoords());
607 $template->setVariable("ALT", ilLegacyFormElementsUtil::prepareFormOutput($answer->getAnswertext()));
608 $template->setVariable("TITLE", ilLegacyFormElementsUtil::prepareFormOutput($answer->getAnswertext()));
609 $template->parseCurrentBlock();
610 }
611 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
612 $template->setVariable("IMG_SRC", ilWACSignedPath::signFile($imagepath));
613 $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
614 $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
615 $questionoutput = $template->get();
616 if (!$show_question_only) {
617 // get page object output
618 $questionoutput = $this->getILIASPage($questionoutput);
619 }
620 return $questionoutput;
621 }
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
static prepareFormOutput($a_str, bool $a_strip=false)
static signFile(string $path_to_file)

References $preview, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilWACSignedPath\signFile().

+ Here is the call graph for this function:

◆ getPreviousSolutionConfirmationCheckboxHtml()

assImagemapQuestionGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

Reimplemented from assQuestionGUI.

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

842 : string
843 {
844 if (!count($this->object->currentSolution)) {
845 return '';
846 }
847
848 $button = ilLinkButton::getInstance();
849 $button->setCaption('use_previous_solution');
850
851 $button->setUrl(ilUtil::appendUrlParameterString(
852 $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd()),
853 $this->buildSelectionParameter($this->object->currentSolution, null)
854 ));
855
856 $tpl = new ilTemplate('tpl.tst_question_additional_behaviour_checkbox.html', true, true, 'Modules/TestQuestionPool');
857 $tpl->setVariable('BUTTON', $button->render());
858
859 return $tpl->get();
860 }
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.

References $tpl, ilUtil\appendUrlParameterString(), ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assImagemapQuestionGUI::getSpecificFeedbackOutput ( array  $userSolution)

Returns the answer specific feedback for the question.

Parameters
array$userSolution($userSolution[<value1>] = <value2>)

Reimplemented from assQuestionGUI.

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

741 : string
742 {
743 if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
744 return '';
745 }
746
747 $output = '<table class="test_specific_feedback"><tbody>';
748
749 foreach ($this->object->getAnswers() as $idx => $answer) {
750 $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
751 $this->object->getId(),
752 0,
753 $idx
754 );
755
756 $output .= "<tr><td>{$answer->getAnswerText()}</td><td>{$feedback}</td></tr>";
757 }
758
759 $output .= '</tbody></table>';
760
761 return $this->object->prepareTextareaOutput($output, true);
762 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

624 : string
625 // hey.
626 {
627 if ($active_id) {
628 $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
629 // hey.
630
631 $userSelection = array();
632 $selectionIndex = 0;
633
634 $preview = new ilImagemapPreview($this->object->getImagePath() . $this->object->getImageFilename());
635
636 foreach ($solutions as $idx => $solution_value) {
637 if (strlen($solution_value["value1"])) {
638 $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);
639 $userSelection[$selectionIndex] = $solution_value["value1"];
640
641 $selectionIndex = $this->object->getIsMultipleChoice() ? ++$selectionIndex : $selectionIndex;
642 }
643 }
644
645 $preview->createPreview();
646
647 $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
648 } else {
649 $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
650 }
651
652 // generate the question output
653 $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", true, true, "Modules/TestQuestionPool");
654 $this->ctrl->setParameterByClass($this->getTargetGuiClass(), "formtimestamp", time());
655 $hrefArea = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd());
656 foreach ($this->object->answers as $answer_id => $answer) {
657 $template->setCurrentBlock("imagemap_area");
658 $template->setVariable("HREF_AREA", $this->buildAreaLinkTarget($userSelection, $answer_id));
659 $template->setVariable("SHAPE", $answer->getArea());
660 $template->setVariable("COORDS", $answer->getCoords());
661 $template->setVariable("ALT", ilLegacyFormElementsUtil::prepareFormOutput($answer->getAnswertext()));
662 $template->setVariable("TITLE", ilLegacyFormElementsUtil::prepareFormOutput($answer->getAnswertext()));
663 $template->parseCurrentBlock();
664 if ($show_feedback) {
665 if (!$this->object->getIsMultipleChoice() && count($userSelection) && current($userSelection) == $answer_id) {
666 $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
667 $this->object->getId(),
668 0,
669 $answer_id
670 );
671 if (strlen($feedback)) {
672 $template->setCurrentBlock("feedback");
673 $template->setVariable("FEEDBACK", $feedback);
674 $template->parseCurrentBlock();
675 }
676 }
677 }
678 }
679 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
680 $template->setVariable("IMG_SRC", ilWACSignedPath::signFile($imagepath));
681 $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
682 $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
683 $questionoutput = $template->get();
684 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
685 return $pageoutput;
686 }
buildAreaLinkTarget($currentSelection, $areaIndex)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)

References $preview, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilWACSignedPath\signFile().

+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assImagemapQuestionGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

◆ populateCorrectionsFormProperties()

assImagemapQuestionGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

Reimplemented from assQuestionGUI.

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

878 : void
879 {
880 $image = new ilImagemapCorrectionsInputGUI($this->lng->txt('image'), 'image');
881 $image->setPointsUncheckedFieldEnabled($this->object->getIsMultipleChoice());
882 $image->setRequired(true);
883
884 if (strlen($this->object->getImageFilename())) {
885 $image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename());
886 $image->setValue($this->object->getImageFilename());
887 $image->setAreas($this->object->getAnswers());
888 $assessmentSetting = new ilSetting("assessment");
889 $linecolor = (strlen(
890 $assessmentSetting->get("imap_line_color")
891 )) ? "\"#" . $assessmentSetting->get("imap_line_color") . "\"" : "\"#FF0000\"";
892 $image->setLineColor($linecolor);
893 $image->setImagePath($this->object->getImagePath());
894 $image->setImagePathWeb($this->object->getImagePathWeb());
895 }
896 $form->addItem($image);
897 }

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assImagemapQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

References $linecolor, ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), assImagemapQuestion\MODE_MULTIPLE_CHOICE, assImagemapQuestion\MODE_SINGLE_CHOICE, and ILIAS\Repository\object().

Referenced by buildEditForm().

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

◆ renderAggregateView()

assImagemapQuestionGUI::renderAggregateView (   $answeringFequencies)
protected

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

792 : string
793 {
794 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
795
796 $tpl->setCurrentBlock('headercell');
797 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_answer_header'));
799
800 $tpl->setCurrentBlock('headercell');
801 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_frequency_header'));
803
804 foreach ($answeringFequencies as $answerIndex => $answeringFrequency) {
805 $tpl->setCurrentBlock('aggregaterow');
806 $tpl->setVariable('OPTION', $this->object->getAnswer($answerIndex)->getAnswerText());
807 $tpl->setVariable('COUNT', $answeringFrequency);
809 }
810
811 return $tpl->get();
812 }
setCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Parses the given block.

References $tpl, ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ saveCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

902 : void
903 {
904 $areas = $form->getItemByPostVar('image')->getAreas();
905
906 foreach ($this->object->getAnswers() as $index => $answer) {
907 if ($this->object->getIsMultipleChoice()) {
908 $answer->setPointsUnchecked((float) $areas[$index]->getPointsUnchecked());
909 }
910
911 $answer->setPoints((float) $areas[$index]->getPoints());
912 }
913 }
getItemByPostVar(string $a_post_var)

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

+ Here is the call graph for this function:

◆ saveShape()

assImagemapQuestionGUI::saveShape ( )

Saves a shape of the area editor.

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

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

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

+ 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 99 of file class.assImagemapQuestionGUI.php.

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

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

Referenced by writePostData().

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

◆ writePostData()

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

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

Returns
integer A positive value, if one of the required fields wasn't set, else 0
}

Reimplemented from assQuestionGUI.

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

81 : int
82 {
83 $form = $this->buildEditForm();
84 $form->setValuesByPost();
85
86 if (!$always && !$form->checkInput()) {
87 $this->editQuestion($form);
88 return 1;
89 }
90
93 $this->writeAnswerSpecificPostData($form);
95
96 return 0;
97 }
editQuestion(ilPropertyFormGUI $form=null)
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.

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

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

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

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

Referenced by writePostData().

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

Field Documentation

◆ $linecolor

assImagemapQuestionGUI::$linecolor
private

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

Referenced by populateQuestionSpecificFormPart().


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