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