24 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
25 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
51 include_once
"./Modules/TestQuestionPool/classes/class.assFlashQuestion.php";
53 $this->newUnitId = null;
56 $this->
object->loadFromDb($id);
62 if (preg_match(
"/suggestrange_(.*?)/",
$cmd, $matches))
64 $cmd =
"suggestRange";
91 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
96 if (
$_POST[
'flash'][
'delete'] == 1)
98 $this->
object->deleteApplet();
102 $this->
object->setApplet(
$_POST[
'flash'][
'filename']);
104 if ($_FILES[
"flash"][
"tmp_name"])
106 $this->
object->deleteApplet();
107 $filename = $this->
object->moveUploadedFile($_FILES[
"flash"][
"tmp_name"], $_FILES[
"flash"][
"name"]);
110 $this->
object->clearParameters();
111 if (is_array(
$_POST[
"flash"][
"flash_param_name"]))
113 foreach (
$_POST[
'flash'][
'flash_param_name'] as $idx => $val)
115 $this->
object->addParameter($val,
$_POST[
'flash'][
'flash_param_value'][$idx]);
118 if (is_array(
$_POST[
'flash'][
'flash_param_delete']))
120 foreach (
$_POST[
'flash'][
'flash_param_delete'] as $key => $value)
122 $this->
object->removeParameter(
$_POST[
'flash'][
'flash_param_name'][$key]);
125 $this->
object->setTitle(
$_POST[
"title"]);
126 $this->
object->setAuthor(
$_POST[
"author"]);
127 $this->
object->setComment(
$_POST[
"comment"]);
128 $questiontext =
$_POST[
"question"];
129 $this->
object->setQuestion($questiontext);
130 $this->
object->setEstimatedWorkingTime(
131 $_POST[
"Estimated"][
"hh"],
132 $_POST[
"Estimated"][
"mm"],
135 $this->
object->setWidth(
$_POST[
"flash"][
"width"]);
136 $this->
object->setHeight(
$_POST[
"flash"][
"height"]);
137 $this->
object->setPoints(
$_POST[
"points"]);
153 $save = ((strcmp($this->ctrl->getCmd(),
"save") == 0) || (strcmp($this->ctrl->getCmd(),
"saveEdit") == 0)) ? TRUE : FALSE;
156 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
158 $form->setFormAction($this->ctrl->getFormAction($this));
160 $form->setMultipart(TRUE);
161 $form->setTableWidth(
"100%");
162 $form->setId(
"flash");
169 if (strlen($this->object->getApplet()))
171 $flash->setApplet($this->object->getApplet());
172 $flash->setAppletPathWeb($this->object->getFlashPathWeb());
174 $flash->setWidth($this->object->getWidth());
175 $flash->setHeight($this->object->getHeight());
176 $flash->setParameters($this->object->getParameters());
177 $form->addItem($flash);
178 if ($this->object->getId())
181 $hidden->setValue($this->object->getId());
182 $form->addItem($hidden);
186 $points->setValue($this->object->getPoints());
198 $form->setValuesByPost();
199 $errors = !$form->checkInput();
200 $form->setValuesByPost();
201 if (
$errors) $checkonly =
false;
204 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
211 $this->
object->addParameter(
"",
"");
215 function outQuestionForTest($formaction, $active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
217 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $use_post_solutions, $show_feedback);
218 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
219 $this->tpl->setVariable(
"FORMACTION", $formaction);
238 $graphicalOutput = FALSE,
239 $result_output = FALSE,
240 $show_question_only = TRUE,
241 $show_feedback = FALSE,
242 $show_correct_solution = FALSE,
243 $show_manual_scoring = FALSE
247 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
250 if (is_array($this->object->getParameters()))
252 foreach ($this->object->getParameters() as
$name => $value)
254 array_push($params, urlencode($name) .
"=" . urlencode($value));
258 array_push($params,
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
259 array_push($params,
"client=" . urlencode(CLIENT_ID));
260 array_push($params,
"points_max=" . urlencode($this->object->getPoints()));
264 array_push($params,
"pass=" .
$pass);
268 include_once
"./Modules/Test/classes/class.ilObjTest.php";
273 array_push($params,
"active_id=" . $active_id);
275 array_push($params,
"question_id=" . $this->object->getId());
277 if ($show_correct_solution)
279 array_push($params,
"solution=correct");
283 array_push($params,
"solution=user");
286 if (($active_id > 0) && (!$show_correct_solution))
288 if ($graphicalOutput)
291 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
292 if ($reached_points == $this->object->getMaximumPoints())
294 $template->setCurrentBlock(
"icon_ok");
296 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
297 $template->parseCurrentBlock();
301 $template->setCurrentBlock(
"icon_ok");
302 if ($reached_points > 0)
305 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
310 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
312 $template->parseCurrentBlock();
319 $template->setCurrentBlock(
"flash_vars");
320 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
321 $template->parseCurrentBlock();
322 $template->setCurrentBlock(
"applet_parameters");
323 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
324 $template->parseCurrentBlock();
326 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
327 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
328 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
329 $template->setVariable(
"ID", $this->object->getId());
330 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
331 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
333 $questionoutput = $template->get();
334 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
335 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
336 $solutionoutput = $solutiontemplate->get();
337 if (!$show_question_only)
342 return $solutionoutput;
347 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
349 if (is_array($this->object->getParameters()))
351 foreach ($this->object->getParameters() as
$name => $value)
353 array_push($params, urlencode($name) .
"=" . urlencode($value));
358 $template->setCurrentBlock(
"flash_vars");
359 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
360 $template->parseCurrentBlock();
361 $template->setCurrentBlock(
"applet_parameters");
362 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
363 $template->parseCurrentBlock();
365 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
366 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
367 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
368 $template->setVariable(
"ID", $this->object->getId());
369 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
370 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
371 $questionoutput = $template->get();
372 if (!$show_question_only)
377 return $questionoutput;
380 function getTestOutput($active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
383 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
385 if (is_array($this->object->getParameters()))
387 foreach ($this->object->getParameters() as
$name => $value)
389 array_push($params, urlencode($name) .
"=" . urlencode($value));
393 array_push($params,
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
394 array_push($params,
"client=" . urlencode(CLIENT_ID));
395 array_push($params,
"points_max=" . urlencode($this->object->getPoints()));
399 array_push($params,
"pass=" .
$pass);
403 include_once
"./Modules/Test/classes/class.ilObjTest.php";
408 array_push($params,
"active_id=" . $active_id);
410 array_push($params,
"question_id=" . $this->object->getId());
414 $template->setCurrentBlock(
"flash_vars");
415 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
416 $template->parseCurrentBlock();
417 $template->setCurrentBlock(
"applet_parameters");
418 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
419 $template->parseCurrentBlock();
421 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
422 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
423 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
424 $template->setVariable(
"ID", $this->object->getId());
425 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
426 $template->setVariable(
"APPLET_FILE", $this->object->getFlashPathWeb() . $this->
object->getApplet());
427 $questionoutput = $template->get();
429 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
440 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
442 $this->
object->saveFeedbackGeneric(0,
$_POST[
"feedback_incomplete"]);
443 $this->
object->saveFeedbackGeneric(1,
$_POST[
"feedback_complete"]);
444 $this->
object->cleanupMediaObjectUsage();
455 global $rbacsystem, $ilTabs;
457 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
458 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
459 $q_type = $this->
object->getQuestionType();
463 $classname = $q_type .
"GUI";
464 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
465 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
470 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
473 $ilTabs->addTarget(
"edit_content",
474 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"edit"),
475 array(
"edit",
"insert",
"exec_pg"),
476 "",
"", $force_active);
480 $ilTabs->addTarget(
"preview",
481 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"preview"),
483 "ilPageObjectGUI",
"", $force_active);
486 $force_active =
false;
487 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
490 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
491 $commands =
$_POST[
"cmd"];
492 if (is_array($commands))
494 foreach ($commands as $key => $value)
496 if (preg_match(
"/^suggestrange_.*/", $key, $matches))
498 $force_active =
true;
503 $ilTabs->addTarget(
"edit_properties",
505 array(
"editQuestion",
"save",
"flashAddParam",
"saveEdit",
"originalSyncForm"),
506 $classname,
"", $force_active);
511 $ilTabs->addTarget(
"feedback",
512 $this->ctrl->getLinkTargetByClass($classname,
"feedback"),
513 array(
"feedback",
"saveFeedback"),
519 $ilTabs->addTarget(
"solution_hint",
520 $this->ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
521 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
522 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution"
532 $ilTabs->addTarget(
"statistics",
533 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
538 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
542 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
546 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));