ILIAS  release_7 Revision v7.30-3-g800a261c036
assImagemapQuestionGUI Class Reference

Image map question GUI representation. 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 ()
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 getTestOutput ($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
 
 getSpecificFeedbackOutput ($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 ($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
 __construct ()
 assQuestionGUI constructor More...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 execute command More...
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=false, $user_post_solutions=false, $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- 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 ($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 ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 addSaveOnEnterOnLoadCode ()
 

Private Attributes

 $linecolor
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $request
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 
- Protected Attributes inherited from assQuestionGUI
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
 $ctrl
 
 $editForm
 
 $use_intermediate_solution = false
 

Detailed Description

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 24 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.
Returns

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

References ILIAS\GlobalScreen\Provider\__construct().

38  {
40  include_once './Modules/TestQuestionPool/classes/class.assImagemapQuestion.php';
41  $this->object = new assImagemapQuestion();
42  if ($id >= 0) {
43  $this->object->loadFromDb($id);
44  }
45  $assessmentSetting = new ilSetting("assessment");
46  $this->linecolor = (strlen($assessmentSetting->get("imap_line_color"))) ? "#" . $assessmentSetting->get("imap_line_color") : "#FF0000";
47  }
Class for image map questions.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addCircle()

assImagemapQuestionGUI::addCircle ( )

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

References areaEditor().

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

◆ addPoly()

assImagemapQuestionGUI::addPoly ( )

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

References areaEditor().

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

◆ addRect()

assImagemapQuestionGUI::addRect ( )

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

References areaEditor().

220  {
221  $this->areaEditor('rect');
222  }
+ Here is the call graph for this function:

◆ aggregateAnswers()

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

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

Referenced by getAggregatedAnswersView(), and getAnswersFrequency().

854  {
855  $answeringFequencies = array();
856 
857  foreach ($existingAnswerOptions as $answerIndex => $answerOption) {
858  $answeringFequencies[$answerIndex] = 0;
859  }
860 
861  foreach ($givenSolutionRows as $solutionRow) {
862  $answeringFequencies[$solutionRow['value1']]++;
863  }
864 
865  return $answeringFequencies;
866  }
+ Here is the caller graph for this function:

◆ areaEditor()

assImagemapQuestionGUI::areaEditor (   $shape = '')

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

References $_POST, $c, $index, $linecolor, $preview, assQuestionGUI\getQuestionTemplate(), and ilUtil\sendInfo().

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

262  {
263  $shape = (strlen($shape)) ? $shape : $_POST['shape'];
264 
265  $this->getQuestionTemplate();
266 
267  $editorTpl = new ilTemplate('tpl.il_as_qpl_imagemap_question.html', true, true, 'Modules/TestQuestionPool');
268 
269  $coords = array();
270  if (is_array($_POST['image']['mapcoords'])) {
271  foreach ($_POST['image']['mapcoords'] as $value) {
272  array_push($coords, $value);
273  }
274  }
275  if (is_array($_POST['cmd']['areaEditor']['image'])) {
276  array_push($coords, $_POST['cmd']['areaEditor']['image'][0] . "," . $_POST['cmd']['areaEditor']['image'][1]);
277  }
278  foreach ($coords as $value) {
279  $editorTpl->setCurrentBlock("hidden");
280  $editorTpl->setVariable("HIDDEN_NAME", 'image[mapcoords][]');
281  $editorTpl->setVariable("HIDDEN_VALUE", $value);
282  $editorTpl->parseCurrentBlock();
283  }
284 
285  $editorTpl->setCurrentBlock("hidden");
286  $editorTpl->setVariable("HIDDEN_NAME", 'shape');
287  $editorTpl->setVariable("HIDDEN_VALUE", $shape);
288  $editorTpl->parseCurrentBlock();
289 
290  $preview = new ilImagemapPreview($this->object->getImagePath() . $this->object->getImageFilename());
291  foreach ($this->object->answers as $index => $answer) {
292  $preview->addArea($index, $answer->getArea(), $answer->getCoords(), $answer->getAnswertext(), "", "", true, $this->linecolor);
293  }
294  $hidearea = false;
295  $disabled_save = " disabled=\"disabled\"";
296  $c = "";
297  switch ($shape) {
298  case "rect":
299  if (count($coords) == 0) {
300  ilUtil::sendInfo($this->lng->txt("rectangle_click_tl_corner"));
301  } elseif (count($coords) == 1) {
302  ilUtil::sendInfo($this->lng->txt("rectangle_click_br_corner"));
303  $preview->addPoint($preview->getAreaCount(), join(",", $coords), true, "blue");
304  } elseif (count($coords) == 2) {
305  $c = join(",", $coords);
306  $hidearea = true;
307  $disabled_save = "";
308  }
309  break;
310  case "circle":
311  if (count($coords) == 0) {
312  ilUtil::sendInfo($this->lng->txt("circle_click_center"));
313  } elseif (count($coords) == 1) {
314  ilUtil::sendInfo($this->lng->txt("circle_click_circle"));
315  $preview->addPoint($preview->getAreaCount(), join(",", $coords), true, "blue");
316  } elseif (count($coords) == 2) {
317  if (preg_match("/(\d+)\s*,\s*(\d+)\s+(\d+)\s*,\s*(\d+)/", $coords[0] . " " . $coords[1], $matches)) {
318  $c = "$matches[1],$matches[2]," . (int) sqrt((($matches[3] - $matches[1]) * ($matches[3] - $matches[1])) + (($matches[4] - $matches[2]) * ($matches[4] - $matches[2])));
319  }
320  $hidearea = true;
321  $disabled_save = "";
322  }
323  break;
324  case "poly":
325  if (count($coords) == 0) {
326  ilUtil::sendInfo($this->lng->txt("polygon_click_starting_point"));
327  } elseif (count($coords) == 1) {
328  ilUtil::sendInfo($this->lng->txt("polygon_click_next_point"));
329  $preview->addPoint($preview->getAreaCount(), implode(",", $coords), true, "blue");
330  } elseif (count($coords) > 1) {
331  ilUtil::sendInfo($this->lng->txt("polygon_click_next_or_save"));
332  $disabled_save = "";
333  $c = implode(",", $coords);
334  }
335  break;
336  }
337  if (strlen($c)) {
338  $preview->addArea($preview->getAreaCount(), $shape, $c, $_POST["shapetitle"], "", "", true, "blue");
339  }
340  $preview->createPreview();
341  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename()) . "?img=" . time();
342  if (!$hidearea) {
343  $editorTpl->setCurrentBlock("maparea");
344  $editorTpl->setVariable("IMAGE_SOURCE", "$imagepath");
345  $editorTpl->setVariable("IMAGEMAP_NAME", "image");
346  $editorTpl->parseCurrentBlock();
347  } else {
348  $editorTpl->setCurrentBlock("imagearea");
349  $editorTpl->setVariable("IMAGE_SOURCE", "$imagepath");
350  $editorTpl->setVariable("ALT_IMAGE", $this->lng->txt("imagemap"));
351  $editorTpl->parseCurrentBlock();
352  }
353 
354  if (strlen($_POST['shapetitle'])) {
355  $editorTpl->setCurrentBlock("shapetitle");
356  $editorTpl->setVariable("VALUE_SHAPETITLE", $_POST["shapetitle"]);
357  $editorTpl->parseCurrentBlock();
358  }
359 
360  $editorTpl->setVariable("TEXT_IMAGEMAP", $this->lng->txt("imagemap"));
361  $editorTpl->setVariable("TEXT_SHAPETITLE", $this->lng->txt("ass_imap_hint"));
362  $editorTpl->setVariable("CANCEL", $this->lng->txt("cancel"));
363  $editorTpl->setVariable("SAVE", $this->lng->txt("save"));
364  $editorTpl->setVariable("DISABLED_SAVE", $disabled_save);
365  switch ($shape) {
366  case "rect":
367  $editorTpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this, 'addRect'));
368  break;
369  case 'circle':
370  $editorTpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this, 'addCircle'));
371  break;
372  case 'poly':
373  $editorTpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this, 'addPoly'));
374  break;
375  }
376 
377  $this->tpl->setVariable('QUESTION_DATA', $editorTpl->get());
378  }
$c
Definition: cli.php:37
getQuestionTemplate()
get question template
Image map image preview creator.
$index
Definition: metadata.php:128
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$preview
Definition: imgupload.php:55
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ back()

