ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjCourseGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
5require_once "./Services/Container/classes/class.ilContainerGUI.php";
6
29{
34 function ilObjCourseGUI()
35 {
36 global $ilCtrl, $ilHelp;
37
38 // CONTROL OPTIONS
39 $this->ctrl =& $ilCtrl;
40 $this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
41
42 $this->type = "crs";
43 $this->ilContainerGUI('',(int) $_GET['ref_id'],true,false);
44
45 $this->lng->loadLanguageModule('crs');
46
47 $this->SEARCH_USER = 1;
48 $this->SEARCH_GROUP = 2;
49 $this->SEARCH_COURSE = 3;
50 }
51
52 function gatewayObject()
53 {
54 switch($_POST["action"])
55 {
56
57 case "deleteSubscribers":
58 $this->deleteSubscribers();
59 break;
60
61 case "addSubscribers":
62 $this->addSubscribers();
63 break;
64
65 case "addFromWaitingList":
66 $this->addFromWaitingList();
67 break;
68
69 case "removeFromWaitingList":
70 $this->removeFromWaitingList();
71 break;
72
73 default:
74 $this->viewObject();
75 break;
76 }
77 return true;
78 }
79
86 public function memberGatewayObject()
87 {
88 if(isset($_POST['btn_pressed']['deleteMembers']))
89 {
90 return $this->deleteMembersObject();
91 }
92 elseif($_POST['btn_pressed']['sendMailToSelectedUsers'])
93 {
94 return $this->sendMailToSelectedUsersObject();
95 }
96 else
97 {
98 return $this->updateMembersObject();
99 }
100 }
101
103 {
104 if(isset($_GET['member_id']))
105 {
106 $_POST['member'] = array($_GET['member_id']);
107 }
108 else
109 {
110 $_POST['member'] = array_unique(array_merge((array) $_POST['members'],
111 (array) $_POST['tutors'],
112 (array) $_POST['admins'],
113 (array) $_POST['waiting'],
114 (array) $_POST['subscribers'],
115 (array) $_POST['roles']
116 ));
117 }
118
119 if (!count($_POST["member"]))
120 {
121 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
122 $this->cancelMemberObject();
123 return false;
124 }
125
126 foreach($_POST["member"] as $usr_id)
127 {
128 $rcps[] = ilObjUser::_lookupLogin($usr_id);
129 }
130
131 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
132 require_once 'Modules/Course/classes/class.ilCourseMailTemplateTutorContext.php';
133
137 $this,
138 'members',
139 array(),
140 array(
141 'type' => 'new',
142 'sig' => $this->createMailSignature()
143 ),
144 array(
146 'ref_id' => $this->object->getRefId(),
147 'ts' => time()
148 )
149 )
150 );
151 }
152
158 {
160
161 $return_location = "members";
162
163 #ilUtil::sendSuccess($this->lng->txt("action_aborted"),true);
164 ilUtil::redirect($this->ctrl->getLinkTarget($this,$return_location,"",false,false));
165 }
166
171 protected function afterImport(ilObject $a_new_object)
172 {
173 global $ilUser, $ilSetting;
174
175 // #11895
176 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
177 $part = ilCourseParticipants::_getInstanceByObjId($a_new_object->getId());
178 $part->add($ilUser->getId(), ilCourseConstants::CRS_ADMIN);
179 $part->updateNotification($ilUser->getId(), $ilSetting->get('mail_crs_admin_notification', true));
180
181 parent::afterImport($a_new_object);
182 }
183
184 function renderObject()
185 {
186 $this->ctrl->setCmd("view");
187 $this->viewObject();
188 }
189
195 protected function forwardToTimingsView()
196 {
197 if(!$this->ctrl->getCmd() and $this->object->getViewMode() == ilContainer::VIEW_TIMING)
198 {
199 if(!isset($_SESSION['crs_timings'])) {
200 $_SESSION['crs_timings'] = true;
201 }
202
203 if($_SESSION['crs_timings'] == true) {
204 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
205 $course_content_obj = new ilCourseContentGUI($this);
206 $this->ctrl->setCmdClass(get_class($course_content_obj));
207 $this->ctrl->setCmd('editUserTimings');
208 $this->ctrl->forwardCommand($course_content_obj);
209 return true;
210 }
211 }
212 $_SESSION['crs_timings'] = false;
213 return false;
214 }
215
216
217 function viewObject()
218 {
219 global $rbacsystem, $ilUser, $ilCtrl;
220
221 // CHECK ACCESS
222 $this->checkPermission('read','view');
223 /*
224 if(!$rbacsystem->checkAccess("read",$this->object->getRefId()))
225 {
226 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
227 }
228 */
229 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
230 {
231 parent::viewObject();
232 return true;
233 }
234
235 // Fill meta header tags
236 include_once('Services/MetaData/classes/class.ilMDUtils.php');
237 ilMDUtils::_fillHTMLMetaTags($this->object->getId(),$this->object->getId(),'crs');
238
239 // Trac access
240 if ($ilCtrl->getNextClass() != "ilcolumngui")
241 {
242 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
243 ilLearningProgress::_tracProgress($ilUser->getId(),$this->object->getId(),
244 $this->object->getRefId(),'crs');
245 }
246
247 if(!$this->checkAgreement())
248 {
249 include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
250 $this->tabs_gui->clearTargets();
251 $this->ctrl->setReturn($this,'view_content');
252 $agreement = new ilMemberAgreementGUI($this->object->getRefId());
253 $this->ctrl->setCmdClass(get_class($agreement));
254 $this->ctrl->forwardCommand($agreement);
255 return true;
256 }
257
258 if(!$this->__checkStartObjects())
259 {
260 include_once "Services/Container/classes/class.ilContainerStartObjectsContentGUI.php";
261 $stgui = new ilContainerStartObjectsContentGUI($this, $this->object);
262 $stgui->enableDesktop($this->object->getAboStatus(), $this);
263 return $stgui->getHTML();
264 }
265
266 // views handled by general container logic
267 if ($this->object->getViewMode() == ilContainer::VIEW_SIMPLE ||
268 $this->object->getViewMode() == ilContainer::VIEW_BY_TYPE ||
269 $this->object->getViewMode() == ilContainer::VIEW_SESSIONS ||
270 $this->object->getViewMode() == ilContainer::VIEW_TIMING ||
271 $this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE
272 )
273 {
274 $ret = parent::renderObject();
275 return $ret;
276 }
277 else
278 {
279 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
280 $course_content_obj = new ilCourseContentGUI($this);
281
282 $this->ctrl->setCmdClass(get_class($course_content_obj));
283 $this->ctrl->forwardCommand($course_content_obj);
284 }
285
286 return true;
287 }
288
290 {
291 return parent::renderObject();
292 }
293
300 {
301 $this->ctrl->setCmd("showSummary");
302 $this->ctrl->setCmdClass("ilinfoscreengui");
303 $this->infoScreen();
304 }
305
309 function infoScreen()
310 {
311 global $ilErr,$ilAccess, $ilUser, $ilSetting;
312
313 $this->checkPermission('visible');
314 // Fill meta header tags
315 include_once('Services/MetaData/classes/class.ilMDUtils.php');
316 ilMDUtils::_fillHTMLMetaTags($this->object->getId(),$this->object->getId(),'crs');
317
318 $this->tabs_gui->setTabActive('info_short');
319
320 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
321 include_once 'Modules/Course/classes/class.ilCourseFile.php';
322
323 $files =& ilCourseFile::_readFilesByCourse($this->object->getId());
324
325 $info = new ilInfoScreenGUI($this);
326 $info->enablePrivateNotes();
327 $info->enableFeedback();
328 $info->enableNews();
329 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
330 {
331 $info->enableNewsEditing();
332 }
333
334 if(strlen($this->object->getImportantInformation()) or
335 strlen($this->object->getSyllabus()) or
336 count($files))
337 {
338 $info->addSection($this->lng->txt('crs_general_informations'));
339 }
340
341 if(strlen($this->object->getImportantInformation()))
342 {
343 $info->addProperty($this->lng->txt('crs_important_info'),
344 "<strong>".nl2br(
345 ilUtil::makeClickable($this->object->getImportantInformation(), true)."</strong>"));
346 }
347 if(strlen($this->object->getSyllabus()))
348 {
349 $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(
350 ilUtil::makeClickable ($this->object->getSyllabus(), true)));
351 }
352 // files
353 if(count($files))
354 {
355 $tpl = new ilTemplate('tpl.event_info_file.html',true,true,'Modules/Course');
356
357 foreach($files as $file)
358 {
359 $tpl->setCurrentBlock("files");
360 $this->ctrl->setParameter($this,'file_id',$file->getFileId());
361 $tpl->setVariable("DOWN_LINK",$this->ctrl->getLinkTarget($this,'sendfile'));
362 $tpl->setVariable("DOWN_NAME",$file->getFileName());
363 $tpl->setVariable("DOWN_INFO_TXT",$this->lng->txt('crs_file_size_info'));
364 $tpl->setVariable("DOWN_SIZE",$file->getFileSize());
365 $tpl->setVariable("TXT_BYTES",$this->lng->txt('bytes'));
366 $tpl->parseCurrentBlock();
367 }
368 $info->addProperty($this->lng->txt('crs_file_download'),
369 $tpl->get());
370 }
371
372 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
373 $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO,'crs',$this->object->getId());
374 $record_gui->setInfoObject($info);
375 $record_gui->parse();
376
377 // meta data
378 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
379
380 // contact
381 if($this->object->hasContactData())
382 {
383 $info->addSection($this->lng->txt("crs_contact"));
384 }
385 if(strlen($this->object->getContactName()))
386 {
387 $info->addProperty($this->lng->txt("crs_contact_name"),
388 $this->object->getContactName());
389 }
390 if(strlen($this->object->getContactResponsibility()))
391 {
392 $info->addProperty($this->lng->txt("crs_contact_responsibility"),
393 $this->object->getContactResponsibility());
394 }
395 if(strlen($this->object->getContactPhone()))
396 {
397 $info->addProperty($this->lng->txt("crs_contact_phone"),
398 $this->object->getContactPhone());
399 }
400 if($this->object->getContactEmail())
401 {
402 include_once './Modules/Course/classes/class.ilCourseMailTemplateMemberContext.php';
403 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
404
405 $emails = split(",",$this->object->getContactEmail());
406 foreach ($emails as $email) {
407 $email = trim($email);
408 $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true , 'Modules/Course');
409 $etpl->setVariable(
410 "EMAIL_LINK",
412 $info, 'showSummary', array(),
413 array(
414 'type' => 'new',
415 'rcp_to' => $email,
416 'sig' => $this->createMailSignature()
417 ),
418 array(
420 'ref_id' => $this->object->getRefId(),
421 'ts' => time()
422 )
423 )
424 );
425 $etpl->setVariable("CONTACT_EMAIL", $email);
426 $mailString .= $etpl->get()."<br />";
427 }
428 $info->addProperty($this->lng->txt("crs_contact_email"), $mailString);
429 }
430 if(strlen($this->object->getContactConsultation()))
431 {
432 $info->addProperty($this->lng->txt("crs_contact_consultation"),
433 nl2br($this->object->getContactConsultation()));
434 }
435
436
437 // support contacts
438 $parts = ilParticipants::getInstanceByObjId($this->object->getId());
439 $conts = $parts->getContacts();
440 if (count($conts) > 0)
441 {
442 $info->addSection($this->lng->txt("crs_mem_contacts"));
443 foreach ($conts as $c)
444 {
445 include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
446 $pgui = new ilPublicUserProfileGUI($c);
447 $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
448 $pgui->setEmbedded(true);
449 $info->addProperty("", $pgui->getHTML());
450 }
451 }
452
453
454
455 //
456 // access
457 //
458
459 // #10360
460 $this->lng->loadLanguageModule("rep");
461 $info->addSection($this->lng->txt("rep_activation_availability"));
462 $info->showLDAPRoleGroupMappingInfo();
463
464 // activation
465 if($this->object->getActivationUnlimitedStatus())
466 {
467 $info->addProperty($this->lng->txt("rep_activation_access"),
468 $this->lng->txt('crs_visibility_limitless'));
469 }
470 else
471 {
472 $info->addProperty($this->lng->txt('rep_activation_access'),
474 new ilDateTime($this->object->getActivationStart(),IL_CAL_UNIX),
475 new ilDateTime($this->object->getActivationEnd(),IL_CAL_UNIX)));
476
477 }
478 switch($this->object->getSubscriptionLimitationType())
479 {
481 $txt = $this->lng->txt("crs_info_reg_deactivated");
482 break;
483
484 default:
485 switch($this->object->getSubscriptionType())
486 {
488 $txt = $this->lng->txt("crs_info_reg_confirmation");
489 break;
491 $txt = $this->lng->txt("crs_info_reg_direct");
492 break;
494 $txt = $this->lng->txt("crs_info_reg_password");
495 break;
496 }
497 }
498
499 // subscription
500 $info->addProperty($this->lng->txt("crs_info_reg"),$txt);
501
502
503 if($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED)
504 {
505 if($this->object->getSubscriptionUnlimitedStatus())
506 {
507 $info->addProperty($this->lng->txt("crs_reg_until"),
508 $this->lng->txt('crs_unlimited'));
509 }
510 elseif($this->object->getSubscriptionStart() < time())
511 {
512 $info->addProperty($this->lng->txt("crs_reg_until"),
513 $this->lng->txt('crs_to').' '.
514 ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(),IL_CAL_UNIX)));
515 }
516 elseif($this->object->getSubscriptionStart() > time())
517 {
518 $info->addProperty($this->lng->txt("crs_reg_until"),
519 $this->lng->txt('crs_from').' '.
520 ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(),IL_CAL_UNIX)));
521 }
522 if ($this->object->isSubscriptionMembershipLimited())
523 {
524 if($this->object->getSubscriptionMinMembers())
525 {
526 $info->addProperty(
527 $this->lng->txt("mem_min_users"),
528 $this->object->getSubscriptionMinMembers()
529 );
530 }
531 if($this->object->getSubscriptionMaxMembers())
532 {
533 include_once './Modules/Course/classes/class.ilObjCourseAccess.php';
534 $reg_info = ilObjCourseAccess::lookupRegistrationInfo($this->object->getId());
535
536 $info->addProperty(
537 $this->lng->txt('mem_free_places'),
538 $reg_info['reg_info_free_places']
539 );
540 }
541 }
542 }
543
544 if($this->object->getCancellationEnd())
545 {
546 $info->addProperty($this->lng->txt('crs_cancellation_end'),
547 ilDatePresentation::formatDate( $this->object->getCancellationEnd()));
548 }
549
550 if($this->object->getCourseStart())
551 {
552 $info->addProperty($this->lng->txt('crs_period'),
554 $this->object->getCourseStart(),
555 $this->object->getCourseEnd()
556 ));
557 }
558
559 // archive
560 if($this->object->getViewMode() == IL_CRS_VIEW_ARCHIVE)
561 {
562 if($this->object->getArchiveType() != IL_CRS_ARCHIVE_NONE)
563 {
564 $info->addProperty($this->lng->txt("crs_archive"),
566 new ilDateTime($this->object->getArchiveStart(),IL_CAL_UNIX),
567 new ilDateTime($this->object->getArchiveStart(),IL_CAL_UNIX)));
568 }
569 }
570 // Confirmation
571 include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
573
574 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
575 if($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledCourseExport())
576 {
577 include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
578
579 $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
580
581 $this->lng->loadLanguageModule('ps');
582 $info->addSection($this->lng->txt('crs_user_agreement_info'));
583 $info->addProperty($this->lng->txt('ps_export_data'),$field_info->exportableFieldsToInfoString());
584
585 if($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId()))
586 {
587 $info->addProperty($this->lng->txt('ps_crs_user_fields'),$fields);
588 }
589 }
590
591 $info->enableLearningProgress(true);
592
593 // forward the command
594 $this->ctrl->forwardCommand($info);
595 }
596
601 {
602 include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
603 $noti = new ilMembershipNotifications($this->ref_id);
604 if($noti->canCurrentUserEdit())
605 {
606 if((bool)$_REQUEST["crs_ntf"])
607 {
608 $noti->activateUser();
609 }
610 else
611 {
612 $noti->deactivateUser();
613 }
614 }
615 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
616 $this->ctrl->redirect($this, "");
617 }
618
625 public function editInfoObject(ilPropertyFormGUI $a_form = null)
626 {
627 include_once 'Modules/Course/classes/class.ilCourseFile.php';
628
629 global $ilErr,$ilAccess;
630
631 $this->checkPermission('write');
632 /*
633 if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
634 {
635 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
636 }
637 */
638 $this->setSubTabs('properties');
639 $this->tabs_gui->setTabActive('settings');
640 $this->tabs_gui->setSubTabActive('crs_info_settings');
641
642 if(!$a_form)
643 {
644 $a_form = $this->initInfoEditor();
645 }
646 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.edit_info.html','Modules/Course');
647 $this->tpl->setVariable('INFO_TABLE',$a_form->getHTML());
648
649 if(!count($files = ilCourseFile::_readFilesByCourse($this->object->getId())))
650 {
651 return true;
652 }
653 $rows = array();
654 foreach($files as $file)
655 {
656 $table_data['id'] = $file->getFileId();
657 $table_data['filename'] = $file->getFileName();
658 $table_data['filetype'] = $file->getFileType();
659 $table_data['filesize'] = $file->getFileSize();
660
661 $rows[] = $table_data;
662 }
663
664 include_once("./Modules/Course/classes/class.ilCourseInfoFileTableGUI.php");
665 $table_gui = new ilCourseInfoFileTableGUI($this, "edit");
666 $table_gui->setTitle($this->lng->txt("crs_info_download"));
667 $table_gui->setData($rows);
668 $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
669 $table_gui->addMultiCommand("confirmDeleteInfoFiles", $this->lng->txt("delete"));
670 $table_gui->setSelectAllCheckbox("file_id");
671 $this->tpl->setVariable('INFO_FILE_TABLE',$table_gui->getHTML());
672
673 return true;
674
675 }
676
685 {
686 if(!count($_POST['file_id']))
687 {
688 ilUtil::sendFailure($this->lng->txt('select_one'));
689 $this->editInfoObject();
690 return false;
691 }
692
693 $this->setSubTabs('properties');
694 $this->tabs_gui->setTabActive('settings');
695 $this->tabs_gui->setSubTabActive('crs_info_settings');
696
697 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
698 $c_gui = new ilConfirmationGUI();
699
700 // set confirm/cancel commands
701 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteInfoFiles"));
702 $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
703 $c_gui->setCancel($this->lng->txt("cancel"), "editInfo");
704 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteInfoFiles");
705
706 // add items to delete
707 include_once('Modules/Course/classes/class.ilCourseFile.php');
708 foreach($_POST["file_id"] as $file_id)
709 {
710 $file = new ilCourseFile($file_id);
711 $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
712 }
713
714 $this->tpl->setContent($c_gui->getHTML());
715 }
716
723 public function deleteInfoFilesObject()
724 {
725 if(!count($_POST['file_id']))
726 {
727 ilUtil::sendFailure($this->lng->txt('select_one'));
728 $this->editInfoObject();
729 return false;
730 }
731 include_once('Modules/Course/classes/class.ilCourseFile.php');
732
733 foreach($_POST['file_id'] as $file_id)
734 {
735 $file = new ilCourseFile($file_id);
736 if($this->object->getId() == $file->getCourseId())
737 {
738 $file->delete();
739 }
740 }
741 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
742 $this->editInfoObject();
743 return true;
744 }
745
753 public function initInfoEditor()
754 {
755 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
756 $form = new ilPropertyFormGUI();
757 $form->setFormAction($this->ctrl->getFormAction($this,'updateInfo'));
758 $form->setMultipart(true);
759 $form->setTitle($this->lng->txt('crs_general_info'));
760 $form->addCommandButton('updateInfo',$this->lng->txt('save'));
761 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
762
763 $area = new ilTextAreaInputGUI($this->lng->txt('crs_important_info'),'important');
764 $area->setValue($this->object->getImportantInformation());
765 $area->setRows(6);
766 $area->setCols(80);
767 $form->addItem($area);
768
769 $area = new ilTextAreaInputGUI($this->lng->txt('crs_syllabus'),'syllabus');
770 $area->setValue($this->object->getSyllabus());
771 $area->setRows(6);
772 $area->setCols(80);
773 $form->addItem($area);
774
776 $section->setTitle($this->lng->txt('crs_info_download'));
777 $form->addItem($section);
778
779 $file = new ilFileInputGUI($this->lng->txt('crs_file'),'file');
780 $file->enableFileNameSelection('file_name');
781 $form->addItem($file);
782
784 $section->setTitle($this->lng->txt('crs_contact'));
785 $form->addItem($section);
786
787 $text = new ilTextInputGUI($this->lng->txt('crs_contact_name'),'contact_name');
788 $text->setValue($this->object->getContactName());
789 $text->setSize(40);
790 $text->setMaxLength(70);
791 $form->addItem($text);
792
793 $text = new ilTextInputGUI($this->lng->txt('crs_contact_responsibility'),'contact_responsibility');
794 $text->setValue($this->object->getContactResponsibility());
795 $text->setSize(40);
796 $text->setMaxLength(70);
797 $form->addItem($text);
798
799 $text = new ilTextInputGUI($this->lng->txt('crs_contact_phone'),'contact_phone');
800 $text->setValue($this->object->getContactPhone());
801 $text->setSize(40);
802 $text->setMaxLength(40);
803 $form->addItem($text);
804
805 $text = new ilTextInputGUI($this->lng->txt('crs_contact_email'),'contact_email');
806 $text->setValue($this->object->getContactEmail());
807 $text->setInfo($this->lng->txt('crs_contact_email_info'));
808 $text->setSize(40);
809 $text->setMaxLength(255);
810 $form->addItem($text);
811
812 $area = new ilTextAreaInputGUI($this->lng->txt('crs_contact_consultation'),'contact_consultation');
813 $area->setValue($this->object->getContactConsultation());
814 $area->setRows(6);
815 $area->setCols(80);
816 $form->addItem($area);
817
818 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
819 $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR,'crs',$this->object->getId());
820 $this->record_gui->setPropertyForm($form);
821 $this->record_gui->parse();
822
823 return $form;
824 }
825
827 {
828 global $ilErr,$ilAccess;
829
830 $this->checkPermission('write');
831
832 include_once 'Modules/Course/classes/class.ilCourseFile.php';
833 $file_obj = new ilCourseFile();
834 $file_obj->setCourseId($this->object->getId());
835 $file_obj->setFileName(strlen($_POST['file_name']) ?
836 ilUtil::stripSlashes($_POST['file_name']) :
837 $_FILES['file']['name']);
838 $file_obj->setFileSize($_FILES['file']['size']);
839 $file_obj->setFileType($_FILES['file']['type']);
840 $file_obj->setTemporaryName($_FILES['file']['tmp_name']);
841 $file_obj->setErrorCode($_FILES['file']['error']);
842
843 $this->object->setImportantInformation(ilUtil::stripSlashes($_POST['important']));
844 $this->object->setSyllabus(ilUtil::stripSlashes($_POST['syllabus']));
845 $this->object->setContactName(ilUtil::stripSlashes($_POST['contact_name']));
846 $this->object->setContactResponsibility(ilUtil::stripSlashes($_POST['contact_responsibility']));
847 $this->object->setContactPhone(ilUtil::stripSlashes($_POST['contact_phone']));
848 $this->object->setContactEmail(ilUtil::stripSlashes($_POST['contact_email']));
849 $this->object->setContactConsultation(ilUtil::stripSlashes($_POST['contact_consultation']));
850
851
852 // validate
853
854 $error = false;
855 $ilErr->setMessage('');
856
857 $file_obj->validate();
858 $this->object->validateInfoSettings();
859 if(strlen($ilErr->getMessage()))
860 {
861 $error = $ilErr->getMessage();
862 }
863
864 // needed for proper advanced MD validation
865 $form = $this->initInfoEditor();
866 $form->checkInput();
867 if(!$this->record_gui->importEditFormPostValues())
868 {
869 $error = true;
870 }
871
872 if($error)
873 {
874 if($error !== true)
875 {
876 ilUtil::sendFailure($ilErr->getMessage());
877 }
878 $this->editInfoObject($form);
879 return false;
880 }
881
882 $this->object->update();
883 $file_obj->create();
884 $this->record_gui->writeEditForm();
885
886
887 // Update ecs content
888 include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
889 $ecs = new ilECSCourseSettings($this->object);
890 $ecs->handleContentUpdate();
891
892 ilUtil::sendSuccess($this->lng->txt("crs_settings_saved"));
893 $this->editInfoObject();
894 return true;
895 }
896
897 function updateObject()
898 {
899 $form = $this->initEditForm();
900 $form->checkInput();
901
902 $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
903 $this->object->setDescription(ilUtil::stripSlashes($_POST['desc']));
904
905 /*
906 $archive_start = $this->loadDate('archive_start');
907 $archive_end = $this->loadDate('archive_end');
908 */
909 $period = $form->getItemByPostVar("access_period");
910 $sub_period = $form->getItemByPostVar("subscription_period");
911
912 if((int)$_POST['activation_type'])
913 {
914 $this->object->setActivationType(IL_CRS_ACTIVATION_LIMITED);
915 }
916 else
917 {
918 $this->object->setActivationType(IL_CRS_ACTIVATION_UNLIMITED);
919 }
920 $this->object->setOfflineStatus(!(bool)$_POST['activation_online']);
921 $this->object->setActivationStart($period->getStart()->get(IL_CAL_UNIX));
922 $this->object->setActivationEnd($period->getEnd()->get(IL_CAL_UNIX));
923 $this->object->setActivationVisibility((int)$_POST['activation_visibility']);
924
925 $sub_type = (int)$_POST['subscription_type'];
926 if($sub_type != IL_CRS_SUBSCRIPTION_DEACTIVATED)
927 {
928 $this->object->setSubscriptionType($sub_type);
929
930 if((int)$_POST['subscription_limitation_type'])
931 {
932 $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_LIMITED);
933 }
934 else
935 {
936 $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_UNLIMITED);
937 }
938 }
939 else
940 {
941 $this->object->setSubscriptionType(IL_CRS_SUBSCRIPTION_DIRECT); // see ilObjCourse::__createDefaultSettings()
942 $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
943 }
944
945 // save subitems anyways
946 $this->object->setSubscriptionPassword(ilUtil::stripSlashes($_POST['subscription_password']));
947 $this->object->setSubscriptionStart($sub_period->getStart()->get(IL_CAL_UNIX));
948 $this->object->setSubscriptionEnd($sub_period->getEnd()->get(IL_CAL_UNIX));
949
950 $this->object->enableRegistrationAccessCode((int) $_POST['reg_code_enabled']);
951 $this->object->setRegistrationAccessCode(ilUtil::stripSlashes($_POST['reg_code']));
952
953 $cancel_end = $form->getItemByPostVar("cancel_end");
954 if($_POST[$cancel_end->getActivationPostVar()])
955 {
956 $dt = $cancel_end->getDate()->get(IL_CAL_DATETIME);
957 $this->object->setCancellationEnd(new ilDate($dt, IL_CAL_DATETIME));
958 }
959 else
960 {
961 $this->object->setCancellationEnd(null);
962 }
963
964 $this->object->enableSubscriptionMembershipLimitation((int) $_POST['subscription_membership_limitation']);
965 $this->object->setSubscriptionMaxMembers((int) $_POST['subscription_max']);
966 $this->object->setSubscriptionMinMembers((int)$_POST['subscription_min']);
967
968 $old_autofill = $this->object->hasWaitingListAutoFill();
969
970 switch((int) $_POST['waiting_list'])
971 {
972 case 2:
973 $this->object->enableWaitingList(true);
974 $this->object->setWaitingListAutoFill(true);
975 break;
976
977 case 1:
978 $this->object->enableWaitingList(true);
979 $this->object->setWaitingListAutoFill(false);
980 break;
981
982 default:
983 $this->object->enableWaitingList(false);
984 $this->object->setWaitingListAutoFill(false);
985 break;
986 }
987
988 #$this->object->setSubscriptionNotify((int) $_POST['subscription_notification']);
989
990 if((bool)$_POST["period_tgl"])
991 {
992 $crs_period = $form->getItemByPostVar("period");
993 $this->object->setCourseStart($crs_period->getStart());
994 $this->object->setCourseEnd($crs_period->getEnd());
995 }
996 else
997 {
998 $this->object->setCourseStart(null);
999 $this->object->setCourseEnd(null);
1000 }
1001
1002 $this->object->setViewMode((int) $_POST['view_mode']);
1003
1004 if($this->object->getViewMode() == IL_CRS_VIEW_TIMING)
1005 {
1006 $this->object->setOrderType(ilContainer::SORT_ACTIVATION);
1007 }
1008 else
1009 {
1010 $this->object->setOrderType($form->getInput('sorting'));
1011 }
1012 $this->saveSortingSettings($form);
1013
1014 /*
1015 $this->object->setArchiveStart($archive_start->get(IL_CAL_UNIX));
1016 $this->object->setArchiveEnd($archive_end->get(IL_CAL_UNIX));
1017 $this->object->setArchiveType($_POST['archive_type']);
1018 */
1019 $this->object->setAboStatus((int) $_POST['abo']);
1020 $this->object->setShowMembers((int) $_POST['show_members']);
1021 $this->object->setMailToMembersType((int) $_POST['mail_type']);
1022
1023 $this->object->enableSessionLimit((int) $_POST['sl']);
1024 $this->object->setNumberOfPreviousSessions(is_numeric($_POST['sp']) ? (int) $_POST['sp'] : -1 );
1025 $this->object->setNumberOfnextSessions(is_numeric($_POST['sn']) ? (int) $_POST['sn'] : -1 );
1026
1027 $this->object->setAutoNotification($_POST['auto_notification'] == 1 ? true : false);
1028
1029
1030 $show_lp_sync_confirmation = false;
1031
1032 // could be hidden in form
1033 if(isset($_POST['status_dt']))
1034 {
1035 if($this->object->getStatusDetermination() != ilObjCourse::STATUS_DETERMINATION_LP &&
1036 (int)$_POST['status_dt'] == ilObjCourse::STATUS_DETERMINATION_LP)
1037 {
1038 $show_lp_sync_confirmation = true;
1039 }
1040 else
1041 {
1042 $this->object->setStatusDetermination((int)$_POST['status_dt']);
1043 }
1044 }
1045
1046 if($this->object->validate())
1047 {
1048 $this->object->update();
1049
1050 // if autofill has been activated trigger process
1051 if(!$old_autofill &&
1052 $this->object->hasWaitingListAutoFill())
1053 {
1054 $this->object->handleAutoFill();
1055 }
1056
1057 // BEGIN ChangeEvent: Record write event
1058 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1059 global $ilUser;
1060 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
1061 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
1062 // END ChangeEvent: Record write event
1063
1064
1065 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
1067 $this->object->getId(),
1068 $form,
1069 array(
1075 )
1076 );
1077
1078 // Update ecs export settings
1079 include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
1080 $ecs = new ilECSCourseSettings($this->object);
1081 if(!$ecs->handleSettingsUpdate())
1082 {
1083 $this->editObject();
1084 return false;
1085 }
1086
1087 if($show_lp_sync_confirmation)
1088 {
1089 return $this->confirmLPSync();
1090 }
1091
1092 return $this->afterUpdate();
1093 }
1094 else
1095 {
1096 ilUtil::sendFailure($this->object->getMessage());
1097 $this->editObject();
1098 return false;
1099 }
1100 }
1101
1102 protected function confirmLPSync()
1103 {
1104 global $tpl;
1105
1106 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1107 $cgui = new ilConfirmationGUI();
1108 $cgui->setFormAction($this->ctrl->getFormAction($this, "setLPSync"));
1109 $cgui->setHeaderText($this->lng->txt("crs_status_determination_sync"));
1110 $cgui->setCancel($this->lng->txt("cancel"), "edit");
1111 $cgui->setConfirm($this->lng->txt("confirm"), "setLPSync");
1112
1113 $tpl->setContent($cgui->getHTML());
1114 }
1115
1116 protected function setLPSyncObject()
1117 {
1118 $this->object->setStatusDetermination(ilObjCourse::STATUS_DETERMINATION_LP);
1119 $this->object->update();
1120
1121 $this->object->syncMembersStatusWithLP();
1122
1123 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1124 $this->ctrl->redirect($this, "edit");
1125 }
1126
1133 public function editObject()
1134 {
1135 parent::editObject();
1136
1137 $this->setSubTabs('properties');
1138 $this->tabs_gui->setSubTabActive('crs_settings');
1139 }
1140
1148 protected function initEditForm()
1149 {
1150 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1151 include_once('./Services/Calendar/classes/class.ilDateTime.php');
1152
1153 $form = new ilPropertyFormGUI();
1154 $form->setTitle($this->lng->txt('crs_edit'));
1155
1156 $form->addCommandButton('update',$this->lng->txt('save'));
1157 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
1158
1159 $form->setFormAction($this->ctrl->getFormAction($this,'update'));
1160
1161 // title
1162 $title = new ilTextInputGUI($this->lng->txt('title'),'title');
1163 $title->setSubmitFormOnEnter(true);
1164 $title->setValue($this->object->getTitle());
1165 $title->setSize(min(40, ilObject::TITLE_LENGTH));
1166 $title->setMaxLength(ilObject::TITLE_LENGTH);
1167 $title->setRequired(true);
1168 $form->addItem($title);
1169
1170 // desc
1171 $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'desc');
1172 $desc->setValue($this->object->getLongDescription());
1173 $desc->setRows(2);
1174 $desc->setCols(40);
1175 $form->addItem($desc);
1176
1177 // Show didactic template type
1178 $this->initDidacticTemplate($form);
1179
1180 // period
1181 $cdur_tgl = new ilCheckboxInputGUI($this->lng->txt('crs_period'),'period_tgl');
1182 $cdur_tgl->setInfo($this->lng->txt('crs_period_info'));
1183 $cdur_tgl->setChecked($this->object->getCourseStart());
1184 $form->addItem($cdur_tgl);
1185
1186 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
1187 $cdur = new ilDateDurationInputGUI('', 'period');
1188 $cdur->setStartText($this->lng->txt('crs_start'));
1189 $cdur->setEndText($this->lng->txt('crs_end'));
1190 if($this->object->getCourseStart())
1191 {
1192 $cdur->setStart($this->object->getCourseStart());
1193 }
1194 if($this->object->getCourseStart())
1195 {
1196 $cdur->setEnd($this->object->getCourseEnd());
1197 }
1198 $cdur_tgl->addSubItem($cdur);
1199
1200
1201 // activation/availability
1202
1203 $this->lng->loadLanguageModule('rep');
1204
1206 $section->setTitle($this->lng->txt('rep_activation_availability'));
1207 $form->addItem($section);
1208
1209 $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'),'activation_online');
1210 $online->setChecked(!$this->object->getOfflineStatus());
1211 $online->setInfo($this->lng->txt('crs_activation_online_info'));
1212 $form->addItem($online);
1213
1214 $act_type = new ilCheckboxInputGUI($this->lng->txt('crs_visibility_until'), 'activation_type');
1215 $act_type->setInfo($this->lng->txt('crs_visibility_until_info'));
1216 $act_type->setChecked($this->object->getActivationType() == IL_CRS_ACTIVATION_LIMITED);
1217 // $act_type->setInfo($this->lng->txt('crs_availability_until_info'));
1218
1219 $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
1220 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
1221 $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
1222 $dur->setShowTime(true);
1223 $dur->setStart(new ilDateTime($this->object->getActivationStart(),IL_CAL_UNIX));
1224 $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
1225 $dur->setEnd(new ilDateTime($this->object->getActivationEnd(),IL_CAL_UNIX));
1226 $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
1227 $act_type->addSubItem($dur);
1228
1229 $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility');
1230 $visible->setInfo($this->lng->txt('crs_activation_limited_visibility_info'));
1231 $visible->setChecked($this->object->getActivationVisibility());
1232 $act_type->addSubItem($visible);
1233
1234 $form->addItem($act_type);
1235
1236
1238 $section->setTitle($this->lng->txt('crs_reg'));
1239 $form->addItem($section);
1240
1241 $reg_proc = new ilRadioGroupInputGUI($this->lng->txt('crs_registration_type'),'subscription_type');
1242 $reg_proc->setValue(
1243 ($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED)
1244 ? $this->object->getSubscriptionType()
1246 // $reg_proc->setInfo($this->lng->txt('crs_reg_type_info'));
1247
1248 $opt = new ilRadioOption($this->lng->txt('crs_subscription_options_direct'),IL_CRS_SUBSCRIPTION_DIRECT);
1249 $reg_proc->addOption($opt);
1250
1251 $opt = new ilRadioOption($this->lng->txt('crs_subscription_options_password'),IL_CRS_SUBSCRIPTION_PASSWORD);
1252
1253 $pass = new ilTextInputGUI($this->lng->txt("password"),'subscription_password');
1254 $pass->setInfo($this->lng->txt('crs_reg_password_info'));
1255 $pass->setSubmitFormOnEnter(true);
1256 $pass->setSize(12);
1257 $pass->setMaxLength(12);
1258 $pass->setValue($this->object->getSubscriptionPassword());
1259
1260 $opt->addSubItem($pass);
1261 $reg_proc->addOption($opt);
1262
1263 $opt = new ilRadioOption($this->lng->txt('crs_subscription_options_confirmation'),IL_CRS_SUBSCRIPTION_CONFIRMATION);
1264 $opt->setInfo($this->lng->txt('crs_registration_confirmation_info'));
1265 $reg_proc->addOption($opt);
1266
1267 $opt = new ilRadioOption($this->lng->txt('crs_reg_no_selfreg'),IL_CRS_SUBSCRIPTION_DEACTIVATED);
1268 $opt->setInfo($this->lng->txt('crs_registration_deactivated'));
1269 $reg_proc->addOption($opt);
1270
1271 $form->addItem($reg_proc);
1272
1273
1274 // Registration codes
1275 $reg_code = new ilCheckboxInputGUI($this->lng->txt('crs_reg_code'),'reg_code_enabled');
1276 $reg_code->setChecked($this->object->isRegistrationAccessCodeEnabled());
1277 $reg_code->setValue(1);
1278 $reg_code->setInfo($this->lng->txt('crs_reg_code_enabled_info'));
1279
1280 /*
1281 $code = new ilNonEditableValueGUI($this->lng->txt('crs_reg_code_value'));
1282 $code->setValue($this->object->getRegistrationAccessCode());
1283 $reg_code->addSubItem($code);
1284 */
1285
1286 #$link = new ilNonEditableValueGUI($this->lng->txt('crs_reg_code_link'));
1287 // Create default access code
1288 if(!$this->object->getRegistrationAccessCode())
1289 {
1290 include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1291 $this->object->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1292 }
1293 $reg_link = new ilHiddenInputGUI('reg_code');
1294 $reg_link->setValue($this->object->getRegistrationAccessCode());
1295 $form->addItem($reg_link);
1296
1297 $link = new ilCustomInputGUI($this->lng->txt('crs_reg_code_link'));
1298 include_once './Services/Link/classes/class.ilLink.php';
1299 $val = ilLink::_getLink($this->object->getRefId(),$this->object->getType(),array(),'_rcode'.$this->object->getRegistrationAccessCode());
1300 $link->setHTML('<font class="small">'.$val.'</font>');
1301 $reg_code->addSubItem($link);
1302
1303 $form->addItem($reg_code);
1304
1305
1306 // time limit
1307 $time_limit = new ilCheckboxInputGUI($this->lng->txt('crs_registration_limited'),'subscription_limitation_type');
1308 $time_limit->setInfo($this->lng->txt('crs_registration_limited_info'));
1309 $time_limit->setChecked(($this->object->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_LIMITED) ? true : false);
1310
1311 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
1312 $sdur = new ilDateDurationInputGUI($this->lng->txt('crs_registration_period'), "subscription_period");
1313 $sdur->setShowTime(true);
1314 $sdur->setStart(new ilDateTime($this->object->getSubscriptionStart(),IL_CAL_UNIX));
1315 $sdur->setStartText($this->lng->txt('crs_start'));
1316 $sdur->setEnd(new ilDateTime($this->object->getSubscriptionEnd(),IL_CAL_UNIX));
1317 $sdur->setEndText($this->lng->txt('crs_end'));
1318
1319 $time_limit->addSubItem($sdur);
1320 $form->addItem($time_limit);
1321
1322 // cancellation limit
1323 $cancel = new ilDateTimeInputGUI($this->lng->txt('crs_cancellation_end'), 'cancel_end');
1324 $cancel->setInfo($this->lng->txt('crs_cancellation_end_info'));
1325 $cancel_end = $this->object->getCancellationEnd();
1326 $cancel->enableDateActivation('', 'cancel_end_tgl', (bool)$cancel_end);
1327 if($cancel_end)
1328 {
1329 $cancel->setDate($cancel_end);
1330 }
1331 $form->addItem($cancel);
1332
1333 // Max members
1334 $lim = new ilCheckboxInputGUI($this->lng->txt('crs_subscription_max_members_short'),'subscription_membership_limitation');
1335 $lim->setInfo($this->lng->txt('crs_subscription_max_members_short_info'));
1336 $lim->setValue(1);
1337 $lim->setChecked($this->object->isSubscriptionMembershipLimited());
1338
1339 $min = new ilTextInputGUI('','subscription_min');
1340 $min->setSubmitFormOnEnter(true);
1341 $min->setSize(4);
1342 $min->setMaxLength(4);
1343 $min->setValue($this->object->getSubscriptionMinMembers() ? $this->object->getSubscriptionMinMembers() : '');
1344 $min->setTitle($this->lng->txt('crs_subscription_min_members'));
1345 $min->setInfo($this->lng->txt('crs_subscription_min_members_info'));
1346 $lim->addSubItem($min);
1347
1348 $max = new ilTextInputGUI('','subscription_max');
1349 $max->setSubmitFormOnEnter(true);
1350 $max->setSize(4);
1351 $max->setMaxLength(4);
1352 $max->setValue($this->object->getSubscriptionMaxMembers() ? $this->object->getSubscriptionMaxMembers() : '');
1353 $max->setTitle($this->lng->txt('crs_subscription_max_members'));
1354 $max->setInfo($this->lng->txt('crs_reg_max_info'));
1355
1356 $lim->addSubItem($max);
1357
1358 /*
1359 $wait = new ilCheckboxInputGUI($this->lng->txt('crs_waiting_list'),'waiting_list');
1360 $wait->setChecked($this->object->enabledWaitingList());
1361 $wait->setInfo($this->lng->txt('crs_wait_info'));
1362 $lim->addSubItem($wait);
1363
1364 $wait = new ilCheckboxInputGUI($this->lng->txt('crs_waiting_list'),'waiting_list');
1365 $wait->setChecked($this->object->enabledWaitingList());
1366 $wait->setInfo($this->lng->txt('crs_wait_info'));
1367 $lim->addSubItem($wait);
1368
1369 $auto = new ilCheckboxInputGUI($this->lng->txt('crs_waiting_list_autofill'), 'auto_wait');
1370 $auto->setChecked($this->object->hasWaitingListAutoFill());
1371 $auto->setInfo($this->lng->txt('crs_waiting_list_autofill_info'));
1372 $wait->addSubItem($auto);
1373 */
1374
1375 $wait = new ilRadioGroupInputGUI($this->lng->txt('crs_waiting_list'), 'waiting_list');
1376
1377 $option = new ilRadioOption($this->lng->txt('none'), 0);
1378 $wait->addOption($option);
1379
1380 $option = new ilRadioOption($this->lng->txt('crs_waiting_list_no_autofill'), 1);
1381 $option->setInfo($this->lng->txt('crs_wait_info'));
1382 $wait->addOption($option);
1383
1384 $option = new ilRadioOption($this->lng->txt('crs_waiting_list_autofill'), 2);
1385 $option->setInfo($this->lng->txt('crs_waiting_list_autofill_info'));
1386 $wait->addOption($option);
1387
1388 if($this->object->hasWaitingListAutoFill())
1389 {
1390 $wait->setValue(2);
1391 }
1392 else if($this->object->enabledWaitingList())
1393 {
1394 $wait->setValue(1);
1395 }
1396
1397 $lim->addSubItem($wait);
1398
1399 $form->addItem($lim);
1400
1401
1402 $pres = new ilFormSectionHeaderGUI();
1403 $pres->setTitle($this->lng->txt('crs_view_mode'));
1404
1405 $form->addItem($pres);
1406
1407 // presentation type
1408 $view_type = new ilRadioGroupInputGUI($this->lng->txt('crs_presentation_type'),'view_mode');
1409 $view_type->setValue($this->object->getViewMode());
1410
1411 $opts = new ilRadioOption($this->lng->txt('cntr_view_sessions'),IL_CRS_VIEW_SESSIONS);
1412 $opts->setInfo($this->lng->txt('cntr_view_info_sessions'));
1413 $view_type->addOption($opts);
1414
1415 // Limited sessions
1416 $sess = new ilCheckboxInputGUI($this->lng->txt('sess_limit'),'sl');
1417 $sess->setValue(1);
1418 $sess->setChecked($this->object->isSessionLimitEnabled());
1419 $sess->setInfo($this->lng->txt('sess_limit_info'));
1420
1421 $prev = new ilNumberInputGUI($this->lng->txt('sess_num_prev'),'sp');
1422 #$prev->setSubmitFormOnEnter(true);
1423 $prev->setMinValue(0);
1424 $prev->setValue($this->object->getNumberOfPreviousSessions() == -1 ?
1425 '' :
1426 $this->object->getNumberOfPreviousSessions()
1427 );
1428 $prev->setSize(2);
1429 $prev->setMaxLength(3);
1430 $sess->addSubItem($prev);
1431
1432 $next = new ilNumberInputGUI($this->lng->txt('sess_num_next'),'sn');
1433 #$next->setSubmitFormOnEnter(true);
1434 $next->setMinValue(0);
1435 $next->setValue($this->object->getNumberOfNextSessions() == -1 ?
1436 '' :
1437 $this->object->getNumberOfnextSessions()
1438 );
1439 $next->setSize(2);
1440 $next->setMaxLength(3);
1441 $sess->addSubItem($next);
1442
1443 $opts->addSubItem($sess);
1444
1445
1446
1447
1448 $optsi = new ilRadioOption($this->lng->txt('cntr_view_simple'),IL_CRS_VIEW_SIMPLE);
1449 $optsi->setInfo($this->lng->txt('cntr_view_info_simple'));
1450 $view_type->addOption($optsi);
1451
1452 $optbt = new ilRadioOption($this->lng->txt('cntr_view_by_type'),IL_CRS_VIEW_BY_TYPE);
1453 $optbt->setInfo($this->lng->txt('cntr_view_info_by_type'));
1454 $view_type->addOption($optbt);
1455
1456 $opto = new ilRadioOption($this->lng->txt('crs_view_objective'),IL_CRS_VIEW_OBJECTIVE);
1457 $opto->setInfo($this->lng->txt('crs_view_info_objective'));
1458 $view_type->addOption($opto);
1459
1460 $optt = new ilRadioOption($this->lng->txt('crs_view_timing'),IL_CRS_VIEW_TIMING);
1461 $optt->setInfo($this->lng->txt('crs_view_info_timing'));
1462 $view_type->addOption($optt);
1463
1464 $form->addItem($view_type);
1465
1466 $this->initSortingForm(
1467 $form,
1468 array(
1473 )
1474 );
1475
1476
1477
1478 // lp vs. course status
1479 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1481 {
1482 include_once './Services/Object/classes/class.ilObjectLP.php';
1483 $olp = ilObjectLP::getInstance($this->object->getId());
1484 if($olp->getCurrentMode())
1485 {
1486 $lp_status = new ilFormSectionHeaderGUI();
1487 $lp_status->setTitle($this->lng->txt('crs_course_status_of_users'));
1488 $form->addItem($lp_status);
1489
1490 $lp_status_options = new ilRadioGroupInputGUI($this->lng->txt('crs_status_determination'), "status_dt");
1491// $lp_status_options->setRequired(true);
1492 $lp_status_options->setValue($this->object->getStatusDetermination());
1493
1494 $lp_option = new ilRadioOption($this->lng->txt('crs_status_determination_lp'),
1495 ilObjCourse::STATUS_DETERMINATION_LP, $this->lng->txt('crs_status_determination_lp_info'));
1496 $lp_status_options->addOption($lp_option);
1497 $lp_status_options->addOption(new ilRadioOption($this->lng->txt('crs_status_determination_manual'),
1499
1500 $form->addItem($lp_status_options);
1501 }
1502 }
1503
1504 // additional features
1505 $feat = new ilFormSectionHeaderGUI();
1506 $feat->setTitle($this->lng->txt('obj_features'));
1507 $form->addItem($feat);
1508
1509 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
1511 $this->object->getId(),
1512 $form,
1513 array(
1519 )
1520 );
1521
1522 $mem = new ilCheckboxInputGUI($this->lng->txt('crs_show_members'),'show_members');
1523 $mem->setChecked($this->object->getShowMembers());
1524 $mem->setInfo($this->lng->txt('crs_show_members_info'));
1525 $form->addItem($mem);
1526
1527 // Show members type
1528 $mail_type = new ilRadioGroupInputGUI($this->lng->txt('crs_mail_type'), 'mail_type');
1529 $mail_type->setValue($this->object->getMailToMembersType());
1530
1531 $mail_tutors = new ilRadioOption($this->lng->txt('crs_mail_tutors_only'), ilCourseConstants::MAIL_ALLOWED_TUTORS,
1532 $this->lng->txt('crs_mail_tutors_only_info'));
1533 $mail_type->addOption($mail_tutors);
1534
1535 $mail_all = new ilRadioOption($this->lng->txt('crs_mail_all'), ilCourseConstants::MAIL_ALLOWED_ALL,
1536 $this->lng->txt('crs_mail_all_info'));
1537 $mail_type->addOption($mail_all);
1538 $form->addItem($mail_type);
1539
1540 // Notification Settings
1541 /*$notification = new ilFormSectionHeaderGUI();
1542 $notification->setTitle($this->lng->txt('crs_notification'));
1543 $form->addItem($notification);*/
1544
1545 // Self notification
1546 $not = new ilCheckboxInputGUI($this->lng->txt('crs_auto_notification'), 'auto_notification');
1547 $not->setValue(1);
1548 $not->setInfo($this->lng->txt('crs_auto_notification_info'));
1549 $not->setChecked( $this->object->getAutoNotification() );
1550 $form->addItem($not);
1551
1552
1553 // Further information
1554 //$further = new ilFormSectionHeaderGUI();
1555 //$further->setTitle($this->lng->txt('crs_further_settings'));
1556 //$form->addItem($further);
1557
1558 $desk = new ilCheckboxInputGUI($this->lng->txt('crs_add_remove_from_desktop'),'abo');
1559 $desk->setChecked($this->object->getAboStatus());
1560 $desk->setInfo($this->lng->txt('crs_add_remove_from_desktop_info'));
1561 $form->addItem($desk);
1562
1563
1564 // Edit ecs export settings
1565 include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
1566 $ecs = new ilECSCourseSettings($this->object);
1567 $ecs->addSettingsToForm($form, 'crs');
1568
1569 return $form;
1570 }
1571
1572 protected function getEditFormValues()
1573 {
1574 // values are done in initEditForm()
1575 }
1576
1580 function editCourseIconsObject($a_form = null)
1581 {
1582 global $tpl;
1583
1584 $this->checkPermission('write');
1585
1586 $this->setSubTabs("properties");
1587 $this->tabs_gui->setTabActive('settings');
1588
1589 if(!$a_form)
1590 {
1591 $a_form = $this->initCourseIconsForm();
1592 }
1593
1594 $tpl->setContent($a_form->getHTML());
1595 }
1596
1598 {
1599 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1600 $form = new ilPropertyFormGUI();
1601 $form->setFormAction($this->ctrl->getFormAction($this));
1602
1603 $this->showCustomIconsEditing(1, $form);
1604
1605 // $form->setTitle($this->lng->txt('edit_grouping'));
1606 $form->addCommandButton('updateCourseIcons', $this->lng->txt('save'));
1607
1608 return $form;
1609 }
1610
1612 {
1613 include_once 'Modules/Course/classes/class.ilCourseFile.php';
1614 $file = new ilCourseFile((int) $_GET['file_id']);
1615 ilUtil::deliverFile($file->getAbsolutePath(),$file->getFileName(),$file->getFileType());
1616 return true;
1617 }
1618
1623 {
1624 global $ilSetting;
1625
1626 $this->checkPermission('write');
1627
1628 $form = $this->initCourseIconsForm();
1629 if($form->checkInput())
1630 {
1631 //save custom icons
1632 if ($ilSetting->get("custom_icons"))
1633 {
1634 if($_POST["cont_icon_delete"])
1635 {
1636 $this->object->removeCustomIcon();
1637 }
1638 $this->object->saveIcons($_FILES["cont_icon"]['tmp_name']);
1639 }
1640
1641 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1642 $this->ctrl->redirect($this,"editCourseIcons");
1643 }
1644
1645 $form->setValuesByPost();
1646 $this->editCourseIconsObject($form);
1647 }
1648
1649
1653 function setSubTabs($a_tab)
1654 {
1655 global $rbacsystem,$ilUser,$ilAccess,$tree;
1656
1657 switch ($a_tab)
1658 {
1659 case "properties":
1660 $this->tabs_gui->addSubTabTarget("crs_settings",
1661 $this->ctrl->getLinkTarget($this,'edit'),
1662 "edit", get_class($this));
1663
1664 $this->tabs_gui->addSubTabTarget("crs_info_settings",
1665 $this->ctrl->getLinkTarget($this,'editInfo'),
1666 "editInfo", get_class($this));
1667
1668 $this->tabs_gui->addSubTabTarget("preconditions",
1669 $this->ctrl->getLinkTargetByClass('ilConditionHandlerGUI','listConditions'),
1670 "", "ilConditionHandlerGUI");
1671
1672 $this->tabs_gui->addSubTabTarget("crs_start_objects",
1673 $this->ctrl->getLinkTargetByClass('ilContainerStartObjectsGUI','listStructure'),
1674 "listStructure", get_class($this));
1675
1676 $this->tabs_gui->addSubTabTarget('groupings',
1677 $this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui','listGroupings'),
1678 'listGroupings',
1679 get_class($this));
1680
1681 // custom icon
1682 if ($this->ilias->getSetting("custom_icons"))
1683 {
1684 $this->tabs_gui->addSubTabTarget("icon_settings",
1685 $this->ctrl->getLinkTarget($this,'editCourseIcons'),
1686 "editCourseIcons", get_class($this));
1687 }
1688
1689 // map settings
1690 include_once("./Services/Maps/classes/class.ilMapUtil.php");
1692 {
1693 $this->tabs_gui->addSubTabTarget("crs_map_settings",
1694 $this->ctrl->getLinkTarget($this,'editMapSettings'),
1695 "editMapSettings", get_class($this));
1696 }
1697
1698
1699 include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1700 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1701 // only show if export permission is granted
1702 if(ilPrivacySettings::_getInstance()->checkExportAccess($this->object->getRefId()) or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId()))
1703 {
1704 $this->tabs_gui->addSubTabTarget('crs_custom_user_fields',
1705 $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui'),
1706 '',
1707 'ilobjectcustomuserfieldsgui');
1708 }
1709
1710 // certificates
1711 include_once "Services/Certificate/classes/class.ilCertificate.php";
1713 {
1714 $this->tabs_gui->addSubTabTarget(
1715 "certificate",
1716 $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
1717 "", "ilcertificategui");
1718 }
1719 break;
1720
1721 case 'members':
1722 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
1723 {
1724 $this->tabs_gui->addSubTabTarget("crs_member_administration",
1725 $this->ctrl->getLinkTarget($this,'members'),
1726 "members", get_class($this));
1727
1728 $this->tabs_gui->addSubTabTarget("crs_members_groups",
1729 $this->ctrl->getLinkTargetByClass("ilCourseParticipantsGroupsGUI", "show"),
1730 "", "ilCourseParticipantsGroupsGUI");
1731
1732 $this->tabs_gui->addSubTabTarget(
1733 'crs_members_gallery',
1734 $this->ctrl->getLinkTargetByClass('ilUsersGalleryGUI', 'view'),
1735 '',
1736 'ilUsersGalleryGUI'
1737 );
1738 }
1739 elseif(
1740 $this->object->getShowMembers() == $this->object->SHOW_MEMBERS_ENABLED
1741 )
1742 {
1743 $this->tabs_gui->addSubTabTarget(
1744 'crs_members_gallery',
1745 $this->ctrl->getLinkTargetByClass('ilUsersGalleryGUI', 'view'),
1746 '',
1747 'ilUsersGalleryGUI'
1748 );
1749 }
1750
1751 // members map
1752 include_once("./Services/Maps/classes/class.ilMapUtil.php");
1753 if (ilMapUtil::isActivated() && $this->object->getEnableCourseMap())
1754 {
1755 $this->tabs_gui->addSubTabTarget("crs_members_map",
1756 $this->ctrl->getLinkTarget($this,'membersMap'),
1757 "membersMap", get_class($this));
1758 }
1759
1760 $childs = (array) $tree->getChildsByType($this->object->getRefId(),'sess');
1761 if(count($childs) && $ilAccess->checkAccess('write','',$this->object->getRefId()))
1762 {
1763 $this->tabs_gui->addSubTabTarget("events",
1764 $this->ctrl->getLinkTargetByClass('ilsessionoverviewgui','listSessions'),
1765 "", 'ilsessionoverviewgui');
1766 }
1767
1768 include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
1769 if(ilPrivacySettings::_getInstance()->checkExportAccess($this->object->getRefId()))
1770 {
1771 $this->tabs_gui->addSubTabTarget('export_members',
1772 $this->ctrl->getLinkTargetByClass('ilmemberexportgui','show'),
1773 "", 'ilmemberexportgui');
1774 }
1775
1776 break;
1777
1778
1779 }
1780 }
1781
1786 {
1787 if ($this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE
1788 && !$this->isActiveAdministrationPanel())
1789 {
1790 return false;
1791 }
1792 parent::showPossibleSubObjects();
1793 }
1794
1801 {
1802 $this->object->removeSmallIcon();
1803 $this->ctrl->redirect($this,'editCourseIcons');
1804 }
1805
1812 {
1813 $this->object->removeBigIcon();
1814 $this->ctrl->redirect($this,'editCourseIcons');
1815 }
1816
1817
1824 {
1825 $this->object->removeTinyIcon();
1826 $this->ctrl->redirect($this,'editCourseIcons');
1827 }
1828
1833 protected function afterSave(ilObject $a_new_object)
1834 {
1835 global $rbacadmin, $ilUser, $ilSetting;
1836
1837 $a_new_object->getMemberObject()->add($ilUser->getId(),IL_CRS_ADMIN);
1838 $a_new_object->getMemberObject()->updateNotification($ilUser->getId(),$ilSetting->get('mail_crs_admin_notification', true));
1839 // cognos-blu-patch: begin
1840 $a_new_object->getMemberObject()->updateContact($ilUser->getId(),1);
1841 // cognos-blu-patch: end
1842 $a_new_object->update();
1843
1844 // BEGIN ChangeEvent: Record write event.
1845 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1846 global $ilUser;
1847 ilChangeEvent::_recordWriteEvent($a_new_object->getId(), $ilUser->getId(), 'create');
1848 // END ChangeEvent: Record write event.
1849
1850 // always send a message
1851 ilUtil::sendSuccess($this->lng->txt("crs_added"),true);
1852
1853 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
1854 ilUtil::redirect($this->getReturnLocation("save",
1855 $this->ctrl->getLinkTarget($this, "edit", "", false, false)));
1856 }
1857
1859 {
1860 global $rbacsystem;
1861
1862 $_POST["archives"] = $_POST["archives"] ? $_POST["archives"] : array();
1863
1864 // MINIMUM ACCESS LEVEL = 'write'
1865 $this->checkPermission('read');
1866 /*
1867 if(!$rbacsystem->checkAccess("read", $this->object->getRefId()))
1868 {
1869 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1870 }
1871 */
1872 if(!count($_POST['archives']))
1873 {
1874 ilUtil::sendFailure($this->lng->txt('crs_no_archive_selected'));
1875 $this->archiveObject();
1876
1877 return false;
1878 }
1879 if(count($_POST['archives']) > 1)
1880 {
1881 ilUtil::sendFailure($this->lng->txt('crs_select_one_archive'));
1882 $this->archiveObject();
1883
1884 return false;
1885 }
1886
1887 $this->object->initCourseArchiveObject();
1888
1889 $abs_path = $this->object->archives_obj->getArchiveFile((int) $_POST['archives'][0]);
1890 $basename = basename($abs_path);
1891
1892 ilUtil::deliverFile($abs_path,$basename);
1893 }
1894
1901 public function setShowHidePrefs()
1902 {
1903 global $ilUser;
1904
1905 if(isset($_GET['admin_hide']))
1906 {
1907 $ilUser->writePref('crs_admin_hide',(int) $_GET['admin_hide']);
1908 }
1909 if(isset($_GET['tutor_hide']))
1910 {
1911 $ilUser->writePref('crs_tutor_hide',(int) $_GET['tutor_hide']);
1912 }
1913 if(isset($_GET['member_hide']))
1914 {
1915 $ilUser->writePref('crs_member_hide',(int) $_GET['member_hide']);
1916 }
1917 if(isset($_GET['subscriber_hide']))
1918 {
1919 $ilUser->writePref('crs_subscriber_hide',(int) $_GET['subscriber_hide']);
1920 }
1921 if(isset($_GET['wait_hide']))
1922 {
1923 $ilUser->writePref('crs_wait_hide',(int) $_GET['wait_hide']);
1924 }
1925 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
1926 foreach(ilCourseParticipants::getMemberRoles($this->object->getRefId()) as $role_id)
1927 {
1928 if(isset($_GET['role_hide_'.$role_id]))
1929 {
1930 $ilUser->writePref('crs_role_hide_'.$role_id,(int) $_GET['role_hide_'.$role_id]);
1931 }
1932 }
1933 }
1934
1935 public function readMemberData($ids,$role = 'admin',$selected_columns = null)
1936 {
1937 if($this->show_tracking)
1938 {
1939 include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
1940 $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
1941 $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
1942 $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
1943 }
1944 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1946
1947 if($privacy->enabledCourseAccessTimes())
1948 {
1949 include_once('./Services/Tracking/classes/class.ilLearningProgress.php');
1950 $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
1951 }
1952
1953 $do_prtf = (is_array($selected_columns) &&
1954 in_array('prtf', $selected_columns) &&
1955 is_array($ids));
1956 if($do_prtf)
1957 {
1958 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
1960 $this->ctrl->getLinkTarget($this, "members"));
1961 }
1962
1963 foreach((array) $ids as $usr_id)
1964 {
1965 $name = ilObjUser::_lookupName($usr_id);
1966 $tmp_data['firstname'] = $name['firstname'];
1967 $tmp_data['lastname'] = $name['lastname'];
1968 $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id);
1969 $tmp_data['passed'] = $this->object->getMembersObject()->hasPassed($usr_id) ? 1 : 0;
1970 if($this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP)
1971 {
1972 $tmp_data['passed_info'] = $this->object->getMembersObject()->getPassedInfo($usr_id);
1973 }
1974 $tmp_data['notification'] = $this->object->getMembersObject()->isNotificationEnabled($usr_id) ? 1 : 0;
1975 $tmp_data['blocked'] = $this->object->getMembersObject()->isBlocked($usr_id) ? 1 : 0;
1976 // cognos-blu-patch: begin
1977 $tmp_data['contact'] = $this->object->getMembersObject()->isContact($usr_id) ? 1 : 0;
1978 // cognos-blu-patch: end
1979
1980 $tmp_data['usr_id'] = $usr_id;
1981
1982 if($this->show_tracking)
1983 {
1984 if(in_array($usr_id,$completed))
1985 {
1986 $tmp_data['progress'] = ilLPStatus::LP_STATUS_COMPLETED;
1987 }
1988 elseif(in_array($usr_id,$in_progress))
1989 {
1990 $tmp_data['progress'] = ilLPStatus::LP_STATUS_IN_PROGRESS;
1991 }
1992 elseif(in_array($usr_id,$failed))
1993 {
1994 $tmp_data['progress'] = ilLPStatus::LP_STATUS_FAILED;
1995 }
1996 else
1997 {
1998 $tmp_data['progress'] = ilLPStatus::LP_STATUS_NOT_ATTEMPTED;
1999 }
2000 }
2001
2002 if($privacy->enabledCourseAccessTimes())
2003 {
2004 if(isset($progress[$usr_id]['ts']) and $progress[$usr_id]['ts'])
2005 {
2006 $tmp_data['access_ut'] = $progress[$usr_id]['ts'];
2007 $tmp_data['access_time'] = ilDatePresentation::formatDate(new ilDateTime($progress[$usr_id]['ts'],IL_CAL_UNIX));
2008 }
2009 else
2010 {
2011 $tmp_data['access_ut'] = 0;
2012 $tmp_data['access_time'] = $this->lng->txt('no_date');
2013 }
2014 }
2015
2016 if($do_prtf)
2017 {
2018 $tmp_data['prtf'] = $all_prtf[$usr_id];
2019 }
2020
2021 $members[$usr_id] = $tmp_data;
2022 }
2023 return $members ? $members : array();
2024 }
2025
2026
2027
2035 protected function membersObject()
2036 {
2037 global $ilUser, $ilAccess, $ilToolbar, $lng, $ilCtrl, $tpl, $rbacreview;
2038
2039 include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
2040 include_once('./Modules/Course/classes/class.ilCourseParticipantsTableGUI.php');
2041
2042
2043 if(isset($_GET['member_table_nav']))
2044 {
2045 list($_SESSION['crs_print_sort'],$_SESSION['crs_print_order'],$tmp) = explode(':',$_GET['member_table_nav']);
2046 }
2047
2048 $this->checkPermission('write');
2049
2050 include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
2051 $this->show_tracking = (ilObjUserTracking::_enabledLearningProgress() and
2053 if($this->show_tracking)
2054 {
2055 include_once('./Services/Object/classes/class.ilObjectLP.php');
2056 $olp = ilObjectLP::getInstance($this->object->getId());
2057 $this->show_tracking = $olp->isActive();
2058 }
2059
2060 include_once('./Services/Object/classes/class.ilObjectActivation.php');
2061 $this->timings_enabled = (ilObjectActivation::hasTimings($this->object->getRefId()) and
2062 ($this->object->getViewMode() == IL_CRS_VIEW_TIMING));
2063
2064 $this->setSubTabs('members');
2065 $this->tabs_gui->setTabActive('members');
2066 $this->tabs_gui->setSubTabActive('crs_member_administration');
2067
2068 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.crs_edit_members.html','Modules/Course');
2069 $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
2070
2071 // add members
2072 include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
2073
2075 $this,
2076 $ilToolbar,
2077 array(
2078 'auto_complete_name' => $lng->txt('user'),
2079 'user_type' => $this->getLocalRoles(),
2080 'submit_name' => $lng->txt('add')
2081 )
2082 );
2083
2084 // spacer
2085 $ilToolbar->addSeparator();
2086
2087 // search button
2088 $ilToolbar->addButton($this->lng->txt("crs_search_users"),
2089 $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI','start'));
2090
2091 // separator
2092 $ilToolbar->addSeparator();
2093
2094 // print button
2095 $ilToolbar->addButton($this->lng->txt("crs_print_list"),
2096 $this->ctrl->getLinkTarget($this, 'printMembers'));
2097
2098 /* attendance list button
2099 $ilToolbar->addButton($this->lng->txt("sess_gen_attendance_list"),
2100 $this->ctrl->getLinkTarget($this, 'attendanceList'));
2101 */
2102 $this->addMailToMemberButton($ilToolbar, "members", true);
2103
2104 $this->setShowHidePrefs();
2105
2106 // Waiting list table
2107 include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2108 $waiting_list = new ilCourseWaitingList($this->object->getId());
2109 if(count($wait = $waiting_list->getAllUsers()))
2110 {
2111 include_once('./Services/Membership/classes/class.ilWaitingListTableGUI.php');
2112 if($ilUser->getPref('crs_wait_hide'))
2113 {
2114 $table_gui = new ilWaitingListTableGUI($this,$waiting_list,false);
2115 $this->ctrl->setParameter($this,'wait_hide',0);
2116 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2117 $this->lng->txt('show'));
2118 $this->ctrl->clearParameters($this);
2119 }
2120 else
2121 {
2122 $table_gui = new ilWaitingListTableGUI($this,$waiting_list,true);
2123 $this->ctrl->setParameter($this,'wait_hide',1);
2124 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2125 $this->lng->txt('hide'));
2126 $this->ctrl->clearParameters($this);
2127 }
2128 $table_gui->setUsers($wait);
2129 $table_gui->setTitle($this->lng->txt('crs_waiting_list'),'icon_usr.svg',$this->lng->txt('crs_waiting_list'));
2130 $this->tpl->setVariable('TABLE_WAIT',$table_gui->getHTML());
2131 }
2132
2133 // Subscriber table
2134 if($subscribers = ilCourseParticipants::lookupSubscribers($this->object->getId()))
2135 {
2136 include_once('./Services/Membership/classes/class.ilSubscriberTableGUI.php');
2137 if($ilUser->getPref('crs_subscriber_hide'))
2138 {
2139 $table_gui = new ilSubscriberTableGUI($this,false);
2140 $this->ctrl->setParameter($this,'subscriber_hide',0);
2141 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2142 $this->lng->txt('show'));
2143 $this->ctrl->clearParameters($this);
2144 }
2145 else
2146 {
2147 $table_gui = new ilSubscriberTableGUI($this,true);
2148 $this->ctrl->setParameter($this,'subscriber_hide',1);
2149 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2150 $this->lng->txt('hide'));
2151 $this->ctrl->clearParameters($this);
2152 }
2153 $table_gui->readSubscriberData();
2154 $table_gui->setTitle($this->lng->txt('group_new_registrations'),'icon_usr.svg',$this->lng->txt('group_new_registrations'));
2155 $this->tpl->setVariable('TABLE_SUB',$table_gui->getHTML());
2156 }
2157
2158
2159
2160 if($rbacreview->getNumberOfAssignedUsers(array($this->object->getDefaultAdminRole())))
2161 {
2162 // Security: display the list of course administrators read-only,
2163 // if the user doesn't have the 'edit_permission' permission.
2164 $showEditLink =
2165 (
2166 $ilAccess->checkAccess("edit_permission", '', $this->object->getRefId()) or
2167 ilCourseParticipants::_getInstanceByObjId($this->object->getId())->isAdmin($ilUser->getId())
2168 );
2169 if($ilUser->getPref('crs_admin_hide'))
2170 {
2171 $table_gui = new ilCourseParticipantsTableGUI(
2172 $this,
2173 'admin',
2174 false,
2175 false,
2176 $this->timings_enabled,
2177 $showEditLink,
2178 $this->object->getDefaultAdminRole(),
2179 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP
2180 );
2181 $this->ctrl->setParameter($this,'admin_hide',0);
2182 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2183 $this->lng->txt('show'));
2184 $this->ctrl->clearParameters($this);
2185 }
2186 else
2187 {
2188 $table_gui = new ilCourseParticipantsTableGUI(
2189 $this,
2190 'admin',
2191 true,
2192 false,
2193 $this->timings_enabled,
2194 $showEditLink,
2195 $this->object->getDefaultAdminRole(),
2196 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP
2197 );
2198 $this->ctrl->setParameter($this,'admin_hide',1);
2199 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2200 $this->lng->txt('hide'));
2201 $this->ctrl->clearParameters($this);
2202 }
2203 $table_gui->setTitle($this->lng->txt('crs_administrators'),'icon_usr.svg',$this->lng->txt('crs_administrators'));
2204 $table_gui->parse();
2205 $this->tpl->setVariable('ADMINS',$table_gui->getHTML());
2206 }
2207 if($rbacreview->getNumberOfAssignedUsers(array($this->object->getDefaultTutorRole())))
2208 {
2209 if($ilUser->getPref('crs_tutor_hide'))
2210 {
2211 $table_gui = new ilCourseParticipantsTableGUI(
2212 $this,
2213 'tutor',
2214 false,
2215 false,
2216 $this->timings_enabled,
2217 true,
2218 $this->object->getDefaultTutorRole(),
2219 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP
2220 );
2221 $this->ctrl->setParameter($this,'tutor_hide',0);
2222 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2223 $this->lng->txt('show'));
2224 $this->ctrl->clearParameters($this);
2225 }
2226 else
2227 {
2228 $table_gui = new ilCourseParticipantsTableGUI(
2229 $this,
2230 'tutor',
2231 true,
2232 false,
2233 $this->timings_enabled,
2234 true,
2235 $this->object->getDefaultTutorRole(),
2236 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP
2237 );
2238 $this->ctrl->setParameter($this,'tutor_hide',1);
2239 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2240 $this->lng->txt('hide'));
2241 $this->ctrl->clearParameters($this);
2242 }
2243 $table_gui->setTitle($this->lng->txt('crs_tutors'),'icon_usr.svg',$this->lng->txt('crs_tutors'));
2244 $table_gui->parse();
2245 $this->tpl->setVariable('TUTORS',$table_gui->getHTML());
2246 }
2247 if($rbacreview->getNumberOfAssignedUsers(array($this->object->getDefaultMemberRole())))
2248 {
2249 if($ilUser->getPref('crs_member_hide'))
2250 {
2251 $table_gui = new ilCourseParticipantsTableGUI(
2252 $this,
2253 'member',
2254 false,
2255 $this->show_tracking,
2256 $this->timings_enabled,
2257 true,
2258 $this->object->getDefaultMemberRole(),
2259 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP
2260 );
2261
2262 $this->ctrl->setParameter($this,'member_hide',0);
2263 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2264 $this->lng->txt('show'));
2265 $this->ctrl->clearParameters($this);
2266 }
2267 else
2268 {
2269 $table_gui = new ilCourseParticipantsTableGUI(
2270 $this,
2271 'member',
2272 true,
2273 $this->show_tracking,
2274 $this->timings_enabled,
2275 true,
2276 $this->object->getDefaultMemberRole(),
2277 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP
2278 );
2279 $this->ctrl->setParameter($this,'member_hide',1);
2280 $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
2281 $this->lng->txt('hide'));
2282 $this->ctrl->clearParameters($this);
2283 }
2284 $table_gui->setTitle($this->lng->txt('crs_members'),'icon_usr.svg',$this->lng->txt('crs_members'));
2285 $table_gui->parse();
2286 $this->tpl->setCurrentBlock('member_block');
2287 $this->tpl->setVariable('MEMBERS',$table_gui->getHTML());
2288 $this->tpl->parseCurrentBlock();
2289
2290 }
2291 foreach(ilCourseParticipants::getMemberRoles($this->object->getRefId()) as $role_id)
2292 {
2293 // Do not show table if no user is assigned
2294 if(!($GLOBALS['rbacreview']->getNumberOfAssignedUsers(array($role_id))))
2295 {
2296 continue;
2297 }
2298 if($ilUser->getPref('crs_role_hide_'.$role_id))
2299 {
2300 $table_gui = new ilCourseParticipantsTableGUI(
2301 $this,
2302 'role',
2303 false,
2304 $this->show_tracking,
2305 $this->timings_enabled,
2306 true,
2307 $role_id,
2308 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP
2309 );
2310 $this->ctrl->setParameter($this,'role_hide_'.$role_id,0);
2311 $table_gui->addHeaderCommand(
2312 $this->ctrl->getLinkTarget($this,'members'),
2313 $this->lng->txt('show')
2314 );
2315 $this->ctrl->clearParameters($this);
2316 }
2317 else
2318 {
2319 $table_gui = new ilCourseParticipantsTableGUI(
2320 $this,
2321 'role',
2322 true,
2323 $this->show_tracking,
2324 $this->timings_enabled,
2325 true,
2326 $role_id,
2327 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP
2328 );
2329 $this->ctrl->setParameter($this,'role_hide_'.$role_id,1);
2330 $table_gui->addHeaderCommand(
2331 $this->ctrl->getLinkTarget($this,'members'),
2332 $this->lng->txt('hide')
2333 );
2334 $this->ctrl->clearParameters($this);
2335 }
2336
2337 $table_gui->setTitle(ilObject::_lookupTitle($role_id),'icon_usr.svg',$this->lng->txt('crs_members'));
2338 $table_gui->parse();
2339 $this->tpl->setCurrentBlock('member_block');
2340 $this->tpl->setVariable('MEMBERS',$table_gui->getHTML());
2341 $this->tpl->parseCurrentBlock();
2342 }
2343
2344
2345 $this->tpl->setVariable('TXT_SELECTED_USER',$this->lng->txt('crs_selected_users'));
2346 $this->tpl->setVariable('BTN_FOOTER_EDIT',$this->lng->txt('edit'));
2347 $this->tpl->setVariable('BTN_FOOTER_VAL',$this->lng->txt('remove'));
2348 $this->tpl->setVariable('BTN_FOOTER_MAIL',$this->lng->txt('crs_mem_send_mail'));
2349 $this->tpl->setVariable('ARROW_DOWN',ilUtil::getImagePath('arrow_downright.svg'));
2350
2351 }
2352
2353
2354
2362 public function updateAdminStatusObject()
2363 {
2364 $this->checkPermission('write');
2365
2366 $visible_members = array_intersect(array_unique((array) $_POST['visible_member_ids']),$this->object->getMembersObject()->getAdmins());
2367 $passed = is_array($_POST['passed']) ? $_POST['passed'] : array();
2368 $notification = is_array($_POST['notification']) ? $_POST['notification'] : array();
2369 // cognos-blu-patch: begin
2370 $contact = is_array($_POST['contact']) ? $_POST['contact'] : array();
2371
2372 $this->updateParticipantsStatus('admins',$visible_members,$passed,$notification,array(),$contact);
2373 // cognos-blu-patch: end
2374 }
2375
2383 public function updateTutorStatusObject()
2384 {
2385 $this->checkPermission('write');
2386
2387 $visible_members = array_intersect(array_unique((array) $_POST['visible_member_ids']),$this->object->getMembersObject()->getTutors());
2388 $passed = is_array($_POST['passed']) ? $_POST['passed'] : array();
2389 $notification = is_array($_POST['notification']) ? $_POST['notification'] : array();
2390 // cognos-blu-patch: begin
2391 $contact = is_array($_POST['contact']) ? $_POST['contact'] : array();
2392
2393 $this->updateParticipantsStatus('admins',$visible_members,$passed,$notification,array(),$contact);
2394 // cognos-blu-patch: end
2395 }
2396
2405 {
2406 $this->checkPermission('write');
2407
2408 $visible_members = array_intersect(array_unique((array) $_POST['visible_member_ids']),$this->object->getMembersObject()->getMembers());
2409 $passed = is_array($_POST['passed']) ? $_POST['passed'] : array();
2410 $blocked = is_array($_POST['blocked']) ? $_POST['blocked'] : array();
2411 // cognos-blu-patch: begin
2412 $contact = is_array($_POST['contact']) ? $_POST['contact'] : array();
2413
2414 $this->updateParticipantsStatus('members',$visible_members,$passed,array(),$blocked, $contact);
2415 // cognos-blu-patch: end
2416
2417 }
2418
2422 public function updateRoleStatusObject()
2423 {
2424 global $rbacreview;
2425
2426 $this->checkPermission('write');
2427
2428 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
2429
2430 $users = array();
2431 foreach(ilCourseParticipants::getMemberRoles($this->object->getRefId()) as $role_id)
2432 {
2433 $users = array_merge($users,$rbacreview->assignedUsers($role_id));
2434 }
2435
2436 $passed = is_array($_POST['passed']) ? $_POST['passed'] : array();
2437 $blocked = is_array($_POST['blocked']) ? $_POST['blocked'] : array();
2438 // cognos-blu-patch: begin
2439 $contact = is_array($_POST['contact']) ? $_POST['contact'] : array();
2440
2441 $this->updateParticipantsStatus('members',$users,$passed,array(),$blocked,$contact);
2442 // cognos-blu-patch: end
2443 }
2444
2451 protected function updateLPFromStatus($a_member_id, $a_has_passed)
2452 {
2453 global $ilUser;
2454
2455 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
2457 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP)
2458 {
2459 include_once './Services/Object/classes/class.ilObjectLP.php';
2460 $olp = ilObjectLP::getInstance($this->object->getId());
2461 if($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR)
2462 {
2463 include_once 'Services/Tracking/classes/class.ilLPMarks.php';
2464 $marks = new ilLPMarks($this->object->getId(), $a_member_id);
2465
2466 // only if status has changed
2467 if($marks->getCompleted() != $a_has_passed)
2468 {
2469 $marks->setCompleted($a_has_passed);
2470 $marks->update();
2471
2472 // as course is origin of LP status change, block syncing
2473 include_once("./Modules/Course/classes/class.ilCourseAppEventListener.php");
2475
2476 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
2477 ilLPStatusWrapper::_updateStatus($this->object->getId(), $a_member_id);
2478 }
2479 }
2480 }
2481 }
2482
2483 // cognos-blu-patch: begin
2484 function updateParticipantsStatus($type,$visible_members,$passed,$notification,$blocked,$contact)
2485 // cognos-blu-patch: end
2486 {
2487 global $ilAccess,$ilErr,$ilUser,$rbacadmin;
2488 foreach($visible_members as $member_id)
2489 {
2490 $this->object->getMembersObject()->updatePassed($member_id,in_array($member_id,$passed),true);
2491
2492 $this->updateLPFromStatus($member_id, in_array($member_id, $passed));
2493
2494 switch($type)
2495 {
2496 case 'admins';
2497 $this->object->getMembersObject()->updateNotification($member_id,in_array($member_id,$notification));
2498 // cognos-blu-patch: begin
2499 $this->object->getMembersObject()->updateContact($member_id,in_array($member_id,$contact) ? TRUE : FALSE);
2500 // cognos-blu-patch: end
2501 $this->object->getMembersObject()->updateBlocked($member_id,false);
2502 break;
2503
2504 case 'members':
2505 if($this->object->getMembersObject()->isBlocked($member_id) and !in_array($member_id,$blocked))
2506 {
2507 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_UNBLOCK_MEMBER,$member_id);
2508 }
2509 if(!$this->object->getMembersObject()->isBlocked($member_id) and in_array($member_id,$blocked))
2510 {
2511 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_BLOCK_MEMBER,$member_id);
2512 }
2513 $this->object->getMembersObject()->updateNotification($member_id,false);
2514
2515 // cognos-blu-patch: begin
2516
2517 // check if member is admin or tutor: otherwise reset contact flag
2518 if(!$this->object->getMembersObject()->isAdmin($member_id) and !$this->object->getMembersObject()->isTutor($member_id))
2519 {
2520 $this->object->getMembersObject()->updateContact($member_id,FALSE);
2521 }
2522 // cognos-blu-patch: end
2523 $this->object->getMembersObject()->updateBlocked($member_id,in_array($member_id,$blocked));
2524
2525 break;
2526 }
2527 }
2528
2529 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
2530 $this->membersObject();
2531 }
2532
2533
2535 {
2536 include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
2537
2538 $this->object->initWaitingList();
2539 if($this->object->waiting_list_obj->getCountUsers())
2540 {
2541 $counter = 0;
2542 $f_result = array();
2543 foreach($this->object->waiting_list_obj->getAllUsers() as $waiting_data)
2544 {
2545 // GET USER OBJ
2546 if($tmp_obj = ilObjectFactory::getInstanceByObjId($waiting_data['usr_id'],false))
2547 {
2548 $waiting_list_ids[] = $waiting_data['usr_id'];
2549 $message = '';
2550 // Check if user is member in course grouping
2551 foreach(ilObjCourseGrouping::_getGroupingCourseIds($this->object->getRefId(),
2552 $this->object->getId()) as $course_data)
2553 {
2554 $tmp_members = ilCourseParticipants::_getInstanceByObjId($course_data['id']);
2555 if($course_data['id'] != $this->object->getId() and
2556 $tmp_members->isGroupingMember($tmp_obj->getId(),$course_data['unique']))
2557 {
2558 $message .= ('<br /><span class="ilAlert">'.$this->lng->txt('crs_member_of').' ');
2559 $message .= (ilObject::_lookupTitle($course_data['id'])."</span>");
2560 }
2561 }
2562
2563 $f_result[$counter][] = ilUtil::formCheckbox(0,"waiting_list[]",$waiting_data['usr_id']);
2564 $f_result[$counter][] = $tmp_obj->getLastname().', '.$tmp_obj->getFirstname().$message;
2565 $f_result[$counter][] = $tmp_obj->getLogin();
2566 $f_result[$counter][] = ilDatePresentation::formatDate(new ilDateTime($waiting_data['time'],IL_CAL_UNIX));
2567 unset($tmp_obj);
2568 ++$counter;
2569 }
2570 }
2571 $this->__showWaitingListTable($f_result,$waiting_list_ids);
2572
2573 } // END waiting list
2574 }
2575
2576
2584 public function editMemberObject()
2585 {
2586 $_POST['members'] = array((int) $_GET['member_id']);
2587 $this->editMembersObject();
2588 return true;
2589 }
2590
2591
2598 public function editMembersObject()
2599 {
2600 $this->checkPermission('write');
2601
2602 $post_participants = array_unique(array_merge((array) $_POST['admins'],(array) $_POST['tutors'],(array) $_POST['members'], (array) $_POST['roles']));
2603 $real_participants = ilCourseParticipants::_getInstanceByObjId($this->object->getId())->getParticipants();
2604 $participants = array_intersect((array) $post_participants, (array) $real_participants);
2605
2606
2607
2608 if(!count($participants))
2609 {
2610 ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2611 $this->membersObject();
2612 return false;
2613 }
2614
2615 $this->setSubTabs('members');
2616 $this->tabs_gui->setTabActive('members');
2617 $this->tabs_gui->setSubTabActive('crs_member_administration');
2618
2619 include_once('./Modules/Course/classes/class.ilCourseEditParticipantsTableGUI.php');
2620 $table_gui = new ilCourseEditParticipantsTableGUI($this);
2621 $table_gui->setTitle($this->lng->txt('crs_header_edit_members'),'icon_usr.svg',$this->lng->txt('crs_header_edit_members'));
2622 $table_gui->setData($this->readMemberData($participants));
2623
2624 $this->tpl->setContent($table_gui->getHTML());
2625 return true;
2626 }
2627
2635 public function updateMembersObject()
2636 {
2637 global $rbacsystem, $rbacreview, $ilUser, $ilAccess;
2638
2639 $this->checkPermission('write');
2640
2641 if(!count($_POST['participants']))
2642 {
2643 ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2644 $this->membersObject();
2645 return false;
2646 }
2647
2648 $notifications = $_POST['notification'] ? $_POST['notification'] : array();
2649 $passed = $_POST['passed'] ? $_POST['passed'] : array();
2650 $blocked = $_POST['blocked'] ? $_POST['blocked'] : array();
2651 // cognos-blu-patch: begin
2652 $contact = $_POST['contact'] ? $_POST['contact'] : array();
2653 // cognos-blu-patch: end
2654
2655 // Determine whether the user has the 'edit_permission' permission
2656 $hasEditPermissionAccess =
2657 (
2658 $ilAccess->checkAccess('edit_permission','',$this->object->getRefId()) or
2659 ilCourseParticipants::_getInstanceByObjId($this->object->getId())->isAdmin($ilUser->getId())
2660 );
2661
2662 // Get all assignable local roles of the course object, and
2663 // determine the role id of the course administrator role.
2664 $assignableLocalCourseRoles = array();
2665 $courseAdminRoleId = $this->object->getDefaultAdminRole();
2666 foreach ($this->object->getLocalCourseRoles(false) as $title => $role_id)
2667 {
2668 $assignableLocalCourseRoles[$role_id] = $title;
2669 }
2670
2671 // Validate the user ids and role ids in the post data
2672 foreach($_POST['participants'] as $usr_id)
2673 {
2674 $memberIsCourseAdmin = $rbacreview->isAssigned($usr_id, $courseAdminRoleId);
2675
2676 // If the current user doesn't have the 'edit_permission'
2677 // permission, make sure he doesn't remove the course
2678 // administrator role of members who are course administrator.
2679 if (! $hasEditPermissionAccess && $memberIsCourseAdmin &&
2680 ! in_array($courseAdminRoleId, $_POST['roles'][$usr_id])
2681 )
2682 {
2683 $_POST['roles'][$usr_id][] = $courseAdminRoleId;
2684 }
2685
2686 // Validate the role ids in the post data
2687 foreach ((array) $_POST['roles'][$usr_id] as $role_id)
2688 {
2689 if(!array_key_exists($role_id, $assignableLocalCourseRoles))
2690 {
2691 ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'));
2692 $this->membersObject();
2693 return false;
2694 }
2695 if(!$hasEditPermissionAccess &&
2696 $role_id == $courseAdminRoleId &&
2697 !$memberIsCourseAdmin)
2698 {
2699 ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'));
2700 $this->membersObject();
2701 return false;
2702 }
2703 }
2704 }
2705
2706 $has_admin = false;
2707 foreach(ilCourseParticipants::_getInstanceByObjId($this->object->getId())->getAdmins() as $admin_id)
2708 {
2709 if(!isset($_POST['roles'][$admin_id]))
2710 {
2711 $has_admin = true;
2712 break;
2713 }
2714 if(in_array($courseAdminRoleId,$_POST['roles'][$admin_id]))
2715 {
2716 $has_admin = true;
2717 break;
2718 }
2719 }
2720
2721 if(!$has_admin)
2722 {
2723 ilUtil::sendFailure($this->lng->txt('crs_min_one_admin'));
2724 $_POST['members'] = $_POST['participants'];
2725 $this->editMembersObject();
2726 return false;
2727 }
2728
2729 foreach($_POST['participants'] as $usr_id)
2730 {
2731 $this->object->getMembersObject()->updateRoleAssignments($usr_id,(array) $_POST['roles'][$usr_id]);
2732
2733 // Disable notification for all of them
2734 $this->object->getMembersObject()->updateNotification($usr_id,0);
2735 if(($this->object->getMembersObject()->isTutor($usr_id) or $this->object->getMembersObject()->isAdmin($usr_id)) and in_array($usr_id,$notifications))
2736 {
2737 $this->object->getMembersObject()->updateNotification($usr_id,1);
2738 }
2739
2740 $this->object->getMembersObject()->updateBlocked($usr_id,0);
2741 if((!$this->object->getMembersObject()->isAdmin($usr_id) and !$this->object->getMembersObject()->isTutor($usr_id)) and in_array($usr_id,$blocked))
2742 {
2743 $this->object->getMembersObject()->updateBlocked($usr_id,1);
2744 }
2745 $this->object->getMembersObject()->updatePassed($usr_id,in_array($usr_id,$passed),true);
2746 $this->object->getMembersObject()->sendNotification(
2747 $this->object->getMembersObject()->NOTIFY_STATUS_CHANGED,
2748 $usr_id);
2749
2750 // cognos-blu-patch: begin
2751 if(
2752 ($GLOBALS['rbacreview']->isAssigned($usr_id, $this->object->getDefaultAdminRole()) or $GLOBALS['rbacreview']->isAssigned($usr_id, $this->object->getDefaultTutorRole())) and
2753 in_array($usr_id,$contact)
2754 )
2755 {
2756 $this->object->getMembersObject()->updateContact($usr_id,TRUE);
2757 }
2758 else
2759 {
2760 $this->object->getMembersObject()->updateContact($usr_id,FALSE);
2761 }
2762 // cognos-blu-patch: end
2763
2764 $this->updateLPFromStatus($usr_id,in_array($usr_id,$passed));
2765 }
2766 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
2767 $this->ctrl->redirect($this, "members");
2768 return true;
2769
2770 }
2771
2772
2773
2774
2776 {
2777 global $rbacsystem, $ilUser;
2778
2779 $this->checkPermission('write');
2780
2781 // CHECK MEMBER_ID
2782 if(!isset($_GET["member_id"]) or !$this->object->getMembersObject()->isAssigned((int) $_GET["member_id"]))
2783 {
2784 $this->ilias->raiseError($this->lng->txt("crs_no_valid_member_id_given"),$this->ilias->error_obj->MESSAGE);
2785 }
2786
2787
2788 // Remember settings for notification
2789 $passed = $this->object->getMembersObject()->hasPassed((int) $_GET['member_id']);
2790 $notify = $this->object->getMembersObject()->isNotificationEnabled((int) $_GET['member_id']);
2791 $blocked = $this->object->getMembersObject()->isBlocked((int) $_GET['member_id']);
2792
2793 $this->object->getMembersObject()->updateRoleAssignments((int) $_GET['member_id'],$_POST['roles']);
2794 $this->object->getMembersObject()->updatePassed((int) $_GET['member_id'],(int) $_POST['passed'],true);
2795 $this->object->getMembersObject()->updateNotification((int) $_GET['member_id'],(int) $_POST['notification']);
2796 $this->object->getMembersObject()->updateBlocked((int) $_GET['member_id'],(int) $_POST['blocked']);
2797
2798 if($passed != $this->object->getMembersObject()->hasPassed((int) $_GET['member_id']) or
2799 $notify != $this->object->getMembersObject()->isNotificationEnabled((int) $_GET['member_id']) or
2800 $blocked != $this->object->getMembersObject()->isBlocked((int) $_GET['member_id']))
2801 {
2802 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_STATUS_CHANGED,(int) $_GET['member_id']);
2803 }
2804
2805 $this->updateLPFromStatus((int) $_GET['member_id'], (bool) $_POST['passed']);
2806
2807 ilUtil::sendSuccess($this->lng->txt("crs_member_updated"));
2808 $this->membersObject();
2809 return true;
2810
2811 }
2812
2813
2821 public function assignMembersObject(array $a_usr_ids,$a_type)
2822 {
2823 global $rbacsystem;
2824
2825 $this->checkPermission('write');
2826 if(!count($a_usr_ids))
2827 {
2828 ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"),true);
2829 return false;
2830 }
2831
2832 $added_users = 0;
2833 foreach($a_usr_ids as $user_id)
2834 {
2835 if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id,false))
2836 {
2837 continue;
2838 }
2839 if($this->object->getMembersObject()->isAssigned($user_id))
2840 {
2841 continue;
2842 }
2843 switch($a_type)
2844 {
2845 case $this->object->getDefaultMemberRole():
2846 $this->object->getMembersObject()->add($user_id,IL_CRS_MEMBER);
2847 break;
2848 case $this->object->getDefaultTutorRole():
2849 $this->object->getMembersObject()->add($user_id,IL_CRS_TUTOR);
2850 break;
2851 case $this->object->getDefaultAdminRole():
2852 $this->object->getMembersObject()->add($user_id,IL_CRS_ADMIN);
2853 break;
2854 default:
2855 if(in_array($a_type,$this->object->getLocalCourseRoles(true)))
2856 {
2857 $this->object->getMembersObject()->add($user_id,IL_CRS_MEMBER);
2858 $this->object->getMembersObject()->updateRoleAssignments($user_id,(array)$a_type);
2859 }
2860 else
2861 {
2862 $GLOBALS['ilLog']->write(__METHOD__.': Can\'t find role with role id "' . $a_type . '" to assign users to.');
2863 ilUtil::sendFailure($this->lng->txt("crs_cannot_find_role"),true);
2864 return false;
2865 }
2866 break;
2867 }
2868 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_ACCEPT_USER,$user_id);
2869
2870 $this->object->checkLPStatusSync($user_id);
2871
2872 ++$added_users;
2873 }
2874 if($added_users)
2875 {
2876 ilUtil::sendSuccess($this->lng->txt("crs_users_added"),true);
2877 unset($_SESSION["crs_search_str"]);
2878 unset($_SESSION["crs_search_for"]);
2879 unset($_SESSION['crs_usr_search_result']);
2880
2881 $this->checkLicenses(true);
2882 $this->ctrl->redirect($this,'members');
2883 }
2884 ilUtil::sendFailure($this->lng->txt("crs_users_already_assigned"),true);
2885 return false;
2886 }
2887
2889 {
2890 global $rbacsystem;
2891
2892 $this->checkPermission('write');
2893
2894 if(!count($_POST["waiting"]))
2895 {
2896 ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"));
2897 $this->membersObject();
2898
2899 return false;
2900 }
2901 include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2902 $waiting_list = new ilCourseWaitingList($this->object->getId());
2903
2904 $added_users = 0;
2905 foreach($_POST["waiting"] as $user_id)
2906 {
2907 if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id,false))
2908 {
2909 continue;
2910 }
2911 if($this->object->getMembersObject()->isAssigned($user_id))
2912 {
2913 continue;
2914 }
2915 $this->object->getMembersObject()->add($user_id,IL_CRS_MEMBER);
2916 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_ACCEPT_USER,$user_id);
2917 $waiting_list->removeFromList($user_id);
2918
2919 $this->object->checkLPStatusSync($user_id);
2920
2921 ++$added_users;
2922 }
2923
2924 if($added_users)
2925 {
2926 ilUtil::sendSuccess($this->lng->txt("crs_users_added"));
2927 $this->membersObject();
2928 return true;
2929 }
2930 else
2931 {
2932 ilUtil::sendFailure($this->lng->txt("crs_users_already_assigned"));
2933 $this->membersObject();
2934 return false;
2935 }
2936 }
2937
2944 public function refuseFromListObject()
2945 {
2946 global $ilUser;
2947
2948 $this->checkPermission('write');
2949
2950 if(!count($_POST['waiting']))
2951 {
2952 ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2953 $this->membersObject();
2954 return false;
2955 }
2956
2957 include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2958 $waiting_list = new ilCourseWaitingList($this->object->getId());
2959
2960 foreach($_POST["waiting"] as $user_id)
2961 {
2962 $waiting_list->removeFromList($user_id);
2963 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER,$user_id);
2964 }
2965
2966 ilUtil::sendSuccess($this->lng->txt('crs_users_removed_from_list'));
2967 $this->membersObject();
2968 return true;
2969 }
2970
2971
2973 {
2974 global $rbacsystem;
2975
2976 // MINIMUM ACCESS LEVEL = 'administrate'
2977 $this->checkPermission('write');
2978 /*
2979 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
2980 {
2981 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
2982 }
2983 */
2984 if(!is_array($_SESSION["crs_delete_waiting_list_ids"]))
2985 {
2986 ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"));
2987 $this->membersObject();
2988
2989 return false;
2990 }
2991
2992 $this->object->initWaitingList();
2993 foreach($_SESSION['crs_delete_waiting_list_ids'] as $usr_id)
2994 {
2995 $this->object->waiting_list_obj->removeFromList($usr_id);
2996 }
2997 ilUtil::sendSuccess($this->lng->txt('crs_users_removed_from_list'));
2998 $this->membersObject();
2999
3000 return true;
3001 }
3002
3003
3004 public function assignSubscribersObject()
3005 {
3006 global $rbacsystem,$ilErr;
3007
3008
3009 $this->checkPermission('write');
3010
3011 if(!is_array($_POST["subscribers"]))
3012 {
3013 ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"));
3014 $this->membersObject();
3015
3016 return false;
3017 }
3018
3019 if(!$this->object->getMembersObject()->assignSubscribers($_POST["subscribers"]))
3020 {
3021 ilUtil::sendFailure($ilErr->getMessage());
3022 $this->membersObject();
3023 return false;
3024 }
3025 else
3026 {
3027 foreach($_POST["subscribers"] as $usr_id)
3028 {
3029 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_ACCEPT_SUBSCRIBER,$usr_id);
3030
3031 $this->object->checkLPStatusSync($usr_id);
3032 }
3033 }
3034 ilUtil::sendSuccess($this->lng->txt("crs_subscribers_assigned"));
3035 $this->membersObject();
3036
3037 return true;
3038 }
3039
3041 {
3042 global $rbacsystem;
3043
3044 $this->checkPermission('write');
3045
3046 if($this->object->isSubscriptionMembershipLimited() and $this->object->getSubscriptionMaxMembers() and
3047 $this->object->getSubscriptionMaxMembers() <= $this->object->getMembersObject()->getCountMembers())
3048 {
3049 ilUtil::sendFailure($this->lng->txt("crs_max_members_reached"));
3050 $this->membersObject();
3051
3052 return false;
3053 }
3054 if($number = $this->object->getMembersObject()->autoFillSubscribers())
3055 {
3056 ilUtil::sendSuccess($this->lng->txt("crs_number_users_added")." ".$number);
3057 }
3058 else
3059 {
3060 ilUtil::sendFailure($this->lng->txt("crs_no_users_added"));
3061 }
3062 $this->membersObject();
3063
3064 return true;
3065 }
3066
3067
3069 {
3070 global $rbacsystem;
3071
3072 $this->tabs_gui->setTabActive('members');
3073
3074 // MINIMUM ACCESS LEVEL = 'administrate'
3075 $this->checkPermission('write');
3076 /*
3077 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
3078 {
3079 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
3080 }
3081 */
3082 if(!is_array($_POST["subscriber"]) or !count($_POST["subscriber"]))
3083 {
3084 ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"));
3085 $this->membersObject();
3086
3087 return false;
3088 }
3089 ilUtil::sendQuestion($this->lng->txt("crs_delete_subscribers_sure"));
3090
3091 // SHOW DELETE SCREEN
3092 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_editMembers.html",'Modules/Course');
3093
3094 // SAVE IDS IN SESSION
3095 $_SESSION["crs_delete_subscriber_ids"] = $_POST["subscriber"];
3096
3097 $counter = 0;
3098 $f_result = array();
3099
3100 foreach($_POST["subscriber"] as $member_id)
3101 {
3102 $member_data = $this->object->getMembersObject()->getSubscriberData($member_id);
3103
3104 // GET USER OBJ
3105 if($tmp_obj = ilObjectFactory::getInstanceByObjId($member_id,false))
3106 {
3107 $f_result[$counter][] = $tmp_obj->getLogin();
3108 $f_result[$counter][] = $tmp_obj->getFirstname();
3109 $f_result[$counter][] = $tmp_obj->getLastname();
3110 $f_result[$counter][] = ilDatePresentation::formatDate(new ilDateTime($member_data['time']),IL_CAL_UNIX);
3111
3112 unset($tmp_obj);
3113 ++$counter;
3114 }
3115 }
3116 return $this->__showDeleteSubscriberTable($f_result);
3117 }
3118
3120 {
3121 global $rbacsystem;
3122
3123 $this->tabs_gui->setTabActive('members');
3124
3125 // MINIMUM ACCESS LEVEL = 'administrate'
3126 $this->checkPermission('write');
3127 /*
3128 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
3129 {
3130 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
3131 }
3132 */
3133 if(!is_array($_POST["waiting_list"]) or !count($_POST["waiting_list"]))
3134 {
3135 ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"));
3136 $this->membersObject();
3137
3138 return false;
3139 }
3140 ilUtil::sendSuccess($this->lng->txt("crs_delete_from_list_sure"));
3141
3142 // SHOW DELETE SCREEN
3143 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_editMembers.html",'Modules/Course');
3144 $this->object->initWaitingList();
3145
3146 // SAVE IDS IN SESSION
3147 $_SESSION["crs_delete_waiting_list_ids"] = $_POST["waiting_list"];
3148
3149 $counter = 0;
3150 $f_result = array();
3151
3152 foreach($_POST["waiting_list"] as $wait_id)
3153 {
3154 $user_data =& $this->object->waiting_list_obj->getUser($wait_id);
3155 // GET USER OBJ
3156 if($tmp_obj = ilObjectFactory::getInstanceByObjId($wait_id,false))
3157 {
3158 $f_result[$counter][] = $tmp_obj->getLogin();
3159 $f_result[$counter][] = $tmp_obj->getFirstname();
3160 $f_result[$counter][] = $tmp_obj->getLastname();
3161 #$f_result[$counter][] = strftime("%Y-%m-%d %R",$user_data["time"]);
3162 $f_result[$counter][] = ilDatePresentation::formatDate(new ilDateTime($user_data['time'],IL_CAL_UNIX));
3163
3164 unset($tmp_obj);
3165 ++$counter;
3166 }
3167 }
3168 return $this->__showRemoveFromWaitingListTable($f_result);
3169 }
3170
3171 public function leaveObject()
3172 {
3173 global $ilUser;
3174
3175 $this->checkPermission('leave');
3176
3177 if($this->object->getMembersObject()->isLastAdmin($ilUser->getId()))
3178 {
3179 ilUtil::sendFailure($this->lng->txt('crs_min_one_admin'));
3180 $this->viewObject();
3181 return false;
3182 }
3183
3184 $this->tabs_gui->setTabActive('crs_unsubscribe');
3185
3186 include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
3187 $cgui = new ilConfirmationGUI();
3188 $cgui->setHeaderText($this->lng->txt('crs_unsubscribe_sure'));
3189 $cgui->setFormAction($this->ctrl->getFormAction($this));
3190 $cgui->setCancel($this->lng->txt("cancel"), "cancel");
3191 $cgui->setConfirm($this->lng->txt("crs_unsubscribe"), "performUnsubscribe");
3192 $this->tpl->setContent($cgui->getHTML());
3193 }
3194
3199 {
3200 $this->leaveObject();
3201 }
3202
3204 {
3205 global $ilUser, $ilCtrl;
3206
3207 // CHECK ACCESS
3208 $this->checkPermission('leave');
3209 $this->object->getMembersObject()->delete($this->ilias->account->getId());
3210 $this->object->getMembersObject()->sendUnsubscribeNotificationToAdmins($this->ilias->account->getId());
3211 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_UNSUBSCRIBE,$ilUser->getId());
3212
3213 ilUtil::sendSuccess($this->lng->txt('crs_unsubscribed_from_crs'),true);
3214
3215 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->tree->getParentId($this->ref_id));
3216 $ilCtrl->redirectByClass("ilrepositorygui", "");
3217 }
3218
3225 {
3226 global $ilAccess, $ilUser;
3227
3228 $this->checkPermission('write');
3229
3230 $participants = array_merge((array) $_POST['admins'],(array) $_POST['tutors'], (array) $_POST['members'], (array) $_POST['roles']);
3231
3232 if(!$participants)
3233 {
3234 ilUtil::sendFailure($this->lng->txt('no_checkbox'));
3235 $this->membersObject();
3236 return true;
3237 }
3238
3239 // Check last admin
3240 if(!$this->object->getMemberObject()->checkLastAdmin($participants))
3241 {
3242 ilUtil::sendFailure($this->lng->txt('crs_at_least_one_admin'));
3243 $this->membersObject();
3244
3245 return false;
3246 }
3247
3248 // Access check for admin deletion
3249 if(
3250 !$ilAccess->checkAccess('edit_permission', '',$this->object->getRefId()) and
3251 !ilCourseParticipants::_getInstanceByObjId($this->object->getId())->isAdmin($ilUser->getId())
3252 )
3253 {
3254 foreach ($participants as $usr_id)
3255 {
3256 $part = ilCourseParticipant::_getInstanceByObjId($this->object->getId(),$usr_id);
3257 if($part->isAdmin())
3258 {
3259 ilUtil::sendFailure($this->lng->txt("msg_no_perm_perm"));
3260 $this->membersObject();
3261 return false;
3262 }
3263 }
3264 }
3265
3266 $this->setSubTabs('members');
3267 $this->tabs_gui->setTabActive('members');
3268 $this->tabs_gui->setSubTabActive('crs_member_administration');
3269
3270 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
3271 $confirm = new ilConfirmationGUI();
3272 $confirm->setFormAction($this->ctrl->getFormAction($this,'deleteMembers'));
3273 $confirm->setHeaderText($this->lng->txt('crs_header_delete_members'));
3274 $confirm->setConfirm($this->lng->txt('confirm'),'removeMembers');
3275 $confirm->setCancel($this->lng->txt('cancel'),'members');
3276
3277 foreach($participants as $usr_id)
3278 {
3279 $name = ilObjUser::_lookupName($usr_id);
3280
3281 $confirm->addItem('participants[]',
3282 $name['user_id'],
3283 $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
3284 ilUtil::getImagePath('icon_usr.svg'));
3285 }
3286
3287 $this->tpl->setContent($confirm->getHTML());
3288
3289 }
3290
3297 protected function removeMembersObject()
3298 {
3299 global $rbacreview, $rbacsystem, $ilAccess, $ilUser;
3300
3301 $this->checkPermission('write');
3302
3303 if(!is_array($_POST["participants"]) or !count($_POST["participants"]))
3304 {
3305 ilUtil::sendFailure($this->lng->txt("crs_no_member_selected"));
3306 $this->membersObject();
3307
3308 return false;
3309 }
3310
3311 // If the user doesn't have the edit_permission and is not administrator, he may not remove
3312 // members who have the course administrator role
3313 if (
3314 !$ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()) and
3315 !ilCourseParticipants::_getInstanceByObjId($this->object->getId())->isAdmin($ilUser->getId())
3316 )
3317 {
3318 // Determine the role id of the course administrator role.
3319 $courseAdminRoleId = null;
3320 foreach ($this->object->getLocalCourseRoles(false) as $title => $role_id)
3321 {
3322 if (substr($title, 0, 12) == 'il_crs_admin')
3323 {
3324 $courseAdminRoleId = $role_id;
3325 }
3326 }
3327
3328 foreach ($_POST['participants'] as $usr_id)
3329 {
3330 if ($rbacreview->isAssigned($usr_id, $courseAdminRoleId))
3331 {
3332 ilUtil::sendFailure($this->lng->txt("msg_no_perm_perm"));
3333 $this->membersObject();
3334 return false;
3335 }
3336 }
3337 }
3338
3339 if(!$this->object->getMembersObject()->deleteParticipants($_POST["participants"]))
3340 {
3341 ilUtil::sendFailure($this->object->getMessage());
3342 $this->membersObject();
3343
3344 return false;
3345 }
3346 else
3347 {
3348 // SEND NOTIFICATION
3349 foreach($_POST["participants"] as $usr_id)
3350 {
3351 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_DISMISS_MEMBER,$usr_id);
3352 }
3353 }
3354 ilUtil::sendSuccess($this->lng->txt("crs_members_deleted"), true);
3355 $this->ctrl->redirect($this, "members");
3356
3357 return true;
3358 }
3359
3361 {
3362 global $rbacsystem;
3363
3364 $this->checkPermission('write');
3365
3366 if(!$_POST['subscribers'])
3367 {
3368 ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"));
3369 $this->membersObject();
3370 return false;
3371 }
3372
3373 if(!$this->object->getMembersObject()->deleteSubscribers($_POST["subscribers"]))
3374 {
3375 ilUtil::sendFailure($this->object->getMessage());
3376 $this->membersObject();
3377 return false;
3378 }
3379 else
3380 {
3381 foreach($_POST['subscribers'] as $usr_id)
3382 {
3383 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER,$usr_id);
3384 }
3385 }
3386
3387 ilUtil::sendSuccess($this->lng->txt("crs_subscribers_deleted"));
3388 $this->membersObject();
3389 return true;
3390 }
3391
3395 protected function getAgreementTabs()
3396 {
3397
3398 if ($ilAccess->checkAccess('visible','',$this->ref_id))
3399 {
3400 $GLOBALS['ilTabs']->addTarget("info_short",
3401 $this->ctrl->getLinkTargetByClass(
3402 array("ilobjcoursegui", "ilinfoscreengui"), "showSummary"),
3403 "infoScreen"
3404 );
3405 }
3406 if($ilAccess->checkAccess('leave','',$this->object->getRefId()) and $this->object->getMemberObject()->isMember())
3407 {
3408 $GLOBALS['ilTabs']->addTarget("crs_unsubscribe",
3409 $this->ctrl->getLinkTarget($this, "unsubscribe"),
3410 'leave',
3411 "");
3412 }
3413
3414 }
3415
3419 function getTabs(&$tabs_gui)
3420 {
3421 global $rbacsystem,$ilAccess,$ilUser, $lng, $ilHelp;
3422
3423 $ilHelp->setScreenIdComponent("crs");
3424
3425 $this->ctrl->setParameter($this,"ref_id",$this->ref_id);
3426
3427 if($ilAccess->checkAccess('read','',$this->ref_id))
3428 {
3429 $tabs_gui->addTab('view_content', $lng->txt("content"),
3430 $this->ctrl->getLinkTarget($this,''));
3431 }
3432
3433 // learning objectives
3434 if($ilAccess->checkAccess('write','',$this->ref_id))
3435 {
3436 include_once('./Modules/Course/classes/class.ilCourseObjective.php');
3437 if($this->object->getViewMode() == IL_CRS_VIEW_OBJECTIVE or ilCourseObjective::_getCountObjectives($this->object->getId()))
3438 {
3439 $tabs_gui->addTarget(
3440 'crs_objectives',
3441 $this->ctrl->getLinkTargetByClass('illoeditorgui',''),
3442 'illoeditorgui'
3443 );
3444
3445 }
3446 }
3447
3448 if ($ilAccess->checkAccess('visible','',$this->ref_id))
3449 {
3450 //$next_class = $this->ctrl->getNextClass($this);
3451
3452 // this is not nice. tabs should be displayed in ilcoursegui
3453 // not via ilrepositorygui, then next_class == ilinfoscreengui
3454 // could be checked
3455 $force_active = (strtolower($_GET["cmdClass"]) == "ilinfoscreengui"
3456 || strtolower($_GET["cmdClass"]) == "ilnotegui")
3457 ? true
3458 : false;
3459 $tabs_gui->addTarget("info_short",
3460 $this->ctrl->getLinkTargetByClass(
3461 array("ilobjcoursegui", "ilinfoscreengui"), "showSummary"),
3462 "infoScreen",
3463 "", "", $force_active);
3464 }
3465 if ($ilAccess->checkAccess('write','',$this->ref_id))
3466 {
3467 $force_active = (strtolower($_GET["cmdClass"]) == "ilconditionhandlergui"
3468 && $_GET["item_id"] == "")
3469 ? true
3470 : false;
3471 $tabs_gui->addTarget("settings",
3472 $this->ctrl->getLinkTarget($this, "edit"),
3473 array("edit", "editMapSettings", "editCourseIcons", "listStructure"), "", "", $force_active);
3474 }
3475
3476
3477 $is_participant = ilCourseParticipants::_isParticipant($this->ref_id, $ilUser->getId());
3478 include_once './Services/Mail/classes/class.ilMail.php';
3479 $mail = new ilMail($GLOBALS['ilUser']->getId());
3480
3481 // member list
3482 if($ilAccess->checkAccess('write','',$this->ref_id))
3483 {
3484 $tabs_gui->addTarget("members",
3485 $this->ctrl->getLinkTarget($this, "members"),
3486 "members",
3487 get_class($this));
3488 }
3489 elseif(
3490 $this->object->getShowMembers() == $this->object->SHOW_MEMBERS_ENABLED and
3491 $is_participant
3492 )
3493 {
3494 $this->tabs_gui->addTarget(
3495 'members',
3496 $this->ctrl->getLinkTargetByClass('ilUsersGalleryGUI', 'view'),
3497 '',
3498 'ilUsersGalleryGUI'
3499 );
3500 }
3501 elseif(
3502 $this->object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL and
3503 $GLOBALS['rbacsystem']->checkAccess('internal_mail',$mail->getMailObjectReferenceId ()) and
3504 $is_participant
3505 )
3506 {
3507 $tabs_gui->addTarget("members",
3508 $this->ctrl->getLinkTarget($this, "mailMembersBtn"),
3509 "members",
3510 get_class($this));
3511
3512 }
3513
3514
3515 // learning progress
3516 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
3517 if(ilLearningProgressAccess::checkAccess($this->object->getRefId(), $is_participant))
3518 {
3519 $tabs_gui->addTarget('learning_progress',
3520 $this->ctrl->getLinkTargetByClass(array('ilobjcoursegui','illearningprogressgui'),''),
3521 '',
3522 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
3523 }
3524
3525
3526
3527 // license overview
3528 include_once("Services/License/classes/class.ilLicenseAccess.php");
3529 if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id)
3531 {
3532 $tabs_gui->addTarget("licenses",
3533 $this->ctrl->getLinkTargetByClass('illicenseoverviewgui', ''),
3534 "", "illicenseoverviewgui");
3535 }
3536
3537 // meta data
3538 if ($ilAccess->checkAccess('write','',$this->ref_id))
3539 {
3540 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
3541 $mdgui = new ilObjectMetaDataGUI($this->object);
3542 $mdtab = $mdgui->getTab();
3543 if($mdtab)
3544 {
3545 $tabs_gui->addTarget("meta_data",
3546 $mdtab,
3547 "",
3548 "ilobjectmetadatagui");
3549 }
3550 }
3551
3552 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
3553 {
3554 $tabs_gui->addTarget(
3555 'export',
3556 $this->ctrl->getLinkTargetByClass('ilexportgui',''),
3557 'export',
3558 'ilexportgui'
3559 );
3560 }
3561
3562 if ($ilAccess->checkAccess('edit_permission','',$this->ref_id))
3563 {
3564 $tabs_gui->addTarget("perm_settings",
3565 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
3566 array("perm","info","owner"), 'ilpermissiongui');
3567 }
3568
3569 if ($this->ctrl->getTargetScript() == "adm_object.php")
3570 {
3571 $tabs_gui->addTarget("show_owner",
3572 $this->ctrl->getLinkTarget($this, "owner"), "owner", get_class($this));
3573
3574 if ($this->tree->getSavedNodeData($this->ref_id))
3575 {
3576 $tabs_gui->addTarget("trash",
3577 $this->ctrl->getLinkTarget($this, "trash"), "trash", get_class($this));
3578 }
3579 }
3580 // Join/Leave
3581 if($ilAccess->checkAccess('join','',$this->ref_id)
3582 and !$this->object->getMemberObject()->isAssigned())
3583 {
3584 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
3585 if(ilCourseWaitingList::_isOnList($ilUser->getId(), $this->object->getId()))
3586 {
3587 $tabs_gui->addTab(
3588 'leave',
3589 $this->lng->txt('membership_leave'),
3590 $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui','show','')
3591 );
3592
3593 }
3594 else
3595 {
3596
3597 $tabs_gui->addTarget("join",
3598 $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', "show"),
3599 'show',
3600 "");
3601 }
3602 }
3603 if($ilAccess->checkAccess('leave','',$this->object->getRefId())
3604 and $this->object->getMemberObject()->isMember())
3605 {
3606 $tabs_gui->addTarget("crs_unsubscribe",
3607 $this->ctrl->getLinkTarget($this, "unsubscribe"),
3608 'leave',
3609 "");
3610
3611 }
3612 }
3613
3614 function fetchPrintSubscriberData($a_members)
3615 {
3616 foreach($a_members as $member_id)
3617 {
3618
3619 $member_data = $this->object->getMembersObject()->getSubscriberData($member_id);
3620
3621 if($tmp_obj = ilObjectFactory::getInstanceByObjId($member_id,false))
3622 {
3623 $print_member[$member_id]['login'] = $tmp_obj->getLogin();
3624 $print_member[$member_id]['name'] = $tmp_obj->getLastname().', '.$tmp_obj->getFirstname();
3625 $print_member[$member_id]['time'] = ilDatePresentation::formatDate(new ilDateTime($member_data['time'],IL_CAL_UNIX));
3626 }
3627 }
3628 switch($_SESSION['crs_print_sort'])
3629 {
3630 case 'lastname':
3631 return ilUtil::sortArray($print_member,'name',$_SESSION['crs_print_order'], false, true);
3632
3633 case 'login':
3634 return ilUtil::sortArray($print_member,'login',$_SESSION['crs_print_order'], false, true);
3635
3636 case 'sub_time':
3637 return ilUtil::sortArray($print_member,'time',$_SESSION['crs_print_order'], false, true);
3638
3639 default:
3640 return ilUtil::sortArray($print_member,'name',$_SESSION['crs_print_order'], false, true);
3641 }
3642 }
3643
3644 function fetchPrintMemberData($a_members)
3645 {
3646 global $ilAccess,$lng;
3647
3648 $lng->loadLanguageModule('trac');
3649
3650 #$is_admin = (bool) $ilAccess->checkAccess("write",'',$this->object->getRefId());
3651 $is_admin = true;
3652
3653 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
3655
3656 if($privacy->enabledCourseAccessTimes())
3657 {
3658 include_once('./Services/Tracking/classes/class.ilLearningProgress.php');
3659 $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
3660 }
3661
3662 if($this->show_tracking)
3663 {
3664 include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
3665 $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
3666 $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
3667 $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
3668 }
3669
3670 foreach($a_members as $member_id)
3671 {
3672 // GET USER OBJ
3673 if($tmp_obj = ilObjectFactory::getInstanceByObjId($member_id,false))
3674 {
3675 $print_member[$member_id]['login'] = $tmp_obj->getLogin();
3676 $print_member[$member_id]['name'] = $tmp_obj->getLastname().', '.$tmp_obj->getFirstname();
3677
3678 if($this->object->getMembersObject()->isAdmin($member_id))
3679 {
3680 $print_member[$member_id]['role'] = $this->lng->txt("il_crs_admin");
3681 }
3682 elseif($this->object->getMembersObject()->isTutor($member_id))
3683 {
3684 $print_member[$member_id]['role'] = $this->lng->txt("il_crs_tutor");
3685 }
3686 elseif($this->object->getMembersObject()->isMember($member_id))
3687 {
3688 $print_member[$member_id]['role'] = $this->lng->txt("il_crs_member");
3689 }
3690 if($this->object->getMembersObject()->isAdmin($member_id) or $this->object->getMembersObject()->isTutor($member_id))
3691 {
3692 if($this->object->getMembersObject()->isNotificationEnabled($member_id))
3693 {
3694 $print_member[$member_id]['status'] = $this->lng->txt("crs_notify");
3695 }
3696 else
3697 {
3698 $print_member[$member_id]['status'] = $this->lng->txt("crs_no_notify");
3699 }
3700 }
3701 else
3702 {
3703 if($this->object->getMembersObject()->isBlocked($member_id))
3704 {
3705 $print_member[$member_id]['status'] = $this->lng->txt("crs_blocked");
3706 }
3707 else
3708 {
3709 $print_member[$member_id]['status'] = $this->lng->txt("crs_unblocked");
3710 }
3711 }
3712
3713 if($is_admin)
3714 {
3715 $print_member[$member_id]['passed'] = $this->object->getMembersObject()->hasPassed($member_id) ?
3716 $this->lng->txt('crs_member_passed') :
3717 $this->lng->txt('crs_member_not_passed');
3718
3719 }
3720 if($privacy->enabledCourseAccessTimes())
3721 {
3722 if(isset($progress[$member_id]['ts']) and $progress[$member_id]['ts'])
3723 {
3725 $print_member[$member_id]['access'] = ilDatePresentation::formatDate(new ilDateTime($progress[$member_id]['ts'],IL_CAL_UNIX));
3727 }
3728 else
3729 {
3730 $print_member[$member_id]['access'] = $this->lng->txt('no_date');
3731 }
3732 }
3733 if($this->show_tracking)
3734 {
3735 if(in_array($member_id,$completed))
3736 {
3737 $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_COMPLETED);
3738 }
3739 elseif(in_array($member_id,$in_progress))
3740 {
3741 $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_IN_PROGRESS);
3742 }
3743 elseif(in_array($member_id,$failed))
3744 {
3745 $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_FAILED);
3746 }
3747 else
3748 {
3749 $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_NOT_ATTEMPTED);
3750 }
3751 }
3752
3753 }
3754 }
3755
3756 switch($_SESSION['crs_print_sort'])
3757 {
3758 case 'progress':
3759 return ilUtil::sortArray($print_member,'progress',$_SESSION['crs_print_order'], false, true);
3760
3761 case 'access_time':
3762 return ilUtil::sortArray($print_member,'access',$_SESSION['crs_print_order'], false, true);
3763
3764 case 'lastname':
3765 return ilUtil::sortArray($print_member,'name',$_SESSION['crs_print_order'], false, true);
3766
3767 case 'login':
3768 return ilUtil::sortArray($print_member,'login',$_SESSION['crs_print_order'], false, true);
3769
3770 case 'passed':
3771 return ilUtil::sortArray($print_member,'passed',$_SESSION['crs_print_order'], false, true);
3772
3773 case 'blocked':
3774 case 'notification':
3775 return ilUtil::sortArray($print_member,'status',$_SESSION['crs_print_order'], false, true);
3776
3777 default:
3778 return ilUtil::sortArray($print_member,'name',$_SESSION['crs_print_order'], false, true);
3779 }
3780 }
3781
3783 {
3784 global $ilTabs;
3785
3786 $this->checkPermission('write');
3787
3788 $ilTabs->clearTargets();
3789 $ilTabs->setBackTarget($this->lng->txt('back'),
3790 $this->ctrl->getLinkTarget($this, 'members'));
3791
3792 $list = $this->initAttendanceList();
3793 $form = $list->initForm('printMembersOutput');
3794 $this->tpl->setContent($form->getHTML());
3795 }
3796
3797 protected function initAttendanceList()
3798 {
3799 include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
3800 $members_obj = ilCourseParticipants::_getInstanceByObjId($this->object->getId());
3801
3802 include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
3803 $waiting_list = new ilCourseWaitingList($this->object->getId());
3804
3805 include_once 'Services/Membership/classes/class.ilAttendanceList.php';
3806 $list = new ilAttendanceList($this, $members_obj, $waiting_list);
3807 $list->setId('crsmemlst');
3808
3809 $list->setTitle($this->lng->txt('crs_members_print_title'),
3810 $this->lng->txt('obj_crs').': '.$this->object->getTitle());
3811
3812 include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
3813 $this->show_tracking = (ilObjUserTracking::_enabledLearningProgress() and
3815 if($this->show_tracking)
3816 {
3817 include_once('./Services/Object/classes/class.ilObjectLP.php');
3818 $olp = ilObjectLP::getInstance($this->object->getId());
3819 $this->show_tracking = $olp->isActive();
3820 }
3821 if($this->show_tracking)
3822 {
3823 $list->addPreset('progress', $this->lng->txt('learning_progress'), true);
3824 }
3825
3826 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
3828 if($privacy->enabledCourseAccessTimes())
3829 {
3830 $list->addPreset('access', $this->lng->txt('last_access'), true);
3831 }
3832
3833 $list->addPreset('status', $this->lng->txt('crs_status'), true);
3834 $list->addPreset('passed', $this->lng->txt('crs_passed'), true);
3835
3836 return $list;
3837 }
3838
3839 public function getAttendanceListUserData($a_user_id)
3840 {
3841 return $this->members_data[$a_user_id];
3842 }
3843
3845 {
3846 $list = $this->initAttendanceList();
3847 $list->initFromForm();
3848 $list->setCallback(array($this, 'getAttendanceListUserData'));
3849
3850 $this->members_data = $this->fetchPrintMemberData($this->object->getMembersObject()->getParticipants());
3851 $list->getNonMemberUserData($this->members_data);
3852
3853 $list->getFullscreenHTML();
3854 exit();
3855
3856 /* currently deactivated
3857
3858 // SUBSCRIBERS
3859 if(count($members = $this->object->getMembersObject()->getSubscribers()))
3860 {
3861 $tpl = new ilTemplate('tpl.crs_members_print.html',true,true,'Modules/Course');
3862
3863 $members = $this->fetchPrintSubscriberData($members);
3864 foreach($members as $member_data)
3865 {
3866 $tpl->setCurrentBlock("subscribers_row");
3867 $tpl->setVariable("SLOGIN",$member_data['login']);
3868 $tpl->setVariable("SNAME",$member_data['name']);
3869 $tpl->setVariable("STIME",$member_data["time"]);
3870 $tpl->parseCurrentBlock();
3871 }
3872
3873 $tpl->setVariable("SUBSCRIBERS_IMG_SOURCE",ilUtil::getImagePath('icon_usr.svg'));
3874 $tpl->setVariable("SUBSCRIBERS_IMG_ALT",$this->lng->txt('crs_subscribers'));
3875 $tpl->setVariable("SUBSCRIBERS_TABLE_HEADER",$this->lng->txt('crs_subscribers'));
3876 $tpl->setVariable("TXT_SLOGIN",$this->lng->txt('username'));
3877 $tpl->setVariable("TXT_SNAME",$this->lng->txt('name'));
3878 $tpl->setVariable("TXT_STIME",$this->lng->txt('crs_time'));
3879
3880 $tpl->show();
3881 }
3882 */
3883 }
3884
3886 {
3887 include_once "./Services/Table/classes/class.ilTableGUI.php";
3888
3889 return new ilTableGUI(0,false);
3890 }
3891
3892
3893 function __setTableGUIBasicData(&$tbl,&$result_set,$from = "")
3894 {
3895 switch($from)
3896 {
3897 case "members":
3898 $offset = $_GET["update_members"] ? $_GET["offset"] : 0;
3899 $order = $_GET["update_members"] ? $_GET["sort_by"] : 'login';
3900 $direction = $_GET["update_members"] ? $_GET["sort_order"] : '';
3901 break;
3902
3903 case "subscribers":
3904 $offset = $_GET["update_subscribers"] ? $_GET["offset"] : 0;
3905 $order = $_GET["update_subscribers"] ? $_GET["sort_by"] : 'sub_time';
3906 $direction = $_GET["update_subscribers"] ? $_GET["sort_order"] : '';
3907 break;
3908
3909 case "group":
3910 $offset = $_GET["offset"];
3911 $order = $_GET["sort_by"] ? $_GET["sort_by"] : "title";
3912 $direction = $_GET["sort_order"];
3913 break;
3914
3915 case "role":
3916 $offset = $_GET["offset"];
3917 $order = $_GET["sort_by"] ? $_GET["sort_by"] : "title";
3918 $direction = $_GET["sort_order"];
3919 break;
3920
3921 default:
3922 $offset = $_GET["offset"];
3923 // init sort_by (unfortunatly sort_by is preset with 'title'
3924 if ($_GET["sort_by"] == "title" or empty($_GET["sort_by"]))
3925 {
3926 $_GET["sort_by"] = "login";
3927 }
3928 $order = $_GET["sort_by"];
3929 $direction = $_GET["sort_order"];
3930 break;
3931 }
3932
3933 $tbl->setOrderColumn($order);
3934 $tbl->setOrderDirection($direction);
3935 $tbl->setOffset($offset);
3936 $tbl->setLimit($_GET["limit"]);
3937 $tbl->setMaxCount(count($result_set));
3938 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
3939 $tbl->setData($result_set);
3940 }
3941
3942
3943 function __showRemoveFromWaitingListTable($a_result_set)
3944 {
3945 $tbl =& $this->__initTableGUI();
3946 $tpl =& $tbl->getTemplateObject();
3947
3948 $tpl->setCurrentBlock("tbl_form_header");
3949 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
3950 $tpl->parseCurrentBlock();
3951 $tpl->setCurrentBlock("tbl_action_btn");
3952 $tpl->setVariable("BTN_NAME","cancelMember");
3953 $tpl->setVariable("BTN_VALUE",$this->lng->txt("cancel"));
3954 $tpl->parseCurrentBlock();
3955 $tpl->setCurrentBlock("tbl_action_btn");
3956 $tpl->setVariable("BTN_NAME","performRemoveFromWaitingList");
3957 $tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
3958 $tpl->parseCurrentBlock();
3959 $tpl->setCurrentBlock("tbl_action_row");
3960 $tpl->setVariable("COLUMN_COUNTS",4);
3961 $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.svg"));
3962 $tpl->parseCurrentBlock();
3963
3964 $tbl->setTitle($this->lng->txt("crs_header_remove_from_waiting_list"),"icon_usr.svg",
3965 $this->lng->txt("crs_header_remove_from_waiting_list"));
3966 $tbl->setHeaderNames(array($this->lng->txt("username"),
3967 $this->lng->txt("firstname"),
3968 $this->lng->txt("lastname"),
3969 $this->lng->txt("crs_time")));
3970 $tbl->setHeaderVars(array("login",
3971 "firstname",
3972 "lastname",
3973 "sub_time"),
3974 array("ref_id" => $this->object->getRefId(),
3975 "cmd" => "members",
3976 "cmdClass" => "ilobjcoursegui",
3977 "cmdNode" => $_GET["cmdNode"]));
3978
3979 $tbl->setColumnWidth(array("25%","25%","25%","25%"));
3980
3981 $this->__setTableGUIBasicData($tbl,$a_result_set);
3982 $tbl->render();
3983
3984 $this->tpl->setVariable("EDIT_MEMBER_TABLE",$tbl->tpl->get());
3985
3986 return true;
3987 }
3988
3989 function __showDeleteSubscriberTable($a_result_set)
3990 {
3991 $tbl =& $this->__initTableGUI();
3992 $tpl =& $tbl->getTemplateObject();
3993
3994 $tpl->setCurrentBlock("tbl_form_header");
3995 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
3996 $tpl->parseCurrentBlock();
3997 $tpl->setCurrentBlock("tbl_action_btn");
3998 $tpl->setVariable("BTN_NAME","removeSubscribers");
3999 $tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
4000 $tpl->parseCurrentBlock();
4001 $tpl->setCurrentBlock("tbl_action_btn");
4002 $tpl->setVariable("BTN_NAME","cancelMember");
4003 $tpl->setVariable("BTN_VALUE",$this->lng->txt("cancel"));
4004 $tpl->parseCurrentBlock();
4005 $tpl->setCurrentBlock("tbl_action_row");
4006 $tpl->setVariable("COLUMN_COUNTS",4);
4007 $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.svg"));
4008 $tpl->parseCurrentBlock();
4009
4010 $tbl->setTitle($this->lng->txt("crs_header_delete_subscribers"),"icon_usr.svg",$this->lng->txt("crs_header_delete_members"));
4011 $tbl->setHeaderNames(array($this->lng->txt("username"),
4012 $this->lng->txt("firstname"),
4013 $this->lng->txt("lastname"),
4014 $this->lng->txt("crs_time")));
4015 $tbl->setHeaderVars(array("login",
4016 "firstname",
4017 "lastname",
4018 "sub_time"),
4019 array("ref_id" => $this->object->getRefId(),
4020 "cmd" => "members",
4021 "cmdClass" => "ilobjcoursegui",
4022 "cmdNode" => $_GET["cmdNode"]));
4023
4024 $tbl->setColumnWidth(array("25%","25%","25%","25%"));
4025
4026 $this->__setTableGUIBasicData($tbl,$a_result_set);
4027 $tbl->render();
4028
4029 $this->tpl->setVariable("EDIT_MEMBER_TABLE",$tbl->tpl->get());
4030
4031 return true;
4032 }
4033
4034
4035
4036 function __showWaitingListTable($a_result_set,$a_waiting_list_ids = NULL)
4037 {
4038 $actions = array("addFromWaitingList" => $this->lng->txt("crs_add_subscribers"),
4039 "removeFromWaitingList" => $this->lng->txt("crs_delete_from_waiting_list"));
4040
4041 $tbl =& $this->__initTableGUI();
4042 $tpl =& $tbl->getTemplateObject();
4043
4044 $tbl->enable('select_all');
4045 $tbl->setFormName("wait_form");
4046 $tbl->setSelectAllCheckbox("waiting_list");
4047
4048
4049 // SET FOOTER BUTTONS
4050 $tpl->setCurrentBlock("tbl_action_row");
4051
4052 $tpl->setVariable("COLUMN_COUNTS",5);
4053
4054 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
4055
4056 $tpl->setCurrentBlock("tbl_action_select");
4057 $tpl->setVariable("SELECT_ACTION",ilUtil::formSelect(1,"action",$actions,false,true));
4058 $tpl->setVariable("BTN_NAME","gateway");
4059 $tpl->setVariable("BTN_VALUE",$this->lng->txt("execute"));
4060 $tpl->parseCurrentBlock();
4061
4062 $tpl->setCurrentBlock("tbl_action_row");
4063 $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
4064 $tpl->parseCurrentBlock();
4065
4066
4067 $tbl->setTitle($this->lng->txt("crs_waiting_list"),"icon_usr.svg",$this->lng->txt("crs_waiting_list"));
4068 $tbl->setHeaderNames(array('',
4069 $this->lng->txt("name"),
4070 $this->lng->txt("login"),
4071 $this->lng->txt("crs_time")));
4072 $tbl->setHeaderVars(array("",
4073 "name",
4074 "login",
4075 "sub_time"),
4076 array("ref_id" => $this->object->getRefId(),
4077 "cmd" => "members",
4078 "update_subscribers" => 1,
4079 "cmdClass" => "ilobjcoursegui",
4080 "cmdNode" => $_GET["cmdNode"]));
4081 $tbl->setColumnWidth(array('1%'));
4082
4083 $this->__setTableGUIBasicData($tbl,$a_result_set,"subscribers");
4084 $tbl->render();
4085
4086 $this->tpl->setCurrentBlock('sub_wait_table');
4087 $this->tpl->setVariable('SUB_WAIT_NAME','wait_form');
4088 $this->tpl->setVariable('SUB_WAIT_FORMACTION',$this->ctrl->getFormAction($this));
4089 $this->tpl->setVariable("SUB_WAIT_TABLE_CONTENT",$tbl->tpl->get());
4090 $this->tpl->parseCurrentBlock();
4091
4092 return true;
4093 }
4094
4095
4096
4097 function __getDateSelect($a_type,$a_varname,$a_selected)
4098 {
4099 switch($a_type)
4100 {
4101 case "minute":
4102 for($i=0;$i<=60;$i++)
4103 {
4104 $days[$i] = $i < 10 ? "0".$i : $i;
4105 }
4106 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
4107
4108 case "hour":
4109 for($i=0;$i<24;$i++)
4110 {
4111 $days[$i] = $i < 10 ? "0".$i : $i;
4112 }
4113 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
4114
4115 case "day":
4116 for($i=1;$i<32;$i++)
4117 {
4118 $days[$i] = $i < 10 ? "0".$i : $i;
4119 }
4120 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
4121
4122 case "month":
4123 for($i=1;$i<13;$i++)
4124 {
4125 $month[$i] = $i < 10 ? "0".$i : $i;
4126 }
4127 return ilUtil::formSelect($a_selected,$a_varname,$month,false,true);
4128
4129 case "year":
4130 for($i = date("Y",time());$i < date("Y",time()) + 3;++$i)
4131 {
4132 $year[$i] = $i;
4133 }
4134 return ilUtil::formSelect($a_selected,$a_varname,$year,false,true);
4135 }
4136 }
4137
4138 function __toUnix($a_time_arr)
4139 {
4140 return mktime($a_time_arr["hour"],
4141 $a_time_arr["minute"],
4142 $a_time_arr["second"],
4143 $a_time_arr["month"],
4144 $a_time_arr["day"],
4145 $a_time_arr["year"]);
4146 }
4148 {
4149 unset($_SESSION["crs_delete_member_ids"]);
4150 unset($_SESSION["crs_delete_subscriber_ids"]);
4151 unset($_SESSION["crs_search_str"]);
4152 unset($_SESSION["crs_search_for"]);
4153 unset($_SESSION["crs_group"]);
4154 unset($_SESSION["crs_role"]);
4155 unset($_SESSION["crs_archives"]);
4156 }
4157
4159 {
4160 global $rbacsystem,$ilUser,$ilAccess,$ilErr,$ilTabs,$ilNavigationHistory,$ilCtrl, $ilToolbar;
4161
4162 $next_class = $this->ctrl->getNextClass($this);
4163 $cmd = $this->ctrl->getCmd();
4164
4165 $this->prepareOutput();
4166
4167 // show repository tree
4168 $this->showRepTree();
4169
4170 // add entry to navigation history
4171 if(!$this->getCreationMode() &&
4172 $ilAccess->checkAccess('read', '', $_GET['ref_id']))
4173 {
4174 include_once("./Services/Link/classes/class.ilLink.php");
4175 $ilNavigationHistory->addItem($_GET["ref_id"],
4176 ilLink::_getLink($_GET["ref_id"], "crs"), "crs");
4177 }
4178
4179 if(!$this->getCreationMode())
4180 {
4181 if(IS_PAYMENT_ENABLED)
4182 {
4183 include_once 'Services/Payment/classes/class.ilPaymentObject.php';
4184 if(ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = (isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL) ))
4185 {
4186 $ilTabs->setTabActive('info_short');
4187
4188 include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
4189 $this->ctrl->setReturn($this, '');
4190 $pp_gui = new ilShopPurchaseGUI($this->object->getRefId());
4191 $this->ctrl->forwardCommand($pp_gui);
4192 return true;
4193 }
4194 }
4195 }
4196
4197 switch($next_class)
4198 {
4199 case "ilinfoscreengui":
4200 $this->infoScreen(); // forwards command
4201 break;
4202
4203 case 'ilobjectmetadatagui';
4204 if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
4205 {
4206 $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
4207 }
4208 $this->tabs_gui->setTabActive('meta_data');
4209 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
4210 $md_gui = new ilObjectMetaDataGUI($this->object);
4211 $this->ctrl->forwardCommand($md_gui);
4212 break;
4213
4214 case 'ilcourseregistrationgui':
4215 $this->ctrl->setReturn($this,'');
4216 $this->tabs_gui->setTabActive('join');
4217 include_once('./Modules/Course/classes/class.ilCourseRegistrationGUI.php');
4218 $registration = new ilCourseRegistrationGUI($this->object, $this);
4219 $this->ctrl->forwardCommand($registration);
4220 break;
4221
4222 case 'ilobjectcustomuserfieldsgui':
4223 include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
4224
4225 if(isset($_REQUEST['member_id']))
4226 {
4227 $this->ctrl->setReturn($this,'members');
4228 }
4229
4230 $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
4231 $this->setSubTabs('properties');
4232 $this->tabs_gui->setTabActive('settings');
4233 $this->ctrl->forwardCommand($cdf_gui);
4234 break;
4235
4236 case "ilcourseobjectivesgui":
4237 include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
4238
4239 $this->ctrl->setReturn($this,"");
4240 $reg_gui =& new ilCourseObjectivesGUI($this->object->getRefId());
4241 $ret =& $this->ctrl->forwardCommand($reg_gui);
4242 break;
4243
4244 case 'ilobjcoursegroupinggui':
4245 include_once './Modules/Course/classes/class.ilObjCourseGroupingGUI.php';
4246
4247 $this->ctrl->setReturn($this,'edit');
4248 $this->setSubTabs('properties');
4249 $crs_grp_gui =& new ilObjCourseGroupingGUI($this->object,(int) $_GET['obj_id']);
4250 $this->ctrl->forwardCommand($crs_grp_gui);
4251 $this->tabs_gui->setTabActive('settings');
4252 $this->tabs_gui->setSubTabActive('groupings');
4253 break;
4254
4255 case "ilcolumngui":
4256 $this->tabs_gui->setTabActive('none');
4257 $this->checkPermission("read");
4258 //$this->prepareOutput();
4259 //include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
4260 //$this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
4261 // ilObjStyleSheet::getContentStylePath(0));
4262 //$this->renderObject();
4263 $this->viewObject();
4264 break;
4265
4266 case "ilconditionhandlergui":
4267 include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
4268 // preconditions for whole course
4269 $this->setSubTabs("properties");
4270 $this->tabs_gui->setTabActive('settings');
4271 $new_gui =& new ilConditionHandlerGUI($this);
4272 $this->ctrl->forwardCommand($new_gui);
4273 break;
4274
4275 case "illearningprogressgui":
4276 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
4277
4279 $this->object->getRefId(),
4280 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
4281 $this->ctrl->forwardCommand($new_gui);
4282 $this->tabs_gui->setTabActive('learning_progress');
4283 break;
4284
4285 case 'ilusersgallerygui':
4286 $is_admin = (bool)$ilAccess->checkAccess('write', '', $this->object->ref_id);
4287 $is_participant = (bool)ilCourseParticipants::_isParticipant($this->ref_id, $ilUser->getId());
4288 if(
4289 !$is_admin &&
4290 (
4291 $this->object->getShowMembers() == $this->object->SHOW_MEMBERS_DISABLED ||
4292 !$is_participant
4293 )
4294 )
4295 {
4296 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
4297 }
4298
4299 $this->addMailToMemberButton($ilToolbar, 'jump2UsersGallery');
4300
4301 require_once 'Services/User/classes/class.ilUsersGalleryGUI.php';
4302 require_once 'Services/User/classes/class.ilUsersGalleryParticipants.php';
4303 $this->setSubTabs('members');
4304 $this->tabs_gui->setTabActive('members');
4305 $this->tabs_gui->setSubTabActive('crs_members_gallery');
4306
4307 $provider = new ilUsersGalleryParticipants($this->object->getMembersObject());
4308 $gallery_gui = new ilUsersGalleryGUI($provider);
4309 $this->ctrl->forwardCommand($gallery_gui);
4310 break;
4311
4312 case 'illicenseoverviewgui':
4313 include_once("./Services/License/classes/class.ilLicenseOverviewGUI.php");
4315 $ret =& $this->ctrl->forwardCommand($license_gui);
4316 $this->tabs_gui->setTabActive('licenses');
4317 break;
4318
4319 case 'ilpermissiongui':
4320 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
4321 $this->tabs_gui->setTabActive('perm_settings');
4322 $perm_gui =& new ilPermissionGUI($this);
4323 $ret =& $this->ctrl->forwardCommand($perm_gui);
4324 break;
4325
4326 case 'ilrepositorysearchgui':
4327
4328 if(!$this->checkPermissionBool('write'))
4329 {
4330 $GLOBALS['ilErr']->raiseError($GLOBALS['lng']->txt('permission_denied'), $GLOBALS['ilErr']->WARNING);
4331 }
4332 include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
4333 $rep_search = new ilRepositorySearchGUI();
4334 if(ilCourseParticipant::_getInstanceByObjId($this->object->getId(), $GLOBALS['ilUser']->getId())->isAdmin() or $this->checkPermissionBool('edit_permission'))
4335 {
4336 $rep_search->setCallback($this,
4337 'assignMembersObject',
4338 $this->getLocalRoles()
4339 );
4340 }
4341 else
4342 {
4343 //#18445 excludes admin role
4344 $rep_search->setCallback($this,
4345 'assignMembersObject',
4346 $this->getLocalRoles(array($this->object->getDefaultAdminRole()))
4347 );
4348
4349 }
4350
4351
4352 $this->checkLicenses();
4353
4354 // Set tabs
4355 $this->ctrl->setReturn($this,'members');
4356 $ret =& $this->ctrl->forwardCommand($rep_search);
4357 $this->setSubTabs('members');
4358 $this->tabs_gui->setTabActive('members');
4359 $this->tabs_gui->setSubTabActive('crs_member_administration');
4360 break;
4361
4362 case 'ilcoursecontentinterface':
4363
4364 $this->initCourseContentInterface();
4365 $this->cci_obj->cci_setContainer($this);
4366
4367 $this->ctrl->forwardCommand($this->cci_obj);
4368 $this->setSubTabs('content');
4369 $this->tabs_gui->setTabActive('content');
4370 break;
4371
4372 case 'ilcoursecontentgui':
4373 $this->ctrl->setReturn($this,'members');
4374 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
4375 $course_content_obj = new ilCourseContentGUI($this);
4376 $this->ctrl->forwardCommand($course_content_obj);
4377 break;
4378
4379 case 'ilpublicuserprofilegui':
4380 $this->tpl->enableDragDropFileUpload(null);
4381 require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
4382 $this->setSubTabs('members');
4383 $this->tabs_gui->setTabActive('members');
4384 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
4385 $profile_gui->setBackUrl($this->ctrl->getLinkTargetByClass("ilUsersGalleryGUI",'view'));
4386 $this->tabs_gui->setSubTabActive('crs_members_gallery');
4387 $html = $this->ctrl->forwardCommand($profile_gui);
4388 $this->tpl->setVariable("ADM_CONTENT", $html);
4389 break;
4390
4391 case 'ilmemberexportgui':
4392 include_once('./Services/Membership/classes/Export/class.ilMemberExportGUI.php');
4393
4394 $this->setSubTabs('members');
4395 $this->tabs_gui->setTabActive('members');
4396 $this->tabs_gui->setSubTabActive('export_members');
4397 $export = new ilMemberExportGUI($this->object->getRefId());
4398 $this->ctrl->forwardCommand($export);
4399 break;
4400
4401 case 'ilmemberagreementgui':
4402 include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
4403 $this->tabs_gui->clearTargets();
4404
4405 $this->ctrl->setReturn($this,'');
4406 $agreement = new ilMemberAgreementGUI($this->object->getRefId());
4407 $this->ctrl->forwardCommand($agreement);
4408 break;
4409
4410 case 'ilsessionoverviewgui':
4411 $this->setSubTabs('members');
4412 $this->tabs_gui->setTabActive('members');
4413 $this->tabs_gui->setSubTabActive('events');
4414
4415 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
4416 $prt = ilCourseParticipants::_getInstanceByObjId($this->object->getId());
4417
4418 include_once('./Modules/Session/classes/class.ilSessionOverviewGUI.php');
4419 $overview = new ilSessionOverviewGUI($this->object->getRefId(), $prt);
4420 $this->ctrl->forwardCommand($overview);
4421 break;
4422
4423 // container page editing
4424 case "ilcontainerpagegui":
4425 $ret = $this->forwardToPageObject();
4426 if ($ret != "")
4427 {
4428 $this->tpl->setContent($ret);
4429 }
4430 break;
4431
4432 case "ilcontainerstartobjectspagegui":
4433 // file downloads, etc. (currently not active)
4434 include_once "Services/Container/classes/class.ilContainerStartObjectsPageGUI.php";
4435 $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
4436 $ret = $this->ctrl->forwardCommand($pgui);
4437 if($ret)
4438 {
4439 $this->tpl->setContent($ret);
4440 }
4441 break;
4442
4443 case 'ilobjectcopygui':
4444 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
4445 $cp = new ilObjectCopyGUI($this);
4446 $cp->setType('crs');
4447 $this->ctrl->forwardCommand($cp);
4448 break;
4449
4450 case "ilobjstylesheetgui":
4451 $this->forwardToStyleSheet();
4452 break;
4453
4454 case 'ilcourseparticipantsgroupsgui':
4455 include_once './Modules/Course/classes/class.ilCourseParticipantsGroupsGUI.php';
4456
4457 $cmg_gui = new ilCourseParticipantsGroupsGUI($this->object->getRefId());
4458 $this->setSubTabs('members');
4459
4460 if($cmd == "show" || $cmd = "")
4461 {
4462 $this->addMailToMemberButton($ilToolbar, "members");
4463 }
4464 $this->tabs_gui->setTabActive('members');
4465 $this->ctrl->forwardCommand($cmg_gui);
4466 break;
4467
4468 case 'ilexportgui':
4469 $this->tabs_gui->setTabActive('export');
4470 include_once './Services/Export/classes/class.ilExportGUI.php';
4471 $exp = new ilExportGUI($this);
4472 $exp->addFormat('xml');
4473 $this->ctrl->forwardCommand($exp);
4474 break;
4475
4476 case "ilcommonactiondispatchergui":
4477 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
4479 $this->ctrl->forwardCommand($gui);
4480 break;
4481
4482 case 'ildidactictemplategui':
4483 $this->ctrl->setReturn($this,'edit');
4484 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
4485 $did = new ilDidacticTemplateGUI($this);
4486 $this->ctrl->forwardCommand($did);
4487 break;
4488
4489 case "ilcertificategui":
4490 $this->tabs_gui->activateTab("settings");
4491 $this->setSubTabs("properties");
4492
4493 include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
4494 include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
4495 $output_gui = new ilCertificateGUI(new ilCourseCertificateAdapter($this->object));
4496 $this->ctrl->forwardCommand($output_gui);
4497 break;
4498
4499 case 'ilobjectservicesettingsgui':
4500 $this->ctrl->setReturn($this,'edit');
4501 $this->setSubTabs("properties");
4502 $this->tabs_gui->activateTab('settings');
4503 $this->tabs_gui->acltivateSubTab('tool_settings');
4504
4505 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
4506 $service = new ilObjectServiceSettingsGUI(
4507 $this,
4508 $this->object->getId(),
4509 array(
4511 ));
4512 $this->ctrl->forwardCommand($service);
4513 break;
4514
4515 case 'illoeditorgui':
4516 #$this->tabs_gui->clearTargets();
4517 #$this->tabs_gui->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,''));
4518 $this->tabs_gui->activateTab('crs_objectives');
4519
4520 include_once './Modules/Course/classes/Objectives/class.ilLOEditorGUI.php';
4521 $editor = new ilLOEditorGUI($this->object);
4522 $this->ctrl->forwardCommand($editor);
4523 break;
4524
4525 case 'ilcontainerstartobjectsgui':
4526 $this->ctrl->setReturn($this,'edit');
4527 $this->tabs_gui->clearTargets();
4528 $this->tabs_gui->setBackTarget($this->lng->txt("back_to_crs_content"),
4529 $this->ctrl->getLinkTarget($this, "edit"));
4530 $this->tabs_gui->addTab("start",
4531 $this->lng->txt("crs_start_objects"),
4532 $this->ctrl->getLinkTargetByClass("ilcontainerstartobjectsgui", "listStructure"));
4533 global $ilHelp;
4534 $ilHelp->setScreenIdComponent("crs");
4535
4536 include_once './Services/Container/classes/class.ilContainerStartObjectsGUI.php';
4537 $stgui = new ilContainerStartObjectsGUI($this->object);
4538 $this->ctrl->forwardCommand($stgui);
4539 break;
4540
4541 case 'illomembertestresultgui':
4542 include_once './Modules/Course/classes/Objectives/class.ilLOMemberTestResultGUI.php';
4543 $GLOBALS['ilCtrl']->setReturn($this, 'members');
4544 $GLOBALS['ilTabs']->clearTargets();
4545 $GLOBALS['ilTabs']->setBackTarget(
4546 $GLOBALS['lng']->txt('back'),
4547 $GLOBALS['ilCtrl']->getLinkTarget($this,'members')
4548 );
4549
4550 $result_view = new ilLOMemberTestResultGUI($this, $this->object, (int) $_REQUEST['uid']);
4551 $this->ctrl->forwardCommand($result_view);
4552 break;
4553
4554 case 'ilmailmembersearchgui':
4555 include_once 'Services/Mail/classes/class.ilMail.php';
4556 $mail = new ilMail($ilUser->getId());
4557
4558 if(!($this->object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL ||
4559 $ilAccess->checkAccess('write',"",$this->object->getRefId())) &&
4560 $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId()))
4561 {
4562 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
4563 }
4564
4565 $this->tabs_gui->setTabActive('members');
4566
4567 include_once './Services/Contact/classes/class.ilMailMemberSearchGUI.php';
4568 include_once './Services/Contact/classes/class.ilMailMemberCourseRoles.php';
4569
4570 $mail_search = new ilMailMemberSearchGUI($this, $this->object->getRefId(), new ilMailMemberCourseRoles());
4571 $mail_search->setObjParticipants(ilCourseParticipants::_getInstanceByObjId($this->object->getId()));
4572 $this->ctrl->forwardCommand($mail_search);
4573 break;
4574 default:
4575/* if(!$this->creation_mode)
4576 {
4577 $this->checkPermission('visible');
4578 }*/
4579 /*
4580 if(!$this->creation_mode and !$ilAccess->checkAccess('visible','',$this->object->getRefId(),'crs'))
4581 {
4582 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
4583 }
4584 */
4585
4586 // #9401 - see also ilStartupGUI::_checkGoto()
4587 if($cmd == 'infoScreenGoto')
4588 {
4589 if(ilObjCourse::_isActivated($this->object->getId()) &&
4590 ilObjCourse::_registrationEnabled($this->object->getId()))
4591 {
4592 $cmd = 'join';
4593 }
4594 else
4595 {
4596 $cmd = 'infoScreen';
4597 }
4598 }
4599
4600 if(!$this->creation_mode)
4601 {
4602 if ($cmd == "infoScreen")
4603 {
4604 $this->checkPermission("visible");
4605 }
4606 else
4607 {
4608// $this->checkPermission("read");
4609 }
4610 }
4611
4612
4613 if( !$this->creation_mode
4614 && $cmd != 'infoScreen'
4615 && $cmd != 'sendfile'
4616 && $cmd != 'unsubscribe'
4617 && $cmd != 'performUnsubscribe'
4618 && !$ilAccess->checkAccess("read",'',$this->object->getRefId())
4619 || $cmd == 'join'
4620 || $cmd == 'subscribe')
4621 {
4622 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
4623 if($rbacsystem->checkAccess('join',$this->object->getRefId()) &&
4624 !ilCourseParticipants::_isParticipant($this->object->getRefId(),$ilUser->getId()))
4625 {
4626 include_once('./Modules/Course/classes/class.ilCourseRegistrationGUI.php');
4627 $this->ctrl->redirectByClass("ilCourseRegistrationGUI");
4628 }
4629 else
4630 {
4631 $this->infoScreenObject();
4632 break;
4633 }
4634 }
4635
4636 if($cmd == 'listObjectives')
4637 {
4638 include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
4639
4640 $this->ctrl->setReturn($this,"");
4641 $obj_gui =& new ilCourseObjectivesGUI($this->object->getRefId());
4642 $ret =& $this->ctrl->forwardCommand($obj_gui);
4643 break;
4644 }
4645
4646 // Dirty hack for course timings view
4647 if($this->forwardToTimingsView())
4648 {
4649 break;
4650 }
4651
4652 if(!$cmd)
4653 {
4654 $cmd = 'view';
4655 }
4656 $cmd .= 'Object';
4657 $this->$cmd();
4658
4659 break;
4660 }
4661
4662 $this->addHeaderAction();
4663
4664 return true;
4665 }
4666
4673 private function checkAgreement()
4674 {
4675 global $ilUser,$ilAccess;
4676
4677 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
4678 {
4679 return true;
4680 }
4681
4682 // Disable aggrement if is not member of course
4683 if(!$this->object->getMemberObject()->isAssigned())
4684 {
4685 return true;
4686 }
4687
4688 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
4689 if(ilMemberViewSettings::getInstance()->isActive())
4690 {
4691 return true;
4692 }
4693
4694 include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
4695 include_once('Services/Membership/classes/class.ilMemberAgreement.php');
4697
4698 // Check agreement
4699 if(($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId()))
4700 and !ilMemberAgreement::_hasAccepted($ilUser->getId(),$this->object->getId()))
4701 {
4702 $GLOBALS['ilLog']->write(__METHOD__.': Missing course confirmation.');
4703 return false;
4704 }
4705 // Check required fields
4706 include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
4707 if(!ilCourseUserData::_checkRequired($ilUser->getId(),$this->object->getId()))
4708 {
4709 $GLOBALS['ilLog']->write(__METHOD__.': Missing required fields');
4710 return false;
4711 }
4712 return true;
4713 }
4714
4715
4722 private function checkLicenses($a_keep = false)
4723 {
4724 global $lng;
4725
4726
4727 include_once("Services/License/classes/class.ilLicenseAccess.php");
4729 {
4730 $lic_set = new ilSetting("license");
4731 $buffer = $lic_set->get("license_warning");
4732
4733 include_once("./Services/License/classes/class.ilLicense.php");
4734 $licensed_items = ilLicense::_getLicensedChildObjects($this->object->getRefId());
4735 foreach ($licensed_items as $item)
4736 {
4737 $license =& new ilLicense($item['obj_id']);
4738 $remaining = $license->getRemainingLicenses();
4739 if ($remaining <= $buffer)
4740 {
4741 $lng->loadlanguageModule("license");
4742 ilUtil::sendInfo(sprintf($this->lng->txt("course_licenses_rare"), $remaining), $a_keep);
4743 break;
4744 }
4745 }
4746 }
4747 }
4748
4749 // STATIC
4750 function _forwards()
4751 {
4752 return array("ilCourseRegisterGUI",'ilConditionHandlerGUI');
4753 }
4754
4756 {
4757 global $ilLocator;
4758 switch ($this->ctrl->getCmd())
4759 {
4760 default:
4761 #$ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""));
4762 break;
4763 }
4764 }
4765
4769 public static function _goto($a_target, $a_add = "")
4770 {
4771 global $ilAccess, $ilErr, $lng,$ilUser;
4772
4773 include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
4774 if(substr($a_add,0,5) == 'rcode')
4775 {
4776 if($ilUser->getId() == ANONYMOUS_USER_ID)
4777 {
4778 // Redirect to login for anonymous
4780 "login.php?target=".$_GET["target"]."&cmd=force_login&lang=".
4781 $ilUser->getCurrentLanguage()
4782 );
4783 }
4784
4785 // Redirects to target location after assigning user to course
4787 $a_target,
4789 substr($a_add,5)
4790 );
4791 }
4792
4793 if ($a_add == "mem" && $ilAccess->checkAccess("write", "", $a_target))
4794 {
4795 ilObjectGUI::_gotoRepositoryNode($a_target, "members");
4796 }
4797
4798 if ($ilAccess->checkAccess("read", "", $a_target))
4799 {
4801 }
4802 else
4803 {
4804 // to do: force flat view
4805 if ($ilAccess->checkAccess("visible", "", $a_target))
4806 {
4807 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreenGoto");
4808 }
4809 else
4810 {
4811 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
4812 {
4813 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
4816 }
4817 }
4818 }
4819 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
4820 }
4821
4822
4823 function toUnix($date,$time = array())
4824 {
4825 return mktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
4826 }
4827
4828 function __prepareDateSelect($a_unix_time)
4829 {
4830 return array('y' => date('Y',$a_unix_time),
4831 'm' => date('n',$a_unix_time),
4832 'd' => date('d',$a_unix_time));
4833 }
4834
4835 function __prepareTimeSelect($a_unix_time)
4836 {
4837 return array('h' => date('G',$a_unix_time),
4838 'm' => date('i',$a_unix_time),
4839 's' => date('s',$a_unix_time));
4840 }
4841
4842 // Copy wizard
4843
4848 {
4849 global $ilUser, $ilCtrl, $ilUser, $ilAccess;
4850
4851 $this->setSubTabs("properties");
4852 $this->tabs_gui->setTabActive('settings');
4853
4854 if (!ilMapUtil::isActivated() ||
4855 !$ilAccess->checkAccess("write", "", $this->object->getRefId()))
4856 {
4857 return;
4858 }
4859
4860 $latitude = $this->object->getLatitude();
4861 $longitude = $this->object->getLongitude();
4862 $zoom = $this->object->getLocationZoom();
4863
4864 // Get Default settings, when nothing is set
4865 if ($latitude == 0 && $longitude == 0 && $zoom == 0)
4866 {
4868 $latitude = $def["latitude"];
4869 $longitude = $def["longitude"];
4870 $zoom = $def["zoom"];
4871 }
4872
4873 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
4874 $form = new ilPropertyFormGUI();
4875 $form->setFormAction($ilCtrl->getFormAction($this));
4876
4877 $form->setTitle($this->lng->txt("crs_map_settings"));
4878
4879 // enable map
4880 $public = new ilCheckboxInputGUI($this->lng->txt("crs_enable_map"),
4881 "enable_map");
4882 $public->setValue("1");
4883 $public->setChecked($this->object->getEnableCourseMap());
4884 $form->addItem($public);
4885
4886 // map location
4887 $loc_prop = new ilLocationInputGUI($this->lng->txt("crs_map_location"),
4888 "location");
4889 $loc_prop->setLatitude($latitude);
4890 $loc_prop->setLongitude($longitude);
4891 $loc_prop->setZoom($zoom);
4892 $form->addItem($loc_prop);
4893
4894 $form->addCommandButton("saveMapSettings", $this->lng->txt("save"));
4895
4896 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
4897 //$this->tpl->show();
4898 }
4899
4901 {
4902 global $ilCtrl, $ilUser;
4903
4904 $this->object->setLatitude(ilUtil::stripSlashes($_POST["location"]["latitude"]));
4905 $this->object->setLongitude(ilUtil::stripSlashes($_POST["location"]["longitude"]));
4906 $this->object->setLocationZoom(ilUtil::stripSlashes($_POST["location"]["zoom"]));
4907 $this->object->setEnableCourseMap(ilUtil::stripSlashes($_POST["enable_map"]));
4908 $this->object->update();
4909
4910 $ilCtrl->redirect($this, "editMapSettings");
4911 }
4912
4917 {
4918 global $tpl;
4919
4920 $this->tabs_gui->setTabActive("members");
4921 $this->setSubTabs('members');
4922 $this->tabs_gui->setSubTabActive("crs_members_map");
4923
4924 include_once("./Services/Maps/classes/class.ilMapUtil.php");
4925 if (!ilMapUtil::isActivated() || !$this->object->getEnableCourseMap())
4926 {
4927 return;
4928 }
4929
4930 $map = ilMapUtil::getMapGUI();
4931 $map->setMapId("course_map")
4932 ->setWidth("700px")
4933 ->setHeight("500px")
4934 ->setLatitude($this->object->getLatitude())
4935 ->setLongitude($this->object->getLongitude())
4936 ->setZoom($this->object->getLocationZoom())
4937 ->setEnableTypeControl(true)
4938 ->setEnableNavigationControl(true)
4939 ->setEnableCentralMarker(true);
4940
4941 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
4942 $members = ilCourseParticipants::_getInstanceByObjId($this->object->getId())->getParticipants();
4943 if(count($members))
4944 {
4945 foreach($members as $user_id)
4946 {
4947 $map->addUserMarker($user_id);
4948 }
4949 }
4950
4951 $tpl->setContent($map->getHTML());
4952 $tpl->setLeftContent($map->getUserListHTML());
4953 }
4954
4958 function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
4959 {
4960 return ilObjCourseGUI::_modifyItemGUI($a_item_list_gui, 'ilcoursecontentgui', $a_item_data, $a_show_path,
4961 $this->object->getAboStatus(), $this->object->getRefId(), $this->object->getId());
4962 }
4963
4967 static function _modifyItemGUI($a_item_list_gui, $a_cmd_class, $a_item_data, $a_show_path,
4968 $a_abo_status, $a_course_ref_id, $a_course_obj_id, $a_parent_ref_id = 0)
4969 {
4970 global $lng, $ilAccess;
4971
4972 // this is set for folders within the course
4973 if ($a_parent_ref_id == 0)
4974 {
4975 $a_parent_ref_id = $a_course_ref_id;
4976 }
4977
4978 // Special handling for tests in courses with learning objectives
4979 if($a_item_data['type'] == 'tst' and
4981 {
4982 $a_item_list_gui->addCommandLinkParameter(array('crs_show_result' => $a_course_ref_id));
4983 }
4984
4985 $a_item_list_gui->enableSubscribe($a_abo_status);
4986
4987 $is_tutor = ($ilAccess->checkAccess('write','',
4988 $a_course_ref_id,'crs', $a_course_obj_id));
4989
4990 if($a_show_path and $is_tutor)
4991 {
4992 $a_item_list_gui->addCustomProperty($lng->txt('path'),
4993 ilContainer::_buildPath($a_item_data['ref_id'], $a_course_ref_id),
4994 false,
4995 true);
4996 }
4997 }
4998
5003 {
5004 global $ilAccess, $lng, $ilCtrl;
5005
5006 if ($this->object->getType() != 'crs')
5007 {
5008 return true;
5009 }
5010 if (!$ilAccess->checkAccess('write','',
5011 $this->object->getRefId(),'crs',$this->object->getId()))
5012 {
5013 $is_tutor = false;
5014 // No further tabs if objective view or archives
5015 if($this->object->enabledObjectiveView())
5016 {
5017 return false;
5018 }
5019 }
5020 else
5021 {
5022 $is_tutor = true;
5023 }
5024
5025 // These subtabs should also work, if the command is called directly in
5026 // ilObjCourseGUI, so please use ...ByClass methods.
5027 // (see ilObjCourseGUI->executeCommand: case "ilcolumngui")
5028
5029 if(!$_SESSION['crs_timings_panel'][$this->object->getId()] or 1)
5030 {
5031 if (!$this->isActiveAdministrationPanel())
5032 {
5033 $this->tabs_gui->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTargetByClass("ilobjcoursegui", "view"));
5034 }
5035 else
5036 {
5037 $this->tabs_gui->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTargetByClass("ilobjcoursegui", "disableAdministrationPanel"));
5038 }
5039 }
5040 if($this->object->getViewMode() == IL_CRS_VIEW_TIMING)
5041 {
5042 $this->tabs_gui->addSubTabTarget('timings_timings',
5043 $this->ctrl->getLinkTargetByClass('ilcoursecontentgui','editUserTimings'));
5044 }
5045
5046 $this->addStandardContainerSubTabs(false);
5047
5048
5049 return true;
5050 }
5051
5059 protected function loadDate($a_field)
5060 {
5061 global $ilUser;
5062
5063 include_once('./Services/Calendar/classes/class.ilDateTime.php');
5064
5065 // #10206 / #10217
5066 if(is_array($_POST[$a_field]['date']))
5067 {
5068 $dt['year'] = (int) $_POST[$a_field]['date']['y'];
5069 $dt['mon'] = (int) $_POST[$a_field]['date']['m'];
5070 $dt['mday'] = (int) $_POST[$a_field]['date']['d'];
5071 $dt['hours'] = (int) $_POST[$a_field]['time']['h'];
5072 $dt['minutes'] = (int) $_POST[$a_field]['time']['m'];
5073 $dt['seconds'] = (int) $_POST[$a_field]['time']['s'];
5074 }
5075 else
5076 {
5077 $date = date_parse($_POST[$a_field]['date']." ".$_POST[$a_field]['time']);
5078 $dt['year'] = (int) $date['year'];
5079 $dt['mon'] = (int) $date['month'];
5080 $dt['mday'] = (int) $date['day'];
5081 $dt['hours'] = (int) $date['hour'];
5082 $dt['minutes'] = (int) $date['minute'];
5083 $dt['seconds'] = (int) $date['second'];
5084 }
5085
5086 $date = new ilDateTime($dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
5087 return $date;
5088 }
5089
5097 public function askResetObject()
5098 {
5099 ilUtil::sendQuestion($this->lng->txt('crs_objectives_reset_sure'));
5100
5101 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
5102 $confirm = new ilConfirmationGUI();
5103 $confirm->setFormAction($this->ctrl->getFormAction($this));
5104 $confirm->setConfirm($this->lng->txt('reset'), 'reset');
5105 $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
5106
5107 $GLOBALS['tpl']->setContent($confirm->getHTML());
5108 return true;
5109 }
5110
5111 function resetObject()
5112 {
5113 global $ilUser;
5114
5115 include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
5116 $usr_results = new ilLOUserResults($this->object->getId(), $GLOBALS['ilUser']->getId());
5117 $usr_results->delete();
5118
5119
5120 include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
5121 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
5123 $this->object->getId(),
5124 $GLOBALS['ilUser']->getId()
5125 );
5126
5127 include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
5128
5129 $tmp_obj_res = new ilCourseObjectiveResult($ilUser->getId());
5130 $tmp_obj_res->reset($this->object->getId());
5131
5132 $ilUser->deletePref('crs_objectives_force_details_'.$this->object->getId());
5133
5134 ilUtil::sendSuccess($this->lng->txt('crs_objectives_reseted'));
5135 $this->viewObject();
5136 }
5137
5139 {
5140 global $ilAccess,$ilUser;
5141
5142 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
5143 {
5144 return true;
5145 }
5146
5147 include_once './Services/Container/classes/class.ilContainerStartObjects.php';
5148 $this->start_obj = new ilContainerStartObjects($this->object->getRefId(),
5149 $this->object->getId());
5150 if(count($this->start_obj->getStartObjects()) &&
5151 !$this->start_obj->allFullfilled($ilUser->getId()))
5152 {
5153 return false;
5154 }
5155
5156 return true;
5157 }
5158
5163 public function prepareOutput()
5164 {
5165 global $rbacsystem;
5166 if(!$this->getCreationMode())
5167 {
5168 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
5170 if($settings->isActive() and $settings->getContainer() != $this->object->getRefId())
5171 {
5172 $settings->setContainer($this->object->getRefId());
5173 $rbacsystem->initMemberView();
5174 }
5175 }
5176 parent::prepareOutput();
5177 }
5178
5183 public function createMailSignature()
5184 {
5185 $link = chr(13).chr(10).chr(13).chr(10);
5186 $link .= $this->lng->txt('crs_mail_permanent_link');
5187 $link .= chr(13).chr(10).chr(13).chr(10);
5188 include_once './Services/Link/classes/class.ilLink.php';
5189 $link .= ilLink::_getLink($this->object->getRefId());
5190 return rawurlencode(base64_encode($link));
5191 }
5192
5193 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
5194 {
5195 global $ilSetting, $ilUser;
5196
5197 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
5198
5199 if($lg && $this->ref_id && ilCourseParticipants::_isParticipant($this->ref_id, $ilUser->getId()))
5200 {
5201 // certificate
5202 include_once "Services/Certificate/classes/class.ilCertificate.php";
5204 ilCertificate::isObjectActive($this->object->getId()) &&
5205 ilCourseParticipants::getDateTimeOfPassed($this->object->getId(), $ilUser->getId()))
5206 {
5207 $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
5208
5209 $this->lng->loadLanguageModule("certificate");
5210 $lg->addCustomCommand($cert_url, "download_certificate");
5211
5212 $lg->addHeaderIcon("cert_icon",
5213 ilUtil::getImagePath("icon_cert.svg"),
5214 $this->lng->txt("download_certificate"),
5215 null,
5216 null,
5217 $cert_url);
5218 }
5219
5220 // notification
5221 include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
5223 {
5224 $noti = new ilMembershipNotifications($this->ref_id);
5225 if(!$noti->isCurrentUserActive())
5226 {
5227 $lg->addHeaderIcon("not_icon",
5228 ilUtil::getImagePath("notification_off.svg"),
5229 $this->lng->txt("crs_notification_deactivated"));
5230
5231 $this->ctrl->setParameter($this, "crs_ntf", 1);
5232 $caption = "crs_activate_notification";
5233 }
5234 else
5235 {
5236 $lg->addHeaderIcon("not_icon",
5237 ilUtil::getImagePath("notification_on.svg"),
5238 $this->lng->txt("crs_notification_activated"));
5239
5240 $this->ctrl->setParameter($this, "crs_ntf", 0);
5241 $caption = "crs_deactivate_notification";
5242 }
5243
5244 if($noti->canCurrentUserEdit())
5245 {
5246 $lg->addCustomCommand($this->ctrl->getLinkTarget($this, "saveNotification"),
5247 $caption);
5248 }
5249
5250 $this->ctrl->setParameter($this, "crs_ntf", "");
5251 }
5252 }
5253
5254 return $lg;
5255 }
5256
5258 {
5259 global $ilUser, $ilAccess;
5260
5261 $user_id = null;
5262 if ($ilAccess->checkAccess('write','',$this->ref_id))
5263 {
5264 $user_id = $_REQUEST["member_id"];
5265 }
5266 if(!$user_id)
5267 {
5268 $user_id = $ilUser->getId();
5269 }
5270
5271 include_once "Services/Certificate/classes/class.ilCertificate.php";
5273 !ilCertificate::isObjectActive($this->object->getId()) ||
5274 !ilCourseParticipants::getDateTimeOfPassed($this->object->getId(), $user_id))
5275 {
5276 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
5277 $this->ctrl->redirect($this);
5278 }
5279
5280 include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
5281 $certificate = new ilCertificate(new ilCourseCertificateAdapter($this->object));
5282 $certificate->outCertificate(array("user_id" => $user_id), true);
5283 }
5284
5285
5286 protected function afterSaveCallback()
5287 {
5288 $this->ctrl->redirectByClass(array('ilrepositorygui','ilobjcoursegui','illoeditorgui'),'materials');
5289 }
5290
5291 public function saveSortingObject()
5292 {
5293 if(isset($_POST['position']["lobj"]))
5294 {
5295 $lobj = $_POST['position']["lobj"];
5296 unset($_POST['position']["lobj"]);
5297
5298 $objective_order = array();
5299 foreach($lobj as $objective_id => $materials)
5300 {
5301 $objective_order[$objective_id] = $materials[0];
5302 unset($lobj[$objective_id][0]);
5303 }
5304
5305 // objective order
5306 include_once "Modules/Course/classes/class.ilCourseObjective.php";
5307 asort($objective_order);
5308 $pos = 0;
5309 foreach(array_keys($objective_order) as $objective_id)
5310 {
5311 $obj = new ilCourseObjective($this->object, $objective_id);
5312 $obj->writePosition(++$pos);
5313 }
5314
5315 // material order
5316 include_once "Modules/Course/classes/class.ilCourseObjectiveMaterials.php";
5317 foreach($lobj as $objective_id => $materials)
5318 {
5319 $objmat = new ilCourseObjectiveMaterials($objective_id);
5320
5321 asort($materials);
5322 $pos = 0;
5323 foreach(array_keys($materials) as $ass_id)
5324 {
5325 $objmat->writePosition($ass_id, ++$pos);
5326 }
5327 }
5328 }
5329
5330 return parent::saveSortingObject();
5331 }
5332
5338 {
5339 include_once './Services/Link/classes/class.ilLink.php';
5341 return TRUE;
5342
5343 }
5344
5348 protected function redirectLocToTestObject($a_force_new_run = NULL)
5349 {
5350 $objective_id = (int) $_REQUEST['objective_id'];
5351 $test_id = (int) $_REQUEST['tid'];
5352
5353 include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
5354 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
5355 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
5356
5357
5358 $res = new ilLOUserResults(
5359 $this->object->getId(),
5360 $GLOBALS['ilUser']->getId());
5361 $passed = $res->getCompletedObjectiveIds();
5362
5363 $has_completed = FALSE;
5364 if($objective_id)
5365 {
5366 $objective_ids = array($objective_id);
5367 if(in_array($objective_id, $passed))
5368 {
5369 $has_completed = TRUE;
5370 $passed = array();
5371 }
5372 }
5373 else
5374 {
5375 include_once './Modules/Course/classes/class.ilCourseObjective.php';
5376 $objective_ids = ilCourseObjective::_getObjectiveIds($this->object->getId(),true);
5377
5378 // do not disable objective question if all are passed
5379 if(count($objective_ids) == count($passed))
5380 {
5381 $has_completed = TRUE;
5382 $passed = array();
5383 }
5384 }
5385
5386 if($has_completed)
5387 {
5388 // show confirmation
5389 $this->redirectLocToTestConfirmation($objective_id,$test_id);
5390 return TRUE;
5391 }
5392
5393 include_once './Services/Link/classes/class.ilLink.php';
5395 return TRUE;
5396
5397 }
5398
5404 protected function redirectLocToTestConfirmation($a_objective_id, $a_test_id)
5405 {
5406 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
5407 $confirm = new ilConfirmationGUI();
5408 $confirm->setFormAction($GLOBALS['ilCtrl']->getFormAction($this));
5409
5410 if($a_objective_id)
5411 {
5412 $question = $this->lng->txt('crs_loc_objective_passed_confirmation');
5413 }
5414 else
5415 {
5416 $question = $this->lng->txt('crs_loc_objectives_passed_confirmation');
5417 }
5418
5419 $confirm->addHiddenItem('objective_id', $a_objective_id);
5420 $confirm->addHiddenItem('tid', $a_test_id);
5421 $confirm->setConfirm($this->lng->txt('crs_loc_tst_start'), 'redirectLocToTestConfirmed');
5422 $confirm->setCancel($this->lng->txt('cancel'), 'view');
5423
5424 ilUtil::sendQuestion($question);
5425
5426 $GLOBALS['tpl']->setContent($confirm->getHTML());
5427 return true;
5428 }
5429 // end-patch lok
5430
5437 protected function getLocalRoles($a_exclude = array())
5438 {
5439 $crs_admin = $this->object->getDefaultAdminRole();
5440 $crs_member = $this->object->getDefaultMemberRole();
5441 $local_roles = $this->object->getLocalCourseRoles(false);
5442 $crs_roles = array();
5443
5444 //put the course member role to the top of the crs_roles array
5445 if(in_array($crs_member, $local_roles))
5446 {
5447 $crs_roles[$crs_member] = ilObjRole::_getTranslation(array_search ($crs_member, $local_roles));
5448 unset($local_roles[$crs_roles[$crs_member]]);
5449 }
5450
5451 foreach($local_roles as $title => $role_id)
5452 {
5453 if($role_id == $crs_admin && !$this->hasAdminPermission())
5454 {
5455 continue;
5456 }
5457
5458 $crs_roles[$role_id] = ilObjRole::_getTranslation($title);
5459 }
5460
5461 if(count($a_exclude) > 0)
5462 {
5463 foreach($a_exclude as $excluded_role)
5464 {
5465 if(isset($crs_roles[$excluded_role]))
5466 {
5467 unset($crs_roles[$excluded_role]);
5468 }
5469 }
5470 }
5471 return $crs_roles;
5472 }
5473
5478 protected function hasAdminPermission()
5479 {
5480 global $ilUser;
5481 return ilCourseParticipant::_getInstanceByObjId($this->object->getId(), $ilUser->getId())->isAdmin()
5482 or $this->checkPermissionBool('edit_permission');
5483 }
5484
5485 protected function mailMembersBtnObject()
5486 {
5487 global $ilToolbar;
5488 $this->checkPermission('read');
5489
5490 $this->tabs_gui->setTabActive('members');
5491
5492 $this->addMailToMemberButton($ilToolbar, "mailMembersBtn");
5493 }
5494
5502 protected function addMailToMemberButton($ilToolbar, $back_cmd = null, $a_separator = false)
5503 {
5504 global $ilUser, $rbacsystem, $ilAccess;
5505 include_once 'Services/Mail/classes/class.ilMail.php';
5506 $mail = new ilMail($ilUser->getId());
5507
5508 if(
5509 ($this->object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL or
5510 $ilAccess->checkAccess('write',"",$this->object->getRefId())) and
5511 $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId()))
5512 {
5513
5514 if($a_separator)
5515 {
5516 $ilToolbar->addSeparator();
5517 }
5518
5519 if($back_cmd)
5520 {
5521 $this->ctrl->setParameter($this, "back_cmd", $back_cmd);
5522 }
5523
5524 $ilToolbar->addButton($this->lng->txt("mail_members"),
5525 $this->ctrl->getLinkTargetByClass('ilMailMemberSearchGUI','')
5526 );
5527 }
5528 }
5529
5533 protected function jump2UsersGalleryObject()
5534 {
5535 $this->ctrl->redirectByClass('ilUsersGalleryGUI');
5536 }
5537
5539 {
5540 if(!is_array($_POST["subscribers"]))
5541 {
5542 ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"));
5543 $this->membersObject();
5544
5545 return false;
5546 }
5547
5548 $this->lng->loadLanguageModule('mmbr');
5549
5550 $this->checkPermission('write');
5551 $this->setSubTabs('members');
5552 $this->tabs_gui->setTabActive('members');
5553 $this->tabs_gui->setSubTabActive('crs_member_administration');
5554
5555 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
5556 $c_gui = new ilConfirmationGUI();
5557
5558 // set confirm/cancel commands
5559 $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseSubscribers"));
5560 $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
5561 $c_gui->setCancel($this->lng->txt("cancel"), "members");
5562 $c_gui->setConfirm($this->lng->txt("confirm"), "refuseSubscribers");
5563
5564 foreach($_POST["subscribers"] as $subscribers)
5565 {
5566 $name = ilObjUser::_lookupName($subscribers);
5567
5568 $c_gui->addItem('subscribers[]',
5569 $name['user_id'],
5570 $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
5571 ilUtil::getImagePath('icon_usr.svg'));
5572 }
5573
5574 $this->tpl->setContent($c_gui->getHTML());
5575 return true;
5576 }
5577
5579 {
5580 if(!is_array($_POST["subscribers"]))
5581 {
5582 ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"));
5583 $this->membersObject();
5584
5585 return false;
5586 }
5587 $this->checkPermission('write');
5588 $this->setSubTabs('members');
5589 $this->tabs_gui->setTabActive('members');
5590 $this->tabs_gui->setSubTabActive('crs_member_administration');
5591
5592 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
5593 $c_gui = new ilConfirmationGUI();
5594
5595 // set confirm/cancel commands
5596 $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignSubscribers"));
5597 $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
5598 $c_gui->setCancel($this->lng->txt("cancel"), "members");
5599 $c_gui->setConfirm($this->lng->txt("confirm"), "assignSubscribers");
5600
5601 foreach($_POST["subscribers"] as $subscribers)
5602 {
5603 $name = ilObjUser::_lookupName($subscribers);
5604
5605 $c_gui->addItem('subscribers[]',
5606 $name['user_id'],
5607 $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
5608 ilUtil::getImagePath('icon_usr.svg'));
5609 }
5610
5611 $this->tpl->setContent($c_gui->getHTML());
5612 return true;
5613 }
5614
5616 {
5617 if(!is_array($_POST["waiting"]))
5618 {
5619 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
5620 $this->membersObject();
5621
5622 return false;
5623 }
5624
5625 $this->lng->loadLanguageModule('mmbr');
5626
5627 $this->checkPermission('write');
5628 $this->setSubTabs('members');
5629 $this->tabs_gui->setTabActive('members');
5630 $this->tabs_gui->setSubTabActive('crs_member_administration');
5631
5632 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
5633 $c_gui = new ilConfirmationGUI();
5634
5635 // set confirm/cancel commands
5636 $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseFromList"));
5637 $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
5638 $c_gui->setCancel($this->lng->txt("cancel"), "members");
5639 $c_gui->setConfirm($this->lng->txt("confirm"), "refuseFromList");
5640
5641 foreach($_POST["waiting"] as $waiting)
5642 {
5643 $name = ilObjUser::_lookupName($waiting);
5644
5645 $c_gui->addItem('waiting[]',
5646 $name['user_id'],
5647 $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
5648 ilUtil::getImagePath('icon_usr.svg'));
5649 }
5650
5651 $this->tpl->setContent($c_gui->getHTML());
5652 return true;
5653 }
5654
5656 {
5657 if(!is_array($_POST["waiting"]))
5658 {
5659 ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"));
5660 $this->membersObject();
5661
5662 return false;
5663 }
5664 $this->checkPermission('write');
5665 $this->setSubTabs('members');
5666 $this->tabs_gui->setTabActive('members');
5667 $this->tabs_gui->setSubTabActive('crs_member_administration');
5668
5669 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
5670 $c_gui = new ilConfirmationGUI();
5671
5672 // set confirm/cancel commands
5673 $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignFromWaitingList"));
5674 $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
5675 $c_gui->setCancel($this->lng->txt("cancel"), "members");
5676 $c_gui->setConfirm($this->lng->txt("confirm"), "assignFromWaitingList");
5677
5678 foreach($_POST["waiting"] as $waiting)
5679 {
5680 $name = ilObjUser::_lookupName($waiting);
5681
5682 $c_gui->addItem('waiting[]',
5683 $name['user_id'],
5684 $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
5685 ilUtil::getImagePath('icon_usr.svg'));
5686 }
5687
5688 $this->tpl->setContent($c_gui->getHTML());
5689 return true;
5690 }
5691} // END class.ilObjCourseGUI
5692?>
print $file
$failed
Definition: Utf8Test.php:86
$section
Definition: Utf8Test.php:84
$_GET["client_id"]
$_SESSION["AccountId"]
const IL_CRS_SUBSCRIPTION_LIMITED
const IL_CRS_VIEW_SESSIONS
const IL_CRS_ACTIVATION_UNLIMITED
const IL_CRS_VIEW_SIMPLE
const IL_CRS_VIEW_OBJECTIVE
const IL_CRS_VIEW_BY_TYPE
const IL_CRS_SUBSCRIPTION_PASSWORD
const IL_CRS_ARCHIVE_NONE
const IL_CRS_SUBSCRIPTION_CONFIRMATION
const IL_CRS_VIEW_ARCHIVE
const IL_CRS_VIEW_TIMING
const IL_CRS_SUBSCRIPTION_UNLIMITED
const IL_CRS_ACTIVATION_LIMITED
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_SUBSCRIPTION_DIRECT
const IL_CAL_FKT_GETDATE
const IL_CAL_UNIX
const IL_CAL_DATETIME
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_CRS_MEMBER
const IL_CRS_TUTOR
Base class for attendance lists.
GUI class to create PDF certificates.
Create PDF certificates.
static isObjectActive($a_obj_id)
_recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
_catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
class ilConditionHandlerGUI
Confirmation screen class.
Class ilContainerGUI.
afterUpdate()
Post (successful) object update hook.
& forwardToPageObject()
forward command to page object
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
addStandardContainerSubTabs($a_include_view=true)
Add standar container subtabs for view, manage, oderdering and text/media editor link.
ilContainerGUI($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
forwardToStyleSheet()
Forward to style object.
showCustomIconsEditing($a_input_colspan=1, ilPropertyFormGUI $a_form=null, $a_as_section=true)
show edit section of custom icons for container
saveSortingSettings(ilPropertyFormGUI $form)
Save sorting settings.
Class ilContainerStartObjectsGUI.
Container start objects page GUI class.
static setBlockedForLP($a_status)
Toggle LP blocking property status.
Class ilCourseContentGUI.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
static _hasFields($a_container_id)
Check if there are any define fields.
static _fieldsToInfoString($a_obj_id)
Fields to info string.
& _readFilesByCourse($a_course_id)
class ilCourseObjectiveMaterials
class ilcourseobjective
static _getCountObjectives($a_obj_id, $a_activated_only=false)
get count objectives
static _getObjectiveIds($course_id, $a_activated_only=false)
class ilobjcourseobjectivesgui
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
Class ilCourseParticipantsGroupsGUI.
static getDateTimeOfPassed($a_obj_id, $a_usr_id)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static getMemberRoles($a_ref_id)
Get member roles.
GUI class for course registrations.
static _checkRequired($a_usr_id, $a_obj_id)
Check required fields.
This class represents a custom property in a property form.
input GUI for a time span (start and end date)
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
This class represents a date/time property in a property form.
@classDescription Date and time handling
Class for single dates.
GUI class for didactic template settings inside repository objects.
Class ilECSCourseSettings.
static _getInstanceByType($a_type)
Get Singleton Instance.
Export User Interface Class.
This class represents a file property in a property form.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
Class ilInfoScreenGUI.
Class ilLOEditorGUI.
static deleteRuns($a_container_id, $a_user_id)
Delete runs @global type $ilDB.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
static _lookupInProgressForObject($a_obj_id, $a_user_ids=null)
Get in progress users for object.
const LP_STATUS_COMPLETED
const LP_STATUS_FAILED
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
static _lookupProgressByObjId($a_obj_id)
lookup progress for a specific object
static _isEnabled()
Check, if licencing is enabled This check is called from the ilAccessHandler class.
_getLicensedChildObjects($a_ref_id)
Get a list of all sub objects with activated licensing.
This class represents a location property in a property form.
static _fillHTMLMetaTags($a_rbac_id, $a_obj_id, $a_type)
Fill html meta tags.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
static getLinkTarget($gui, $cmd, Array $gui_params=array(), Array $mail_params=array(), $context_params=array())
static setRecipients(array $recipients)
const CONTEXT_KEY
Session parameter for the context.
Class ilMailMemberCourseRoles.
Class ilMailMemberSearchGUI.
Class Mail this class handles base functions for mail handling.
static isActivated()
Checks whether Map feature is activated.
static getMapGUI()
Get an instance of the GUI class.
static getDefaultSettings()
Get default longitude, latitude and zoom.
static _hasAccepted($a_usr_id, $a_obj_id)
Check if user has accepted agreement.
static getInstance()
Get instance.
Membership notification settings.
static handleCode($a_ref_id, $a_type, $a_code)
Handle target parameter.
static generateCode()
Generate new registration key.
This class represents a number property in a property form.
static lookupRegistrationInfo($a_obj_id)
Lookup registration info @global ilDB $ilDB @global ilObjUser $ilUser @global ilLanguage $lng.
Class ilObjCourseGUI.
updateRoleStatusObject()
Update status of additional course roles.
removeSmallIconObject()
remove small icon
static _modifyItemGUI($a_item_list_gui, $a_cmd_class, $a_item_data, $a_show_path, $a_abo_status, $a_course_ref_id, $a_course_obj_id, $a_parent_ref_id=0)
We need a static version of this, e.g.
checkAgreement()
Check agreement and redirect if it is not accepted.
setContentSubTabs()
Set content sub tabs.
__getDateSelect($a_type, $a_varname, $a_selected)
refuseFromListObject()
refuse from waiting list
afterSave(ilObject $a_new_object)
save object @access public
membersObject()
Member administration.
modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
Modify Item ListGUI for presentation in container.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add file manager link.
hasAdminPermission()
user has admin permission or "edit permission" permission on this course
editCourseIconsObject($a_form=null)
edit container icons
updateTutorStatusObject()
update tuto status
executeCommand()
execute command note: this method is overwritten in all container objects
updateLPFromStatus($a_member_id, $a_has_passed)
sync course status and lp status
saveNotificationObject()
:TEMP: Save notification setting (from infoscreen)
afterImport(ilObject $a_new_object)
add course admin after import file
toUnix($date, $time=array())
initInfoEditor()
init info editor
cancelMemberObject()
canceledObject is called when operation is canceled, method links back @access public
deleteMembersObject()
Delete members @global ilAccessHandler $ilAccess.
updateMemberStatusObject()
updateMemberStatus
editMapSettingsObject()
Edit Map Settings.
static _goto($a_target, $a_add="")
goto target course
__showWaitingListTable($a_result_set, $a_waiting_list_ids=NULL)
setSubTabs($a_tab)
set sub tabs
editInfoObject(ilPropertyFormGUI $a_form=null)
Edit info page informations.
__prepareDateSelect($a_unix_time)
prepareOutput()
Handle member view.
getAttendanceListUserData($a_user_id)
getLocalRoles($a_exclude=array())
createMailSignature()
Create a course mail signature.
checkLicenses($a_keep=false)
Check the remaining licenses of course objects and generate a message if raare.
getTabs(&$tabs_gui)
Get tabs.
saveSortingObject()
Save Sorting.
assignMembersObject(array $a_usr_ids, $a_type)
callback from repository search gui @global ilRbacSystem $rbacsystem
loadDate($a_field)
load date
updateMembersObject()
update members
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
__setTableGUIBasicData(&$tbl, &$result_set, $from="")
standard implementation for tables use 'from' variable use different initial setting of table
__showDeleteSubscriberTable($a_result_set)
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
fetchPrintMemberData($a_members)
updateCourseIconsObject()
update container icons
redirectLocToTestObject($a_force_new_run=NULL)
Test redirection will be moved lo adapter.
removeBigIconObject()
remove big icon
updateObject()
updates object entry in object_data
addMailToMemberButton($ilToolbar, $back_cmd=null, $a_separator=false)
add Mail to Member button to toolbar
memberGatewayObject()
Gateway for member administration commands.
readMemberData($ids, $role='admin', $selected_columns=null)
editMemberObject()
edit member
askResetObject()
ask reset test results
ilObjCourseGUI()
Constructor @access public.
__showRemoveFromWaitingListTable($a_result_set)
editMembersObject()
edit members
getAgreementTabs()
Get tabs for member agreement.
infoScreen()
show information screen
updateAdminStatusObject()
update admin status
removeMembersObject()
Remove members @global ilRbacReview $rbacreview @global ilRbacSystem $rbacsystem.
setShowHidePrefs()
set preferences (show/hide tabel content)
unsubscribeObject()
DEPRECATED?
confirmDeleteInfoFilesObject()
show info file donfimation table
fetchPrintSubscriberData($a_members)
removeTinyIconObject()
remove small icon
__prepareTimeSelect($a_unix_time)
viewObject()
list childs of current object
deleteInfoFilesObject()
Delete info files.
redirectLocToTestConfirmation($a_objective_id, $a_test_id)
Show confirmation whether user wants to start a new run or resume a previous run.
showPossibleSubObjects()
show possible sub objects selection list
renderObject()
render the object
getEditFormValues()
Get values for edit form.
updateParticipantsStatus($type, $visible_members, $passed, $notification, $blocked, $contact)
membersMapObject()
Members map.
Class ilObjCourseGroupingGUI.
_getGroupingCourseIds($a_course_ref_id, $a_course_id)
Get all ids of courses that are grouped with another course @access static.
_isActivated($a_obj_id)
Is activated.
const STATUS_DETERMINATION_MANUAL
const STATUS_DETERMINATION_LP
_registrationEnabled($a_obj_id)
Registration enabled? Method is in Access class, since it is needed by Access/ListGUI.
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, $a_back_url=null)
_getTranslation($a_role_title)
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static hasTimings($a_ref_id)
Check if there is any active timing (in subtree)
GUI class for the workflow of copying objects.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
getFormAction($a_cmd, $a_formaction="")
get form action for command (command is method name without "Object", e.g.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
getReturnLocation($a_cmd, $a_location="")
get return location for command (command is method name without "Object", e.g.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getCreationMode()
get creation mode
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
initDidacticTemplate(ilPropertyFormGUI $form)
Show didactic template types.
addHeaderAction()
Add header action menu.
static getInstance($a_obj_id)
Class ilObjectMetaDataGUI.
GUI class for service settings (calendar, notes, comments)
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
update()
update object in db
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
getId()
get object id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
static lookupSubscribers($a_obj_id)
static _requiresPurchaseToAccess($a_ref_id, $a_purchasetype='')
this function should be used by all buyable repository objects !!
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getInstance()
Get instance of ilPrivacySettings.
This class represents a property form user interface.
GUI class for public user profile presentation.
This class represents a property in a property form.
This class represents an option in a radio group.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
ILIAS Setting Class.
Class ilShopPurchaseGUI.
GUI class for course/group subscriptions.
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.
@ilCtrl_Calls ilUsersGalleryGUI: ilPublicUserProfileGUI @ilCtrl_isCalledBy ilUsersGalleryGUI: ilObjCo...
Class ilUsersGalleryParticipants.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
GUI class for course/group waiting list.
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
$_POST['username']
Definition: cron.php:12
$txt
Definition: error.php:12
$html
Definition: example_001.php:87
$lg
Definition: example_018.php:62
$text
$tbl
Definition: example_048.php:81
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
$info
Definition: example_052.php:80
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
redirection script todo: (a better solution should control the processing via a xml file)
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15