ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 writeAnswerSpecificPostData ($always=true)
 
 writeQuestionSpecificPostData ($always=true)
 
 editQuestion ($checkonly=FALSE)
 
 populateAnswerSpecificFormPart (\ilPropertyFormGUI $form)
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 addRect ()
 
 addCircle ()
 
 addPoly ()
 
 saveShape ()
 Saves a shape of the area editor. More...
 
 areaEditor ($shape='')
 
 removeArea ()
 
 back ()
 
 outQuestionForTest ($formaction, $active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
 
 getSolutionOutput ( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
 Get the question solution output. More...
 
 getPreview ($show_question_only=FALSE)
 
 getTestOutput ($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 
 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...
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui (ilTestPlayerAbstractGUI $linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 assessment ()
 output assessment More...
 
_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...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getSelfAssessmentTags ()
 Get tags allowed in question tags in self assessment mode. 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...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 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 ()
 
 showHints ()
 

Private Attributes

 $linecolor
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
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'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
- Protected Member Functions inherited from assQuestionGUI
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 writeQuestionGenericPostData ()
 

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$

Definition at line 23 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 36 of file class.assImagemapQuestionGUI.php.

37  {
38  parent::__construct();
39  include_once './Modules/TestQuestionPool/classes/class.assImagemapQuestion.php';
40  $this->object = new assImagemapQuestion();
41  if ($id >= 0)
42  {
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  }
ILIAS Setting Class.
Class for image map questions.

Member Function Documentation

◆ addCircle()

assImagemapQuestionGUI::addCircle ( )

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

References areaEditor().

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

◆ addPoly()

assImagemapQuestionGUI::addPoly ( )

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

References areaEditor().

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

◆ addRect()

assImagemapQuestionGUI::addRect ( )

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

References areaEditor().

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

◆ areaEditor()

assImagemapQuestionGUI::areaEditor (   $shape = '')

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

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

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

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

◆ back()

assImagemapQuestionGUI::back ( )

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

References ilUtil\sendInfo().

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

◆ editQuestion()

assImagemapQuestionGUI::editQuestion (   $checkonly = FALSE)

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

References $errors, assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), assQuestionGUI\getQuestionTemplate(), assQuestionGUI\isSaveCommand(), assQuestionGUI\outQuestionType(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by removeArea(), and writePostData().

144  {
145  $save = $this->isSaveCommand();
146  $this->getQuestionTemplate();
147 
148  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
149  $form = new ilPropertyFormGUI();
150  $form->setFormAction($this->ctrl->getFormAction($this));
151  $form->setTitle($this->outQuestionType());
152  $form->setMultipart(TRUE);
153  $form->setTableWidth("100%");
154  $form->setId("assimagemap");
155 
156  $this->addBasicQuestionFormProperties( $form );
157  $this->populateQuestionSpecificFormPart( $form );
158  // $this->populateAnswerSpecificFormPart( $form ); Nothing to do here, this line FYI. See notes in method.
159 
160  $this->populateTaxonomyFormSection($form);
161  $this->addQuestionFormCommandButtons($form);
162 
163  $errors = false;
164  if ($save)
165  {
166  $form->setValuesByPost();
167  $errors = !$form->checkInput();
168  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling
169  // and we need this if we don't want to have duplication of backslashes
170  if ($errors) $checkonly = false;
171  }
172 
173  if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
174  return $errors;
175  }
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
$errors
getQuestionTemplate()
get question template
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:

◆ 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[]

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

872  {
873  return array();
874  }

◆ 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[]

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

886  {
887  return array();
888  }

◆ 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

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

899  {
900  return ''; //print_r($relevant_answers,true);
901  }

◆ getCommand()

assImagemapQuestionGUI::getCommand (   $cmd)

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

References $_POST, and $cmd.

50  {
51  if (isset($_POST["imagemap"]) ||
52  isset($_POST["imagemap_x"]) ||
53  isset($_POST["imagemap_y"]))
54  {
55  $this->ctrl->setCmd("getCoords");
56  $cmd = "getCoords";
57  }
58 
59  return $cmd;
60  }
$_POST['username']
Definition: cron.php:12
$cmd
Definition: sahs_server.php:35

◆ getPreview()

assImagemapQuestionGUI::getPreview (   $show_question_only = FALSE)

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

References assQuestionGUI\getILIASPage(), and ilUtil\prepareFormOutput().

610  {
611  $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
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  $formaction = "#";
616  foreach ($this->object->answers as $answer_id => $answer)
617  {
618  $template->setCurrentBlock("imagemap_area");
619  $template->setVariable("HREF_AREA", $formaction);
620  $template->setVariable("SHAPE", $answer->getArea());
621  $template->setVariable("COORDS", $answer->getCoords());
622  $template->setVariable("ALT", ilUtil::prepareFormOutput($answer->getAnswertext()));
623  $template->setVariable("TITLE", ilUtil::prepareFormOutput($answer->getAnswertext()));
624  $template->parseCurrentBlock();
625  }
626  $questiontext = $this->object->getQuestion();
627  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
628  $template->setVariable("IMG_SRC", "$imagepath");
629  $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
630  $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
631  $questionoutput = $template->get();
632  if (!$show_question_only)
633  {
634  // get page object output
635  $questionoutput = $this->getILIASPage($questionoutput);
636  }
637  return $questionoutput;
638  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ getSolutionOutput()

assImagemapQuestionGUI::getSolutionOutput (   $active_id,
  $pass = NULL,
  $graphicalOutput = FALSE,
  $result_output = FALSE,
  $show_question_only = TRUE,
  $show_feedback = FALSE,
  $show_correct_solution = FALSE,
  $show_manual_scoring = FALSE,
  $show_question_text = TRUE 
)

Get the question solution output.

Parameters
integer$active_idThe active user id
integer$passThe test pass
boolean$graphicalOutputShow visual feedback for right/wrong answers
boolean$result_outputShow the reached points for parts of the question
boolean$show_question_onlyShow the question without the ILIAS content around
boolean$show_feedbackShow the question feedback
boolean$show_correct_solutionShow the correct solution instead of the user solution
boolean$show_manual_scoringShow specific information for the manual scoring output
Returns
The solution output of the question as HTML code

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

References $linecolor, $pass, $preview, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), assQuestionGUI\getAnswerFeedbackOutput(), and ilUtil\getImagePath().

476  {
477  $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
478  $solutions = array();
479  if (($active_id > 0) && (!$show_correct_solution))
480  {
481  include_once "./Modules/Test/classes/class.ilObjTest.php";
482  if ((!$showsolution) && !ilObjTest::_getUsePreviousAnswers($active_id, true))
483  {
484  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
485  }
486  $solutions =& $this->object->getSolutionValues($active_id, $pass);
487  }
488  else
489  {
490  if(!$this->object->getIsMultipleChoice())
491  {
492  $found_index = -1;
493  $max_points = 0;
494  foreach ($this->object->answers as $index => $answer)
495  {
496  if ($answer->getPoints() > $max_points)
497  {
498  $max_points = $answer->getPoints();
499  $found_index = $index;
500  }
501  }
502  array_push($solutions, array("value1" => $found_index));
503  }
504  else
505  {
506  // take the correct solution instead of the user solution
507  foreach($this->object->answers as $index => $answer)
508  {
509  $points_checked = $answer->getPoints();
510  $points_unchecked = $answer->getPointsUnchecked();
511  if($points_checked > $points_unchecked)
512  {
513  if($points_checked > 0)
514  {
515  array_push($solutions, array("value1" => $index));
516  }
517  }
518  }
519  }
520  }
521  $solution_id = -1;
522  if (is_array($solutions))
523  {
524  include_once "./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
525  $preview = new ilImagemapPreview($this->object->getImagePath().$this->object->getImageFilename());
526  foreach ($solutions as $idx => $solution_value)
527  {
528  if (strcmp($solution_value["value1"], "") != 0)
529  {
530  $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);
531  $solution_id = $solution_value["value1"];
532  }
533  }
534  $preview->createPreview();
535  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
536  }
537 
538  // generate the question output
539  include_once "./Services/UICore/classes/class.ilTemplate.php";
540  $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
541  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
542  $questiontext = $this->object->getQuestion();
543  if ($show_question_text==true)
544  {
545  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
546  }
547  $template->setVariable("IMG_SRC", "$imagepath");
548  $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
549  $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
550  if (($active_id > 0) && (!$show_correct_solution))
551  {
552  if ($graphicalOutput)
553  {
554  // output of ok/not ok icons for user entered solutions
555  $reached_points = $this->object->getReachedPoints($active_id, $pass);
556  if ($reached_points == $this->object->getMaximumPoints())
557  {
558  $template->setCurrentBlock("icon_ok");
559  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.png"));
560  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
561  $template->parseCurrentBlock();
562  }
563  else
564  {
565  $template->setCurrentBlock("icon_ok");
566  if ($reached_points > 0)
567  {
568  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.png"));
569  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
570  }
571  else
572  {
573  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.png"));
574  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
575  }
576  $template->parseCurrentBlock();
577  }
578  }
579  }
580 
581  if ($show_feedback)
582  {
583  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
584  $this->object->getId(), $solution_id
585  );
586 
587  if (strlen($fb))
588  {
589  $template->setCurrentBlock("feedback");
590  $template->setVariable("FEEDBACK", $fb);
591  $template->parseCurrentBlock();
592  }
593  }
594 
595  $questionoutput = $template->get();
596  $feedback = ($show_feedback) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
597  if (strlen($feedback)) $solutiontemplate->setVariable("FEEDBACK", $feedback);
598  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
599 
600  $solutionoutput = $solutiontemplate->get();
601  if (!$show_question_only)
602  {
603  // get page object output
604  $solutionoutput = '<div class="ilc_question_Standard">'.$solutionoutput."</div>";
605  }
606  return $solutionoutput;
607  }
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
Image map image preview creator.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
$preview
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assImagemapQuestionGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

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

845  {
846  $output = '<table class="ilTstSpecificFeedbackTable"><tbody>';
847 
848  foreach($this->object->getAnswers() as $idx => $answer)
849  {
850  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
851  $this->object->getId(), $idx
852  );
853 
854  $output .= "<tr><td><b><i>{$answer->getAnswerText()}</i></b></td><td>{$feedback}</td></tr>";
855  }
856 
857  $output .= '</tbody></table>';
858 
859  return $this->object->prepareTextareaOutput($output, TRUE);
860  }

◆ getTestOutput()

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

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

References $linecolor, $pass, $preview, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), assQuestionGUI\getTargetGuiClass(), assQuestionGUI\outQuestionPage(), and ilUtil\prepareFormOutput().

Referenced by outQuestionForTest().

641  {
642  // get the solution of the user for the active pass or from the last pass if allowed
643  $user_solution = "";
644  if($this->object->getIsMultipleChoice())
645  {
646  $user_solution = array();
647  }
648  if ($active_id)
649  {
650  $solutions = NULL;
651  include_once "./Modules/Test/classes/class.ilObjTest.php";
652  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
653  {
654  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
655  }
656  $solutions =& $this->object->getSolutionValues($active_id, $pass);
657  foreach ($solutions as $idx => $solution_value)
658  {
659  if($this->object->getIsMultipleChoice())
660  {
661  $user_solution[] = $solution_value["value1"];
662  }
663  else
664  {
665  $user_solution = $solution_value["value1"];
666  }
667  }
668  }
669 
670  $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
671  if ($active_id)
672  {
673  $solutions = NULL;
674  include_once "./Modules/Test/classes/class.ilObjTest.php";
675  if ((!$showsolution) && !ilObjTest::_getUsePreviousAnswers($active_id, true))
676  {
677  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
678  }
679  $solutions =& $this->object->getSolutionValues($active_id, $pass);
680  include_once "./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
681  $preview = new ilImagemapPreview($this->object->getImagePath().$this->object->getImageFilename());
682  foreach ($solutions as $idx => $solution_value)
683  {
684  if (strcmp($solution_value["value1"], "") != 0)
685  {
686  $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);
687  }
688  }
689  $preview->createPreview();
690  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
691  }
692 
693  // generate the question output
694  include_once "./Services/UICore/classes/class.ilTemplate.php";
695  $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
696  $this->ctrl->setParameterByClass($this->getTargetGuiClass(), "formtimestamp", time());
697  $hrefArea = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), "handleQuestionAction");
698  foreach ($this->object->answers as $answer_id => $answer)
699  {
700  $template->setCurrentBlock("imagemap_area");
701  $parameter = "&amp;selImage=$answer_id";
702  if(is_array($user_solution) && in_array($answer_id, $user_solution))
703  {
704  $parameter = "&amp;remImage=$answer_id";
705  }
706  $template->setVariable("HREF_AREA", $hrefArea . $parameter);
707  $template->setVariable("SHAPE", $answer->getArea());
708  $template->setVariable("COORDS", $answer->getCoords());
709  $template->setVariable("ALT", ilUtil::prepareFormOutput($answer->getAnswertext()));
710  $template->setVariable("TITLE", ilUtil::prepareFormOutput($answer->getAnswertext()));
711  $template->parseCurrentBlock();
712  if ($show_feedback)
713  {
714  if(!$this->object->getIsMultipleChoice() && strlen($user_solution) && $user_solution == $answer_id)
715  {
716  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
717  $this->object->getId(), $answer_id
718  );
719  if (strlen($feedback))
720  {
721  $template->setCurrentBlock("feedback");
722  $template->setVariable("FEEDBACK", $feedback);
723  $template->parseCurrentBlock();
724  }
725  }
726  }
727  }
728  $questiontext = $this->object->getQuestion();
729  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
730  $template->setVariable("IMG_SRC", "$imagepath");
731  $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
732  $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
733  $questionoutput = $template->get();
734  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
735  return $pageoutput;
736  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
Image map image preview creator.
special template class to simplify handling of ITX/PEAR
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
$preview
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outQuestionForTest()