assImagemapQuestionGUI::back ( )

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

References ilUtil\sendInfo().

381  {
382  ilUtil::sendInfo($this->lng->txt('msg_cancel'), true);
383  $this->ctrl->redirect($this, 'editQuestion');
384  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ buildAreaLinkTarget()

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

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

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

Referenced by getTestOutput().

729  {
730  $href = $this->ctrl->getLinkTargetByClass(
731  $this->getTargetGuiClass(),
732  $this->getQuestionActionCmd()
733  );
734 
736  $href,
737  $this->buildSelectionParameter($currentSelection, $areaIndex)
738  );
739 
740  return $href;
741  }
buildSelectionParameter($currentSelection, $areaIndex=null)
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
+ 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 143 of file class.assImagemapQuestionGUI.php.

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

Referenced by editQuestion(), and writePostData().

144  {
145  $form = $this->buildBasicEditFormObject();
146 
147  $this->addBasicQuestionFormProperties($form);
148  $this->populateQuestionSpecificFormPart($form);
149  $this->populateTaxonomyFormSection($form);
150  $this->addQuestionFormCommandButtons($form);
151 
152  return $form;
153  }
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildSelectionParameter()

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

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

References assQuestion\implodeKeyValues().

Referenced by buildAreaLinkTarget(), and getPreviousSolutionConfirmationCheckboxHtml().

