ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 
 getSolutionOutput ( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
 Get the question solution output. More...
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 getTestOutput ($active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($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...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getOutputMode ()
 
 setOutputMode ($outputMode)
 
 isPdfOutputMode ()
 
 isContentEditingOutputMode ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 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...
 
 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, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
- Public Member Functions inherited from ilGuiAnswerScoringAdjustable
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 

Protected Member Functions

 deleteImage ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 renderAggregateView ($answeringFequencies)
 
 aggregateAnswers ($givenSolutionRows, $existingAnswerOptions)
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 getPreviousSolutionProvidedMessage ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 isLastSolutionSubmitAuthorized ($active_id, $pass)
 fetches solutions from database and prefers intermediate solutions, but falls back to authorized solutions. More...
 
 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)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 getTestOutputSolutions ($activeId, $pass)
 
 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...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const OUTPUT_MODE_SCREEN = 'outModeScreen'
 
const OUTPUT_MODE_PDF = 'outModePdf'
 
const OUTPUT_MODE_CONTENT_EDITING = 'outModeUsrSol'
 

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

Constructor & Destructor Documentation

◆ __construct()

assImagemapQuestionGUI::__construct (   $id = -1)

assImagemapQuestionGUI constructor

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

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

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

38 {
39 parent::__construct();
40 include_once './Modules/TestQuestionPool/classes/class.assImagemapQuestion.php';
41 $this->object = new assImagemapQuestion();
42 if ($id >= 0)
43 {
44 $this->object->loadFromDb($id);
45 }
46 $assessmentSetting = new ilSetting("assessment");
47 $this->linecolor = (strlen($assessmentSetting->get("imap_line_color"))) ? "#" . $assessmentSetting->get("imap_line_color") : "#FF0000";
48 }
Class for image map questions.
ILIAS Setting Class.

Member Function Documentation

◆ addCircle()

assImagemapQuestionGUI::addCircle ( )

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

239 {
240 $this->areaEditor('circle');
241 }

References areaEditor().

+ Here is the call graph for this function:

◆ addPoly()

assImagemapQuestionGUI::addPoly ( )

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

244 {
245 $this->areaEditor('poly');
246 }

References areaEditor().

+ Here is the call graph for this function:

◆ addRect()

assImagemapQuestionGUI::addRect ( )

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

234 {
235 $this->areaEditor('rect');
236 }

References areaEditor().

+ Here is the call graph for this function:

◆ aggregateAnswers()

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

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

962 {
963 $answeringFequencies = array();
964
965 foreach($existingAnswerOptions as $answerIndex => $answerOption)
966 {
967 $answeringFequencies[$answerIndex] = 0;
968 }
969
970 foreach($givenSolutionRows as $solutionRow)
971 {
972 $answeringFequencies[$solutionRow['value1']]++;
973 }
974
975 return $answeringFequencies;
976 }

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ areaEditor()

assImagemapQuestionGUI::areaEditor (   $shape = '')

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

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

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

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

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

◆ back()

assImagemapQuestionGUI::back ( )

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

429 {
430 ilUtil::sendInfo($this->lng->txt('msg_cancel'), true);
431 $this->ctrl->redirect($this, 'editQuestion');
432 }

References ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ completeTestOutputFormAction()

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

Reimplemented from assQuestionGUI.

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

437 {
438 #require_once './Modules/Test/classes/class.ilObjTest.php';
439 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
440 #{
441 # $pass = ilObjTest::_getPass($active_id);
442 # $info = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
443 #}
444 #else
445 #{
446 # $info = $this->object->getUserSolutionPreferingIntermediate($active_id, NULL);
447 #}
448
449 $info = $this->getTestOutputSolutions($active_id, $pass);
450
451 if (count($info))
452 {
453 if (strcmp($info[0]["value1"], "") != 0)
454 {
455 $formAction .= "&selImage=" . $info[0]["value1"];
456 }
457 }
458
459 return $formAction;
460 }
getTestOutputSolutions($activeId, $pass)
$info
Definition: example_052.php:80

References $info, $pass, and assQuestionGUI\getTestOutputSolutions().

+ Here is the call graph for this function:

◆ deleteImage()

assImagemapQuestionGUI::deleteImage ( )
protected

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

64 {
65 $this->writePostData(true);
66 $this->object->saveToDb();
67 $this->ctrl->redirect($this, 'editQuestion');
68 }
writePostData()
Evaluates a posted edit form and writes the form data in the question object.

References assQuestionGUI\writePostData().

+ Here is the call graph for this function:

◆ editQuestion()

assImagemapQuestionGUI::editQuestion (   $checkonly = FALSE)

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

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

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

Referenced by removeArea(), and writePostData().

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

◆ getAfterParticipationSuppressionAnswerPostVars()

assImagemapQuestionGUI::getAfterParticipationSuppressionAnswerPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiAnswerScoringAdjustable.

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

920 {
921 return array();
922 }

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

934 {
935 return array();
936 }

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

987 {
988 return $this->renderAggregateView(
989 $this->aggregateAnswers( $relevant_answers, $this->object->getAnswers() )
990 );
991 }
aggregateAnswers($givenSolutionRows, $existingAnswerOptions)
renderAggregateView($answeringFequencies)

References aggregateAnswers(), and renderAggregateView().

+ Here is the call graph for this function:

◆ getCommand()

assImagemapQuestionGUI::getCommand (   $cmd)

Reimplemented from assQuestionGUI.

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

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

References $_POST, and $cmd.

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

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

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

+ 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

Reimplemented from assQuestionGUI.

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

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

References $pass, $preview, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getAnswerFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), and ilWACSignedPath\signFile().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assImagemapQuestionGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

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

888 {
889 if( !$this->object->feedbackOBJ->specificAnswerFeedbackExists(array_values($this->object->getAnswers())) )
890 {
891 return '';
892 }
893
894 $output = '<table class="test_specific_feedback"><tbody>';
895
896 foreach($this->object->getAnswers() as $idx => $answer)
897 {
898 $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
899 $this->object->getId(), $idx
900 );
901
902 $output .= "<tr><td>{$answer->getAnswerText()}</td><td>{$feedback}</td></tr>";
903 }
904
905 $output .= '</tbody></table>';
906
907 return $this->object->prepareTextareaOutput($output, TRUE);
908 }

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

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

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

