24 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
25 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
52 include_once
"./Modules/TestQuestionPool/classes/class.assFlashQuestion.php";
54 $this->newUnitId = null;
57 $this->
object->loadFromDb($id);
63 if (preg_match(
"/suggestrange_(.*?)/",
$cmd, $matches))
65 $cmd =
"suggestRange";
92 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
97 if (
$_POST[
'flash'][
'delete'] == 1)
99 $this->
object->deleteApplet();
103 $this->
object->setApplet(
$_POST[
'flash'][
'filename']);
105 if ($_FILES[
"flash"][
"tmp_name"])
107 $this->
object->deleteApplet();
108 $filename = $this->
object->moveUploadedFile($_FILES[
"flash"][
"tmp_name"], $_FILES[
"flash"][
"name"]);
111 $this->
object->clearParameters();
112 if (is_array(
$_POST[
"flash"][
"flash_param_name"]))
114 foreach (
$_POST[
'flash'][
'flash_param_name'] as $idx => $val)
116 $this->
object->addParameter($val,
$_POST[
'flash'][
'flash_param_value'][$idx]);
119 if (is_array(
$_POST[
'flash'][
'flash_param_delete']))
121 foreach (
$_POST[
'flash'][
'flash_param_delete'] as $key => $value)
123 $this->
object->removeParameter(
$_POST[
'flash'][
'flash_param_name'][$key]);
126 $this->
object->setTitle(
$_POST[
"title"]);
127 $this->
object->setAuthor(
$_POST[
"author"]);
128 $this->
object->setComment(
$_POST[
"comment"]);
129 $questiontext =
$_POST[
"question"];
130 $this->
object->setQuestion($questiontext);
131 $this->
object->setEstimatedWorkingTime(
132 $_POST[
"Estimated"][
"hh"],
133 $_POST[
"Estimated"][
"mm"],
136 $this->
object->setWidth(
$_POST[
"flash"][
"width"]);
137 $this->
object->setHeight(
$_POST[
"flash"][
"height"]);
138 $this->
object->setPoints(
$_POST[
"points"]);
158 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
160 $form->setFormAction($this->ctrl->getFormAction($this));
162 $form->setMultipart(TRUE);
163 $form->setTableWidth(
"100%");
164 $form->setId(
"flash");
171 if (strlen($this->object->getApplet()))
173 $flash->setApplet($this->object->getApplet());
174 $flash->setAppletPathWeb($this->object->getFlashPathWeb());
176 $flash->setWidth($this->object->getWidth());
177 $flash->setHeight($this->object->getHeight());
178 $flash->setParameters($this->object->getParameters());
179 $form->addItem($flash);
180 if ($this->object->getId())
183 $hidden->setValue($this->object->getId());
184 $form->addItem($hidden);
188 $points->
setValue($this->object->getPoints());
189 $points->setRequired(TRUE);
191 $points->setMinValue(0.0);
192 $form->addItem($points);
200 $form->setValuesByPost();
201 $errors = !$form->checkInput();
202 $form->setValuesByPost();
203 if (
$errors) $checkonly =
false;
206 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
213 $this->
object->addParameter(
"",
"");
217 function outQuestionForTest($formaction, $active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
219 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $use_post_solutions, $show_feedback);
220 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
221 $this->tpl->setVariable(
"FORMACTION", $formaction);
240 $graphicalOutput = FALSE,
241 $result_output = FALSE,
242 $show_question_only = TRUE,
243 $show_feedback = FALSE,
244 $show_correct_solution = FALSE,
245 $show_manual_scoring = FALSE,
246 $show_question_text = TRUE
250 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
253 if (is_array($this->object->getParameters()))
255 foreach ($this->object->getParameters() as $name => $value)
257 array_push($params, urlencode($name) .
"=" . urlencode($value));
261 array_push($params,
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
262 array_push($params,
"client=" . urlencode(CLIENT_ID));
263 array_push($params,
"points_max=" . urlencode($this->object->getPoints()));
267 array_push($params,
"pass=" .
$pass);
271 include_once
"./Modules/Test/classes/class.ilObjTest.php";
276 array_push($params,
"active_id=" . $active_id);
278 array_push($params,
"question_id=" . $this->object->getId());
280 if ($show_correct_solution)
282 array_push($params,
"solution=correct");
286 array_push($params,
"solution=user");
289 if (($active_id > 0) && (!$show_correct_solution))
291 if ($graphicalOutput)
294 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
295 if ($reached_points == $this->object->getMaximumPoints())
297 $template->setCurrentBlock(
"icon_ok");
299 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
300 $template->parseCurrentBlock();
304 $template->setCurrentBlock(
"icon_ok");
305 if ($reached_points > 0)
308 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
313 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
315 $template->parseCurrentBlock();
322 $template->setCurrentBlock(
"flash_vars");
323 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
324 $template->parseCurrentBlock();
325 $template->setCurrentBlock(
"applet_parameters");
326 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
327 $template->parseCurrentBlock();
329 if ($show_question_text==
true)
331 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
333 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
334 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
335 $template->setVariable(
"ID", $this->object->getId());
336 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
337 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
339 $questionoutput = $template->get();
340 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
341 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
342 $solutionoutput = $solutiontemplate->get();
343 if (!$show_question_only)
346 $solutionoutput =
'<div class="ilc_question_Standard">'.$solutionoutput.
"</div>";
348 return $solutionoutput;
353 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
355 if (is_array($this->object->getParameters()))
357 foreach ($this->object->getParameters() as $name => $value)
359 array_push($params, urlencode($name) .
"=" . urlencode($value));
364 $template->setCurrentBlock(
"flash_vars");
365 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
366 $template->parseCurrentBlock();
367 $template->setCurrentBlock(
"applet_parameters");
368 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
369 $template->parseCurrentBlock();
371 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
372 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
373 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
374 $template->setVariable(
"ID", $this->object->getId());
375 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
376 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
377 $questionoutput = $template->get();
378 if (!$show_question_only)
383 return $questionoutput;
386 function getTestOutput($active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
389 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
391 if (is_array($this->object->getParameters()))
393 foreach ($this->object->getParameters() as $name => $value)
395 array_push($params, urlencode($name) .
"=" . urlencode($value));
399 array_push($params,
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
400 array_push($params,
"client=" . urlencode(CLIENT_ID));
401 array_push($params,
"points_max=" . urlencode($this->object->getPoints()));
405 array_push($params,
"pass=" .
$pass);
409 include_once
"./Modules/Test/classes/class.ilObjTest.php";
414 array_push($params,
"active_id=" . $active_id);
416 array_push($params,
"question_id=" . $this->object->getId());
420 $template->setCurrentBlock(
"flash_vars");
421 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
422 $template->parseCurrentBlock();
423 $template->setCurrentBlock(
"applet_parameters");
424 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
425 $template->parseCurrentBlock();
427 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
428 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
429 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
430 $template->setVariable(
"ID", $this->object->getId());
431 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
432 $template->setVariable(
"APPLET_FILE", $this->object->getFlashPathWeb() . $this->
object->getApplet());
433 $questionoutput = $template->get();
435 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
446 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
448 $this->
object->saveFeedbackGeneric(0,
$_POST[
"feedback_incomplete"]);
449 $this->
object->saveFeedbackGeneric(1,
$_POST[
"feedback_complete"]);
450 $this->
object->cleanupMediaObjectUsage();
463 global $rbacsystem, $ilTabs;
465 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
466 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
467 $q_type = $this->
object->getQuestionType();
471 $classname = $q_type .
"GUI";
472 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
473 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
478 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
481 $ilTabs->addTarget(
"edit_page",
482 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"edit"),
483 array(
"edit",
"insert",
"exec_pg"),
484 "",
"", $force_active);
488 $ilTabs->addTarget(
"preview",
489 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"preview"),
491 "ilPageObjectGUI",
"", $force_active);
494 $force_active =
false;
495 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
498 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
499 $commands =
$_POST[
"cmd"];
500 if (is_array($commands))
502 foreach ($commands as $key => $value)
504 if (preg_match(
"/^suggestrange_.*/", $key, $matches))
506 $force_active =
true;
511 $ilTabs->addTarget(
"edit_question",
513 array(
"editQuestion",
"save",
"flashAddParam",
"saveEdit",
"originalSyncForm"),
514 $classname,
"", $force_active);
519 $ilTabs->addTarget(
"feedback",
520 $this->ctrl->getLinkTargetByClass($classname,
"feedback"),
521 array(
"feedback",
"saveFeedback"),
530 $ilTabs->addTarget(
"solution_hint",
531 $this->ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
532 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
533 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution"
543 $ilTabs->addTarget(
"statistics",
544 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
549 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
554 global $___test_express_mode;
556 if (!
$_GET[
'test_express_mode'] && !$___test_express_mode) {
557 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
561 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
566 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));
573 return $this->
object->prepareTextareaOutput($output, TRUE);