ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjCourse.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without ceven the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24require_once "./Services/Container/classes/class.ilContainer.php";
25include_once './Modules/Course/classes/class.ilCourseConstants.php';
26include_once './Services/Membership/interfaces/interface.ilMembershipRegistrationCodes.php';
27
36{
40 protected $course_logger = null;
41
42
43 const CAL_REG_START = 1;
44 const CAL_REG_END = 2;
48 const CAL_COURSE_END = 6;
51
52
55
56 private $member_obj = null;
57 private $members_obj = null;
59
60 private $latitude = '';
61 private $longitude = '';
62 private $locationzoom = 0;
63 private $enablemap = 0;
64
65 private $session_limit = 0;
66 private $session_prev = -1;
67 private $session_next = -1;
68
69 private $reg_access_code = '';
70 private $reg_access_code_enabled = false;
71 private $status_dt = null;
72
74
79
83 protected $crs_start; // [ilDate]
84
88 protected $crs_end; // [ilDate]
89
90
91 protected $leave_end; // [ilDate]
92 protected $min_members; // [int]
93 protected $auto_fill_from_waiting; // [bool]
94
98 protected $member_export = false;
99
104
110 private $auto_notification = true;
111
112
116 private $target_group = '';
117
118
125 public function __construct($a_id = 0, $a_call_by_reference = true)
126 {
127
128 #define("ILIAS_MODULE","course");
129 #define("KEEP_IMAGE_PATH",1);
130
131 $this->SUBSCRIPTION_DEACTIVATED = 1;
132 $this->SUBSCRIPTION_CONFIRMATION = 2;
133 $this->SUBSCRIPTION_DIRECT = 3;
134 $this->SUBSCRIPTION_PASSWORD = 4;
135 $this->SUBSCRIPTION_AUTOSUBSCRIPTION = 5;
136 $this->ARCHIVE_DISABLED = 1;
137 $this->ARCHIVE_READ = 2;
138 $this->ARCHIVE_DOWNLOAD = 3;
139 $this->ABO_ENABLED = 1;
140 $this->ABO_DISABLED = 0;
141 $this->SHOW_MEMBERS_ENABLED = 1;
142 $this->SHOW_MEMBERS_DISABLED = 0;
143 $this->setStatusDetermination(self::STATUS_DETERMINATION_LP);
144
145 $this->type = "crs";
146
147 $this->course_logger = $GLOBALS['DIC']->logger()->crs();
148
149 parent::__construct($a_id, $a_call_by_reference);
150 }
151
157 public static function lookupShowMembersEnabled($a_obj_id)
158 {
159 $query = 'SELECT show_members FROM crs_settings ' .
160 'WHERE obj_id = ' . $GLOBALS['DIC']['ilDB']->quote($a_obj_id, 'integer');
161 $res = $GLOBALS['DIC']['ilDB']->query($query);
162 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
163 return (bool) $row->show_members;
164 }
165 return false;
166 }
167
168 public function getShowMembersExport()
169 {
171 }
172
173 public function setShowMembersExport($a_mem_export)
174 {
175 $this->member_export = $a_mem_export;
176 }
177
183 {
185 }
186
192 public function setRegistrationAccessCode($a_code)
193 {
194 $this->reg_access_code = $a_code;
195 }
196
202 {
203 return (bool) $this->reg_access_code_enabled;
204 }
205
211 public function enableRegistrationAccessCode($a_status)
212 {
213 $this->reg_access_code_enabled = $a_status;
214 }
215
216 public function getImportantInformation()
217 {
218 return $this->important;
219 }
220 public function setImportantInformation($a_info)
221 {
222 $this->important = $a_info;
223 }
224 public function getSyllabus()
225 {
226 return $this->syllabus;
227 }
228 public function setSyllabus($a_syllabus)
229 {
230 $this->syllabus = $a_syllabus;
231 }
232
236 public function getTargetGroup() : ?string
237 {
238 return $this->target_group;
239 }
240
244 public function setTargetGroup(?string $a_tg)
245 {
246 $this->target_group = $a_tg;
247 }
248
249 public function getContactName()
250 {
251 return $this->contact_name;
252 }
253 public function setContactName($a_cn)
254 {
255 $this->contact_name = $a_cn;
256 }
257 public function getContactConsultation()
258 {
259 return $this->contact_consultation;
260 }
261 public function setContactConsultation($a_value)
262 {
263 $this->contact_consultation = $a_value;
264 }
265 public function getContactPhone()
266 {
267 return $this->contact_phone;
268 }
269 public function setContactPhone($a_value)
270 {
271 $this->contact_phone = $a_value;
272 }
273 public function getContactEmail()
274 {
275 return $this->contact_email;
276 }
277 public function setContactEmail($a_value)
278 {
279 $this->contact_email = $a_value;
280 }
281 public function getContactResponsibility()
282 {
283 return $this->contact_responsibility;
284 }
285 public function setContactResponsibility($a_value)
286 {
287 $this->contact_responsibility = $a_value;
288 }
295 {
296 return !$this->getActivationStart() || !$this->getActivationEnd();
297 }
298 public function getActivationStart()
299 {
300 return $this->activation_start;
301 }
302 public function setActivationStart($a_value)
303 {
304 $this->activation_start = $a_value;
305 }
306 public function getActivationEnd()
307 {
308 return $this->activation_end;
309 }
310 public function setActivationEnd($a_value)
311 {
312 $this->activation_end = $a_value;
313 }
314 public function setActivationVisibility($a_value)
315 {
316 $this->activation_visibility = (bool) $a_value;
317 }
318 public function getActivationVisibility()
319 {
320 return $this->activation_visibility;
321 }
322
324 {
325 return $this->subscription_limitation_type;
326 }
327 public function setSubscriptionLimitationType($a_type)
328 {
329 $this->subscription_limitation_type = $a_type;
330 }
332 {
333 return $this->subscription_limitation_type == IL_CRS_SUBSCRIPTION_UNLIMITED;
334 }
335 public function getSubscriptionStart()
336 {
337 return $this->subscription_start;
338 }
339 public function setSubscriptionStart($a_value)
340 {
341 $this->subscription_start = $a_value;
342 }
343 public function getSubscriptionEnd()
344 {
345 return $this->subscription_end;
346 }
347 public function setSubscriptionEnd($a_value)
348 {
349 $this->subscription_end = $a_value;
350 }
351 public function getSubscriptionType()
352 {
353 return $this->subscription_type ? $this->subscription_type : IL_CRS_SUBSCRIPTION_DIRECT;
354 #return $this->subscription_type ? $this->subscription_type : $this->SUBSCRIPTION_DEACTIVATED;
355 }
356 public function setSubscriptionType($a_value)
357 {
358 $this->subscription_type = $a_value;
359 }
360 public function getSubscriptionPassword()
361 {
362 return $this->subscription_password;
363 }
364 public function setSubscriptionPassword($a_value)
365 {
366 $this->subscription_password = $a_value;
367 }
368 public function enabledObjectiveView()
369 {
370 return $this->view_mode == IL_CRS_VIEW_OBJECTIVE;
371 }
372
373 public function enabledWaitingList()
374 {
375 return (bool) $this->waiting_list;
376 }
377
378 public function enableWaitingList($a_status)
379 {
380 $this->waiting_list = (bool) $a_status;
381 }
382
383 public function inSubscriptionTime()
384 {
385 if ($this->getSubscriptionUnlimitedStatus()) {
386 return true;
387 }
388 if (time() > $this->getSubscriptionStart() and time() < $this->getSubscriptionEnd()) {
389 return true;
390 }
391 return false;
392 }
393
399 public function enableSessionLimit($a_status)
400 {
401 $this->session_limit = $a_status;
402 }
403
404 public function isSessionLimitEnabled()
405 {
406 return (bool) $this->session_limit;
407 }
408
416 public function enableSubscriptionMembershipLimitation($a_status)
417 {
418 $this->subscription_membership_limitation = $a_status;
419 }
420
426 public function setNumberOfPreviousSessions($a_num)
427 {
428 $this->session_prev = $a_num;
429 }
430
436 {
437 return $this->session_prev;
438 }
439
445 public function setNumberOfNextSessions($a_num)
446 {
447 $this->session_next = $a_num;
448 }
449
454 public function getNumberOfNextSessions()
455 {
456 return $this->session_next;
457 }
466 {
467 return (bool) $this->subscription_membership_limitation;
468 }
469
471 {
472 return $this->subscription_max_members;
473 }
474 public function setSubscriptionMaxMembers($a_value)
475 {
476 $this->subscription_max_members = $a_value;
477 }
478
487 public static function _isSubscriptionNotificationEnabled($a_course_id)
488 {
489 global $DIC;
490
491 $ilDB = $DIC['ilDB'];
492
493 $query = "SELECT * FROM crs_settings " .
494 "WHERE obj_id = " . $ilDB->quote($a_course_id, 'integer') . " " .
495 "AND sub_notify = 1";
496 $res = $ilDB->query($query);
497 return $res->numRows() ? true : false;
498 }
499
506 public function getSubItems(
507 $a_admin_panel_enabled = false,
508 $a_include_side_block = false,
509 $a_get_single = 0,
510 \ilContainerUserFilter $container_user_filter = null
511 ) {
512 // Caching
513 if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block])) {
514 return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
515 }
516
517 // Results are stored in $this->items
518 parent::getSubItems($a_admin_panel_enabled, $a_include_side_block, $a_get_single);
520 $this->items,
521 $this,
522 (bool) $a_admin_panel_enabled,
523 (bool) $a_include_side_block
524 );
525 return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
526 }
527
528 public function getSubscriptionNotify()
529 {
530 return true;
531 return $this->subscription_notify ? true : false;
532 }
533 public function setSubscriptionNotify($a_value)
534 {
535 $this->subscription_notify = $a_value ? true : false;
536 }
537
538 public function setViewMode($a_mode)
539 {
540 $this->view_mode = $a_mode;
541 }
542 public function getViewMode()
543 {
544 return $this->view_mode;
545 }
546
551 public static function lookupTimingMode($a_obj_id)
552 {
553 global $DIC;
554
555 $ilDB = $DIC['ilDB'];
556
557 $query = 'SELECT timing_mode FROM crs_settings ' .
558 'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
559 $res = $ilDB->query($query);
560
561 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
562 return (int) $row->timing_mode;
563 }
565 }
566
570 public function setTimingMode($a_mode)
571 {
572 $this->timing_mode = $a_mode;
573 }
574
578 public function getTimingMode()
579 {
580 return $this->timing_mode;
581 }
582
583
589 public static function _lookupViewMode($a_id)
590 {
591 global $DIC;
592
593 $ilDB = $DIC['ilDB'];
594
595 $query = "SELECT view_mode FROM crs_settings WHERE obj_id = " . $ilDB->quote($a_id, 'integer') . " ";
596 $res = $ilDB->query($query);
597 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
598 return $row->view_mode;
599 }
600 return false;
601 }
602
603 public static function _lookupAboStatus($a_id)
604 {
605 global $DIC;
606
607 $ilDB = $DIC['ilDB'];
608
609 $query = "SELECT abo FROM crs_settings WHERE obj_id = " . $ilDB->quote($a_id, 'integer') . " ";
610 $res = $ilDB->query($query);
611 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
612 return $row->abo;
613 }
614 return false;
615 }
616
617 public function getArchiveStart()
618 {
619 return $this->archive_start ? $this->archive_start : time();
620 }
621 public function setArchiveStart($a_value)
622 {
623 $this->archive_start = $a_value;
624 }
625 public function getArchiveEnd()
626 {
627 return $this->archive_end ? $this->archive_end : mktime(0, 0, 0, 12, 12, date("Y", time()) + 2);
628 }
629 public function setArchiveEnd($a_value)
630 {
631 $this->archive_end = $a_value;
632 }
633 public function getArchiveType()
634 {
635 return $this->archive_type ? IL_CRS_ARCHIVE_DOWNLOAD : IL_CRS_ARCHIVE_NONE;
636 }
637 public function setArchiveType($a_value)
638 {
639 $this->archive_type = $a_value;
640 }
641 public function setAboStatus($a_status)
642 {
643 $this->abo = $a_status;
644 }
645 public function getAboStatus()
646 {
647 return $this->abo;
648 }
649 public function setShowMembers($a_status)
650 {
651 $this->show_members = $a_status;
652 }
653 public function getShowMembers()
654 {
655 return $this->show_members;
656 }
657
663 public function setMailToMembersType($a_type)
664 {
665 $this->mail_members = $a_type;
666 }
667
672 public function getMailToMembersType()
673 {
674 return $this->mail_members;
675 }
676
677 public function getMessage()
678 {
679 return $this->message;
680 }
681 public function setMessage($a_message)
682 {
683 $this->message = $a_message;
684 }
685 public function appendMessage($a_message)
686 {
687 if ($this->getMessage()) {
688 $this->message .= "<br /> ";
689 }
690 $this->message .= $a_message;
691 }
692
697 public function isActivated()
698 {
699 if ($this->getOfflineStatus()) {
700 return false;
701 }
702 if ($this->getActivationUnlimitedStatus()) {
703 return true;
704 }
705 if (time() < $this->getActivationStart() or
706 time() > $this->getActivationEnd()) {
707 return false;
708 }
709 return true;
710 }
711
718 public static function _isActivated($a_obj_id)
719 {
720 include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
721 return ilObjCourseAccess::_isActivated($a_obj_id);
722 }
723
730 public static function _registrationEnabled($a_obj_id)
731 {
732 include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
734 }
735
736
737 public function allowAbo()
738 {
739 return $this->ABO == $this->ABO_ENABLED;
740 }
741
745 public function read()
746 {
747 parent::read();
748
749 include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
751
752 $this->__readSettings();
753 }
754 public function create($a_upload = false)
755 {
756 global $DIC;
757
758 $ilAppEventHandler = $DIC['ilAppEventHandler'];
759
760 parent::create($a_upload);
761
762 if (!$a_upload) {
763 $this->createMetaData();
764 }
766
767 $ilAppEventHandler->raise(
768 'Modules/Course',
769 'create',
770 array('object' => $this,
771 'obj_id' => $this->getId(),
772 'appointments' => $this->prepareAppointments('create'))
773 );
774 }
775
781 public function setLatitude($a_latitude)
782 {
783 $this->latitude = $a_latitude;
784 }
785
791 public function getLatitude()
792 {
793 return $this->latitude;
794 }
795
801 public function setLongitude($a_longitude)
802 {
803 $this->longitude = $a_longitude;
804 }
805
811 public function getLongitude()
812 {
813 return $this->longitude;
814 }
815
821 public function setLocationZoom($a_locationzoom)
822 {
823 $this->locationzoom = $a_locationzoom;
824 }
825
831 public function getLocationZoom()
832 {
833 return $this->locationzoom;
834 }
835
841 public function setEnableCourseMap($a_enablemap)
842 {
843 $this->enablemap = $a_enablemap;
844 }
845
850 public function getEnableMap()
851 {
852 return $this->getEnableCourseMap();
853 }
854
860 public function getEnableCourseMap()
861 {
862 return $this->enablemap;
863 }
864
870 public function setCoursePeriod(\ilDateTime $start = null, \ilDateTime $end = null)
871 {
872 if (
873 ($start instanceof \ilDate && !$end instanceof ilDate) ||
874 ($end instanceof \ilDate && !$start instanceof ilDate)
875 ) {
876 throw new InvalidArgumentException('Different date types not supported.');
877 }
878
879 if ($start instanceof \ilDate) {
881 } else {
883 }
884 $this->setCourseStart($start);
885 $this->setCourseEnd($end);
886 }
887
891 protected function toggleCourseStartTimeIndication(bool $time_indication)
892 {
893 $this->course_start_time_indication = $time_indication;
894 }
895
899 public function getCourseStartTimeIndication() : bool
900 {
902 }
903
904
908 protected function setCourseStart(ilDateTime $a_value = null)
909 {
910 $this->crs_start = $a_value;
911 }
912
916 public function getCourseStart() : ?\ilDateTime
917 {
918 return $this->crs_start;
919 }
920
924 protected function setCourseEnd(ilDateTime $a_value = null)
925 {
926 $this->crs_end = $a_value;
927 }
928
932 public function getCourseEnd() : ?\ilDateTime
933 {
934 return $this->crs_end;
935 }
936
937 public function setCancellationEnd(ilDate $a_value = null)
938 {
939 $this->leave_end = $a_value;
940 }
941
942 public function getCancellationEnd()
943 {
944 return $this->leave_end;
945 }
946
947 public function setSubscriptionMinMembers($a_value)
948 {
949 if ($a_value !== null) {
950 $a_value = (int) $a_value;
951 }
952 $this->min_members = $a_value;
953 }
954
956 {
957 return $this->min_members;
958 }
959
960 public function setWaitingListAutoFill($a_value)
961 {
962 $this->auto_fill_from_waiting = (bool) $a_value;
963 }
964
965 public function hasWaitingListAutoFill()
966 {
967 return (bool) $this->auto_fill_from_waiting;
968 }
969
978 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
979 {
980 global $DIC;
981
982 $ilDB = $DIC['ilDB'];
983 $ilUser = $DIC['ilUser'];
984 $certificateLogger = $DIC->logger()->cert();
985
986
987 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
988
989 $this->cloneAutoGeneratedRoles($new_obj);
990 $this->cloneMetaData($new_obj);
991
992 // Assign admin
993 $new_obj->getMemberObject()->add($ilUser->getId(), IL_CRS_ADMIN);
994 // cognos-blu-patch: begin
995 $new_obj->getMemberObject()->updateContact($ilUser->getId(), 1);
996 // cognos-blu-patch: end
997
998
999 // #14596
1000 $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
1001 if ($cwo->isRootNode($this->getRefId())) {
1002 $this->setOfflineStatus(true);
1003 }
1004
1005 // Copy settings
1006 $this->cloneSettings($new_obj);
1007
1008 // Course Defined Fields
1009 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1010 ilCourseDefinedFieldDefinition::_clone($this->getId(), $new_obj->getId());
1011
1012 // Clone course files
1013 include_once('Modules/Course/classes/class.ilCourseFile.php');
1014 ilCourseFile::_cloneFiles($this->getId(), $new_obj->getId());
1015
1016 // Copy learning progress settings
1017 include_once('Services/Tracking/classes/class.ilLPObjSettings.php');
1018 $obj_settings = new ilLPObjSettings($this->getId());
1019 $obj_settings->cloneSettings($new_obj->getId());
1020 unset($obj_settings);
1021
1022 // clone certificate (#11085)
1023 $pathFactory = new ilCertificatePathFactory();
1024 $templateRepository = new ilCertificateTemplateRepository($ilDB);
1025
1026 $cloneAction = new ilCertificateCloneAction(
1027 $ilDB,
1028 $pathFactory,
1029 $templateRepository,
1030 $DIC->filesystem()->web(),
1031 $certificateLogger,
1033 );
1034 $cloneAction->cloneCertificate($this, $new_obj);
1035
1036 $book_service = new ilBookingService();
1037 $book_service->cloneSettings($this->getId(), $new_obj->getId());
1038
1039 $badges = ilBadge::getInstancesByParentId($this->getId());
1040 foreach ($badges as $badge) {
1041 $badge->clone($new_obj->getId());
1042 }
1043
1044 return $new_obj;
1045 }
1046
1055 public function cloneDependencies($a_target_id, $a_copy_id)
1056 {
1057 parent::cloneDependencies($a_target_id, $a_copy_id);
1058
1059 // Clone course start objects
1060 include_once('Services/Container/classes/class.ilContainerStartObjects.php');
1061 $start = new ilContainerStartObjects($this->getRefId(), $this->getId());
1062 $start->cloneDependencies($a_target_id, $a_copy_id);
1063
1064 // Clone course item settings
1065 include_once('Services/Object/classes/class.ilObjectActivation.php');
1066 ilObjectActivation::cloneDependencies($this->getRefId(), $a_target_id, $a_copy_id);
1067
1068 // clone objective settings
1069 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
1070 ilLOSettings::cloneSettings($a_copy_id, $this->getId(), ilObject::_lookupObjId($a_target_id));
1071
1072 // Clone course learning objectives
1073 include_once('Modules/Course/classes/class.ilCourseObjective.php');
1074 $crs_objective = new ilCourseObjective($this);
1075 $crs_objective->ilClone($a_target_id, $a_copy_id);
1076
1077 // clone membership limitation
1078 foreach (\ilObjCourseGrouping::_getGroupings($this->getId()) as $grouping_id) {
1079 \ilLoggerFactory::getLogger('crs')->info('Handling grouping id: ' . $grouping_id);
1080 $grouping = new \ilObjCourseGrouping($grouping_id);
1081 $grouping->cloneGrouping($a_target_id, $a_copy_id);
1082 }
1083
1084 return true;
1085 }
1086
1094 public function cloneAutoGeneratedRoles($new_obj)
1095 {
1096 global $DIC;
1097
1098 $ilLog = $DIC['ilLog'];
1099 $rbacadmin = $DIC['rbacadmin'];
1100 $rbacreview = $DIC['rbacreview'];
1101
1102 $admin = $this->getDefaultAdminRole();
1103 $new_admin = $new_obj->getDefaultAdminRole();
1104
1105 if (!$admin || !$new_admin || !$this->getRefId() || !$new_obj->getRefId()) {
1106 $ilLog->write(__METHOD__ . ' : Error cloning auto generated role: il_crs_admin');
1107 }
1108 $rbacadmin->copyRolePermissions($admin, $this->getRefId(), $new_obj->getRefId(), $new_admin, true);
1109 $ilLog->write(__METHOD__ . ' : Finished copying of role crs_admin.');
1110
1111 $tutor = $this->getDefaultTutorRole();
1112 $new_tutor = $new_obj->getDefaultTutorRole();
1113 if (!$tutor || !$new_tutor) {
1114 $ilLog->write(__METHOD__ . ' : Error cloning auto generated role: il_crs_tutor');
1115 }
1116 $rbacadmin->copyRolePermissions($tutor, $this->getRefId(), $new_obj->getRefId(), $new_tutor, true);
1117 $ilLog->write(__METHOD__ . ' : Finished copying of role crs_tutor.');
1118
1119 $member = $this->getDefaultMemberRole();
1120 $new_member = $new_obj->getDefaultMemberRole();
1121 if (!$member || !$new_member) {
1122 $ilLog->write(__METHOD__ . ' : Error cloning auto generated role: il_crs_member');
1123 }
1124 $rbacadmin->copyRolePermissions($member, $this->getRefId(), $new_obj->getRefId(), $new_member, true);
1125 $ilLog->write(__METHOD__ . ' : Finished copying of role crs_member.');
1126
1127 return true;
1128 }
1129
1130
1131 public function validate()
1132 {
1133 $this->setMessage('');
1134
1136 $this->getSubscriptionStart() > $this->getSubscriptionEnd()) {
1137 $this->appendMessage($this->lng->txt("subscription_times_not_valid"));
1138 }
1140 $this->appendMessage($this->lng->txt("crs_password_required"));
1141 }
1142 if ($this->isSubscriptionMembershipLimited()) {
1143 if ($this->getSubscriptionMinMembers() <= 0 && $this->getSubscriptionMaxMembers() <= 0) {
1144 $this->appendMessage($this->lng->txt("crs_max_and_min_members_needed"));
1145 }
1146 if ($this->getSubscriptionMaxMembers() <= 0 && $this->enabledWaitingList()) {
1147 $this->appendMessage($this->lng->txt("crs_max_members_needed"));
1148 }
1149 if ($this->getSubscriptionMaxMembers() > 0 && $this->getSubscriptionMinMembers() > $this->getSubscriptionMaxMembers()) {
1150 $this->appendMessage($this->lng->txt("crs_max_and_min_members_invalid"));
1151 }
1152 }
1153 if (!$this->getTitle() || !$this->getStatusDetermination()) {
1154 $this->appendMessage($this->lng->txt('err_check_input'));
1155 }
1156
1157 // :TODO: checkInput() is not used properly
1158 if (($this->getCourseStart() && !$this->getCourseEnd()) ||
1159 (!$this->getCourseStart() && $this->getCourseEnd()) ||
1160 ($this->getCourseStart() && $this->getCourseEnd() && $this->getCourseStart()->get(IL_CAL_UNIX) > $this->getCourseEnd()->get(IL_CAL_UNIX))) {
1161 $this->appendMessage($this->lng->txt("crs_course_period_not_valid"));
1162 }
1163
1164 return $this->getMessage() ? false : true;
1165 }
1166
1167 public function validateInfoSettings()
1168 {
1169 global $DIC;
1170
1171 $ilErr = $DIC['ilErr'];
1172 $error = false;
1173 if ($this->getContactEmail()) {
1174 $emails = explode(",", $this->getContactEmail());
1175
1176 foreach ($emails as $email) {
1177 $email = trim($email);
1179 $ilErr->appendMessage($this->lng->txt('contact_email_not_valid') . " '" . $email . "'");
1180 $error = true;
1181 }
1182 }
1183 }
1184 return !$error;
1185 }
1186
1187 public function hasContactData()
1188 {
1189 return strlen($this->getContactName()) or
1190 strlen($this->getContactResponsibility()) or
1191 strlen($this->getContactEmail()) or
1192 strlen($this->getContactPhone()) or
1193 strlen($this->getContactConsultation());
1194 }
1195
1196
1203 public function delete()
1204 {
1205 global $DIC;
1206
1207 $ilAppEventHandler = $DIC['ilAppEventHandler'];
1208
1209 // always call parent delete function first!!
1210 if (!parent::delete()) {
1211 return false;
1212 }
1213
1214 // delete meta data
1215 $this->deleteMetaData();
1216
1217 // put here course specific stuff
1218
1219 $this->__deleteSettings();
1220
1221 include_once('Modules/Course/classes/class.ilCourseParticipants.php');
1223
1224 include_once './Modules/Course/classes/class.ilCourseObjective.php';
1226
1227 include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
1229
1230 include_once './Modules/Course/classes/class.ilCourseFile.php';
1232
1233 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1235
1236 $ilAppEventHandler->raise(
1237 'Modules/Course',
1238 'delete',
1239 array('object' => $this,
1240 'obj_id' => $this->getId(),
1241 'appointments' => $this->prepareAppointments('delete'))
1242 );
1243
1244
1245 return true;
1246 }
1247
1248
1252 public function update()
1253 {
1254 global $DIC;
1255
1256 $ilAppEventHandler = $DIC['ilAppEventHandler'];
1257 $ilLog = $DIC->logger()->crs();
1258
1259 include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
1260 $sorting = new ilContainerSortingSettings($this->getId());
1261 $sorting->setSortMode($this->getOrderType());
1262 $sorting->update();
1263
1264 $this->updateMetaData();
1265 $this->updateSettings();
1266 parent::update();
1267
1268 $ilAppEventHandler->raise(
1269 'Modules/Course',
1270 'update',
1271 array('object' => $this,
1272 'obj_id' => $this->getId(),
1273 'appointments' => $this->prepareAppointments('update'))
1274 );
1275 }
1276
1280 public function updateSettings()
1281 {
1282 global $DIC;
1283
1284 $ilDB = $DIC['ilDB'];
1285
1286 // Due to a bug 3.5.alpha maybe no settings exist. => create default settings
1287
1288 $query = "SELECT * FROM crs_settings WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
1289 $res = $ilDB->query($query);
1290
1291 if (!$res->numRows()) {
1292 $this->__createDefaultSettings();
1293 }
1294
1295
1296 $query = "UPDATE crs_settings SET " .
1297 "syllabus = " . $ilDB->quote($this->getSyllabus(), 'text') . ", " .
1298 "contact_name = " . $ilDB->quote($this->getContactName(), 'text') . ", " .
1299 "contact_responsibility = " . $ilDB->quote($this->getContactResponsibility(), 'text') . ", " .
1300 "contact_phone = " . $ilDB->quote($this->getContactPhone(), 'text') . ", " .
1301 "contact_email = " . $ilDB->quote($this->getContactEmail(), 'text') . ", " .
1302 "contact_consultation = " . $ilDB->quote($this->getContactConsultation(), 'text') . ", " .
1303 "activation_type = " . $ilDB->quote(!$this->getOfflineStatus(), 'integer') . ", " .
1304 "sub_limitation_type = " . $ilDB->quote($this->getSubscriptionLimitationType(), 'integer') . ", " .
1305 "sub_start = " . $ilDB->quote($this->getSubscriptionStart(), 'integer') . ", " .
1306 "sub_end = " . $ilDB->quote($this->getSubscriptionEnd(), 'integer') . ", " .
1307 "sub_type = " . $ilDB->quote($this->getSubscriptionType(), 'integer') . ", " .
1308 "sub_password = " . $ilDB->quote($this->getSubscriptionPassword(), 'text') . ", " .
1309 "sub_mem_limit = " . $ilDB->quote((int) $this->isSubscriptionMembershipLimited(), 'integer') . ", " .
1310 "sub_max_members = " . $ilDB->quote($this->getSubscriptionMaxMembers(), 'integer') . ", " .
1311 "sub_notify = " . $ilDB->quote($this->getSubscriptionNotify(), 'integer') . ", " .
1312 "view_mode = " . $ilDB->quote($this->getViewMode(), 'integer') . ", " .
1313 'timing_mode = ' . $ilDB->quote($this->getTimingMode(), 'integer') . ', ' .
1314 "abo = " . $ilDB->quote($this->getAboStatus(), 'integer') . ", " .
1315 "waiting_list = " . $ilDB->quote($this->enabledWaitingList(), 'integer') . ", " .
1316 "important = " . $ilDB->quote($this->getImportantInformation(), 'text') . ", " .
1317 'target_group = ' . $ilDB->quote($this->getTargetGroup(), \ilDBConstants::T_TEXT) . ', ' .
1318 "show_members = " . $ilDB->quote($this->getShowMembers(), 'integer') . ", " .
1319 "show_members_export = " . $ilDB->quote($this->getShowMembersExport(), 'integer') . ", " .
1320 "latitude = " . $ilDB->quote($this->getLatitude(), 'text') . ", " .
1321 "longitude = " . $ilDB->quote($this->getLongitude(), 'text') . ", " .
1322 "location_zoom = " . $ilDB->quote($this->getLocationZoom(), 'integer') . ", " .
1323 "enable_course_map = " . $ilDB->quote((int) $this->getEnableCourseMap(), 'integer') . ", " .
1324 'session_limit = ' . $ilDB->quote($this->isSessionLimitEnabled(), 'integer') . ', ' .
1325 'session_prev = ' . $ilDB->quote($this->getNumberOfPreviousSessions(), 'integer') . ', ' .
1326 'session_next = ' . $ilDB->quote($this->getNumberOfNextSessions(), 'integer') . ', ' .
1327 'reg_ac_enabled = ' . $ilDB->quote($this->isRegistrationAccessCodeEnabled(), 'integer') . ', ' .
1328 'reg_ac = ' . $ilDB->quote($this->getRegistrationAccessCode(), 'text') . ', ' .
1329 'auto_notification = ' . $ilDB->quote((int) $this->getAutoNotification(), 'integer') . ', ' .
1330 'status_dt = ' . $ilDB->quote((int) $this->getStatusDetermination()) . ', ' .
1331 'mail_members_type = ' . $ilDB->quote((int) $this->getMailToMembersType(), 'integer') . ', ' .
1332 'period_start = ' . $ilDB->quote(\ilCalendarUtil::convertDateToUtcDBTimestamp($this->getCourseStart()), \ilDBConstants::T_TIMESTAMP) . ', ' .
1334 'period_time_indication = ' . $ilDB->quote($this->getCourseStartTimeIndication() ? 1 : 0, \ilDBConstants::T_INTEGER) . ', ' .
1335 'auto_wait = ' . $ilDB->quote((int) $this->hasWaitingListAutoFill(), 'integer') . ', ' .
1336 'leave_end = ' . $ilDB->quote(($this->getCancellationEnd() && !$this->getCancellationEnd()->isNull()) ? $this->getCancellationEnd()->get(IL_CAL_UNIX) : null, 'integer') . ', ' .
1337 'min_members = ' . $ilDB->quote((int) $this->getSubscriptionMinMembers(), 'integer') . ' ' .
1338 "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . "";
1339
1340 $res = $ilDB->manipulate($query);
1341
1342 // moved activation to ilObjectActivation
1343 if ($this->ref_id) {
1344 include_once "./Services/Object/classes/class.ilObjectActivation.php";
1345 ilObjectActivation::getItem($this->ref_id);
1346
1347 $item = new ilObjectActivation;
1348 if (!$this->getActivationStart() || !$this->getActivationEnd()) {
1350 } else {
1351 $item->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
1352 $item->setTimingStart($this->getActivationStart());
1353 $item->setTimingEnd($this->getActivationEnd());
1354 $item->toggleVisible($this->getActivationVisibility());
1355 }
1356
1357 $item->update($this->ref_id);
1358 }
1359 }
1360
1368 public function cloneSettings(\ilObjCourse $new_obj)
1369 {
1370 $new_obj->setSyllabus($this->getSyllabus());
1371 $new_obj->setContactName($this->getContactName());
1373 $new_obj->setContactPhone($this->getContactPhone());
1374 $new_obj->setContactEmail($this->getContactEmail());
1376 $new_obj->setOfflineStatus($this->getOfflineStatus()); // #9914
1377 $new_obj->setActivationStart($this->getActivationStart());
1378 $new_obj->setActivationEnd($this->getActivationEnd());
1381 $new_obj->setSubscriptionStart($this->getSubscriptionStart());
1382 $new_obj->setSubscriptionEnd($this->getSubscriptionEnd());
1383 $new_obj->setSubscriptionType($this->getSubscriptionType());
1387 $new_obj->setSubscriptionNotify($this->getSubscriptionNotify());
1388 $new_obj->setViewMode($this->getViewMode());
1389 $new_obj->setTimingMode($this->getTimingMode());
1390 $new_obj->setOrderType($this->getOrderType());
1391 $new_obj->setAboStatus($this->getAboStatus());
1392 $new_obj->enableWaitingList($this->enabledWaitingList());
1394 $new_obj->setTargetGroup($this->getTargetGroup());
1395 $new_obj->setShowMembers($this->getShowMembers());
1396 // patch mem_exp
1397 $new_obj->setShowMembersExport($this->getShowMembersExport());
1398 // patch mem_exp
1399 $new_obj->enableSessionLimit($this->isSessionLimitEnabled());
1402 $new_obj->setAutoNotification($this->getAutoNotification());
1404 include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1407 $new_obj->setMailToMembersType($this->getMailToMembersType());
1408 $new_obj->setCoursePeriod(
1409 $this->getCourseStart(),
1410 $this->getCourseEnd()
1411 );
1412 $new_obj->setCancellationEnd($this->getCancellationEnd());
1415
1416 // #10271
1417 $new_obj->setEnableCourseMap($this->getEnableCourseMap());
1418 $new_obj->setLatitude($this->getLatitude());
1419 $new_obj->setLongitude($this->getLongitude());
1420 $new_obj->setLocationZoom($this->getLocationZoom());
1421
1422 $new_obj->update();
1423 }
1424
1425 public function __createDefaultSettings()
1426 {
1427 global $DIC;
1428
1429 $ilDB = $DIC['ilDB'];
1430
1431 include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1433
1434 $query = "INSERT INTO crs_settings (obj_id,syllabus,contact_name,contact_responsibility," .
1435 "contact_phone,contact_email,contact_consultation," .
1436 "sub_limitation_type,sub_start,sub_end,sub_type,sub_password,sub_mem_limit," .
1437 "sub_max_members,sub_notify,view_mode,timing_mode,abo," .
1438 "latitude,longitude,location_zoom,enable_course_map,waiting_list,show_members,show_members_export, " .
1439 "session_limit,session_prev,session_next, reg_ac_enabled, reg_ac, auto_notification, status_dt,mail_members_type) " .
1440 "VALUES( " .
1441 $ilDB->quote($this->getId(), 'integer') . ", " .
1442 $ilDB->quote($this->getSyllabus(), 'text') . ", " .
1443 $ilDB->quote($this->getContactName(), 'text') . ", " .
1444 $ilDB->quote($this->getContactResponsibility(), 'text') . ", " .
1445 $ilDB->quote($this->getContactPhone(), 'text') . ", " .
1446 $ilDB->quote($this->getContactEmail(), 'text') . ", " .
1447 $ilDB->quote($this->getContactConsultation(), 'text') . ", " .
1448 $ilDB->quote(IL_CRS_SUBSCRIPTION_DEACTIVATED, 'integer') . ", " .
1449 $ilDB->quote($this->getSubscriptionStart(), 'integer') . ", " .
1450 $ilDB->quote($this->getSubscriptionEnd(), 'integer') . ", " .
1451 $ilDB->quote(IL_CRS_SUBSCRIPTION_DIRECT, 'integer') . ", " .
1452 $ilDB->quote($this->getSubscriptionPassword(), 'text') . ", " .
1453 "0, " .
1454 $ilDB->quote($this->getSubscriptionMaxMembers(), 'integer') . ", " .
1455 "1, " .
1456 "0, " .
1457 $ilDB->quote(IL_CRS_VIEW_TIMING_ABSOLUTE, 'integer') . ', ' .
1458 $ilDB->quote($this->ABO_ENABLED, 'integer') . ", " .
1459 $ilDB->quote($this->getLatitude(), 'text') . ", " .
1460 $ilDB->quote($this->getLongitude(), 'text') . ", " .
1461 $ilDB->quote($this->getLocationZoom(), 'integer') . ", " .
1462 $ilDB->quote($this->getEnableCourseMap(), 'integer') . ", " .
1463 #"objective_view = '0', ".
1464 "1, " .
1465 "1," .
1466 '0,' .
1467 $ilDB->quote($this->isSessionLimitEnabled(), 'integer') . ', ' .
1468 $ilDB->quote($this->getNumberOfPreviousSessions(), 'integer') . ', ' .
1469 $ilDB->quote($this->getNumberOfPreviousSessions(), 'integer') . ', ' .
1470 $ilDB->quote($this->isRegistrationAccessCodeEnabled(), 'integer') . ', ' .
1471 $ilDB->quote($this->getRegistrationAccessCode(), 'text') . ', ' .
1472 $ilDB->quote((int) $this->getAutoNotification(), 'integer') . ', ' .
1473 $ilDB->quote((int) $this->getStatusDetermination(), 'integer') . ', ' .
1474 $ilDB->quote((int) $this->getMailToMembersType(), 'integer') . ' ' .
1475 ")";
1476
1477 $res = $ilDB->manipulate($query);
1478 $this->__readSettings();
1479
1480 include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
1481 $sorting = new ilContainerSortingSettings($this->getId());
1482 $sorting->setSortMode(ilContainer::SORT_MANUAL);
1483 $sorting->update();
1484 }
1485
1486
1487 public function __readSettings()
1488 {
1489 global $DIC;
1490
1491 $ilDB = $DIC['ilDB'];
1492
1493 $query = "SELECT * FROM crs_settings WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . "";
1494
1495 $res = $ilDB->query($query);
1496 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1497 $this->setSyllabus($row->syllabus);
1498 $this->setTargetGroup($row->target_group);
1499 $this->setContactName($row->contact_name);
1500 $this->setContactResponsibility($row->contact_responsibility);
1501 $this->setContactPhone($row->contact_phone);
1502 $this->setContactEmail($row->contact_email);
1503 $this->setContactConsultation($row->contact_consultation);
1504 $this->setOfflineStatus(!(bool) $row->activation_type); // see below
1505 $this->setSubscriptionLimitationType($row->sub_limitation_type);
1506 $this->setSubscriptionStart($row->sub_start);
1507 $this->setSubscriptionEnd($row->sub_end);
1508 $this->setSubscriptionType($row->sub_type);
1509 $this->setSubscriptionPassword($row->sub_password);
1510 $this->enableSubscriptionMembershipLimitation($row->sub_mem_limit);
1511 $this->setSubscriptionMaxMembers($row->sub_max_members);
1512 $this->setSubscriptionNotify($row->sub_notify);
1513 $this->setViewMode($row->view_mode);
1514 $this->setTimingMode((int) $row->timing_mode);
1515 $this->setAboStatus($row->abo);
1516 $this->enableWaitingList($row->waiting_list);
1517 $this->setImportantInformation($row->important);
1518 $this->setShowMembers($row->show_members);
1519
1520 if (\ilPrivacySettings::_getInstance()->participantsListInCoursesEnabled()) {
1521 $this->setShowMembersExport($row->show_members_export);
1522 } else {
1523 $this->setShowMembersExport(false);
1524 }
1525 $this->setLatitude($row->latitude);
1526 $this->setLongitude($row->longitude);
1527 $this->setLocationZoom($row->location_zoom);
1528 $this->setEnableCourseMap($row->enable_course_map);
1529 $this->enableSessionLimit($row->session_limit);
1530 $this->setNumberOfPreviousSessions($row->session_prev);
1531 $this->setNumberOfNextSessions($row->session_next);
1532 $this->enableRegistrationAccessCode($row->reg_ac_enabled);
1533 $this->setRegistrationAccessCode($row->reg_ac);
1534 $this->setAutoNotification($row->auto_notification == 1 ? true : false);
1535 $this->setStatusDetermination((int) $row->status_dt);
1536 $this->setMailToMembersType($row->mail_members_type);
1537
1538 if ($row->period_time_indication) {
1539 $this->setCoursePeriod(
1540 new \ilDateTime($row->period_start, IL_CAL_DATETIME, \ilTimeZone::UTC),
1541 new \ilDateTime($row->period_end, IL_CAL_DATETIME, \ilTimeZone::UTC)
1542 );
1543 } elseif (!is_null($row->period_start) && !is_null($row->period_end)) {
1544 $this->setCoursePeriod(
1545 new \ilDate($row->period_start, IL_CAL_DATE),
1546 new \ilDate($row->period_end, IL_CAL_DATE)
1547 );
1548 }
1549 $this->toggleCourseStartTimeIndication((bool) $row->period_time_indication);
1550 $this->setCancellationEnd($row->leave_end ? new ilDate($row->leave_end, IL_CAL_UNIX) : null);
1551 $this->setWaitingListAutoFill($row->auto_wait);
1552 $this->setSubscriptionMinMembers($row->min_members ? $row->min_members : null);
1553 }
1554
1555 // moved activation to ilObjectActivation
1556 if ($this->ref_id) {
1557 include_once "./Services/Object/classes/class.ilObjectActivation.php";
1558 $activation = ilObjectActivation::getItem($this->ref_id);
1559 switch ($activation["timing_type"]) {
1561 $this->setActivationStart($activation["timing_start"]);
1562 $this->setActivationEnd($activation["timing_end"]);
1563 $this->setActivationVisibility($activation["visible"]);
1564 break;
1565 }
1566 }
1567 return true;
1568 }
1569
1570 public function initWaitingList()
1571 {
1572 include_once "./Modules/Course/classes/class.ilCourseWaitingList.php";
1573
1574 if (!is_object($this->waiting_list_obj)) {
1575 $this->waiting_list_obj = new ilCourseWaitingList($this->getId());
1576 }
1577 return true;
1578 }
1579
1580
1586 protected function initCourseMemberObject()
1587 {
1588 global $DIC;
1589
1590 $ilUser = $DIC['ilUser'];
1591
1592 include_once "./Modules/Course/classes/class.ilCourseParticipant.php";
1593 $this->member_obj = ilCourseParticipant::_getInstanceByObjId($this->getId(), $ilUser->getId());
1594 return true;
1595 }
1596
1602 protected function initCourseMembersObject()
1603 {
1604 global $DIC;
1605
1606 $ilUser = $DIC['ilUser'];
1607
1608 include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
1609 $this->members_obj = ilCourseParticipants::_getInstanceByObjId($this->getId());
1610 return true;
1611 }
1612
1617 public function getMemberObject()
1618 {
1619 if (!$this->member_obj instanceof ilCourseParticipant) {
1620 $this->initCourseMemberObject();
1621 }
1622 return $this->member_obj;
1623 }
1624
1628 public function getMembersObject()
1629 {
1630 if (!$this->members_obj instanceof ilCourseParticipants) {
1631 $this->initCourseMembersObject();
1632 }
1633 return $this->members_obj;
1634 }
1635
1636
1637
1638 // RBAC METHODS
1639 public function initDefaultRoles()
1640 {
1641 global $DIC;
1642
1643 $rbacadmin = $DIC['rbacadmin'];
1644 $rbacreview = $DIC['rbacreview'];
1645 $ilDB = $DIC['ilDB'];
1646
1647 include_once './Services/AccessControl/classes/class.ilObjRole.php';
1649 'il_crs_admin_' . $this->getRefId(),
1650 "Admin of crs obj_no." . $this->getId(),
1651 'il_crs_admin',
1652 $this->getRefId()
1653 );
1655 'il_crs_tutor_' . $this->getRefId(),
1656 "Tutor of crs obj_no." . $this->getId(),
1657 'il_crs_tutor',
1658 $this->getRefId()
1659 );
1661 'il_crs_member_' . $this->getRefId(),
1662 "Member of crs obj_no." . $this->getId(),
1663 'il_crs_member',
1664 $this->getRefId()
1665 );
1666
1667 return array();
1668 }
1669
1679 public function setParentRolePermissions($a_parent_ref)
1680 {
1681 global $DIC;
1682
1683 $rbacadmin = $DIC['rbacadmin'];
1684 $rbacreview = $DIC['rbacreview'];
1685
1686 $parent_roles = $rbacreview->getParentRoleIds($a_parent_ref);
1687 foreach ((array) $parent_roles as $parent_role) {
1688 $rbacadmin->initIntersectionPermissions(
1689 $this->getRefId(),
1690 $parent_role['obj_id'],
1691 $parent_role['parent'],
1694 );
1695 }
1696 }
1697
1705 {
1706 global $DIC;
1707
1708 $ilDB = $DIC['ilDB'];
1709
1710 $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_crs_non_member'";
1711 $res = $this->ilias->db->query($q);
1712 $row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
1713
1714 return $row["obj_id"];
1715 }
1716
1721 public static function lookupCourseNonMemberTemplatesId()
1722 {
1723 global $DIC;
1724
1725 $ilDB = $DIC['ilDB'];
1726
1727 $query = 'SELECT obj_id FROM object_data WHERE type = ' . $ilDB->quote('rolt', 'text') . ' AND title = ' . $ilDB->quote('il_crs_non_member', 'text');
1728 $res = $ilDB->query($query);
1729 $row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
1730
1731 return isset($row['obj_id']) ? $row['obj_id'] : 0;
1732 }
1733
1740 public function getLocalCourseRoles($a_translate = false)
1741 {
1742 global $DIC;
1743
1744 $rbacadmin = $DIC['rbacadmin'];
1745 $rbacreview = $DIC['rbacreview'];
1746
1747 if (empty($this->local_roles)) {
1748 $this->local_roles = array();
1749 $role_arr = $rbacreview->getRolesOfRoleFolder($this->getRefId());
1750
1751 foreach ($role_arr as $role_id) {
1752 if ($rbacreview->isAssignable($role_id, $this->getRefId()) == true) {
1753 $role_Obj = $this->ilias->obj_factory->getInstanceByObjId($role_id);
1754
1755 if ($a_translate) {
1756 $role_name = ilObjRole::_getTranslation($role_Obj->getTitle());
1757 } else {
1758 $role_name = $role_Obj->getTitle();
1759 }
1760 $this->local_roles[$role_name] = $role_Obj->getId();
1761 }
1762 }
1763 }
1764
1765 return $this->local_roles;
1766 }
1767
1768
1769
1779 public function getDefaultCourseRoles($a_crs_id = "")
1780 {
1781 global $DIC;
1782
1783 $rbacadmin = $DIC['rbacadmin'];
1784 $rbacreview = $DIC['rbacreview'];
1785
1786 if (strlen($a_crs_id) > 0) {
1787 $crs_id = $a_crs_id;
1788 } else {
1789 $crs_id = $this->getRefId();
1790 }
1791
1792 $role_arr = $rbacreview->getRolesOfRoleFolder($crs_id);
1793
1794 foreach ($role_arr as $role_id) {
1795 $role_Obj = &$this->ilias->obj_factory->getInstanceByObjId($role_id);
1796
1797 $crs_Member = "il_crs_member_" . $crs_id;
1798 $crs_Admin = "il_crs_admin_" . $crs_id;
1799 $crs_Tutor = "il_crs_tutor_" . $crs_id;
1800
1801 if (strcmp($role_Obj->getTitle(), $crs_Member) == 0) {
1802 $arr_crsDefaultRoles["crs_member_role"] = $role_Obj->getId();
1803 }
1804
1805 if (strcmp($role_Obj->getTitle(), $crs_Admin) == 0) {
1806 $arr_crsDefaultRoles["crs_admin_role"] = $role_Obj->getId();
1807 }
1808
1809 if (strcmp($role_Obj->getTitle(), $crs_Tutor) == 0) {
1810 $arr_crsDefaultRoles["crs_tutor_role"] = $role_Obj->getId();
1811 }
1812 }
1813
1814 return $arr_crsDefaultRoles;
1815 }
1816
1817 public function __getLocalRoles()
1818 {
1819 global $DIC;
1820
1821 $rbacreview = $DIC['rbacreview'];
1822
1823 // GET role_objects of predefined roles
1824
1825 return $rbacreview->getRolesOfRoleFolder($this->getRefId(), false);
1826 }
1827
1828 public function __deleteSettings()
1829 {
1830 global $DIC;
1831
1832 $ilDB = $DIC['ilDB'];
1833
1834 $query = "DELETE FROM crs_settings " .
1835 "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
1836 $res = $ilDB->manipulate($query);
1837
1838 return true;
1839 }
1840
1841
1842 public function getDefaultMemberRole()
1843 {
1844 $local_roles = $this->__getLocalRoles();
1845
1846 foreach ($local_roles as $role_id) {
1847 $title = ilObject::_lookupTitle($role_id);
1848 if (substr($title, 0, 8) == 'il_crs_m') {
1849 return $role_id;
1850 }
1851 }
1852 return 0;
1853 }
1854 public function getDefaultTutorRole()
1855 {
1856 $local_roles = $this->__getLocalRoles();
1857
1858 foreach ($local_roles as $role_id) {
1859 if ($tmp_role = &ilObjectFactory::getInstanceByObjId($role_id, false)) {
1860 if (!strcmp($tmp_role->getTitle(), "il_crs_tutor_" . $this->getRefId())) {
1861 return $role_id;
1862 }
1863 }
1864 }
1865 return false;
1866 }
1867 public function getDefaultAdminRole()
1868 {
1869 $local_roles = $this->__getLocalRoles();
1870
1871 foreach ($local_roles as $role_id) {
1872 if ($tmp_role = &ilObjectFactory::getInstanceByObjId($role_id, false)) {
1873 if (!strcmp($tmp_role->getTitle(), "il_crs_admin_" . $this->getRefId())) {
1874 return $role_id;
1875 }
1876 }
1877 }
1878 return false;
1879 }
1880
1881 public static function _deleteUser($a_usr_id)
1882 {
1883 // Delete all user related data
1884 // delete lm_history
1885 include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
1887
1888 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
1890
1891 // Course objectives
1892 include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
1894 }
1895
1902 public function MDUpdateListener($a_element)
1903 {
1904 global $DIC;
1905
1906 $ilLog = $DIC['ilLog'];
1907
1908 parent::MDUpdateListener($a_element);
1909
1910 switch ($a_element) {
1911 case 'General':
1912 // Update ecs content
1913 include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
1914 $ecs = new ilECSCourseSettings($this);
1915 $ecs->handleContentUpdate();
1916 break;
1917
1918 default:
1919 return true;
1920 }
1921 }
1922
1927 public function addAdditionalSubItemInformation(&$a_item_data)
1928 {
1929 include_once './Services/Object/classes/class.ilObjectActivation.php';
1931 }
1932
1940 protected function prepareAppointments($a_mode = 'create')
1941 {
1942 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php');
1943 include_once('./Services/Calendar/classes/class.ilDateTime.php');
1944
1945 switch ($a_mode) {
1946 case 'create':
1947 case 'update':
1948 if (!$this->getActivationUnlimitedStatus() and !$this->getOfflineStatus()) {
1949 $app = new ilCalendarAppointmentTemplate(self::CAL_ACTIVATION_START);
1950 $app->setTitle($this->getTitle());
1951 $app->setSubtitle('crs_cal_activation_start');
1952 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1953 $app->setDescription($this->getLongDescription());
1954 $app->setStart(new ilDateTime($this->getActivationStart(), IL_CAL_UNIX));
1955 $apps[] = $app;
1956
1957 $app = new ilCalendarAppointmentTemplate(self::CAL_ACTIVATION_END);
1958 $app->setTitle($this->getTitle());
1959 $app->setSubtitle('crs_cal_activation_end');
1960 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1961 $app->setDescription($this->getLongDescription());
1962 $app->setStart(new ilDateTime($this->getActivationEnd(), IL_CAL_UNIX));
1963 $apps[] = $app;
1964 }
1966 $app = new ilCalendarAppointmentTemplate(self::CAL_REG_START);
1967 $app->setTitle($this->getTitle());
1968 $app->setSubtitle('crs_cal_reg_start');
1969 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1970 $app->setDescription($this->getLongDescription());
1971 $app->setStart(new ilDateTime($this->getSubscriptionStart(), IL_CAL_UNIX));
1972 $apps[] = $app;
1973
1974 $app = new ilCalendarAppointmentTemplate(self::CAL_REG_END);
1975 $app->setTitle($this->getTitle());
1976 $app->setSubtitle('crs_cal_reg_end');
1977 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1978 $app->setDescription($this->getLongDescription());
1979 $app->setStart(new ilDateTime($this->getSubscriptionEnd(), IL_CAL_UNIX));
1980 $apps[] = $app;
1981 }
1982 if ($this->getCourseStart() && $this->getCourseEnd()) {
1983 $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_START);
1984 $app->setTitle($this->getTitle());
1985 $app->setSubtitle('crs_cal_start');
1986 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1987 $app->setDescription($this->getLongDescription());
1988 $app->setStart($this->getCourseStart());
1989 $app->setFullday(!$this->getCourseStartTimeIndication());
1990 $apps[] = $app;
1991
1992 $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_END);
1993 $app->setTitle($this->getTitle());
1994 $app->setSubtitle('crs_cal_end');
1995 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1996 $app->setDescription($this->getLongDescription());
1997 $app->setStart($this->getCourseEnd());
1998 $app->setFullday(!$this->getCourseStartTimeIndication());
1999 $apps[] = $app;
2000 }
2001 if (
2003 ) {
2005 foreach ($active as $null => $item) {
2006 if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
2007 // create calendar entry for fixed types
2008 $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_TIMING_START);
2009 $app->setContextInfo($item['ref_id']);
2010 $app->setTitle($item['title']);
2011 $app->setSubtitle('cal_crs_timing_start');
2012 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
2013 $app->setStart(new ilDate($item['suggestion_start'], IL_CAL_UNIX));
2014 $app->setFullday(true);
2015 $apps[] = $app;
2016
2017 $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_TIMING_END);
2018 $app->setContextInfo($item['ref_id']);
2019 $app->setTitle($item['title']);
2020 $app->setSubtitle('cal_crs_timing_end');
2021 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
2022 $app->setStart(new ilDate($item['suggestion_end'], IL_CAL_UNIX));
2023 $app->setFullday(true);
2024 $apps[] = $app;
2025 }
2026 }
2027 }
2028 return $apps ? $apps : array();
2029
2030 case 'delete':
2031 // Nothing to do: The category and all assigned appointments will be deleted.
2032 return array();
2033 }
2034 }
2035
2036 ###### Interface ilMembershipRegistrationCodes
2041 public static function lookupObjectsByCode($a_code)
2042 {
2043 global $DIC;
2044
2045 $ilDB = $DIC['ilDB'];
2046
2047 $query = "SELECT obj_id FROM crs_settings " .
2048 "WHERE reg_ac_enabled = " . $ilDB->quote(1, 'integer') . " " .
2049 "AND reg_ac = " . $ilDB->quote($a_code, 'text');
2050 $res = $ilDB->query($query);
2051
2052 $obj_ids = array();
2053 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
2054 $obj_ids[] = $row->obj_id;
2055 }
2056 return $obj_ids;
2057 }
2058
2066 public function register($a_user_id, $a_role = ilCourseConstants::CRS_MEMBER, $a_force_registration = false)
2067 {
2068 global $DIC;
2069
2070 $ilCtrl = $DIC['ilCtrl'];
2071 $tree = $DIC['tree'];
2072 include_once './Services/Membership/exceptions/class.ilMembershipRegistrationException.php';
2073 include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
2075
2076 if ($part->isAssigned($a_user_id)) {
2077 return true;
2078 }
2079
2080 if (!$a_force_registration) {
2081 // offline
2082 if (ilObjCourseAccess::_isOffline($this->getId())) {
2084 "Can't register to course, course is offline.",
2086 );
2087 }
2088 // activation
2089 if (!ilObjCourseAccess::_isActivated($this->getId())) {
2091 "Can't register to course, course is not activated.",
2093 );
2094 }
2095
2098 throw new ilMembershipRegistrationException('Cant registrate to course ' . $this->getId() .
2099 ', course subscription is deactivated.', ilMembershipRegistrationException::REGISTRATION_CODE_DISABLED);
2100 }
2101 }
2102
2103 // Time Limitation
2105 if (!$this->inSubscriptionTime()) {
2106 throw new ilMembershipRegistrationException('Cant registrate to course ' . $this->getId() .
2107 ', course is out of registration time.', ilMembershipRegistrationException::OUT_OF_REGISTRATION_PERIOD);
2108 }
2109 }
2110
2111 // Max members
2112 if ($this->isSubscriptionMembershipLimited()) {
2113 $free = max(0, $this->getSubscriptionMaxMembers() - $part->getCountMembers());
2114 include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2115 $waiting_list = new ilCourseWaitingList($this->getId());
2116 if ($this->enabledWaitingList() and (!$free or $waiting_list->getCountUsers())) {
2117 $waiting_list->addToList($a_user_id);
2118 $this->lng->loadLanguageModule("crs");
2119 $info = sprintf(
2120 $this->lng->txt('crs_added_to_list'),
2121 $waiting_list->getPosition($a_user_id)
2122 );
2123 include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
2124 $participants = ilCourseParticipants::_getInstanceByObjId($this->getId());
2125 $participants->sendNotification($participants->NOTIFY_WAITING_LIST, $a_user_id);
2126
2128 }
2129
2130 if (!$this->enabledWaitingList() && !$free) {
2131 throw new ilMembershipRegistrationException('Cant registrate to course ' . $this->getId() .
2132 ', membership is limited.', ilMembershipRegistrationException::OBJECT_IS_FULL);
2133 }
2134 }
2135 }
2136
2137 $part->add($a_user_id, $a_role);
2138 $part->sendNotification($part->NOTIFY_ACCEPT_USER, $a_user_id);
2139 $part->sendNotification($part->NOTIFY_ADMINS, $a_user_id);
2140
2141
2142 include_once './Modules/Forum/classes/class.ilForumNotification.php';
2144
2145 return true;
2146 }
2147
2154 public function getAutoNotification()
2155 {
2157 }
2158
2159
2166 public function setAutoNotification($value)
2167 {
2168 $this->auto_notification = $value;
2169 }
2170
2176 public function setStatusDetermination($a_value)
2177 {
2178 $a_value = (int) $a_value;
2179
2180 // #13905
2181 if ($a_value == self::STATUS_DETERMINATION_LP) {
2182 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
2185 }
2186 }
2187
2188 $this->status_dt = $a_value;
2189 }
2190
2196 public function getStatusDetermination()
2197 {
2198 return $this->status_dt;
2199 }
2200
2204 public function syncMembersStatusWithLP()
2205 {
2206 include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
2207 foreach ($this->getMembersObject()->getParticipants() as $user_id) {
2208 // #15529 - force raise on sync
2209 ilLPStatusWrapper::_updateStatus($this->getId(), $user_id, null, false, true);
2210 }
2211 }
2212
2220 public function checkLPStatusSync($a_member_id)
2221 {
2222 // #11113
2223 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
2226 include_once("Services/Tracking/classes/class.ilLPStatus.php");
2227 // #13811 - we need to suppress creation if status entry
2228 $has_completed = (ilLPStatus::_lookupStatus($this->getId(), $a_member_id, false) == ilLPStatus::LP_STATUS_COMPLETED_NUM);
2229 $this->getMembersObject()->updatePassed($a_member_id, $has_completed, false, true);
2230 }
2231 }
2232
2233 public function getOrderType()
2234 {
2235 if ($this->enabledObjectiveView()) {
2237 }
2238 return parent::getOrderType();
2239 }
2240
2244 public function handleAutoFill()
2245 {
2246 if (
2247 !$this->enabledWaitingList() or
2248 !$this->hasWaitingListAutoFill()
2249 ) {
2250 $this->course_logger->debug('Waiting list or auto fill disabled.');
2251 return;
2252 }
2253
2254 $max = $this->getSubscriptionMaxMembers();
2256
2257 $this->course_logger->debug('Max members: ' . $max);
2258 $this->course_logger->debug('Current members: ' . $now);
2259
2260 if ($max <= $now) {
2261 return;
2262 }
2263
2264 // see assignFromWaitingListObject()
2265 include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2266 $waiting_list = new ilCourseWaitingList($this->getId());
2267
2268 foreach ($waiting_list->getUserIds() as $user_id) {
2269 if (!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id, false)) {
2270 $this->course_logger->warning('Cannot create user instance for id: ' . $user_id);
2271 continue;
2272 }
2273 if ($this->getMembersObject()->isAssigned($user_id)) {
2274 $this->course_logger->warning('User is already assigned to course. uid: ' . $user_id . ' course_id: ' . $this->getRefId());
2275 continue;
2276 }
2277 $this->getMembersObject()->add($user_id, IL_CRS_MEMBER);
2278 $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_USER, $user_id, true);
2279 $waiting_list->removeFromList($user_id);
2280 $this->checkLPStatusSync($user_id);
2281
2282 $this->course_logger->info('Assigned user from waiting list to course: ' . $this->getTitle());
2283 $now++;
2284 if ($now >= $max) {
2285 break;
2286 }
2287 }
2288 }
2289
2290 public static function mayLeave($a_course_id, $a_user_id = null, &$a_date = null)
2291 {
2292 global $DIC;
2293
2294 $ilUser = $DIC['ilUser'];
2295 $ilDB = $DIC['ilDB'];
2296
2297 if (!$a_user_id) {
2298 $a_user_id = $ilUser->getId();
2299 }
2300
2301 $set = $ilDB->query("SELECT leave_end" .
2302 " FROM crs_settings" .
2303 " WHERE obj_id = " . $ilDB->quote($a_course_id, "integer"));
2304 $row = $ilDB->fetchAssoc($set);
2305 if ($row && $row["leave_end"]) {
2306 // timestamp to date
2307 $limit = date("Ymd", $row["leave_end"]);
2308 if ($limit < date("Ymd")) {
2309 $a_date = new ilDate(date("Y-m-d", $row["leave_end"]), IL_CAL_DATE);
2310 return false;
2311 }
2312 }
2313 return true;
2314 }
2315
2321 public static function findCoursesWithNotEnoughMembers()
2322 {
2323 $ilDB = $GLOBALS['DIC']->database();
2324 $tree = $GLOBALS['DIC']->repositoryTree();
2325
2326 $res = array();
2327
2328 $before = new ilDateTime(time(), IL_CAL_UNIX);
2329 $before->increment(IL_CAL_DAY, -1);
2330 $now = $before->get(IL_CAL_UNIX);
2331
2332 include_once "Modules/Course/classes/class.ilCourseParticipants.php";
2333
2334 $set = $ilDB->query("SELECT obj_id, min_members" .
2335 " FROM crs_settings" .
2336 " WHERE min_members > " . $ilDB->quote(0, "integer") .
2337 " AND sub_mem_limit = " . $ilDB->quote(1, "integer") . // #17206
2338 " AND ((leave_end IS NOT NULL" .
2339 " AND leave_end < " . $ilDB->quote($now, "text") . ")" .
2340 " OR (leave_end IS NULL" .
2341 " AND sub_end IS NOT NULL" .
2342 " AND sub_end < " . $ilDB->quote($now, "text") . "))" .
2343 " AND (period_start IS NULL OR period_start > " . $ilDB->quote($now, "integer") . ")");
2344 while ($row = $ilDB->fetchAssoc($set)) {
2345 $refs = ilObject::_getAllReferences($row['obj_id']);
2346 $ref = end($refs);
2347
2348 if ($tree->isDeleted($ref)) {
2349 continue;
2350 }
2351
2352 $part = new ilCourseParticipants($row["obj_id"]);
2353 $reci = $part->getNotificationRecipients();
2354 if (sizeof($reci)) {
2355 $missing = (int) $row["min_members"] - $part->getCountMembers();
2356 if ($missing > 0) {
2357 $res[$row["obj_id"]] = array($missing, $reci);
2358 }
2359 }
2360 }
2361
2362 return $res;
2363 }
2364} //END class.ilObjCourse
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_TRANSLATION_SYSTEM
const IL_CRS_SUBSCRIPTION_LIMITED
const IL_CRS_VIEW_TIMING_ABSOLUTE
const IL_CRS_VIEW_OBJECTIVE
const IL_CRS_SUBSCRIPTION_PASSWORD
const IL_CRS_ARCHIVE_NONE
const IL_CRS_ARCHIVE_DOWNLOAD
const IL_CRS_SUBSCRIPTION_UNLIMITED
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_SUBSCRIPTION_DIRECT
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_DATETIME
const IL_CAL_DAY
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_CRS_MEMBER
static getInstancesByParentId($a_parent_id, array $a_filter=null)
Low level api for booking service.
Apointment templates are used for automatic generated apointments.
static convertDateToUtcDBTimestamp(\ilDateTime $date=null)
static prepareSessionPresentationLimitation(array $items, ilContainer $container, bool $admin_panel_enabled=false, bool $include_side_block=false)
static _lookupSortMode($a_obj_id)
lookup sort mode
Class ilContainer.
setOrderType($a_value)
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static _deleteByContainer($a_container_id)
Delete all fields of a container.
static _clone($a_source_id, $a_target_id)
Clone fields.
static _cloneFiles($a_source_id, $a_target_id)
Clone course files.
static _deleteByCourse($a_course_id)
static _deleteUser($a_usr_id)
Delete user @global type $ilDB.
class ilcourseobjective
static _deleteAll($course_id)
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
@classDescription Date and time handling
Class for single dates.
Class ilECSCourseSettings.
static checkForumsExistsInsert($ref_id, $user_id=0)
static cloneSettings($a_copy_id, $a_container_id, $a_new_container_id)
Clone settings.
static deleteResultsForUser($a_user_id)
Delete all result entries for user.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
const LP_STATUS_COMPLETED_NUM
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
static getLogger($a_component_id)
Get component logger.
static generateCode()
Generate new registration key.
static _registrationEnabled($a_obj_id)
static _usingRegistrationCode()
Using Registration code.
static _isActivated($a_obj_id, &$a_visible_flag=null, $a_mind_member_view=true)
Is activated?
static _isOffline($a_obj_id)
Type-specific implementation of general status.
static _deleteAll($a_course_id)
static _getGroupings($a_course_id)
Class ilObjCourse.
static lookupCourseNonMemberTemplatesId()
Lookup course non member id.
getDefaultCourseRoles($a_crs_id="")
get default course roles, returns the defaultlike create roles il_crs_tutor, il_crs_admin and il_crs_...
setCourseStart(ilDateTime $a_value=null)
static _lookupViewMode($a_id)
lookup view mode of container
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone course (no member data)
getNumberOfNextSessions()
Set number of previous sessions.
setCourseEnd(ilDateTime $a_value=null)
getMailToMembersType()
Get mail to members type.
setParentRolePermissions($a_parent_ref)
This method is called before "initDefaultRoles".
const STATUS_DETERMINATION_MANUAL
setTargetGroup(?string $a_tg)
setLongitude($a_longitude)
Set Longitude.
static _registrationEnabled($a_obj_id)
Registration enabled? Method is in Access class, since it is needed by Access/ListGUI.
setMessage($a_message)
const STATUS_DETERMINATION_LP
isActivated()
Check if course is active and not offline.
setActivationStart($a_value)
setStatusDetermination($a_value)
Set status determination mode.
setSubscriptionNotify($a_value)
setTimingMode($a_mode)
enableWaitingList($a_status)
setShowMembersExport($a_mem_export)
static _isSubscriptionNotificationEnabled($a_course_id)
Check if subscription notification is enabled.
handleAutoFill()
Handle course auto fill.
update()
update complete object
isSubscriptionMembershipLimited()
is membership limited
enableSubscriptionMembershipLimitation($a_status)
enable max members
enableSessionLimit($a_status)
en/disable limited number of sessions
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
cloneSettings(\ilObjCourse $new_obj)
Clone entries in settings table.
getLatitude()
Get Latitude.
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies (start objects, preconditions)
getLocalCourseRoles($a_translate=false)
get ALL local roles of course, also those created and defined afterwards only fetch data once from da...
getViewMode()
Get container view mode.
static _lookupAboStatus($a_id)
setNumberOfNextSessions($a_num)
Set number of previous sessions.
setWaitingListAutoFill($a_value)
setSubscriptionType($a_value)
MDUpdateListener($a_element)
Overwriten Metadata update listener for ECS functionalities.
__getCrsNonMemberTemplateId()
get course non-member template @access private
static lookupObjectsByCode($a_code)
static mayLeave($a_course_id, $a_user_id=null, &$a_date=null)
static _isActivated($a_obj_id)
Is activated.
setContactEmail($a_value)
initCourseMemberObject()
Init course member object @global ilObjUser $ilUser.
setActivationEnd($a_value)
setRegistrationAccessCode($a_code)
Set refistration access code.
prepareAppointments($a_mode='create')
Prepare calendar appointments.
setContactPhone($a_value)
getLocationZoom()
Get LocationZoom.
initCourseMembersObject()
Init course member object @global ilObjUser $ilUser.
getSubItems( $a_admin_panel_enabled=false, $a_include_side_block=false, $a_get_single=0, \ilContainerUserFilter $container_user_filter=null)
Get subitems of container.
static findCoursesWithNotEnoughMembers()
Minimum members check @global type $ilDB.
setArchiveType($a_value)
getEnableCourseMap()
Get Enable Course Map.
setSubscriptionEnd($a_value)
setLatitude($a_latitude)
Set Latitude.
enableRegistrationAccessCode($a_status)
En/disable registration access code.
setSubscriptionMaxMembers($a_value)
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
create($a_upload=false)
updateSettings()
Update settings.
getRegistrationAccessCode()
get access code
getMemberObject()
Get course member object.
checkLPStatusSync($a_member_id)
sync course status from lp
syncMembersStatusWithLP()
Set course status for all members by lp status.
setArchiveEnd($a_value)
toggleCourseStartTimeIndication(bool $time_indication)
setShowMembers($a_status)
setMailToMembersType($a_type)
Set mail to members type.
setCoursePeriod(\ilDateTime $start=null, \ilDateTime $end=null)
setSubscriptionPassword($a_value)
setSubscriptionStart($a_value)
setImportantInformation($a_info)
const CAL_ACTIVATION_START
getOrderType()
Get order type default implementation.
const CAL_COURSE_TIMING_START
setNumberOfPreviousSessions($a_num)
Set number of previous sessions.
cloneAutoGeneratedRoles($new_obj)
Clone automatic genrated roles (permissions and template permissions)
appendMessage($a_message)
getActivationUnlimitedStatus()
get activation unlimited no start or no end
setContactConsultation($a_value)
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
setSyllabus($a_syllabus)
setSubscriptionMinMembers($a_value)
setContactResponsibility($a_value)
setAboStatus($a_status)
getStatusDetermination()
Get status determination mode.
addAdditionalSubItemInformation(&$a_item_data)
Add additional information to sub item, e.g.
static lookupTimingMode($a_obj_id)
setViewMode($a_mode)
const CAL_COURSE_TIMING_END
setArchiveStart($a_value)
setEnableCourseMap($a_enablemap)
Set Enable Course Map.
const CAL_ACTIVATION_END
setSubscriptionLimitationType($a_type)
static _deleteUser($a_usr_id)
isRegistrationAccessCodeEnabled()
Check if access code is enabled.
getEnableMap()
Type independent wrapper.
setCancellationEnd(ilDate $a_value=null)
setLocationZoom($a_locationzoom)
Set LocationZoom.
getAutoNotification()
Returns automatic notification status from $this->auto_notification.
getNumberOfPreviousSessions()
Set number of previous sessions.
setAutoNotification($value)
Sets automatic notification status in $this->auto_notification, using given $status.
setActivationVisibility($a_value)
getLongitude()
Get Longitude.
static _getTranslation($a_role_title)
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
static _enabledLearningProgress()
check wether learing progress is enabled or not
static getUserIdByLogin($a_login)
Class ilObjectActivation.
setTimingType($a_type)
Set timing type.
static cloneDependencies($a_ref_id, $a_target_id, $a_copy_id)
Clone dependencies.
static addAdditionalSubItemInformation(array &$a_item)
Parse item data for list entries.
static getTimingsItems($a_container_ref_id)
Get (sub) item data for timings view (no session material, no side blocks)
static getItem($a_ref_id)
Get item data.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupObjId($a_id)
setOfflineStatus($a_status)
Set offline status.
static _lookupTitle($a_id)
lookup object title
deleteMetaData()
delete meta data entry
updateMetaData()
update meta data entry
getOfflineStatus()
Get offline status.
createMetaData()
create meta data entry
getRefId()
get reference id @access public
getLongDescription()
get object long description (stored in object_description)
static _getAllReferences($a_id)
get all reference ids of object
cloneMetaData($target_obj)
Copy meta data.
getId()
get object id @access public
getTitle()
get object title @access public
static lookupNumberOfMembers($a_ref_id)
Lookup number of members @global ilRbacReview $rbacreview @global <type> $ilObjDataCache.
static _deleteUser($a_usr_id)
Delete user data.
static _deleteAllEntries($a_obj_id)
Delete all entries Normally called for course deletion.
static _getInstance()
Get instance of ilPrivacySettings.
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
$app
Definition: cli.php:38
const ROLE_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
Interface for all objects that offer registration with access codes.
if( $orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:285
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)
$query
$ilErr
Definition: raiseError.php:18
foreach($_POST as $key=> $value) $res
global $ilDB
$message
Definition: xapiexit.php:14