+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assImagemapQuestionGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

◆ populateQuestionSpecificFormPart()

assImagemapQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

References $linecolor, ilPropertyFormGUI\addItem(), assImagemapQuestion\MODE_MULTIPLE_CHOICE, and assImagemapQuestion\MODE_SINGLE_CHOICE.

Referenced by editQuestion().

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

◆ removeArea()

assImagemapQuestionGUI::removeArea ( )

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

421 {
422 $this->writePostData(true);
423 $position = key($_POST['cmd']['removeArea']['image']);
424 $this->object->deleteArea($position);
425 $this->editQuestion();
426 }

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

+ Here is the call graph for this function:

◆ renderAggregateView()

assImagemapQuestionGUI::renderAggregateView (   $answeringFequencies)
protected

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

939 {
940 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
941
942 $tpl->setCurrentBlock('headercell');
943 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_answer_header'));
944 $tpl->parseCurrentBlock();
945
946 $tpl->setCurrentBlock('headercell');
947 $tpl->setVariable('HEADER', $this->lng->txt('tst_answer_aggr_frequency_header'));
948 $tpl->parseCurrentBlock();
949
950 foreach($answeringFequencies as $answerIndex => $answeringFrequency)
951 {
952 $tpl->setCurrentBlock('aggregaterow');
953 $tpl->setVariable('OPTION', $this->object->getAnswer($answerIndex)->getAnswerText());
954 $tpl->setVariable('COUNT', $answeringFrequency);
955 $tpl->parseCurrentBlock();
956 }
957
958 return $tpl->get();
959 }

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ saveShape()

assImagemapQuestionGUI::saveShape ( )

Saves a shape of the area editor.

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

252 {
253 $coords = "";
254 switch ($_POST["shape"])
255 {
256 case "rect":
257 $coords = join($_POST['image']['mapcoords'], ",");
258 ilUtil::sendSuccess($this->lng->txt('msg_rect_added'), true);
259 break;
260 case "circle":
261 if (preg_match("/(\d+)\s*,\s*(\d+)\s+(\d+)\s*,\s*(\d+)/", $_POST['image']['mapcoords'][0] . " " . $_POST['image']['mapcoords'][1], $matches))
262 {
263 $coords = "$matches[1],$matches[2]," . (int)sqrt((($matches[3]-$matches[1])*($matches[3]-$matches[1]))+(($matches[4]-$matches[2])*($matches[4]-$matches[2])));
264 }
265 ilUtil::sendSuccess($this->lng->txt('msg_circle_added'), true);
266 break;
267 case "poly":
268 $coords = join($_POST['image']['mapcoords'], ",");
269 ilUtil::sendSuccess($this->lng->txt('msg_poly_added'), true);
270 break;
271 }
272 $this->object->addAnswer($_POST["shapetitle"], 0, count($this->object->getAnswers()), $coords, $_POST["shape"]);
273 $this->object->saveToDb();
274 $this->ctrl->redirect($this, 'editQuestion');
275 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $_POST, $coords, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ setQuestionTabs()

assImagemapQuestionGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

@access public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Reimplemented from assQuestionGUI.

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

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

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

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

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

References $_POST.

Referenced by writePostData().

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

78 {
79 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
80 if (!$hasErrors)
81 {
82 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
87 return 0;
88 }
89 return 1;
90 }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.

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

+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assImagemapQuestionGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

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

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

Implements ilGuiQuestionScoringAdjustable.

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

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

References $_POST, and assImagemapQuestion\MODE_MULTIPLE_CHOICE.

Referenced by writePostData().

+ Here is the caller graph for this function:

Field Documentation

◆ $linecolor

assImagemapQuestionGUI::$linecolor
private

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

Referenced by populateQuestionSpecificFormPart().


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