ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC;
71
72 $ilCtrl = $DIC['ilCtrl'];
73 $lng = $DIC['lng'];
74 $ilErr = $DIC['ilErr'];
75 $ilias = $DIC['ilias'];
76 $tpl = $DIC['tpl'];
77 $tree = $DIC['tree'];
78 $ilTabs = $DIC['ilTabs'];
79
80 $this->ctrl = $ilCtrl;
81 $this->ctrl->saveParameter($this, array("ref_id"));
82
83 $this->logger = $GLOBALS['DIC']->logger()->crs();
84 $this->ilErr = $ilErr;
85 $this->lng = $lng;
86 $this->lng->loadLanguageModule('crs');
87 $this->tpl = $tpl;
88 $this->tree = $tree;
89 $this->tabs_gui = $ilTabs;
90
91 $this->course_id = $a_course_id;
92 $this->__initCourseObject();
93
94 // begin-patch lok
95 $this->settings = ilLOSettings::getInstanceByObjId($this->course_obj->getId());
96 // end-patch lok
97 }
98
102 public function executeCommand()
103 {
104 global $DIC;
105
106 $ilTabs = $DIC['ilTabs'];
107
108 $ilTabs->setTabActive('crs_objectives');
109
110 $cmd = $this->ctrl->getCmd();
111
112
113 if (!$cmd = $this->ctrl->getCmd()) {
114 $cmd = "list";
115 }
116
117 $this->$cmd();
118 }
119
120 // begin-patch lok
125 public function getSettings()
126 {
127 return $this->settings;
128 }
129 // end-patch lok
130
131
139 protected function listObjectives()
140 {
141 global $DIC;
142
143 $ilAccess = $DIC['ilAccess'];
144 $ilErr = $DIC['ilErr'];
145 $ilObjDataCache = $DIC['ilObjDataCache'];
146 $ilToolbar = $DIC['ilToolbar'];
147
148 $_SESSION['objective_mode'] = self::MODE_UNDEFINED;
149 if (!$ilAccess->checkAccess("write", '', $this->course_obj->getRefId())) {
150 $this->ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
151 }
152
153 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.crs_objectives.html', 'Modules/Course');
154
155 $ilToolbar->addButton(
156 $this->lng->txt('crs_add_objective'),
157 $this->ctrl->getLinkTarget($this, "'create")
158 );
159
160 include_once('./Modules/Course/classes/class.ilCourseObjectivesTableGUI.php');
161 $table = new ilCourseObjectivesTableGUI($this, $this->course_obj);
162 $table->setTitle($this->lng->txt('crs_objectives'), '', $this->lng->txt('crs_objectives'));
163 $table->parse(ilCourseObjective::_getObjectiveIds($this->course_obj->getId(), false));
164
165 $this->tpl->setVariable('OBJECTIVES_TABLE', $table->getHTML());
166 }
167
174 protected function saveSorting()
175 {
176 global $DIC;
177
178 $ilAccess = $DIC['ilAccess'];
179 $ilErr = $DIC['ilErr'];
180 $ilObjDataCache = $DIC['ilObjDataCache'];
181
182 if (!$ilAccess->checkAccess("write", '', $this->course_obj->getRefId())) {
183 $this->ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
184 }
185
186 asort($_POST['position'], SORT_NUMERIC);
187
188 $counter = 1;
189 foreach ($_POST['position'] as $objective_id => $position) {
190 $objective = new ilCourseObjective($this->course_obj, $objective_id);
191 $objective->writePosition($counter++);
192 }
193 ilUtil::sendSuccess($this->lng->txt('crs_objective_saved_sorting'));
194 $this->listObjectives();
195 }
196
197 public function askDeleteObjective()
198 {
199 global $DIC;
200
201 $rbacsystem = $DIC['rbacsystem'];
202
203 // MINIMUM ACCESS LEVEL = 'write'
204 if (!$rbacsystem->checkAccess("write", $this->course_obj->getRefId())) {
205 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
206 }
207 if (!count($_POST['objective'])) {
208 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'));
209 $this->listObjectives();
210
211 return true;
212 }
213
214 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_objectives.html", 'Modules/Course');
215
216 ilUtil::sendQuestion($this->lng->txt('crs_delete_objectve_sure'));
217
218 $tpl = new ilTemplate("tpl.table.html", true, true);
219 $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.crs_objectives_delete_row.html", 'Modules/Course');
220
221 $counter = 0;
222 foreach ($_POST['objective'] as $objective_id) {
223 $objective_obj = $this->__initObjectivesObject($objective_id);
224
225 $tpl->setCurrentBlock("tbl_content");
226 $tpl->setVariable("ROWCOL", ilUtil::switchColor(++$counter, "tblrow2", "tblrow1"));
227 $tpl->setVariable("TITLE", $objective_obj->getTitle());
228 $tpl->setVariable("DESCRIPTION", $objective_obj->getDescription());
229 $tpl->parseCurrentBlock();
230 }
231
232 $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
233
234 // Show action row
235 $tpl->setCurrentBlock("tbl_action_btn");
236 $tpl->setVariable("BTN_NAME", 'deleteObjectives');
237 $tpl->setVariable("BTN_VALUE", $this->lng->txt('delete'));
238 $tpl->parseCurrentBlock();
239
240 $tpl->setCurrentBlock("tbl_action_btn");
241 $tpl->setVariable("BTN_NAME", 'listObjectives');
242 $tpl->setVariable("BTN_VALUE", $this->lng->txt('cancel'));
243 $tpl->parseCurrentBlock();
244
245 $tpl->setCurrentBlock("tbl_action_row");
246 $tpl->setVariable("COLUMN_COUNTS", 1);
247 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.svg'));
248 $tpl->parseCurrentBlock();
249
250
251 // create table
252 $tbl = new ilTableGUI();
253 $tbl->setStyle('table', 'std');
254
255 // title & header columns
256 $tbl->setTitle($this->lng->txt("crs_objectives"), "", $this->lng->txt("crs_objectives"));
257
258 $tbl->setHeaderNames(array($this->lng->txt("title")));
259 $tbl->setHeaderVars(
260 array("title"),
261 array("ref_id" => $this->course_obj->getRefId(),
262 "cmdClass" => "ilcourseobjectivesgui",
263 "cmdNode" => $_GET["cmdNode"])
264 );
265 $tbl->setColumnWidth(array("50%"));
266
267 $tbl->setLimit($_GET["limit"]);
268 $tbl->setOffset($_GET["offset"]);
269 $tbl->setMaxCount(count($_POST['objective']));
270
271 // footer
272 $tbl->disable("footer");
273 $tbl->disable('sort');
274
275 // render table
276 $tbl->setTemplate($tpl);
277 $tbl->render();
278
279 $this->tpl->setVariable("OBJECTIVES_TABLE", $tpl->get());
280
281
282 // Save marked objectives
283 $_SESSION['crs_delete_objectives'] = $_POST['objective'];
284
285 return true;
286 }
287
288 public function deleteObjectives()
289 {
290 global $DIC;
291
292 $rbacsystem = $DIC['rbacsystem'];
293
294 // MINIMUM ACCESS LEVEL = 'write'
295 if (!$rbacsystem->checkAccess("write", $this->course_obj->getRefId())) {
296 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
297 }
298 if (!count($_SESSION['crs_delete_objectives'])) {
299 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'));
300 $this->listObjectives();
301
302 return true;
303 }
304
305 foreach ($_SESSION['crs_delete_objectives'] as $objective_id) {
306 $objective_obj = &$this->__initObjectivesObject($objective_id);
307 $objective_obj->delete();
308 }
309
310 ilUtil::sendSuccess($this->lng->txt('crs_objectives_deleted'));
311 $this->listObjectives();
312
313 return true;
314 }
315
322 protected function questionOverview()
323 {
324 global $DIC;
325
326 $ilAccess = $DIC['ilAccess'];
327 $ilErr = $DIC['ilErr'];
328 $ilTabs = $DIC['ilTabs'];
329
330 $ilTabs->setSubTabActive('crs_objective_overview_question_assignment');
331
332 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
333 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
334 }
335
336 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionsTableGUI.php');
337 $table = new ilCourseObjectiveQuestionsTableGUI($this, $this->course_obj);
338 $table->setTitle($this->lng->txt('crs_objectives_edit_question_assignments'), '', $this->lng->txt('crs_objectives'));
339 // begin-patch lok
340 $table->parse(ilCourseObjective::_getObjectiveIds($this->course_obj->getId(), false));
341 // end-patch lok
342
343 $this->tpl->setContent($table->getHTML());
344 }
345
352 protected function saveQuestionOverview()
353 {
354 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
355
356 global $DIC;
357
358 $ilAccess = $DIC['ilAccess'];
359 $ilErr = $DIC['ilErr'];
360
361 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
362 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
363 }
364 $error = false;
365
366 $_POST['self'] = $_POST['self'] ? $_POST['self'] : array();
367 $_POST['final'] = $_POST['final'] ? $_POST['final'] : array();
368
369 foreach ($_POST['self'] as $objective_id => $limit) {
370 $qst = new ilCourseObjectiveQuestion($objective_id);
371 $max_points = $qst->getSelfAssessmentPoints();
372
373 if ($limit < 0 or $limit > $max_points) {
374 ilUtil::sendFailure($this->lng->txt('crs_objective_limit_err'));
375 $this->questionOverview();
376 return false;
377 }
378 }
379 foreach ($_POST['final'] as $objective_id => $limit) {
380 $qst = new ilCourseObjectiveQuestion($objective_id);
381 $max_points = $qst->getFinalTestPoints();
382
383 if ($limit < 0 or $limit > $max_points) {
384 ilUtil::sendFailure($this->lng->txt('crs_objective_limit_err'));
385 $this->questionOverview();
386 return false;
387 }
388 }
389
390 foreach ($_POST['self'] as $objective_id => $limit) {
392 }
393
394 foreach ($_POST['final'] as $objective_id => $limit) {
396 }
397
398 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
399 $this->questionOverview();
400 return true;
401 }
402
403 // PRIVATE
404 public function __initCourseObject()
405 {
406 if (!$this->course_obj = &ilObjectFactory::getInstanceByRefId($this->course_id, false)) {
407 $this->ilErr->raiseError("ilCourseObjectivesGUI: cannot create course object", $this->ilErr->MESSAGE);
408 exit;
409 }
410 return true;
411 }
412
413 public function __initObjectivesObject($a_id = 0)
414 {
415 return $this->objectives_obj = new ilCourseObjective($this->course_obj, $a_id);
416 }
417
418 public function __initLMObject($a_objective_id = 0)
419 {
420 include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
421 $this->objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
422
423 return true;
424 }
425
426 // begin-patch lok
432 public function __initQuestionObject($a_objective_id = 0)
433 {
434 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
435 $this->objectives_qst_obj = new ilCourseObjectiveQuestion($a_objective_id);
436
437 return $this->objectives_qst_obj;
438 }
439 // end-patch lok
440
444 public function setSubTabs($a_active = "")
445 {
446 global $DIC;
447
448 $ilTabs = $DIC['ilTabs'];
449 $ilHelp = $DIC['ilHelp'];
450
451 if ($a_active != "") {
452 $ilHelp->setScreenIdComponent("crs");
453 $ilHelp->setScreenId("crs_objective");
454 $ilHelp->setSubScreenId($a_active);
455 }
456
457
458 // begin-patch lok
459 // no subtabs here
460 return true;
461 // end-patch lok
462
463
464 $ilTabs->addSubTabTarget(
465 "crs_objective_overview_objectives",
466 $this->ctrl->getLinkTarget($this, "listObjectives"),
467 array("listObjectives", "moveObjectiveUp", "moveObjectiveDown", "listAssignedLM"),
468 array(),
469 '',
470 true
471 );
472 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
473
474 if (ilCourseObjectiveQuestion::_hasTests($this->course_obj->getId())) {
475 $ilTabs->addSubTabTarget(
476 "crs_objective_overview_question_assignment",
477 $this->ctrl->getLinkTarget($this, "questionOverview"),
478 "editQuestionAssignment",
479 array(),
480 '',
481 false
482 );
483 }
484 }
485
486
494 public function create()
495 {
496 global $DIC;
497
498 $tpl = $DIC['tpl'];
499
500 $this->setSubTabs("create_obj");
501
502 $_SESSION['objective_mode'] = self::MODE_CREATE;
503
504 $this->ctrl->saveParameter($this, 'objective_id');
505
506 if (!is_object($this->objective)) {
507 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
508 }
509 $this->__initQuestionObject((int) $_GET['objective_id']);
510 $this->initWizard(1);
511
512 $this->initFormTitle('create', 1);
513 $GLOBALS['DIC']['tpl']->setContent($this->form->getHtml());
514 #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
515 #$tpl->setContent($w_tpl->get());
516 }
517
524 protected function edit()
525 {
526 global $DIC;
527
528 $tpl = $DIC['tpl'];
529
530 $_SESSION['objective_mode'] = self::MODE_UPDATE;
531
532 $this->setSubTabs("edit_obj");
533
534 $this->ctrl->setParameter($this, 'objective_id', (int) $_REQUEST['objective_id']);
535
536 if (!$_REQUEST['objective_id']) {
537 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
538 $this->ctrl->redirect($this, 'listObjectives');
539 }
540
541 if (!is_object($this->objective)) {
542 $this->objective = new ilCourseObjective($this->course_obj, (int) $_REQUEST['objective_id']);
543 }
544
545 $this->__initQuestionObject((int) $_REQUEST['objective_id']);
546 $this->initWizard(1);
547 $this->initFormTitle('create', 1);
548 $GLOBALS['DIC']['tpl']->setContent($this->form->getHtml());
549 #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
550 #$tpl->setContent($w_tpl->get());
551 }
552
559 protected function save()
560 {
561 global $DIC;
562
563 $ilAccess = $DIC['ilAccess'];
564 $ilErr = $DIC['ilErr'];
565
566 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
567 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
568 }
569
570 $this->ctrl->saveParameter($this, 'objective_id');
571
572 $this->objective = new ilCourseObjective($this->course_obj, (int) $_REQUEST['objective_id']);
573 $this->initFormTitle('create', 1);
574 if ($this->form->checkInput()) {
575 $this->objective->setTitle($this->form->getInput('title'));
576 $this->objective->setDescription($this->form->getInput('description'));
577 $this->objective->setPasses(0);
578
579 if (!$_GET['objective_id']) {
580 $objective_id = $this->objective->add();
581 ilUtil::sendSuccess($this->lng->txt('crs_added_objective'), true);
582 } else {
583 $this->objective->update();
584 ilUtil::sendSuccess($this->lng->txt('crs_objective_modified'), true);
585 $objective_id = $_GET['objective_id'];
586 }
587 } else {
588 if ((int) $_GET['objective_id']) {
589 $this->form->setValuesByPost();
590 return $this->edit();
591 } else {
592 $this->form->setValuesByPost();
593 return $this->create();
594 }
595 }
596
597 if ($_SESSION['objective_mode'] != self::MODE_CREATE) {
598 $this->ctrl->returnToParent($this);
599 }
600
601 $this->ctrl->setParameter($this, 'objective_id', $objective_id);
602 $this->ctrl->redirect($this, 'materialAssignment');
603 return true;
604 }
605
612 protected function materialAssignment()
613 {
614 global $DIC;
615
616 $ilAccess = $DIC['ilAccess'];
617 $ilErr = $DIC['ilErr'];
618 $tpl = $DIC['tpl'];
619
620 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
621 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
622 }
623 if (!$_GET['objective_id']) {
624 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
625 $this->ctrl->redirect($this, 'listObjectives');
626 }
627
628 $this->setSubTabs("materials");
629
630 $this->ctrl->saveParameter($this, 'objective_id');
631
632 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
633
634 include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterialAssignmentTableGUI.php');
635 $table = new ilCourseObjectiveMaterialAssignmentTableGUI($this, $this->course_obj, (int) $_GET['objective_id']);
636 $table->setTitle(
637 $this->lng->txt('crs_objective_wiz_materials'),
638 '',
639 $this->lng->txt('crs_objectives')
640 );
641
642 include_once('Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
643 $table->parse(ilCourseObjectiveMaterials::_getAssignableMaterials($this->course_obj->getRefId()));
644
645 $this->__initQuestionObject((int) $_GET['objective_id']);
646 $this->initWizard(2);
647 #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
648 $GLOBALS['DIC']['tpl']->setContent($table->getHTML());
649 #$tpl->setContent($w_tpl->get());
650 }
651
659 protected function updateMaterialAssignment()
660 {
661 global $DIC;
662
663 $ilAccess = $DIC['ilAccess'];
664 $ilErr = $DIC['ilErr'];
665 $ilObjDataCache = $DIC['ilObjDataCache'];
666
667 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
668 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
669 }
670 if (!$_GET['objective_id']) {
671 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
672 $this->ctrl->redirect($this, 'listObjectives');
673 }
674
675 $this->__initLMObject((int) $_GET['objective_id']);
676 $this->objectives_lm_obj->deleteAll();
677
678 if (is_array($_POST['materials'])) {
679 foreach ($_POST['materials'] as $node_id) {
680 $obj_id = $ilObjDataCache->lookupObjId($node_id);
681 $type = $ilObjDataCache->lookupType($obj_id);
682
683 $this->objectives_lm_obj->setLMRefId($node_id);
684 $this->objectives_lm_obj->setLMObjId($obj_id);
685 $this->objectives_lm_obj->setType($type);
686 $this->objectives_lm_obj->add();
687 }
688 }
689 if (is_array($_POST['chapters'])) {
690 foreach ($_POST['chapters'] as $chapter) {
691 include_once('./Modules/LearningModule/classes/class.ilLMObject.php');
692
693 list($ref_id, $chapter_id) = explode('_', $chapter);
694
695 $this->objectives_lm_obj->setLMRefId($ref_id);
696 $this->objectives_lm_obj->setLMObjId($chapter_id);
697 $this->objectives_lm_obj->setType(ilLMObject::_lookupType($chapter_id));
698 $this->objectives_lm_obj->add();
699 }
700 }
701 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
702
703
704 if ($_SESSION['objective_mode'] != self::MODE_CREATE) {
705 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'), true);
706 $this->ctrl->returnToParent($this);
707 }
708
709 // begin-patch lok
710 if ($this->getSettings()->worksWithInitialTest()) {
712 } else {
713 $this->finalTestAssignment();
714 }
715 // end-patch lok
716 }
717
724 protected function selfAssessmentAssignment()
725 {
726 global $DIC;
727
728 $ilAccess = $DIC['ilAccess'];
729 $ilErr = $DIC['ilErr'];
730 $tpl = $DIC['tpl'];
731
732 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
733 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
734 }
735 if (!$_GET['objective_id']) {
736 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
737 $this->ctrl->redirect($this, 'listObjectives');
738 }
739
740 $this->setSubTabs("self_ass_assign");
741
742 $this->ctrl->saveParameter($this, 'objective_id');
743
744 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
745
746 // begin-patch lok
747 $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_INITIAL);
748 $this->test_type = $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_INITIAL;
750 return $this->showRandomTestAssignment();
751 }
752 // end-patch lok
753
754 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php');
756 $this,
757 $this->course_obj,
758 (int) $_GET['objective_id'],
760 );
761 $table->setTitle(
762 $this->lng->txt('crs_objective_wiz_self'),
763 '',
764 $this->lng->txt('crs_objective')
765 );
766 $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
767
768 $this->__initQuestionObject((int) $_GET['objective_id']);
769 $this->initWizard(3);
770 $GLOBALS['DIC']['tpl']->setContent($table->getHTML());
771 #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
772 #$tpl->setContent($w_tpl->get());
773 }
774
783 {
784 global $DIC;
785
786 $ilAccess = $DIC['ilAccess'];
787 $ilErr = $DIC['ilErr'];
788 $ilObjDataCache = $DIC['ilObjDataCache'];
789
790 $checked_questions = $_POST['questions'] ? $_POST['questions'] : array();
791
792
793 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
794 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
795 }
796 if (!$_GET['objective_id']) {
797 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
798 $this->ctrl->redirect($this, 'listObjectives');
799 }
800
801 $this->__initQuestionObject((int) $_GET['objective_id']);
802
803 // Delete unchecked
804 foreach ($this->objectives_qst_obj->getSelfAssessmentQuestions() as $question) {
805 $id = $question['ref_id'] . '_' . $question['question_id'];
806 if (!in_array($id, $checked_questions)) {
807 $this->objectives_qst_obj->delete($question['qst_ass_id']);
808 }
809 }
810 // Add checked
811 foreach ($checked_questions as $question_id) {
812 list($test_ref_id, $qst_id) = explode('_', $question_id);
813 $test_obj_id = $ilObjDataCache->lookupObjId($test_ref_id);
814
815 if ($this->objectives_qst_obj->isSelfAssessmentQuestion($qst_id)) {
816 continue;
817 }
818 $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT);
819 $this->objectives_qst_obj->setTestRefId($test_ref_id);
820 $this->objectives_qst_obj->setTestObjId($test_obj_id);
821 $this->objectives_qst_obj->setQuestionId($qst_id);
822 $this->objectives_qst_obj->add();
823 }
824
825 // TODO: not nice
826 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
827 $this->questions = new ilCourseObjectiveQuestion((int) $_GET['objective_id']);
828 // not required due to percentages
829 //$this->questions->updateLimits();
830
831 if ($checked_questions) {
832 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
833 $this->selfAssessmentLimits();
834 return true;
835 } else {
836 switch ($_SESSION['objective_mode']) {
838 $this->finalTestAssignment();
839 return true;
840
843 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
844 return true;
845 }
846 }
847 }
848
856 protected function selfAssessmentLimits()
857 {
858 global $DIC;
859
860 $ilAccess = $DIC['ilAccess'];
861 $ilErr = $DIC['ilErr'];
862 $tpl = $DIC['tpl'];
863
864 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
865 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
866 }
867 if (!$_GET['objective_id']) {
868 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
869 $this->ctrl->redirect($this, 'listObjectives');
870 }
871
872 $this->setSubTabs("self_ass_limits");
873
874 $this->ctrl->saveParameter($this, 'objective_id');
875 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
876
877 $this->__initQuestionObject((int) $_GET['objective_id']);
878 $this->initWizard(4);
879
880 $this->initFormLimits('selfAssessment');
881 $GLOBALS['DIC']['tpl']->setContent($this->form->getHtml());
882 #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
883 #$tpl->setContent($w_tpl->get());
884 }
885
893 protected function updateSelfAssessmentLimits()
894 {
895 global $DIC;
896
897 $ilAccess = $DIC['ilAccess'];
898 $ilErr = $DIC['ilErr'];
899 $ilObjDataCache = $DIC['ilObjDataCache'];
900
901 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
902 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
903 }
904 if (!$_GET['objective_id']) {
905 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
906 $this->ctrl->redirect($this, 'listObjectives');
907 }
908
909 $this->__initQuestionObject((int) $_GET['objective_id']);
910
911 if ((int) $_POST['limit'] < 1 or (int) $_POST['limit'] > 100) {
912 ilUtil::sendFailure($this->lng->txt('crs_objective_err_limit'));
913 $this->selfAssessmentLimits();
914 return false;
915 }
916
917 foreach ($this->objectives_qst_obj->getSelfAssessmentTests() as $test) {
918 $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT);
919 $this->objectives_qst_obj->setTestSuggestedLimit((int) $_POST['limit']);
920 $this->objectives_qst_obj->updateTest($test['test_objective_id']);
921 }
922
923 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
924 $this->ctrl->returnToParent($this);
925 }
926
927
935 protected function finalTestAssignment()
936 {
937 global $DIC;
938
939 $ilAccess = $DIC['ilAccess'];
940 $ilErr = $DIC['ilErr'];
941 $tpl = $DIC['tpl'];
942
943 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
944 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
945 }
946 if (!$_GET['objective_id']) {
947 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
948 $this->ctrl->redirect($this, 'listObjectives');
949 }
950
951 $this->setSubTabs("final_test_assign");
952
953 $this->ctrl->saveParameter($this, 'objective_id');
954 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
955
956 // begin-patch lok
957 $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_QUALIFIED);
958 $this->test_type = $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_QUALIFIED;
960 return $this->showRandomTestAssignment();
961 }
962 // end-patch lok
963
964 include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php');
966 $this,
967 $this->course_obj,
968 (int) $_GET['objective_id'],
970 );
971
972 $table->setTitle(
973 $this->lng->txt('crs_objective_wiz_final'),
974 '',
975 $this->lng->txt('crs_objective')
976 );
977 $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
978
979 $this->__initQuestionObject((int) $_GET['objective_id']);
980 $this->initWizard(5);
981 $GLOBALS['DIC']['tpl']->setContent($table->getHTML());
982 #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
983 #$tpl->setContent($w_tpl->get());
984 }
985
986 // begin-patch lok
987 protected function isRandomTestType($a_tst_type = 0)
988 {
989 if (!$a_tst_type) {
990 $a_tst_type = $this->test_type;
991 }
992
993 $tst_ref_id = $this->getSettings()->getTestByType($a_tst_type);
994 if (!$tst_ref_id) {
995 return false;
996 }
997 include_once './Modules/Test/classes/class.ilObjTest.php';
999 }
1000
1006 {
1007 $this->ctrl->saveParameter($this, 'objective_id');
1008 $this->ctrl->setParameter($this, 'tt', (int) $_REQUEST['tt']);
1009 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1010 $this->test_type = (int) $_REQUEST['tt'];
1011
1012
1013 $this->setSubTabs("rand_test_assign");
1014
1015 if (!$form instanceof ilPropertyFormGUI) {
1016 $form = $this->initFormRandom();
1017 }
1018
1019 $this->__initQuestionObject((int) $_GET['objective_id']);
1020 $this->initWizard(5);
1021 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
1022 #$w_tpl->setVariable('WIZ_CONTENT',$form->getHTML());
1023
1024 #$GLOBALS['DIC']['tpl']->setContent($w_tpl->get());
1025 }
1026
1030 protected function initFormRandom()
1031 {
1032 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1033 $form = new ilPropertyFormGUI();
1034 $form->setFormAction($this->ctrl->getFormAction($this));
1035
1036 if ($this->test_type == ilLOSettings::TYPE_TEST_INITIAL) {
1037 $form->setTitle($this->lng->txt('crs_loc_form_random_limits_it'));
1038 } else {
1039 $form->setTitle($this->lng->txt('crs_loc_form_random_limits_qt'));
1040 }
1041
1042 $form->addCommandButton('saveRandom', $this->lng->txt('save'));
1043
1044 $options = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_rand_assign_qpl'), 'type');
1045 $options->setValue(1);
1046 $options->setRequired(true);
1047
1048 $ass_qpl = new ilRadioOption($this->lng->txt('crs_loc_rand_assign_qpl'), 1);
1049 $options->addOption($ass_qpl);
1050
1051 $qpl = new ilSelectInputGUI($this->lng->txt('crs_loc_rand_qpl'), 'qpl');
1052 $qpl->setRequired(true);
1053 $qpl->setMulti(true, false);
1054 $qpl->setOptions($this->getRandomTestQplOptions());
1055
1057 $this->course_obj->getId(),
1058 (int) $_REQUEST['objective_id'],
1059 ilObject::_lookupObjId($this->getSettings()->getTestByType($this->test_type)),
1060 $this->test_type
1061 );
1062
1063 $qpl->setValue($sequences[0]);
1064 $qpl->setMultiValues($sequences);
1065 $ass_qpl->addSubItem($qpl);
1066
1067 // points
1068 $per = new ilNumberInputGUI($this->lng->txt('crs_loc_perc'), 'per');
1069 $per->setValue(
1071 $this->course_obj->getId(),
1072 (int) $_REQUEST['objective_id'],
1073 $this->test_type
1074 )
1075 );
1076 $per->setSize(3);
1077 $per->setMinValue(1);
1078 $per->setMaxValue(100);
1079 $per->setRequired(true);
1080 $ass_qpl->addSubItem($per);
1081
1082 $form->addItem($options);
1083 return $form;
1084 }
1085
1086
1087 protected function getRandomTestQplOptions()
1088 {
1089 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
1090 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
1091
1092 $tst_ref_id = $this->getSettings()->getTestByType($this->test_type);
1093 if ($tst_ref_id) {
1094 $tst = ilObjectFactory::getInstanceByRefId($tst_ref_id, false);
1095 }
1096 if (!$tst instanceof ilObjTest) {
1097 return array();
1098 }
1100 $GLOBALS['DIC']['ilDB'],
1101 $tst,
1103 $GLOBALS['DIC']['ilDB'],
1104 $tst
1105 )
1106 );
1107
1108 $list->loadDefinitions();
1109
1110 include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
1111 $translater = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['DIC']['ilDB']);
1112 $translater->loadLabels($list);
1113
1114 $options[0] = $this->lng->txt('select_one');
1115 foreach ($list as $definition) {
1117 $title = $definition->getPoolTitle();
1118 // fau: taxFilter/typeFilter - get title for extended filter conditions
1119 $filterTitle = array();
1120 $filterTitle[] = $translater->getTaxonomyFilterLabel($definition->getMappedTaxonomyFilter());
1121 $filterTitle[] = $translater->getTypeFilterLabel($definition->getTypeFilter());
1122 if (!empty($filterTitle)) {
1123 $title .= ' -> ' . implode(' / ', $filterTitle);
1124 }
1125 #$tax_id = $definition->getMappedFilterTaxId();
1126 #if($tax_id)
1127 #{
1128 # $title .= (' -> '. $translater->getTaxonomyTreeLabel($tax_id));
1129 #}
1130 #$tax_node = $definition->getMappedFilterTaxNodeId();
1131 #if($tax_node)
1132 #{
1133 # $title .= (' -> ' .$translater->getTaxonomyNodeLabel($tax_node));
1134 #}
1135 // fau.
1136 $options[$definition->getId()] = $title;
1137 }
1138 return $options;
1139 }
1140
1144 protected function saveRandom()
1145 {
1146 $this->ctrl->saveParameter($this, 'objective_id');
1147 $this->ctrl->setParameter($this, 'tt', (int) $_REQUEST['tt']);
1148 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1149 $this->test_type = (int) $_REQUEST['tt'];
1150
1151 $form = $this->initFormRandom();
1152
1153
1154
1155
1156 if ($form->checkInput()) {
1158 $this->course_obj->getId(),
1159 (int) $_REQUEST['objective_id'],
1160 $this->test_type
1161 );
1162
1163 $qst = $this->__initQuestionObject((int) $_GET['objective_id']);
1164 $qst->deleteByTestType(
1165 ($this->test_type == ilLOSettings::TYPE_TEST_INITIAL) ?
1168 );
1169 $ref_id = $this->getSettings()->getTestByType($this->test_type);
1170 foreach (array_unique((array) $form->getInput('qpl')) as $qpl_id) {
1171 include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
1172 $rnd = new ilLORandomTestQuestionPools(
1173 $this->course_obj->getId(),
1174 (int) $_REQUEST['objective_id'],
1175 $this->test_type,
1176 $qpl_id
1177 );
1178 $rnd->setLimit($form->getInput('per'));
1179 $rnd->setTestId(ilObject::_lookupObjId($ref_id));
1180 $rnd->create();
1181 }
1182 } else {
1183 $form->setValuesByPost();
1184 ilUtil::sendFailure($this->lng->txt('err_check_input'));
1185 return $this->showRandomTestAssignment();
1186 }
1187
1188 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1189 if ($this->test_type == ilLOSettings::TYPE_TEST_QUALIFIED) {
1190 $this->ctrl->returnToParent($this);
1191 } else {
1192 $this->ctrl->redirect($this, 'finalTestAssignment');
1193 }
1194 }
1195
1203 protected function updateFinalTestAssignment()
1204 {
1205 global $DIC;
1206
1207 $ilAccess = $DIC['ilAccess'];
1208 $ilErr = $DIC['ilErr'];
1209 $ilObjDataCache = $DIC['ilObjDataCache'];
1210
1211 $checked_questions = $_POST['questions'] ? $_POST['questions'] : array();
1212
1213
1214 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1215 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1216 }
1217 if (!$_GET['objective_id']) {
1218 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1219 $this->ctrl->redirect($this, 'listObjectives');
1220 }
1221
1222 $this->__initQuestionObject((int) $_GET['objective_id']);
1223
1224 // Delete unchecked
1225 foreach ($this->objectives_qst_obj->getFinalTestQuestions() as $question) {
1226 $id = $question['ref_id'] . '_' . $question['question_id'];
1227 if (!in_array($id, $checked_questions)) {
1228 $this->objectives_qst_obj->delete($question['qst_ass_id']);
1229 }
1230 }
1231 // Add checked
1232 foreach ($checked_questions as $question_id) {
1233 list($test_ref_id, $qst_id) = explode('_', $question_id);
1234 $test_obj_id = $ilObjDataCache->lookupObjId($test_ref_id);
1235
1236 if ($this->objectives_qst_obj->isFinalTestQuestion($qst_id)) {
1237 continue;
1238 }
1239
1240 $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
1241 $this->objectives_qst_obj->setTestRefId($test_ref_id);
1242 $this->objectives_qst_obj->setTestObjId($test_obj_id);
1243 $this->objectives_qst_obj->setQuestionId($qst_id);
1244 $this->objectives_qst_obj->add();
1245 }
1246
1247 // TODO: not nice
1248 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
1249 $this->questions = new ilCourseObjectiveQuestion((int) $_GET['objective_id']);
1250 // not required due to percentages
1251 //$this->questions->updateLimits();
1252
1253 ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
1254 $this->finalTestLimits();
1255 }
1256
1262 {
1263 global $DIC;
1264
1265 $ilAccess = $DIC['ilAccess'];
1266 $ilErr = $DIC['ilErr'];
1267
1268 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1269 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1270 }
1271 if (!$_GET['objective_id']) {
1272 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1273 $this->ctrl->returnToParent($this);
1274 }
1275 $this->ctrl->saveParameter($this, 'objective_id');
1276 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1277
1278 $this->initWizard(6);
1279 $form = $this->initFormTestAssignment();
1280 $GLOBALS['DIC']['tpl']->setContent($form->getHtml());
1281 }
1282
1290 protected function finalTestLimits()
1291 {
1292 global $DIC;
1293
1294 $ilAccess = $DIC['ilAccess'];
1295 $ilErr = $DIC['ilErr'];
1296 $tpl = $DIC['tpl'];
1297
1298 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1299 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1300 }
1301 if (!$_GET['objective_id']) {
1302 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1303 $this->ctrl->returnToParent($this);
1304 }
1305
1306 $this->setSubTabs("final_test_limits");
1307
1308 $this->ctrl->saveParameter($this, 'objective_id');
1309 $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1310
1311 $this->__initQuestionObject((int) $_GET['objective_id']);
1312 $this->initWizard(6);
1313
1314 $this->initFormLimits('final');
1315 $GLOBALS['DIC']['tpl']->setContent($this->form->getHtml());
1316
1317 #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
1318 #$tpl->setContent($w_tpl->get());
1319 }
1320
1328 protected function updateFinalTestLimits()
1329 {
1330 global $DIC;
1331
1332 $ilAccess = $DIC['ilAccess'];
1333 $ilErr = $DIC['ilErr'];
1334 $ilObjDataCache = $DIC['ilObjDataCache'];
1335
1336 if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1337 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1338 }
1339 if (!$_GET['objective_id']) {
1340 ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1341 $this->ctrl->redirect($this, 'listObjectives');
1342 }
1343
1344 $this->__initQuestionObject((int) $_GET['objective_id']);
1345
1346 if ((int) $_POST['limit'] < 1 or (int) $_POST['limit'] > 100) {
1347 ilUtil::sendFailure($this->lng->txt('crs_objective_err_limit'));
1348 $this->finalTestLimits();
1349 return false;
1350 }
1351
1352 foreach ($this->objectives_qst_obj->getFinalTests() as $test) {
1353 $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
1354 $this->objectives_qst_obj->setTestSuggestedLimit((int) $_POST['limit']);
1355 $this->objectives_qst_obj->updateTest($test['test_objective_id']);
1356 }
1357
1358 if ($_SESSION['objective_mode'] != self::MODE_CREATE) {
1359 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1360 } else {
1361 ilUtil::sendSuccess($this->lng->txt('crs_added_objective'), true);
1362 }
1363 $this->ctrl->returnToParent($this);
1364 }
1365
1373 protected function initFormLimits($a_mode)
1374 {
1375 if (!is_object($this->form)) {
1376 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1377 $this->form = new ilPropertyFormGUI();
1378 }
1379 $this->form->setFormAction($this->ctrl->getFormAction($this));
1380 $this->form->setTableWidth('100%');
1381 //$this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.svg'),$this->lng->txt('crs_objective'));
1382
1383 switch ($a_mode) {
1384 case 'selfAssessment':
1385 $this->form->setTitle($this->lng->txt('crs_objective_wiz_self_limit'));
1386 $this->form->addCommandButton('updateSelfAssessmentLimits', $this->lng->txt('crs_wiz_next'));
1387 $this->form->addCommandButton('selfAssessmentAssignment', $this->lng->txt('crs_wiz_back'));
1388
1389 $tests = $this->objectives_qst_obj->getSelfAssessmentTests();
1390 $max_points = $this->objectives_qst_obj->getSelfAssessmentPoints();
1391
1392 break;
1393
1394 case 'final':
1395 $this->form->setTitle($this->lng->txt('crs_objective_wiz_final_limit'));
1396 $this->form->addCommandButton('updateFinalTestLimits', $this->lng->txt('crs_wiz_next'));
1397 $this->form->addCommandButton('finalTestAssignment', $this->lng->txt('crs_wiz_back'));
1398
1399 $tests = $this->objectives_qst_obj->getFinalTests();
1400 $max_points = $this->objectives_qst_obj->getFinalTestPoints();
1401
1402 break;
1403 }
1404
1405 $over = new ilCustomInputGUI($this->lng->txt('crs_objective_qst_summary'), '');
1406
1407 $tpl = new ilTemplate('tpl.crs_objective_qst_summary.html', true, true, 'Modules/Course');
1408
1409
1410 $limit = 0;
1411
1412 foreach ($tests as $test) {
1413 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': ' . print_r($test, true));
1414
1415 $limit = $test['limit'];
1416
1417 foreach ($this->objectives_qst_obj->getQuestionsOfTest($test['obj_id']) as $question) {
1418 $tpl->setCurrentBlock('qst');
1419 $tpl->setVariable('QST_TITLE', $question['title']);
1420 if (strlen($question['description'])) {
1421 $tpl->setVariable('QST_DESCRIPTION', $question['description']);
1422 }
1423 $tpl->setVariable('QST_POINTS', $question['points'] . ' ' .
1424 $this->lng->txt('crs_objective_points'));
1425 $tpl->parseCurrentBlock();
1426 }
1427 $tpl->setCurrentBlock('tst');
1428 $tpl->setVariable('TST_TITLE', ilObject::_lookupTitle($test['obj_id']));
1429 if ($desc = ilObject::_lookupDescription($test['obj_id'])) {
1430 $tpl->setVariable('TST_DESC', $desc);
1431 }
1432 $tpl->setVariable('TST_TYPE_IMG', ilUtil::getTypeIconPath('tst', $test['obj_id'], 'tiny'));
1433 $tpl->setVariable('TST_ALT_IMG', $this->lng->txt('obj_tst'));
1434 $tpl->parseCurrentBlock();
1435 }
1436
1437 $tpl->setVariable('TXT_ALL_POINTS', $this->lng->txt('crs_objective_all_points'));
1438 $tpl->setVariable('TXT_POINTS', $this->lng->txt('crs_objective_points'));
1439 $tpl->setVariable('POINTS', $max_points);
1440
1441 $over->setHtml($tpl->get());
1442 $this->form->addItem($over);
1443
1444 // points
1445 $req = new ilNumberInputGUI($this->lng->txt('crs_loc_perc'), 'limit');
1446 $req->setValue($limit);
1447 $req->setSize(3);
1448 $req->setMinValue(1);
1449 $req->setMaxValue(100);
1450 $req->setRequired(true);
1451 switch ($a_mode) {
1452 case 'selfAssessment':
1453 $req->setInfo($this->lng->txt('crs_obj_initial_req_info'));
1454 break;
1455
1456 case 'final':
1457 $req->setInfo($this->lng->txt('crs_obj_final_req_info'));
1458 break;
1459 }
1460 $this->form->addItem($req);
1461 }
1462
1463
1470 protected function initFormTitle($a_mode, $a_step_number)
1471 {
1472 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1473 if ($this->form instanceof ilPropertyFormGUI) {
1474 return;
1475 }
1476
1477 $this->form = new ilPropertyFormGUI();
1478 $this->form->setFormAction($this->ctrl->getFormAction($this));
1479 //$this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.svg'),$this->lng->txt('crs_objective'));
1480
1481 switch ($a_mode) {
1482 case 'create':
1483 $this->form->setTitle($this->lng->txt('crs_objective_wiz_title'));
1484 $this->form->addCommandButton('save', $this->lng->txt('crs_wiz_next'));
1485 // begin-patch lok
1486 #$this->form->addCommandButton('listObjectives',$this->lng->txt('cancel'));
1487 // end-patch lok
1488 break;
1489
1490 case 'update':
1491 break;
1492 }
1493
1494 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
1495 $title->setValue($this->objective->getTitle());
1496 $title->setRequired(true);
1497 $title->setSize(40);
1498 $title->setMaxLength(70);
1499 $this->form->addItem($title);
1500
1501 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
1502 $desc->setValue($this->objective->getDescription());
1503 $desc->setCols(40);
1504 $desc->setRows(5);
1505 $this->form->addItem($desc);
1506 }
1507
1508
1516 protected function initWizard($a_step_number)
1517 {
1518 $options = array(
1519 1 => $this->lng->txt('crs_objective_wiz_title'),
1520 2 => $this->lng->txt('crs_objective_wiz_materials'),
1521 3 => $this->lng->txt('crs_objective_wiz_self'),
1522 4 => $this->lng->txt('crs_objective_wiz_self_limit'),
1523 5 => $this->lng->txt('crs_objective_wiz_final'),
1524 6 => $this->lng->txt('crs_objective_wiz_final_limit'));
1525
1526 $info = array(
1527 1 => $this->lng->txt('crs_objective_wiz_title_info'),
1528 2 => $this->lng->txt('crs_objective_wiz_materials_info'),
1529 3 => $this->lng->txt('crs_objective_wiz_self_info'),
1530 4 => $this->lng->txt('crs_objective_wiz_self_limit_info'),
1531 5 => $this->lng->txt('crs_objective_wiz_final_info'),
1532 6 => $this->lng->txt('crs_objective_wiz_final_limit_info'));
1533
1534 $links = array(
1535 1 => $this->ctrl->getLinkTarget($this, 'edit'),
1536 2 => $this->ctrl->getLinkTarget($this, 'materialAssignment'),
1537 3 => $this->ctrl->getLinkTarget($this, 'selfAssessmentAssignment'),
1538 4 => $this->ctrl->getLinkTarget($this, 'selfAssessmentLimits'),
1539 5 => $this->ctrl->getLinkTarget($this, 'finalTestAssignment'),
1540 6 => $this->ctrl->getLinkTarget($this, 'finalTestLimits'));
1541
1542
1543
1544
1545 // checklist gui start
1546 include_once("./Services/UIComponent/Checklist/classes/class.ilChecklistGUI.php");
1547 $check_list = new ilChecklistGUI();
1548 // checklist gui end
1549
1550 if ($_SESSION['objective_mode'] == self::MODE_CREATE) {
1551 // checklist gui start
1552 $check_list->setHeading($this->lng->txt('crs_checklist_objective'));
1553 // checklist gui end
1554 } else {
1555 // checklist gui start
1556 $check_list->setHeading($this->lng->txt('crs_checklist_objective'));
1557 // checklist gui end
1558 }
1559
1560 // end-patch lok
1561 $num = 0;
1562 foreach ($options as $step => $title) {
1563 // checklist gui start
1564 $item_link = "";
1565 // checklist gui end
1566
1567 // begin-patch lok
1568 if ($step == 3 and (!$this->getSettings()->worksWithInitialTest() or $this->getSettings()->hasSeparateInitialTests())) {
1569 continue;
1570 }
1571 if ($step == 4 and (!$this->getSettings()->worksWithInitialTest() or $this->getSettings()->hasSeparateInitialTests())) {
1572 continue;
1573 }
1574 if ($step == 5 and $this->getSettings()->hasSeparateQualifiedTests()) {
1575 continue;
1576 }
1577 if ($step == 6 and $this->getSettings()->hasSeparateQualifiedTests()) {
1578 continue;
1579 }
1581 continue;
1582 }
1584 continue;
1585 }
1586 $num++;
1587 // end-patch lok
1588
1589 if ($_SESSION['objective_mode'] == self::MODE_UPDATE) {
1590 $hide_link = false;
1591 if ($step == 4 and !count($this->objectives_qst_obj->getSelfAssessmentQuestions())) {
1592 $hide_link = true;
1593 }
1594 if ($step == 6 and !count($this->objectives_qst_obj->getFinalTestQuestions())) {
1595 $hide_link = true;
1596 }
1597 // begin-patch lok
1598 if ($step == 3 and !$this->getSettings()->worksWithInitialTest()) {
1599 $hide_link = true;
1600 }
1601 if ($step == 4 and !$this->getSettings()->worksWithInitialTest()) {
1602 $hide_link = true;
1603 }
1604 if (!$hide_link) {
1605 // checklist gui start
1606 $item_link = $links[$step];
1607 // checklist gui end
1608 }
1609 }
1610
1611 // checklist gui start
1612 $check_list->addEntry($title, $item_link, ilChecklistGUI::STATUS_NO_STATUS, ($step == $a_step_number));
1613 // checklist gui end
1614 }
1615
1616 // checklist gui start
1617 $GLOBALS['DIC']["tpl"]->setRightContent($check_list->getHTML());
1618 // checklist gui end
1619 }
1620}
$test
Definition: Utf8Test.php:84
exit
Definition: backend.php:16
$_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.
static lookupLimit($a_container_id, $a_objective_id, $a_test_type)
lookup limit @global type $ilDB
static deleteForObjectiveAndTestType($a_course_id, $a_objective_id, $a_tst_type)
Delete assignment for objective id and test type.
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 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)
foreach($_REQUEST as $var) foreach(array('_POST'=> 'HTTP_POST_VARS', '_GET'=> 'HTTP_GET_VARS', '_COOKIE'=> 'HTTP_COOKIE_VARS', '_SERVER'=> 'HTTP_SERVER_VARS', '_ENV'=> 'HTTP_ENV_VARS', '_FILES'=> 'HTTP_POST_FILES') as $array=> $other) $step
Definition: cssgen.php:155
$tests
Definition: bench.php:104
$tbl
Definition: example_048.php:81
if(!array_key_exists('StateId', $_REQUEST)) $id
$links
$req
Definition: getUserInfo.php:20
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
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
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2