ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
assFlashQuestionGUI Class Reference

The assFlashQuestionGUI class encapsulates the GUI representation for flash questions. More...

+ Inheritance diagram for assFlashQuestionGUI:
+ Collaboration diagram for assFlashQuestionGUI:

Public Member Functions

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

Protected Member Functions

 writePostData ($always=false)
 {} More...
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 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)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 buildEditForm ()
 

Private Attributes

 $newUnitId
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

assFlashQuestionGUI::__construct (   $id = -1)

assFlashQuestionGUI constructor

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

Parameters
integer$idThe database id of a single choice question object public

Definition at line 35 of file class.assFlashQuestionGUI.php.

References $id.

36  {
37  parent::__construct();
38  include_once "./Modules/TestQuestionPool/classes/class.assFlashQuestion.php";
39  $this->object = new assFlashQuestion();
40  $this->newUnitId = null;
41  if ($id >= 0) {
42  $this->object->loadFromDb($id);
43  }
44  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Class for Flash based questions.

Member Function Documentation

◆ editQuestion()

assFlashQuestionGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

public

Definition at line 119 of file class.assFlashQuestionGUI.php.

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

Referenced by flashAddParam(), suggestRange(), and writePostData().

120  {
121  //$save = ((strcmp($this->ctrl->getCmd(), "save") == 0) || (strcmp($this->ctrl->getCmd(), "saveEdit") == 0)) ? TRUE : FALSE;
122  $save = $this->isSaveCommand();
123  $this->getQuestionTemplate();
124 
125  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
126  $form = new ilPropertyFormGUI();
127  $this->editForm = $form;
128 
129  $form->setFormAction($this->ctrl->getFormAction($this));
130  $form->setTitle($this->outQuestionType());
131  $form->setMultipart(true);
132  $form->setTableWidth("100%");
133  $form->setId("flash");
134 
137 
139 
141 
142  $errors = false;
143 
144  if ($save) {
145  $form->setValuesByPost();
146  $errors = !$form->checkInput();
147  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
148  if ($errors) {
149  $checkonly = false;
150  }
151  }
152 
153  if (!$checkonly) {
154  $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
155  }
156  return $errors;
157  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
if(isset($_POST['submit'])) $form
$errors
Definition: index.php:6
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:

◆ flashAddParam()

assFlashQuestionGUI::flashAddParam ( )

Definition at line 188 of file class.assFlashQuestionGUI.php.

References editQuestion(), and writePostData().

189  {
190  $this->writePostData();
191  $this->object->addParameter("", "");
192  $this->editQuestion();
193  }
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
+ Here is the call graph for this function:

◆ getAfterParticipationSuppressionQuestionPostVars()

assFlashQuestionGUI::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 484 of file class.assFlashQuestionGUI.php.

485  {
486  return array();
487  }

◆ getAggregatedAnswersView()

assFlashQuestionGUI::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 497 of file class.assFlashQuestionGUI.php.

498  {
499  // Empty implementation here since a feasible way to aggregate answer is not known.
500  return ''; //print_r($relevant_answers,true);
501  }

◆ getCommand()

assFlashQuestionGUI::getCommand (   $cmd)

Definition at line 46 of file class.assFlashQuestionGUI.php.

47  {
48  if (preg_match("/suggestrange_(.*?)/", $cmd, $matches)) {
49  $cmd = "suggestRange";
50  }
51  return $cmd;
52  }

◆ getPreview()

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

Definition at line 301 of file class.assFlashQuestionGUI.php.

References $name, PHPMailer\PHPMailer\$params, $template, and assQuestionGUI\getILIASPage().

302  {
303  $template = new ilTemplate("tpl.il_as_qpl_flash_question_output.html", true, true, "Modules/TestQuestionPool");
304  $params = array();
305  if (is_array($this->object->getParameters())) {
306  foreach ($this->object->getParameters() as $name => $value) {
307  array_push($params, urlencode($name) . "=" . urlencode($value));
308  }
309  }
310  if (count($params)) {
311  $template->setCurrentBlock("flash_vars");
312  $template->setVariable("FLASH_VARS", join("&", $params));
313  $template->parseCurrentBlock();
314  $template->setCurrentBlock("applet_parameters");
315  $template->setVariable("PARAM_VALUE", join("&", $params));
316  $template->parseCurrentBlock();
317  }
318  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
319  $template->setVariable("APPLET_WIDTH", $this->object->getWidth());
320  $template->setVariable("APPLET_HEIGHT", $this->object->getHeight());
321  $template->setVariable("ID", $this->object->getId());
322  $template->setVariable("APPLET_PATH", $this->object->getFlashPathWeb() . $this->object->getApplet());
323  $template->setVariable("APPLET_FILE", $this->object->getApplet());
324  $questionoutput = $template->get();
325  if (!$show_question_only) {
326  // get page object output
327  $questionoutput = $this->getILIASPage($questionoutput);
328  }
329  return $questionoutput;
330  }
$template
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()

assFlashQuestionGUI::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 208 of file class.assFlashQuestionGUI.php.

References $_COOKIE, $name, PHPMailer\PHPMailer\$params, $pass, $template, ilObjTest\_getPass(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), and ilUtil\removeTrailingPathSeparators().

218  {
219  // get the solution of the user for the active pass or from the last pass if allowed
220  $template = new ilTemplate("tpl.il_as_qpl_flash_question_output_solution.html", true, true, "Modules/TestQuestionPool");
221 
222  $params = array();
223  if (is_array($this->object->getParameters())) {
224  foreach ($this->object->getParameters() as $name => $value) {
225  array_push($params, urlencode($name) . "=" . urlencode($value));
226  }
227  }
228 
229  array_push($params, "session_id=" . urlencode($_COOKIE[session_name()]));
230  array_push($params, "client=" . urlencode(CLIENT_ID));
231  array_push($params, "points_max=" . urlencode($this->object->getPoints()));
232  array_push($params, "server=" . urlencode(ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php?wsdl"));
233  if (!is_null($pass)) {
234  array_push($params, "pass=" . $pass);
235  } else {
236  include_once "./Modules/Test/classes/class.ilObjTest.php";
237  array_push($params, "pass=" . ilObjTest::_getPass($active_id));
238  }
239  if ($active_id) {
240  array_push($params, "active_id=" . $active_id);
241  }
242  array_push($params, "question_id=" . $this->object->getId());
243 
244  if ($show_correct_solution) {
245  array_push($params, "solution=correct");
246  } else {
247  array_push($params, "solution=user");
248  }
249 
250  if (($active_id > 0) && (!$show_correct_solution)) {
251  if ($graphicalOutput) {
252  // output of ok/not ok icons for user entered solutions
253  $reached_points = $this->object->getReachedPoints($active_id, $pass);
254  if ($reached_points == $this->object->getMaximumPoints()) {
255  $template->setCurrentBlock("icon_ok");
256  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
257  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
258  $template->parseCurrentBlock();
259  } else {
260  $template->setCurrentBlock("icon_ok");
261  if ($reached_points > 0) {
262  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
263  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
264  } else {
265  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
266  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
267  }
268  $template->parseCurrentBlock();
269  }
270  }
271  }
272 
273  if (count($params)) {
274  $template->setCurrentBlock("flash_vars");
275  $template->setVariable("FLASH_VARS", join("&", $params));
276  $template->parseCurrentBlock();
277  $template->setCurrentBlock("applet_parameters");
278  $template->setVariable("PARAM_VALUE", join("&", $params));
279  $template->parseCurrentBlock();
280  }
281  if ($show_question_text == true) {
282  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
283  }
284  $template->setVariable("APPLET_WIDTH", $this->object->getWidth());
285  $template->setVariable("APPLET_HEIGHT", $this->object->getHeight());
286  $template->setVariable("ID", $this->object->getId());
287  $template->setVariable("APPLET_PATH", $this->object->getFlashPathWeb() . $this->object->getApplet());
288  $template->setVariable("APPLET_FILE", $this->object->getApplet());
289 
290  $questionoutput = $template->get();
291  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
292  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
293  $solutionoutput = $solutiontemplate->get();
294  if (!$show_question_only) {
295  // get page object output
296  $solutionoutput = $this->getILIASPage($solutionoutput);
297  }
298  return $solutionoutput;
299  }
$_COOKIE['client_id']
Definition: server.php:9
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
$template
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
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assFlashQuestionGUI::getSpecificFeedbackOutput (   $userSolution)

Definition at line 469 of file class.assFlashQuestionGUI.php.

References Sabre\VObject\$output.

470  {
471  $output = "";
472  return $this->object->prepareTextareaOutput($output, true);
473  }

◆ getTestOutput()

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

Definition at line 333 of file class.assFlashQuestionGUI.php.

References $_COOKIE, $name, PHPMailer\PHPMailer\$params, $pass, $template, ilObjTest\_getPass(), assQuestionGUI\outQuestionPage(), and ilUtil\removeTrailingPathSeparators().

335  {
336  // generate the question output
337  $template = new ilTemplate("tpl.il_as_qpl_flash_question_output.html", true, true, "Modules/TestQuestionPool");
338  $params = array();
339  if (is_array($this->object->getParameters())) {
340  foreach ($this->object->getParameters() as $name => $value) {
341  array_push($params, urlencode($name) . "=" . urlencode($value));
342  }
343  }
344 
345  array_push($params, "session_id=" . urlencode($_COOKIE[session_name()]));
346  array_push($params, "client=" . urlencode(CLIENT_ID));
347  array_push($params, "points_max=" . urlencode($this->object->getPoints()));
348  array_push($params, "server=" . urlencode(ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php?wsdl"));
349  if (strlen($pass)) {
350  array_push($params, "pass=" . $pass);
351  } else {
352  include_once "./Modules/Test/classes/class.ilObjTest.php";
353  array_push($params, "pass=" . ilObjTest::_getPass($active_id));
354  }
355  if ($active_id) {
356  array_push($params, "active_id=" . $active_id);
357  }
358  array_push($params, "question_id=" . $this->object->getId());
359 
360  if (count($params)) {
361  $template->setCurrentBlock("flash_vars");
362  $template->setVariable("FLASH_VARS", join("&", $params));
363  $template->parseCurrentBlock();
364  $template->setCurrentBlock("applet_parameters");
365  $template->setVariable("PARAM_VALUE", join("&", $params));
366  $template->parseCurrentBlock();
367  }
368  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
369  $template->setVariable("APPLET_WIDTH", $this->object->getWidth());
370  $template->setVariable("APPLET_HEIGHT", $this->object->getHeight());
371  $template->setVariable("ID", $this->object->getId());
372  $template->setVariable("APPLET_PATH", $this->object->getFlashPathWeb() . $this->object->getApplet());
373  $template->setVariable("APPLET_FILE", $this->object->getFlashPathWeb() . $this->object->getApplet());
374  $questionoutput = $template->get();
375 
376  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
377  return $pageoutput;
378  }
$_COOKIE['client_id']
Definition: server.php:9
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
$template
special template class to simplify handling of ITX/PEAR
static removeTrailingPathSeparators($path)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assFlashQuestionGUI::populateQuestionSpecificFormPart ( ilPropertyFormGUI  $form)

Adds the question specific forms parts to a question property form gui.

Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Implements ilGuiQuestionScoringAdjustable.

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

References $form, ilPropertyFormGUI\addItem(), ilFormPropertyGUI\setRequired(), and ilNumberInputGUI\setValue().

Referenced by editQuestion().

160  {
161  // flash file
162  $flash = new ilFlashFileInputGUI($this->lng->txt("flashfile"), "flash");
163  $flash->setRequired(true);
164  if (strlen($this->object->getApplet())) {
165  $flash->setApplet($this->object->getApplet());
166  $flash->setAppletPathWeb($this->object->getFlashPathWeb());
167  }
168  $flash->setWidth($this->object->getWidth());
169  $flash->setHeight($this->object->getHeight());
170  $flash->setParameters($this->object->getParameters());
171  $form->addItem($flash);
172  if ($this->object->getId()) {
173  $hidden = new ilHiddenInputGUI("", "ID");
174  $hidden->setValue($this->object->getId());
175  $form->addItem($hidden);
176  }
177  // points
178  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
179  $points->setValue($this->object->getPoints());
180  $points->setRequired(true);
181  $points->setSize(3);
182  $points->setMinValue(0.0);
183  $form->addItem($points);
184 
185  return $form;
186  }
setValue($a_value)
Set Value.
This class represents an image file property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a hidden form property in a property form.
if(isset($_POST['submit'])) $form
This class represents a number property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setQuestionTabs()

assFlashQuestionGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Definition at line 387 of file class.assFlashQuestionGUI.php.

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

388  {
389  global $DIC;
390  $rbacsystem = $DIC['rbacsystem'];
391  $ilTabs = $DIC['ilTabs'];
392 
393  $ilTabs->clearTargets();
394 
395  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
396  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
397  $q_type = $this->object->getQuestionType();
398 
399  if (strlen($q_type)) {
400  $classname = $q_type . "GUI";
401  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
402  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
403  }
404 
405  if ($_GET["q_id"]) {
406  if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
407  // edit page
408  $ilTabs->addTarget(
409  "edit_page",
410  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
411  array("edit", "insert", "exec_pg"),
412  "",
413  "",
414  $force_active
415  );
416  }
417 
418  $this->addTab_QuestionPreview($ilTabs);
419  }
420 
421  $force_active = false;
422  if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
423  $url = "";
424  if ($classname) {
425  $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
426  }
427  $commands = $_POST["cmd"];
428  if (is_array($commands)) {
429  foreach ($commands as $key => $value) {
430  if (preg_match("/^suggestrange_.*/", $key, $matches)) {
431  $force_active = true;
432  }
433  }
434  }
435  // edit question properties
436  $ilTabs->addTarget(
437  "edit_question",
438  $url,
439  array("editQuestion", "save", "flashAddParam", "saveEdit", "originalSyncForm"),
440  $classname,
441  "",
442  $force_active
443  );
444  }
445 
446  // add tab for question feedback within common class assQuestionGUI
447  $this->addTab_QuestionFeedback($ilTabs);
448 
449  // add tab for question hint within common class assQuestionGUI
450  $this->addTab_QuestionHints($ilTabs);
451 
452  // add tab for question's suggested solution within common class assQuestionGUI
453  $this->addTab_SuggestedSolution($ilTabs, $classname);
454 
455  // Assessment of questions sub menu entry
456  if ($_GET["q_id"]) {
457  $ilTabs->addTarget(
458  "statistics",
459  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
460  array("assessment"),
461  $classname,
462  ""
463  );
464  }
465 
466  $this->addBackTab($ilTabs);
467  }
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
global $DIC
Definition: saml.php:7
$_GET["client_id"]
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBackTab(ilTabsGUI $ilTabs)
$url
$key
Definition: croninfo.php:18
$_POST["username"]
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
+ Here is the call graph for this function:

◆ suggestRange()

assFlashQuestionGUI::suggestRange ( )

Suggest a range for a result.

public

Definition at line 59 of file class.assFlashQuestionGUI.php.

References editQuestion(), assQuestionGUI\getErrorMessage(), ilUtil\sendInfo(), and writePostData().

60  {
61  if ($this->writePostData()) {
63  }
64  $this->editQuestion();
65  }
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ writePostData()

assFlashQuestionGUI::writePostData (   $always = false)
protected

{}

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

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

Referenced by flashAddParam(), and suggestRange().

71  {
72  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
73  if (!$hasErrors) {
74  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
77 
78  $this->saveTaxonomyAssignments();
79  return 0;
80  }
81  return 1;
82  }
This class represents a property form user interface.
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
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:
+ Here is the caller graph for this function:

◆ writeQuestionSpecificPostData()

assFlashQuestionGUI::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 84 of file class.assFlashQuestionGUI.php.

References $_POST, $filename, $key, and assQuestionGUI\setErrorMessage().

Referenced by writePostData().

85  {
86  $this->setErrorMessage("");
87  if ($_POST['flash']['delete'] == 1) {
88  $this->object->deleteApplet();
89  } else {
90  $this->object->setApplet($_POST['flash']['filename']);
91  }
92  if ($_FILES["flash"]["tmp_name"]) {
93  $this->object->deleteApplet();
94  $filename = $this->object->moveUploadedFile($_FILES["flash"]["tmp_name"], $_FILES["flash"]["name"]);
95  $this->object->setApplet($filename);
96  }
97  $this->object->clearParameters();
98  if (is_array($_POST["flash"]["flash_param_name"])) {
99  foreach ($_POST['flash']['flash_param_name'] as $idx => $val) {
100  $this->object->addParameter($val, $_POST['flash']['flash_param_value'][$idx]);
101  }
102  }
103  if (is_array($_POST['flash']['flash_param_delete'])) {
104  foreach ($_POST['flash']['flash_param_delete'] as $key => $value) {
105  $this->object->removeParameter($_POST['flash']['flash_param_name'][$key]);
106  }
107  }
108 
109  $this->object->setWidth($_POST["flash"]["width"]);
110  $this->object->setHeight($_POST["flash"]["height"]);
111  $this->object->setPoints($_POST["points"]);
112  }
setErrorMessage($errormessage)
$filename
Definition: buildRTE.php:89
$key
Definition: croninfo.php:18
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $newUnitId

assFlashQuestionGUI::$newUnitId
private

Definition at line 25 of file class.assFlashQuestionGUI.php.


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