ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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
25 include_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  var $ctrl;
44  var $ilias;
45  var $ilErr;
46  var $lng;
47  var $tpl;
48 
51 
52  // begin-patch lok
53  protected $settings;
54  protected $test_type = 0;
55  // end-patch lok
56 
57  function ilCourseObjectivesGUI($a_course_id)
58  {
59  include_once './Modules/Course/classes/class.ilCourseObjective.php';
60 
61  global $ilCtrl,$lng,$ilErr,$ilias,$tpl,$tree,$ilTabs;
62 
63  $this->ctrl =& $ilCtrl;
64  $this->ctrl->saveParameter($this,array("ref_id"));
65 
66  $this->ilErr =& $ilErr;
67  $this->lng =& $lng;
68  $this->lng->loadLanguageModule('crs');
69  $this->tpl =& $tpl;
70  $this->tree =& $tree;
71  $this->tabs_gui =& $ilTabs;
72 
73  $this->course_id = $a_course_id;
74  $this->__initCourseObject();
75 
76  // begin-patch lok
77  $this->settings = ilLOSettings::getInstanceByObjId($this->course_obj->getId());
78  // end-patch lok
79 
80  }
81 
85  function &executeCommand()
86  {
87  global $ilTabs;
88 
89  $ilTabs->setTabActive('crs_objectives');
90 
91  $cmd = $this->ctrl->getCmd();
92 
93 
94  if (!$cmd = $this->ctrl->getCmd())
95  {
96  $cmd = "list";
97  }
98 
99  $this->$cmd();
100  }
101 
102  // begin-patch lok
107  public function getSettings()
108  {
109  return $this->settings;
110  }
111  // end-patch lok
112 
113 
121  protected function listObjectives()
122  {
123  global $ilAccess,$ilErr,$ilObjDataCache,$ilToolbar;
124 
125  $_SESSION['objective_mode'] = self::MODE_UNDEFINED;
126  if(!$ilAccess->checkAccess("write",'',$this->course_obj->getRefId()))
127  {
128  $this->ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilErr->MESSAGE);
129  }
130 
131  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.crs_objectives.html','Modules/Course');
132 
133  $ilToolbar->addButton($this->lng->txt('crs_add_objective'),
134  $this->ctrl->getLinkTarget($this, "'create"));
135 
136  include_once('./Modules/Course/classes/class.ilCourseObjectivesTableGUI.php');
137  $table = new ilCourseObjectivesTableGUI($this,$this->course_obj);
138  $table->setTitle($this->lng->txt('crs_objectives'),'',$this->lng->txt('crs_objectives'));
139  $table->parse(ilCourseObjective::_getObjectiveIds($this->course_obj->getId(),false));
140 
141  $this->tpl->setVariable('OBJECTIVES_TABLE',$table->getHTML());
142  }
143 
150  protected function saveSorting()
151  {
152  global $ilAccess,$ilErr,$ilObjDataCache;
153 
154  if(!$ilAccess->checkAccess("write",'',$this->course_obj->getRefId()))
155  {
156  $this->ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilErr->MESSAGE);
157  }
158 
159  asort($_POST['position'],SORT_NUMERIC);
160 
161  $counter = 1;
162  foreach($_POST['position'] as $objective_id => $position)
163  {
164  $objective = new ilCourseObjective($this->course_obj,$objective_id);
165  $objective->writePosition($counter++);
166  }
167  ilUtil::sendSuccess($this->lng->txt('crs_objective_saved_sorting'));
168  $this->listObjectives();
169  }
170 
172  {
173  global $rbacsystem;
174 
175  // MINIMUM ACCESS LEVEL = 'write'
176  if(!$rbacsystem->checkAccess("write", $this->course_obj->getRefId()))
177  {
178  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilErr->MESSAGE);
179  }
180  if(!count($_POST['objective']))
181  {
182  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'));
183  $this->listObjectives();
184 
185  return true;
186  }
187 
188  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_objectives.html",'Modules/Course');
189 
190  ilUtil::sendQuestion($this->lng->txt('crs_delete_objectve_sure'));
191 
192  $tpl =& new ilTemplate("tpl.table.html", true, true);
193  $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.crs_objectives_delete_row.html",'Modules/Course');
194 
195  $counter = 0;
196  foreach($_POST['objective'] as $objective_id)
197  {
198  $objective_obj = $this->__initObjectivesObject($objective_id);
199 
200  $tpl->setCurrentBlock("tbl_content");
201  $tpl->setVariable("ROWCOL",ilUtil::switchColor(++$counter,"tblrow2","tblrow1"));
202  $tpl->setVariable("TITLE",$objective_obj->getTitle());
203  $tpl->setVariable("DESCRIPTION",$objective_obj->getDescription());
204  $tpl->parseCurrentBlock();
205  }
206 
207  $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
208 
209  // Show action row
210  $tpl->setCurrentBlock("tbl_action_btn");
211  $tpl->setVariable("BTN_NAME",'deleteObjectives');
212  $tpl->setVariable("BTN_VALUE",$this->lng->txt('delete'));
213  $tpl->parseCurrentBlock();
214 
215  $tpl->setCurrentBlock("tbl_action_btn");
216  $tpl->setVariable("BTN_NAME",'listObjectives');
217  $tpl->setVariable("BTN_VALUE",$this->lng->txt('cancel'));
218  $tpl->parseCurrentBlock();
219 
220  $tpl->setCurrentBlock("tbl_action_row");
221  $tpl->setVariable("COLUMN_COUNTS",1);
222  $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath('arrow_downright.svg'));
223  $tpl->parseCurrentBlock();
224 
225 
226  // create table
227  $tbl = new ilTableGUI();
228  $tbl->setStyle('table','std');
229 
230  // title & header columns
231  $tbl->setTitle($this->lng->txt("crs_objectives"),"",$this->lng->txt("crs_objectives"));
232 
233  $tbl->setHeaderNames(array($this->lng->txt("title")));
234  $tbl->setHeaderVars(array("title"),
235  array("ref_id" => $this->course_obj->getRefId(),
236  "cmdClass" => "ilcourseobjectivesgui",
237  "cmdNode" => $_GET["cmdNode"]));
238  $tbl->setColumnWidth(array("50%"));
239 
240  $tbl->setLimit($_GET["limit"]);
241  $tbl->setOffset($_GET["offset"]);
242  $tbl->setMaxCount(count($_POST['objective']));
243 
244  // footer
245  $tbl->disable("footer");
246  $tbl->disable('sort');
247 
248  // render table
249  $tbl->setTemplate($tpl);
250  $tbl->render();
251 
252  $this->tpl->setVariable("OBJECTIVES_TABLE", $tpl->get());
253 
254 
255  // Save marked objectives
256  $_SESSION['crs_delete_objectives'] = $_POST['objective'];
257 
258  return true;
259  }
260 
261  function deleteObjectives()
262  {
263  global $rbacsystem;
264 
265  // MINIMUM ACCESS LEVEL = 'write'
266  if(!$rbacsystem->checkAccess("write", $this->course_obj->getRefId()))
267  {
268  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilErr->MESSAGE);
269  }
270  if(!count($_SESSION['crs_delete_objectives']))
271  {
272  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'));
273  $this->listObjectives();
274 
275  return true;
276  }
277 
278  foreach($_SESSION['crs_delete_objectives'] as $objective_id)
279  {
280  $objective_obj =& $this->__initObjectivesObject($objective_id);
281  $objective_obj->delete();
282  }
283 
284  ilUtil::sendSuccess($this->lng->txt('crs_objectives_deleted'));
285  $this->listObjectives();
286 
287  return true;
288  }
289 
296  protected function questionOverview()
297  {
298  global $ilAccess,$ilErr,$ilTabs;
299 
300  $ilTabs->setSubTabActive('crs_objective_overview_question_assignment');
301 
302  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
303  {
304  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
305  }
306 
307  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionsTableGUI.php');
308  $table = new ilCourseObjectiveQuestionsTableGUI($this,$this->course_obj);
309  $table->setTitle($this->lng->txt('crs_objectives_edit_question_assignments'),'',$this->lng->txt('crs_objectives'));
310  // begin-patch lok
311  $table->parse(ilCourseObjective::_getObjectiveIds($this->course_obj->getId(),false));
312  // end-patch lok
313 
314  $this->tpl->setContent($table->getHTML());
315  }
316 
323  protected function saveQuestionOverview()
324  {
325  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
326 
327  global $ilAccess,$ilErr;
328 
329  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
330  {
331  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
332  }
333  $error = false;
334 
335  $_POST['self'] = $_POST['self'] ? $_POST['self'] : array();
336  $_POST['final'] = $_POST['final'] ? $_POST['final'] : array();
337 
338  foreach($_POST['self'] as $objective_id => $limit)
339  {
340  $qst = new ilCourseObjectiveQuestion($objective_id);
341  $max_points = $qst->getSelfAssessmentPoints();
342 
343  if($limit < 0 or $limit > $max_points)
344  {
345  ilUtil::sendFailure($this->lng->txt('crs_objective_limit_err'));
346  $this->questionOverview();
347  return false;
348  }
349  }
350  foreach($_POST['final'] as $objective_id => $limit)
351  {
352  $qst = new ilCourseObjectiveQuestion($objective_id);
353  $max_points = $qst->getFinalTestPoints();
354 
355  if($limit < 0 or $limit > $max_points)
356  {
357  ilUtil::sendFailure($this->lng->txt('crs_objective_limit_err'));
358  $this->questionOverview();
359  return false;
360  }
361  }
362 
363  foreach($_POST['self'] as $objective_id => $limit)
364  {
366  }
367 
368  foreach($_POST['final'] as $objective_id => $limit)
369  {
371  }
372 
373  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
374  $this->questionOverview();
375  return true;
376  }
377 
378  // PRIVATE
380  {
381  if(!$this->course_obj =& ilObjectFactory::getInstanceByRefId($this->course_id,false))
382  {
383  $this->ilErr->raiseError("ilCourseObjectivesGUI: cannot create course object",$this->ilErr->MESSAGE);
384  exit;
385  }
386  return true;
387  }
388 
389  function __initObjectivesObject($a_id = 0)
390  {
391  return $this->objectives_obj = new ilCourseObjective($this->course_obj,$a_id);
392  }
393 
394  function __initLMObject($a_objective_id = 0)
395  {
396  include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
397  $this->objectives_lm_obj =& new ilCourseObjectiveMaterials($a_objective_id);
398 
399  return true;
400  }
401 
402  // begin-patch lok
408  function __initQuestionObject($a_objective_id = 0)
409  {
410  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
411  $this->objectives_qst_obj =& new ilCourseObjectiveQuestion($a_objective_id);
412 
413  return $this->objectives_qst_obj;
414  }
415  // end-patch lok
416 
420  function setSubTabs($a_active = "")
421  {
422  global $ilTabs, $ilHelp;
423 
424  if ($a_active != "")
425  {
426  $ilHelp->setScreenIdComponent("crs");
427  $ilHelp->setScreenId("crs_objective");
428  $ilHelp->setSubScreenId($a_active);
429  }
430 
431 
432  // begin-patch lok
433  // no subtabs here
434  return true;
435  // end-patch lok
436 
437 
438  $ilTabs->addSubTabTarget("crs_objective_overview_objectives",
439  $this->ctrl->getLinkTarget($this, "listObjectives"),
440  array("listObjectives", "moveObjectiveUp", "moveObjectiveDown", "listAssignedLM"),
441  array(),
442  '',
443  true);
444  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
445 
446  if(ilCourseObjectiveQuestion::_hasTests($this->course_obj->getId()))
447  {
448  $ilTabs->addSubTabTarget("crs_objective_overview_question_assignment",
449  $this->ctrl->getLinkTarget($this, "questionOverview"),
450  "editQuestionAssignment",
451  array(),
452  '',
453  false);
454  }
455  }
456 
457 
465  public function create()
466  {
467  global $tpl;
468 
469  $this->setSubTabs("create_obj");
470 
471  $_SESSION['objective_mode'] = self::MODE_CREATE;
472 
473  $this->ctrl->saveParameter($this,'objective_id');
474 
475  if(!is_object($this->objective))
476  {
477  $this->objective = new ilCourseObjective($this->course_obj,(int) $_GET['objective_id']);
478  }
479  $this->__initQuestionObject((int) $_GET['objective_id']);
480  $this->initWizard(1);
481 
482  $this->initFormTitle('create',1);
483  $GLOBALS['tpl']->setContent($this->form->getHtml());
484  #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
485  #$tpl->setContent($w_tpl->get());
486  }
487 
494  protected function edit()
495  {
496  global $tpl;
497 
498  $_SESSION['objective_mode'] = self::MODE_UPDATE;
499 
500  $this->setSubTabs("edit_obj");
501 
502  $this->ctrl->setParameter($this,'objective_id',(int) $_REQUEST['objective_id']);
503 
504  if(!$_REQUEST['objective_id'])
505  {
506  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
507  $this->ctrl->redirect($this,'listObjectives');
508  }
509 
510  if(!is_object($this->objective))
511  {
512  $this->objective = new ilCourseObjective($this->course_obj,(int) $_REQUEST['objective_id']);
513  }
514 
515  $this->__initQuestionObject((int) $_REQUEST['objective_id']);
516  $this->initWizard(1);
517  $this->initFormTitle('create',1);
518  $GLOBALS['tpl']->setContent($this->form->getHtml());
519  #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
520  #$tpl->setContent($w_tpl->get());
521  }
522 
529  protected function save()
530  {
531  global $ilAccess,$ilErr;
532 
533  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
534  {
535  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
536  }
537 
538  $this->ctrl->saveParameter($this,'objective_id');
539 
540  $this->objective = new ilCourseObjective($this->course_obj,(int) $_REQUEST['objective_id']);
541  $this->initFormTitle('create', 1);
542  if($this->form->checkInput())
543  {
544  $this->objective->setTitle($this->form->getInput('title'));
545  $this->objective->setDescription($this->form->getInput('description'));
546  $this->objective->setPasses(0);
547 
548  if(!$_GET['objective_id'])
549  {
550  $objective_id = $this->objective->add();
551  ilUtil::sendSuccess($this->lng->txt('crs_added_objective'),true);
552  }
553  else
554  {
555  $this->objective->update();
556  ilUtil::sendSuccess($this->lng->txt('crs_objective_modified'),true);
557  $objective_id = $_GET['objective_id'];
558  }
559  }
560  else
561  {
562  $this->form->setValuesByPost();
563  return $this->edit();
564  }
565 
566  if($_SESSION['objective_mode'] != self::MODE_CREATE)
567  {
568  $this->ctrl->returnToParent($this);
569  }
570 
571  $this->ctrl->setParameter($this,'objective_id',$objective_id);
572  $this->ctrl->redirect($this,'materialAssignment');
573  return true;
574  }
575 
582  protected function materialAssignment()
583  {
584  global $ilAccess,$ilErr,$tpl;
585 
586  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
587  {
588  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
589  }
590  if(!$_GET['objective_id'])
591  {
592  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
593  $this->ctrl->redirect($this,'listObjectives');
594  }
595 
596  $this->setSubTabs("materials");
597 
598  $this->ctrl->saveParameter($this,'objective_id');
599 
600  $this->objective = new ilCourseObjective($this->course_obj,(int) $_GET['objective_id']);
601 
602  include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterialAssignmentTableGUI.php');
603  $table = new ilCourseObjectiveMaterialAssignmentTableGUI($this,$this->course_obj,(int) $_GET['objective_id']);
604  $table->setTitle($this->lng->txt('crs_objective_wiz_materials'),
605  '',$this->lng->txt('crs_objectives'));
606 
607  include_once('Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
608  $table->parse(ilCourseObjectiveMaterials::_getAssignableMaterials($this->course_obj->getRefId()));
609 
610  $this->__initQuestionObject((int) $_GET['objective_id']);
611  $this->initWizard(2);
612  #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
613  $GLOBALS['tpl']->setContent($table->getHTML());
614  #$tpl->setContent($w_tpl->get());
615  }
616 
624  protected function updateMaterialAssignment()
625  {
626  global $ilAccess,$ilErr,$ilObjDataCache;
627 
628  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
629  {
630  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
631  }
632  if(!$_GET['objective_id'])
633  {
634  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
635  $this->ctrl->redirect($this,'listObjectives');
636  }
637 
638  $this->__initLMObject((int) $_GET['objective_id']);
639  $this->objectives_lm_obj->deleteAll();
640 
641  if(is_array($_POST['materials']))
642  {
643  foreach($_POST['materials'] as $node_id)
644  {
645  $obj_id = $ilObjDataCache->lookupObjId($node_id);
646  $type = $ilObjDataCache->lookupType($obj_id);
647 
648  $this->objectives_lm_obj->setLMRefId($node_id);
649  $this->objectives_lm_obj->setLMObjId($obj_id);
650  $this->objectives_lm_obj->setType($type);
651  $this->objectives_lm_obj->add();
652  }
653  }
654  if(is_array($_POST['chapters']))
655  {
656  foreach($_POST['chapters'] as $chapter)
657  {
658  include_once('./Modules/LearningModule/classes/class.ilLMObject.php');
659 
660  list($ref_id,$chapter_id) = explode('_',$chapter);
661 
662  $this->objectives_lm_obj->setLMRefId($ref_id);
663  $this->objectives_lm_obj->setLMObjId($chapter_id);
664  $this->objectives_lm_obj->setType(ilLMObject::_lookupType($chapter_id));
665  $this->objectives_lm_obj->add();
666  }
667  }
668  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
669 
670 
671  if($_SESSION['objective_mode'] != self::MODE_CREATE)
672  {
673  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'),true);
674  $this->ctrl->returnToParent($this);
675  }
676 
677  // begin-patch lok
678  if($this->getSettings()->worksWithInitialTest())
679  {
680  $this->selfAssessmentAssignment();
681  }
682  else
683  {
684  $this->finalTestAssignment();
685  }
686  // end-patch lok
687  }
688 
695  protected function selfAssessmentAssignment()
696  {
697  global $ilAccess,$ilErr,$tpl;
698 
699  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
700  {
701  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
702  }
703  if(!$_GET['objective_id'])
704  {
705  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
706  $this->ctrl->redirect($this,'listObjectives');
707  }
708 
709  $this->setSubTabs("self_ass_assign");
710 
711  $this->ctrl->saveParameter($this,'objective_id');
712 
713  $this->objective = new ilCourseObjective($this->course_obj,(int) $_GET['objective_id']);
714 
715  // begin-patch lok
716  $this->ctrl->setParameter($this,'tt',ilLOSettings::TYPE_TEST_INITIAL);
717  $this->test_type = $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_INITIAL;
719  {
720  return $this->showRandomTestAssignment();
721  }
722  // end-patch lok
723 
724  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php');
726  $this->course_obj,
727  (int) $_GET['objective_id'],
729  $table->setTitle($this->lng->txt('crs_objective_wiz_self'),
730  '',$this->lng->txt('crs_objective'));
731  $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
732 
733  $this->__initQuestionObject((int) $_GET['objective_id']);
734  $this->initWizard(3);
735  $GLOBALS['tpl']->setContent($table->getHTML());
736  #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
737  #$tpl->setContent($w_tpl->get());
738  }
739 
747  protected function updateSelfAssessmentAssignment()
748  {
749  global $ilAccess,$ilErr,$ilObjDataCache;
750 
751  $checked_questions = $_POST['questions'] ? $_POST['questions'] : array();
752 
753 
754  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
755  {
756  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
757  }
758  if(!$_GET['objective_id'])
759  {
760  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
761  $this->ctrl->redirect($this,'listObjectives');
762  }
763 
764  $this->__initQuestionObject((int) $_GET['objective_id']);
765 
766  // Delete unchecked
767  foreach($this->objectives_qst_obj->getSelfAssessmentQuestions() as $question)
768  {
769  $id = $question['ref_id'].'_'.$question['question_id'];
770  if(!in_array($id,$checked_questions))
771  {
772  $this->objectives_qst_obj->delete($question['qst_ass_id']);
773  }
774  }
775  // Add checked
776  foreach($checked_questions as $question_id)
777  {
778  list($test_ref_id,$qst_id) = explode('_',$question_id);
779  $test_obj_id = $ilObjDataCache->lookupObjId($test_ref_id);
780 
781  if($this->objectives_qst_obj->isSelfAssessmentQuestion($qst_id))
782  {
783  continue;
784  }
785  $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT);
786  $this->objectives_qst_obj->setTestRefId($test_ref_id);
787  $this->objectives_qst_obj->setTestObjId($test_obj_id);
788  $this->objectives_qst_obj->setQuestionId($qst_id);
789  $this->objectives_qst_obj->add();
790  }
791 
792  // TODO: not nice
793  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
794  $this->questions = new ilCourseObjectiveQuestion((int) $_GET['objective_id']);
795  // not required due to percentages
796  //$this->questions->updateLimits();
797 
798  if($checked_questions)
799  {
800  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
801  $this->selfAssessmentLimits();
802  return true;
803  }
804  else
805  {
806  switch($_SESSION['objective_mode'])
807  {
808  case self::MODE_CREATE:
809  $this->finalTestAssignment();
810  return true;
811 
812  case self::MODE_UPDATE:
813  $this->selfAssessmentAssignment();
814  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
815  return true;
816  }
817  }
818  }
819 
827  protected function selfAssessmentLimits()
828  {
829  global $ilAccess,$ilErr,$tpl;
830 
831  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
832  {
833  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
834  }
835  if(!$_GET['objective_id'])
836  {
837  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
838  $this->ctrl->redirect($this,'listObjectives');
839  }
840 
841  $this->setSubTabs("self_ass_limits");
842 
843  $this->ctrl->saveParameter($this,'objective_id');
844  $this->objective = new ilCourseObjective($this->course_obj,(int) $_GET['objective_id']);
845 
846  $this->__initQuestionObject((int) $_GET['objective_id']);
847  $this->initWizard(4);
848 
849  $this->initFormLimits('selfAssessment');
850  $GLOBALS['tpl']->setContent($this->form->getHtml());
851  #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
852  #$tpl->setContent($w_tpl->get());
853  }
854 
862  protected function updateSelfAssessmentLimits()
863  {
864  global $ilAccess,$ilErr,$ilObjDataCache;
865 
866  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
867  {
868  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
869  }
870  if(!$_GET['objective_id'])
871  {
872  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
873  $this->ctrl->redirect($this,'listObjectives');
874  }
875 
876  $this->__initQuestionObject((int) $_GET['objective_id']);
877 
878  if((int) $_POST['limit'] < 1 or (int) $_POST['limit'] > 100)
879  {
880  ilUtil::sendFailure($this->lng->txt('crs_objective_err_limit'));
881  $this->selfAssessmentLimits();
882  return false;
883  }
884 
885  foreach($this->objectives_qst_obj->getSelfAssessmentTests() as $test)
886  {
887  $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT);
888  $this->objectives_qst_obj->setTestSuggestedLimit((int) $_POST['limit']);
889  $this->objectives_qst_obj->updateTest($test['test_objective_id']);
890  }
891 
892  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
893  $this->ctrl->returnToParent($this);
894  }
895 
896 
904  protected function finalTestAssignment()
905  {
906  global $ilAccess,$ilErr,$tpl;
907 
908  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
909  {
910  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
911  }
912  if(!$_GET['objective_id'])
913  {
914  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
915  $this->ctrl->redirect($this,'listObjectives');
916  }
917 
918  $this->setSubTabs("final_test_assign");
919 
920  $this->ctrl->saveParameter($this,'objective_id');
921  $this->objective = new ilCourseObjective($this->course_obj,(int) $_GET['objective_id']);
922 
923  // begin-patch lok
924  $this->ctrl->setParameter($this,'tt',ilLOSettings::TYPE_TEST_QUALIFIED);
925  $this->test_type = $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_QUALIFIED;
927  {
928  return $this->showRandomTestAssignment();
929  }
930  // end-patch lok
931 
932  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php');
934  $this->course_obj,
935  (int) $_GET['objective_id'],
937 
938  $table->setTitle($this->lng->txt('crs_objective_wiz_final'),
939  '',$this->lng->txt('crs_objective'));
940  $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
941 
942  $this->__initQuestionObject((int) $_GET['objective_id']);
943  $this->initWizard(5);
944  $GLOBALS['tpl']->setContent($table->getHTML());
945  #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
946  #$tpl->setContent($w_tpl->get());
947  }
948 
949  // begin-patch lok
950  protected function isRandomTestType($a_tst_type = 0)
951  {
952  if(!$a_tst_type)
953  {
954  $a_tst_type = $this->test_type;
955  }
956 
957  $tst_ref_id = $this->getSettings()->getTestByType($a_tst_type);
958  if(!$tst_ref_id)
959  {
960  return false;
961  }
962  include_once './Modules/Test/classes/class.ilObjTest.php';
964  }
965 
970  protected function showRandomTestAssignment(ilPropertyFormGUI $form = null)
971  {
972  $this->ctrl->saveParameter($this,'objective_id');
973  $this->ctrl->setParameter($this,'tt', (int) $_REQUEST['tt']);
974  $this->objective = new ilCourseObjective($this->course_obj,(int) $_GET['objective_id']);
975  $this->test_type = (int) $_REQUEST['tt'];
976 
977 
978  $this->setSubTabs("rand_test_assign");
979 
980  if(!$form instanceof ilPropertyFormGUI)
981  {
982  $form = $this->initFormRandom();
983  }
984 
985  $this->__initQuestionObject((int) $_GET['objective_id']);
986  $this->initWizard(5);
987  $GLOBALS['tpl']->setContent($form->getHTML());
988  #$w_tpl->setVariable('WIZ_CONTENT',$form->getHTML());
989 
990  #$GLOBALS['tpl']->setContent($w_tpl->get());
991  }
992 
996  protected function initFormRandom()
997  {
998  include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
999  $rnd = new ilLORandomTestQuestionPools(
1000  $this->course_obj->getId(),
1001  (int) $_REQUEST['objective_id'],
1002  $this->test_type
1003  );
1004 
1005  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1006  $form = new ilPropertyFormGUI();
1007  $form->setFormAction($this->ctrl->getFormAction($this));
1008 
1009  if($this->test_type == ilLOSettings::TYPE_TEST_INITIAL)
1010  {
1011  $form->setTitle($this->lng->txt('crs_loc_form_random_limits_it'));
1012  }
1013  else
1014  {
1015  $form->setTitle($this->lng->txt('crs_loc_form_random_limits_qt'));
1016  }
1017 
1018  $form->addCommandButton('saveRandom', $this->lng->txt('save'));
1019 
1020  $options = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_rand_assign_qpl'),'type');
1021  $options->setValue(1);
1022  $options->setRequired(true);
1023 
1024  $ass_qpl = new ilRadioOption($this->lng->txt('crs_loc_rand_assign_qpl'),1);
1025  $options->addOption($ass_qpl);
1026 
1027  $qpl = new ilSelectInputGUI($this->lng->txt('crs_loc_rand_qpl'),'qpl');
1028  $qpl->setOptions($this->getRandomTestQplOptions());
1029  $qpl->setValue($rnd->getQplSequence());
1030  $ass_qpl->addSubItem($qpl);
1031 
1032  #$num = new ilNumberInputGUI($this->lng->txt('crs_loc_num_qst'),'num_qst');
1033  #$num->setSize(3);
1034  #$num->setMinValue(1);
1035  #$num->setRequired(true);
1036  #$ass_qpl->addSubItem($num);
1037 
1038  // points
1039  $per = new ilNumberInputGUI($this->lng->txt('crs_loc_perc'),'per');
1040  $per->setValue($rnd->getLimit());
1041  $per->setSize(3);
1042  $per->setMinValue(1);
1043  $per->setMaxValue(100);
1044  $per->setRequired(true);
1045  $ass_qpl->addSubItem($per);
1046 
1047  $form->addItem($options);
1048  return $form;
1049  }
1050 
1051 
1052  protected function getRandomTestQplOptions()
1053  {
1054  include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
1055  include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
1056 
1057  $tst_ref_id = $this->getSettings()->getTestByType($this->test_type);
1058  if($tst_ref_id)
1059  {
1060  $tst = ilObjectFactory::getInstanceByRefId($tst_ref_id,false);
1061  }
1062  if(!$tst instanceof ilObjTest)
1063  {
1064  return array();
1065  }
1067  $GLOBALS['ilDB'],
1068  $tst,
1070  $GLOBALS['ilDB'],
1071  $tst
1072  )
1073  );
1074 
1075  $list->loadDefinitions();
1076 
1077  include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
1078  $translater = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['ilDB']);
1079  $translater->loadLabels($list);
1080 
1081  $options[0] = $this->lng->txt('select_one');
1082  foreach ($list as $definition)
1083  {
1084  $title = $definition->getPoolTitle();
1085  $tax_id = $definition->getMappedFilterTaxId();
1086  if($tax_id)
1087  {
1088  $title .= (' -> '. $translater->getTaxonomyTreeLabel($tax_id));
1089  }
1090  $tax_node = $definition->getMappedFilterTaxNodeId();
1091  if($tax_node)
1092  {
1093  $title .= (' -> ' .$translater->getTaxonomyNodeLabel($tax_node));
1094  }
1095  $options[$definition->getId()] = $title;
1096  }
1097  return $options;
1098  }
1099 
1103  protected function saveRandom()
1104  {
1105  $this->ctrl->saveParameter($this,'objective_id');
1106  $this->ctrl->setParameter($this,'tt',(int) $_REQUEST['tt']);
1107  $this->objective = new ilCourseObjective($this->course_obj,(int) $_GET['objective_id']);
1108  $this->test_type = (int) $_REQUEST['tt'];
1109 
1110  $form = $this->initFormRandom();
1111  if($form->checkInput())
1112  {
1113  $qst = $this->__initQuestionObject((int) $_GET['objective_id']);
1114  $qst->deleteByTestType(
1115  ($this->test_type == ilLOSettings::TYPE_TEST_INITIAL) ?
1118  );
1119  $ref_id = $this->getSettings()->getTestByType($this->test_type);
1120 
1121  include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
1122  $rnd = new ilLORandomTestQuestionPools(
1123  $this->course_obj->getId(),
1124  (int) $_REQUEST['objective_id'],
1125  $this->test_type
1126  );
1127  $rnd->delete();
1128  $rnd->setLimit($form->getInput('per'));
1129  $rnd->setQplSequence($form->getInput('qpl'));
1130  $rnd->setTestId(ilObject::_lookupObjId($ref_id));
1131  $rnd->create();
1132  }
1133  else
1134  {
1135  $form->setValuesByPost();
1136  ilUtil::sendFailure($this->lng->txt('err_check_input'));
1137  return $this->showRandomTestAssignment();
1138  }
1139 
1140  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
1141  if($this->test_type == ilLOSettings::TYPE_TEST_QUALIFIED)
1142  {
1143  $this->ctrl->returnToParent($this);
1144  }
1145  else
1146  {
1147  $this->ctrl->redirect($this,'finalTestAssignment');
1148  }
1149  }
1150 
1158  protected function updateFinalTestAssignment()
1159  {
1160  global $ilAccess,$ilErr,$ilObjDataCache;
1161 
1162  $checked_questions = $_POST['questions'] ? $_POST['questions'] : array();
1163 
1164 
1165  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
1166  {
1167  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
1168  }
1169  if(!$_GET['objective_id'])
1170  {
1171  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
1172  $this->ctrl->redirect($this,'listObjectives');
1173  }
1174 
1175  $this->__initQuestionObject((int) $_GET['objective_id']);
1176 
1177  // Delete unchecked
1178  foreach($this->objectives_qst_obj->getFinalTestQuestions() as $question)
1179  {
1180  $id = $question['ref_id'].'_'.$question['question_id'];
1181  if(!in_array($id,$checked_questions))
1182  {
1183  $this->objectives_qst_obj->delete($question['qst_ass_id']);
1184  }
1185  }
1186  // Add checked
1187  foreach($checked_questions as $question_id)
1188  {
1189  list($test_ref_id,$qst_id) = explode('_',$question_id);
1190  $test_obj_id = $ilObjDataCache->lookupObjId($test_ref_id);
1191 
1192  if($this->objectives_qst_obj->isFinalTestQuestion($qst_id))
1193  {
1194  continue;
1195  }
1196 
1197  $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
1198  $this->objectives_qst_obj->setTestRefId($test_ref_id);
1199  $this->objectives_qst_obj->setTestObjId($test_obj_id);
1200  $this->objectives_qst_obj->setQuestionId($qst_id);
1201  $this->objectives_qst_obj->add();
1202  }
1203 
1204  // TODO: not nice
1205  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
1206  $this->questions = new ilCourseObjectiveQuestion((int) $_GET['objective_id']);
1207  // not required due to percentages
1208  //$this->questions->updateLimits();
1209 
1210  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
1211  $this->finalTestLimits();
1212  }
1213 
1218  protected function finalSeparatedTestAssignment(ilPropertyFormGUI $form = null)
1219  {
1220  global $ilAccess, $ilErr;
1221 
1222  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
1223  {
1224  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
1225  }
1226  if(!$_GET['objective_id'])
1227  {
1228  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
1229  $this->ctrl->returnToParent($this);
1230  }
1231  $this->ctrl->saveParameter($this,'objective_id');
1232  $this->objective = new ilCourseObjective($this->course_obj,(int) $_GET['objective_id']);
1233 
1234  $this->initWizard(6);
1235  $form = $this->initFormTestAssignment();
1236  $GLOBALS['tpl']->setContent($form->getHtml());
1237  }
1238 
1246  protected function finalTestLimits()
1247  {
1248  global $ilAccess,$ilErr,$tpl;
1249 
1250  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
1251  {
1252  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
1253  }
1254  if(!$_GET['objective_id'])
1255  {
1256  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
1257  $this->ctrl->returnToParent($this);
1258  }
1259 
1260  $this->setSubTabs("final_test_limits");
1261 
1262  $this->ctrl->saveParameter($this,'objective_id');
1263  $this->objective = new ilCourseObjective($this->course_obj,(int) $_GET['objective_id']);
1264 
1265  $this->__initQuestionObject((int) $_GET['objective_id']);
1266  $this->initWizard(6);
1267 
1268  $this->initFormLimits('final');
1269  $GLOBALS['tpl']->setContent($this->form->getHtml());
1270 
1271  #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
1272  #$tpl->setContent($w_tpl->get());
1273  }
1274 
1282  protected function updateFinalTestLimits()
1283  {
1284  global $ilAccess,$ilErr,$ilObjDataCache;
1285 
1286  if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
1287  {
1288  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
1289  }
1290  if(!$_GET['objective_id'])
1291  {
1292  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'),true);
1293  $this->ctrl->redirect($this,'listObjectives');
1294  }
1295 
1296  $this->__initQuestionObject((int) $_GET['objective_id']);
1297 
1298  if((int) $_POST['limit'] < 1 or (int) $_POST['limit'] > 100)
1299  {
1300  ilUtil::sendFailure($this->lng->txt('crs_objective_err_limit'));
1301  $this->finalTestLimits();
1302  return false;
1303  }
1304 
1305  foreach($this->objectives_qst_obj->getFinalTests() as $test)
1306  {
1307  $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
1308  $this->objectives_qst_obj->setTestSuggestedLimit((int) $_POST['limit']);
1309  $this->objectives_qst_obj->updateTest($test['test_objective_id']);
1310  }
1311 
1312  if($_SESSION['objective_mode'] != self::MODE_CREATE)
1313  {
1314  ilUtil::sendSuccess($this->lng->txt('settings_saved'), TRUE);
1315  }
1316  else
1317  {
1318  ilUtil::sendSuccess($this->lng->txt('crs_added_objective'),TRUE);
1319  }
1320  $this->ctrl->returnToParent($this);
1321  }
1322 
1330  protected function initFormLimits($a_mode)
1331  {
1332  if(!is_object($this->form))
1333  {
1334  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1335  $this->form = new ilPropertyFormGUI();
1336  }
1337  $this->form->setFormAction($this->ctrl->getFormAction($this));
1338  $this->form->setTableWidth('100%');
1339  //$this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.svg'),$this->lng->txt('crs_objective'));
1340 
1341  switch($a_mode)
1342  {
1343  case 'selfAssessment':
1344  $this->form->setTitle($this->lng->txt('crs_objective_wiz_self_limit'));
1345  $this->form->addCommandButton('updateSelfAssessmentLimits',$this->lng->txt('crs_wiz_next'));
1346  $this->form->addCommandButton('selfAssessmentAssignment',$this->lng->txt('crs_wiz_back'));
1347 
1348  $tests = $this->objectives_qst_obj->getSelfAssessmentTests();
1349  $max_points = $this->objectives_qst_obj->getSelfAssessmentPoints();
1350 
1351  break;
1352 
1353  case 'final':
1354  $this->form->setTitle($this->lng->txt('crs_objective_wiz_final_limit'));
1355  $this->form->addCommandButton('updateFinalTestLimits',$this->lng->txt('crs_wiz_next'));
1356  $this->form->addCommandButton('finalTestAssignment',$this->lng->txt('crs_wiz_back'));
1357 
1358  $tests = $this->objectives_qst_obj->getFinalTests();
1359  $max_points = $this->objectives_qst_obj->getFinalTestPoints();
1360 
1361  break;
1362  }
1363 
1364  $over = new ilCustomInputGUI($this->lng->txt('crs_objective_qst_summary'),'');
1365 
1366  $tpl = new ilTemplate('tpl.crs_objective_qst_summary.html',true,true,'Modules/Course');
1367 
1368 
1369  $limit = 0;
1370 
1371  foreach($tests as $test)
1372  {
1373  $GLOBALS['ilLog']->write(__METHOD__.': '.print_r($test,TRUE));
1374 
1375  $limit = $test['limit'];
1376 
1377  foreach($this->objectives_qst_obj->getQuestionsOfTest($test['obj_id']) as $question)
1378  {
1379  $tpl->setCurrentBlock('qst');
1380  $tpl->setVariable('QST_TITLE',$question['title']);
1381  if(strlen($question['description']))
1382  {
1383  $tpl->setVariable('QST_DESCRIPTION',$question['description']);
1384  }
1385  $tpl->setVariable('QST_POINTS',$question['points'].' '.
1386  $this->lng->txt('crs_objective_points'));
1387  $tpl->parseCurrentBlock();
1388  }
1389  $tpl->setCurrentBlock('tst');
1390  $tpl->setVariable('TST_TITLE',ilObject::_lookupTitle($test['obj_id']));
1391  if($desc = ilObject::_lookupDescription($test['obj_id']))
1392  {
1393  $tpl->setVariable('TST_DESC',$desc);
1394  }
1395  $tpl->setVariable('TST_TYPE_IMG',ilUtil::getTypeIconPath('tst',$test['obj_id'],'tiny'));
1396  $tpl->setVariable('TST_ALT_IMG',$this->lng->txt('obj_tst'));
1397  $tpl->parseCurrentBlock();
1398  }
1399 
1400  $tpl->setVariable('TXT_ALL_POINTS',$this->lng->txt('crs_objective_all_points'));
1401  $tpl->setVariable('TXT_POINTS',$this->lng->txt('crs_objective_points'));
1402  $tpl->setVariable('POINTS',$max_points);
1403 
1404  $over->setHtml($tpl->get());
1405  $this->form->addItem($over);
1406 
1407  // points
1408  $req = new ilNumberInputGUI($this->lng->txt('crs_loc_perc'),'limit');
1409  $req->setValue($limit);
1410  $req->setSize(3);
1411  $req->setMinValue(1);
1412  $req->setMaxValue(100);
1413  $req->setRequired(true);
1414  switch($a_mode)
1415  {
1416  case 'selfAssessment':
1417  $req->setInfo($this->lng->txt('crs_obj_initial_req_info'));
1418  break;
1419 
1420  case 'final':
1421  $req->setInfo($this->lng->txt('crs_obj_final_req_info'));
1422  break;
1423  }
1424  $this->form->addItem($req);
1425  }
1426 
1427 
1434  protected function initFormTitle($a_mode,$a_step_number)
1435  {
1436  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1437  if($this->form instanceof ilPropertyFormGUI)
1438  {
1439  return;
1440  }
1441 
1442  $this->form = new ilPropertyFormGUI();
1443  $this->form->setFormAction($this->ctrl->getFormAction($this));
1444  //$this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.svg'),$this->lng->txt('crs_objective'));
1445 
1446  switch($a_mode)
1447  {
1448  case 'create':
1449  $this->form->setTitle($this->lng->txt('crs_objective_wiz_title'));
1450  $this->form->addCommandButton('save',$this->lng->txt('crs_wiz_next'));
1451  // begin-patch lok
1452  #$this->form->addCommandButton('listObjectives',$this->lng->txt('cancel'));
1453  // end-patch lok
1454  break;
1455 
1456  case 'update':
1457  break;
1458  }
1459 
1460  $title = new ilTextInputGUI($this->lng->txt('title'),'title');
1461  $title->setValue($this->objective->getTitle());
1462  $title->setRequired(true);
1463  $title->setSize(40);
1464  $title->setMaxLength(70);
1465  $this->form->addItem($title);
1466 
1467  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
1468  $desc->setValue($this->objective->getDescription());
1469  $desc->setCols(40);
1470  $desc->setRows(5);
1471  $this->form->addItem($desc);
1472 
1473  }
1474 
1475 
1483  protected function initWizard($a_step_number)
1484  {
1485  $options = array(
1486  1 => $this->lng->txt('crs_objective_wiz_title'),
1487  2 => $this->lng->txt('crs_objective_wiz_materials'),
1488  3 => $this->lng->txt('crs_objective_wiz_self'),
1489  4 => $this->lng->txt('crs_objective_wiz_self_limit'),
1490  5 => $this->lng->txt('crs_objective_wiz_final'),
1491  6 => $this->lng->txt('crs_objective_wiz_final_limit'));
1492 
1493  $info = array(
1494  1 => $this->lng->txt('crs_objective_wiz_title_info'),
1495  2 => $this->lng->txt('crs_objective_wiz_materials_info'),
1496  3 => $this->lng->txt('crs_objective_wiz_self_info'),
1497  4 => $this->lng->txt('crs_objective_wiz_self_limit_info'),
1498  5 => $this->lng->txt('crs_objective_wiz_final_info'),
1499  6 => $this->lng->txt('crs_objective_wiz_final_limit_info'));
1500 
1501  $links = array(
1502  1 => $this->ctrl->getLinkTarget($this,'edit'),
1503  2 => $this->ctrl->getLinkTarget($this,'materialAssignment'),
1504  3 => $this->ctrl->getLinkTarget($this,'selfAssessmentAssignment'),
1505  4 => $this->ctrl->getLinkTarget($this,'selfAssessmentLimits'),
1506  5 => $this->ctrl->getLinkTarget($this,'finalTestAssignment'),
1507  6 => $this->ctrl->getLinkTarget($this,'finalTestLimits'));
1508 
1509 
1510 
1511 
1512  // checklist gui start
1513  include_once("./Services/UIComponent/Checklist/classes/class.ilChecklistGUI.php");
1514  $check_list = new ilChecklistGUI();
1515  // checklist gui end
1516 
1517  if($_SESSION['objective_mode'] == self::MODE_CREATE)
1518  {
1519  // checklist gui start
1520  $check_list->setHeading($this->lng->txt('crs_checklist_objective'));
1521  // checklist gui end
1522  }
1523  else
1524  {
1525  // checklist gui start
1526  $check_list->setHeading($this->lng->txt('crs_checklist_objective'));
1527  // checklist gui end
1528  }
1529 
1530  // end-patch lok
1531  $num = 0;
1532  foreach($options as $step => $title)
1533  {
1534  // checklist gui start
1535  $item_link = "";
1536  // checklist gui end
1537 
1538  // begin-patch lok
1539  if($step == 3 and (!$this->getSettings()->worksWithInitialTest() or $this->getSettings()->hasSeparateInitialTests()))
1540  {
1541  continue;
1542  }
1543  if($step == 4 and (!$this->getSettings()->worksWithInitialTest() or $this->getSettings()->hasSeparateInitialTests()))
1544  {
1545  continue;
1546  }
1547  if($step == 5 and $this->getSettings()->hasSeparateQualifiedTests())
1548  {
1549  continue;
1550  }
1551  if($step == 6 and $this->getSettings()->hasSeparateQualifiedTests())
1552  {
1553  continue;
1554  }
1555  if($step == 4 and $this->isRandomTestType(ilLOSettings::TYPE_TEST_INITIAL))
1556  {
1557  continue;
1558  }
1559  if($step == 6 and $this->isRandomTestType(ilLOSettings::TYPE_TEST_QUALIFIED))
1560  {
1561  continue;
1562  }
1563  $num++;
1564  // end-patch lok
1565 
1566  if($_SESSION['objective_mode'] == self::MODE_UPDATE)
1567  {
1568  $hide_link = false;
1569  if($step == 4 and !count($this->objectives_qst_obj->getSelfAssessmentQuestions()))
1570  {
1571  $hide_link = true;
1572  }
1573  if($step == 6 and !count($this->objectives_qst_obj->getFinalTestQuestions()))
1574  {
1575  $hide_link = true;
1576  }
1577  // begin-patch lok
1578  if($step == 3 and !$this->getSettings()->worksWithInitialTest())
1579  {
1580  $hide_link = true;
1581  }
1582  if($step == 4 and !$this->getSettings()->worksWithInitialTest())
1583  {
1584  $hide_link = true;
1585  }
1586  if(!$hide_link)
1587  {
1588  // checklist gui start
1589  $item_link = $links[$step];
1590  // checklist gui end
1591  }
1592  }
1593 
1594  // checklist gui start
1595  $check_list->addEntry($title, $item_link, ilChecklistGUI::STATUS_NO_STATUS, ($step == $a_step_number));
1596  // checklist gui end
1597  }
1598 
1599  // checklist gui start
1600  $GLOBALS["tpl"]->setRightContent($check_list->getHTML());
1601  // checklist gui end
1602 
1603  }
1604 
1605 }
1606 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
saveQuestionOverview()
update question overview
materialAssignment()
material assignment
static getInstanceByObjId($a_obj_id)
get singleton instance
selfAssessmentAssignment()
self assessment assignemnt
This class represents an option in a radio group.
exit
Definition: login.php:54
initFormTitle($a_mode, $a_step_number)
init form title
setHtml($a_html)
Set Html.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
$_POST['username']
Definition: cron.php:12
setValue($a_value)
Set Value.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
updateMaterialAssignment()
update material assignment
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
This class represents a property form user interface.
updateSelfAssessmentLimits()
update self assessment limits
initWizard($a_step_number)
init wizard
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not...
$_GET["client_id"]
$tbl
Definition: example_048.php:81
saveRandom()
Save random test settings.
updateFinalTestLimits()
update self assessment limits
$cmd
Definition: sahs_server.php:35
setValue($a_value)
Set Value.
static _getObjectiveIds($course_id, $a_activated_only=false)
finalTestLimits()
self assessment limits
static _lookupTitle($a_id)
lookup object title
Class ilTableGUI.
TableGUI for material assignments of course objectives.
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...
global $ilCtrl
Definition: ilias.php:18
showRandomTestAssignment(ilPropertyFormGUI $form=null)
finalTestAssignment()
final test assignment
updateFinalTestAssignment()
update self assessment assignment
$info
Definition: example_052.php:80
class ilCourseObjectiveMaterials
updateSelfAssessmentAssignment()
update self assessment assignment
This class represents a property in a property form.
class ilobjcourseobjectivesgui
if(!is_array($argv)) $options
finalSeparatedTestAssignment(ilPropertyFormGUI $form=null)
Show test assignment form.
class ilcourseobjective
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
static _lookupDescription($a_id)
lookup object description
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
redirection script todo: (a better solution should control the processing via a xml file) ...
setSubTabs($a_active="")
set sub tabs
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
setOptions($a_options)
Set Options.
initFormLimits($a_mode)
init limit form
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a custom property in a property form.
static _getAssignableMaterials($a_container_id)
Get an array of course material ids that can be assigned to learning objectives No tst...
$ref_id
Definition: sahs_server.php:39
This class represents a text area property in a property form.
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 _updateTestLimits($a_objective_id, $a_status, $a_limit)
update test limits
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
setValue($a_value)
Set Value.
TableGUI for question assignments of course objectives.
class ilcourseobjectiveQuestion
selfAssessmentLimits()
self assessment limits
static _getAssignableTests($a_container_ref_id)
Get assignable tests.
$test
Definition: Utf8Test.php:85