744  {
745  if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
746  $reuseSelection = array();
747 
748  if ($areaIndex === null) {
749  $reuseSelection = $currentSelection;
750  } elseif ($this->object->getIsMultipleChoice()) {
751  if (!in_array($areaIndex, $currentSelection)) {
752  $reuseSelection[] = $areaIndex;
753  }
754 
755  foreach (array_diff($currentSelection, array($areaIndex)) as $otherSelectedArea) {
756  $reuseSelection[] = $otherSelectedArea;
757  }
758  } else {
759  $reuseSelection[] = $areaIndex;
760  }
761 
762  $selection = assQuestion::implodeKeyValues($reuseSelection);
763  $action = 'reuseSelection';
764  } elseif ($areaIndex !== null) {
765  if (!$this->object->getIsMultipleChoice() || !in_array($areaIndex, $currentSelection)) {
766  $areaAction = 'selImage';
767  } else {
768  $areaAction = 'remImage';
769  }
770 
771  $selection = $areaIndex;
772  $action = $areaAction;
773  } else {
774  return '';
775  }
776 
777  return "{$action}={$selection}";
778  }
static implodeKeyValues($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 388 of file class.assImagemapQuestionGUI.php.

References $pass.

389  {
390  #require_once './Modules/Test/classes/class.ilObjTest.php';
391  #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
392  #{
393  # $pass = ilObjTest::_getPass($active_id);
394  # $info = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
395  #}
396  #else
397  #{
398  # $info = $this->object->getUserSolutionPreferingIntermediate($active_id, NULL);
399  #}
400 
401  $info = $this->object->getTestOutputSolutions($active_id, $pass);
402 
403  if (count($info)) {
404  if (strcmp($info[0]["value1"], "") != 0) {
405  $formAction .= "&selImage=" . $info[0]["value1"];
406  }
407  }
408 
409  return $formAction;
410  }

◆ deleteImage()

assImagemapQuestionGUI::deleteImage ( )
protected

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

62  {
63  $this->object->deleteImage();
64  $this->object->saveToDb();
65  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
66  $this->ctrl->redirect($this, 'editQuestion');
67  }

◆ editQuestion()

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

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

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

Referenced by writePostData().

160  {
161  if (null === $form) {
162  $form = $this->buildEditForm();
163  }
164 
165  $this->getQuestionTemplate();
166 
167  $this->tpl->setVariable('QUESTION_DATA', $this->ctrl->getHTML($form));
168  }
getQuestionTemplate()
get question template
+ 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 812 of file class.assImagemapQuestionGUI.php.

813  {
814  return array();
815  }

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

827  {
828  return array();
829  }

◆ getAggregatedAnswersView()

assImagemapQuestionGUI::getAggregatedAnswersView (   $relevant_answers)

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

Parameters
array$relevant_answers
Returns
string

Implements ilGuiQuestionScoringAdjustable.

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

References aggregateAnswers(), and renderAggregateView().

877  {
878  return $this->renderAggregateView(
879  $this->aggregateAnswers($relevant_answers, $this->object->getAnswers())
880  );
881  }
renderAggregateView($answeringFequencies)
aggregateAnswers($givenSolutionRows, $existingAnswerOptions)
+ Here is the call graph for this function:

◆ getAnswersFrequency()

assImagemapQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

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

References aggregateAnswers().

904  {
905  $agg = $this->aggregateAnswers($relevantAnswers, $this->object->getAnswers());
906 
907  $answers = array();
908 
909  foreach ($this->object->getAnswers() as $answerIndex => $ans) {
910  $answers[] = array(
911  'answer' => $ans->getAnswerText(),
912  'frequency' => $agg[$answerIndex]
913  );
914  }
915 
916  return $answers;
917  }
aggregateAnswers($givenSolutionRows, $existingAnswerOptions)
+ Here is the call graph for this function:

◆ getCommand()

assImagemapQuestionGUI::getCommand (   $cmd)

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

References $_POST.

50  {
51  if (isset($_POST["imagemap"]) ||
52  isset($_POST["imagemap_x"]) ||
53  isset($_POST["imagemap_y"])) {
54  $this->ctrl->setCmd("getCoords");
55  $cmd = "getCoords";
56  }
57 
58  return $cmd;
59  }
$_POST["username"]

◆ getPreview()

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

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

References $linecolor, $preview, assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), assQuestionGUI\getQuestionActionCmd(), assQuestionGUI\getTargetGuiClass(), ilUtil\prepareFormOutput(), and ilWACSignedPath\signFile().