assImagemapQuestionGUI::outQuestionForTest (   $formaction,
  $active_id,
  $pass = NULL,
  $is_postponed = FALSE,
  $use_post_solutions = FALSE,
  $show_feedback = FALSE 
)

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

References $pass, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), and getTestOutput().

426  {
427  $test_output = $this->getTestOutput($active_id, $pass, $is_postponed, $use_post_solutions, $show_feedback);
428  $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
429 
430  #$this->ctrl->setParameterByClass($this->getTargetGuiClass(), "formtimestamp", time());
431  #$formaction = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), "selectImagemapRegion");
432  include_once "./Modules/Test/classes/class.ilObjTest.php";
433  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
434  {
435  $pass = ilObjTest::_getPass($active_id);
436  $info =& $this->object->getSolutionValues($active_id, $pass);
437  }
438  else
439  {
440  $info =& $this->object->getSolutionValues($active_id, NULL);
441  }
442  if (count($info))
443  {
444  if (strcmp($info[0]["value1"], "") != 0)
445  {
446  $formaction .= "&selImage=" . $info[0]["value1"];
447  }
448  }
449  $this->tpl->setVariable("FORMACTION", $formaction);
450  }
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
getTestOutput($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assImagemapQuestionGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

◆ populateQuestionSpecificFormPart()

assImagemapQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 184 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 editQuestion().

185  {
186  // is MultipleChoice?
187  $radioGroup = new ilRadioGroupInputGUI($this->lng->txt( 'tst_imap_qst_mode' ), 'is_multiple_choice');
188  $radioGroup->setValue( $this->object->getIsMultipleChoice() );
189  $modeSingleChoice = new ilRadioOption($this->lng->txt( 'tst_imap_qst_mode_sc'),
191  $modeMultipleChoice = new ilRadioOption($this->lng->txt( 'tst_imap_qst_mode_mc'),
193  $radioGroup->addOption( $modeSingleChoice );
194  $radioGroup->addOption( $modeMultipleChoice );
195  $form->addItem( $radioGroup );
196 
197  // image
198  include_once "./Modules/TestQuestionPool/classes/class.ilImagemapFileInputGUI.php";
199  $image = new ilImagemapFileInputGUI($this->lng->txt( 'image' ), 'image');
200  $image->setPointsUncheckedFieldEnabled( $this->object->getIsMultipleChoice() );
201  $image->setRequired( true );
202 
203  if (strlen( $this->object->getImageFilename() ))
204  {
205  $image->setImage( $this->object->getImagePathWeb() . $this->object->getImageFilename() );
206  $image->setValue( $this->object->getImageFilename() );
207  $image->setAreas( $this->object->getAnswers() );
208  $assessmentSetting = new ilSetting("assessment");
209  $linecolor = (strlen( $assessmentSetting->get( "imap_line_color" )
210  )) ? "\"#" . $assessmentSetting->get( "imap_line_color" ) . "\"" : "\"#FF0000\"";
211  $image->setLineColor( $linecolor );
212  $image->setImagePath( $this->object->getImagePath() );
213  $image->setImagePathWeb( $this->object->getImagePathWeb() );
214  }
215  $form->addItem( $image );
216 
217  // imagemapfile
218  $imagemapfile = new ilFileInputGUI($this->lng->txt( 'add_imagemap' ), 'imagemapfile');
219  $imagemapfile->setRequired( false );
220  $form->addItem( $imagemapfile );
221  return $form;
222  }
This class represents an option in a radio group.
ILIAS Setting Class.
This class represents a file property in a property form.
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:

◆ removeArea()

assImagemapQuestionGUI::removeArea ( )

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

References $_POST, editQuestion(), and assQuestionGUI\writePostData().

412  {
413  $this->writePostData(true);
414  $position = key($_POST['cmd']['removeArea']['image']);
415  $this->object->deleteArea($position);
416  $this->editQuestion();
417  }
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ saveShape()

assImagemapQuestionGUI::saveShape ( )

Saves a shape of the area editor.

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

References $_POST, and ilUtil\sendSuccess().

243  {
244  $coords = "";
245  switch ($_POST["shape"])
246  {
247  case "rect":
248  $coords = join($_POST['image']['mapcoords'], ",");
249  ilUtil::sendSuccess($this->lng->txt('msg_rect_added'), true);
250  break;
251  case "circle":
252  if (preg_match("/(\d+)\s*,\s*(\d+)\s+(\d+)\s*,\s*(\d+)/", $_POST['image']['mapcoords'][0] . " " . $_POST['image']['mapcoords'][1], $matches))
253  {
254  $coords = "$matches[1],$matches[2]," . (int)sqrt((($matches[3]-$matches[1])*($matches[3]-$matches[1]))+(($matches[4]-$matches[2])*($matches[4]-$matches[2])));
255  }
256  ilUtil::sendSuccess($this->lng->txt('msg_circle_added'), true);
257  break;
258  case "poly":
259  $coords = join($_POST['image']['mapcoords'], ",");
260  ilUtil::sendSuccess($this->lng->txt('msg_poly_added'), true);
261  break;
262  }
263  $this->object->addAnswer($_POST["shapetitle"], 0, count($this->object->getAnswers()), $coords, $_POST["shape"]);
264  $this->object->saveToDb();
265  $this->ctrl->redirect($this, 'editQuestion');
266  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ setQuestionTabs()

assImagemapQuestionGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

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

References $_GET, $_POST, $ref_id, assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), and ilTestExpressPage\getReturnToPageLink().

746  {
747  global $rbacsystem, $ilTabs;
748 
749  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
750  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
751  $q_type = $this->object->getQuestionType();
752 
753  if (strlen($q_type))
754  {
755  $classname = $q_type . "GUI";
756  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
757  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
758  }
759 
760  if ($_GET["q_id"])
761  {
762  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
763  {
764  // edit page
765  $ilTabs->addTarget("edit_page",
766  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
767  array("edit", "insert", "exec_pg"),
768  "", "", $force_active);
769  }
770 
771  // edit page
772  $ilTabs->addTarget("preview",
773  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "preview"),
774  array("preview"),
775  "ilAssQuestionPageGUI", "", $force_active);
776  }
777 
778  $force_active = false;
779  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
780  {
781  $url = "";
782  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
783  if (array_key_exists("imagemap_x", $_POST))
784  {
785  $force_active = true;
786  }
787  // edit question properties
788  $ilTabs->addTarget("edit_question",
789  $url,
790  array("editQuestion", "save", "addArea", "addRect", "addCircle", "addPoly",
791  "uploadingImage", "uploadingImagemap", "areaEditor",
792  "removeArea", "saveShape", "saveEdit", "originalSyncForm"),
793  $classname, "", $force_active);
794  }
795 
796  // add tab for question feedback within common class assQuestionGUI
797  $this->addTab_QuestionFeedback($ilTabs);
798 
799  // add tab for question hint within common class assQuestionGUI
800  $this->addTab_QuestionHints($ilTabs);
801 
802  if ($_GET["q_id"])
803  {
804  $ilTabs->addTarget("solution_hint",
805  $this->ctrl->getLinkTargetByClass($classname, "suggestedsolution"),
806  array("suggestedsolution", "saveSuggestedSolution", "outSolutionExplorer", "cancel",
807  "addSuggestedSolution","cancelExplorer", "linkChilds", "removeSuggestedSolution"
808  ),
809  $classname,
810  ""
811  );
812  }
813 
814  // Assessment of questions sub menu entry
815  if ($_GET["q_id"])
816  {
817  $ilTabs->addTarget("statistics",
818  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
819  array("assessment"),
820  $classname, "");
821  }
822 
823  if (($_GET["calling_test"] > 0) || ($_GET["test_ref_id"] > 0))
824  {
825  $ref_id = $_GET["calling_test"];
826  if (strlen($ref_id) == 0) $ref_id = $_GET["test_ref_id"];
827 
828  global $___test_express_mode;
829 
830  if (!$_GET['test_express_mode'] && !$___test_express_mode) {
831  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
832  }
833  else {
835  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), $link);
836  }
837  }
838  else
839  {
840  $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
841  }
842  }
$_POST['username']
Definition: cron.php:12
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
$_GET["client_id"]
static getReturnToPageLink($q_id=null)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

