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;
 
   93                 if (
$_POST[
'flash'][
'delete'] == 1)
 
   95                         $this->
object->deleteApplet();
 
   99                         $this->
object->setApplet( 
$_POST[
'flash'][
'filename'] );
 
  101                 if ($_FILES[
"flash"][
"tmp_name"])
 
  103                         $this->
object->deleteApplet();
 
  104                         $filename = $this->
object->moveUploadedFile( $_FILES[
"flash"][
"tmp_name"], $_FILES[
"flash"][
"name"] );
 
  107                 $this->
object->clearParameters();
 
  108                 if (is_array( 
$_POST[
"flash"][
"flash_param_name"] ))
 
  110                         foreach (
$_POST[
'flash'][
'flash_param_name'] as $idx => $val)
 
  112                                 $this->
object->addParameter( $val, 
$_POST[
'flash'][
'flash_param_value'][$idx] );
 
  115                 if (is_array( 
$_POST[
'flash'][
'flash_param_delete'] ))
 
  117                         foreach (
$_POST[
'flash'][
'flash_param_delete'] as $key => $value)
 
  119                                 $this->
object->removeParameter( 
$_POST[
'flash'][
'flash_param_name'][$key] );
 
  123                 $this->
object->setWidth( 
$_POST[
"flash"][
"width"] );
 
  124                 $this->
object->setHeight( 
$_POST[
"flash"][
"height"] );
 
  125                 $this->
object->setPoints( 
$_POST[
"points"] );
 
  139                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  141                 $form->setFormAction($this->ctrl->getFormAction($this));
 
  143                 $form->setMultipart(TRUE);
 
  144                 $form->setTableWidth(
"100%");
 
  145                 $form->setId(
"flash");
 
  158                         $form->setValuesByPost();
 
  159                         $errors = !$form->checkInput();
 
  160                         $form->setValuesByPost(); 
 
  161                         if (
$errors) $checkonly = 
false;
 
  164                 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
 
  173                 if (strlen( $this->object->getApplet() ))
 
  175                         $flash->setApplet( $this->object->getApplet() );
 
  176                         $flash->setAppletPathWeb( $this->object->getFlashPathWeb() );
 
  178                 $flash->setWidth( $this->object->getWidth() );
 
  179                 $flash->setHeight( $this->object->getHeight() );
 
  180                 $flash->setParameters( $this->object->getParameters() );
 
  182                 if ($this->object->getId())
 
  185                         $hidden->setValue( $this->object->getId() );
 
  190                 $points->
setValue( $this->object->getPoints() );
 
  191                 $points->setRequired( TRUE );
 
  192                 $points->setSize( 3 );
 
  193                 $points->setMinValue( 0.0 );
 
  202                 $this->