590  {
591  if (is_object($this->getPreviewSession())) {
592  $user_solution = array();
593 
594  if (is_array($this->getPreviewSession()->getParticipantsSolution())) {
595  $user_solution = array_values($this->getPreviewSession()->getParticipantsSolution());
596  }
597 
598  include_once "./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
599  $preview = new ilImagemapPreview($this->object->getImagePath() . $this->object->getImageFilename());
600  foreach ($user_solution as $idx => $solution_value) {
601  if (strcmp($solution_value, "") != 0) {
602  $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);
603  }
604  }
605  $preview->createPreview();
606  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
607  } else {
608  $user_solution = array();
609  $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
610  }
611 
612  // generate the question output
613  include_once "./Services/UICore/classes/class.ilTemplate.php";
614  $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", true, true, "Modules/TestQuestionPool");
615 
616  if ($this->getQuestionActionCmd() && strlen($this->getTargetGuiClass())) {
617  $hrefArea = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd());
618  } else {
619  $hrefArea = null;
620  }
621 
622  foreach ($this->object->answers as $answer_id => $answer) {
623  $parameter = "&selImage=$answer_id";
624  if (is_array($user_solution) && in_array($answer_id, $user_solution)) {
625  $parameter = "&remImage=$answer_id";
626  }
627 
628  if ($hrefArea) {
629  $template->setCurrentBlock("imagemap_area_href");
630  $template->setVariable("HREF_AREA", $hrefArea . $parameter);
631  $template->parseCurrentBlock();
632  }
633 
634  $template->setCurrentBlock("imagemap_area");
635  $template->setVariable("SHAPE", $answer->getArea());
636  $template->setVariable("COORDS", $answer->getCoords());
637  $template->setVariable("ALT", ilUtil::prepareFormOutput($answer->getAnswertext()));
638  $template->setVariable("TITLE", ilUtil::prepareFormOutput($answer->getAnswertext()));
639  $template->parseCurrentBlock();
640  }
641  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
642  $template->setVariable("IMG_SRC", ilWACSignedPath::signFile($imagepath));
643  $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
644  $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
645  $questionoutput = $template->get();
646  if (!$show_question_only) {
647  // get page object output
648  $questionoutput = $this->getILIASPage($questionoutput);
649  }
650  return $questionoutput;
651  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
Image map image preview creator.
$preview
Definition: imgupload.php:55
getILIASPage($html="")
Returns the ILIAS Page around a question.
static signFile($path_to_file)
+ Here is the call graph for this function:

