3 declare(strict_types=1);
60 public function __construct(
int $a_id = 0,
bool $a_call_by_reference =
true)
64 $this->session_logger = $DIC->logger()->sess();
65 $this->obj_data_cache = $DIC[
'ilObjDataCache'];
66 $this->event_handler = $DIC->event();
76 $ilDB = $DIC->database();
78 $query =
"SELECT reg_type FROM event " .
79 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
91 $ilDB = $DIC->database();
93 $query =
"SELECT * FROM event " .
94 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
98 $data[
'location'] = $row->location ?:
'';
99 $data[
'details'] = $row->details ?:
'';
100 $data[
'name'] = $row->tutor_name ?:
'';
101 $data[
'email'] = $row->tutor_email ?:
'';
102 $data[
'phone'] = $row->tutor_phone ?:
'';
135 self::LOCAL_ROLE_PARTICIPANT_PREFIX .
'_' . $this->
getRefId(),
136 'Participant of session obj_no.' . $this->
getId(),
137 self::LOCAL_ROLE_PARTICIPANT_PREFIX,
142 $this->session_logger->warning(
'Could not create default session role.');
154 $this->location = $a_location;
164 $this->name = $a_name;
174 $this->phone = $a_phone;
184 $this->email = $a_email;
194 return strlen($this->
getName()) ||
201 $this->details = $a_details;
211 $this->reg_type = $a_type;
226 $this->reg_limited = $a_limit;
236 $this->reg_min_users = $a_users;
246 $this->reg_limited_users = $a_users;
256 $this->reg_waiting_list = $a_stat;
261 $this->reg_waiting_list_autofill = $a_value;
271 $this->show_members = $a_status;
286 $this->registrationNotificationEnabled = $value;
296 $this->notificationOption = $value;
318 $this->show_cannot_participate_option = $status;
328 $this->appointments[] = $appointment;
341 $app = $this->appointments[0] ?? null;
347 $this->mail_members = $a_type;
362 $ilErr->appendMessage($this->
lng->txt(
"sess_max_members_needed"));
369 public function cloneObject(
int $target_id,
int $copy_id = 0,
bool $omit_tree =
false): ?
ilObjSession 374 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
377 $new_obj->applyDidacticTemplate($dtpl);
387 $new_obj->setAppointments(array($new_app));
388 $new_obj->update(
true);
396 $obj_settings->cloneSettings($new_obj->getId());
397 unset($obj_settings);
441 parent::cloneDependencies($target_id, $copy_id);
443 $target_obj_id = $ilObjDataCache->lookupObjId($target_id);
446 $session_materials->cloneItems($this->
getId(), $copy_id);
451 public function create(
bool $a_skip_meta_data =
false):
int 458 if (!$a_skip_meta_data) {
462 $next_id =
$ilDB->nextId(
'event');
463 $query =
"INSERT INTO event (event_id,obj_id,location,tutor_name,tutor_phone,tutor_email,details,registration, " .
464 'reg_type, reg_limit_users, reg_limited, reg_waiting_list, reg_min_users, reg_auto_wait,show_members,mail_members, 465 reg_notification, notification_opt, show_cannot_part) ' .
467 $ilDB->quote($next_id,
'integer') .
", " .
468 $this->db->quote($this->
getId(),
'integer') .
", " .
469 $this->db->quote($this->
getLocation(),
'text') .
"," .
470 $this->db->quote($this->
getName(),
'text') .
", " .
471 $this->db->quote($this->
getPhone(),
'text') .
", " .
472 $this->db->quote($this->
getEmail(),
'text') .
", " .
473 $this->db->quote($this->
getDetails(),
'text') .
"," .
481 $this->db->quote((
int) $this->
getShowMembers(),
'integer') .
', ' .
488 $this->event_id = $next_id;
490 $ilAppEventHandler->raise(
493 array(
'object' => $this,
494 'obj_id' => $this->
getId(),
498 return $this->
getId();
501 public function update(
bool $a_skip_meta_update =
false): bool
506 if (!parent::update()) {
509 if (!$a_skip_meta_update) {
513 $query =
"UPDATE event SET " .
514 "location = " . $this->db->quote($this->
getLocation(),
'text') .
"," .
515 "tutor_name = " . $this->db->quote($this->
getName(),
'text') .
", " .
516 "tutor_phone = " . $this->db->quote($this->
getPhone(),
'text') .
", " .
517 "tutor_email = " . $this->db->quote($this->
getEmail(),
'text') .
", " .
518 "details = " . $this->db->quote($this->
getDetails(),
'text') .
", " .
526 'show_members = ' . $this->db->quote((
int) $this->
getShowMembers(),
'integer') .
', ' .
532 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
535 $ilAppEventHandler->raise(
538 array(
'object' => $this,
539 'obj_id' => $this->
getId(),
545 public function delete():
bool 550 if (!parent::delete()) {
557 $query =
"DELETE FROM event " .
558 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
565 $ilAppEventHandler->raise(
568 array(
'object' => $this,
569 'obj_id' => $this->
getId(),
580 $query =
"SELECT * FROM event WHERE " .
581 "obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
582 $res = $this->db->query($query);
586 $this->
setName((
string) $row->tutor_name);
587 $this->
setPhone((
string) $row->tutor_phone);
588 $this->
setEmail((
string) $row->tutor_email);
601 $this->event_id = (
int) $row->event_id;
631 $app->setFullday($sess_app->isFullday());
632 $app->setStart($sess_app->getStart());
633 $app->setEnd($sess_app->getEnd());
652 $this->session_logger->debug(
'Waiting list or auto fill is disabled.');
657 $current =
$parts->getCountParticipants();
662 $this->session_logger->warning(
'No ref_id found for obj_id: ' . $this->
getId());
668 if ($max <= $current) {
669 $this->session_logger->debug(
'Maximum number of participants not reached.');
670 $this->session_logger->debug(
'Maximum number of members: ' . $max);
671 $this->session_logger->debug(
'Current number of members: ' . $current);
676 foreach ($session_waiting_list->getUserIds() as $user_id) {
679 $this->session_logger->warning(
'Found invalid user id on waiting list: ' . $user_id);
682 if (in_array($user_id,
$parts->getParticipants())) {
683 $this->session_logger->notice(
'User on waiting list already session member: ' . $user_id);
688 $this->session_logger->debug(
'Registration enabled: register user');
689 $parts->register($user_id);
691 $this->session_logger->debug(
'Registration disabled: set user status to participated.');
692 $parts->getEventParticipants()->updateParticipation($user_id,
true);
699 $session_waiting_list->removeFromList($user_id);
702 if ($current >= $max) {
setRegistrationMaxUsers(int $a_users)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const NOTIFICATION_INHERIT_OPTION
static _deleteBySession(int $a_event_id)
setShowMembers(bool $a_status)
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
cloneSettings(ilObjSession $new_obj)
static _getAllReferences(int $id)
get all reference ids for object ID
setWaitingListAutoFill(bool $a_value)
const LOCAL_ROLE_PARTICIPANT_PREFIX
isRegistrationNotificationEnabled()
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setAppointments(array $appointments)
Apointment templates are used for automatic generated apointments.
static createDefaultRole(string $a_title, string $a_description, string $a_tpl_name, int $a_ref_id)
getRegistrationMinUsers()
setRegistrationType(int $a_type)
setMailToMembersType(int $a_type)
static _lookupRegistrationEnabled(int $a_obj_id)
isRegistrationWaitingListEnabled()
ilSessionParticipants $members_obj
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
bool $registrationNotificationEnabled
isCannotParticipateOptionEnabled()
ilObjectDataCache $obj_data_cache
update(bool $a_skip_meta_update=false)
static lookupTemplateId(int $a_ref_id)
cloneMetaData(ilObject $target_obj)
Copy meta data.
enableCannotParticipateOption(bool $status)
setRegistrationNotificationEnabled(bool $value)
getRegistrationMaxUsers()
__construct(int $a_id=0, bool $a_call_by_reference=true)
prepareCalendarAppointments(string $a_mode='create')
isRegistrationUserLimitEnabled()
static _delete(int $a_event_id)
cloneDependencies($target_id, $copy_id)
setPhone(string $a_phone)
static _deleteByEvent(int $a_event_id)
addAppointment(ilSessionAppointment $appointment)
static lookupSession(int $a_obj_id)
string $notificationOption
initDefaultRoles()
Create local session participant role.
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
bool $reg_waiting_list_autofill
create(bool $a_skip_meta_data=false)
setRegistrationMinUsers(int $a_users)
bool $show_cannot_participate_option
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static lookupNumberOfMembers(int $a_ref_id)
Lookup number of members.
setEmail(string $a_email)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
setRegistrationNotificationOption(string $value)
const TYPE_ACCEPTED_SUBSCRIPTION_MEMBER
setDetails(string $a_details)
static _getInstanceByObjId(int $a_obj_id)
enabledRegistrationForUsers()
getLongDescription()
get object long description (stored in object_description)
static _readAppointmentsBySession(int $a_event_id)
setLocation(string $a_location)
enableRegistrationUserLimit(int $a_limit)
getRegistrationNotificationOption()
getPresentationTitleAppointmentPeriod()
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...
ilAppEventHandler $event_handler
enableRegistrationWaitingList(bool $a_stat)