19 declare(strict_types=1);
39 $this->
logger = $DIC->logger()->sess();
53 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
55 if ($a_entity ===
'sess_item') {
58 return "http://www.ilias.de/xml/Modules/Session/" . $a_entity;
61 protected function getTypes(
string $a_entity,
string $a_version): array
63 if ($a_entity ==
"sess") {
69 "Description" =>
"text",
71 "TutorName" =>
"text",
72 "TutorEmail" =>
"text",
73 "TutorPhone" =>
"text",
75 "Registration" =>
"integer",
76 "EventStart" =>
"text",
78 "StartingTime" =>
"integer",
79 "EndingTime" =>
"integer",
80 "Fulltime" =>
"integer" 86 "Description" =>
"text",
88 "TutorName" =>
"text",
89 "TutorEmail" =>
"text",
90 "TutorPhone" =>
"text",
92 "Registration" =>
"integer",
93 "EventStart" =>
"text",
95 "StartingTime" =>
"integer",
96 "EndingTime" =>
"integer",
97 "Fulltime" =>
"integer",
98 "LimitedRegistration" =>
"integer",
99 "WaitingList" =>
"integer",
100 "LimitUsers" =>
"integer" 106 "Description" =>
"text",
107 "Location" =>
"text",
108 "TutorName" =>
"text",
109 "TutorEmail" =>
"text",
110 "TutorPhone" =>
"text",
112 "Registration" =>
"integer",
113 "EventStart" =>
"text",
114 "EventEnd" =>
"text",
115 "StartingTime" =>
"integer",
116 "EndingTime" =>
"integer",
117 "Fulltime" =>
"integer",
118 "LimitedRegistration" =>
"integer",
119 "WaitingList" =>
"integer",
120 "AutoWait" =>
"integer",
121 "LimitUsers" =>
"integer",
122 "MinUsers" =>
"integer" 128 "Description" =>
"text",
129 "Location" =>
"text",
130 "TutorName" =>
"text",
131 "TutorEmail" =>
"text",
132 "TutorPhone" =>
"text",
134 "Registration" =>
"integer",
135 "EventStart" =>
"text",
136 "EventEnd" =>
"text",
137 "StartingTime" =>
"integer",
138 "EndingTime" =>
"integer",
139 "Fulltime" =>
"integer",
140 "LimitedRegistration" =>
"integer",
141 "WaitingList" =>
"integer",
142 "AutoWait" =>
"integer",
143 "LimitUsers" =>
"integer",
144 "MinUsers" =>
"integer",
145 'MailMembers' =>
'integer',
146 'ShowMembers' =>
'integer',
155 "Description" =>
"text",
156 "Location" =>
"text",
157 "TutorName" =>
"text",
158 "TutorEmail" =>
"text",
159 "TutorPhone" =>
"text",
161 "Registration" =>
"integer",
162 "EventStart" =>
"text",
163 "EventEnd" =>
"text",
164 "StartingTime" =>
"integer",
165 "EndingTime" =>
"integer",
166 "Fulltime" =>
"integer",
167 "LimitedRegistration" =>
"integer",
168 "WaitingList" =>
"integer",
169 "AutoWait" =>
"integer",
170 "LimitUsers" =>
"integer",
171 "MinUsers" =>
"integer",
172 'MailMembers' =>
'integer',
173 'ShowMembers' =>
'integer',
175 'ShowCannotPart' =>
'integer',
176 'RegistrationNotificationEnabled' =>
'integer',
177 'RegistrationNotificationOption' =>
'text' 182 if ($a_entity ==
"sess_item") {
183 switch ($a_version) {
192 "SessionId" =>
"integer",
201 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
205 if ($a_entity ==
"sess") {
206 switch ($a_version) {
209 " location, tutor_name, tutor_email, tutor_phone, details, registration, " .
210 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
211 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
212 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
214 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
218 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
219 " reg_limited limited_registration, reg_waiting_list waiting_list, " .
220 " reg_limit_users limit_users, " .
221 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
222 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
223 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
224 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
226 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
230 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
231 " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
232 " reg_limit_users limit_users, reg_min_users min_users, " .
233 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
234 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
235 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
236 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
238 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
242 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
243 " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
244 " reg_limit_users limit_users, reg_min_users min_users, " .
245 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime, mail_members, show_members " .
246 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
247 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
248 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
250 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
258 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
259 " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
260 " reg_limit_users limit_users, reg_min_users min_users, " .
261 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime, mail_members, show_members, " .
262 " show_cannot_part, reg_notification registration_notification_enabled, " .
263 " notification_opt registration_notification_option " .
264 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
265 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
266 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
268 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
275 if ($a_entity ==
"sess_item") {
276 switch ($a_version) {
285 " FROM event_items " .
287 $ilDB->in(
"event_id", $a_ids,
false,
"integer"));
293 public function getXmlRecord(
string $a_entity,
string $a_version, array $a_set): array
295 if ($a_entity ==
"sess") {
297 if (!$a_set[
"Fulltime"]) {
299 #$start = new ilDateTime($a_set["EventStart"], IL_CAL_DATETIME); 300 #$a_set["EventStart"] = $start->get(IL_CAL_DATETIME,'','UTC'); 301 #$end = new ilDateTime($a_set["EventEnd"], IL_CAL_DATETIME); 302 #$a_set["EventEnd"] = $end->get(IL_CAL_DATETIME,'','UTC'); 305 if ($a_entity ==
"sess_item") {
315 ?array $a_rec =
null,
321 "sess_item" => array(
"ids" => ($a_rec[
"Id"] ??
''))
332 if ($new_id = $a_mapping->
getMapping(
'components/ILIAS/Container',
'objs', $a_rec[
'Id'])) {
336 $this->
logger->debug(
'Session creation without existing instance');
338 $newObj->setType(
"sess");
339 $newObj->create(
true);
341 $newObj->setTitle((
string) ($a_rec[
"Title"] ??
''));
342 $newObj->setDescription((
string) ($a_rec[
"Description"] ??
''));
343 $newObj->setLocation((
string) ($a_rec[
"Location"] ??
''));
344 $newObj->setName((
string) ($a_rec[
"TutorName"] ??
''));
345 $newObj->setPhone((
string) ($a_rec[
"TutorPhone"] ??
''));
346 $newObj->setEmail((
string) ($a_rec[
"TutorEmail"] ??
''));
347 $newObj->setDetails((
string) ($a_rec[
"Details"] ??
''));
349 switch ($a_schema_version) {
353 if (isset($a_rec[
'MailMembers'])) {
354 $newObj->setMailToMembersType((
int) $a_rec[
'MailMembers']);
356 if (isset($a_rec[
'ShowMembers'])) {
357 $newObj->setShowMembers((
bool) $a_rec[
'ShowMembers']);
359 if (isset($a_rec[
'ShowCannotPart'])) {
360 $newObj->enableCannotParticipateOption((
bool) $a_rec[
'ShowCannotPart']);
362 if (isset($a_rec[
'RegistrationNotificationEnabled'])) {
363 $newObj->setRegistrationNotificationEnabled((
bool) $a_rec[
'RegistrationNotificationEnabled']);
365 if (isset($a_rec[
'RegistrationNotificationOption'])) {
366 $newObj->setRegistrationNotificationOption((
string) $a_rec[
'RegistrationNotificationOption']);
373 $newObj->setRegistrationType((
int) ($a_rec[
"Registration"] ?? 0));
375 $newObj->enableRegistrationUserLimit((
int) ($a_rec[
"LimitedRegistration"] ?? 0));
376 $newObj->setRegistrationMaxUsers((
int) ($a_rec[
"LimitUsers"] ?? 0));
377 $newObj->enableRegistrationWaitingList((
bool) ($a_rec[
"WaitingList"] ??
false));
379 if (isset($a_rec[
"MinUsers"])) {
380 $newObj->setRegistrationMinUsers((
int) ($a_rec[
"MinUsers"] ?? 0));
383 if (isset($a_rec[
"AutoWait"])) {
384 $newObj->setWaitingListAutoFill((
bool) ($a_rec[
"AutoWait"] ??
false));
389 $newObj->update(
true);
394 $app->setStart($start);
398 $app->toggleFullTime((
bool) ($a_rec[
"Fulltime"] ??
false));
399 $app->setSessionId($newObj->getId());
402 $this->current_obj = $newObj;
403 $a_mapping->
addMapping(
"components/ILIAS/Session",
"sess", $a_rec[
"Id"], (
string) $newObj->getId());
404 $a_mapping->
addMapping(
'components/ILIAS/ILIASObject',
'objs', $a_rec[
'Id'], (
string) $newObj->getId());
405 $a_mapping->
addMapping(
'components/ILIAS/AdvancedMetaData',
'parent', $a_rec[
'Id'], (
string) $newObj->getId());
407 "components/ILIAS/MetaData",
409 $a_rec[
"Id"] .
":0:sess",
410 $newObj->getId() .
":0:sess" 415 if ($obj_id = $a_mapping->
getMapping(
'components/ILIAS/Container',
'objs', $a_rec[
'ItemId'])) {
432 foreach ($a_obj_ids as $obj_id) {
434 foreach ($ref_ids as
$ref_id) {
436 $this->data[$counter++][
'Type'] = $tpl_id;
444 $this->
logger->debug(
'Apply didactic template');
447 $this->
logger->debug(
'Default permissions');
453 foreach ($templates as $template) {
454 if ($template->isAutoGenerated()) {
455 $this->
logger->debug(
'Apply first auto generated');
readData(string $a_entity, string $a_version, array $a_ids)
applyDidacticTemplate(int $tpl_id)
applyDidacticTemplate(ilObject $rep_object, int $tpl_id)
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
static _getAllReferences(int $id)
get all reference ids for object ID
getXmlNamespace(string $a_entity, string $a_schema_version)
setTargetId(string $target_id)
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static lookupTemplateId(int $a_ref_id)
ilObjSession $current_obj
getMapping(string $a_comp, string $a_entity, string $a_old_id)
getXmlRecord(string $a_entity, string $a_version, array $a_set)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
getTypes(string $a_entity, string $a_version)
readDidacticTemplateType(array $a_obj_ids)
static getInstanceByObjectType(string $a_obj_type)
__construct(Container $dic, ilPlugin $plugin)
addItem(int $a_item_ref_id)
class ilSessionAppointment