3 declare(strict_types=1);
61 public function __construct(
int $a_id = 0,
bool $a_call_by_reference =
true)
65 $this->session_logger = $DIC->logger()->sess();
66 $this->obj_data_cache = $DIC[
'ilObjDataCache'];
67 $this->event_handler = $DIC->event();
77 $ilDB = $DIC->database();
79 $query =
"SELECT reg_type FROM event " .
80 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
92 $ilDB = $DIC->database();
94 $query =
"SELECT * FROM event " .
95 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
99 $data[
'location'] = $row->location ?:
'';
100 $data[
'details'] = $row->details ?:
'';
101 $data[
'name'] = $row->tutor_name ?:
'';
102 $data[
'email'] = $row->tutor_email ?:
'';
103 $data[
'phone'] = $row->tutor_phone ?:
'';
136 self::LOCAL_ROLE_PARTICIPANT_PREFIX .
'_' . $this->
getRefId(),
137 'Participant of session obj_no.' . $this->
getId(),
138 self::LOCAL_ROLE_PARTICIPANT_PREFIX,
143 $this->session_logger->warning(
'Could not create default session role.');
155 $this->location = $a_location;
165 $this->name = $a_name;
175 $this->phone = $a_phone;
185 $this->email = $a_email;
195 return strlen($this->
getName()) ||
202 $this->details = $a_details;
212 $this->reg_type = $a_type;
227 $this->reg_limited = $a_limit;
237 $this->reg_min_users = $a_users;
247 $this->reg_limited_users = $a_users;
257 $this->reg_waiting_list = $a_stat;
262 $this->reg_waiting_list_autofill = $a_value;
272 $this->show_members = $a_status;
287 $this->registrationNotificationEnabled = $value;
297 $this->notificationOption = $value;
319 $this->show_cannot_participate_option = $status;
329 $this->appointments[] = $appointment;
342 $app = $this->appointments[0] ?? null;
353 $this->mail_members = $a_type;
368 $ilErr->appendMessage($this->
lng->txt(
"sess_max_members_needed"));
375 public function cloneObject(
int $a_target_id,
int $a_copy_id = 0,
bool $a_omit_tree =
false): ?
ilObjSession 380 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
383 $new_obj->applyDidacticTemplate($dtpl);
393 $new_obj->setAppointments(array($new_app));
394 $new_obj->update(
true);
397 foreach ($this->files as $file) {
398 $file->cloneFiles($new_obj->getEventId());
407 $obj_settings->cloneSettings($new_obj->getId());
408 unset($obj_settings);
452 parent::cloneDependencies($a_target_id, $a_copy_id);
454 $target_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
457 $session_materials->cloneItems($this->
getId(), $a_copy_id);
462 public function create(
bool $a_skip_meta_data =
false):
int 469 if (!$a_skip_meta_data) {
473 $next_id =
$ilDB->nextId(
'event');
474 $query =
"INSERT INTO event (event_id,obj_id,location,tutor_name,tutor_phone,tutor_email,details,registration, " .
475 'reg_type, reg_limit_users, reg_limited, reg_waiting_list, reg_min_users, reg_auto_wait,show_members,mail_members, 476 reg_notification, notification_opt, show_cannot_part) ' .
478 $ilDB->quote($next_id,
'integer') .
", " .
479 $this->db->quote($this->
getId(),
'integer') .
", " .
480 $this->db->quote($this->
getLocation(),
'text') .
"," .
481 $this->db->quote($this->
getName(),
'text') .
", " .
482 $this->db->quote($this->
getPhone(),
'text') .
", " .
483 $this->db->quote($this->
getEmail(),
'text') .
", " .
484 $this->db->quote($this->
getDetails(),
'text') .
"," .
492 $this->db->quote((
int) $this->
getShowMembers(),
'integer') .
', ' .
499 $this->event_id = $next_id;
501 $ilAppEventHandler->raise(
504 array(
'object' => $this,
505 'obj_id' => $this->
getId(),
509 return $this->
getId();
512 public function update(
bool $a_skip_meta_update =
false): bool
517 if (!parent::update()) {
520 if (!$a_skip_meta_update) {
524 $query =
"UPDATE event SET " .
525 "location = " . $this->db->quote($this->
getLocation(),
'text') .
"," .
526 "tutor_name = " . $this->db->quote($this->
getName(),
'text') .
", " .
527 "tutor_phone = " . $this->db->quote($this->
getPhone(),
'text') .
", " .
528 "tutor_email = " . $this->db->quote($this->
getEmail(),
'text') .
", " .
529 "details = " . $this->db->quote($this->
getDetails(),
'text') .
", " .
537 'show_members = ' . $this->db->quote((
int) $this->
getShowMembers(),
'integer') .
', ' .
543 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
546 $ilAppEventHandler->raise(
549 array(
'object' => $this,
550 'obj_id' => $this->
getId(),
556 public function delete():
bool 561 if (!parent::delete()) {
568 $query =
"DELETE FROM event " .
569 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
576 foreach ($this->
getFiles() as $file) {
580 $ilAppEventHandler->raise(
583 array(
'object' => $this,
584 'obj_id' => $this->
getId(),
595 $query =
"SELECT * FROM event WHERE " .
596 "obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
601 $this->
setName((
string) $row->tutor_name);
602 $this->
setPhone((
string) $row->tutor_phone);
603 $this->
setEmail((
string) $row->tutor_email);
616 $this->event_id = (
int) $row->event_id;
631 include_once(
'./Modules/Session/classes/class.ilSessionFile.php');
658 $app->setFullday($sess_app->isFullday());
659 $app->setStart($sess_app->getStart());
660 $app->setEnd($sess_app->getEnd());
679 $this->session_logger->debug(
'Waiting list or auto fill is disabled.');
684 $current =
$parts->getCountParticipants();
689 $this->session_logger->warning(
'No ref_id found for obj_id: ' . $this->
getId());
695 if ($max <= $current) {
696 $this->session_logger->debug(
'Maximum number of participants not reached.');
697 $this->session_logger->debug(
'Maximum number of members: ' . $max);
698 $this->session_logger->debug(
'Current number of members: ' . $current);
703 foreach ($session_waiting_list->getUserIds() as $user_id) {
706 $this->session_logger->warning(
'Found invalid user id on waiting list: ' . $user_id);
709 if (in_array($user_id,
$parts->getParticipants())) {
710 $this->session_logger->notice(
'User on waiting list already session member: ' . $user_id);
715 $this->session_logger->debug(
'Registration enabled: register user');
716 $parts->register($user_id);
718 $this->session_logger->debug(
'Registration disabled: set user status to participated.');
719 $parts->getEventParticipants()->updateParticipation($user_id,
true);
726 $session_waiting_list->removeFromList($user_id);
729 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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isCannotParticipateOptionEnabled()
ilObjectDataCache $obj_data_cache
update(bool $a_skip_meta_update=false)
static lookupTemplateId(int $a_ref_id)
cloneDependencies($a_target_id, $a_copy_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)
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
__construct(Container $dic, ilPlugin $plugin)
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)