object->addParameter(
"", 
"");
 
  206         function outQuestionForTest($formaction, $active_id, 
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 
  208                 $test_output = $this->
getTestOutput($active_id, 
$pass, $is_postponed, $use_post_solutions, $show_feedback); 
 
  209                 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
 
  210                 $this->tpl->setVariable(
"FORMACTION", $formaction);
 
  229                 $graphicalOutput = FALSE,
 
  230                 $result_output = FALSE,
 
  231                 $show_question_only = TRUE,
 
  232                 $show_feedback = FALSE,
 
  233                 $show_correct_solution = FALSE,
 
  234                 $show_manual_scoring = FALSE,
 
  235                 $show_question_text = TRUE
 
  239                 $template = 
new ilTemplate(
"tpl.il_as_qpl_flash_question_output_solution.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  242                 if (is_array($this->object->getParameters()))
 
  244                         foreach ($this->object->getParameters() as $name => $value)
 
  246                                 array_push($params, urlencode($name) . 
"=" . urlencode($value));
 
  250                 array_push($params, 
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
 
  251                 array_push($params, 
"client=" . urlencode(CLIENT_ID));
 
  252                 array_push($params, 
"points_max=" . urlencode($this->object->getPoints()));
 
  256                         array_push($params, 
"pass=" . 
$pass);
 
  260                         include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  265                         array_push($params, 
"active_id=" . $active_id);
 
  267                 array_push($params, 
"question_id=" . $this->object->getId());
 
  269                 if ($show_correct_solution)
 
  271                         array_push($params, 
"solution=correct");
 
  275                         array_push($params, 
"solution=user");
 
  278                 if (($active_id > 0) && (!$show_correct_solution))
 
  280                         if ($graphicalOutput)
 
  283                                 $reached_points = $this->
object->getReachedPoints($active_id, 
$pass);
 
  284                                 if ($reached_points == $this->object->getMaximumPoints())
 
  286                                         $template->setCurrentBlock(
"icon_ok");
 
  288                                         $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
 
  289                                         $template->parseCurrentBlock();
 
  293                                         $template->setCurrentBlock(
"icon_ok");
 
  294                                         if ($reached_points > 0)
 
  297                                                 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
 
  302                                                 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
 
  304                                         $template->parseCurrentBlock();
 
  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();
 
  318                 if ($show_question_text==
true)
 
  320                         $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
 
  322                 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
 
  323                 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
 
  324                 $template->setVariable(
"ID", $this->object->getId());
 
  325                 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
 
  326                 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
 
  328                 $questionoutput = $template->get();
 
  329                 $solutiontemplate = 
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  330                 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
 
  331                 $solutionoutput = $solutiontemplate->get(); 
 
  332                 if (!$show_question_only)
 
  335                         $solutionoutput = 
'<div class="ilc_question_Standard">'.$solutionoutput.
"</div>";
 
  337                 return $solutionoutput;
 
  342                 $template = 
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  344                 if (is_array($this->object->getParameters()))
 
  346                         foreach ($this->object->getParameters() as $name => $value)
 
  348                                 array_push($params, urlencode($name) . 
"=" . urlencode($value));
 
  353                         $template->setCurrentBlock(
"flash_vars");
 
  354                         $template->setVariable(
"FLASH_VARS", join($params, 
"&"));
 
  355                         $template->parseCurrentBlock();
 
  356                         $template->setCurrentBlock(
"applet_parameters");
 
  357                         $template->setVariable(
"PARAM_VALUE", join($params, 
"&"));
 
  358                         $template->parseCurrentBlock();
 
  360                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
 
  361                 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
 
  362                 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
 
  363                 $template->setVariable(
"ID", $this->object->getId());
 
  364                 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
 
  365                 $template->setVariable(
"APPLET_FILE", $this->object->getApplet());
 
  366                 $questionoutput = $template->get();
 
  367                 if (!$show_question_only)
 
  372                 return $questionoutput;
 
  375         function getTestOutput($active_id, 
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 
  378                 $template = 
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  380                 if (is_array($this->object->getParameters()))
 
  382                         foreach ($this->object->getParameters() as $name => $value)
 
  384                                 array_push($params, urlencode($name) . 
"=" . urlencode($value));
 
  388                 array_push($params, 
"session_id=" . urlencode(
$_COOKIE[
"PHPSESSID"]));
 
  389                 array_push($params, 
"client=" . urlencode(CLIENT_ID));
 
  390                 array_push($params, 
"points_max=" . urlencode($this->object->getPoints()));
 
  394                         array_push($params, 
"pass=" . 
$pass);
 
  398                         include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  403                         array_push($params, 
"active_id=" . $active_id);
 
  405                 array_push($params, 
"question_id=" . $this->object->getId());
 
  409                         $template->setCurrentBlock(
"flash_vars");
 
  410                         $template->setVariable(
"FLASH_VARS", join($params, 
"&"));
 
  411                         $template->parseCurrentBlock();
 
  412                         $template->setCurrentBlock(
"applet_parameters");
 
  413                         $template->setVariable(
"PARAM_VALUE", join($params, 
"&"));
 
  414                         $template->parseCurrentBlock();
 
  416                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
 
  417                 $template->setVariable(
"APPLET_WIDTH", $this->object->getWidth());
 
  418                 $template->setVariable(
"APPLET_HEIGHT", $this->object->getHeight());
 
  419                 $template->setVariable(
"ID", $this->object->getId());
 
  420                 $template->setVariable(
"APPLET_PATH", $this->object->getFlashPathWeb() . $this->
object->getApplet());
 
  421                 $template->setVariable(
"APPLET_FILE", $this->object->getFlashPathWeb() . $this->
object->getApplet());
 
  422                 $questionoutput = $template->get();
 
  424                 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
 
  437                 global $rbacsystem, $ilTabs;
 
  439                 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI", 
"q_id", 
$_GET[
"q_id"]);
 
  440                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  441                 $q_type = $this->
object->getQuestionType();
 
  445                         $classname = $q_type . 
"GUI";
 
  446                         $this->ctrl->setParameterByClass(strtolower($classname), 
"sel_question_types", $q_type);
 
  447                         $this->ctrl->setParameterByClass(strtolower($classname), 
"q_id", 
$_GET[
"q_id"]);
 
  452                         if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  455                                 $ilTabs->addTarget(
"edit_page",
 
  456                                         $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI", 
"edit"),
 
  457                                         array(
"edit", 
"insert", 
"exec_pg"),
 
  458                                         "", 
"", $force_active);
 
  462                         $ilTabs->addTarget(
"preview",
 
  463                                 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI", 
"preview"),
 
  465                                 "ilAssQuestionPageGUI", 
"", $force_active);
 
  468                 $force_active = 
false;
 
  469                 if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  472                         if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, 
"editQuestion");
 
  473                         $commands = 
$_POST[
"cmd"];
 
  474                         if (is_array($commands))
 
  476                                 foreach ($commands as $key => $value)
 
  478                                         if (preg_match(
"/^suggestrange_.*/", $key, $matches))
 
  480                                                 $force_active = 
true;
 
  485                         $ilTabs->addTarget(
"edit_question",
 
  487                                 array(
"editQuestion", 
"save", 
"flashAddParam", 
"saveEdit", 
"originalSyncForm"),
 
  488                                 $classname, 
"", $force_active);
 
  499                         $ilTabs->addTarget(
"solution_hint",
 
  500                                 $this->ctrl->getLinkTargetByClass($classname, 
"suggestedsolution"),
 
  501                                 array(
"suggestedsolution", 
"saveSuggestedSolution", 
"outSolutionExplorer", 
"cancel", 
 
  502                                 "addSuggestedSolution",
"cancelExplorer", 
"linkChilds", 
"removeSuggestedSolution" 
  512                         $ilTabs->addTarget(
"statistics",
 
  513                                 $this->ctrl->getLinkTargetByClass($classname, 
"assessment"),
 
  518                 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
 
  523                         global $___test_express_mode;
 
  525                         if (!
$_GET[
'test_express_mode'] && !$___test_express_mode) {
 
  526                             $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), 
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
 
  530                             $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
 
  535                         $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui", 
"questions"));
 
  542                 return $this->
object->prepareTextareaOutput($output, TRUE);