◆ getPreviousSolutionConfirmationCheckboxHtml()

assImagemapQuestionGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

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

References assQuestionGUI\$tpl, ilUtil\appendUrlParameterString(), buildSelectionParameter(), ilLinkButton\getInstance(), and assQuestionGUI\getQuestionActionCmd().

884  {
885  if (!count($this->object->currentSolution)) {
886  return '';
887  }
888 
889  $button = ilLinkButton::getInstance();
890  $button->setCaption('use_previous_solution');
891 
892  $button->setUrl(ilUtil::appendUrlParameterString(
893  $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd()),
894  $this->buildSelectionParameter($this->object->currentSolution, null)
895  ));
896 
897  $tpl = new ilTemplate('tpl.tst_question_additional_behaviour_checkbox.html', true, true, 'Modules/TestQuestionPool');
898  $tpl->setVariable('BUTTON', $button->render());
899 
900  return $tpl->get();
901  }
buildSelectionParameter($currentSelection, $areaIndex=null)
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assImagemapQuestionGUI::getSpecificFeedbackOutput (   $userSolution)

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

781  {
782  if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
783  return '';
784  }
785 
786  $output = '<table class="test_specific_feedback"><tbody>';
787 
788  foreach ($this->object->getAnswers() as $idx => $answer) {
789  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
790  $this->object->getId(),
791  0,
792  $idx
793  );
794 
795  $output .= "<tr><td>{$answer->getAnswerText()}</td><td>{$feedback}</td></tr>";
796  }
797 
798  $output .= '</tbody></table>';
799 
800  return $this->object->prepareTextareaOutput($output, true);
801  }

◆ getTestOutput()

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

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

References $linecolor, $pass, $preview, buildAreaLinkTarget(), assQuestionGUI\getQuestionActionCmd(), assQuestionGUI\getTargetGuiClass(), assQuestionGUI\outQuestionPage(), ilUtil\prepareFormOutput(), and ilWACSignedPath\signFile().

