5include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
6include_once
'./Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
79 public function __construct($a_id = 0, $a_call_by_reference =
true)
85 $this->session_logger =
$GLOBALS[
'DIC']->logger()->sess();
106 $query =
"SELECT reg_type FROM event " .
107 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
126 $query =
"SELECT * FROM event " .
127 "WHERE obj_id = " .
$ilDB->quote($a_obj_id);
130 $data[
'location'] = $row->location ? $row->location :
'';
131 $data[
'details'] = $row->details ? $row->details :
'';
132 $data[
'name'] = $row->tutor_name ? $row->tutor_name :
'';
133 $data[
'email'] = $row->tutor_email ? $row->tutor_email :
'';
134 $data[
'phone'] = $row->tutor_phone ? $row->tutor_phone :
'';
136 return (array)
$data;
176 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
178 self::LOCAL_ROLE_PARTICIPANT_PREFIX .
'_' . $this->
getRefId(),
179 'Participant of session obj_no.' . $this->
getId(),
180 self::LOCAL_ROLE_PARTICIPANT_PREFIX,
185 $this->session_logger->warning(
'Could not create default session role.');
210 $this->location = $a_location;
232 $this->name = $a_name;
254 $this->phone = $a_phone;
277 $this->email = $a_email;
298 return strlen($this->
getName()) or
312 $this->details = $a_details;
328 $this->reg_type = $a_type;
343 $this->reg_limited = $a_limit;
353 $this->reg_min_users = $a_users;
363 $this->reg_limited_users = $a_users;
373 $this->reg_waiting_list = $a_stat;
378 $this->reg_waiting_list_autofill = (bool) $a_value;
392 $this->show_members = (bool) $a_status;
418 return $this->registrationNotificationEnabled = $value;
434 $this->notificationOption = $value;
468 $this->show_cannot_participate_option = $status;
479 return $this->appointments ? $this->appointments : array();
491 $this->appointments[] = $appointment;
514 return is_object($this->appointments[0]) ? $this->appointments[0] : ($this->appointments[0] =
new ilSessionAppointment());
526 return $this->files ? $this->files : array();
536 $this->mail_members = $a_type;
565 $ilErr->appendMessage($this->lng->txt(
"sess_max_members_needed"));
580 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
585 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
588 $new_obj->applyDidacticTemplate($dtpl);
598 $new_obj->setAppointments(array($new_app));
599 $new_obj->update(
true);
602 foreach ($this->files as $file) {
603 $file->cloneFiles($new_obj->getEventId());
611 include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
613 $obj_settings->cloneSettings($new_obj->getId());
614 unset($obj_settings);
673 $ilObjDataCache =
$DIC[
'ilObjDataCache'];
675 parent::cloneDependencies($a_target_id, $a_copy_id);
677 $target_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
679 include_once(
'./Modules/Session/classes/class.ilEventItems.php');
681 $session_materials->cloneItems($this->
getId(), $a_copy_id);
693 public function create($a_skip_meta_data =
false)
700 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
704 if (!$a_skip_meta_data) {
708 $next_id =
$ilDB->nextId(
'event');
709 $query =
"INSERT INTO event (event_id,obj_id,location,tutor_name,tutor_phone,tutor_email,details,registration, " .
710 'reg_type, reg_limit_users, reg_limited, reg_waiting_list, reg_min_users, reg_auto_wait,show_members,mail_members,
711 reg_notification, notification_opt, show_cannot_part) ' .
713 $ilDB->quote($next_id,
'integer') .
", " .
714 $this->db->quote($this->
getId(),
'integer') .
", " .
715 $this->db->quote($this->
getLocation(),
'text') .
"," .
716 $this->db->quote($this->
getName(),
'text') .
", " .
717 $this->db->quote($this->
getPhone(),
'text') .
", " .
718 $this->db->quote($this->
getEmail(),
'text') .
", " .
719 $this->db->quote($this->
getDetails(),
'text') .
"," .
734 $this->event_id = $next_id;
736 $ilAppEventHandler->raise(
739 array(
'object' => $this,
740 'obj_id' => $this->
getId(),
744 return $this->
getId();
754 public function update($a_skip_meta_update =
false)
761 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
763 if (!parent::update()) {
766 if (!$a_skip_meta_update) {
770 $query =
"UPDATE event SET " .
771 "location = " . $this->db->quote($this->
getLocation(),
'text') .
"," .
772 "tutor_name = " . $this->db->quote($this->
getName(),
'text') .
", " .
773 "tutor_phone = " . $this->db->quote($this->
getPhone(),
'text') .
", " .
774 "tutor_email = " . $this->db->quote($this->
getEmail(),
'text') .
", " .
775 "details = " . $this->db->quote($this->
getDetails(),
'text') .
", " .
783 'show_members = ' . $this->db->quote($this->
getShowMembers(),
'integer') .
', ' .
789 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
792 $ilAppEventHandler->raise(
795 array(
'object' => $this,
796 'obj_id' => $this->
getId(),
808 public function delete()
815 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
817 if (!parent::delete()) {
824 $query =
"DELETE FROM event " .
825 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
828 include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
831 include_once(
'./Modules/Session/classes/class.ilEventItems.php');
834 include_once(
'./Modules/Session/classes/class.ilEventParticipants.php');
837 foreach ($this->
getFiles() as $file) {
841 $ilAppEventHandler->raise(
844 array(
'object' => $this,
845 'obj_id' => $this->
getId(),
864 $query =
"SELECT * FROM event WHERE " .
865 "obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
870 $this->
setName($row->tutor_name);
885 $this->event_id = $row->event_id;
902 include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
915 include_once(
'./Modules/Session/classes/class.ilSessionFile.php');
934 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php');
947 $app->setFullday($sess_app->isFullday());
948 $app->setStart($sess_app->getStart());
949 $app->setEnd($sess_app->getEnd());
969 $this->session_logger->debug(
'Waiting list or auto fill is disabled.');
974 $current = $parts->getCountParticipants();
977 if ($max <= $current) {
978 $this->session_logger->debug(
'Maximum number of participants not reached.');
979 $this->session_logger->debug(
'Maximum number of members: ' . $max);
980 $this->session_logger->debug(
'Current number of members: ' . $current);
985 foreach ($session_waiting_list->getUserIds() as $user_id) {
988 $this->session_logger->warning(
'Found invalid user id on waiting list: ' . $user_id);
991 if (in_array($user_id, $parts->getParticipants())) {
992 $this->session_logger->notice(
'User on waiting list already session member: ' . $user_id);
997 $this->session_logger->debug(
'Registration enabled: register user');
998 $parts->register($user_id);
999 $parts->sendNotification(
1004 $this->session_logger->debug(
'Registration disabled: set user status to participated.');
1005 $parts->getEventParticipants()->updateParticipation($user_id,
true);
1006 $parts->sendNotification(
1012 $session_waiting_list->removeFromList($user_id);
1015 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
enableCannotParticipateOption(bool $status)
setRegistrationNotificationOption($value)
isCannotParticipateOptionEnabled()
getLocation()
get location
$reg_waiting_list_autofill
initDefaultRoles()
Create local session participant role.
enabledRegistrationForUsers()
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)
$show_cannot_participate_option
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
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