ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 (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 ($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, $showInlineFeedback=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 ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
_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...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass=NULL, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
- 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 ()
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_QuestionPreview (ilTabsGUI $tabsGUI)
 
 writeQuestionGenericPostData ()
 
 getFormEncodingType ()
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 

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'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 

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

References areaEditor().

238  {
239  $this->areaEditor('circle');
240  }
+ Here is the call graph for this function:

◆ addPoly()

assImagemapQuestionGUI::addPoly ( )

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

References areaEditor().

243  {
244  $this->areaEditor('poly');
245  }
+ Here is the call graph for this function:

◆ addRect()

assImagemapQuestionGUI::addRect ( )

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

References areaEditor().

233  {
234  $this->areaEditor('rect');
235  }
+ Here is the call graph for this function:

◆ areaEditor()

assImagemapQuestionGUI::areaEditor (   $shape = '')

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

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

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

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

◆ back()

assImagemapQuestionGUI::back ( )

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

References ilUtil\sendInfo().

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

◆ deleteImage()

assImagemapQuestionGUI::deleteImage ( )
protected

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

References assQuestionGUI\writePostData().

63  {
64  $this->writePostData(true);
65  $this->object->saveToDb();
66  $this->ctrl->redirect($this, 'editQuestion');
67  }
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
+ Here is the call graph for this function:

◆ editQuestion()

assImagemapQuestionGUI::editQuestion (   $checkonly = FALSE)

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

152  {
153  $save = $this->isSaveCommand();
154  $this->getQuestionTemplate();
155 
156  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
157  $form = new ilPropertyFormGUI();
158  $form->setFormAction($this->ctrl->getFormAction($this));
159  $form->setTitle($this->outQuestionType());
160  $form->setMultipart(TRUE);
161  $form->setTableWidth("100%");
162  $form->setId("assimagemap");
163 
164  $this->addBasicQuestionFormProperties( $form );
165  $this->populateQuestionSpecificFormPart( $form );
166  // $this->populateAnswerSpecificFormPart( $form ); Nothing to do here, this line FYI. See notes in method.
167 
168  $this->populateTaxonomyFormSection($form);
169  $this->addQuestionFormCommandButtons($form);
170 
171  $errors = false;
172  if ($save)
173  {
174  $form->setValuesByPost();
175  $errors = !$form->checkInput();
176  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling
177  // and we need this if we don't want to have duplication of backslashes
178  if ($errors) $checkonly = false;
179  }
180 
181  if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
182  return $errors;
183  }
$errors
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.
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[]

Implements ilGuiAnswerScoringAdjustable.

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

906  {
907  return array();
908  }

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

920  {
921  return array();
922  }

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

933  {
934  return ''; //print_r($relevant_answers,true);
935  }

◆ 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,
  $showInlineFeedback = false 
)

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

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

621  {
622  if( is_object($this->getPreviewSession()) )
623  {
624  $user_solution = array();
625 
626  if( is_array($this->getPreviewSession()->getParticipantsSolution()) )
627  {
628  $user_solution = array_values($this->getPreviewSession()->getParticipantsSolution());
629  }
630 
631  include_once "./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
632  $preview = new ilImagemapPreview($this->object->getImagePath().$this->object->getImageFilename());
633  foreach ($user_solution as $idx => $solution_value)
634  {
635  if (strcmp($solution_value, "") != 0)
636  {
637  $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);
638  }
639  }
640  $preview->createPreview();
641  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
642  }
643  else
644  {
645  $user_solution = array();
646  $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
647  }
648 
649  // generate the question output
650  include_once "./Services/UICore/classes/class.ilTemplate.php";
651  $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
652 
653  if($this->getQuestionActionCmd())
654  {
655  $hrefArea = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd());
656  }
657  else
658  {
659  $hrefArea = null;
660  }
661 
662  foreach ($this->object->answers as $answer_id => $answer)
663  {
664  $parameter = "&selImage=$answer_id";
665  if(is_array($user_solution) && in_array($answer_id, $user_solution))
666  {
667  $parameter = "&remImage=$answer_id";
668  }
669 
670  if($hrefArea)
671  {
672  $template->setCurrentBlock("imagemap_area_href");
673  $template->setVariable("HREF_AREA", $hrefArea . $parameter);
674  $template->parseCurrentBlock();
675  }
676 
677  $template->setCurrentBlock("imagemap_area");
678  $template->setVariable("SHAPE", $answer->getArea());
679  $template->setVariable("COORDS", $answer->getCoords());
680  $template->setVariable("ALT", ilUtil::prepareFormOutput($answer->getAnswertext()));
681  $template->setVariable("TITLE", ilUtil::prepareFormOutput($answer->getAnswertext()));
682  $template->parseCurrentBlock();
683  }
684  $questiontext = $this->object->getQuestion();
685  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
686  $template->setVariable("IMG_SRC", "$imagepath");
687  $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
688  $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
689  $questionoutput = $template->get();
690  if (!$show_question_only)
691  {
692  // get page object output
693  $questionoutput = $this->getILIASPage($questionoutput);
694  }
695  return $questionoutput;
696  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$preview
Image map image preview creator.
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 476 of file class.assImagemapQuestionGUI.php.

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

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