656  {
657  if ($active_id) {
658  // hey: prevPassSolutions - obsolete due to central check
659  #$solutions = NULL;
660  #include_once "./Modules/Test/classes/class.ilObjTest.php";
661  #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
662  #{
663  # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
664  #}
665  $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
666  // hey.
667 
668  $userSelection = array();
669  $selectionIndex = 0;
670 
671  include_once "./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
672  $preview = new ilImagemapPreview($this->object->getImagePath() . $this->object->getImageFilename());
673 
674  foreach ($solutions as $idx => $solution_value) {
675  if (strlen($solution_value["value1"])) {
676  $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);
677  $userSelection[$selectionIndex] = $solution_value["value1"];
678 
679  $selectionIndex = $this->object->getIsMultipleChoice() ? ++$selectionIndex : $selectionIndex;
680  }
681  }
682 
683  $preview->createPreview();
684 
685  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
686  } else {
687  $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
688  }
689 
690  // generate the question output
691  include_once "./Services/UICore/classes/class.ilTemplate.php";
692  $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", true, true, "Modules/TestQuestionPool");
693  $this->ctrl->setParameterByClass($this->getTargetGuiClass(), "formtimestamp", time());
694  $hrefArea = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd());
695  foreach ($this->object->answers as $answer_id => $answer) {
696  $template->setCurrentBlock("imagemap_area");
697  $template->setVariable("HREF_AREA", $this->buildAreaLinkTarget($userSelection, $answer_id));
698  $template->setVariable("SHAPE", $answer->getArea());
699  $template->setVariable("COORDS", $answer->getCoords());
700  $template->setVariable("ALT", ilUtil::prepareFormOutput($answer->getAnswertext()));
701  $template->setVariable("TITLE", ilUtil::prepareFormOutput($answer->getAnswertext()));
702  $template->parseCurrentBlock();
703  if ($show_feedback) {
704  if (!$this->object->getIsMultipleChoice() && count($userSelection) && current($userSelection) == $answer_id) {
705  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
706  $this->object->getId(),
707  0,
708  $answer_id
709  );
710  if (strlen($feedback)) {
711  $template->setCurrentBlock("feedback");
712  $template->setVariable("FEEDBACK", $feedback);
713  $template->parseCurrentBlock();
714  }
715  }
716  }
717  }
718  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
719  $template->setVariable("IMG_SRC", ilWACSignedPath::signFile($imagepath));
720  $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
721  $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
722  $questionoutput = $template->get();
723  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
724  return $pageoutput;
725  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
buildAreaLinkTarget($currentSelection, $areaIndex)
Image map image preview creator.
$preview
Definition: imgupload.php:55
static signFile($path_to_file)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assImagemapQuestionGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

◆ populateCorrectionsFormProperties()

assImagemapQuestionGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

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

References $linecolor, ilPropertyFormGUI\addItem(), and ilImagemapFileInputGUI\setPointsUncheckedFieldEnabled().

920  {
921  require_once 'Modules/TestQuestionPool/classes/forms/class.ilImagemapCorrectionsInputGUI.php';
922  $image = new ilImagemapCorrectionsInputGUI($this->lng->txt('image'), 'image');
923  $image->setPointsUncheckedFieldEnabled($this->object->getIsMultipleChoice());
924  $image->setRequired(true);
925 
926  if (strlen($this->object->getImageFilename())) {
927  $image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename());
928  $image->setValue($this->object->getImageFilename());
929  $image->setAreas($this->object->getAnswers());
930  $assessmentSetting = new ilSetting("assessment");
931  $linecolor = (strlen(
932  $assessmentSetting->get("imap_line_color")
933  )) ? "\"#" . $assessmentSetting->get("imap_line_color") . "\"" : "\"#FF0000\"";
934  $image->setLineColor($linecolor);
935  $image->setImagePath($this->object->getImagePath());
936  $image->setImagePathWeb($this->object->getImagePathWeb());
937  }
938  $form->addItem($image);
939  }
addItem($a_item)
Add Item (Property, SectionHeader).
setPointsUncheckedFieldEnabled($pointsUncheckedFieldEnabled)
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assImagemapQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

Referenced by buildEditForm().

