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"]);
157 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
159 $form->setFormAction($this->ctrl->getFormAction($this));
161 $form->setMultipart(TRUE);
162 $form->setTableWidth(
"100%");
163 $form->setId(
"flash");
170 if (strlen($this->object->getApplet()))
172 $flash->setApplet($this->object->getApplet());
173 $flash->setAppletPathWeb($this->object->getFlashPathWeb());
175 $flash->setWidth($this->object->getWidth());
176 $flash->setHeight($this->object->getHeight());
177 $flash->setParameters($this->object->getParameters());
178 $form->addItem($flash);
179 if ($this->object->getId())
182 $hidden->setValue($this->object->getId());
183 $form->addItem($hidden);
187 $points->
setValue($this->object->getPoints());
188 $points->setRequired(TRUE);
190 $points->setMinValue(0.0);
191 $form->addItem($points);
199 $form->setValuesByPost();
200 $errors = !$form->checkInput();
201 $form->setValuesByPost();
202 if (
$errors) $checkonly =
false;
205 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
212 $this->
object->addParameter(
"",
"");
216 function outQuestionForTest($formaction, $active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
218 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $use_post_solutions, $show_feedback);
219 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
220 $this->tpl->setVariable(
"FORMACTION", $formaction);
239 $graphicalOutput = FALSE,
240 $result_output = FALSE,
241 $show_question_only = TRUE,
242 $show_feedback = FALSE,
243 $show_correct_solution = FALSE,
244 $show_manual_scoring = FALSE
248 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
251 if (is_array($this->object->getParameters()))
253 foreach ($this->object->getParameters() as $name => $value)
255 array_push($params, urlencode($name) .
"=" . urlencode($value));
259 array_push($params,
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
260 array_push($params,
"client=" . urlencode(CLIENT_ID));
261 array_push($params,
"points_max=" . urlencode($this->object->getPoints()));
265 array_push($params,
"pass=" .
$pass);
269 include_once
"./Modules/Test/classes/class.ilObjTest.php";
274 array_push($params,
"active_id=" . $active_id);
276 array_push($params,
"question_id=" . $this->object->getId());
278 if ($show_correct_solution)
280 array_push($params,
"solution=correct");
284 array_push($params,
"solution=user");
287 if (($active_id > 0) && (!$show_correct_solution))
289 if ($graphicalOutput)
292 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
293 if ($reached_points == $this->object->getMaximumPoints())
295 $template->setCurrentBlock(
"icon_ok");
297 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
298 $template->parseCurrentBlock();
302 $template->setCurrentBlock(
"icon_ok");
303 if ($reached_points > 0)
306 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
311 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
313 $template->parseCurrentBlock();
320 $template->setCurrentBlock(
"flash_vars");
321 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
322 $template->parseCurrentBlock();
323 $template->setCurrentBlock(
"applet_parameters");
324 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
325 $template->parseCurrentBlock();
327 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
328 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
329 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
330 $template->setVariable(
"ID", $this->object->getId());
331 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
332 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
334 $questionoutput = $template->get();
335 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
336 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
337 $solutionoutput = $solutiontemplate->get();
338 if (!$show_question_only)
343 return $solutionoutput;
348 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
350 if (is_array($this->object->getParameters()))
352 foreach ($this->object->getParameters() as $name => $value)
354 array_push($params, urlencode($name) .
"=" . urlencode($value));
359 $template->setCurrentBlock(
"flash_vars");
360 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
361 $template->parseCurrentBlock();
362 $template->setCurrentBlock(
"applet_parameters");
363 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
364 $template->parseCurrentBlock();
366 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
367 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
368 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
369 $template->setVariable(
"ID", $this->object->getId());
370 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
371 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
372 $questionoutput = $template->get();
373 if (!$show_question_only)
378 return $questionoutput;
381 function getTestOutput($active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
384 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
386 if (is_array($this->object->getParameters()))
388 foreach ($this->object->getParameters() as $name => $value)
390 array_push($params, urlencode($name) .
"=" . urlencode($value));
394 array_push($params,
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
395 array_push($params,
"client=" . urlencode(CLIENT_ID));
396 array_push($params,
"points_max=" . urlencode($this->object->getPoints()));
400 array_push($params,
"pass=" .
$pass);
404 include_once
"./Modules/Test/classes/class.ilObjTest.php";
409 array_push($params,
"active_id=" . $active_id);
411 array_push($params,
"question_id=" . $this->object->getId());
415 $template->setCurrentBlock(
"flash_vars");
416 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
417 $template->parseCurrentBlock();
418 $template->setCurrentBlock(
"applet_parameters");
419 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
420 $template->parseCurrentBlock();
422 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
423 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
424 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
425 $template->setVariable(
"ID", $this->object->getId());
426 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
427 $template->setVariable(
"APPLET_FILE", $this->object->getFlashPathWeb() . $this->
object->getApplet());
428 $questionoutput = $template->get();
430 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
441 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
443 $this->
object->saveFeedbackGeneric(0,
$_POST[
"feedback_incomplete"]);
444 $this->
object->saveFeedbackGeneric(1,
$_POST[
"feedback_complete"]);
445 $this->
object->cleanupMediaObjectUsage();
456 global $rbacsystem, $ilTabs;
458 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
459 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
460 $q_type = $this->
object->getQuestionType();
464 $classname = $q_type .
"GUI";
465 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
466 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
471 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
474 $ilTabs->addTarget(
"edit_content",
475 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"edit"),
476 array(
"edit",
"insert",
"exec_pg"),
477 "",
"", $force_active);
481 $ilTabs->addTarget(
"preview",
482 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"preview"),
484 "ilPageObjectGUI",
"", $force_active);
487 $force_active =
false;
488 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
491 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
492 $commands =
$_POST[
"cmd"];
493 if (is_array($commands))
495 foreach ($commands as $key => $value)
497 if (preg_match(
"/^suggestrange_.*/", $key, $matches))
499 $force_active =
true;
504 $ilTabs->addTarget(
"edit_properties",
506 array(
"editQuestion",
"save",
"flashAddParam",
"saveEdit",
"originalSyncForm"),
507 $classname,
"", $force_active);
512 $ilTabs->addTarget(
"feedback",
513 $this->ctrl->getLinkTargetByClass($classname,
"feedback"),
514 array(
"feedback",
"saveFeedback"),
520 $ilTabs->addTarget(
"solution_hint",
521 $this->ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
522 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
523 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution"
533 $ilTabs->addTarget(
"statistics",
534 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
539 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
544 global $___test_express_mode;
546 if (!
$_GET[
'test_express_mode'] && !$___test_express_mode) {
547 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
551 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
556 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));