ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjExerciseGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once "./Services/Object/classes/class.ilObjectGUI.php";
6 
24 {
28  protected $tabs;
29 
33  protected $help;
34 
39  public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
40  {
41  global $DIC;
42 
43  $this->lng = $DIC->language();
44  $this->user = $DIC->user();
45  $this->ctrl = $DIC->ctrl();
46  $this->tabs = $DIC->tabs();
47  $this->help = $DIC["ilHelp"];
48  $this->locator = $DIC["ilLocator"];
49  $this->tpl = $DIC["tpl"];
50  $this->toolbar = $DIC->toolbar();
51  $lng = $DIC->language();
52 
53  $this->type = "exc";
54  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
55 
56  $lng->loadLanguageModule("exercise");
57  $lng->loadLanguageModule("exc");
58  $this->ctrl->saveParameter($this, "ass_id");
59 
60  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
61  if ($_REQUEST["ass_id"] > 0 && is_object($this->object) && ilExAssignment::lookupExerciseId($_REQUEST["ass_id"]) == $this->object->getId()) {
62  $this->ass = new ilExAssignment((int) $_REQUEST["ass_id"]);
63  } elseif ($_REQUEST["ass_id"] > 0) {
64  include_once("./Modules/Exercise/exceptions/class.ilExerciseException.php");
65  throw new ilExerciseException("Assignment ID does not match Exercise.");
66  }
67  }
68 
69  public function executeCommand()
70  {
73  $ilTabs = $this->tabs;
74  $lng = $this->lng;
75 
76  $next_class = $this->ctrl->getNextClass($this);
77  $cmd = $this->ctrl->getCmd();
78  $this->prepareOutput();
79 
80  //echo "-".$next_class."-".$cmd."-"; exit;
81  switch ($next_class) {
82  case "ilinfoscreengui":
83  $ilTabs->activateTab("info");
84  $this->infoScreen(); // forwards command
85  break;
86 
87  case 'ilpermissiongui':
88  $ilTabs->activateTab("permissions");
89  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
90  $perm_gui = new ilPermissionGUI($this);
91  $ret =&$this->ctrl->forwardCommand($perm_gui);
92  break;
93 
94  case "illearningprogressgui":
95  $ilTabs->activateTab("learning_progress");
96  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
97 
98  $new_gui = new ilLearningProgressGUI(
100  $this->object->getRefId(),
101  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
102  );
103  $this->ctrl->forwardCommand($new_gui);
104  $this->tabs_gui->setTabActive('learning_progress');
105  break;
106 
107  case 'ilobjectcopygui':
108  $ilCtrl->saveParameter($this, 'new_type');
109  $ilCtrl->setReturnByClass(get_class($this), 'create');
110 
111  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
112  $cp = new ilObjectCopyGUI($this);
113  $cp->setType('exc');
114  $this->ctrl->forwardCommand($cp);
115  break;
116 
117  case "ilexportgui":
118  $ilTabs->activateTab("export");
119  include_once("./Services/Export/classes/class.ilExportGUI.php");
120  $exp_gui = new ilExportGUI($this);
121  $exp_gui->addFormat("xml");
122  $ret = $this->ctrl->forwardCommand($exp_gui);
123 // $this->tpl->show();
124  break;
125 
126  case "ilcommonactiondispatchergui":
127  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
129  $this->ctrl->forwardCommand($gui);
130  break;
131 
132  case "ilcertificategui":
133  $this->setSettingsSubTabs();
134  $this->tabs_gui->activateTab("settings");
135  $this->tabs_gui->activateSubTab("certificate");
136  include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
137  include_once "./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
138  $output_gui = new ilCertificateGUI(new ilExerciseCertificateAdapter($this->object));
139  $this->ctrl->forwardCommand($output_gui);
140  break;
141 
142  case "ilexassignmenteditorgui":
143  $this->checkPermission("write");
144  $ilTabs->activateTab("content");
145  $this->addContentSubTabs("list_assignments");
146  include_once("./Modules/Exercise/classes/class.ilExAssignmentEditorGUI.php");
147  $ass_gui = new ilExAssignmentEditorGUI($this->object->getId(), $this->object->isCompletionBySubmissionEnabled(), $this->ass);
148  $this->ctrl->forwardCommand($ass_gui);
149  break;
150 
151  case "ilexsubmissiongui":
152  $this->checkPermission("read");
153  $ilTabs->activateTab("content");
154  $this->addContentSubTabs("content");
155  $this->ctrl->setReturn($this, "showOverview");
156  include_once("./Modules/Exercise/classes/class.ilExSubmissionGUI.php");
157  $sub_gui = new ilExSubmissionGUI($this->object, $this->ass, (int) $_REQUEST["member_id"]);
158  $this->ctrl->forwardCommand($sub_gui);
159  break;
160 
161  case "ilexercisemanagementgui":
162  // rbac or position access
163  if ($GLOBALS['DIC']->access()->checkRbacOrPositionPermissionAccess(
164  'edit_submissions_grades',
165  'edit_submissions_grades',
166  $this->object->getRefId()
167  )) {
168  $ilTabs->activateTab("grades");
169  include_once("./Modules/Exercise/classes/class.ilExerciseManagementGUI.php");
170  $mgmt_gui = new ilExerciseManagementGUI($this->object, $this->ass);
171  $this->ctrl->forwardCommand($mgmt_gui);
172  } else {
173  $this->checkPermission("edit_submissions_grades"); // throw error by standard procedure
174  }
175  break;
176 
177  case "ilexccriteriacataloguegui":
178  $this->checkPermission("write");
179  $ilTabs->activateTab("settings");
180  $this->setSettingsSubTabs();
181  $ilTabs->activateSubTab("crit");
182  include_once("./Modules/Exercise/classes/class.ilExcCriteriaCatalogueGUI.php");
183  $crit_gui = new ilExcCriteriaCatalogueGUI($this->object);
184  $this->ctrl->forwardCommand($crit_gui);
185  break;
186 
187  default:
188  if (!$cmd) {
189  $cmd = "infoScreen";
190  }
191 
192  $cmd .= "Object";
193 
194  $this->$cmd();
195 
196  break;
197  }
198 
199  $this->addHeaderAction();
200 
201  return true;
202  }
203 
204  public function viewObject()
205  {
206  $this->infoScreenObject();
207  }
208 
209  protected function afterSave(ilObject $a_new_object)
210  {
212 
213  $a_new_object->saveData();
214 
215  ilUtil::sendSuccess($this->lng->txt("exc_added"), true);
216 
217  $ilCtrl->setParameterByClass("ilExAssignmentEditorGUI", "ref_id", $a_new_object->getRefId());
218  $ilCtrl->redirectByClass("ilExAssignmentEditorGUI", "addAssignment");
219  }
220 
221  protected function listAssignmentsObject()
222  {
224 
225  $this->checkPermissionBool("write");
226 
227  // #16587
228  $ilCtrl->redirectByClass("ilExAssignmentEditorGUI", "listAssignments");
229  }
230 
234  protected function initEditCustomForm(ilPropertyFormGUI $a_form)
235  {
236  $a_form->setTitle($this->lng->txt("exc_edit_exercise"));
237 
239  $section->setTitle($this->lng->txt('exc_passing_exc'));
240  $a_form->addItem($section);
241 
242  // pass mode
243  $radg = new ilRadioGroupInputGUI($this->lng->txt("exc_pass_mode"), "pass_mode");
244 
245  $op1 = new ilRadioOption(
246  $this->lng->txt("exc_pass_all"),
247  "all",
248  $this->lng->txt("exc_pass_all_info")
249  );
250  $radg->addOption($op1);
251  $op2 = new ilRadioOption(
252  $this->lng->txt("exc_pass_minimum_nr"),
253  "nr",
254  $this->lng->txt("exc_pass_minimum_nr_info")
255  );
256  $radg->addOption($op2);
257 
258  // minimum number of assignments to pass
259  $ni = new ilNumberInputGUI($this->lng->txt("exc_min_nr"), "pass_nr");
260  $ni->setSize(4);
261  $ni->setMaxLength(4);
262  $ni->setRequired(true);
263  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
264  $mand = ilExAssignment::countMandatory($this->object->getId());
265  $min = max($mand, 1);
266  $ni->setMinValue($min, true);
267  $ni->setInfo($this->lng->txt("exc_min_nr_info"));
268  $op2->addSubItem($ni);
269 
270  $a_form->addItem($radg);
271 
272  // completion by submission
273  $subcompl = new ilRadioGroupInputGUI($this->lng->txt("exc_passed_status_determination"), "completion_by_submission");
274  $op1 = new ilRadioOption($this->lng->txt("exc_completion_by_tutor"), 0, "");
275  $subcompl->addOption($op1);
276  $op2 = new ilRadioOption($this->lng->txt("exc_completion_by_submission"), 1, $this->lng->txt("exc_completion_by_submission_info"));
277  $subcompl->addOption($op2);
278  $a_form->addItem($subcompl);
279 
280  /*$subcompl = new ilCheckboxInputGUI($this->lng->txt('exc_completion_by_submission'), 'completion_by_submission');
281  $subcompl->setInfo($this->lng->txt('exc_completion_by_submission_info'));
282  $subcompl->setValue(1);
283  $a_form->addItem($subcompl);*/
284 
286  $section->setTitle($this->lng->txt('exc_publishing'));
287  $a_form->addItem($section);
288 
289  // show submissions
290  $cb = new ilCheckboxInputGUI($this->lng->txt("exc_show_submissions"), "show_submissions");
291  $cb->setInfo($this->lng->txt("exc_show_submissions_info"));
292  $a_form->addItem($cb);
293 
295  $section->setTitle($this->lng->txt('exc_notification'));
296  $a_form->addItem($section);
297 
298  // submission notifications
299  $cbox = new ilCheckboxInputGUI($this->lng->txt("exc_submission_notification"), "notification");
300  $cbox->setInfo($this->lng->txt("exc_submission_notification_info"));
301  $a_form->addItem($cbox);
302 
303 
304  // feedback settings
305 
307  $section->setTitle($this->lng->txt('exc_feedback'));
308  $a_form->addItem($section);
309 
310  $fdb = new ilCheckboxGroupInputGUI($this->lng->txt("exc_settings_feedback"), "tfeedback");
311  $a_form->addItem($fdb);
312 
313  $option = new ilCheckboxOption($this->lng->txt("exc_settings_feedback_mail"), ilObjExercise::TUTOR_FEEDBACK_MAIL);
314  $option->setInfo($this->lng->txt("exc_settings_feedback_mail_info"));
315  $fdb->addOption($option);
316  $option = new ilCheckboxOption($this->lng->txt("exc_settings_feedback_file"), ilObjExercise::TUTOR_FEEDBACK_FILE);
317  $option->setInfo($this->lng->txt("exc_settings_feedback_file_info"));
318  $fdb->addOption($option);
319  $option = new ilCheckboxOption($this->lng->txt("exc_settings_feedback_text"), ilObjExercise::TUTOR_FEEDBACK_TEXT);
320  $option->setInfo($this->lng->txt("exc_settings_feedback_text_info"));
321  $fdb->addOption($option);
322 
323  $position_settings = ilOrgUnitGlobalSettings::getInstance()
324  ->getObjectPositionSettingsByType($this->object->getType());
325 
326  if ($position_settings->isActive()) {
327  // add additional feature section
328  $feat = new ilFormSectionHeaderGUI();
329  $feat->setTitle($this->lng->txt('obj_features'));
330  $a_form->addItem($feat);
331 
332  // add orgunit settings
334  $this->object->getId(),
335  $a_form,
336  array(
338  )
339  );
340  }
341  }
342 
346  protected function getEditFormCustomValues(array &$a_values)
347  {
349 
350  $a_values["desc"] = $this->object->getLongDescription();
351  $a_values["show_submissions"] = $this->object->getShowSubmissions();
352  $a_values["pass_mode"] = $this->object->getPassMode();
353  if ($a_values["pass_mode"] == "nr") {
354  $a_values["pass_nr"] = $this->object->getPassNr();
355  }
356 
357  include_once "./Services/Notification/classes/class.ilNotification.php";
358  $a_values["notification"] = ilNotification::hasNotification(
360  $ilUser->getId(),
361  $this->object->getId()
362  );
363 
364  $a_values['completion_by_submission'] = (int) $this->object->isCompletionBySubmissionEnabled();
365 
366  $tfeedback = array();
367  if ($this->object->hasTutorFeedbackMail()) {
368  $tfeedback[] = ilObjExercise::TUTOR_FEEDBACK_MAIL;
369  }
370  if ($this->object->hasTutorFeedbackText()) {
371  $tfeedback[] = ilObjExercise::TUTOR_FEEDBACK_TEXT;
372  }
373  if ($this->object->hasTutorFeedbackFile()) {
374  $tfeedback[] = ilObjExercise::TUTOR_FEEDBACK_FILE;
375  }
376  $a_values['tfeedback'] = $tfeedback;
377 
378  // orgunit position setting enabled
379  $a_values['obj_orgunit_positions'] = (bool) ilOrgUnitGlobalSettings::getInstance()
380  ->isPositionAccessActiveForObject($this->object->getId());
381  }
382 
383  protected function updateCustom(ilPropertyFormGUI $a_form)
384  {
386  $this->object->setShowSubmissions($a_form->getInput("show_submissions"));
387  $this->object->setPassMode($a_form->getInput("pass_mode"));
388  if ($this->object->getPassMode() == "nr") {
389  $this->object->setPassNr($a_form->getInput("pass_nr"));
390  }
391 
392  $this->object->setCompletionBySubmission($a_form->getInput('completion_by_submission') == 1 ? true : false);
393 
394  $feedback = $a_form->getInput("tfeedback");
395  $this->object->setTutorFeedback(is_array($feedback)
396  ? array_sum($feedback)
397  : null);
398 
399  include_once "./Services/Notification/classes/class.ilNotification.php";
402  $ilUser->getId(),
403  $this->object->getId(),
404  (bool) $a_form->getInput("notification")
405  );
406 
407 
409  $this->object->getId(),
410  $a_form,
411  array(
413  )
414  );
415  }
416 
422  public function addContentSubTabs($a_activate)
423  {
424  $ilTabs = $this->tabs;
425  $lng = $this->lng;
427 
428  $ilTabs->addSubTab(
429  "content",
430  $lng->txt("view"),
431  $ilCtrl->getLinkTarget($this, "showOverview")
432  );
433  if ($this->checkPermissionBool("write")) {
434  $ilTabs->addSubTab(
435  "list_assignments",
436  $lng->txt("edit"),
437  $ilCtrl->getLinkTargetByClass("ilExAssignmentEditorGUI", "listAssignments")
438  );
439  }
440  $ilTabs->activateSubTab($a_activate);
441  }
442 
448  public function getTabs()
449  {
450  $lng = $this->lng;
451  $ilHelp = $this->help;
452 
453  $ilHelp->setScreenIdComponent("exc");
454 
455  if ($this->checkPermissionBool("read")) {
456  $this->tabs_gui->addTab(
457  "content",
458  $lng->txt("exc_assignments"),
459  $this->ctrl->getLinkTarget($this, "showOverview")
460  );
461  }
462 
463  $next_class = strtolower($this->ctrl->getNextClass());
464  if ($this->checkPermissionBool("visible") || $this->checkPermissionBool("read")) {
465  $this->tabs_gui->addTab(
466  "info",
467  $lng->txt("info_short"),
468  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
469  );
470  }
471 
472  // edit properties
473  if ($this->checkPermissionBool("write")) {
474  /*$tabs_gui->addTab("assignments",
475  $lng->txt("exc_edit_assignments"),
476  $this->ctrl->getLinkTarget($this, 'listAssignments'));*/
477 
478  $this->tabs_gui->addTab(
479  "settings",
480  $lng->txt("settings"),
481  $this->ctrl->getLinkTarget($this, 'edit')
482  );
483  }
484  if ($this->access->checkRbacOrPositionPermissionAccess(
485  'edit_submissions_grades',
486  'edit_submissions_grades',
487  $this->object->getRefId()
488  )) {
489  $this->tabs_gui->addTab(
490  "grades",
491  $lng->txt("exc_submissions_and_grades"),
492  $this->ctrl->getLinkTargetByClass("ilexercisemanagementgui", "members")
493  );
494  }
495 
496  // learning progress
497  $save_sort_order = $_GET["sort_order"]; // hack, because exercise sort parameters
498  $save_sort_by = $_GET["sort_by"]; // must not be forwarded to learning progress
499  $save_offset = $_GET["offset"];
500  $_GET["offset"] = $_GET["sort_by"] = $_GET["sort_order"] = "";
501 
502  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
503  if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
504  $this->tabs_gui->addTab(
505  'learning_progress',
506  $lng->txt('learning_progress'),
507  $this->ctrl->getLinkTargetByClass(array('ilobjexercisegui','illearningprogressgui'), '')
508  );
509  }
510 
511  $_GET["sort_order"] = $save_sort_order; // hack, part ii
512  $_GET["sort_by"] = $save_sort_by;
513  $_GET["offset"] = $save_offset;
514 
515  // export
516  if ($this->checkPermissionBool("write")) {
517  $this->tabs_gui->addTab(
518  "export",
519  $lng->txt("export"),
520  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
521  );
522  }
523 
524 
525  // permissions
526  if ($this->checkPermissionBool("edit_permission")) {
527  $this->tabs_gui->addTab(
528  'permissions',
529  $lng->txt("perm_settings"),
530  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
531  );
532  }
533  }
534 
540  public function infoScreenObject()
541  {
542  $this->ctrl->setCmd("showSummary");
543  $this->ctrl->setCmdClass("ilinfoscreengui");
544  $this->infoScreen();
545  }
546 
550  public function infoScreen()
551  {
553  $ilTabs = $this->tabs;
554  $lng = $this->lng;
555 
556  $ilTabs->activateTab("info");
557 
558  if (!$this->checkPermissionBool("read")) {
559  $this->checkPermission("visible");
560  }
561 
562  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
563  $info = new ilInfoScreenGUI($this);
564 
565  $info->enablePrivateNotes();
566 
567  $info->enableNews();
568  if ($this->checkPermissionBool("write")) {
569  $info->enableNewsEditing();
570  $info->setBlockProperty("news", "settings", true);
571  }
572 
573  // standard meta data
574  //$info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
575 
576  // instructions
577  $info->addSection($this->lng->txt("exc_overview"));
578  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
579  $ass = ilExAssignment::getAssignmentDataOfExercise($this->object->getId());
580  $cnt = 0;
581  $mcnt = 0;
582  foreach ($ass as $a) {
583  $cnt++;
584  if ($a["mandatory"]) {
585  $mcnt++;
586  }
587  }
588  $info->addProperty($lng->txt("exc_assignments"), $cnt);
589  $info->addProperty($lng->txt("exc_mandatory"), $mcnt);
590  if ($this->object->getPassMode() != "nr") {
591  $info->addProperty(
592  $lng->txt("exc_pass_mode"),
593  $lng->txt("exc_msg_all_mandatory_ass")
594  );
595  } else {
596  $info->addProperty(
597  $lng->txt("exc_pass_mode"),
598  sprintf($lng->txt("exc_msg_min_number_ass"), $this->object->getPassNr())
599  );
600  }
601 
602  // feedback from tutor
603  include_once("Services/Tracking/classes/class.ilLPMarks.php");
604  if ($this->checkPermissionBool("read")) {
605  $lpcomment = ilLPMarks::_lookupComment($ilUser->getId(), $this->object->getId());
606  $mark = ilLPMarks::_lookupMark($ilUser->getId(), $this->object->getId());
607  //$status = ilExerciseMembers::_lookupStatus($this->object->getId(), $ilUser->getId());
608  $st = $this->object->determinStatusOfUser($ilUser->getId());
609  $status = $st["overall_status"];
610  if ($lpcomment != "" || $mark != "" || $status != "notgraded") {
611  $info->addSection($this->lng->txt("exc_feedback_from_tutor"));
612  if ($lpcomment != "") {
613  $info->addProperty(
614  $this->lng->txt("exc_comment"),
615  $lpcomment
616  );
617  }
618  if ($mark != "") {
619  $info->addProperty(
620  $this->lng->txt("exc_mark"),
621  $mark
622  );
623  }
624 
625  //if ($status == "")
626  //{
627  // $info->addProperty($this->lng->txt("status"),
628  // $this->lng->txt("message_no_delivered_files"));
629  //}
630  //else
631  if ($status != "notgraded") {
632  $img = '<img src="' . ilUtil::getImagePath("scorm/" . $status . ".svg") . '" ' .
633  ' alt="' . $lng->txt("exc_" . $status) . '" title="' . $lng->txt("exc_" . $status) .
634  '" />';
635 
636  $add = "";
637  if ($st["failed_a_mandatory"]) {
638  $add = " (" . $lng->txt("exc_msg_failed_mandatory") . ")";
639  } elseif ($status == "failed") {
640  $add = " (" . $lng->txt("exc_msg_missed_minimum_number") . ")";
641  }
642  $info->addProperty(
643  $this->lng->txt("status"),
644  $img . " " . $this->lng->txt("exc_" . $status) . $add
645  );
646  }
647  }
648  }
649 
650  // forward the command
651  $this->ctrl->forwardCommand($info);
652  }
653 
654  public function editObject()
655  {
656  $this->setSettingsSubTabs();
657  $this->tabs_gui->activateSubTab("edit");
658  return parent::editObject();
659  }
660 
661  protected function setSettingsSubTabs()
662  {
663  $this->tabs_gui->addSubTab(
664  "edit",
665  $this->lng->txt("general_settings"),
666  $this->ctrl->getLinkTarget($this, "edit")
667  );
668 
669  $this->tabs_gui->addSubTab(
670  "crit",
671  $this->lng->txt("exc_criteria_catalogues"),
672  $this->ctrl->getLinkTargetByClass("ilexccriteriacataloguegui", "")
673  );
674 
675  include_once "Services/Certificate/classes/class.ilCertificate.php";
676  if (ilCertificate::isActive()) {
677  $this->tabs_gui->addSubTab(
678  "certificate",
679  $this->lng->txt("certificate"),
680  $this->ctrl->getLinkTarget($this, "certificate")
681  );
682  }
683  }
684 
690  public static function _goto($a_target, $a_raw)
691  {
692  global $DIC;
693 
694  $ilErr = $DIC["ilErr"];
695  $lng = $DIC->language();
696  $ilAccess = $DIC->access();
697  $ilCtrl = $DIC->ctrl();
698 
699  //we don't have baseClass here...
700  $ilCtrl->setTargetScript("ilias.php");
701  $ilCtrl->initBaseClass("ilRepositoryGUI");
702 
703  //ilExerciseMailNotification has links to:
704  // "Assignments", "Submission and Grades" and Downnoad the NEW files if the assignment type is "File Upload".
705  $ass_id = $_GET['ass_id'];
706  $parts = explode("_", $a_raw);
707  if (!$ass_id) {
708  $ass_id = null;
709  $action = null;
710 
711  switch (end($parts)) {
712  case "download":
713  $action = $parts[3];
714  $member = $parts[2];
715  $ass_id = $parts[1];
716  break;
717 
718  case "setdownload":
719  $action = $parts[3];
720  $member = $parts[2];
721  $ass_id = $parts[1];
722  break;
723 
724  case "grades":
725  $action= $parts[2];
726  $ass_id = $parts[1];
727  break;
728  }
729  }
730 
731  $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "ref_id", $a_target);
732 
733  if ($ilAccess->checkAccess("read", "", $a_target)) {
734  $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "target", $a_raw);
735 
736  if ($ass_id) {
737  $ilCtrl->setParameterByClass("ilExerciseManagementGUI", "ass_id", $ass_id);
738  }
739 
740  switch ($action) {
741  case "grades":
742  $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI", "ilExerciseManagementGUI"), "members");
743  break;
744 
745  /*case "download":
746  $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "member_id", $member);
747  $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI", "ilExerciseManagementGUI", "ilExSubmissionFileGUI"),"downloadNewReturned");
748  break;*/
749 
750  case "setdownload":
751  $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "member_id", $member);
752  $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI", "ilExerciseManagementGUI"), "waitingDownload");
753  break;
754 
755  default:
756  if ($parts[1] != "") {
757  $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "ass_id", $parts[1]);
758  $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "ass_id_goto", $parts[1]);
759  }
760  $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI"), "showOverview");
761  break;
762 
763  }
764  } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
765  $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI"), "infoScreen");
766  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
767  ilUtil::sendFailure(sprintf(
768  $lng->txt("msg_no_perm_read_item"),
770  ), true);
772  }
773  }
774 
778  public function addLocatorItems()
779  {
780  $ilLocator = $this->locator;
781 
782  if (is_object($this->object)) {
783  // #17955
784  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "showOverview"), "", $_GET["ref_id"]);
785  }
786  }
787 
788 
792 
796  public function showOverviewObject()
797  {
798  $tpl = $this->tpl;
799  $ilTabs = $this->tabs;
801  $ilToolbar = $this->toolbar;
802 
803  $this->checkPermission("read");
804 
805  $tpl->addJavaScript("./Modules/Exercise/js/ilExcPresentation.js");
806 
807  include_once("./Services/Tracking/classes/class.ilLearningProgress.php");
809  $ilUser->getId(),
810  $this->object->getId(),
811  $this->object->getRefId(),
812  'exc'
813  );
814 
815  $ilTabs->activateTab("content");
816  $this->addContentSubTabs("content");
817 
818  // show certificate?
819  if ($this->object->hasUserCertificate($ilUser->getId())) {
820  include_once "./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
821  include_once "./Services/Certificate/classes/class.ilCertificate.php";
822  $adapter = new ilExerciseCertificateAdapter($this->object);
824  $ilToolbar->addButton(
825  $this->lng->txt("certificate"),
826  $this->ctrl->getLinkTarget($this, "outCertificate")
827  );
828  }
829  }
830 
831  include_once("./Modules/Exercise/classes/class.ilExAssignmentGUI.php");
832  $ass_gui = new ilExAssignmentGUI($this->object);
833 
834  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
835  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
836  $acc = new ilAccordionGUI();
837  $acc->setId("exc_ow_" . $this->object->getId());
838 
839  $ass_data = ilExAssignment::getInstancesByExercise($this->object->getId());
840  foreach ($ass_data as $ass) {
841  // incoming assignment deeplink
842  $force_open = false;
843  if (isset($_GET["ass_id_goto"]) &&
844  (int) $_GET["ass_id_goto"] == $ass->getId()) {
845  $force_open = true;
846  }
847 
848  $acc->addItem(
849  $ass_gui->getOverviewHeader($ass),
850  $ass_gui->getOverviewBody($ass),
851  $force_open
852  );
853  }
854 
855  if (count($ass_data) < 2) {
856  $acc->setBehaviour("FirstOpen");
857  } else {
858  $acc->setUseSessionStorage(true);
859  }
860 
861  $mtpl = new ilTemplate("tpl.exc_ass_overview.html", true, true, "Modules/Exercise");
862  $mtpl->setVariable("CONTENT", $acc->getHTML());
863 
864  $tpl->setContent($mtpl->get());
865  }
866 
867  public function certificateObject()
868  {
869  $this->setSettingsSubTabs();
870  $this->tabs_gui->activateTab("settings");
871  $this->tabs_gui->activateSubTab("certificate");
872 
873  include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
874  include_once "./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
875  $output_gui = new ilCertificateGUI(new ilExerciseCertificateAdapter($this->object));
876  $output_gui->certificateEditor();
877  }
878 
879  public function outCertificateObject()
880  {
882 
883  if ($this->object->hasUserCertificate($ilUser->getId())) {
884  ilUtil::sendFailure($this->lng->txt("msg_failed"));
885  $this->showOverviewObject();
886  }
887 
888  include_once "./Services/Certificate/classes/class.ilCertificate.php";
889  include_once "./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
890  $certificate = new ilCertificate(new ilExerciseCertificateAdapter($this->object));
891  $certificate->outCertificate(array("user_id" => $ilUser->getId()));
892  }
893 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilExAssignmentEditorGUI.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor public.
This class represents an option in a radio group.
Class ilExcCriteriaCatalogueGUI.
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
static getAssignmentDataOfExercise($a_exc_id)
Get assignments data of an exercise in an array.
Class ilInfoScreenGUI.
Exercise assignment.
static countMandatory($a_ex_id)
Order assignments by deadline date.
This class represents an option in a checkbox group.
static _isComplete($adapter)
Checks the status of the certificate.
This class represents a property form user interface.
$action
GUI class for the workflow of copying objects.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
This class represents a section header in a property form.
Class ilObjExerciseGUI.
updateCustom(ilPropertyFormGUI $a_form)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
addItem($a_item)
Add Item (Property, SectionHeader).
getEditFormCustomValues(array &$a_values)
Get values for properties form.
setInfo($a_info)
Set Info.
user()
Definition: user.php:4
static _goto($a_target, $a_raw)
redirect script
addContentSubTabs($a_activate)
Add subtabs of content view.
global $ilCtrl
Definition: ilias.php:18
showOverviewObject()
Show overview of assignments.
setInfo($a_info)
Set Information Text.
GUI class for exercise assignments.
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
$section
Definition: Utf8Test.php:83
Export User Interface Class.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
prepareOutput($a_show_subobjects=true)
prepare output
This class represents a property in a property form.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
getTabs()
adds tabs to tab gui object
setTitle($a_title)
Set Title.
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.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
static getInstancesByExercise($a_exc_id)
special template class to simplify handling of ITX/PEAR
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
GUI class to create PDF certificates.
$ilUser
Definition: imgupload.php:18
This class represents a property in a property form.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilExerciseManagementGUI.
setSize($a_size)
Set Size.
afterSave(ilObject $a_new_object)
Create new PHPExcel object
obj_idprivate
$ret
Definition: parser.php:6
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
getRefId()
get reference id public
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
Create PDF certificates.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static lookupExerciseId($a_ass_id)
Lookup excercise id for assignment id.
static _lookupMark($a_usr_id, $a_obj_id)
static _lookupComment($a_usr_id, $a_obj_id)
$info
Definition: index.php:5
initEditCustomForm(ilPropertyFormGUI $a_form)
Init properties form.
Accordion user interface class.
addHeaderAction()
Add header action menu.
infoScreen()
show information screen
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Class ilObjUserTrackingGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilExSubmissionGUI.
addLocatorItems()
Add locator item.
Exercise exceptions class.