4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6 include_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
37 include_once
"./Modules/TestQuestionPool/classes/class.assFlashQuestion.php";
39 $this->newUnitId = null;
42 $this->
object->loadFromDb($id);
48 if (preg_match(
"/suggestrange_(.*?)/",
$cmd, $matches))
50 $cmd =
"suggestRange";
78 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
81 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
94 if (
$_POST[
'flash'][
'delete'] == 1)
96 $this->
object->deleteApplet();
100 $this->
object->setApplet(
$_POST[
'flash'][
'filename'] );
102 if ($_FILES[
"flash"][
"tmp_name"])
104 $this->
object->deleteApplet();
105 $filename = $this->
object->moveUploadedFile( $_FILES[
"flash"][
"tmp_name"], $_FILES[
"flash"][
"name"] );
108 $this->
object->clearParameters();
109 if (is_array(
$_POST[
"flash"][
"flash_param_name"] ))
111 foreach (
$_POST[
'flash'][
'flash_param_name'] as $idx => $val)
113 $this->
object->addParameter( $val,
$_POST[
'flash'][
'flash_param_value'][$idx] );
116 if (is_array(
$_POST[
'flash'][
'flash_param_delete'] ))
118 foreach (
$_POST[
'flash'][
'flash_param_delete'] as $key => $value)
120 $this->
object->removeParameter(
$_POST[
'flash'][
'flash_param_name'][$key] );
124 $this->
object->setWidth(
$_POST[
"flash"][
"width"] );
125 $this->
object->setHeight(
$_POST[
"flash"][
"height"] );
126 $this->
object->setPoints(
$_POST[
"points"] );
140 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
142 $form->setFormAction($this->ctrl->getFormAction($this));
144 $form->setMultipart(TRUE);
145 $form->setTableWidth(
"100%");
146 $form->setId(
"flash");
159 $form->setValuesByPost();
160 $errors = !$form->checkInput();
161 $form->setValuesByPost();
162 if (
$errors) $checkonly =
false;
165 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
174 if (strlen( $this->object->getApplet() ))
176 $flash->setApplet( $this->object->getApplet() );
177 $flash->setAppletPathWeb( $this->object->getFlashPathWeb() );
179 $flash->setWidth( $this->object->getWidth() );
180 $flash->setHeight( $this->object->getHeight() );
181 $flash->setParameters( $this->object->getParameters() );
183 if ($this->object->getId())
186 $hidden->setValue( $this->object->getId() );
191 $points->
setValue( $this->object->getPoints() );
192 $points->setRequired( TRUE );
193 $points->setSize( 3 );
194 $points->setMinValue( 0.0 );
203 $this->
object->addParameter(
"",
"");
223 $graphicalOutput = FALSE,
224 $result_output = FALSE,
225 $show_question_only = TRUE,
226 $show_feedback = FALSE,
227 $show_correct_solution = FALSE,
228 $show_manual_scoring = FALSE,
229 $show_question_text = TRUE
233 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
236 if (is_array($this->object->getParameters()))
238 foreach ($this->object->getParameters() as $name => $value)
240 array_push($params, urlencode($name) .
"=" . urlencode($value));
244 array_push($params,
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
245 array_push($params,
"client=" . urlencode(CLIENT_ID));
246 array_push($params,
"points_max=" . urlencode($this->object->getPoints()));
250 array_push($params,
"pass=" .
$pass);
254 include_once
"./Modules/Test/classes/class.ilObjTest.php";
259 array_push($params,
"active_id=" . $active_id);
261 array_push($params,
"question_id=" . $this->object->getId());
263 if ($show_correct_solution)
265 array_push($params,
"solution=correct");
269 array_push($params,
"solution=user");
272 if (($active_id > 0) && (!$show_correct_solution))
274 if ($graphicalOutput)
277 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
278 if ($reached_points == $this->object->getMaximumPoints())
280 $template->setCurrentBlock(
"icon_ok");
282 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
283 $template->parseCurrentBlock();
287 $template->setCurrentBlock(
"icon_ok");
288 if ($reached_points > 0)
291 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
296 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
298 $template->parseCurrentBlock();
305 $template->setCurrentBlock(
"flash_vars");
306 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
307 $template->parseCurrentBlock();
308 $template->setCurrentBlock(
"applet_parameters");
309 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
310 $template->parseCurrentBlock();
312 if ($show_question_text==
true)
314 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
316 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
317 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
318 $template->setVariable(
"ID", $this->object->getId());
319 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
320 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
322 $questionoutput = $template->get();
323 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
324 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
325 $solutionoutput = $solutiontemplate->get();
326 if (!$show_question_only)
331 return $solutionoutput;
334 function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
336 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
338 if (is_array($this->object->getParameters()))
340 foreach ($this->object->getParameters() as $name => $value)
342 array_push($params, urlencode($name) .
"=" . urlencode($value));
347 $template->setCurrentBlock(
"flash_vars");
348 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
349 $template->parseCurrentBlock();
350 $template->setCurrentBlock(
"applet_parameters");
351 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
352 $template->parseCurrentBlock();
354 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
355 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
356 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
357 $template->setVariable(
"ID", $this->object->getId());
358 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
359 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
360 $questionoutput = $template->get();
361 if (!$show_question_only)
366 return $questionoutput;
369 function getTestOutput($active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
372 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
374 if (is_array($this->object->getParameters()))
376 foreach ($this->object->getParameters() as $name => $value)
378 array_push($params, urlencode($name) .
"=" . urlencode($value));
382 array_push($params,
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
383 array_push($params,
"client=" . urlencode(CLIENT_ID));
384 array_push($params,
"points_max=" . urlencode($this->object->getPoints()));
388 array_push($params,
"pass=" .
$pass);
392 include_once
"./Modules/Test/classes/class.ilObjTest.php";
397 array_push($params,
"active_id=" . $active_id);
399 array_push($params,
"question_id=" . $this->object->getId());
403 $template->setCurrentBlock(
"flash_vars");
404 $template->setVariable(
"FLASH_VARS", join($params,
"&"));
405 $template->parseCurrentBlock();
406 $template->setCurrentBlock(
"applet_parameters");
407 $template->setVariable(
"PARAM_VALUE", join($params,
"&"));
408 $template->parseCurrentBlock();
410 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
411 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
412 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
413 $template->setVariable(
"ID", $this->object->getId());
414 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
415 $template->setVariable(
"APPLET_FILE", $this->object->getFlashPathWeb() . $this->
object->getApplet());
416 $questionoutput = $template->get();
418 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
431 global $rbacsystem, $ilTabs;
433 $ilTabs->clearTargets();
435 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
436 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
437 $q_type = $this->
object->getQuestionType();
441 $classname = $q_type .
"GUI";
442 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
443 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
448 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
451 $ilTabs->addTarget(
"edit_page",
452 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
453 array(
"edit",
"insert",
"exec_pg"),
454 "",
"", $force_active);
460 $force_active =
false;
461 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
464 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
465 $commands =
$_POST[
"cmd"];
466 if (is_array($commands))
468 foreach ($commands as $key => $value)
470 if (preg_match(
"/^suggestrange_.*/", $key, $matches))
472 $force_active =
true;
477 $ilTabs->addTarget(
"edit_question",
479 array(
"editQuestion",
"save",
"flashAddParam",
"saveEdit",
"originalSyncForm"),
480 $classname,
"", $force_active);
495 $ilTabs->addTarget(
"statistics",
496 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
507 return $this->
object->prepareTextareaOutput($output, TRUE);