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 parent::__construct();
38 include_once
"./Modules/TestQuestionPool/classes/class.assFlashQuestion.php";
40 $this->newUnitId = null;
43 $this->
object->loadFromDb($id);
49 if (preg_match(
"/suggestrange_(.*?)/",
$cmd, $matches))
51 $cmd =
"suggestRange";
75 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
78 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
91 if (
$_POST[
'flash'][
'delete'] == 1)
93 $this->
object->deleteApplet();
97 $this->
object->setApplet(
$_POST[
'flash'][
'filename'] );
99 if ($_FILES[
"flash"][
"tmp_name"])
101 $this->
object->deleteApplet();
102 $filename = $this->
object->moveUploadedFile( $_FILES[
"flash"][
"tmp_name"], $_FILES[
"flash"][
"name"] );
105 $this->
object->clearParameters();
106 if (is_array(
$_POST[
"flash"][
"flash_param_name"] ))
108 foreach (
$_POST[
'flash'][
'flash_param_name'] as $idx => $val)
110 $this->
object->addParameter( $val,
$_POST[
'flash'][
'flash_param_value'][$idx] );
113 if (is_array(
$_POST[
'flash'][
'flash_param_delete'] ))
115 foreach (
$_POST[
'flash'][
'flash_param_delete'] as $key => $value)
117 $this->
object->removeParameter(
$_POST[
'flash'][
'flash_param_name'][$key] );
121 $this->
object->setWidth(
$_POST[
"flash"][
"width"] );
122 $this->
object->setHeight(
$_POST[
"flash"][
"height"] );
123 $this->
object->setPoints(
$_POST[
"points"] );
137 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
139 $this->editForm = $form;
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() );
191 $points->setRequired( TRUE );
192 $points->setSize( 3 );
193 $points->setMinValue( 0.0 );
202 $this->
object->addParameter(
"",
"");
222 $graphicalOutput = FALSE,
223 $result_output = FALSE,
224 $show_question_only = TRUE,
225 $show_feedback = FALSE,
226 $show_correct_solution = FALSE,
227 $show_manual_scoring = FALSE,
228 $show_question_text = TRUE
232 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
235 if (is_array($this->
object->getParameters()))
237 foreach ($this->
object->getParameters() as $name => $value)
239 array_push(
$params, urlencode($name) .
"=" . urlencode($value));
244 array_push(
$params,
"client=" . urlencode(CLIENT_ID));
245 array_push(
$params,
"points_max=" . urlencode($this->
object->getPoints()));
253 include_once
"./Modules/Test/classes/class.ilObjTest.php";
258 array_push(
$params,
"active_id=" . $active_id);
260 array_push(
$params,
"question_id=" . $this->
object->getId());
262 if ($show_correct_solution)
264 array_push(
$params,
"solution=correct");
268 array_push(
$params,
"solution=user");
271 if (($active_id > 0) && (!$show_correct_solution))
273 if ($graphicalOutput)
276 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
277 if ($reached_points == $this->
object->getMaximumPoints())
279 $template->setCurrentBlock(
"icon_ok");
281 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
282 $template->parseCurrentBlock();
286 $template->setCurrentBlock(
"icon_ok");
287 if ($reached_points > 0)
290 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
295 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
297 $template->parseCurrentBlock();
304 $template->setCurrentBlock(
"flash_vars");
305 $template->setVariable(
"FLASH_VARS", join(
$params,
"&"));
306 $template->parseCurrentBlock();
307 $template->setCurrentBlock(
"applet_parameters");
308 $template->setVariable(
"PARAM_VALUE", join(
$params,
"&"));
309 $template->parseCurrentBlock();
311 if ($show_question_text==
true)
313 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
315 $template->setVariable(
"APPLET_WIDTH", $this->
object->getWidth());
316 $template->setVariable(
"APPLET_HEIGHT", $this->
object->getHeight());
317 $template->setVariable(
"ID", $this->
object->getId());
318 $template->setVariable(
"APPLET_PATH", $this->
object->getFlashPathWeb() . $this->
object->getApplet());
319 $template->setVariable(
"APPLET_FILE", $this->
object->getApplet());
321 $questionoutput = $template->get();
322 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
323 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
324 $solutionoutput = $solutiontemplate->get();
325 if (!$show_question_only)
330 return $solutionoutput;
333 function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
335 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
337 if (is_array($this->
object->getParameters()))
339 foreach ($this->
object->getParameters() as $name => $value)
341 array_push(
$params, urlencode($name) .
"=" . urlencode($value));
346 $template->setCurrentBlock(
"flash_vars");
347 $template->setVariable(
"FLASH_VARS", join(
$params,
"&"));
348 $template->parseCurrentBlock();
349 $template->setCurrentBlock(
"applet_parameters");
350 $template->setVariable(
"PARAM_VALUE", join(
$params,
"&"));
351 $template->parseCurrentBlock();
353 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
354 $template->setVariable(
"APPLET_WIDTH", $this->
object->getWidth());
355 $template->setVariable(
"APPLET_HEIGHT", $this->
object->getHeight());
356 $template->setVariable(
"ID", $this->
object->getId());
357 $template->setVariable(
"APPLET_PATH", $this->
object->getFlashPathWeb() . $this->
object->getApplet());
358 $template->setVariable(
"APPLET_FILE", $this->
object->getApplet());
359 $questionoutput = $template->get();
360 if (!$show_question_only)
365 return $questionoutput;
369 function getTestOutput($active_id,
$pass, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
373 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
375 if (is_array($this->
object->getParameters()))
377 foreach ($this->
object->getParameters() as $name => $value)
379 array_push(
$params, urlencode($name) .
"=" . urlencode($value));
384 array_push(
$params,
"client=" . urlencode(CLIENT_ID));
385 array_push(
$params,
"points_max=" . urlencode($this->
object->getPoints()));
393 include_once
"./Modules/Test/classes/class.ilObjTest.php";
398 array_push(
$params,
"active_id=" . $active_id);
400 array_push(
$params,
"question_id=" . $this->
object->getId());
404 $template->setCurrentBlock(
"flash_vars");
405 $template->setVariable(
"FLASH_VARS", join(
$params,
"&"));
406 $template->parseCurrentBlock();
407 $template->setCurrentBlock(
"applet_parameters");
408 $template->setVariable(
"PARAM_VALUE", join(
$params,
"&"));
409 $template->parseCurrentBlock();
411 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
412 $template->setVariable(
"APPLET_WIDTH", $this->
object->getWidth());
413 $template->setVariable(
"APPLET_HEIGHT", $this->
object->getHeight());
414 $template->setVariable(
"ID", $this->
object->getId());
415 $template->setVariable(
"APPLET_PATH", $this->
object->getFlashPathWeb() . $this->
object->getApplet());
416 $template->setVariable(
"APPLET_FILE", $this->
object->getFlashPathWeb() . $this->
object->getApplet());
417 $questionoutput = $template->get();
419 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
432 global $rbacsystem, $ilTabs;
434 $ilTabs->clearTargets();
436 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
437 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
438 $q_type = $this->
object->getQuestionType();
442 $classname = $q_type .
"GUI";
443 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
444 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
449 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
452 $ilTabs->addTarget(
"edit_page",
453 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
454 array(
"edit",
"insert",
"exec_pg"),
455 "",
"", $force_active);
461 $force_active =
false;
462 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
465 if ($classname)
$url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
466 $commands =
$_POST[
"cmd"];
467 if (is_array($commands))
469 foreach ($commands as $key => $value)
471 if (preg_match(
"/^suggestrange_.*/", $key, $matches))
473 $force_active =
true;
478 $ilTabs->addTarget(
"edit_question",
480 array(
"editQuestion",
"save",
"flashAddParam",
"saveEdit",
"originalSyncForm"),
481 $classname,
"", $force_active);
496 $ilTabs->addTarget(
"statistics",
497 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
508 return $this->
object->prepareTextareaOutput(
$output, TRUE);
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
getTestOutput($active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
The assFlashQuestionGUI class encapsulates the GUI representation for flash questions.
getSolutionOutput( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
Get the question solution output.
writePostData($always=false)
{}
Class for Flash based questions.
getQuestionTemplate()
get question template
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
populateTaxonomyFormSection(ilPropertyFormGUI $form)
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__construct($id=-1)
assFlashQuestionGUI constructor
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
writeQuestionGenericPostData()
getILIASPage($html="")
Returns the ILIAS Page around a question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
getSpecificFeedbackOutput($active_id, $pass)
special template class to simplify handling of ITX/PEAR
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
setQuestionTabs()
Sets the ILIAS tabs for this question type.
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
Basic GUI class for assessment questions.
static removeTrailingPathSeparators($path)
setErrorMessage($errormessage)
Create styles array
The data for the language used.
saveTaxonomyAssignments()
Create new PHPExcel object
obj_idprivate
addBackTab(ilTabsGUI $ilTabs)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
Interface ilGuiQuestionScoringAdjustable.
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
suggestRange()
Suggest a range for a result.