5include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
6include_once
'./Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
55 public function __construct($a_id = 0, $a_call_by_reference =
true)
59 $this->session_logger =
$GLOBALS[
'DIC']->logger()->sess();
63 parent::__construct($a_id, $a_call_by_reference);
78 $query =
"SELECT reg_type FROM event " .
79 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
96 $query =
"SELECT * FROM event " .
97 "WHERE obj_id = " .
$ilDB->quote($a_obj_id);
106 return (array)
$data;
131 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
133 self::LOCAL_ROLE_PARTICIPANT_PREFIX .
'_' . $this->
getRefId(),
134 'Participant of session obj_no.' . $this->
getId(),
135 self::LOCAL_ROLE_PARTICIPANT_PREFIX,
140 $this->session_logger->warning(
'Could not create default session role.');
165 $this->location = $a_location;
187 $this->name = $a_name;
209 $this->phone = $a_phone;
232 $this->email = $a_email;
253 return strlen($this->
getName()) or
267 $this->details = $a_details;
298 $this->reg_limited = $a_limit;
308 $this->reg_min_users = $a_users;
318 $this->reg_limited_users = $a_users;
328 $this->reg_waiting_list = $a_stat;
333 $this->reg_waiting_list_autofill = (bool) $a_value;
360 return $this->appointments ? $this->appointments : array();
372 $this->appointments[] = $appointment;
395 return is_object($this->appointments[0]) ? $this->appointments[0] : ($this->appointments[0] =
new ilSessionAppointment());
407 return $this->files ? $this->files : array();
424 $ilErr->appendMessage($this->lng->txt(
"sess_max_members_needed"));
439 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
441 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
451 $new_obj->setAppointments(array($new_app));
452 $new_obj->update(
true);
455 foreach ($this->files as
$file) {
456 $file->cloneFiles($new_obj->getEventId());
464 include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
466 $obj_settings->cloneSettings($new_obj->getId());
467 unset($obj_settings);
509 global $ilObjDataCache;
511 parent::cloneDependencies($a_target_id, $a_copy_id);
513 $target_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
515 include_once(
'./Modules/Session/classes/class.ilEventItems.php');
517 $session_materials->cloneItems($this->
getId(), $a_copy_id);
529 public function create($a_skip_meta_data =
false)
532 global $ilAppEventHandler;
536 if (!$a_skip_meta_data) {
540 $next_id =
$ilDB->nextId(
'event');
541 $query =
"INSERT INTO event (event_id,obj_id,location,tutor_name,tutor_phone,tutor_email,details,registration, " .
542 'reg_type, reg_limit_users, reg_limited, reg_waiting_list, reg_min_users, reg_auto_wait) ' .
544 $ilDB->quote($next_id,
'integer') .
", " .
545 $this->db->quote($this->
getId(),
'integer') .
", " .
546 $this->db->quote($this->
getLocation(),
'text') .
"," .
547 $this->db->quote($this->
getName(),
'text') .
", " .
548 $this->db->quote($this->
getPhone(),
'text') .
", " .
549 $this->db->quote($this->
getEmail(),
'text') .
", " .
550 $this->db->quote($this->
getDetails(),
'text') .
"," .
560 $this->event_id = $next_id;
562 $ilAppEventHandler->raise(
565 array(
'object' => $this,
566 'obj_id' => $this->
getId(),
570 return $this->
getId();
580 public function update($a_skip_meta_update =
false)
583 global $ilAppEventHandler;
588 if (!$a_skip_meta_update) {
592 $query =
"UPDATE event SET " .
593 "location = " . $this->db->quote($this->
getLocation(),
'text') .
"," .
594 "tutor_name = " . $this->db->quote($this->
getName(),
'text') .
", " .
595 "tutor_phone = " . $this->db->quote($this->
getPhone(),
'text') .
", " .
596 "tutor_email = " . $this->db->quote($this->
getEmail(),
'text') .
", " .
597 "details = " . $this->db->quote($this->
getDetails(),
'text') .
", " .
605 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
608 $ilAppEventHandler->raise(
611 array(
'object' => $this,
612 'obj_id' => $this->
getId(),
624 public function delete()
627 global $ilAppEventHandler;
629 if (!parent::delete()) {
636 $query =
"DELETE FROM event " .
637 "WHERE obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
640 include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
643 include_once(
'./Modules/Session/classes/class.ilEventItems.php');
646 include_once(
'./Modules/Session/classes/class.ilEventParticipants.php');
653 $ilAppEventHandler->raise(
656 array(
'object' => $this,
657 'obj_id' => $this->
getId(),
676 $query =
"SELECT * FROM event WHERE " .
677 "obj_id = " . $this->db->quote($this->
getId(),
'integer') .
" ";
692 $this->event_id =
$row->event_id;
709 include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
722 include_once(
'./Modules/Session/classes/class.ilSessionFile.php');
736 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php');
744 $app->setTitle($this->
getTitle() ? $this->
getTitle() : $this->lng->txt(
'obj_sess'));
748 $app->setFullday($sess_app->isFullday());
749 $app->setStart($sess_app->getStart());
750 $app->setEnd($sess_app->getEnd());
770 $this->session_logger->debug(
'Waiting list or auto fill is disabled.');
775 $current = $parts->getCountParticipants();
779 $this->session_logger->debug(
'Maximum number of participants not reached.');
780 $this->session_logger->debug(
'Maximum number of members: ' . $max);
781 $this->session_logger->debug(
'Current number of members: ' .
$current);
786 foreach ($session_waiting_list->getUserIds() as $user_id) {
789 $this->session_logger->warning(
'Found invalid user id on waiting list: ' . $user_id);
792 if (in_array($user_id, $parts->getParticipants())) {
793 $this->session_logger->notice(
'User on waiting list already session member: ' . $user_id);
798 $this->session_logger->debug(
'Registration enabled: register user');
799 $parts->register($user_id);
800 $parts->sendNotification(
805 $this->session_logger->debug(
'Registration disabled: set user status to participated.');
806 $parts->getEventParticipants()->updateParticipation($user_id,
true);
807 $parts->sendNotification(
813 $session_waiting_list->removeFromList($user_id);
840 include_once(
'./Modules/Session/classes/class.ilSessionParticipants.php');
855 return $this->members_obj;
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 formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
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
static _lookupRegistrationEnabled($a_obj_id)
lookup registration enabled
getMailToMembersType()
Get mail to members type.
setLocation($a_location)
set location
setEmail($a_email)
set email
getLocation()
get location
$reg_waiting_list_autofill
initDefaultRoles()
Create local session participant role.
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)
cloneDependencies($a_target_id, $a_copy_id)
Clone dependencies.
getPresentationTitle()
get title (overwritten from base class)
getRegistrationMinUsers()
enableRegistrationUserLimit($a_limit)
cloneSettings(ilObjSession $new_obj)
clone settings
static lookupSession($a_obj_id)
Get session data.
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()
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone course (no member data)
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)
static _readFilesByEvent($a_event_id)
const TYPE_ACCEPTED_SUBSCRIPTION_MEMBER
static _getInstanceByObjId($a_obj_id)
Get instance.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
update($pash, $contents, Config $config)
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
foreach($_POST as $key=> $value) $res