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';
36 parent::__construct();
37 include_once
'./Modules/TestQuestionPool/classes/class.assJavaApplet.php';
40 $this->
object->loadFromDb(
$id);
46 if (substr($cmd, 0, 6) ==
"delete") {
57 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
59 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
63 $this->
object->setPoints(
$_POST[
"points"]);
75 if (
$_POST[
'delete_applet']) {
77 $this->
object->deleteJavaAppletFilename();
79 $this->
object->setJavaAppletFilename(
$_POST[
'uploaded_javaapplet']);
83 if (!empty($_FILES[
'javaappletName'][
'tmp_name'])) {
84 $this->
object->setJavaAppletFilename(
85 $_FILES[
'javaappletName'][
'name'],
86 $_FILES[
'javaappletName'][
'tmp_name']
89 $this->
object->setJavaCode(
$_POST[
"java_code"]);
90 $this->
object->setJavaCodebase(
$_POST[
"java_codebase"]);
91 $this->
object->setJavaArchive(
$_POST[
"java_archive"]);
92 $this->
object->setJavaWidth(
$_POST[
"java_width"]);
93 $this->
object->setJavaHeight(
$_POST[
"java_height"]);
95 $this->
object->flushParams();
96 if (is_array(
$_POST[
'kvp'][
'key'])) {
97 foreach (
$_POST[
'kvp'][
'key'] as $idx => $val) {
98 if (strlen($val) && strlen(
$_POST[
'kvp'][
'value'][$idx])) {
99 $this->
object->addParameter($val,
$_POST[
'kvp'][
'value'][$idx]);
114 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
116 $this->editForm =
$form;
118 $form->setFormAction($this->ctrl->getFormAction($this));
120 $form->setMultipart(
true);
121 $form->setTableWidth(
"100%");
122 $form->setId(
"assjavaapplet");
134 $form->setValuesByPost();
136 $form->setValuesByPost();
143 $this->tpl->setVariable(
"QUESTION_DATA",
$form->getHTML());
152 $points->
setValue($this->object->getPoints());
153 $points->setRequired(
true);
155 $points->setMinValue(0.0);
159 $header->setTitle($this->lng->txt(
"applet_attributes"));
163 $javaapplet = $this->
object->getJavaAppletFilename();
164 $applet =
new ilFileInputGUI($this->lng->txt(
'javaapplet'),
'javaappletName');
166 $applet->setRequired(
false);
168 if (strlen($javaapplet)) {
174 $delete->setOptionTitle($this->lng->txt(
'delete'));
175 $delete->setValue(1);
176 $applet->addSubItem($delete);
182 $code->setValue($this->object->getJavaCode());
183 $code->setRequired(
true);
186 if (!strlen($javaapplet)) {
188 $archive =
new ilTextInputGUI($this->lng->txt(
"archive"),
"java_archive");
189 $archive->
setValue($this->object->getJavaArchive());
190 $archive->setRequired(
false);
194 $codebase =
new ilTextInputGUI($this->lng->txt(
"codebase"),
"java_codebase");
195 $codebase->
setValue($this->object->getJavaCodebase());
196 $codebase->setRequired(
false);
204 $width->setMinValue(50);
205 $width->setMaxLength(6);
206 $width->setValue($this->object->getJavaWidth());
207 $width->setRequired(
true);
214 $height->setMinValue(50);
215 $height->setMaxLength(6);
216 $height->setValue($this->object->getJavaHeight());
217 $height->setRequired(
true);
221 $header->setTitle($this->lng->txt(
"applet_parameters"));
224 include_once
"./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php";
227 for (
$i = 0;
$i < $this->
object->getParameterCount();
$i++) {
228 $param = $this->
object->getParameter(
$i);
229 array_push($values, array( $param[
'name'], $param[
'value'] ));
231 if (count($values) == 0) {
232 array_push($values, array(
"",
"" ));
234 $kvp->setKeyName($this->lng->txt(
'name'));
235 $kvp->setValueName($this->lng->txt(
'value'));
236 $kvp->setValues($values);
246 $position = key(
$_POST[
'cmd'][
'addkvp']);
247 $this->
object->addParameterAtIndex($position + 1,
"",
"");
257 $position = key(
$_POST[
'cmd'][
'removekvp']);
258 $this->
object->removeParameter($position);
278 $graphicalOutput =
false,
279 $result_output =
false,
280 $show_question_only =
true,
281 $show_feedback =
false,
282 $show_correct_solution =
false,
283 $show_manual_scoring =
false,
284 $show_question_text =
true 286 $userdata = $this->
object->getActiveUserData($active_id);
289 include_once
"./Services/UICore/classes/class.ilTemplate.php";
290 include_once
"./Modules/Test/classes/class.ilObjTest.php";
291 $template =
new ilTemplate(
"tpl.il_as_qpl_javaapplet_question_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
292 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
293 if (strlen($userdata[
"test_id"])) {
294 $template->setCurrentBlock(
"appletparam");
295 $template->setVariable(
"PARAM_NAME",
"test_type");
297 $template->setVariable(
"PARAM_VALUE",
"0");
299 $template->setVariable(
"PARAM_VALUE",
"1");
303 if (strlen($userdata[
"test_id"])) {
304 $template->setCurrentBlock(
"appletparam");
305 $template->setVariable(
"PARAM_NAME",
"test_id");
306 $template->setVariable(
"PARAM_VALUE", $userdata[
"test_id"]);
309 $template->setCurrentBlock(
"appletparam");
310 $template->setVariable(
"PARAM_NAME",
"active_id");
311 $template->setVariable(
"PARAM_VALUE", $active_id);
313 $template->setCurrentBlock(
"appletparam");
314 $template->setVariable(
"PARAM_NAME",
"question_id");
315 $template->setVariable(
"PARAM_VALUE", $this->object->getId());
317 if (strlen($userdata[
"user_id"])) {
318 $template->setCurrentBlock(
"appletparam");
319 $template->setVariable(
"PARAM_NAME",
"user_id");
320 $template->setVariable(
"PARAM_VALUE", $userdata[
"user_id"]);
323 $template->setCurrentBlock(
"appletparam");
324 $template->setVariable(
"PARAM_NAME",
"points_max");
325 $template->setVariable(
"PARAM_VALUE", $this->object->getPoints());
327 $template->setCurrentBlock(
"appletparam");
328 $template->setVariable(
"PARAM_NAME",
"session_id");
331 $template->setCurrentBlock(
"appletparam");
332 $template->setVariable(
"PARAM_NAME",
"client");
333 $template->setVariable(
"PARAM_VALUE", CLIENT_ID);
335 $template->setCurrentBlock(
"appletparam");
336 $template->setVariable(
"PARAM_NAME",
"pass");
338 $template->setVariable(
"PARAM_VALUE", $actualpass);
341 for (
$i = 0;
$i < $this->
object->getParameterCount();
$i++) {
342 $parameter = $this->
object->getParameter(
$i);
343 $template->setCurrentBlock(
"appletparam");
344 $template->setVariable(
"PARAM_NAME", $parameter[
"name"]);
345 $template->setVariable(
"PARAM_VALUE", $parameter[
"value"]);
349 if (($active_id > 0) && (!$show_correct_solution)) {
351 include_once
"./Modules/Test/classes/class.ilObjTest.php";
352 $info = $this->
object->getSolutionValues($active_id,
$pass);
353 foreach (
$info as $kk => $infodata) {
354 $template->setCurrentBlock(
"appletparam");
355 $template->setVariable(
"PARAM_NAME",
"value_" . $infodata[
"order"] .
"_1");
356 $template->setVariable(
"PARAM_VALUE", $infodata[
"value1"]);
358 $template->setCurrentBlock(
"appletparam");
359 $template->setVariable(
"PARAM_NAME",
"value_" . $infodata[
"order"] .
"_2");
360 $template->setVariable(
"PARAM_VALUE", $infodata[
"value2"]);
365 $questiontext = $this->
object->getQuestion();
366 if ($show_question_text ==
true) {
367 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext,
true));
369 $template->setVariable(
"APPLET_WIDTH", $this->object->getJavaWidth());
370 $template->setVariable(
"APPLET_HEIGHT", $this->object->getJavaHeight());
371 $template->setVariable(
"APPLET_CODE", $this->object->getJavaCode());
372 if (strlen($this->object->getJavaArchive()) > 0) {
373 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"" . $this->object->getJavaArchive() .
"\"");
375 if (strpos($this->object->getJavaAppletFilename(),
".jar") !==
false) {
376 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"" . $this->object->getJavaPathWeb() . $this->
object->getJavaAppletFilename() .
"\"");
379 if (strlen($this->object->getJavaCodebase()) > 0) {
380 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"" . $this->object->getJavaCodebase() .
"\"");
382 if (strpos($this->object->getJavaAppletFilename(),
".class") !==
false) {
383 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"" . $this->object->getJavaPathWeb() .
"\"");
386 if (($active_id > 0) && (!$show_correct_solution)) {
387 if ($graphicalOutput) {
389 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
390 if ($reached_points == $this->object->getPoints()) {
393 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
397 if ($reached_points > 0) {
399 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
402 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
410 if (strlen($feedback)) {
416 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
417 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback,
true));
419 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
421 $solutionoutput = $solutiontemplate->get();
422 if (!$show_question_only) {
426 return $solutionoutput;
429 public function getPreview($show_question_only =
false, $showInlineFeedback =
false)
432 include_once
"./Services/UICore/classes/class.ilTemplate.php";
433 $template =
new ilTemplate(
"tpl.il_as_qpl_javaapplet_question_output.html",
true,
true,
"Modules/TestQuestionPool");
434 $template->setCurrentBlock(
"appletparam");
435 $template->setVariable(
"PARAM_NAME",
"question_id");
436 $template->setVariable(
"PARAM_VALUE", $this->object->getId());
438 $template->setCurrentBlock(
"appletparam");
439 $template->setVariable(
"PARAM_NAME",
"points_max");
440 $template->setVariable(
"PARAM_VALUE", $this->object->getPoints());
442 $template->setCurrentBlock(
"appletparam");
443 $template->setVariable(
"PARAM_NAME",
"session_id");
446 $template->setCurrentBlock(
"appletparam");
447 $template->setVariable(
"PARAM_NAME",
"client");
448 $template->setVariable(
"PARAM_VALUE", CLIENT_ID);
451 for (
$i = 0;
$i < $this->
object->getParameterCount();
$i++) {
452 $parameter = $this->
object->getParameter(
$i);
453 $template->setCurrentBlock(
"appletparam");
454 $template->setVariable(
"PARAM_NAME", $parameter[
"name"]);
455 $template->setVariable(
"PARAM_VALUE", $parameter[
"value"]);
459 $questiontext = $this->
object->getQuestion();
460 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext,
true));
461 $template->setVariable(
"APPLET_WIDTH", $this->object->getJavaWidth());
462 $template->setVariable(
"APPLET_HEIGHT", $this->object->getJavaHeight());
463 $template->setVariable(
"APPLET_CODE", $this->object->getJavaCode());
464 if (strlen($this->object->getJavaArchive()) > 0) {
465 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"" . $this->object->getJavaArchive() .
"\"");
467 if (strpos($this->object->getJavaAppletFilename(),
".jar") !==
false) {
468 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"" . $this->object->getJavaPathWeb() . $this->
object->getJavaAppletFilename() .
"\"");
471 if (strlen($this->object->getJavaCodebase()) > 0) {
472 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"" . $this->object->getJavaCodebase() .
"\"");
474 if (strpos($this->object->getJavaAppletFilename(),
".class") !==
false) {
475 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"" . $this->object->getJavaPathWeb() .
"\"");
479 if (!$show_question_only) {
483 return $questionoutput;
487 public function getTestOutput($active_id,
$pass, $is_postponed =
false, $use_post_solutions =
false, $show_feedback =
false)
490 $userdata = $this->
object->getActiveUserData($active_id);
492 include_once
"./Services/UICore/classes/class.ilTemplate.php";
493 $template =
new ilTemplate(
"tpl.il_as_qpl_javaapplet_question_output.html",
true,
true,
"Modules/TestQuestionPool");
494 $template->setCurrentBlock(
"appletparam");
495 $template->setVariable(
"PARAM_NAME",
"test_type");
496 include_once
"./Modules/Test/classes/class.ilObjTest.php";
498 $template->setVariable(
"PARAM_VALUE",
"0");
500 $template->setVariable(
"PARAM_VALUE",
"1");
503 $template->setCurrentBlock(
"appletparam");
504 $template->setVariable(
"PARAM_NAME",
"active_id");
505 $template->setVariable(
"PARAM_VALUE", $active_id);
507 $template->setCurrentBlock(
"appletparam");
508 $template->setVariable(
"PARAM_NAME",
"test_id");
509 $template->setVariable(
"PARAM_VALUE", $userdata[
"test_id"]);
511 $template->setCurrentBlock(
"appletparam");
512 $template->setVariable(
"PARAM_NAME",
"question_id");
513 $template->setVariable(
"PARAM_VALUE", $this->object->getId());
515 $template->setCurrentBlock(
"appletparam");
516 $template->setVariable(
"PARAM_NAME",
"user_id");
517 $template->setVariable(
"PARAM_VALUE", $userdata[
"user_id"]);
519 $template->setCurrentBlock(
"appletparam");
520 $template->setVariable(
"PARAM_NAME",
"points_max");
521 $template->setVariable(
"PARAM_VALUE", $this->object->getPoints());
523 $template->setCurrentBlock(
"appletparam");
524 $template->setVariable(
"PARAM_NAME",
"session_id");
527 $template->setCurrentBlock(
"appletparam");
528 $template->setVariable(
"PARAM_NAME",
"client");
529 $template->setVariable(
"PARAM_VALUE", CLIENT_ID);
531 $template->setCurrentBlock(
"appletparam");
532 $template->setVariable(
"PARAM_NAME",
"pass");
534 $template->setVariable(
"PARAM_VALUE", $actualpass);
536 $template->setCurrentBlock(
"appletparam");
537 $template->setVariable(
"PARAM_NAME",
"post_url");
541 for (
$i = 0;
$i < $this->
object->getParameterCount();
$i++) {
542 $parameter = $this->
object->getParameter(
$i);
543 $template->setCurrentBlock(
"appletparam");
544 $template->setVariable(
"PARAM_NAME", $parameter[
"name"]);
545 $template->setVariable(
"PARAM_VALUE", $parameter[
"value"]);
552 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 553 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 555 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 557 $info = $this->
object->getTestOutputSolutions($active_id,
$pass);
559 foreach (
$info as $kk => $infodata) {
560 $template->setCurrentBlock(
"appletparam");
561 $template->setVariable(
"PARAM_NAME",
"value_" . $infodata[
"order"] .
"_1");
562 $template->setVariable(
"PARAM_VALUE", $infodata[
"value1"]);
564 $template->setCurrentBlock(
"appletparam");
565 $template->setVariable(
"PARAM_NAME",
"value_" . $infodata[
"order"] .
"_2");
566 $template->setVariable(
"PARAM_VALUE", $infodata[
"value2"]);
569 include_once
'./Services/Administration/classes/class.ilSetting.php';
571 if ($soapSetting->get(
"soap_user_administration") == 1) {
572 $template->setCurrentBlock(
"appletparam");
573 $template->setVariable(
"PARAM_NAME",
"server");
578 $questiontext = $this->
object->getQuestion();
579 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext,
true));
580 $template->setVariable(
"APPLET_WIDTH", $this->object->getJavaWidth());
581 $template->setVariable(
"APPLET_HEIGHT", $this->object->getJavaHeight());
582 $template->setVariable(
"APPLET_CODE", $this->object->getJavaCode());
583 if (strlen($this->object->getJavaArchive()) > 0) {
584 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"" . $this->object->getJavaArchive() .
"\"");
586 if (strpos($this->object->getJavaAppletFilename(),
".jar") !==
false) {
587 $template->setVariable(
"APPLET_ARCHIVE",
" archive=\"" . $this->object->getJavaPathWeb() . $this->
object->getJavaAppletFilename() .
"\"");
590 if (strlen($this->object->getJavaCodebase()) > 0) {
591 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"" . $this->object->getJavaCodebase() .
"\"");
593 if (strpos($this->object->getJavaAppletFilename(),
".class") !==
false) {
594 $template->setVariable(
"APPLET_CODEBASE",
" codebase=\"" . $this->object->getJavaPathWeb() .
"\"");
598 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
612 $rbacsystem = $DIC[
'rbacsystem'];
613 $ilTabs = $DIC[
'ilTabs'];
615 $ilTabs->clearTargets();
617 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
618 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
619 $q_type = $this->
object->getQuestionType();
621 if (strlen($q_type)) {
622 $classname = $q_type .
"GUI";
623 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
624 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
628 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
632 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
633 array(
"edit",
"insert",
"exec_pg"),
643 $force_active =
false;
644 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
647 $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
649 $commands =
$_POST[
"cmd"];
650 if (is_array($commands)) {
651 foreach ($commands as
$key => $value) {
652 if (preg_match(
"/^delete_.*/",
$key, $matches)) {
653 $force_active =
true;
661 array(
"editQuestion",
"save",
"saveEdit",
"addkvp",
"removekvp",
"originalSyncForm"),
681 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
694 return $this->
object->prepareTextareaOutput(
$output,
true);
isTestPresentationContext()
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
addkvp()
Add a new answer.
static _getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
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
if(!array_key_exists('StateId', $_REQUEST)) $id
getSpecificFeedbackOutput($userSolution)
Class for Java Applet Questions.
getQuestionTemplate()
get question template
const CSS_CLASS_FEEDBACK_CORRECT
__construct($id=-1)
assJavaAppletGUI constructor
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
populateTaxonomyFormSection(ilPropertyFormGUI $form)
static _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
Java applet question GUI representation.
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
writeQuestionGenericPostData()
if(isset($_POST['submit'])) $form
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)
special template class to simplify handling of ITX/PEAR
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
This class represents a text property in a property form.
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
writePostData($always=false)
{}
const CSS_CLASS_FEEDBACK_WRONG
Basic GUI class for assessment questions.
static removeTrailingPathSeparators($path)
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
getTestOutput($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
saveTaxonomyAssignments()
This class represents a non editable value in a property form.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
addBackTab(ilTabsGUI $ilTabs)
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
getPreview($show_question_only=false, $showInlineFeedback=false)
Interface ilGuiQuestionScoringAdjustable.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
setValue($a_value)
Set Value.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
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.
removekvp()
Remove an answer.
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.