93 public function __construct(
int $a_id = 0,
bool $a_call_by_reference =
true)
100 $this->course_logger =
$DIC->logger()->crs();
106 $query =
'SELECT show_members FROM crs_settings ' .
107 'WHERE obj_id = ' .
$GLOBALS[
'DIC'][
'ilDB']->quote($a_obj_id,
'integer');
110 return (
bool) $row->show_members;
122 $this->member_export = $a_mem_export;
132 $this->reg_access_code = $a_code;
142 $this->reg_access_code_enabled = $a_status;
152 $this->important = $a_info;
162 $this->syllabus = $a_syllabus;
172 $this->target_group = $a_tg;
182 $this->contact_name = $a_cn;
192 $this->contact_consultation = $a_value;
202 $this->contact_phone = $a_value;
212 $this->contact_email = $a_value;
222 $this->contact_responsibility = $a_value;
237 $this->activation_start = $a_value;
247 $this->activation_end = $a_value;
252 $this->activation_visibility = $a_value;
267 $this->subscription_limitation_type = $a_type;
282 $this->subscription_start = $a_value;
292 $this->subscription_end = $a_value;
302 $this->subscription_type = $a_value;
312 $this->subscription_password = $a_value;
327 $this->waiting_list = $a_status;
343 $this->session_limit = $a_status;
353 $this->subscription_membership_limitation = $a_status;
358 $this->session_prev = $a_num;
368 $this->session_next = $a_num;
388 $this->subscription_max_members = $a_value;
396 $query =
"SELECT * FROM crs_settings " .
397 "WHERE obj_id = " .
$ilDB->quote($a_course_id,
'integer') .
" " .
398 "AND sub_notify = 1";
400 return (
bool)
$res->numRows();
404 bool $a_admin_panel_enabled =
false,
405 bool $a_include_side_block =
false,
406 int $a_get_single = 0,
410 if (isset($this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block])) {
411 return $this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block];
415 parent::getSubItems($a_admin_panel_enabled, $a_include_side_block, $a_get_single);
416 $this->items = ilContainerSessionsContentGUI::prepareSessionPresentationLimitation(
419 $a_admin_panel_enabled,
420 $a_include_side_block
422 return $this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block];
432 $this->view_mode = $a_mode;
437 return $this->view_mode;
446 $query =
'SELECT timing_mode FROM crs_settings ' .
447 'WHERE obj_id = ' .
$ilDB->quote($a_obj_id,
'integer');
451 return (
int) $row->timing_mode;
458 $this->timing_mode = $a_mode;
463 return $this->timing_mode;
472 $query =
"SELECT view_mode FROM crs_settings WHERE obj_id = " .
$ilDB->quote($a_id,
'integer') .
" ";
475 return $row->view_mode;
486 $query =
"SELECT abo FROM crs_settings WHERE obj_id = " .
$ilDB->quote($a_id,
'integer') .
" ";
496 $this->abo = $a_status;
506 $this->show_members = $a_status;
511 return $this->show_members;
516 $this->mail_members = $a_type;
521 return $this->mail_members;
531 $this->message = $a_message;
536 if ($this->getMessage()) {
537 $this->message .=
"<br /> ";
539 $this->message .= $a_message;
544 if ($this->getOfflineStatus()) {
547 if ($this->getActivationUnlimitedStatus()) {
550 if (time() < $this->getActivationStart() or
551 time() > $this->getActivationEnd()) {
577 $this->__readSettings();
584 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
586 $id = parent::create($a_upload);
589 $this->createMetaData();
591 $this->__createDefaultSettings();
592 $this->app_event_handler->raise(
595 array(
'object' => $this,
596 'obj_id' => $this->
getId(),
597 'appointments' => $this->prepareAppointments(
'create')
606 $this->latitude = $a_latitude;
611 return $this->latitude;
616 $this->longitude = $a_longitude;
621 return $this->longitude;
626 $this->locationzoom = $a_locationzoom;
631 return $this->locationzoom;
636 $this->enablemap = $a_enablemap;
641 return $this->getEnableCourseMap();
646 return $this->enablemap;
652 ($start instanceof \
ilDate && !$end instanceof
ilDate) ||
655 throw new InvalidArgumentException(
'Different date types not supported.');
658 if ($start instanceof \
ilDate) {
659 $this->toggleCourseStartTimeIndication(
false);
661 $this->toggleCourseStartTimeIndication(
true);
663 $this->setCourseStart($start);
664 $this->setCourseEnd($end);
669 $this->course_start_time_indication = $time_indication;
674 return $this->course_start_time_indication;
679 $this->crs_start = $a_value;
684 return $this->crs_start;
689 $this->crs_end = $a_value;
694 return $this->crs_end;
699 $this->leave_end = $a_value;
704 return $this->leave_end;
709 if ($a_value !==
null) {
712 $this->min_members = $a_value;
717 return $this->min_members;
722 $this->auto_fill_from_waiting = $a_value;
727 return $this->auto_fill_from_waiting;
742 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
744 $this->cloneAutoGeneratedRoles($new_obj);
745 $this->cloneMetaData($new_obj);
748 $new_obj->getMemberObject()->updateContact($this->
user->getId(), 1);
751 if ($cwo->isRootNode($this->getRefId())) {
752 $this->setOfflineStatus(
true);
755 $this->cloneSettings($new_obj);
759 $obj_settings->cloneSettings($new_obj->getId());
760 unset($obj_settings);
768 $DIC->filesystem()->web(),
772 $cloneAction->cloneCertificate($this, $new_obj);
775 $book_service->cloneSettings($this->
getId(), $new_obj->getId());
778 foreach ($badges as $badge) {
779 $badge->clone($new_obj->getId());
790 parent::cloneDependencies($a_target_id, $a_copy_id);
794 $start->cloneDependencies($a_target_id, $a_copy_id);
804 $crs_objective->ilClone($a_target_id, $a_copy_id);
808 $this->course_logger->info(
'Handling grouping id: ' . $grouping_id);
809 $grouping = new \ilObjCourseGrouping($grouping_id);
810 $grouping->cloneGrouping($a_target_id, $a_copy_id);
820 $admin = $this->getDefaultAdminRole();
821 $new_admin = $new_obj->getDefaultAdminRole();
823 if (!$admin || !$new_admin || !$this->getRefId() || !$new_obj->
getRefId()) {
824 $this->course_logger->debug(
'Error cloning auto generated role: il_crs_admin');
826 $this->rbac_admin->copyRolePermissions($admin, $this->getRefId(), $new_obj->
getRefId(), $new_admin,
true);
827 $this->course_logger->debug(
'Finished copying of role crs_admin.');
829 $tutor = $this->getDefaultTutorRole();
830 $new_tutor = $new_obj->getDefaultTutorRole();
831 if (!$tutor || !$new_tutor) {
832 $this->course_logger->info(
'Error cloning auto generated role: il_crs_tutor');
834 $this->rbac_admin->copyRolePermissions($tutor, $this->getRefId(), $new_obj->
getRefId(), $new_tutor,
true);
835 $this->course_logger->info(
'Finished copying of role crs_tutor.');
837 $member = $this->getDefaultMemberRole();
838 $new_member = $new_obj->getDefaultMemberRole();
839 if (!$member || !$new_member) {
840 $this->course_logger->debug(
'Error cloning auto generated role: il_crs_member');
842 $this->rbac_admin->copyRolePermissions($member, $this->getRefId(), $new_obj->
getRefId(), $new_member,
true);
843 $this->course_logger->debug(
'Finished copying of role crs_member.');
848 $this->setMessage(
'');
851 $this->getSubscriptionStart() > $this->getSubscriptionEnd()) {
852 $this->appendMessage($this->
lng->txt(
"subscription_times_not_valid"));
855 $this->appendMessage($this->
lng->txt(
"crs_password_required"));
857 if ($this->isSubscriptionMembershipLimited()) {
858 if ($this->getSubscriptionMinMembers() <= 0 && $this->getSubscriptionMaxMembers() <= 0) {
859 $this->appendMessage($this->
lng->txt(
"crs_max_and_min_members_needed"));
861 if ($this->getSubscriptionMaxMembers() <= 0 && $this->enabledWaitingList()) {
862 $this->appendMessage($this->
lng->txt(
"crs_max_members_needed"));
864 if ($this->getSubscriptionMaxMembers() > 0 && $this->getSubscriptionMinMembers() > $this->getSubscriptionMaxMembers()) {
865 $this->appendMessage($this->
lng->txt(
"crs_max_and_min_members_invalid"));
868 if (!$this->getTitle() || !$this->getStatusDetermination()) {
869 $this->appendMessage($this->
lng->txt(
'err_check_input'));
871 if (($this->getCourseStart() && !$this->getCourseEnd()) ||
872 (!$this->getCourseStart() && $this->getCourseEnd()) ||
873 ($this->getCourseStart() && $this->getCourseEnd() && $this->getCourseStart()->
get(
IL_CAL_UNIX) > $this->getCourseEnd()->
get(
IL_CAL_UNIX))) {
874 $this->appendMessage($this->
lng->txt(
"crs_course_period_not_valid"));
877 return strlen($this->getMessage()) > 0;
883 if ($this->getContactEmail()) {
884 $emails = explode(
",", $this->getContactEmail());
886 foreach ($emails as
$email) {
889 $this->
error->appendMessage($this->
lng->txt(
'contact_email_not_valid') .
" '" . $email .
"'");
899 return strlen($this->getContactName()) || strlen($this->getContactResponsibility()) || strlen($this->getContactEmail()) || strlen($this->getContactPhone()) || strlen($this->getContactConsultation());
908 public function delete():
bool
911 if (!parent::delete()) {
916 $this->deleteMetaData();
920 $this->__deleteSettings();
932 $this->app_event_handler->raise(
935 array(
'object' => $this,
936 'obj_id' => $this->
getId(),
937 'appointments' => $this->prepareAppointments(
'delete')
949 $sorting->setSortMode($this->getOrderType());
952 $this->updateMetaData();
953 $this->updateSettings();
956 $this->app_event_handler->raise(
959 array(
'object' => $this,
960 'obj_id' => $this->
getId(),
961 'appointments' => $this->prepareAppointments(
'update')
971 $query =
"SELECT * FROM crs_settings WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
974 if (!
$res->numRows()) {
975 $this->__createDefaultSettings();
978 $query =
"UPDATE crs_settings SET " .
979 "syllabus = " . $this->db->quote($this->getSyllabus(),
'text') .
", " .
980 "contact_name = " . $this->db->quote($this->getContactName(),
'text') .
", " .
981 "contact_responsibility = " . $this->db->quote($this->getContactResponsibility(),
'text') .
", " .
982 "contact_phone = " . $this->db->quote($this->getContactPhone(),
'text') .
", " .
983 "contact_email = " . $this->db->quote($this->getContactEmail(),
'text') .
", " .
984 "contact_consultation = " . $this->db->quote($this->getContactConsultation(),
'text') .
", " .
985 "activation_type = " . $this->db->quote(!$this->getOfflineStatus(),
'integer') .
", " .
986 "sub_limitation_type = " . $this->db->quote($this->getSubscriptionLimitationType(),
'integer') .
", " .
987 "sub_start = " . $this->db->quote($this->getSubscriptionStart(),
'integer') .
", " .
988 "sub_end = " . $this->db->quote($this->getSubscriptionEnd(),
'integer') .
", " .
989 "sub_type = " . $this->db->quote($this->getSubscriptionType(),
'integer') .
", " .
990 "sub_password = " . $this->db->quote($this->getSubscriptionPassword(),
'text') .
", " .
991 "sub_mem_limit = " . $this->db->quote((
int) $this->isSubscriptionMembershipLimited(),
'integer') .
", " .
992 "sub_max_members = " . $this->db->quote($this->getSubscriptionMaxMembers(),
'integer') .
", " .
993 "sub_notify = " . $this->db->quote($this->getSubscriptionNotify(),
'integer') .
", " .
994 "view_mode = " . $this->db->quote($this->getViewMode(),
'integer') .
", " .
995 'timing_mode = ' . $this->db->quote($this->getTimingMode(),
'integer') .
', ' .
996 "abo = " . $this->db->quote($this->getAboStatus(),
'integer') .
", " .
997 "waiting_list = " . $this->db->quote($this->enabledWaitingList(),
'integer') .
", " .
998 "important = " . $this->db->quote($this->getImportantInformation(),
'text') .
", " .
1000 "show_members = " . $this->db->quote($this->getShowMembers(),
'integer') .
", " .
1001 "show_members_export = " . $this->db->quote($this->getShowMembersExport(),
'integer') .
", " .
1002 "latitude = " . $this->db->quote($this->getLatitude(),
'text') .
", " .
1003 "longitude = " . $this->db->quote($this->getLongitude(),
'text') .
", " .
1004 "location_zoom = " . $this->db->quote($this->getLocationZoom(),
'integer') .
", " .
1005 "enable_course_map = " . $this->db->quote((
int) $this->getEnableCourseMap(),
'integer') .
", " .
1006 'session_limit = ' . $this->db->quote($this->isSessionLimitEnabled(),
'integer') .
', ' .
1007 'session_prev = ' . $this->db->quote($this->getNumberOfPreviousSessions(),
'integer') .
', ' .
1008 'session_next = ' . $this->db->quote($this->getNumberOfNextSessions(),
'integer') .
', ' .
1009 'reg_ac_enabled = ' . $this->db->quote($this->isRegistrationAccessCodeEnabled(),
'integer') .
', ' .
1010 'reg_ac = ' . $this->db->quote($this->getRegistrationAccessCode(),
'text') .
', ' .
1011 'auto_notification = ' . $this->db->quote((
int) $this->getAutoNotification(),
'integer') .
', ' .
1013 'mail_members_type = ' . $this->db->quote($this->getMailToMembersType(),
'integer') .
', ' .
1014 'period_start = ' . $this->db->quote(
1018 'period_end = ' . $this->db->quote(
1022 'period_time_indication = ' . $this->db->quote(
1023 $this->getCourseStartTimeIndication() ? 1 : 0,
1026 'auto_wait = ' . $this->db->quote((
int) $this->hasWaitingListAutoFill(),
'integer') .
', ' .
1027 'leave_end = ' . $this->db->quote(
1028 ($this->getCancellationEnd() && !$this->getCancellationEnd()->isNull()) ? $this->getCancellationEnd()->
get(
IL_CAL_UNIX) :
null,
1031 'min_members = ' . $this->db->quote($this->getSubscriptionMinMembers(),
'integer') .
' ' .
1032 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
"";
1037 if ($this->ref_id ??
false) {
1041 if (!$this->getActivationStart() || !$this->getActivationEnd()) {
1045 $item->setTimingStart($this->getActivationStart());
1046 $item->setTimingEnd($this->getActivationEnd());
1047 $item->toggleVisible($this->getActivationVisibility());
1049 $item->update($this->ref_id);
1055 $new_obj->setSyllabus($this->getSyllabus());
1056 $new_obj->setContactName($this->getContactName());
1057 $new_obj->setContactResponsibility($this->getContactResponsibility());
1058 $new_obj->setContactPhone($this->getContactPhone());
1059 $new_obj->setContactEmail($this->getContactEmail());
1060 $new_obj->setContactConsultation($this->getContactConsultation());
1062 $new_obj->setActivationStart($this->getActivationStart());
1063 $new_obj->setActivationEnd($this->getActivationEnd());
1064 $new_obj->setActivationVisibility($this->getActivationVisibility());
1065 $new_obj->setSubscriptionLimitationType($this->getSubscriptionLimitationType());
1066 $new_obj->setSubscriptionStart($this->getSubscriptionStart());
1067 $new_obj->setSubscriptionEnd($this->getSubscriptionEnd());
1068 $new_obj->setSubscriptionType($this->getSubscriptionType());
1069 $new_obj->setSubscriptionPassword($this->getSubscriptionPassword());
1070 $new_obj->enableSubscriptionMembershipLimitation($this->isSubscriptionMembershipLimited());
1071 $new_obj->setSubscriptionMaxMembers($this->getSubscriptionMaxMembers());
1072 $new_obj->setViewMode($this->getViewMode());
1073 $new_obj->setTimingMode($this->getTimingMode());
1074 $new_obj->setOrderType($this->getOrderType());
1075 $new_obj->setAboStatus($this->getAboStatus());
1076 $new_obj->enableWaitingList($this->enabledWaitingList());
1077 $new_obj->setImportantInformation($this->getImportantInformation());
1078 $new_obj->setTargetGroup($this->getTargetGroup());
1079 $new_obj->setShowMembers($this->getShowMembers());
1081 $new_obj->setShowMembersExport($this->getShowMembersExport());
1083 $new_obj->enableSessionLimit($this->isSessionLimitEnabled());
1084 $new_obj->setNumberOfPreviousSessions($this->getNumberOfPreviousSessions());
1085 $new_obj->setNumberOfNextSessions($this->getNumberOfNextSessions());
1086 $new_obj->setAutoNotification($this->getAutoNotification());
1087 $new_obj->enableRegistrationAccessCode($this->isRegistrationAccessCodeEnabled());
1089 $new_obj->setStatusDetermination($this->getStatusDetermination());
1090 $new_obj->setMailToMembersType($this->getMailToMembersType());
1091 $new_obj->setCoursePeriod(
1092 $this->getCourseStart(),
1093 $this->getCourseEnd()
1095 $new_obj->setCancellationEnd($this->getCancellationEnd());
1096 $new_obj->setWaitingListAutoFill($this->hasWaitingListAutoFill());
1097 $new_obj->setSubscriptionMinMembers($this->getSubscriptionMinMembers());
1100 $new_obj->setEnableCourseMap($this->getEnableCourseMap());
1101 $new_obj->setLatitude($this->getLatitude());
1102 $new_obj->setLongitude($this->getLongitude());
1103 $new_obj->setLocationZoom($this->getLocationZoom());
1112 $query =
"INSERT INTO crs_settings (obj_id,syllabus,contact_name,contact_responsibility," .
1113 "contact_phone,contact_email,contact_consultation," .
1114 "sub_limitation_type,sub_start,sub_end,sub_type,sub_password,sub_mem_limit," .
1115 "sub_max_members,sub_notify,view_mode,timing_mode,abo," .
1116 "latitude,longitude,location_zoom,enable_course_map,waiting_list,show_members,show_members_export, " .
1117 "session_limit,session_prev,session_next, reg_ac_enabled, reg_ac, auto_notification, status_dt,mail_members_type) " .
1119 $this->db->quote($this->
getId(),
'integer') .
", " .
1120 $this->db->quote($this->getSyllabus(),
'text') .
", " .
1121 $this->db->quote($this->getContactName(),
'text') .
", " .
1122 $this->db->quote($this->getContactResponsibility(),
'text') .
", " .
1123 $this->db->quote($this->getContactPhone(),
'text') .
", " .
1124 $this->db->quote($this->getContactEmail(),
'text') .
", " .
1125 $this->db->quote($this->getContactConsultation(),
'text') .
", " .
1127 $this->db->quote($this->getSubscriptionStart(),
'integer') .
", " .
1128 $this->db->quote($this->getSubscriptionEnd(),
'integer') .
", " .
1130 $this->db->quote($this->getSubscriptionPassword(),
'text') .
", " .
1132 $this->db->quote($this->getSubscriptionMaxMembers(),
'integer') .
", " .
1136 $this->db->quote($this->getAboStatus(),
'integer') .
", " .
1137 $this->db->quote($this->getLatitude(),
'text') .
", " .
1138 $this->db->quote($this->getLongitude(),
'text') .
", " .
1139 $this->db->quote($this->getLocationZoom(),
'integer') .
", " .
1140 $this->db->quote($this->getEnableCourseMap(),
'integer') .
", " .
1141 #
"objective_view = '0', ".
1145 $this->db->quote($this->isSessionLimitEnabled(),
'integer') .
', ' .
1146 $this->db->quote($this->getNumberOfPreviousSessions(),
'integer') .
', ' .
1147 $this->db->quote($this->getNumberOfPreviousSessions(),
'integer') .
', ' .
1148 $this->db->quote($this->isRegistrationAccessCodeEnabled(),
'integer') .
', ' .
1149 $this->db->quote($this->getRegistrationAccessCode(),
'text') .
', ' .
1150 $this->db->quote((
int) $this->getAutoNotification(),
'integer') .
', ' .
1151 $this->db->quote($this->getStatusDetermination(),
'integer') .
', ' .
1152 $this->db->quote($this->getMailToMembersType(),
'integer') .
' ' .
1156 $this->__readSettings();
1165 $query =
"SELECT * FROM crs_settings WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer');
1168 $this->setSyllabus((
string) $row->syllabus);
1169 $this->setTargetGroup($row->target_group);
1170 $this->setContactName((
string) $row->contact_name);
1171 $this->setContactResponsibility((
string) $row->contact_responsibility);
1172 $this->setContactPhone((
string) $row->contact_phone);
1173 $this->setContactEmail((
string) $row->contact_email);
1174 $this->setContactConsultation((
string) $row->contact_consultation);
1175 $this->setOfflineStatus(!(
bool) $row->activation_type);
1176 $this->setSubscriptionLimitationType((
int) $row->sub_limitation_type);
1177 $this->setSubscriptionStart((
int) $row->sub_start);
1178 $this->setSubscriptionEnd((
int) $row->sub_end);
1179 $this->setSubscriptionType((
int) $row->sub_type);
1180 $this->setSubscriptionPassword((
string) $row->sub_password);
1181 $this->enableSubscriptionMembershipLimitation((
bool) $row->sub_mem_limit);
1182 $this->setSubscriptionMaxMembers((
int) $row->sub_max_members);
1183 $this->setViewMode((
int) $row->view_mode);
1184 $this->setTimingMode((
int) $row->timing_mode);
1185 $this->setAboStatus((
bool) $row->abo);
1186 $this->enableWaitingList((
bool) $row->waiting_list);
1187 $this->setImportantInformation((
string) $row->important);
1188 $this->setShowMembers((
bool) $row->show_members);
1191 $this->setShowMembersExport((
bool) $row->show_members_export);
1193 $this->setShowMembersExport(
false);
1195 $this->setLatitude((
string) $row->latitude);
1196 $this->setLongitude((
string) $row->longitude);
1197 $this->setLocationZoom((
int) $row->location_zoom);
1198 $this->setEnableCourseMap((
bool) $row->enable_course_map);
1199 $this->enableSessionLimit((
int) $row->session_limit);
1200 $this->setNumberOfPreviousSessions((
int) $row->session_prev);
1201 $this->setNumberOfNextSessions((
int) $row->session_next);
1202 $this->enableRegistrationAccessCode((
bool) $row->reg_ac_enabled);
1203 $this->setRegistrationAccessCode((
string) $row->reg_ac);
1204 $this->setAutoNotification((
bool) $row->auto_notification);
1205 $this->setStatusDetermination((
int) $row->status_dt);
1206 $this->setMailToMembersType((
int) $row->mail_members_type);
1208 if ($row->period_time_indication) {
1209 $this->setCoursePeriod(
1213 } elseif (!is_null($row->period_start) && !is_null($row->period_end)) {
1214 $this->setCoursePeriod(
1219 $this->toggleCourseStartTimeIndication((
bool) $row->period_time_indication);
1220 $this->setCancellationEnd($row->leave_end ?
new ilDate($row->leave_end,
IL_CAL_UNIX) :
null);
1221 $this->setWaitingListAutoFill((
bool) $row->auto_wait);
1222 $this->setSubscriptionMinMembers((
int) $row->min_members);
1226 if ($this->ref_id ??
false) {
1228 switch ($activation[
"timing_type"]) {
1230 $this->setActivationStart((
int) $activation[
"timing_start"]);
1231 $this->setActivationEnd((
int) $activation[
"timing_end"]);
1232 $this->setActivationVisibility((
bool) $activation[
"visible"]);
1258 $this->initCourseMemberObject();
1260 return $this->member_obj;
1266 $this->initCourseMembersObject();
1268 return $this->members_obj;
1276 'il_crs_admin_' . $this->getRefId(),
1277 "Admin of crs obj_no." . $this->
getId(),
1282 'il_crs_tutor_' . $this->getRefId(),
1283 "Tutor of crs obj_no." . $this->
getId(),
1288 'il_crs_member_' . $this->getRefId(),
1289 "Member of crs obj_no." . $this->
getId(),
1304 $parent_roles = $this->rbac_review->getParentRoleIds($a_parent_ref);
1305 foreach ($parent_roles as $parent_role) {
1306 $this->rbac_admin->initIntersectionPermissions(
1308 $parent_role[
'obj_id'],
1309 $parent_role[
'parent'],
1310 $this->__getCrsNonMemberTemplateId(),
1319 $q =
"SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_crs_non_member'";
1322 return (
int) $row[
"obj_id"];
1331 $query =
'SELECT obj_id FROM object_data WHERE type = ' .
$ilDB->quote(
1334 ) .
' AND title = ' .
$ilDB->quote(
'il_crs_non_member',
'text');
1337 return (
int) $row[
'obj_id'];
1348 if (empty($this->local_roles)) {
1349 $this->local_roles = array();
1350 $role_arr = $this->rbac_review->getRolesOfRoleFolder($this->getRefId());
1352 foreach ($role_arr as $role_id) {
1353 if ($this->rbac_review->isAssignable($role_id, $this->getRefId()) ==
true) {
1358 $role_name = $role_Obj->getTitle();
1360 $this->local_roles[$role_name] = $role_Obj->getId();
1364 return $this->local_roles;
1377 if (strlen($a_crs_id) > 0) {
1378 $crs_id = $a_crs_id;
1380 $crs_id = $this->getRefId();
1383 $role_arr = $this->rbac_review->getRolesOfRoleFolder($crs_id);
1385 $arr_crsDefaultRoles = [];
1386 foreach ($role_arr as $role_id) {
1387 $role_Obj = &$this->
ilias->obj_factory->getInstanceByObjId($role_id);
1389 $crs_Member =
"il_crs_member_" . $crs_id;
1390 $crs_Admin =
"il_crs_admin_" . $crs_id;
1391 $crs_Tutor =
"il_crs_tutor_" . $crs_id;
1393 if (strcmp($role_Obj->getTitle(), $crs_Member) == 0) {
1394 $arr_crsDefaultRoles[
"crs_member_role"] = $role_Obj->getId();
1397 if (strcmp($role_Obj->getTitle(), $crs_Admin) == 0) {
1398 $arr_crsDefaultRoles[
"crs_admin_role"] = $role_Obj->getId();
1401 if (strcmp($role_Obj->getTitle(), $crs_Tutor) == 0) {
1402 $arr_crsDefaultRoles[
"crs_tutor_role"] = $role_Obj->getId();
1406 return $arr_crsDefaultRoles;
1414 return $this->rbac_review->getRolesOfRoleFolder($this->getRefId(),
false);
1419 $query =
"DELETE FROM crs_settings " .
1420 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
1421 $this->db->manipulate(
$query);
1426 $local_roles = $this->__getLocalRoles();
1427 foreach ($local_roles as $role_id) {
1429 if (substr($title, 0, 8) ==
'il_crs_m') {
1438 $local_roles = $this->__getLocalRoles();
1439 foreach ($local_roles as $role_id) {
1441 if (!strcmp($tmp_role->getTitle(),
"il_crs_tutor_" . $this->getRefId())) {
1451 $local_roles = $this->__getLocalRoles();
1452 foreach ($local_roles as $role_id) {
1454 if (!strcmp($tmp_role->getTitle(),
"il_crs_admin_" . $this->getRefId())) {
1471 switch ($a_element) {
1475 $ecs->handleContentUpdate();
1494 if (!$this->getActivationUnlimitedStatus() && !$this->getOfflineStatus()) {
1496 $app->setTitle($this->getTitle());
1497 $app->setSubtitle(
'crs_cal_activation_start');
1499 $app->setDescription($this->getLongDescription());
1504 $app->setTitle($this->getTitle());
1505 $app->setSubtitle(
'crs_cal_activation_end');
1507 $app->setDescription($this->getLongDescription());
1513 $app->setTitle($this->getTitle());
1514 $app->setSubtitle(
'crs_cal_reg_start');
1516 $app->setDescription($this->getLongDescription());
1521 $app->setTitle($this->getTitle());
1522 $app->setSubtitle(
'crs_cal_reg_end');
1524 $app->setDescription($this->getLongDescription());
1528 if ($this->getCourseStart() && $this->getCourseEnd()) {
1530 $app->setTitle($this->getTitle());
1531 $app->setSubtitle(
'crs_cal_start');
1533 $app->setDescription($this->getLongDescription());
1534 $app->setStart($this->getCourseStart());
1535 $app->setFullday(!$this->getCourseStartTimeIndication());
1539 $app->setTitle($this->getTitle());
1540 $app->setSubtitle(
'crs_cal_end');
1542 $app->setDescription($this->getLongDescription());
1543 $app->setStart($this->getCourseEnd());
1544 $app->setFullday(!$this->getCourseStartTimeIndication());
1551 foreach ($active as $null => $item) {
1555 $app->setContextInfo($item[
'ref_id']);
1556 $app->setTitle($item[
'title']);
1557 $app->setSubtitle(
'cal_crs_timing_start');
1560 $app->setFullday(
true);
1564 $app->setContextInfo($item[
'ref_id']);
1565 $app->setTitle($item[
'title']);
1566 $app->setSubtitle(
'cal_crs_timing_end');
1569 $app->setFullday(
true);
1593 $query =
"SELECT obj_id FROM crs_settings " .
1594 "WHERE reg_ac_enabled = " .
$ilDB->quote(1,
'integer') .
" " .
1595 "AND reg_ac = " .
$ilDB->quote($a_code,
'text');
1600 $obj_ids[] = (
int) $row->obj_id;
1609 public function register(
1612 bool $a_force_registration = false
1614 if ($this->getMembersObject()->isAssigned($a_user_id)) {
1618 if (!$a_force_registration) {
1622 "Can't register to course, course is offline.",
1629 "Can't register to course, course is not activated.",
1637 'Cant registrate to course ' . $this->
getId() .
1638 ', course subscription is deactivated.',
1646 if (!$this->inSubscriptionTime()) {
1648 'Cant registrate to course ' . $this->
getId() .
1649 ', course is out of registration time.',
1656 if ($this->isSubscriptionMembershipLimited()) {
1657 $free = max(0, $this->getSubscriptionMaxMembers() - $this->getMembersObject()->getCountMembers());
1659 if ($this->enabledWaitingList() && (!$free || $waiting_list->getCountUsers())) {
1660 $waiting_list->addToList($a_user_id);
1661 $this->
lng->loadLanguageModule(
"crs");
1663 $this->
lng->txt(
'crs_added_to_list'),
1664 $waiting_list->getPosition($a_user_id)
1667 $participants->sendNotification(
1678 if (!$this->enabledWaitingList() && !$free) {
1685 $this->getMembersObject()->add($a_user_id, $a_role);
1697 return $this->auto_notification;
1706 $this->auto_notification = $value;
1714 $a_value = $a_value;
1717 if ($a_value == self::STATUS_DETERMINATION_LP) {
1719 $a_value = self::STATUS_DETERMINATION_MANUAL;
1723 $this->status_dt = $a_value;
1731 return $this->status_dt;
1736 foreach ($this->getMembersObject()->getParticipants() as $user_id) {
1757 $this->getMembersObject()->updatePassed($a_member_id, $has_completed,
false,
true);
1763 if ($this->enabledObjectiveView()) {
1766 return parent::getOrderType();
1775 !$this->enabledWaitingList() || !$this->hasWaitingListAutoFill()
1777 $this->course_logger->debug(
'Waiting list or auto fill disabled.');
1781 $max = $this->getSubscriptionMaxMembers();
1784 $this->course_logger->debug(
'Max members: ' . $max);
1785 $this->course_logger->debug(
'Current members: ' . $now);
1794 foreach ($waiting_list->getUserIds() as $user_id) {
1796 $this->course_logger->warning(
'Cannot create user instance for id: ' . $user_id);
1799 if ($this->getMembersObject()->isAssigned($user_id)) {
1800 $this->course_logger->warning(
'User is already assigned to course. uid: ' . $user_id .
' course_id: ' . $this->getRefId());
1805 $waiting_list->removeFromList($user_id);
1806 $this->checkLPStatusSync($user_id);
1808 $this->course_logger->info(
'Assigned user from waiting list to course: ' . $this->getTitle());
1816 public static function mayLeave(
int $a_course_id,
int $a_user_id = 0, &$a_date =
null): bool
1824 $a_user_id =
$ilUser->getId();
1827 $set =
$ilDB->query(
"SELECT leave_end" .
1828 " FROM crs_settings" .
1829 " WHERE obj_id = " .
$ilDB->quote($a_course_id,
"integer"));
1830 $row =
$ilDB->fetchAssoc($set);
1831 if ($row && $row[
"leave_end"]) {
1833 $limit = date(
"Ymd", $row[
"leave_end"]);
1834 if ($limit < date(
"Ymd")) {
1845 $tree =
$GLOBALS[
'DIC']->repositoryTree();
1853 $set =
$ilDB->query(
"SELECT obj_id, min_members" .
1854 " FROM crs_settings" .
1855 " WHERE min_members > " .
$ilDB->quote(0,
"integer") .
1856 " AND sub_mem_limit = " .
$ilDB->quote(1,
"integer") .
1857 " AND ((leave_end IS NOT NULL" .
1858 " AND leave_end < " .
$ilDB->quote($now,
"text") .
")" .
1859 " OR (leave_end IS NULL" .
1860 " AND sub_end IS NOT NULL" .
1861 " AND sub_end < " .
$ilDB->quote($now,
"text") .
"))" .
1863 while ($row =
$ilDB->fetchAssoc($set)) {
1867 if ($tree->isDeleted($ref)) {
1872 $reci = $part->getNotificationRecipients();
1874 $missing = (
int) $row[
"min_members"] - $part->getCountMembers();
1876 $res[(
int) $row[
"obj_id"]] = array($missing, $reci);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static getInstancesByParentId(int $a_parent_id, array $a_filter=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Apointment templates are used for automatic generated apointments.
static convertDateToUtcDBTimestamp(\ilDateTime $date=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupSortMode(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstance(int $a_copy_id)
const IL_CRS_VIEW_OBJECTIVE
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_SUBSCRIPTION_PASSWORD
const IL_CRS_SUBSCRIPTION_LIMITED
const IL_CRS_VIEW_TIMING_ABSOLUTE
const IL_CRS_SUBSCRIPTION_UNLIMITED
const IL_CRS_SUBSCRIPTION_DIRECT
static _deleteByContainer(int $a_container_id)
static _clone(int $a_source_id, int $a_target_id)
static _deleteByCourse(int $a_course_id)
static _cloneFiles(int $a_source_id, int $a_target_id)
static _deleteUser(int $a_usr_id)
const TYPE_ADMISSION_MEMBER
const TYPE_NOTIFICATION_ADMINS
const TYPE_WAITING_LIST_MEMBER
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _deleteAll(int $course_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstanceByObjId(int $a_obj_id, int $a_usr_id)
static _getInstanceByObjId(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static checkForumsExistsInsert(int $ref_id, int $user_id)
static cloneSettings(int $a_copy_id, int $a_container_id, int $a_new_container_id)
static deleteResultsForUser(int $a_user_id)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
const LP_STATUS_COMPLETED_NUM
static _lookupStatus(int $a_obj_id, int $a_user_id, bool $a_create=true)
Lookup status.
Component logger with individual log levels by component id.
static generateCode()
Generate new registration key.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ADDED_TO_WAITINGLIST
const REGISTRATION_CODE_DISABLED
const REGISTRATION_INVALID_OFFLINE
const REGISTRATION_INVALID_AVAILABILITY
const OUT_OF_REGISTRATION_PERIOD
static _registrationEnabled(int $a_obj_id)
static _usingRegistrationCode()
static _isActivated(int $a_obj_id, ?bool &$a_visible_flag=null, bool $a_mind_member_view=true)
static _isOffline(int $obj_id)
Type-specific implementation of general status, has to be overwritten if object type does not support...
static _deleteAll(int $a_course_id)
static _getGroupings(int $a_course_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupCourseNonMemberTemplatesId()
static _lookupAboStatus(int $a_id)
getImportantInformation()
ilCourseWaitingList $waiting_list_obj
setSubscriptionMaxMembers(int $a_value)
getNumberOfNextSessions()
setLongitude(string $a_longitude)
static _deleteUser(int $a_usr_id)
static _lookupViewMode(int $a_id)
__construct(int $a_id=0, bool $a_call_by_reference=true)
const STATUS_DETERMINATION_MANUAL
checkLPStatusSync(int $a_member_id)
sync course status from lp as lp data is not deleted on course exit new members may already have lp c...
bool $reg_access_code_enabled
getSubscriptionPassword()
prepareAppointments(string $a_mode='create')
Prepare calendar appointments.
ilCourseParticipants $members_obj
enableSubscriptionMembershipLimitation(bool $a_status)
setTargetGroup(?string $a_tg)
setSubscriptionLimitationType(int $a_type)
setNumberOfPreviousSessions(int $a_num)
bool $auto_fill_from_waiting
setContactEmail(string $a_value)
cloneObject(int $a_target_id, int $a_copy_id=0, bool $a_omit_tree=false)
Clone course (no member data)
const STATUS_DETERMINATION_LP
static lookupObjectsByCode(string $a_code)
setCoursePeriod(?ilDateTime $start=null, ?ilDateTime $end=null)
appendMessage(string $a_message)
static lookupShowMembersEnabled(int $a_obj_id)
setContactPhone(string $a_value)
bool $activation_visibility
setImportantInformation(string $a_info)
getDefaultCourseRoles(string $a_crs_id="")
get default course roles, returns the defaultlike create roles il_crs_tutor, il_crs_admin and il_crs_...
setShowMembersExport(bool $a_mem_export)
getActivationVisibility()
handleAutoFill()
Handle course auto fill.
isSubscriptionMembershipLimited()
enableSessionLimit(int $a_status)
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
cloneSettings(ilObject $new_obj)
setSubscriptionEnd(int $a_value)
setActivationVisibility(bool $a_value)
getLocalCourseRoles($a_translate=false)
get ALL local roles of course, also those created and defined afterwards only fetch data once from da...
setParentRolePermissions(int $a_parent_ref)
This method is called before "initDefaultRoles".
setLatitude(string $a_latitude)
int $subscription_max_members
enableRegistrationAccessCode(bool $a_status)
__getCrsNonMemberTemplateId()
bool $subscription_membership_limitation
static _isSubscriptionNotificationEnabled(int $a_course_id)
getSubscriptionUnlimitedStatus()
setCourseStart(?ilDateTime $a_value=null)
static lookupTimingMode(int $a_obj_id)
getSubItems(bool $a_admin_panel_enabled=false, bool $a_include_side_block=false, int $a_get_single=0, \ilContainerUserFilter $container_user_filter=null)
getSubscriptionLimitationType()
setTimingMode(int $a_mode)
setContactConsultation(string $a_value)
doMDUpdateListener(string $a_element)
__createDefaultSettings()
initCourseMembersObject()
static findCoursesWithNotEnoughMembers()
setSubscriptionPassword(string $a_value)
setContactName(string $a_cn)
cloneDependencies(int $a_target_id, int $a_copy_id)
@inheritDoc
setNumberOfNextSessions(int $a_num)
getSubscriptionMaxMembers()
getRegistrationAccessCode()
setMailToMembersType(int $a_type)
static _registrationEnabled(int $a_obj_id)
Registration enabled? Method is in Access class, since it is needed by Access/ListGUI.
string $contact_responsibility
syncMembersStatusWithLP()
toggleCourseStartTimeIndication(bool $time_indication)
int $subscription_limitation_type
addAdditionalSubItemInformation(array &$object)
Add additional information to sub item, e.g.
getContactResponsibility()
setCourseEnd(?ilDateTime $a_value=null)
setActivationEnd(int $a_value)
getCourseStartTimeIndication()
const CAL_ACTIVATION_START
const CAL_COURSE_TIMING_START
static _isActivated(int $a_obj_id)
Is activated.
setSubscriptionStart(int $a_value)
getActivationUnlimitedStatus()
setActivationStart(int $a_value)
setSubscriptionType(int $a_value)
setSyllabus(string $a_syllabus)
setMessage(string $a_message)
bool $crs_start_time_indication
setAboStatus(bool $a_status)
getStatusDetermination()
Get status determination mode.
static mayLeave(int $a_course_id, int $a_user_id=0, &$a_date=null)
setShowMembers(bool $a_status)
setEnableCourseMap(bool $a_enablemap)
bool $course_start_time_indication
string $contact_consultation
ilCourseParticipant $member_obj
setStatusDetermination(int $a_value)
Set status determination mode.
setLocationZoom(int $a_locationzoom)
setRegistrationAccessCode(string $a_code)
setCancellationEnd(?ilDate $a_value=null)
const CAL_COURSE_TIMING_END
string $subscription_password
setWaitingListAutoFill(bool $a_value)
getSubscriptionMinMembers()
enableWaitingList(bool $a_status)
setContactResponsibility(string $a_value)
cloneAutoGeneratedRoles(ilObject $new_obj)
Clone automatic genrated roles (permissions and template permissions)
setSubscriptionMinMembers(int $a_value)
isRegistrationAccessCodeEnabled()
getAutoNotification()
Returns automatic notification status from $this->auto_notification.
setAutoNotification(bool $value)
Sets automatic notification status in $this->auto_notification, using given $status.
getNumberOfPreviousSessions()
static createDefaultRole(string $a_title, string $a_description, string $a_tpl_name, int $a_ref_id)
static _getTranslation(string $a_role_title)
static _enabledLearningProgress()
static getUserIdByLogin(string $a_login)
Class ilObjectActivation.
static cloneDependencies(int $ref_id, int $target_id, int $copy_id)
const TIMINGS_DEACTIVATED
static getTimingsItems(int $container_ref_id)
Get (sub) item data for timings view (no session material, no side blocks)
static getItem(int $ref_id)
static addAdditionalSubItemInformation(array &$item)
Parse item data for list entries.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAllReferences(int $id)
get all reference ids for object ID
setOfflineStatus(bool $status)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static lookupNumberOfMembers(int $a_ref_id)
Lookup number of members.
static _deleteAllEntries(int $a_obj_id)
Delete all entries Normally called in case of object deletion.
static _deleteUser(int $a_usr_id)
Delete user data.
static is_email(string $a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
header include for all ilias files.