874  {
875  if( !$this->object->feedbackOBJ->specificAnswerFeedbackExists(array_values($this->object->getAnswers())) )
876  {
877  return '';
878  }
879 
880  $output = '<table class="test_specific_feedback"><tbody>';
881 
882  foreach($this->object->getAnswers() as $idx => $answer)
883  {
884  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
885  $this->object->getId(), $idx
886  );
887 
888  $output .= "<tr><td>{$answer->getAnswerText()}</td><td>{$feedback}</td></tr>";
889  }
890 
891  $output .= '</tbody></table>';
892 
893  return $this->object->prepareTextareaOutput($output, TRUE);
894  }

◆ getTestOutput()

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

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

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

Referenced by outQuestionForTest().

699  {
700  // get the solution of the user for the active pass or from the last pass if allowed
701  $user_solution = "";
702  if($this->object->getIsMultipleChoice())
703  {
704  $user_solution = array();
705  }
706  if ($active_id)
707  {
708  $solutions = NULL;
709  include_once "./Modules/Test/classes/class.ilObjTest.php";
710  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
711  {
712  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
713  }
714  $solutions =& $this->object->getSolutionValues($active_id, $pass);
715  foreach ($solutions as $idx => $solution_value)
716  {
717  if($this->object->getIsMultipleChoice())
718  {
719  $user_solution[] = $solution_value["value1"];
720  }
721  else
722  {
723  $user_solution = $solution_value["value1"];
724  }
725  }
726  }
727 
728  $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
729  if ($active_id)
730  {
731  $solutions = NULL;
732  include_once "./Modules/Test/classes/class.ilObjTest.php";
733  if ((!$showsolution) && !ilObjTest::_getUsePreviousAnswers($active_id, true))
734  {
735  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
736  }
737  $solutions =& $this->object->getSolutionValues($active_id, $pass);
738  include_once "./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
739  $preview = new ilImagemapPreview($this->object->getImagePath().$this->object->getImageFilename());
740  foreach ($solutions as $idx => $solution_value)
741  {
742  if (strcmp($solution_value["value1"], "") != 0)
743  {
744  $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);
745  }
746  }
747  $preview->createPreview();
748  $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
749  }
750 
751  // generate the question output
752  include_once "./Services/UICore/classes/class.ilTemplate.php";
753  $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
754  $this->ctrl->setParameterByClass($this->getTargetGuiClass(), "formtimestamp", time());
755  $hrefArea = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd());
756  foreach ($this->object->answers as $answer_id => $answer)
757  {
758  $template->setCurrentBlock("imagemap_area");
759  $parameter = "&amp;selImage=$answer_id";
760  if(is_array($user_solution) && in_array($answer_id, $user_solution))
761  {
762  $parameter = "&amp;remImage=$answer_id";
763  }
764  $template->setVariable("HREF_AREA", $hrefArea . $parameter);
765  $template->setVariable("SHAPE", $answer->getArea());
766  $template->setVariable("COORDS", $answer->getCoords());
767  $template->setVariable("ALT", ilUtil::prepareFormOutput($answer->getAnswertext()));
768  $template->setVariable("TITLE", ilUtil::prepareFormOutput($answer->getAnswertext()));
769  $template->parseCurrentBlock();
770  if ($show_feedback)
771  {
772  if(!$this->object->getIsMultipleChoice() && strlen($user_solution) && $user_solution == $answer_id)
773  {
774  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
775  $this->object->getId(), $answer_id
776  );
777  if (strlen($feedback))
778  {
779  $template->setCurrentBlock("feedback");
780  $template->setVariable("FEEDBACK", $feedback);
781  $template->parseCurrentBlock();
782  }
783  }
784  }
785  }
786  $questiontext = $this->object->getQuestion();
787  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
788  $template->setVariable("IMG_SRC", "$imagepath");
789  $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
790  $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
791  $questionoutput = $template->get();
792  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
793  return $pageoutput;
794  }
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.
$preview
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.
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 433 of file class.assImagemapQuestionGUI.php.

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