178  {
179  $radioGroup = new ilRadioGroupInputGUI($this->lng->txt('tst_imap_qst_mode'), 'is_multiple_choice');
180  $radioGroup->setValue($this->object->getIsMultipleChoice());
181  $modeSingleChoice = new ilRadioOption(
182  $this->lng->txt('tst_imap_qst_mode_sc'),
184  );
185  $modeMultipleChoice = new ilRadioOption(
186  $this->lng->txt('tst_imap_qst_mode_mc'),
188  );
189  $radioGroup->addOption($modeSingleChoice);
190  $radioGroup->addOption($modeMultipleChoice);
191  $form->addItem($radioGroup);
192 
193  require_once 'Modules/TestQuestionPool/classes/forms/class.ilImagemapFileInputGUI.php';
194  $image = new ilImagemapFileInputGUI($this->lng->txt('image'), 'image');
195  $image->setPointsUncheckedFieldEnabled($this->object->getIsMultipleChoice());
196  $image->setRequired(true);
197 
198  if (strlen($this->object->getImageFilename())) {
199  $image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename());
200  $image->setValue($this->object->getImageFilename());
201  $image->setAreas($this->object->getAnswers());
202  $assessmentSetting = new ilSetting("assessment");
203  $linecolor = (strlen(
204  $assessmentSetting->get("imap_line_color")
205  )) ? "\"#" . $assessmentSetting->get("imap_line_color") . "\"" : "\"#FF0000\"";
206  $image->setLineColor($linecolor);
207  $image->setImagePath($this->object->getImagePath());
208  $image->setImagePathWeb($this->object->getImagePathWeb());
209  }
210  $form->addItem($image);
211 
212  require_once 'Modules/TestQuestionPool/classes/forms/class.ilHtmlImageMapFileInputGUI.php';
213  $imagemapfile = new ilHtmlImageMapFileInputGUI($this->lng->txt('add_imagemap'), 'imagemapfile');
214  $imagemapfile->setRequired(false);
215  $form->addItem($imagemapfile);
216  return $form;
217  }
This class represents an option in a radio group.
Class ilHtmlImageMapFileInputGUI.
This class represents an image map file property in a property form.
This class represents a property in a property form.
setPointsUncheckedFieldEnabled($pointsUncheckedFieldEnabled)
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderAggregateView()

assImagemapQuestionGUI::renderAggregateView (   $answeringFequencies)
protected

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

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

832  {
833  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
834 
835  $tpl->setCurrentBlock('headercell');
836  $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_answer_header'));
837  $tpl->parseCurrentBlock();
838 
839  $tpl->setCurrentBlock('headercell');
840  $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_frequency_header'));
841  $tpl->parseCurrentBlock();
842 
843  foreach ($answeringFequencies as $answerIndex => $answeringFrequency) {
844  $tpl->setCurrentBlock('aggregaterow');
845  $tpl->setVariable('OPTION', $this->object->getAnswer($answerIndex)->getAnswerText());
846  $tpl->setVariable('COUNT', $answeringFrequency);
847  $tpl->parseCurrentBlock();
848  }
849 
850  return $tpl->get();
851  }
+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

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

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

References $index, and ilPropertyFormGUI\getItemByPostVar().