◆ writeAnswerSpecificPostData()

assImagemapQuestionGUI::writeAnswerSpecificPostData (   $always = true)

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

References $_POST.

Referenced by writePostData().

84  {
85  if (!$_POST['image_delete'])
86  {
87  $this->object->flushAnswers();
88  if (is_array( $_POST['image']['coords']['name'] ))
89  {
90  foreach ($_POST['image']['coords']['name'] as $idx => $name)
91  {
92  if( $this->object->getIsMultipleChoice() && isset($_POST['image']['coords']['points_unchecked']) )
93  {
94  $pointsUnchecked = $_POST['image']['coords']['points_unchecked'][$idx];
95  }
96  else
97  {
98  $pointsUnchecked = 0.0;
99  }
100 
101  $this->object->addAnswer(
102  $name,
103  $_POST['image']['coords']['points'][$idx],
104  $idx,
105  $_POST['image']['coords']['coords'][$idx],
106  $_POST['image']['coords']['shape'][$idx],
107  $pointsUnchecked
108  );
109  }
110  }
111  if (strlen( $_FILES['imagemapfile']['tmp_name'] ))
112  {
113  if ($this->object->getSelfAssessmentEditingMode() && $this->object->getId() < 1)
114  $this->object->createNewQuestion();
115  $this->object->uploadImagemap( $_FILES['imagemapfile']['tmp_name'] );
116  }
117  }
118  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

◆ writePostData()

assImagemapQuestionGUI::writePostData (   $always = false)

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

Parameters
bool$always
Returns
integer A positive value, if one of the required fields wasn't set, else 0

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

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

70  {
71  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
72  if (!$hasErrors)
73  {
77  $this->saveTaxonomyAssignments();
78  return 0;
79  }
80  return 1;
81  }
+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assImagemapQuestionGUI::writeQuestionSpecificPostData (   $always = true)

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

References $_POST, and assImagemapQuestion\MODE_MULTIPLE_CHOICE.

Referenced by writePostData().

121  {
122  if ($_POST['image_delete'])
123  {
124  $this->object->deleteImage();
125  }
126  else
127  {
128  if (strlen( $_FILES['image']['tmp_name'] ) == 0)
129  {
130  $this->object->setImageFilename( $_POST["image_name"] );
131  }
132  }
133  if (strlen( $_FILES['image']['tmp_name'] ))
134  {
135  if ($this->object->getSelfAssessmentEditingMode() && $this->object->getId() < 1)
136  $this->object->createNewQuestion();
137  $this->object->setImageFilename( $_FILES['image']['name'], $_FILES['image']['tmp_name'] );
138  }
139 
140  $this->object->setIsMultipleChoice($_POST['is_multiple_choice'] == assImagemapQuestion::MODE_MULTIPLE_CHOICE);
141  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

Field Documentation

◆ $linecolor

assImagemapQuestionGUI::$linecolor
private

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