434  {
435  // TODO - BEGIN: what exactly is done here? cant we use the parent method?
436 
437  require_once './Modules/Test/classes/class.ilObjTest.php';
438  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
439  {
440  $pass = ilObjTest::_getPass($active_id);
441  $info =& $this->object->getSolutionValues($active_id, $pass);
442  }
443  else
444  {
445  $info =& $this->object->getSolutionValues($active_id, NULL);
446  }
447 
448  if (count($info))
449  {
450  if (strcmp($info[0]["value1"], "") != 0)
451  {
452  $formaction .= "&selImage=" . $info[0]["value1"];
453  }
454  }
455 
456  $test_output = $this->getTestOutput($active_id, $pass, $is_postponed, $use_post_solutions, $show_feedback);
457  $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
458  $this->tpl->setVariable("FORMACTION", $formaction);
459 
460  // TODO - END: what exactly is done here? cant we use the parent method?
461  }
_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 185 of file class.assImagemapQuestionGUI.php.

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

◆ populateQuestionSpecificFormPart()

assImagemapQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

193  {
194  // is MultipleChoice?
195  $radioGroup = new ilRadioGroupInputGUI($this->lng->txt( 'tst_imap_qst_mode' ), 'is_multiple_choice');
196  $radioGroup->setValue( $this->object->getIsMultipleChoice() );
197  $modeSingleChoice = new ilRadioOption($this->lng->txt( 'tst_imap_qst_mode_sc'),
199  $modeMultipleChoice = new ilRadioOption($this->lng->txt( 'tst_imap_qst_mode_mc'),
201  $radioGroup->addOption( $modeSingleChoice );
202  $radioGroup->addOption( $modeMultipleChoice );
203  $form->addItem( $radioGroup );
204 
205  // image
206  include_once "./Modules/TestQuestionPool/classes/class.ilImagemapFileInputGUI.php";
207  $image = new ilImagemapFileInputGUI($this->lng->txt( 'image' ), 'image');
208  $image->setPointsUncheckedFieldEnabled( $this->object->getIsMultipleChoice() );
209  $image->setRequired( true );
210 
211  if (strlen( $this->object->getImageFilename() ))
212  {
213  $image->setImage( $this->object->getImagePathWeb() . $this->object->getImageFilename() );
214  $image->setValue( $this->object->getImageFilename() );
215  $image->setAreas( $this->object->getAnswers() );
216  $assessmentSetting = new ilSetting("assessment");
217  $linecolor = (strlen( $assessmentSetting->get( "imap_line_color" )
218  )) ? "\"#" . $assessmentSetting->get( "imap_line_color" ) . "\"" : "\"#FF0000\"";
219  $image->setLineColor( $linecolor );
220  $image->setImagePath( $this->object->getImagePath() );
221  $image->setImagePathWeb( $this->object->getImagePathWeb() );
222  }
223  $form->addItem( $image );
224 
225  // imagemapfile
226  $imagemapfile = new ilFileInputGUI($this->lng->txt( 'add_imagemap' ), 'imagemapfile');
227  $imagemapfile->setRequired( false );
228  $form->addItem( $imagemapfile );
229  return $form;
230  }
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 419 of file class.assImagemapQuestionGUI.php.

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

420  {
421  $this->writePostData(true);
422  $position = key($_POST['cmd']['removeArea']['image']);
423  $this->object->deleteArea($position);
424  $this->editQuestion();
425  }
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 250 of file class.assImagemapQuestionGUI.php.

References $_POST, and ilUtil\sendSuccess().

251  {
252  $coords = "";
253  switch ($_POST["shape"])
254  {
255  case "rect":
256  $coords = join($_POST['image']['mapcoords'], ",");
257  ilUtil::sendSuccess($this->lng->txt('msg_rect_added'), true);
258  break;
259  case "circle":
260  if (preg_match("/(\d+)\s*,\s*(\d+)\s+(\d+)\s*,\s*(\d+)/", $_POST['image']['mapcoords'][0] . " " . $_POST['image']['mapcoords'][1], $matches))
261  {
262  $coords = "$matches[1],$matches[2]," . (int)sqrt((($matches[3]-$matches[1])*($matches[3]-$matches[1]))+(($matches[4]-$matches[2])*($matches[4]-$matches[2])));
263  }
264  ilUtil::sendSuccess($this->lng->txt('msg_circle_added'), true);
265  break;
266  case "poly":
267  $coords = join($_POST['image']['mapcoords'], ",");
268  ilUtil::sendSuccess($this->lng->txt('msg_poly_added'), true);
269  break;
270  }
271  $this->object->addAnswer($_POST["shapetitle"], 0, count($this->object->getAnswers()), $coords, $_POST["shape"]);
272  $this->object->saveToDb();
273  $this->ctrl->redirect($this, 'editQuestion');
274  }
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 803 of file class.assImagemapQuestionGUI.php.

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

804  {
805  global $rbacsystem, $ilTabs;
806 
807  $ilTabs->clearTargets();
808 
809  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
810  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
811  $q_type = $this->object->getQuestionType();
812 
813  if (strlen($q_type))
814  {
815  $classname = $q_type . "GUI";
816  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
817  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
818  }
819 
820  if ($_GET["q_id"])
821  {
822  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
823  {
824  // edit page
825  $ilTabs->addTarget("edit_page",
826  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
827  array("edit", "insert", "exec_pg"),
828  "", "", $force_active);
829  }
830 
831  $this->addTab_QuestionPreview($ilTabs);
832  }
833 
834  $force_active = false;
835  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
836  {
837  $url = "";
838  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
839  if (array_key_exists("imagemap_x", $_POST))
840  {
841  $force_active = true;
842  }
843  // edit question properties
844  $ilTabs->addTarget("edit_question",
845  $url,
846  array("editQuestion", "save", "addArea", "addRect", "addCircle", "addPoly",
847  "uploadingImage", "uploadingImagemap", "areaEditor",
848  "removeArea", "saveShape", "saveEdit", "originalSyncForm"),
849  $classname, "", $force_active);
850  }
851 
852  // add tab for question feedback within common class assQuestionGUI
853  $this->addTab_QuestionFeedback($ilTabs);
854 
855  // add tab for question hint within common class assQuestionGUI
856  $this->addTab_QuestionHints($ilTabs);
857 
858  // add tab for question's suggested solution within common class assQuestionGUI
859  $this->addTab_SuggestedSolution($ilTabs, $classname);
860 
861  // Assessment of questions sub menu entry
862  if ($_GET["q_id"])
863  {
864  $ilTabs->addTarget("statistics",
865  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
866  array("assessment"),
867  $classname, "");
868  }
869 
870  $this->addBackTab($ilTabs);
871  }
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
$_POST['username']
Definition: cron.php:12
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
$_GET["client_id"]
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBackTab(ilTabsGUI $ilTabs)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
+ Here is the call graph for this function:

◆ writeAnswerSpecificPostData()

assImagemapQuestionGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

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

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

Implements ilGuiAnswerScoringAdjustable.

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

References $_POST.

Referenced by writePostData().

92  {
93  if ($this->ctrl->getCmd() != 'deleteImage')
94  {
95  $this->object->flushAnswers();
96  if (is_array( $_POST['image']['coords']['name'] ))
97  {
98  foreach ($_POST['image']['coords']['name'] as $idx => $name)
99  {
100  if( $this->object->getIsMultipleChoice() && isset($_POST['image']['coords']['points_unchecked']) )
101  {
102  $pointsUnchecked = $_POST['image']['coords']['points_unchecked'][$idx];
103  }
104  else
105  {
106  $pointsUnchecked = 0.0;
107  }
108 
109  $this->object->addAnswer(
110  $name,
111  $_POST['image']['coords']['points'][$idx],
112  $idx,
113  $_POST['image']['coords']['coords'][$idx],
114  $_POST['image']['coords']['shape'][$idx],
115  $pointsUnchecked
116  );
117  }
118  }
119  if (strlen( $_FILES['imagemapfile']['tmp_name'] ))
120  {
121  if ($this->object->getSelfAssessmentEditingMode() && $this->object->getId() < 1)
122  $this->object->createNewQuestion();
123  $this->object->uploadImagemap( $_FILES['imagemapfile']['tmp_name'] );
124  }
125  }
126  }
$_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 76 of file class.assImagemapQuestionGUI.php.

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

77  {
78  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
79  if (!$hasErrors)
80  {
81  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
85  $this->saveTaxonomyAssignments();
86  return 0;
87  }
88  return 1;
89  }
This class represents a property form user interface.
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.
+ 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 128 of file class.assImagemapQuestionGUI.php.

References $_POST, and assImagemapQuestion\MODE_MULTIPLE_CHOICE.

Referenced by writePostData().

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