5include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
6include_once
'./Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
74 public function __construct($a_id = 0, $a_call_by_reference =
true)
80 $this->session_logger =
$GLOBALS[
'DIC']->logger()->sess();
101 $query =
"SELECT reg_type FROM event " .
102 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
121 $query =
"SELECT * FROM event " .
122 "WHERE obj_id = " .
$ilDB->quote($a_obj_id);
125 $data[
'location'] = $row->location ? $row->location :
'';
126 $data[
'details'] = $row->details ? $row->details :
'';
127 $data[
'name'] = $row->tutor_name ? $row->tutor_name :
'';
128 $data[
'email'] = $row->tutor_email ? $row->tutor_email :
'';
129 $data[
'phone'] = $row->tutor_phone ? $row->tutor_phone :
'';
131 return (array)
$data;
171 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
173 self::LOCAL_ROLE_PARTICIPANT_PREFIX .
'_' . $this->
getRefId(),
174 'Participant of session obj_no.' . $this->
getId(),
175 self::LOCAL_ROLE_PARTICIPANT_PREFIX,
180 $this->session_logger->warning(
'Could not create default session role.');
205 $this->location = $a_location;
227 $this->name = $a_name;
249 $this->phone = $a_phone;
272 $this->email = $a_email;
293 return strlen($this->
getName()) or
307 $this->details = $a_details;
338 $this->reg_limited = $a_limit;
348 $this->reg_min_users = $a_users;
358 $this->reg_limited_users = $a_users;
368 $this->reg_waiting_list = $a_stat;
373 $this->reg_waiting_list_autofill = (bool) $a_value;
387 $this->show_members = (bool) $a_status;
413 return $this->registrationNotificationEnabled = $value;
429 $this->notificationOption = $value;
451 return $this->appointments ? $this->appointments : array();
463 $this->appointments[] = $appointment;
486 return is_object($this->appointments[0]) ? $this->appointments[0] : ($this->appointments[0] =
new ilSessionAppointment());
498 return $this->files ? $this->files : array();
537 $ilErr->appendMessage($this->lng->txt(
"sess_max_members_needed"));
552 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
557 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
560 $new_obj->applyDidacticTemplate($dtpl);
570 $new_obj->setAppointments(array($new_app));
571 $new_obj->update(
true);
574 foreach ($this->files as $file) {
575 $file->cloneFiles($new_obj->getEventId());
583 include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
585 $obj_settings->cloneSettings($new_obj->getId());
586 unset($obj_settings);
644 $ilObjDataCache =
$DIC[
'ilObjDataCache'];
646 parent::cloneDependencies($a_target_id, $a_copy_id);
648 $target_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
650 include_once(
'./Modules/Session/classes/class.ilEventItems.php');
652 $session_materials->cloneItems($this->
getId(), $a_copy_id);
664 public function create($a_skip_meta_data =
false)
671 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
675 if (!$a_skip_meta_data) {
679 $next_id =
$ilDB->nextId(
'event');
680 $query =
"INSERT INTO event (event_id,obj_id,location,tutor_name,tutor_phone,tutor_email,details,registration, " .
681 'reg_type, reg_limit_users, reg_limited, reg_waiting_list, reg_min_users, reg_auto_wait,show_members,mail_members,
682 reg_notification, notification_opt) ' .
684 $ilDB->quote($next_id,
'integer') .
", " .
685 $this->db->quote($this->
getId(),
'integer') .
", " .
686 $this->db->quote($this->
getLocation(),
'text') .
"," .
687 $this->db->quote($this->
getName(),
'text') .
", " .
688 $this->db->quote($this->
getPhone(),
'text') .
", " .
689 $this->db->quote($this->
getEmail(),
'text') .
", " .
690 $this->db->quote($this->
getDetails(),
'text') .
"," .
704 $this->event_id = $next_id;
706 $ilAppEventHandler->raise(
709 array(
'object' => $this,
710 'obj_id' => $this->
getId(),
714 return $this->
getId();
724 public function update($a_skip_meta_update =
false)
731 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
733 if (!parent::update()) {
736 if (!$a_skip_meta_update) {
740 $query =
"UPDATE event SET " .
741 "location = " . $this->db->quote($this->
getLocation(),
'text') .
"," .
742 "tutor_name = " . $this->db->quote($this->
getName(),
'text') .
", " .
743 "tutor_phone = " . $this->db->quote($this->
getPhone(),
'text') .
", " .
744 "tutor_email = " . $this->db->quote($this->
getEmail(),
'text') .
", " .
745 "details = " . $this->db->quote($this->
getDetails(),
'text') .
", " .
753 'show_members = ' . $this->db->quote($this->
getShowMembers(),
'integer') .
', ' .
758 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
761 $ilAppEventHandler->raise(
764 array(
'object' => $this,
765 'obj_id' => $this->
getId(),
777 public function delete()
784 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
786 if (!parent::delete()) {
793 $query =
"DELETE FROM event " .
794 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
797 include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
800 include_once(
'./Modules/Session/classes/class.ilEventItems.php');
803 include_once(
'./Modules/Session/classes/class.ilEventParticipants.php');
806 foreach ($this->
getFiles() as $file) {
810 $ilAppEventHandler->raise(
813 array(
'object' => $this,
814 'obj_id' => $this->
getId(),
833 $query =
"SELECT * FROM event WHERE " .
834 "obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
839 $this->
setName($row->tutor_name);
853 $this->event_id = $row->event_id;
870 include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
883 include_once(
'./Modules/Session/classes/class.ilSessionFile.php');
897 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php');
910 $app->setFullday($sess_app->isFullday());
911 $app->setStart($sess_app->getStart());
912 $app->setEnd($sess_app->getEnd());
932 $this->session_logger->debug(
'Waiting list or auto fill is disabled.');
937 $current = $parts->getCountParticipants();
940 if ($max <= $current) {
941 $this->session_logger->debug(
'Maximum number of participants not reached.');
942 $this->session_logger->debug(
'Maximum number of members: ' . $max);
943 $this->session_logger->debug(
'Current number of members: ' . $current);
948 foreach ($session_waiting_list->getUserIds() as $user_id) {
951 $this->session_logger->warning(
'Found invalid user id on waiting list: ' . $user_id);
954 if (in_array($user_id, $parts->getParticipants())) {
955 $this->session_logger->notice(
'User on waiting list already session member: ' . $user_id);
960 $this->session_logger->debug(
'Registration enabled: register user');
961 $parts->register($user_id);
962 $parts->sendNotification(
967 $this->session_logger->debug(
'Registration disabled: set user status to participated.');
968 $parts->getEventParticipants()->updateParticipation($user_id,
true);
969 $parts->sendNotification(
975 $session_waiting_list->removeFromList($user_id);
978 if ($current >= $max) {
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_TRANSLATION_NONE
Apointment templates are used for automatic generated apointments.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
static lookupTemplateId($a_ref_id)
Lookup template id @global ilDB $ilDB.
static _delete($a_event_id)
static _deleteByEvent($a_event_id)
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
getFirstAppointment()
get first appointment
const LOCAL_ROLE_PARTICIPANT_PREFIX
enabledRegistration()
is registration enabled
getShowMembers()
Member gallery enabled.
getEnableMap()
ALways disabled.
static _lookupRegistrationEnabled($a_obj_id)
lookup registration enabled
getMailToMembersType()
Get mail to members type.
setLocation($a_location)
set location
setEmail($a_email)
set email
$registrationNotificationEnabled
setRegistrationNotificationOption($value)
getLocation()
get location
$reg_waiting_list_autofill
initDefaultRoles()
Create local session participant role.
getRegistrationNotificationOption()
update($a_skip_meta_update=false)
update object
getEventId()
sget event id
setRegistrationType($a_type)
setRegistrationMinUsers($a_users)
initAppointments()
init appointments
setPhone($a_phone)
set phone
setDetails($a_details)
set details
getAppointments()
get appointments
prepareCalendarAppointments($a_mode='create')
Prepare calendar appointments.
setAppointments($appointments)
set appointments
setWaitingListAutoFill($a_value)
setMailToMembersType($a_type)
Set mail to members type.
cloneDependencies($a_target_id, $a_copy_id)
Clone dependencies.
setRegistrationNotificationEnabled($value)
getPresentationTitle()
get title (overwritten from base class)
setShowMembers($a_status)
Show members gallery.
getRegistrationMinUsers()
isRegistrationNotificationEnabled()
enableRegistrationUserLimit($a_limit)
cloneSettings(ilObjSession $new_obj)
clone settings
static lookupSession($a_obj_id)
Get session data.
getPresentationTitleAppointmentPeriod()
initParticipants()
init participants object
create($a_skip_meta_data=false)
create new session
getMembersObject()
Get members objects.
isRegistrationUserLimitEnabled()
getRegistrationMaxUsers()
enableRegistrationWaitingList($a_stat)
addAppointment($appointment)
add appointment
handleAutoFill()
Handle auto fill for session members.
hasTutorSettings()
check if there any tutor settings
isRegistrationWaitingListEnabled()
setRegistrationMaxUsers($a_users)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObject Basic functions for all objects.
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)
cloneMetaData($target_obj)
Copy meta data.
getId()
get object id @access public
getTitle()
get object title @access public
class ilSessionAppointment
static _readAppointmentsBySession($a_event_id)
static _deleteBySession($a_event_id)
const NOTIFICATION_INHERIT_OPTION
static _readFilesByEvent($a_event_id)
const TYPE_ACCEPTED_SUBSCRIPTION_MEMBER
Session participation handling.
static _getInstanceByObjId($a_obj_id)
Get instance.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
foreach($_POST as $key=> $value) $res