ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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;
49
52
53 private $member_obj = null;
54 private $members_obj = null;
56
57 private $latitude = '';
58 private $longitude = '';
59 private $locationzoom = 0;
60 private $enablemap = 0;
61
62 private $session_limit = 0;
63 private $session_prev = -1;
64 private $session_next = -1;
65
66 private $reg_access_code = '';
67 private $reg_access_code_enabled = false;
68 private $status_dt = null;
69
71
72 protected $crs_start; // [ilDate]
73 protected $crs_end; // [ilDate]
74 protected $leave_end; // [ilDate]
75 protected $min_members; // [int]
76 protected $auto_fill_from_waiting; // [bool]
77
81 protected $member_export = false;
82
91 private $auto_notification = true;
92
99 public function __construct($a_id = 0, $a_call_by_reference = true)
100 {
101
102 #define("ILIAS_MODULE","course");
103 #define("KEEP_IMAGE_PATH",1);
104
105 $this->SUBSCRIPTION_DEACTIVATED = 1;
106 $this->SUBSCRIPTION_CONFIRMATION = 2;
107 $this->SUBSCRIPTION_DIRECT = 3;
108 $this->SUBSCRIPTION_PASSWORD = 4;
109 $this->SUBSCRIPTION_AUTOSUBSCRIPTION = 5;
110 $this->ARCHIVE_DISABLED = 1;
111 $this->ARCHIVE_READ = 2;
112 $this->ARCHIVE_DOWNLOAD = 3;
113 $this->ABO_ENABLED = 1;
114 $this->ABO_DISABLED = 0;
115 $this->SHOW_MEMBERS_ENABLED = 1;
116 $this->SHOW_MEMBERS_DISABLED = 0;
117 $this->setStatusDetermination(self::STATUS_DETERMINATION_LP);
118
119 $this->type = "crs";
120
121 $this->course_logger = $GLOBALS['DIC']->logger()->crs();
122
123 parent::__construct($a_id, $a_call_by_reference);
124 }
125
131 public static function lookupShowMembersEnabled($a_obj_id)
132 {
133 $query = 'SELECT show_members FROM crs_settings ' .
134 'WHERE obj_id = ' . $GLOBALS['ilDB']->quote($a_obj_id, 'integer');
135 $res = $GLOBALS['ilDB']->query($query);
136 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
137 return (bool) $row->show_members;
138 }
139 return false;
140 }
141
142 public function getShowMembersExport()
143 {
145 }
146
147 public function setShowMembersExport($a_mem_export)
148 {
149 $this->member_export = $a_mem_export;
150 }
151
157 {
159 }
160
166 public function setRegistrationAccessCode($a_code)
167 {
168 $this->reg_access_code = $a_code;
169 }
170
176 {
177 return (bool) $this->reg_access_code_enabled;
178 }
179
185 public function enableRegistrationAccessCode($a_status)
186 {
187 $this->reg_access_code_enabled = $a_status;
188 }
189
190 public function getImportantInformation()
191 {
192 return $this->important;
193 }
194 public function setImportantInformation($a_info)
195 {
196 $this->important = $a_info;
197 }
198 public function getSyllabus()
199 {
200 return $this->syllabus;
201 }
202 public function setSyllabus($a_syllabus)
203 {
204 $this->syllabus = $a_syllabus;
205 }
206 public function getContactName()
207 {
208 return $this->contact_name;
209 }
210 public function setContactName($a_cn)
211 {
212 $this->contact_name = $a_cn;
213 }
214 public function getContactConsultation()
215 {
216 return $this->contact_consultation;
217 }
218 public function setContactConsultation($a_value)
219 {
220 $this->contact_consultation = $a_value;
221 }
222 public function getContactPhone()
223 {
224 return $this->contact_phone;
225 }
226 public function setContactPhone($a_value)
227 {
228 $this->contact_phone = $a_value;
229 }
230 public function getContactEmail()
231 {
232 return $this->contact_email;
233 }
234 public function setContactEmail($a_value)
235 {
236 $this->contact_email = $a_value;
237 }
238 public function getContactResponsibility()
239 {
240 return $this->contact_responsibility;
241 }
242 public function setContactResponsibility($a_value)
243 {
244 $this->contact_responsibility = $a_value;
245 }
246 public function getActivationType()
247 {
248 return (int) $this->activation_type;
249 }
250 public function setActivationType($a_type)
251 {
252 // offline is separate property now
254 $this->setOfflineStatus(true);
256 }
257
258 $this->activation_type = $a_type;
259 }
261 {
262 return $this->activation_type == IL_CRS_ACTIVATION_UNLIMITED;
263 }
264 public function getActivationStart()
265 {
266 return $this->activation_start;
267 }
268 public function setActivationStart($a_value)
269 {
270 $this->activation_start = $a_value;
271 }
272 public function getActivationEnd()
273 {
274 return $this->activation_end;
275 }
276 public function setActivationEnd($a_value)
277 {
278 $this->activation_end = $a_value;
279 }
280 public function getOfflineStatus()
281 {
282 return (bool) $this->activation_offline;
283 }
284 public function setOfflineStatus($a_value)
285 {
286 $this->activation_offline = (bool) $a_value;
287 }
288 public function setActivationVisibility($a_value)
289 {
290 $this->activation_visibility = (bool) $a_value;
291 }
292 public function getActivationVisibility()
293 {
294 return $this->activation_visibility;
295 }
296
298 {
299 return $this->subscription_limitation_type;
300 }
302 {
303 $this->subscription_limitation_type = $a_type;
304 }
306 {
307 return $this->subscription_limitation_type == IL_CRS_SUBSCRIPTION_UNLIMITED;
308 }
309 public function getSubscriptionStart()
310 {
311 return $this->subscription_start;
312 }
313 public function setSubscriptionStart($a_value)
314 {
315 $this->subscription_start = $a_value;
316 }
317 public function getSubscriptionEnd()
318 {
319 return $this->subscription_end;
320 }
321 public function setSubscriptionEnd($a_value)
322 {
323 $this->subscription_end = $a_value;
324 }
325 public function getSubscriptionType()
326 {
327 return $this->subscription_type ? $this->subscription_type : IL_CRS_SUBSCRIPTION_DIRECT;
328 #return $this->subscription_type ? $this->subscription_type : $this->SUBSCRIPTION_DEACTIVATED;
329 }
330 public function setSubscriptionType($a_value)
331 {
332 $this->subscription_type = $a_value;
333 }
334 public function getSubscriptionPassword()
335 {
336 return $this->subscription_password;
337 }
338 public function setSubscriptionPassword($a_value)
339 {
340 $this->subscription_password = $a_value;
341 }
342 public function enabledObjectiveView()
343 {
344 return $this->view_mode == IL_CRS_VIEW_OBJECTIVE;
345 }
346
347 public function enabledWaitingList()
348 {
349 return (bool) $this->waiting_list;
350 }
351
352 public function enableWaitingList($a_status)
353 {
354 $this->waiting_list = (bool) $a_status;
355 }
356
357 public function inSubscriptionTime()
358 {
359 if ($this->getSubscriptionUnlimitedStatus()) {
360 return true;
361 }
362 if (time() > $this->getSubscriptionStart() and time() < $this->getSubscriptionEnd()) {
363 return true;
364 }
365 return false;
366 }
367
373 public function enableSessionLimit($a_status)
374 {
375 $this->session_limit = $a_status;
376 }
377
378 public function isSessionLimitEnabled()
379 {
380 return (bool) $this->session_limit;
381 }
382
390 public function enableSubscriptionMembershipLimitation($a_status)
391 {
392 $this->subscription_membership_limitation = $a_status;
393 }
394
400 public function setNumberOfPreviousSessions($a_num)
401 {
402 $this->session_prev = $a_num;
403 }
404
410 {
411 return $this->session_prev;
412 }
413
419 public function setNumberOfNextSessions($a_num)
420 {
421 $this->session_next = $a_num;
422 }
423
428 public function getNumberOfNextSessions()
429 {
430 return $this->session_next;
431 }
440 {
441 return (bool) $this->subscription_membership_limitation;
442 }
443
445 {
446 return $this->subscription_max_members;
447 }
448 public function setSubscriptionMaxMembers($a_value)
449 {
450 $this->subscription_max_members = $a_value;
451 }
452
461 public static function _isSubscriptionNotificationEnabled($a_course_id)
462 {
463 global $ilDB;
464
465 $query = "SELECT * FROM crs_settings " .
466 "WHERE obj_id = " . $ilDB->quote($a_course_id, 'integer') . " " .
467 "AND sub_notify = 1";
468 $res = $ilDB->query($query);
469 return $res->numRows() ? true : false;
470 }
471
478 public function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0)
479 {
480 global $ilUser;
481
482 // Caching
483 if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block])) {
484 return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
485 }
486
487 // Results are stored in $this->items
488 parent::getSubItems($a_admin_panel_enabled, $a_include_side_block, $a_get_single);
489
490 $limit_sess = false;
491 if (!$a_admin_panel_enabled &&
492 !$a_include_side_block &&
493 $this->items['sess'] &&
494 is_array($this->items['sess']) &&
495 $this->isSessionLimitEnabled() &&
496 $this->getViewMode() == ilContainer::VIEW_SESSIONS) { // #16686
497 $limit_sess = true;
498 }
499
500 if (!$limit_sess) {
501 return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
502 }
503
504
505 // do session limit
506
507 // @todo move to gui class
508 if (isset($_GET['crs_prev_sess'])) {
509 $ilUser->writePref('crs_sess_show_prev_' . $this->getId(), (string) (int) $_GET['crs_prev_sess']);
510 }
511 if (isset($_GET['crs_next_sess'])) {
512 $ilUser->writePref('crs_sess_show_next_' . $this->getId(), (string) (int) $_GET['crs_next_sess']);
513 }
514
515 $sessions = ilUtil::sortArray($this->items['sess'], 'start', 'ASC', true, false);
516 $today = new ilDate(date('Ymd', time()), IL_CAL_DATE);
517 $previous = $current = $next = array();
518 foreach ($sessions as $key => $item) {
519 $start = new ilDateTime($item['start'], IL_CAL_UNIX);
520 $end = new ilDateTime($item['end'], IL_CAL_UNIX);
521
522 if (ilDateTime::_within($today, $start, $end, IL_CAL_DAY)) {
523 $current[] = $item;
524 } elseif (ilDateTime::_before($start, $today, IL_CAL_DAY)) {
525 $previous[] = $item;
526 } elseif (ilDateTime::_after($start, $today, IL_CAL_DAY)) {
527 $next[] = $item;
528 }
529 }
530 $num_previous_remove = max(
531 count($previous) - $this->getNumberOfPreviousSessions(),
532 0
533 );
534 while ($num_previous_remove--) {
535 if (!$ilUser->getPref('crs_sess_show_prev_' . $this->getId())) {
536 array_shift($previous);
537 }
538 $this->items['sess_link']['prev']['value'] = 1;
539 }
540
541 $num_next_remove = max(
542 count($next) - $this->getNumberOfNextSessions(),
543 0
544 );
545 while ($num_next_remove--) {
546 if (!$ilUser->getPref('crs_sess_show_next_' . $this->getId())) {
547 array_pop($next);
548 }
549 // @fixme
550 $this->items['sess_link']['next']['value'] = 1;
551 }
552
553 $sessions = array_merge($previous, $current, $next);
554 $this->items['sess'] = $sessions;
555
556 // #15389 - see ilContainer::getSubItems()
557 include_once('Services/Container/classes/class.ilContainerSorting.php');
558 $sort = ilContainerSorting::_getInstance($this->getId());
559 $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $sort->sortItems($this->items);
560
561 return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
562 }
563
564 public function getSubscriptionNotify()
565 {
566 return true;
567 return $this->subscription_notify ? true : false;
568 }
569 public function setSubscriptionNotify($a_value)
570 {
571 $this->subscription_notify = $a_value ? true : false;
572 }
573
574 public function setViewMode($a_mode)
575 {
576 $this->view_mode = $a_mode;
577 }
578 public function getViewMode()
579 {
580 return $this->view_mode;
581 }
582
588 public static function _lookupViewMode($a_id)
589 {
590 global $ilDB;
591
592 $query = "SELECT view_mode FROM crs_settings WHERE obj_id = " . $ilDB->quote($a_id, 'integer') . " ";
593 $res = $ilDB->query($query);
594 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
595 return $row->view_mode;
596 }
597 return false;
598 }
599
600 public static function _lookupAboStatus($a_id)
601 {
602 global $ilDB;
603
604 $query = "SELECT abo FROM crs_settings WHERE obj_id = " . $ilDB->quote($a_id, 'integer') . " ";
605 $res = $ilDB->query($query);
606 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
607 return $row->abo;
608 }
609 return false;
610 }
611
612 public function getArchiveStart()
613 {
614 return $this->archive_start ? $this->archive_start : time();
615 }
616 public function setArchiveStart($a_value)
617 {
618 $this->archive_start = $a_value;
619 }
620 public function getArchiveEnd()
621 {
622 return $this->archive_end ? $this->archive_end : mktime(0, 0, 0, 12, 12, date("Y", time())+2);
623 }
624 public function setArchiveEnd($a_value)
625 {
626 $this->archive_end = $a_value;
627 }
628 public function getArchiveType()
629 {
630 return $this->archive_type ? IL_CRS_ARCHIVE_DOWNLOAD : IL_CRS_ARCHIVE_NONE;
631 }
632 public function setArchiveType($a_value)
633 {
634 $this->archive_type = $a_value;
635 }
636 public function setAboStatus($a_status)
637 {
638 $this->abo = $a_status;
639 }
640 public function getAboStatus()
641 {
642 return $this->abo;
643 }
644 public function setShowMembers($a_status)
645 {
646 $this->show_members = $a_status;
647 }
648 public function getShowMembers()
649 {
650 return $this->show_members;
651 }
652
659 {
660 $this->mail_members = $a_type;
661 }
662
667 public function getMailToMembersType()
668 {
669 return $this->mail_members;
670 }
671
672 public function getMessage()
673 {
674 return $this->message;
675 }
676 public function setMessage($a_message)
677 {
678 $this->message = $a_message;
679 }
680 public function appendMessage($a_message)
681 {
682 if ($this->getMessage()) {
683 $this->message .= "<br /> ";
684 }
685 $this->message .= $a_message;
686 }
687
688 public function isActivated()
689 {
690 if ($this->getOfflineStatus()) {
691 return false;
692 }
693 if ($this->getActivationUnlimitedStatus()) {
694 return true;
695 }
696 if (time() < $this->getActivationStart() or
697 time() > $this->getActivationEnd()) {
698 return false;
699 }
700 return true;
701 }
702
709 public static function _isActivated($a_obj_id)
710 {
711 include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
712 return ilObjCourseAccess::_isActivated($a_obj_id);
713 }
714
721 public static function _registrationEnabled($a_obj_id)
722 {
723 include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
725 }
726
727
728 public function allowAbo()
729 {
730 return $this->ABO == $this->ABO_ENABLED;
731 }
732
736 public function read()
737 {
738 parent::read();
739
740 include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
742
743 $this->__readSettings();
744 }
745 public function create($a_upload = false)
746 {
747 global $ilAppEventHandler;
748
749 parent::create($a_upload);
750
751 if (!$a_upload) {
752 $this->createMetaData();
753 }
755
756 $ilAppEventHandler->raise(
757 'Modules/Course',
758 'create',
759 array('object' => $this,
760 'obj_id' => $this->getId(),
761 'appointments' => $this->prepareAppointments('create'))
762 );
763 }
764
770 public function setLatitude($a_latitude)
771 {
772 $this->latitude = $a_latitude;
773 }
774
780 public function getLatitude()
781 {
782 return $this->latitude;
783 }
784
790 public function setLongitude($a_longitude)
791 {
792 $this->longitude = $a_longitude;
793 }
794
800 public function getLongitude()
801 {
802 return $this->longitude;
803 }
804
810 public function setLocationZoom($a_locationzoom)
811 {
812 $this->locationzoom = $a_locationzoom;
813 }
814
820 public function getLocationZoom()
821 {
822 return $this->locationzoom;
823 }
824
830 public function setEnableCourseMap($a_enablemap)
831 {
832 $this->enablemap = $a_enablemap;
833 }
834
839 public function getEnableMap()
840 {
841 return $this->getEnableCourseMap();
842 }
843
849 public function getEnableCourseMap()
850 {
851 return $this->enablemap;
852 }
853
854 public function setCourseStart(ilDate $a_value = null)
855 {
856 $this->crs_start = $a_value;
857 }
858
859 public function getCourseStart()
860 {
861 return $this->crs_start;
862 }
863
864 public function setCourseEnd(ilDate $a_value = null)
865 {
866 $this->crs_end = $a_value;
867 }
868
869 public function getCourseEnd()
870 {
871 return $this->crs_end;
872 }
873
874 public function setCancellationEnd(ilDate $a_value = null)
875 {
876 $this->leave_end = $a_value;
877 }
878
879 public function getCancellationEnd()
880 {
881 return $this->leave_end;
882 }
883
884 public function setSubscriptionMinMembers($a_value)
885 {
886 if ($a_value !== null) {
887 $a_value = (int) $a_value;
888 }
889 $this->min_members = $a_value;
890 }
891
893 {
894 return $this->min_members;
895 }
896
897 public function setWaitingListAutoFill($a_value)
898 {
899 $this->auto_fill_from_waiting = (bool) $a_value;
900 }
901
902 public function hasWaitingListAutoFill()
903 {
904 return (bool) $this->auto_fill_from_waiting;
905 }
906
915 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
916 {
917 global $ilDB,$ilUser;
918
919 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
920
921 $this->cloneAutoGeneratedRoles($new_obj);
922 $this->cloneMetaData($new_obj);
923
924 // Assign admin
925 $new_obj->getMemberObject()->add($ilUser->getId(), IL_CRS_ADMIN);
926 // cognos-blu-patch: begin
927 $new_obj->getMemberObject()->updateContact($ilUser->getId(), 1);
928 // cognos-blu-patch: end
929
930
931 // #14596
932 $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
933 if ($cwo->isRootNode($this->getRefId())) {
934 $this->setOfflineStatus(true);
935 }
936
937 // Copy settings
938 $this->cloneSettings($new_obj);
939
940 // Course Defined Fields
941 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
942 ilCourseDefinedFieldDefinition::_clone($this->getId(), $new_obj->getId());
943
944 // Clone course files
945 include_once('Modules/Course/classes/class.ilCourseFile.php');
946 ilCourseFile::_cloneFiles($this->getId(), $new_obj->getId());
947
948 // Copy learning progress settings
949 include_once('Services/Tracking/classes/class.ilLPObjSettings.php');
950 $obj_settings = new ilLPObjSettings($this->getId());
951 $obj_settings->cloneSettings($new_obj->getId());
952 unset($obj_settings);
953
954 // clone certificate (#11085)
955 include_once "./Services/Certificate/classes/class.ilCertificate.php";
956 include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
957 $cert = new ilCertificate(new ilCourseCertificateAdapter($this));
958 $newcert = new ilCertificate(new ilCourseCertificateAdapter($new_obj));
959 $cert->cloneCertificate($newcert);
960
961 return $new_obj;
962 }
963
972 public function cloneDependencies($a_target_id, $a_copy_id)
973 {
974 parent::cloneDependencies($a_target_id, $a_copy_id);
975
976 // Clone course start objects
977 include_once('Services/Container/classes/class.ilContainerStartObjects.php');
978 $start = new ilContainerStartObjects($this->getRefId(), $this->getId());
979 $start->cloneDependencies($a_target_id, $a_copy_id);
980
981 // Clone course item settings
982 include_once('Services/Object/classes/class.ilObjectActivation.php');
983 ilObjectActivation::cloneDependencies($this->getRefId(), $a_target_id, $a_copy_id);
984
985 // clone objective settings
986 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
987 ilLOSettings::cloneSettings($a_copy_id, $this->getId(), ilObject::_lookupObjId($a_target_id));
988
989 // Clone course learning objectives
990 include_once('Modules/Course/classes/class.ilCourseObjective.php');
991 $crs_objective = new ilCourseObjective($this);
992 $crs_objective->ilClone($a_target_id, $a_copy_id);
993
994 return true;
995 }
996
1004 public function cloneAutoGeneratedRoles($new_obj)
1005 {
1007
1008 $admin = $this->getDefaultAdminRole();
1009 $new_admin = $new_obj->getDefaultAdminRole();
1010
1011 if (!$admin || !$new_admin || !$this->getRefId() || !$new_obj->getRefId()) {
1012 $ilLog->write(__METHOD__ . ' : Error cloning auto generated role: il_crs_admin');
1013 }
1014 $rbacadmin->copyRolePermissions($admin, $this->getRefId(), $new_obj->getRefId(), $new_admin, true);
1015 $ilLog->write(__METHOD__ . ' : Finished copying of role crs_admin.');
1016
1017 $tutor = $this->getDefaultTutorRole();
1018 $new_tutor = $new_obj->getDefaultTutorRole();
1019 if (!$tutor || !$new_tutor) {
1020 $ilLog->write(__METHOD__ . ' : Error cloning auto generated role: il_crs_tutor');
1021 }
1022 $rbacadmin->copyRolePermissions($tutor, $this->getRefId(), $new_obj->getRefId(), $new_tutor, true);
1023 $ilLog->write(__METHOD__ . ' : Finished copying of role crs_tutor.');
1024
1025 $member = $this->getDefaultMemberRole();
1026 $new_member = $new_obj->getDefaultMemberRole();
1027 if (!$member || !$new_member) {
1028 $ilLog->write(__METHOD__ . ' : Error cloning auto generated role: il_crs_member');
1029 }
1030 $rbacadmin->copyRolePermissions($member, $this->getRefId(), $new_obj->getRefId(), $new_member, true);
1031 $ilLog->write(__METHOD__ . ' : Finished copying of role crs_member.');
1032
1033 return true;
1034 }
1035
1036
1037 public function validate()
1038 {
1039 $this->setMessage('');
1040
1041 #if(($this->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) and
1042 # $this->getSubscriptionType() == )
1043 #{
1044 # $this->appendMessage($this->lng->txt('crs_select_registration_type'));
1045 #}
1046
1047 if (($this->getActivationType() == IL_CRS_ACTIVATION_LIMITED) and
1048 $this->getActivationEnd() < $this->getActivationStart()) {
1049 $this->appendMessage($this->lng->txt("activation_times_not_valid"));
1050 }
1052 $this->getSubscriptionStart() > $this->getSubscriptionEnd()) {
1053 $this->appendMessage($this->lng->txt("subscription_times_not_valid"));
1054 }
1055 #if((!$this->getActivationUnlimitedStatus() and
1056 # !$this->getSubscriptionUnlimitedStatus()) and
1057 # ($this->getSubscriptionStart() > $this->getActivationEnd() or
1058 # $this->getSubscriptionStart() < $this->getActivationStart() or
1059 # $this->getSubscriptionEnd() > $this->getActivationEnd() or
1060 # $this->getSubscriptionEnd() < $this->getActivationStart()))
1061 #
1062 #{
1063 # $this->appendMessage($this->lng->txt("subscription_time_not_within_activation"));
1064 #}
1066 $this->appendMessage($this->lng->txt("crs_password_required"));
1067 }
1068 if ($this->isSubscriptionMembershipLimited()) {
1069 if ($this->getSubscriptionMinMembers() <= 0 && $this->getSubscriptionMaxMembers() <= 0) {
1070 $this->appendMessage($this->lng->txt("crs_max_and_min_members_needed"));
1071 }
1072 if ($this->getSubscriptionMaxMembers() <= 0 && $this->enabledWaitingList()) {
1073 $this->appendMessage($this->lng->txt("crs_max_members_needed"));
1074 }
1075 if ($this->getSubscriptionMaxMembers() > 0 && $this->getSubscriptionMinMembers() > $this->getSubscriptionMaxMembers()) {
1076 $this->appendMessage($this->lng->txt("crs_max_and_min_members_invalid"));
1077 }
1078 }
1079 if (!$this->getTitle() || !$this->getStatusDetermination()) {
1080 $this->appendMessage($this->lng->txt('err_check_input'));
1081 }
1082
1083 // :TODO: checkInput() is not used properly
1084 if (($this->getCourseStart() && !$this->getCourseEnd()) ||
1085 (!$this->getCourseStart() && $this->getCourseEnd()) ||
1086 ($this->getCourseStart() && $this->getCourseEnd() && $this->getCourseStart()->get(IL_CAL_UNIX) > $this->getCourseEnd()->get(IL_CAL_UNIX))) {
1087 $this->appendMessage($this->lng->txt("crs_course_period_not_valid"));
1088 }
1089
1090 return $this->getMessage() ? false : true;
1091 }
1092
1093 public function validateInfoSettings()
1094 {
1095 global $ilErr;
1096 $error = false;
1097 if ($this->getContactEmail()) {
1098 $emails = explode(",", $this->getContactEmail());
1099
1100 foreach ($emails as $email) {
1101 $email = trim($email);
1103 $ilErr->appendMessage($this->lng->txt('contact_email_not_valid') . " '" . $email . "'");
1104 $error = true;
1105 }
1106 }
1107 }
1108 return !$error;
1109 }
1110
1111 public function hasContactData()
1112 {
1113 return strlen($this->getContactName()) or
1114 strlen($this->getContactResponsibility()) or
1115 strlen($this->getContactEmail()) or
1116 strlen($this->getContactPhone()) or
1117 strlen($this->getContactConsultation());
1118 }
1119
1120
1127 public function delete()
1128 {
1129 global $ilAppEventHandler;
1130
1131 // always call parent delete function first!!
1132 if (!parent::delete()) {
1133 return false;
1134 }
1135
1136 // delete meta data
1137 $this->deleteMetaData();
1138
1139 // put here course specific stuff
1140
1141 $this->__deleteSettings();
1142
1143 include_once('Modules/Course/classes/class.ilCourseParticipants.php');
1145
1146 include_once './Modules/Course/classes/class.ilCourseObjective.php';
1148
1149 include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
1151
1152 include_once './Modules/Course/classes/class.ilCourseFile.php';
1154
1155 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1157
1158 $ilAppEventHandler->raise(
1159 'Modules/Course',
1160 'delete',
1161 array('object' => $this,
1162 'obj_id' => $this->getId(),
1163 'appointments' => $this->prepareAppointments('delete'))
1164 );
1165
1166
1167 return true;
1168 }
1169
1170
1171
1175 public function update()
1176 {
1177 global $ilAppEventHandler,$ilLog;
1178
1179 include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
1180 $sorting = new ilContainerSortingSettings($this->getId());
1181 $sorting->setSortMode($this->getOrderType());
1182 $sorting->update();
1183
1184 $this->updateMetaData();
1185 $this->updateSettings();
1187
1188 $ilAppEventHandler->raise(
1189 'Modules/Course',
1190 'update',
1191 array('object' => $this,
1192 'obj_id' => $this->getId(),
1193 'appointments' => $this->prepareAppointments('update'))
1194 );
1195 }
1196
1197 public function updateSettings()
1198 {
1199 global $ilDB;
1200
1201 // Due to a bug 3.5.alpha maybe no settings exist. => create default settings
1202
1203 $query = "SELECT * FROM crs_settings WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
1204 $res = $ilDB->query($query);
1205
1206 if (!$res->numRows()) {
1207 $this->__createDefaultSettings();
1208 }
1209
1210 $query = "UPDATE crs_settings SET " .
1211 "syllabus = " . $ilDB->quote($this->getSyllabus(), 'text') . ", " .
1212 "contact_name = " . $ilDB->quote($this->getContactName(), 'text') . ", " .
1213 "contact_responsibility = " . $ilDB->quote($this->getContactResponsibility(), 'text') . ", " .
1214 "contact_phone = " . $ilDB->quote($this->getContactPhone(), 'text') . ", " .
1215 "contact_email = " . $ilDB->quote($this->getContactEmail(), 'text') . ", " .
1216 "contact_consultation = " . $ilDB->quote($this->getContactConsultation(), 'text') . ", " .
1217 "activation_type = " . $ilDB->quote(!$this->getOfflineStatus(), 'integer') . ", " .
1218 "sub_limitation_type = " . $ilDB->quote($this->getSubscriptionLimitationType(), 'integer') . ", " .
1219 "sub_start = " . $ilDB->quote($this->getSubscriptionStart(), 'integer') . ", " .
1220 "sub_end = " . $ilDB->quote($this->getSubscriptionEnd(), 'integer') . ", " .
1221 "sub_type = " . $ilDB->quote($this->getSubscriptionType(), 'integer') . ", " .
1222 "sub_password = " . $ilDB->quote($this->getSubscriptionPassword(), 'text') . ", " .
1223 "sub_mem_limit = " . $ilDB->quote((int) $this->isSubscriptionMembershipLimited(), 'integer') . ", " .
1224 "sub_max_members = " . $ilDB->quote($this->getSubscriptionMaxMembers(), 'integer') . ", " .
1225 "sub_notify = " . $ilDB->quote($this->getSubscriptionNotify(), 'integer') . ", " .
1226 "view_mode = " . $ilDB->quote($this->getViewMode(), 'integer') . ", " .
1227 "abo = " . $ilDB->quote($this->getAboStatus(), 'integer') . ", " .
1228 "waiting_list = " . $ilDB->quote($this->enabledWaitingList(), 'integer') . ", " .
1229 "important = " . $ilDB->quote($this->getImportantInformation(), 'text') . ", " .
1230 "show_members = " . $ilDB->quote($this->getShowMembers(), 'integer') . ", " .
1231 "show_members_export = " . $ilDB->quote($this->getShowMembersExport(), 'integer') . ", " .
1232 "latitude = " . $ilDB->quote($this->getLatitude(), 'text') . ", " .
1233 "longitude = " . $ilDB->quote($this->getLongitude(), 'text') . ", " .
1234 "location_zoom = " . $ilDB->quote($this->getLocationZoom(), 'integer') . ", " .
1235 "enable_course_map = " . $ilDB->quote((int) $this->getEnableCourseMap(), 'integer') . ", " .
1236 'session_limit = ' . $ilDB->quote($this->isSessionLimitEnabled(), 'integer') . ', ' .
1237 'session_prev = ' . $ilDB->quote($this->getNumberOfPreviousSessions(), 'integer') . ', ' .
1238 'session_next = ' . $ilDB->quote($this->getNumberOfNextSessions(), 'integer') . ', ' .
1239 'reg_ac_enabled = ' . $ilDB->quote($this->isRegistrationAccessCodeEnabled(), 'integer') . ', ' .
1240 'reg_ac = ' . $ilDB->quote($this->getRegistrationAccessCode(), 'text') . ', ' .
1241 'auto_notification = ' . $ilDB->quote((int) $this->getAutoNotification(), 'integer') . ', ' .
1242 'status_dt = ' . $ilDB->quote((int) $this->getStatusDetermination()) . ', ' .
1243 'mail_members_type = ' . $ilDB->quote((int) $this->getMailToMembersType(), 'integer') . ', ' .
1244 'crs_start = ' . $ilDB->quote(($this->getCourseStart() && !$this->getCourseStart()->isNull()) ? $this->getCourseStart()->get(IL_CAL_UNIX) : null, 'integer') . ', ' .
1245 'crs_end = ' . $ilDB->quote(($this->getCourseEnd() && !$this->getCourseEnd()->isNull()) ? $this->getCourseEnd()->get(IL_CAL_UNIX) : null, 'integer') . ', ' .
1246 'auto_wait = ' . $ilDB->quote((int) $this->hasWaitingListAutoFill(), 'integer') . ', ' .
1247 'leave_end = ' . $ilDB->quote(($this->getCancellationEnd() && !$this->getCancellationEnd()->isNull()) ? $this->getCancellationEnd()->get(IL_CAL_UNIX) : null, 'integer') . ', ' .
1248 'min_members = ' . $ilDB->quote((int) $this->getSubscriptionMinMembers(), 'integer') . ' ' .
1249 "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . "";
1250
1251 $res = $ilDB->manipulate($query);
1252
1253 // moved activation to ilObjectActivation
1254 if ($this->ref_id) {
1255 include_once "./Services/Object/classes/class.ilObjectActivation.php";
1256 ilObjectActivation::getItem($this->ref_id);
1257
1258 $item = new ilObjectActivation;
1259 if ($this->getActivationUnlimitedStatus()) {
1261 } else {
1262 $item->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
1263 $item->setTimingStart($this->getActivationStart());
1264 $item->setTimingEnd($this->getActivationEnd());
1265 $item->toggleVisible($this->getActivationVisibility());
1266 }
1267
1268 $item->update($this->ref_id);
1269 }
1270 }
1271
1279 public function cloneSettings($new_obj)
1280 {
1281 $new_obj->setSyllabus($this->getSyllabus());
1282 $new_obj->setContactName($this->getContactName());
1283 $new_obj->setContactResponsibility($this->getContactResponsibility());
1284 $new_obj->setContactPhone($this->getContactPhone());
1285 $new_obj->setContactEmail($this->getContactEmail());
1286 $new_obj->setContactConsultation($this->getContactConsultation());
1287 $new_obj->setOfflineStatus($this->getOfflineStatus()); // #9914
1288 $new_obj->setActivationType($this->getActivationType());
1289 $new_obj->setActivationStart($this->getActivationStart());
1290 $new_obj->setActivationEnd($this->getActivationEnd());
1291 $new_obj->setActivationVisibility($this->getActivationVisibility());
1292 $new_obj->setSubscriptionLimitationType($this->getSubscriptionLimitationType());
1293 $new_obj->setSubscriptionStart($this->getSubscriptionStart());
1294 $new_obj->setSubscriptionEnd($this->getSubscriptionEnd());
1295 $new_obj->setSubscriptionType($this->getSubscriptionType());
1296 $new_obj->setSubscriptionPassword($this->getSubscriptionPassword());
1297 $new_obj->enableSubscriptionMembershipLimitation($this->isSubscriptionMembershipLimited());
1298 $new_obj->setSubscriptionMaxMembers($this->getSubscriptionMaxMembers());
1299 $new_obj->setSubscriptionNotify($this->getSubscriptionNotify());
1300 $new_obj->setViewMode($this->getViewMode());
1301 $new_obj->setOrderType($this->getOrderType());
1302 $new_obj->setAboStatus($this->getAboStatus());
1303 $new_obj->enableWaitingList($this->enabledWaitingList());
1304 $new_obj->setImportantInformation($this->getImportantInformation());
1305 $new_obj->setShowMembers($this->getShowMembers());
1306 // patch mem_exp
1307 $new_obj->setShowMembersExport($this->getShowMembersExport());
1308 // patch mem_exp
1309 $new_obj->enableSessionLimit($this->isSessionLimitEnabled());
1310 $new_obj->setNumberOfPreviousSessions($this->getNumberOfPreviousSessions());
1311 $new_obj->setNumberOfNextSessions($this->getNumberOfNextSessions());
1312 $new_obj->setAutoNotification($this->getAutoNotification());
1313 $new_obj->enableRegistrationAccessCode($this->isRegistrationAccessCodeEnabled());
1314 include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1315 $new_obj->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1316 $new_obj->setStatusDetermination($this->getStatusDetermination());
1317 $new_obj->setMailToMembersType($this->getMailToMembersType());
1318 $new_obj->setCourseStart($this->getCourseStart());
1319 $new_obj->setCourseEnd($this->getCourseEnd());
1320 $new_obj->setCancellationEnd($this->getCancellationEnd());
1321 $new_obj->setWaitingListAutoFill($this->hasWaitingListAutoFill());
1322 $new_obj->setSubscriptionMinMembers($this->getSubscriptionMinMembers());
1323
1324 // #10271
1325 $new_obj->setEnableCourseMap($this->getEnableCourseMap());
1326 $new_obj->setLatitude($this->getLatitude());
1327 $new_obj->setLongitude($this->getLongitude());
1328 $new_obj->setLocationZoom($this->getLocationZoom());
1329
1330 $new_obj->update();
1331 }
1332
1333 public function __createDefaultSettings()
1334 {
1335 global $ilDB;
1336
1337 include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1339
1340 $query = "INSERT INTO crs_settings (obj_id,syllabus,contact_name,contact_responsibility," .
1341 "contact_phone,contact_email,contact_consultation,activation_type,activation_start," .
1342 "activation_end,sub_limitation_type,sub_start,sub_end,sub_type,sub_password,sub_mem_limit," .
1343 "sub_max_members,sub_notify,view_mode,abo," .
1344 "latitude,longitude,location_zoom,enable_course_map,waiting_list,show_members,show_members_export, " .
1345 "session_limit,session_prev,session_next, reg_ac_enabled, reg_ac, auto_notification, status_dt,mail_members_type) " .
1346 "VALUES( " .
1347 $ilDB->quote($this->getId(), 'integer') . ", " .
1348 $ilDB->quote($this->getSyllabus(), 'text') . ", " .
1349 $ilDB->quote($this->getContactName(), 'text') . ", " .
1350 $ilDB->quote($this->getContactResponsibility(), 'text') . ", " .
1351 $ilDB->quote($this->getContactPhone(), 'text') . ", " .
1352 $ilDB->quote($this->getContactEmail(), 'text') . ", " .
1353 $ilDB->quote($this->getContactConsultation(), 'text') . ", " .
1354 $ilDB->quote(0, 'integer') . ", " .
1355 $ilDB->quote($this->getActivationStart(), 'integer') . ", " .
1356 $ilDB->quote($this->getActivationEnd(), 'integer') . ", " .
1357 $ilDB->quote(IL_CRS_SUBSCRIPTION_DEACTIVATED, 'integer') . ", " .
1358 $ilDB->quote($this->getSubscriptionStart(), 'integer') . ", " .
1359 $ilDB->quote($this->getSubscriptionEnd(), 'integer') . ", " .
1360 $ilDB->quote(IL_CRS_SUBSCRIPTION_DIRECT, 'integer') . ", " .
1361 $ilDB->quote($this->getSubscriptionPassword(), 'text') . ", " .
1362 "0, " .
1363 $ilDB->quote($this->getSubscriptionMaxMembers(), 'integer') . ", " .
1364 "1, " .
1365 "0, " .
1366 $ilDB->quote($this->ABO_ENABLED, 'integer') . ", " .
1367 $ilDB->quote($this->getLatitude(), 'text') . ", " .
1368 $ilDB->quote($this->getLongitude(), 'text') . ", " .
1369 $ilDB->quote($this->getLocationZoom(), 'integer') . ", " .
1370 $ilDB->quote($this->getEnableCourseMap(), 'integer') . ", " .
1371 #"objective_view = '0', ".
1372 "1, " .
1373 "1," .
1374 '0,' .
1375 $ilDB->quote($this->isSessionLimitEnabled(), 'integer') . ', ' .
1376 $ilDB->quote($this->getNumberOfPreviousSessions(), 'integer') . ', ' .
1377 $ilDB->quote($this->getNumberOfPreviousSessions(), 'integer') . ', ' .
1378 $ilDB->quote($this->isRegistrationAccessCodeEnabled(), 'integer') . ', ' .
1379 $ilDB->quote($this->getRegistrationAccessCode(), 'text') . ', ' .
1380 $ilDB->quote((int) $this->getAutoNotification(), 'integer') . ', ' .
1381 $ilDB->quote((int) $this->getStatusDetermination(), 'integer') . ', ' .
1382 $ilDB->quote((int) $this->getMailToMembersType(), 'integer') . ' ' .
1383 ")";
1384
1385 $res = $ilDB->manipulate($query);
1386 $this->__readSettings();
1387
1388 include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
1389 $sorting = new ilContainerSortingSettings($this->getId());
1390 $sorting->setSortMode(ilContainer::SORT_MANUAL);
1391 $sorting->update();
1392 }
1393
1394
1395 public function __readSettings()
1396 {
1397 global $ilDB;
1398
1399 $query = "SELECT * FROM crs_settings WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . "";
1400
1401 $res = $ilDB->query($query);
1402 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1403 $this->setSyllabus($row->syllabus);
1404 $this->setContactName($row->contact_name);
1405 $this->setContactResponsibility($row->contact_responsibility);
1406 $this->setContactPhone($row->contact_phone);
1407 $this->setContactEmail($row->contact_email);
1408 $this->setContactConsultation($row->contact_consultation);
1409 $this->setOfflineStatus(!(bool) $row->activation_type); // see below
1410 $this->setSubscriptionLimitationType($row->sub_limitation_type);
1411 $this->setSubscriptionStart($row->sub_start);
1412 $this->setSubscriptionEnd($row->sub_end);
1413 $this->setSubscriptionType($row->sub_type);
1414 $this->setSubscriptionPassword($row->sub_password);
1415 $this->enableSubscriptionMembershipLimitation($row->sub_mem_limit);
1416 $this->setSubscriptionMaxMembers($row->sub_max_members);
1417 $this->setSubscriptionNotify($row->sub_notify);
1418 $this->setViewMode($row->view_mode);
1419 $this->setAboStatus($row->abo);
1420 $this->enableWaitingList($row->waiting_list);
1421 $this->setImportantInformation($row->important);
1422 $this->setShowMembers($row->show_members);
1423 $this->setShowMembersExport($row->show_members_export);
1424 $this->setLatitude($row->latitude);
1425 $this->setLongitude($row->longitude);
1426 $this->setLocationZoom($row->location_zoom);
1427 $this->setEnableCourseMap($row->enable_course_map);
1428 $this->enableSessionLimit($row->session_limit);
1429 $this->setNumberOfPreviousSessions($row->session_prev);
1430 $this->setNumberOfNextSessions($row->session_next);
1431 $this->enableRegistrationAccessCode($row->reg_ac_enabled);
1432 $this->setRegistrationAccessCode($row->reg_ac);
1433 $this->setAutoNotification($row->auto_notification == 1 ? true : false);
1434 $this->setStatusDetermination((int) $row->status_dt);
1435 $this->setMailToMembersType($row->mail_members_type);
1436 $this->setCourseStart($row->crs_start ? new ilDate($row->crs_start, IL_CAL_UNIX) : null);
1437 $this->setCourseEnd($row->crs_end ? new ilDate($row->crs_end, IL_CAL_UNIX) : null);
1438 $this->setCancellationEnd($row->leave_end ? new ilDate($row->leave_end, IL_CAL_UNIX) : null);
1439 $this->setWaitingListAutoFill($row->auto_wait);
1440 $this->setSubscriptionMinMembers($row->min_members ? $row->min_members : null);
1441 }
1442
1443 // moved activation to ilObjectActivation
1444 if ($this->ref_id) {
1445 include_once "./Services/Object/classes/class.ilObjectActivation.php";
1446 $activation = ilObjectActivation::getItem($this->ref_id);
1447 switch ($activation["timing_type"]) {
1450 $this->setActivationStart($activation["timing_start"]);
1451 $this->setActivationEnd($activation["timing_end"]);
1452 $this->setActivationVisibility($activation["visible"]);
1453 break;
1454
1455 default:
1457 break;
1458 }
1459 } else {
1460 // #13176 - there should always be default
1462 }
1463
1464 return true;
1465 }
1466
1467 public function initWaitingList()
1468 {
1469 include_once "./Modules/Course/classes/class.ilCourseWaitingList.php";
1470
1471 if (!is_object($this->waiting_list_obj)) {
1472 $this->waiting_list_obj = new ilCourseWaitingList($this->getId());
1473 }
1474 return true;
1475 }
1476
1477
1483 protected function initCourseMemberObject()
1484 {
1485 global $ilUser;
1486
1487 include_once "./Modules/Course/classes/class.ilCourseParticipant.php";
1488 $this->member_obj = ilCourseParticipant::_getInstanceByObjId($this->getId(), $ilUser->getId());
1489 return true;
1490 }
1491
1497 protected function initCourseMembersObject()
1498 {
1499 global $ilUser;
1500
1501 include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
1502 $this->members_obj = ilCourseParticipants::_getInstanceByObjId($this->getId());
1503 return true;
1504 }
1505
1510 public function getMemberObject()
1511 {
1512 if (!$this->member_obj instanceof ilCourseParticipant) {
1513 $this->initCourseMemberObject();
1514 }
1515 return $this->member_obj;
1516 }
1517
1521 public function getMembersObject()
1522 {
1523 if (!$this->members_obj instanceof ilCourseParticipants) {
1524 $this->initCourseMembersObject();
1525 }
1526 return $this->members_obj;
1527 }
1528
1529
1530
1531 // RBAC METHODS
1532 public function initDefaultRoles()
1533 {
1535
1536 include_once './Services/AccessControl/classes/class.ilObjRole.php';
1538 'il_crs_admin_' . $this->getRefId(),
1539 "Admin of crs obj_no." . $this->getId(),
1540 'il_crs_admin',
1541 $this->getRefId()
1542 );
1544 'il_crs_tutor_' . $this->getRefId(),
1545 "Tutor of crs obj_no." . $this->getId(),
1546 'il_crs_tutor',
1547 $this->getRefId()
1548 );
1550 'il_crs_member_' . $this->getRefId(),
1551 "Member of crs obj_no." . $this->getId(),
1552 'il_crs_member',
1553 $this->getRefId()
1554 );
1555
1556 return array();
1557 }
1558
1568 public function setParentRolePermissions($a_parent_ref)
1569 {
1570 global $rbacadmin, $rbacreview;
1571
1572 $parent_roles = $rbacreview->getParentRoleIds($a_parent_ref);
1573 foreach ((array) $parent_roles as $parent_role) {
1574 $rbacadmin->initIntersectionPermissions(
1575 $this->getRefId(),
1576 $parent_role['obj_id'],
1577 $parent_role['parent'],
1579 ROLE_FOLDER_ID
1580 );
1581 }
1582 }
1583
1591 {
1592 global $ilDB;
1593
1594 $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_crs_non_member'";
1595 $res = $this->ilias->db->query($q);
1597
1598 return $row["obj_id"];
1599 }
1600
1605 public static function lookupCourseNonMemberTemplatesId()
1606 {
1607 global $ilDB;
1608
1609 $query = 'SELECT obj_id FROM object_data WHERE type = ' . $ilDB->quote('rolt', 'text') . ' AND title = ' . $ilDB->quote('il_crs_non_member', 'text');
1610 $res = $ilDB->query($query);
1612
1613 return isset($row['obj_id']) ? $row['obj_id'] : 0;
1614 }
1615
1622 public function getLocalCourseRoles($a_translate = false)
1623 {
1624 global $rbacadmin,$rbacreview;
1625
1626 if (empty($this->local_roles)) {
1627 $this->local_roles = array();
1628 $role_arr = $rbacreview->getRolesOfRoleFolder($this->getRefId());
1629
1630 foreach ($role_arr as $role_id) {
1631 if ($rbacreview->isAssignable($role_id, $this->getRefId()) == true) {
1632 $role_Obj = $this->ilias->obj_factory->getInstanceByObjId($role_id);
1633
1634 if ($a_translate) {
1635 $role_name = ilObjRole::_getTranslation($role_Obj->getTitle());
1636 } else {
1637 $role_name = $role_Obj->getTitle();
1638 }
1639 $this->local_roles[$role_name] = $role_Obj->getId();
1640 }
1641 }
1642 }
1643
1644 return $this->local_roles;
1645 }
1646
1647
1648
1658 public function getDefaultCourseRoles($a_crs_id = "")
1659 {
1660 global $rbacadmin, $rbacreview;
1661
1662 if (strlen($a_crs_id) > 0) {
1663 $crs_id = $a_crs_id;
1664 } else {
1665 $crs_id = $this->getRefId();
1666 }
1667
1668 $role_arr = $rbacreview->getRolesOfRoleFolder($crs_id);
1669
1670 foreach ($role_arr as $role_id) {
1671 $role_Obj =&$this->ilias->obj_factory->getInstanceByObjId($role_id);
1672
1673 $crs_Member ="il_crs_member_" . $crs_id;
1674 $crs_Admin ="il_crs_admin_" . $crs_id;
1675 $crs_Tutor ="il_crs_tutor_" . $crs_id;
1676
1677 if (strcmp($role_Obj->getTitle(), $crs_Member) == 0) {
1678 $arr_crsDefaultRoles["crs_member_role"] = $role_Obj->getId();
1679 }
1680
1681 if (strcmp($role_Obj->getTitle(), $crs_Admin) == 0) {
1682 $arr_crsDefaultRoles["crs_admin_role"] = $role_Obj->getId();
1683 }
1684
1685 if (strcmp($role_Obj->getTitle(), $crs_Tutor) == 0) {
1686 $arr_crsDefaultRoles["crs_tutor_role"] = $role_Obj->getId();
1687 }
1688 }
1689
1690 return $arr_crsDefaultRoles;
1691 }
1692
1693 public function __getLocalRoles()
1694 {
1695 global $rbacreview;
1696
1697 // GET role_objects of predefined roles
1698
1699 return $rbacreview->getRolesOfRoleFolder($this->getRefId(), false);
1700 }
1701
1702 public function __deleteSettings()
1703 {
1704 global $ilDB;
1705
1706 $query = "DELETE FROM crs_settings " .
1707 "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
1708 $res = $ilDB->manipulate($query);
1709
1710 return true;
1711 }
1712
1713
1714 public function getDefaultMemberRole()
1715 {
1716 $local_roles = $this->__getLocalRoles();
1717
1718 foreach ($local_roles as $role_id) {
1719 $title = ilObject::_lookupTitle($role_id);
1720 if (substr($title, 0, 8) == 'il_crs_m') {
1721 return $role_id;
1722 }
1723 }
1724 return 0;
1725 }
1726 public function getDefaultTutorRole()
1727 {
1728 $local_roles = $this->__getLocalRoles();
1729
1730 foreach ($local_roles as $role_id) {
1731 if ($tmp_role =&ilObjectFactory::getInstanceByObjId($role_id, false)) {
1732 if (!strcmp($tmp_role->getTitle(), "il_crs_tutor_" . $this->getRefId())) {
1733 return $role_id;
1734 }
1735 }
1736 }
1737 return false;
1738 }
1739 public function getDefaultAdminRole()
1740 {
1741 $local_roles = $this->__getLocalRoles();
1742
1743 foreach ($local_roles as $role_id) {
1744 if ($tmp_role =&ilObjectFactory::getInstanceByObjId($role_id, false)) {
1745 if (!strcmp($tmp_role->getTitle(), "il_crs_admin_" . $this->getRefId())) {
1746 return $role_id;
1747 }
1748 }
1749 }
1750 return false;
1751 }
1752
1753 public static function _deleteUser($a_usr_id)
1754 {
1755 // Delete all user related data
1756 // delete lm_history
1757 include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
1759
1760 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
1762
1763 // Course objectives
1764 include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
1766 }
1767
1774 public function MDUpdateListener($a_element)
1775 {
1776 global $ilLog;
1777
1778 parent::MDUpdateListener($a_element);
1779
1780 switch ($a_element) {
1781 case 'General':
1782 // Update ecs content
1783 include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
1784 $ecs = new ilECSCourseSettings($this);
1785 $ecs->handleContentUpdate();
1786 break;
1787
1788 default:
1789 return true;
1790 }
1791 }
1792
1797 public function addAdditionalSubItemInformation(&$a_item_data)
1798 {
1799 include_once './Services/Object/classes/class.ilObjectActivation.php';
1801 }
1802
1810 protected function prepareAppointments($a_mode = 'create')
1811 {
1812 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php');
1813 include_once('./Services/Calendar/classes/class.ilDateTime.php');
1814
1815 switch ($a_mode) {
1816 case 'create':
1817 case 'update':
1818 if (!$this->getActivationUnlimitedStatus() and !$this->getOfflineStatus()) {
1819 $app = new ilCalendarAppointmentTemplate(self::CAL_ACTIVATION_START);
1820 $app->setTitle($this->getTitle());
1821 $app->setSubtitle('crs_cal_activation_start');
1822 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1823 $app->setDescription($this->getLongDescription());
1824 $app->setStart(new ilDateTime($this->getActivationStart(), IL_CAL_UNIX));
1825 $apps[] = $app;
1826
1827 $app = new ilCalendarAppointmentTemplate(self::CAL_ACTIVATION_END);
1828 $app->setTitle($this->getTitle());
1829 $app->setSubtitle('crs_cal_activation_end');
1830 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1831 $app->setDescription($this->getLongDescription());
1832 $app->setStart(new ilDateTime($this->getActivationEnd(), IL_CAL_UNIX));
1833 $apps[] = $app;
1834 }
1836 $app = new ilCalendarAppointmentTemplate(self::CAL_REG_START);
1837 $app->setTitle($this->getTitle());
1838 $app->setSubtitle('crs_cal_reg_start');
1839 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1840 $app->setDescription($this->getLongDescription());
1841 $app->setStart(new ilDateTime($this->getSubscriptionStart(), IL_CAL_UNIX));
1842 $apps[] = $app;
1843
1844 $app = new ilCalendarAppointmentTemplate(self::CAL_REG_END);
1845 $app->setTitle($this->getTitle());
1846 $app->setSubtitle('crs_cal_reg_end');
1847 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1848 $app->setDescription($this->getLongDescription());
1849 $app->setStart(new ilDateTime($this->getSubscriptionEnd(), IL_CAL_UNIX));
1850 $apps[] = $app;
1851 }
1852 if ($this->getCourseStart() && $this->getCourseEnd()) {
1853 $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_START);
1854 $app->setTitle($this->getTitle());
1855 $app->setSubtitle('crs_cal_start');
1856 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1857 $app->setDescription($this->getLongDescription());
1858 $app->setStart($this->getCourseStart());
1859 $app->setFullday(true);
1860 $apps[] = $app;
1861
1862 $app = new ilCalendarAppointmentTemplate(self::CAL_COURSE_END);
1863 $app->setTitle($this->getTitle());
1864 $app->setSubtitle('crs_cal_end');
1865 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1866 $app->setDescription($this->getLongDescription());
1867 $app->setStart($this->getCourseEnd());
1868 $app->setFullday(true);
1869 $apps[] = $app;
1870 }
1871
1872
1873 return $apps ? $apps : array();
1874
1875 case 'delete':
1876 // Nothing to do: The category and all assigned appointments will be deleted.
1877 return array();
1878 }
1879 }
1880
1881 ###### Interface ilMembershipRegistrationCodes
1886 public static function lookupObjectsByCode($a_code)
1887 {
1888 global $ilDB;
1889
1890 $query = "SELECT obj_id FROM crs_settings " .
1891 "WHERE reg_ac_enabled = " . $ilDB->quote(1, 'integer') . " " .
1892 "AND reg_ac = " . $ilDB->quote($a_code, 'text');
1893 $res = $ilDB->query($query);
1894
1895 $obj_ids = array();
1896 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1897 $obj_ids[] = $row->obj_id;
1898 }
1899 return $obj_ids;
1900 }
1901
1909 public function register($a_user_id, $a_role = ilCourseConstants::CRS_MEMBER, $a_force_registration = false)
1910 {
1911 global $ilCtrl, $tree;
1912 include_once './Services/Membership/exceptions/class.ilMembershipRegistrationException.php';
1913 include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
1915
1916 if ($part->isAssigned($a_user_id)) {
1917 return true;
1918 }
1919
1920 if (!$a_force_registration) {
1921 // offline
1922 if (!ilObjCourseAccess::_isOnline($this->getId())) {
1924 "Can't register to course, course is offline.",
1926 );
1927 }
1928
1929 // activation
1930 if (!ilObjCourseAccess::_isActivated($this->getId())) {
1932 "Can't register to course, course is not activated.",
1934 );
1935 }
1936
1939 throw new ilMembershipRegistrationException('Cant registrate to course ' . $this->getId() .
1940 ', course subscription is deactivated.', ilMembershipRegistrationException::REGISTRATION_CODE_DISABLED);
1941 }
1942 }
1943
1944 // Time Limitation
1946 if (!$this->inSubscriptionTime()) {
1947 throw new ilMembershipRegistrationException('Cant registrate to course ' . $this->getId() .
1948 ', course is out of registration time.', ilMembershipRegistrationException::OUT_OF_REGISTRATION_PERIOD);
1949 }
1950 }
1951
1952 // Max members
1953 if ($this->isSubscriptionMembershipLimited()) {
1954 $free = max(0, $this->getSubscriptionMaxMembers() - $part->getCountMembers());
1955 include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
1956 $waiting_list = new ilCourseWaitingList($this->getId());
1957 if ($this->enabledWaitingList() and (!$free or $waiting_list->getCountUsers())) {
1958 $waiting_list->addToList($a_user_id);
1959 $this->lng->loadLanguageModule("crs");
1960 $info = sprintf(
1961 $this->lng->txt('crs_added_to_list'),
1962 $waiting_list->getPosition($a_user_id)
1963 );
1964 include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
1965 $participants = ilCourseParticipants::_getInstanceByObjId($this->getId());
1966 $participants->sendNotification($participants->NOTIFY_WAITING_LIST, $a_user_id);
1967
1969 }
1970
1971 if (!$this->enabledWaitingList() && !$free) {
1972 throw new ilMembershipRegistrationException('Cant registrate to course ' . $this->getId() .
1973 ', membership is limited.', ilMembershipRegistrationException::OBJECT_IS_FULL);
1974 }
1975 }
1976 }
1977
1978 $part->add($a_user_id, $a_role);
1979 $part->sendNotification($part->NOTIFY_ACCEPT_USER, $a_user_id);
1980 $part->sendNotification($part->NOTIFY_ADMINS, $a_user_id);
1981
1982
1983 include_once './Modules/Forum/classes/class.ilForumNotification.php';
1985
1986 return true;
1987 }
1988
1995 public function getAutoNotification()
1996 {
1998 }
1999
2000
2007 public function setAutoNotification($value)
2008 {
2009 $this->auto_notification = $value;
2010 }
2011
2017 public function setStatusDetermination($a_value)
2018 {
2019 $a_value = (int) $a_value;
2020
2021 // #13905
2022 if ($a_value == self::STATUS_DETERMINATION_LP) {
2023 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
2026 }
2027 }
2028
2029 $this->status_dt = $a_value;
2030 }
2031
2037 public function getStatusDetermination()
2038 {
2039 return $this->status_dt;
2040 }
2041
2045 public function syncMembersStatusWithLP()
2046 {
2047 include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
2048 foreach ($this->getMembersObject()->getParticipants() as $user_id) {
2049 // #15529 - force raise on sync
2050 ilLPStatusWrapper::_updateStatus($this->getId(), $user_id, null, false, true);
2051 }
2052 }
2053
2061 public function checkLPStatusSync($a_member_id)
2062 {
2063 // #11113
2064 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
2067 include_once("Services/Tracking/classes/class.ilLPStatus.php");
2068 // #13811 - we need to suppress creation if status entry
2069 $has_completed = (ilLPStatus::_lookupStatus($this->getId(), $a_member_id, false) == ilLPStatus::LP_STATUS_COMPLETED_NUM);
2070 $this->getMembersObject()->updatePassed($a_member_id, $has_completed, false, true);
2071 }
2072 }
2073
2074 public function getOrderType()
2075 {
2076 if ($this->enabledObjectiveView()) {
2078 }
2079 return parent::getOrderType();
2080 }
2081
2085 public function handleAutoFill()
2086 {
2087 if (
2088 !$this->enabledWaitingList() or
2089 !$this->hasWaitingListAutoFill()
2090 ) {
2091 $this->course_logger->debug('Waiting list or auto fill disabled.');
2092 return;
2093 }
2094
2095 $max = $this->getSubscriptionMaxMembers();
2097
2098 $this->course_logger->debug('Max members: ' . $max);
2099 $this->course_logger->debug('Current members: ' . $now);
2100
2101 if ($max <= $now) {
2102 return;
2103 }
2104
2105 // see assignFromWaitingListObject()
2106 include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
2107 $waiting_list = new ilCourseWaitingList($this->getId());
2108
2109 foreach ($waiting_list->getUserIds() as $user_id) {
2110 if (!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id, false)) {
2111 $this->course_logger->warning('Cannot create user instance for id: ' . $user_id);
2112 continue;
2113 }
2114 if ($this->getMembersObject()->isAssigned($user_id)) {
2115 $this->course_logger->warning('User is already assigned to course. uid: ' . $user_id . ' course_id: ' . $this->getRefId());
2116 continue;
2117 }
2118 $this->getMembersObject()->add($user_id, IL_CRS_MEMBER);
2119 $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_USER, $user_id, true);
2120 $waiting_list->removeFromList($user_id);
2121 $this->checkLPStatusSync($user_id);
2122
2123 $this->course_logger->info('Assigned user from waiting list to course: ' . $this->getTitle());
2124 $now++;
2125 if ($now >= $max) {
2126 break;
2127 }
2128 }
2129 }
2130
2131 public static function mayLeave($a_course_id, $a_user_id = null, &$a_date = null)
2132 {
2133 global $ilUser, $ilDB;
2134
2135 if (!$a_user_id) {
2136 $a_user_id = $ilUser->getId();
2137 }
2138
2139 $set = $ilDB->query("SELECT leave_end" .
2140 " FROM crs_settings" .
2141 " WHERE obj_id = " . $ilDB->quote($a_course_id, "integer"));
2142 $row = $ilDB->fetchAssoc($set);
2143 if ($row && $row["leave_end"]) {
2144 // timestamp to date
2145 $limit = date("Ymd", $row["leave_end"]);
2146 if ($limit < date("Ymd")) {
2147 $a_date = new ilDate(date("Y-m-d", $row["leave_end"]), IL_CAL_DATE);
2148 return false;
2149 }
2150 }
2151 return true;
2152 }
2153
2159 public static function findCoursesWithNotEnoughMembers()
2160 {
2161 $ilDB = $GLOBALS['DIC']->database();
2162 $tree = $GLOBALS['DIC']->repositoryTree();
2163
2164 $res = array();
2165
2166 $now = time();
2167
2168 include_once "Modules/Course/classes/class.ilCourseParticipants.php";
2169
2170 $set = $ilDB->query("SELECT obj_id, min_members" .
2171 " FROM crs_settings" .
2172 " WHERE min_members > " . $ilDB->quote(0, "integer") .
2173 " AND sub_mem_limit = " . $ilDB->quote(1, "integer") . // #17206
2174 " AND ((leave_end IS NOT NULL" .
2175 " AND leave_end < " . $ilDB->quote($now, "text") . ")" .
2176 " OR (leave_end IS NULL" .
2177 " AND sub_end IS NOT NULL" .
2178 " AND sub_end < " . $ilDB->quote($now, "text") . "))" .
2179 " AND (crs_start IS NULL OR crs_start > " . $ilDB->quote($now, "integer") . ")");
2180 while ($row = $ilDB->fetchAssoc($set)) {
2181 $refs = ilObject::_getAllReferences($row['obj_id']);
2182 $ref = end($refs);
2183
2184 if ($tree->isDeleted($ref)) {
2185 continue;
2186 }
2187
2188 $part = new ilCourseParticipants($row["obj_id"]);
2189 $reci = $part->getNotificationRecipients();
2190 if (sizeof($reci)) {
2191 $missing = (int) $row["min_members"]-$part->getCountMembers();
2192 if ($missing > 0) {
2193 $res[$row["obj_id"]] = array($missing, $reci);
2194 }
2195 }
2196 }
2197
2198 return $res;
2199 }
2200} //END class.ilObjCourse
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_TRANSLATION_SYSTEM
const IL_CRS_SUBSCRIPTION_LIMITED
const IL_CRS_ACTIVATION_OFFLINE
const IL_CRS_ACTIVATION_UNLIMITED
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_ACTIVATION_LIMITED
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_SUBSCRIPTION_DIRECT
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_DAY
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_CRS_MEMBER
Apointment templates are used for automatic generated apointments.
Create PDF certificates.
static _lookupSortMode($a_obj_id)
lookup sort mode
static _getInstance($a_obj_id)
get instance by obj_id
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
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _within(ilDateTime $dt, ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check whether an date is within a date duration given by start and end.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
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 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 _isOnline($a_obj_id)
Check if online setting is active.
static _deleteAll($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_...
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.
getMailToMembersType()
Get mail to members type.
setParentRolePermissions($a_parent_ref)
This method is called before "initDefaultRoles".
const STATUS_DETERMINATION_MANUAL
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
setActivationStart($a_value)
setStatusDetermination($a_value)
Set status determination mode.
setSubscriptionNotify($a_value)
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...
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)
setCourseEnd(ilDate $a_value=null)
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)
getSubItems($a_admin_panel_enabled=false, $a_include_side_block=false, $a_get_single=0)
Get subitems of container.
static mayLeave($a_course_id, $a_user_id=null, &$a_date=null)
setCourseStart(ilDate $a_value=null)
static _isActivated($a_obj_id)
Is activated.
setContactEmail($a_value)
setOfflineStatus($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.
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)
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)
setShowMembers($a_status)
setMailToMembersType($a_type)
Set mail to members type.
setSubscriptionPassword($a_value)
setSubscriptionStart($a_value)
setImportantInformation($a_info)
const CAL_ACTIVATION_START
getOrderType()
Get order type default implementation.
setNumberOfPreviousSessions($a_num)
Set number of previous sessions.
cloneAutoGeneratedRoles($new_obj)
Clone automatic genrated roles (permissions and template permissions)
appendMessage($a_message)
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.
setViewMode($a_mode)
cloneSettings($new_obj)
Clone entries in settings table.
setArchiveStart($a_value)
setEnableCourseMap($a_enablemap)
Set Enable Course Map.
const CAL_ACTIVATION_END
setSubscriptionLimitationType($a_type)
setActivationType($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 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)
static _lookupTitle($a_id)
lookup object title
deleteMetaData()
delete meta data entry
updateMetaData()
update meta data entry
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 sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
$key
Definition: croninfo.php:18
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
Interface for all objects that offer registration with access codes.
if( $orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:193
$end
Definition: saml1-acs.php:18
catch(Exception $e) $message
$info
Definition: index.php:5
update($pash, $contents, Config $config)
redirection script todo: (a better solution should control the processing via a xml file)
$query
global $ilErr
Definition: raiseError.php:16
foreach($_POST as $key=> $value) $res
global $ilDB
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92