945  {
946  $areas = $form->getItemByPostVar('image')->getAreas();
947 
948  foreach ($this->object->getAnswers() as $index => $answer) {
949  if ($this->object->getIsMultipleChoice()) {
950  $answer->setPointsUnchecked((float) $areas[$index]->getPointsUnchecked());
951  }
952 
953  $answer->setPoints((float) $areas[$index]->getPoints());
954  }
955  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
$index
Definition: metadata.php:128
+ Here is the call graph for this function:

◆ saveShape()

assImagemapQuestionGUI::saveShape ( )

Saves a shape of the area editor.

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

References $_POST, and assImagemapQuestion\AVAILABLE_SHAPES.

238  {
239  $coords = "";
240  switch ($_POST["shape"]) {
242  $coords = join(",", $_POST['image']['mapcoords']);
243  ilUtil::sendSuccess($this->lng->txt('msg_rect_added'), true);
244  break;
246  if (preg_match("/(\d+)\s*,\s*(\d+)\s+(\d+)\s*,\s*(\d+)/", $_POST['image']['mapcoords'][0] . " " . $_POST['image']['mapcoords'][1], $matches)) {
247  $coords = "$matches[1],$matches[2]," . (int) sqrt((($matches[3] - $matches[1]) * ($matches[3] - $matches[1])) + (($matches[4] - $matches[2]) * ($matches[4] - $matches[2])));
248  }
249  ilUtil::sendSuccess($this->lng->txt('msg_circle_added'), true);
250  break;
252  $coords = join(",", $_POST['image']['mapcoords']);
253  ilUtil::sendSuccess($this->lng->txt('msg_poly_added'), true);
254  break;
255  }
256  $this->object->addAnswer($_POST["shapetitle"], 0, count($this->object->getAnswers()), $coords, $_POST["shape"]);
257  $this->object->saveToDb();
258  $this->ctrl->redirect($this, 'editQuestion');
259  }
$_POST["username"]

◆ supportsIntermediateSolutionOutput()

◆ writeAnswerSpecificPostData()

assImagemapQuestionGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

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

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

Implements ilGuiAnswerScoringAdjustable.

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

References $_POST, $name, and ilPropertyFormGUI\getItemByPostVar().

Referenced by writePostData().

91  {
92  if ($this->ctrl->getCmd() != 'deleteImage') {
93  $this->object->flushAnswers();
94  if (is_array($_POST['image']['coords']['name'])) {
95  foreach ($_POST['image']['coords']['name'] as $idx => $name) {
96  if ($this->object->getIsMultipleChoice() && isset($_POST['image']['coords']['points_unchecked'])) {
97  $pointsUnchecked = $_POST['image']['coords']['points_unchecked'][$idx];
98  } else {
99  $pointsUnchecked = 0.0;
100  }
101 
102  $this->object->addAnswer(
103  $name,
104  $_POST['image']['coords']['points'][$idx],
105  $idx,
106  $_POST['image']['coords']['coords'][$idx],
107  $_POST['image']['coords']['shape'][$idx],
108  $pointsUnchecked
109  );
110  }
111  }
112 
113  if (strlen($_FILES['imagemapfile']['tmp_name'])) {
114  if ($this->object->getSelfAssessmentEditingMode() && $this->object->getId() < 1) {
115  $this->object->createNewQuestion();
116  }
117 
118  $this->object->uploadImagemap($form->getItemByPostVar('imagemapfile')->getShapes());
119  }
120  }
121  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
if($format !==null) $name
Definition: metadata.php:230
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writePostData()

assImagemapQuestionGUI::writePostData (   $always = false)
protected

{}

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

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

73  {
74  $form = $this->buildEditForm();
75  $form->setValuesByPost();
76 
77  if (!$always && !$form->checkInput()) {
78  $this->editQuestion($form);
79  return 1;
80  }
81 
83  $this->writeQuestionSpecificPostData($form);
84  $this->writeAnswerSpecificPostData($form);
85  $this->saveTaxonomyAssignments();
86 
87  return 0;
88  }
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.

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

Implements ilGuiQuestionScoringAdjustable.

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

References $_POST, and assImagemapQuestion\MODE_MULTIPLE_CHOICE.

Referenced by writePostData().

124  {
125  if ($this->ctrl->getCmd() != 'deleteImage') {
126  if (strlen($_FILES['image']['tmp_name']) == 0) {
127  $this->object->setImageFilename($_POST["image_name"]);
128  }
129  }
130  if (strlen($_FILES['image']['tmp_name'])) {
131  if ($this->object->getSelfAssessmentEditingMode() && $this->object->getId() < 1) {
132  $this->object->createNewQuestion();
133  }
134  $this->object->setImageFilename($_FILES['image']['name'], $_FILES['image']['tmp_name']);
135  }
136 
137  $this->object->setIsMultipleChoice($_POST['is_multiple_choice'] == assImagemapQuestion::MODE_MULTIPLE_CHOICE);
138  }
$_POST["username"]
+ Here is the caller graph for this function:

Field Documentation

◆ $linecolor


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