ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCourseObjectivesGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24// begin-patch lok
25include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
26// end-patch lok
27
37{
38 const MODE_UNDEFINED = 0;
39 const MODE_CREATE = 1;
40 const MODE_UPDATE = 2;
41
42
43 public $ctrl;
44 public $ilias;
45 public $ilErr;
46 public $lng;
47 public $tpl;
48
50 public $course_id;
51
52 // begin-patch lok
53 protected $settings;
54 protected $test_type = 0;
55 // end-patch lok
56
60 private $logger = null;
61
66 public function __construct($a_course_id)
67 {
68 include_once './Modules/Course/classes/class.ilCourseObjective.php';
69
70 global $ilCtrl,$lng,$ilErr,$ilias,$tpl,$tree,$ilTabs;
71
72 $this->ctrl = $ilCtrl;
73 $this->ctrl->saveParameter($this, array("ref_id"));
74
75 $this->logger = $GLOBALS['DIC']->logger()->crs();
76 $this->ilErr = $ilErr;
77 $this->lng = $lng;
78 $this->lng->loadLanguageModule('crs');
79 $this->tpl = $tpl;
80 $this->tree = $tree;
81 $this->tabs_gui = $ilTabs;
82
83 $this->course_id = $a_course_id;
84 $this->__initCourseObject();
85
86 // begin-patch lok
87 $this->settings = ilLOSettings::getInstanceByObjId($this->course_obj->getId());
88 // end-patch lok
89 }
90
94 public function executeCommand()
95 {
96 global $ilTabs;
97
98 $ilTabs->setTabActive('crs_objectives');
99
100 $cmd = $this->ctrl->getCmd();
101
102
103 if (!$cmd = $this->ctrl->getCmd()) {
104 $cmd = "list";
105 }
106
107 $this->$cmd();
108 }
109
110 // begin-patch lok
115 public function getSettings()
116 {
117 return $this->settings;
118 }
119 // end-patch lok
120
121
129 protected function listObjectives()
130 {
131 global $ilAccess,$ilErr,$ilObjDataCache,$ilToolbar;
132
133 $_SESSION['objective_mode'] = self::MODE_UNDEFINED;
134 if (!$ilAccess->checkAccess("write", '', $this->course_obj->getRefId())) {
135 $this->ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
136 }
137
138 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.crs_objectives.html', 'Modules/Course');
139
140 $ilToolbar->addButton(
141 $this->lng->txt('crs_add_objective'),
142 $this->ctrl->getLinkTarget($this, "'create")
143 );
144
145 include_once('./Modules/Course/classes/class.ilCourseObjectivesTableGUI.php');
146 $table = new ilCourseObjectivesTableGUI($this, $this->course_obj);
147 $table->setTitle($this->lng->txt('crs_objectives'), '', $this->lng->txt('crs_objectives'));
148 $table->parse(ilCourseObjective::_getObjectiveIds($this->course_obj->getId(), false));
149
150 $this->tpl->setVariable('OBJECTIVES_TABLE', $table->getHTML());
151 }
152
159 protected function saveSorting()
160 {
161 global $ilAccess,$ilErr,$ilObjDataCache;
162
163 if (!$ilAccess->checkAccess("write", '', $this->course_obj->getRefId())) {
164 $this->ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
165 }
166
167 asort($_POST['position'], SORT_NUMERIC);
168
169 $counter = 1;
170 foreach ($_POST['position'] as $objective_id => $position) {
171 $objective = new ilCourseObjective($this->course_obj, $objective_id);
172 $objective->writePosition($counter++);
173 }
174 ilUtil::sendSuccess($this->lng->txt('crs_objective_saved_sorting'));
175 $this->listObjectives();
176 }
177
178 public function askDeleteObjective()
179 {
180 global $rbacsystem;
181
182 // MINIMUM ACCESS LEVEL = 'write'
183 if (!$rbacsystem->checkAccess("write", $this->course_obj->getRefId())) {
184 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
185 }
186 if (!count($_POST['objective'])) {
187 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'));
188 $this->listObjectives();
189
190 return true;
191 }
192
193 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_objectives.html", 'Modules/Course');
194
195 ilUtil::sendQuestion($this->lng->txt('crs_delete_objectve_sure'));
196
197 $tpl = new ilTemplate("tpl.table.html", true, true);
198 $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.crs_objectives_delete_row.html", 'Modules/Course');
199
200 $counter = 0;
201 foreach ($_POST['objective'] as $objective_id) {
202 $objective_obj = $this->__initObjectivesObject($objective_id);
203
204 $tpl->setCurrentBlock("tbl_content");
205 $tpl->setVariable("ROWCOL", ilUtil::switchColor(++$counter, "tblrow2", "tblrow1"));
206 $tpl->setVariable("TITLE", $objective_obj->getTitle());
207 $tpl->setVariable("DESCRIPTION", $objective_obj->getDescription());
208 $tpl->parseCurrentBlock();
209 }
210
211 $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
212
213 // Show action row
214 $tpl->setCurrentBlock("tbl_action_btn");
215 $tpl->setVariable("BTN_NAME", 'deleteObjectives');
216 $tpl->setVariable("BTN_VALUE", $this->lng->txt('delete'));
217 $tpl->parseCurrentBlock();
218
219 $tpl->setCurrentBlock("tbl_action_btn");
220 $tpl->setVariable("BTN_NAME", 'listObjectives');
221 $tpl->setVariable("BTN_VALUE", $this->lng->txt('cancel'));
222 $tpl->parseCurrentBlock();
223
224 $tpl->setCurrentBlock("tbl_action_row");
225 $tpl->setVariable("COLUMN_COUNTS", 1);
226 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.svg'));
227 $tpl->parseCurrentBlock();
228
229
230 // create table
231 $tbl = new ilTableGUI();
232 $tbl->setStyle('table', 'std');
233
234 // title & header columns
235 $tbl->setTitle($this->lng->txt("crs_objectives"), "", $this->lng->txt("crs_objectives"));
236
237 $tbl->setHeaderNames(array($this->lng->txt("title")));
238 $tbl->setHeaderVars(
239 array("title"),
240 array("ref_id" => $this->course_obj->getRefId(),
241 "cmdClass" => "ilcourseobjectivesgui",
242 "cmdNode" => $_GET["cmdNode"])
243 );
244 $tbl->setColumnWidth(array("50%"));
245
246 $tbl->setLimit($_GET["limit"]);
247 $tbl->setOffset($_GET["offset"]);
248 $tbl->setMaxCount(count($_POST['objective']));
249
250 // footer
251 $tbl->disable("footer");
252 $tbl->disable('sort');
253
254 // render table
255 $tbl->setTemplate($tpl);
256 $tbl->render();
257
258 $this->tpl->setVariable("OBJECTIVES_TABLE", $tpl->get());
259
260
261 // Save marked objectives
262 $_SESSION['crs_delete_objectives'] = $_POST['objective'];
263
264 return true;
265 }
266
267 public function deleteObjectives()
268 {
269 global $rbacsystem;
270
271 // MINIMUM ACCESS LEVEL = 'write'
272 if (!$rbacsystem->checkAccess("write", $this->course_obj->getRefId())) {
273 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
274 }
275 if (!count($_SESSION['crs_delete_objectives'])) {
276 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'));
277 $this->listObjectives();
278
279 return true;
280 }
281
282 foreach ($_SESSION['crs_delete_objectives'] as $objective_id) {
283 $objective_obj =&$this->__initObjectivesObject($objective_id);
284 $objective_obj->delete();
285 }
286
287 ilUtil::sendSuccess($this->lng->txt('crs_objectives_deleted'));
288 $this->listObjectives();
289
290 return true;
291 }
292
299 protected function questionOverview()
300 {
301 global $ilAccess,$ilErr,$ilTabs;
302
303 $ilTabs->setSubTabActive('crs_objective_overview_question_assignment');
304
305 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
306 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
307 }
308
309 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionsTableGUI.php');
310 $table = new ilCourseObjectiveQuestionsTableGUI($this, $this->course_obj);
311 $table->setTitle($this->lng->txt('crs_objectives_edit_question_assignments'), '', $this->lng->txt('crs_objectives'));
312 // begin-patch lok
313 $table->parse(ilCourseObjective::_getObjectiveIds($this->course_obj->getId(), false));
314 // end-patch lok
315
316 $this->tpl->setContent($table->getHTML());
317 }
318
325 protected function saveQuestionOverview()
326 {
327 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
328
329 global $ilAccess,$ilErr;
330
331 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
332 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
333 }
334 $error = false;
335
336 $_POST['self'] = $_POST['self'] ? $_POST['self'] : array();
337 $_POST['final'] = $_POST['final'] ? $_POST['final'] : array();
338
339 foreach ($_POST['self'] as $objective_id => $limit) {
340 $qst = new ilCourseObjectiveQuestion($objective_id);
341 $max_points = $qst->getSelfAssessmentPoints();
342
343 if ($limit < 0 or $limit > $max_points) {
344 ilUtil::sendFailure($this->lng->txt('crs_objective_limit_err'));
345 $this->questionOverview();
346 return false;
347 }
348 }
349 foreach ($_POST['final'] as $objective_id => $limit) {
350 $qst = new ilCourseObjectiveQuestion($objective_id);
351 $max_points = $qst->getFinalTestPoints();
352
353 if ($limit < 0 or $limit > $max_points) {
354 ilUtil::sendFailure($this->lng->txt('crs_objective_limit_err'));
355 $this->questionOverview();
356 return false;
357 }
358 }
359
360 foreach ($_POST['self'] as $objective_id => $limit) {
362 }
363
364 foreach ($_POST['final'] as $objective_id => $limit) {
366 }
367
368 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
369 $this->questionOverview();
370 return true;
371 }
372
373 // PRIVATE
374 public function __initCourseObject()
375 {
376 if (!$this->course_obj =&ilObjectFactory::getInstanceByRefId($this->course_id, false)) {
377 $this->ilErr->raiseError("ilCourseObjectivesGUI: cannot create course object", $this->ilErr->MESSAGE);
378 exit;
379 }
380 return true;
381 }
382
383 public function __initObjectivesObject($a_id = 0)
384 {
385 return $this->objectives_obj = new ilCourseObjective($this->course_obj, $a_id);
386 }
387
388 public function __initLMObject($a_objective_id = 0)
389 {
390 include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
391 $this->objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
392
393 return true;
394 }
395
396 // begin-patch lok
402 public function __initQuestionObject($a_objective_id = 0)
403 {
404 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
405 $this->objectives_qst_obj = new ilCourseObjectiveQuestion($a_objective_id);
406
407 return $this->objectives_qst_obj;
408 }
409 // end-patch lok
410
414 public function setSubTabs($a_active = "")
415 {
416 global $ilTabs, $ilHelp;
417
418 if ($a_active != "") {
419 $ilHelp->setScreenIdComponent("crs");
420 $ilHelp->setScreenId("crs_objective");
421 $ilHelp->setSubScreenId($a_active);
422 }
423
424
425 // begin-patch lok
426 // no subtabs here
427 return true;
428 // end-patch lok
429
430
431 $ilTabs->addSubTabTarget(
432 "crs_objective_overview_objectives",
433 $this->ctrl->getLinkTarget($this, "listObjectives"),
434 array("listObjectives", "moveObjectiveUp", "moveObjectiveDown", "listAssignedLM"),
435 array(),
436 '',
437 true
438 );
439 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
440
441 if (ilCourseObjectiveQuestion::_hasTests($this->course_obj->getId())) {
442 $ilTabs->addSubTabTarget(
443 "crs_objective_overview_question_assignment",
444 $this->ctrl->getLinkTarget($this, "questionOverview"),
445 "editQuestionAssignment",
446 array(),
447 '',
448 false
449 );
450 }
451 }
452
453
461 public function create()
462 {
463 global $tpl;
464
465 $this->setSubTabs("create_obj");
466
467 $_SESSION['objective_mode'] = self::MODE_CREATE;
468
469 $this->ctrl->saveParameter($this, 'objective_id');
470
471 if (!is_object($this->objective)) {
472 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
473 }
474 $this->__initQuestionObject((int) $_GET['objective_id']);
475 $this->initWizard(1);
476
477 $this->initFormTitle('create', 1);
478 $GLOBALS['tpl']->setContent($this->form->getHtml());
479 #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
480 #$tpl->setContent($w_tpl->get());
481 }
482
489 protected function edit()
490 {
491 global $tpl;
492
493 $_SESSION['objective_mode'] = self::MODE_UPDATE;
494
495 $this->setSubTabs("edit_obj");
496
497 $this->ctrl->setParameter($this, 'objective_id', (int) $_REQUEST['objective_id']);
498
499 if (!$_REQUEST['objective_id']) {
500 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
501 $this->ctrl->redirect($this, 'listObjectives');
502 }
503
504 if (!is_object($this->objective)) {
505 $this->objective = new ilCourseObjective($this->course_obj, (int) $_REQUEST['objective_id']);
506 }
507
508 $this->__initQuestionObject((int) $_REQUEST['objective_id']);
509 $this->initWizard(1);
510 $this->initFormTitle('create', 1);
511 $GLOBALS['tpl']->setContent($this->form->getHtml());
512 #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
513 #$tpl->setContent($w_tpl->get());
514 }
515
522 protected function save()
523 {
524 global $ilAccess,$ilErr;
525
526 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
527 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
528 }
529
530 $this->ctrl->saveParameter($this, 'objective_id');
531
532 $this->objective = new ilCourseObjective($this->course_obj, (int) $_REQUEST['objective_id']);
533 $this->initFormTitle('create', 1);
534 if ($this->form->checkInput()) {
535 $this->objective->setTitle($this->form->getInput('title'));
536 $this->objective->setDescription($this->form->getInput('description'));
537 $this->objective->setPasses(0);
538
539 if (!$_GET['objective_id']) {
540 $objective_id = $this->objective->add();
541 ilUtil::sendSuccess($this->lng->txt('crs_added_objective'), true);
542 } else {
543 $this->objective->update();
544 ilUtil::sendSuccess($this->lng->txt('crs_objective_modified'), true);
545 $objective_id = $_GET['objective_id'];
546 }
547 } else {
548 if ((int) $_GET['objective_id']) {
549 $this->form->setValuesByPost();
550 return $this->edit();
551 } else {
552 $this->form->setValuesByPost();
553 return $this->create();
554 }
555 }
556
557 if ($_SESSION['objective_mode'] != self::MODE_CREATE) {
558 $this->ctrl->returnToParent($this);
559 }
560
561 $this->ctrl->setParameter($this, 'objective_id', $objective_id);
562 $this->ctrl->redirect($this, 'materialAssignment');
563 return true;
564 }
565
572 protected function materialAssignment()
573 {
574 global $ilAccess,$ilErr,$tpl;
575
576 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
577 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
578 }
579 if (!$_GET['objective_id']) {
580 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
581 $this->ctrl->redirect($this, 'listObjectives');
582 }
583
584 $this->setSubTabs("materials");
585
586 $this->ctrl->saveParameter($this, 'objective_id');
587
588 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
589
590 include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterialAssignmentTableGUI.php');
591 $table = new ilCourseObjectiveMaterialAssignmentTableGUI($this, $this->course_obj, (int) $_GET['objective_id']);
592 $table->setTitle(
593 $this->lng->txt('crs_objective_wiz_materials'),
594 '',
595 $this->lng->txt('crs_objectives')
596 );
597
598 include_once('Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
599 $table->parse(ilCourseObjectiveMaterials::_getAssignableMaterials($this->course_obj->getRefId()));
600
601 $this->__initQuestionObject((int) $_GET['objective_id']);
602 $this->initWizard(2);
603 #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
604 $GLOBALS['tpl']->setContent($table->getHTML());
605 #$tpl->setContent($w_tpl->get());
606 }
607
615 protected function updateMaterialAssignment()
616 {
617 global $ilAccess,$ilErr,$ilObjDataCache;
618
619 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
620 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
621 }
622 if (!$_GET['objective_id']) {
623 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
624 $this->ctrl->redirect($this, 'listObjectives');
625 }
626
627 $this->__initLMObject((int) $_GET['objective_id']);
628 $this->objectives_lm_obj->deleteAll();
629
630 if (is_array($_POST['materials'])) {
631 foreach ($_POST['materials'] as $node_id) {
632 $obj_id = $ilObjDataCache->lookupObjId($node_id);
633 $type = $ilObjDataCache->lookupType($obj_id);
634
635 $this->objectives_lm_obj->setLMRefId($node_id);
636 $this->objectives_lm_obj->setLMObjId($obj_id);
637 $this->objectives_lm_obj->setType($type);
638 $this->objectives_lm_obj->add();
639 }
640 }
641 if (is_array($_POST['chapters'])) {
642 foreach ($_POST['chapters'] as $chapter) {
643 include_once('./Modules/LearningModule/classes/class.ilLMObject.php');
644
645 list($ref_id, $chapter_id) = explode('_', $chapter);
646
647 $this->objectives_lm_obj->setLMRefId($ref_id);
648 $this->objectives_lm_obj->setLMObjId($chapter_id);
649 $this->objectives_lm_obj->setType(ilLMObject::_lookupType($chapter_id));
650 $this->objectives_lm_obj->add();
651 }
652 }
653 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
654
655
656 if ($_SESSION['objective_mode'] != self::MODE_CREATE) {
657 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'), true);
658 $this->ctrl->returnToParent($this);
659 }
660
661 // begin-patch lok
662 if ($this->getSettings()->worksWithInitialTest()) {
664 } else {
665 $this->finalTestAssignment();
666 }
667 // end-patch lok
668 }
669
676 protected function selfAssessmentAssignment()
677 {
678 global $ilAccess,$ilErr,$tpl;
679
680 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
681 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
682 }
683 if (!$_GET['objective_id']) {
684 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
685 $this->ctrl->redirect($this, 'listObjectives');
686 }
687
688 $this->setSubTabs("self_ass_assign");
689
690 $this->ctrl->saveParameter($this, 'objective_id');
691
692 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
693
694 // begin-patch lok
695 $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_INITIAL);
696 $this->test_type = $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_INITIAL;
698 return $this->showRandomTestAssignment();
699 }
700 // end-patch lok
701
702 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php');
704 $this,
705 $this->course_obj,
706 (int) $_GET['objective_id'],
708 );
709 $table->setTitle(
710 $this->lng->txt('crs_objective_wiz_self'),
711 '',
712 $this->lng->txt('crs_objective')
713 );
714 $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
715
716 $this->__initQuestionObject((int) $_GET['objective_id']);
717 $this->initWizard(3);
718 $GLOBALS['tpl']->setContent($table->getHTML());
719 #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
720 #$tpl->setContent($w_tpl->get());
721 }
722
731 {
732 global $ilAccess,$ilErr,$ilObjDataCache;
733
734 $checked_questions = $_POST['questions'] ? $_POST['questions'] : array();
735
736
737 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
738 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
739 }
740 if (!$_GET['objective_id']) {
741 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
742 $this->ctrl->redirect($this, 'listObjectives');
743 }
744
745 $this->__initQuestionObject((int) $_GET['objective_id']);
746
747 // Delete unchecked
748 foreach ($this->objectives_qst_obj->getSelfAssessmentQuestions() as $question) {
749 $id = $question['ref_id'] . '_' . $question['question_id'];
750 if (!in_array($id, $checked_questions)) {
751 $this->objectives_qst_obj->delete($question['qst_ass_id']);
752 }
753 }
754 // Add checked
755 foreach ($checked_questions as $question_id) {
756 list($test_ref_id, $qst_id) = explode('_', $question_id);
757 $test_obj_id = $ilObjDataCache->lookupObjId($test_ref_id);
758
759 if ($this->objectives_qst_obj->isSelfAssessmentQuestion($qst_id)) {
760 continue;
761 }
762 $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT);
763 $this->objectives_qst_obj->setTestRefId($test_ref_id);
764 $this->objectives_qst_obj->setTestObjId($test_obj_id);
765 $this->objectives_qst_obj->setQuestionId($qst_id);
766 $this->objectives_qst_obj->add();
767 }
768
769 // TODO: not nice
770 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
771 $this->questions = new ilCourseObjectiveQuestion((int) $_GET['objective_id']);
772 // not required due to percentages
773 //$this->questions->updateLimits();
774
775 if ($checked_questions) {
776 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
777 $this->selfAssessmentLimits();
778 return true;
779 } else {
780 switch ($_SESSION['objective_mode']) {
782 $this->finalTestAssignment();
783 return true;
784
787 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
788 return true;
789 }
790 }
791 }
792
800 protected function selfAssessmentLimits()
801 {
802 global $ilAccess,$ilErr,$tpl;
803
804 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
805 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
806 }
807 if (!$_GET['objective_id']) {
808 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
809 $this->ctrl->redirect($this, 'listObjectives');
810 }
811
812 $this->setSubTabs("self_ass_limits");
813
814 $this->ctrl->saveParameter($this, 'objective_id');
815 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
816
817 $this->__initQuestionObject((int) $_GET['objective_id']);
818 $this->initWizard(4);
819
820 $this->initFormLimits('selfAssessment');
821 $GLOBALS['tpl']->setContent($this->form->getHtml());
822 #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
823 #$tpl->setContent($w_tpl->get());
824 }
825
833 protected function updateSelfAssessmentLimits()
834 {
835 global $ilAccess,$ilErr,$ilObjDataCache;
836
837 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
838 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
839 }
840 if (!$_GET['objective_id']) {
841 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
842 $this->ctrl->redirect($this, 'listObjectives');
843 }
844
845 $this->__initQuestionObject((int) $_GET['objective_id']);
846
847 if ((int) $_POST['limit'] < 1 or (int) $_POST['limit'] > 100) {
848 ilUtil::sendFailure($this->lng->txt('crs_objective_err_limit'));
849 $this->selfAssessmentLimits();
850 return false;
851 }
852
853 foreach ($this->objectives_qst_obj->getSelfAssessmentTests() as $test) {
854 $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT);
855 $this->objectives_qst_obj->setTestSuggestedLimit((int) $_POST['limit']);
856 $this->objectives_qst_obj->updateTest($test['test_objective_id']);
857 }
858
859 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
860 $this->ctrl->returnToParent($this);
861 }
862
863
871 protected function finalTestAssignment()
872 {
873 global $ilAccess,$ilErr,$tpl;
874
875 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
876 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
877 }
878 if (!$_GET['objective_id']) {
879 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
880 $this->ctrl->redirect($this, 'listObjectives');
881 }
882
883 $this->setSubTabs("final_test_assign");
884
885 $this->ctrl->saveParameter($this, 'objective_id');
886 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
887
888 // begin-patch lok
889 $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_QUALIFIED);
890 $this->test_type = $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_QUALIFIED;
892 return $this->showRandomTestAssignment();
893 }
894 // end-patch lok
895
896 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php');
898 $this,
899 $this->course_obj,
900 (int) $_GET['objective_id'],
902 );
903
904 $table->setTitle(
905 $this->lng->txt('crs_objective_wiz_final'),
906 '',
907 $this->lng->txt('crs_objective')
908 );
909 $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
910
911 $this->__initQuestionObject((int) $_GET['objective_id']);
912 $this->initWizard(5);
913 $GLOBALS['tpl']->setContent($table->getHTML());
914 #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
915 #$tpl->setContent($w_tpl->get());
916 }
917
918 // begin-patch lok
919 protected function isRandomTestType($a_tst_type = 0)
920 {
921 if (!$a_tst_type) {
922 $a_tst_type = $this->test_type;
923 }
924
925 $tst_ref_id = $this->getSettings()->getTestByType($a_tst_type);
926 if (!$tst_ref_id) {
927 return false;
928 }
929 include_once './Modules/Test/classes/class.ilObjTest.php';
931 }
932
938 {
939 $this->ctrl->saveParameter($this, 'objective_id');
940 $this->ctrl->setParameter($this, 'tt', (int) $_REQUEST['tt']);
941 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
942 $this->test_type = (int) $_REQUEST['tt'];
943
944
945 $this->setSubTabs("rand_test_assign");
946
947 if (!$form instanceof ilPropertyFormGUI) {
948 $form = $this->initFormRandom();
949 }
950
951 $this->__initQuestionObject((int) $_GET['objective_id']);
952 $this->initWizard(5);
953 $GLOBALS['tpl']->setContent($form->getHTML());
954 #$w_tpl->setVariable('WIZ_CONTENT',$form->getHTML());
955
956 #$GLOBALS['tpl']->setContent($w_tpl->get());
957 }
958
962 protected function initFormRandom()
963 {
964 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
965 $form = new ilPropertyFormGUI();
966 $form->setFormAction($this->ctrl->getFormAction($this));
967
968 if ($this->test_type == ilLOSettings::TYPE_TEST_INITIAL) {
969 $form->setTitle($this->lng->txt('crs_loc_form_random_limits_it'));
970 } else {
971 $form->setTitle($this->lng->txt('crs_loc_form_random_limits_qt'));
972 }
973
974 $form->addCommandButton('saveRandom', $this->lng->txt('save'));
975
976 $options = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_rand_assign_qpl'), 'type');
977 $options->setValue(1);
978 $options->setRequired(true);
979
980 $ass_qpl = new ilRadioOption($this->lng->txt('crs_loc_rand_assign_qpl'), 1);
981 $options->addOption($ass_qpl);
982
983 $qpl = new ilSelectInputGUI($this->lng->txt('crs_loc_rand_qpl'), 'qpl');
984 $qpl->setRequired(true);
985 $qpl->setMulti(true, false);
986 $qpl->setOptions($this->getRandomTestQplOptions());
987
989 $this->course_obj->getId(),
990 (int) $_REQUEST['objective_id'],
991 ilObject::_lookupObjId($this->getSettings()->getTestByType($this->test_type)),
992 $this->test_type
993 );
994
995 $qpl->setValue($sequences[0]);
996 $qpl->setMultiValues($sequences);
997 $ass_qpl->addSubItem($qpl);
998
999 // points
1000 $per = new ilNumberInputGUI($this->lng->txt('crs_loc_perc'), 'per');
1001 $per->setValue(
1003 $this->course_obj->getId(),
1004 (int) $_REQUEST['objective_id'],
1005 $this->test_type
1006 )
1007 );
1008 $per->setSize(3);
1009 $per->setMinValue(1);
1010 $per->setMaxValue(100);
1011 $per->setRequired(true);
1012 $ass_qpl->addSubItem($per);
1013
1014 $form->addItem($options);
1015 return $form;
1016 }
1017
1018
1019 protected function getRandomTestQplOptions()
1020 {
1021 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
1022 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
1023
1024 $tst_ref_id = $this->getSettings()->getTestByType($this->test_type);
1025 if ($tst_ref_id) {
1026 $tst = ilObjectFactory::getInstanceByRefId($tst_ref_id, false);
1027 }
1028 if (!$tst instanceof ilObjTest) {
1029 return array();
1030 }
1032 $GLOBALS['ilDB'],
1033 $tst,
1035 $GLOBALS['ilDB'],
1036 $tst
1037 )
1038 );
1039
1040 $list->loadDefinitions();
1041
1042 include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
1043 $translater = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['ilDB']);
1044 $translater->loadLabels($list);
1045
1046 $options[0] = $this->lng->txt('select_one');
1047 foreach ($list as $definition) {
1049 $title = $definition->getPoolTitle();
1050 // fau: taxFilter/typeFilter - get title for extended filter conditions
1051 $filterTitle = array();
1052 $filterTitle[] = $translater->getTaxonomyFilterLabel($definition->getMappedTaxonomyFilter());
1053 $filterTitle[] = $translater->getTypeFilterLabel($definition->getTypeFilter());
1054 if (!empty($filterTitle)) {
1055 $title .= ' -> ' . implode(' / ', $filterTitle);
1056 }
1057 #$tax_id = $definition->getMappedFilterTaxId();
1058 #if($tax_id)
1059 #{
1060 # $title .= (' -> '. $translater->getTaxonomyTreeLabel($tax_id));
1061 #}
1062 #$tax_node = $definition->getMappedFilterTaxNodeId();
1063 #if($tax_node)
1064 #{
1065 # $title .= (' -> ' .$translater->getTaxonomyNodeLabel($tax_node));
1066 #}
1067 // fau.
1068 $options[$definition->getId()] = $title;
1069 }
1070 return $options;
1071 }
1072
1076 protected function saveRandom()
1077 {
1078 $this->ctrl->saveParameter($this, 'objective_id');
1079 $this->ctrl->setParameter($this, 'tt', (int) $_REQUEST['tt']);
1080 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1081 $this->test_type = (int) $_REQUEST['tt'];
1082
1083 $form = $this->initFormRandom();
1084
1085
1086
1087
1088 if ($form->checkInput()) {
1090 $this->course_obj->getId(),
1091 (int) $_REQUEST['objective_id'],
1092 $this->test_type
1093 );
1094
1095 $qst = $this->__initQuestionObject((int) $_GET['objective_id']);
1096 $qst->deleteByTestType(
1097 ($this->test_type == ilLOSettings::TYPE_TEST_INITIAL) ?
1100 );
1101 $ref_id = $this->getSettings()->getTestByType($this->test_type);
1102 foreach (array_unique((array) $form->getInput('qpl')) as $qpl_id) {
1103 include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
1104 $rnd = new ilLORandomTestQuestionPools(
1105 $this->course_obj->getId(),
1106 (int) $_REQUEST['objective_id'],
1107 $this->test_type,
1108 $qpl_id
1109 );
1110 $rnd->setLimit($form->getInput('per'));
1111 $rnd->setTestId(ilObject::_lookupObjId($ref_id));
1112 $rnd->create();
1113 }
1114 } else {
1115 $form->setValuesByPost();
1116 ilUtil::sendFailure($this->lng->txt('err_check_input'));
1117 return $this->showRandomTestAssignment();
1118 }
1119
1120 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1121 if ($this->test_type == ilLOSettings::TYPE_TEST_QUALIFIED) {
1122 $this->ctrl->returnToParent($this);
1123 } else {
1124 $this->ctrl->redirect($this, 'finalTestAssignment');
1125 }
1126 }
1127
1135 protected function updateFinalTestAssignment()
1136 {
1137 global $ilAccess,$ilErr,$ilObjDataCache;
1138
1139 $checked_questions = $_POST['questions'] ? $_POST['questions'] : array();
1140
1141
1142 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1143 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1144 }
1145 if (!$_GET['objective_id']) {
1146 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1147 $this->ctrl->redirect($this, 'listObjectives');
1148 }
1149
1150 $this->__initQuestionObject((int) $_GET['objective_id']);
1151
1152 // Delete unchecked
1153 foreach ($this->objectives_qst_obj->getFinalTestQuestions() as $question) {
1154 $id = $question['ref_id'] . '_' . $question['question_id'];
1155 if (!in_array($id, $checked_questions)) {
1156 $this->objectives_qst_obj->delete($question['qst_ass_id']);
1157 }
1158 }
1159 // Add checked
1160 foreach ($checked_questions as $question_id) {
1161 list($test_ref_id, $qst_id) = explode('_', $question_id);
1162 $test_obj_id = $ilObjDataCache->lookupObjId($test_ref_id);
1163
1164 if ($this->objectives_qst_obj->isFinalTestQuestion($qst_id)) {
1165 continue;
1166 }
1167
1168 $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
1169 $this->objectives_qst_obj->setTestRefId($test_ref_id);
1170 $this->objectives_qst_obj->setTestObjId($test_obj_id);
1171 $this->objectives_qst_obj->setQuestionId($qst_id);
1172 $this->objectives_qst_obj->add();
1173 }
1174
1175 // TODO: not nice
1176 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
1177 $this->questions = new ilCourseObjectiveQuestion((int) $_GET['objective_id']);
1178 // not required due to percentages
1179 //$this->questions->updateLimits();
1180
1181 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
1182 $this->finalTestLimits();
1183 }
1184
1190 {
1191 global $ilAccess, $ilErr;
1192
1193 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1194 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1195 }
1196 if (!$_GET['objective_id']) {
1197 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1198 $this->ctrl->returnToParent($this);
1199 }
1200 $this->ctrl->saveParameter($this, 'objective_id');
1201 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1202
1203 $this->initWizard(6);
1204 $form = $this->initFormTestAssignment();
1205 $GLOBALS['tpl']->setContent($form->getHtml());
1206 }
1207
1215 protected function finalTestLimits()
1216 {
1217 global $ilAccess,$ilErr,$tpl;
1218
1219 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1220 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1221 }
1222 if (!$_GET['objective_id']) {
1223 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1224 $this->ctrl->returnToParent($this);
1225 }
1226
1227 $this->setSubTabs("final_test_limits");
1228
1229 $this->ctrl->saveParameter($this, 'objective_id');
1230 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1231
1232 $this->__initQuestionObject((int) $_GET['objective_id']);
1233 $this->initWizard(6);
1234
1235 $this->initFormLimits('final');
1236 $GLOBALS['tpl']->setContent($this->form->getHtml());
1237
1238 #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
1239 #$tpl->setContent($w_tpl->get());
1240 }
1241
1249 protected function updateFinalTestLimits()
1250 {
1251 global $ilAccess,$ilErr,$ilObjDataCache;
1252
1253 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1254 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1255 }
1256 if (!$_GET['objective_id']) {
1257 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1258 $this->ctrl->redirect($this, 'listObjectives');
1259 }
1260
1261 $this->__initQuestionObject((int) $_GET['objective_id']);
1262
1263 if ((int) $_POST['limit'] < 1 or (int) $_POST['limit'] > 100) {
1264 ilUtil::sendFailure($this->lng->txt('crs_objective_err_limit'));
1265 $this->finalTestLimits();
1266 return false;
1267 }
1268
1269 foreach ($this->objectives_qst_obj->getFinalTests() as $test) {
1270 $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
1271 $this->objectives_qst_obj->setTestSuggestedLimit((int) $_POST['limit']);
1272 $this->objectives_qst_obj->updateTest($test['test_objective_id']);
1273 }
1274
1275 if ($_SESSION['objective_mode'] != self::MODE_CREATE) {
1276 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1277 } else {
1278 ilUtil::sendSuccess($this->lng->txt('crs_added_objective'), true);
1279 }
1280 $this->ctrl->returnToParent($this);
1281 }
1282
1290 protected function initFormLimits($a_mode)
1291 {
1292 if (!is_object($this->form)) {
1293 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1294 $this->form = new ilPropertyFormGUI();
1295 }
1296 $this->form->setFormAction($this->ctrl->getFormAction($this));
1297 $this->form->setTableWidth('100%');
1298 //$this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.svg'),$this->lng->txt('crs_objective'));
1299
1300 switch ($a_mode) {
1301 case 'selfAssessment':
1302 $this->form->setTitle($this->lng->txt('crs_objective_wiz_self_limit'));
1303 $this->form->addCommandButton('updateSelfAssessmentLimits', $this->lng->txt('crs_wiz_next'));
1304 $this->form->addCommandButton('selfAssessmentAssignment', $this->lng->txt('crs_wiz_back'));
1305
1306 $tests = $this->objectives_qst_obj->getSelfAssessmentTests();
1307 $max_points = $this->objectives_qst_obj->getSelfAssessmentPoints();
1308
1309 break;
1310
1311 case 'final':
1312 $this->form->setTitle($this->lng->txt('crs_objective_wiz_final_limit'));
1313 $this->form->addCommandButton('updateFinalTestLimits', $this->lng->txt('crs_wiz_next'));
1314 $this->form->addCommandButton('finalTestAssignment', $this->lng->txt('crs_wiz_back'));
1315
1316 $tests = $this->objectives_qst_obj->getFinalTests();
1317 $max_points = $this->objectives_qst_obj->getFinalTestPoints();
1318
1319 break;
1320 }
1321
1322 $over = new ilCustomInputGUI($this->lng->txt('crs_objective_qst_summary'), '');
1323
1324 $tpl = new ilTemplate('tpl.crs_objective_qst_summary.html', true, true, 'Modules/Course');
1325
1326
1327 $limit = 0;
1328
1329 foreach ($tests as $test) {
1330 $GLOBALS['ilLog']->write(__METHOD__ . ': ' . print_r($test, true));
1331
1332 $limit = $test['limit'];
1333
1334 foreach ($this->objectives_qst_obj->getQuestionsOfTest($test['obj_id']) as $question) {
1335 $tpl->setCurrentBlock('qst');
1336 $tpl->setVariable('QST_TITLE', $question['title']);
1337 if (strlen($question['description'])) {
1338 $tpl->setVariable('QST_DESCRIPTION', $question['description']);
1339 }
1340 $tpl->setVariable('QST_POINTS', $question['points'] . ' ' .
1341 $this->lng->txt('crs_objective_points'));
1342 $tpl->parseCurrentBlock();
1343 }
1344 $tpl->setCurrentBlock('tst');
1345 $tpl->setVariable('TST_TITLE', ilObject::_lookupTitle($test['obj_id']));
1346 if ($desc = ilObject::_lookupDescription($test['obj_id'])) {
1347 $tpl->setVariable('TST_DESC', $desc);
1348 }
1349 $tpl->setVariable('TST_TYPE_IMG', ilUtil::getTypeIconPath('tst', $test['obj_id'], 'tiny'));
1350 $tpl->setVariable('TST_ALT_IMG', $this->lng->txt('obj_tst'));
1351 $tpl->parseCurrentBlock();
1352 }
1353
1354 $tpl->setVariable('TXT_ALL_POINTS', $this->lng->txt('crs_objective_all_points'));
1355 $tpl->setVariable('TXT_POINTS', $this->lng->txt('crs_objective_points'));
1356 $tpl->setVariable('POINTS', $max_points);
1357
1358 $over->setHtml($tpl->get());
1359 $this->form->addItem($over);
1360
1361 // points
1362 $req = new ilNumberInputGUI($this->lng->txt('crs_loc_perc'), 'limit');
1363 $req->setValue($limit);
1364 $req->setSize(3);
1365 $req->setMinValue(1);
1366 $req->setMaxValue(100);
1367 $req->setRequired(true);
1368 switch ($a_mode) {
1369 case 'selfAssessment':
1370 $req->setInfo($this->lng->txt('crs_obj_initial_req_info'));
1371 break;
1372
1373 case 'final':
1374 $req->setInfo($this->lng->txt('crs_obj_final_req_info'));
1375 break;
1376 }
1377 $this->form->addItem($req);
1378 }
1379
1380
1387 protected function initFormTitle($a_mode, $a_step_number)
1388 {
1389 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1390 if ($this->form instanceof ilPropertyFormGUI) {
1391 return;
1392 }
1393
1394 $this->form = new ilPropertyFormGUI();
1395 $this->form->setFormAction($this->ctrl->getFormAction($this));
1396 //$this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.svg'),$this->lng->txt('crs_objective'));
1397
1398 switch ($a_mode) {
1399 case 'create':
1400 $this->form->setTitle($this->lng->txt('crs_objective_wiz_title'));
1401 $this->form->addCommandButton('save', $this->lng->txt('crs_wiz_next'));
1402 // begin-patch lok
1403 #$this->form->addCommandButton('listObjectives',$this->lng->txt('cancel'));
1404 // end-patch lok
1405 break;
1406
1407 case 'update':
1408 break;
1409 }
1410
1411 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
1412 $title->setValue($this->objective->getTitle());
1413 $title->setRequired(true);
1414 $title->setSize(40);
1415 $title->setMaxLength(70);
1416 $this->form->addItem($title);
1417
1418 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
1419 $desc->setValue($this->objective->getDescription());
1420 $desc->setCols(40);
1421 $desc->setRows(5);
1422 $this->form->addItem($desc);
1423 }
1424
1425
1433 protected function initWizard($a_step_number)
1434 {
1435 $options = array(
1436 1 => $this->lng->txt('crs_objective_wiz_title'),
1437 2 => $this->lng->txt('crs_objective_wiz_materials'),
1438 3 => $this->lng->txt('crs_objective_wiz_self'),
1439 4 => $this->lng->txt('crs_objective_wiz_self_limit'),
1440 5 => $this->lng->txt('crs_objective_wiz_final'),
1441 6 => $this->lng->txt('crs_objective_wiz_final_limit'));
1442
1443 $info = array(
1444 1 => $this->lng->txt('crs_objective_wiz_title_info'),
1445 2 => $this->lng->txt('crs_objective_wiz_materials_info'),
1446 3 => $this->lng->txt('crs_objective_wiz_self_info'),
1447 4 => $this->lng->txt('crs_objective_wiz_self_limit_info'),
1448 5 => $this->lng->txt('crs_objective_wiz_final_info'),
1449 6 => $this->lng->txt('crs_objective_wiz_final_limit_info'));
1450
1451 $links = array(
1452 1 => $this->ctrl->getLinkTarget($this, 'edit'),
1453 2 => $this->ctrl->getLinkTarget($this, 'materialAssignment'),
1454 3 => $this->ctrl->getLinkTarget($this, 'selfAssessmentAssignment'),
1455 4 => $this->ctrl->getLinkTarget($this, 'selfAssessmentLimits'),
1456 5 => $this->ctrl->getLinkTarget($this, 'finalTestAssignment'),
1457 6 => $this->ctrl->getLinkTarget($this, 'finalTestLimits'));
1458
1459
1460
1461
1462 // checklist gui start
1463 include_once("./Services/UIComponent/Checklist/classes/class.ilChecklistGUI.php");
1464 $check_list = new ilChecklistGUI();
1465 // checklist gui end
1466
1467 if ($_SESSION['objective_mode'] == self::MODE_CREATE) {
1468 // checklist gui start
1469 $check_list->setHeading($this->lng->txt('crs_checklist_objective'));
1470 // checklist gui end
1471 } else {
1472 // checklist gui start
1473 $check_list->setHeading($this->lng->txt('crs_checklist_objective'));
1474 // checklist gui end
1475 }
1476
1477 // end-patch lok
1478 $num = 0;
1479 foreach ($options as $step => $title) {
1480 // checklist gui start
1481 $item_link = "";
1482 // checklist gui end
1483
1484 // begin-patch lok
1485 if ($step == 3 and (!$this->getSettings()->worksWithInitialTest() or $this->getSettings()->hasSeparateInitialTests())) {
1486 continue;
1487 }
1488 if ($step == 4 and (!$this->getSettings()->worksWithInitialTest() or $this->getSettings()->hasSeparateInitialTests())) {
1489 continue;
1490 }
1491 if ($step == 5 and $this->getSettings()->hasSeparateQualifiedTests()) {
1492 continue;
1493 }
1494 if ($step == 6 and $this->getSettings()->hasSeparateQualifiedTests()) {
1495 continue;
1496 }
1497 if ($step == 4 and $this->isRandomTestType(ilLOSettings::TYPE_TEST_INITIAL)) {
1498 continue;
1499 }
1500 if ($step == 6 and $this->isRandomTestType(ilLOSettings::TYPE_TEST_QUALIFIED)) {
1501 continue;
1502 }
1503 $num++;
1504 // end-patch lok
1505
1506 if ($_SESSION['objective_mode'] == self::MODE_UPDATE) {
1507 $hide_link = false;
1508 if ($step == 4 and !count($this->objectives_qst_obj->getSelfAssessmentQuestions())) {
1509 $hide_link = true;
1510 }
1511 if ($step == 6 and !count($this->objectives_qst_obj->getFinalTestQuestions())) {
1512 $hide_link = true;
1513 }
1514 // begin-patch lok
1515 if ($step == 3 and !$this->getSettings()->worksWithInitialTest()) {
1516 $hide_link = true;
1517 }
1518 if ($step == 4 and !$this->getSettings()->worksWithInitialTest()) {
1519 $hide_link = true;
1520 }
1521 if (!$hide_link) {
1522 // checklist gui start
1523 $item_link = $links[$step];
1524 // checklist gui end
1525 }
1526 }
1527
1528 // checklist gui start
1529 $check_list->addEntry($title, $item_link, ilChecklistGUI::STATUS_NO_STATUS, ($step == $a_step_number));
1530 // checklist gui end
1531 }
1532
1533 // checklist gui start
1534 $GLOBALS["tpl"]->setRightContent($check_list->getHTML());
1535 // checklist gui end
1536 }
1537}
$test
Definition: Utf8Test.php:84
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
TableGUI for material assignments of course objectives.
class ilCourseObjectiveMaterials
static _getAssignableMaterials($a_container_id)
Get an array of course material ids that can be assigned to learning objectives No tst,...
TableGUI for question assignments of course objectives.
class ilcourseobjectiveQuestion
static _updateTestLimits($a_objective_id, $a_status, $a_limit)
update test limits
static _hasTests($a_course_id)
@access public
static _getAssignableTests($a_container_ref_id)
Get assignable tests.
class ilcourseobjective
static _getObjectiveIds($course_id, $a_activated_only=false)
class ilobjcourseobjectivesgui
updateMaterialAssignment()
update material assignment
saveRandom()
Save random test settings.
finalTestAssignment()
final test assignment
initFormTitle($a_mode, $a_step_number)
init form title
setSubTabs($a_active="")
set sub tabs
updateSelfAssessmentLimits()
update self assessment limits
selfAssessmentLimits()
self assessment limits
updateFinalTestLimits()
update self assessment limits
finalSeparatedTestAssignment(ilPropertyFormGUI $form=null)
Show test assignment form.
initWizard($a_step_number)
init wizard
__construct($a_course_id)
Constructor.
updateFinalTestAssignment()
update self assessment assignment
saveQuestionOverview()
update question overview
selfAssessmentAssignment()
self assessment assignemnt
showRandomTestAssignment(ilPropertyFormGUI $form=null)
updateSelfAssessmentAssignment()
update self assessment assignment
initFormLimits($a_mode)
init limit form
finalTestLimits()
self assessment limits
materialAssignment()
material assignment
This class represents a custom property in a property form.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static lookupSequencesByType($a_container_id, $a_objective_id, $a_test_id, $a_test_type)
Lookup sequence ids @global type $ilDB.
deleteForObjectiveAndTestType($a_course_id, $a_objective_id, $a_tst_type)
Delete assignment for objective id and test type.
static lookupLimit($a_container_id, $a_objective_id, $a_test_type)
lookup limit @global type $ilDB
static getInstanceByObjId($a_obj_id)
get singleton instance
This class represents a number property in a property form.
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
Class ilTableGUI.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$counter
$tbl
Definition: example_048.php:81
if(!array_key_exists('StateId', $_REQUEST)) $id
$links
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$req
Definition: getUserInfo.php:20
global $ilCtrl
Definition: ilias.php:18
$error
Definition: Error.php:17
$info
Definition: index.php:5
redirection script todo: (a better solution should control the processing via a xml file)
$type
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
settings()
Definition: settings.php:2