20 declare(strict_types=1);
40 $this->
logger = $DIC->logger()->sess();
54 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
56 if ($a_entity ===
'sess_item') {
59 return "http://www.ilias.de/xml/Modules/Session/" . $a_entity;
62 protected function getTypes(
string $a_entity,
string $a_version): array
64 if ($a_entity ==
"sess") {
70 "Description" =>
"text",
72 "TutorName" =>
"text",
73 "TutorEmail" =>
"text",
74 "TutorPhone" =>
"text",
76 "Registration" =>
"integer",
77 "EventStart" =>
"text",
79 "StartingTime" =>
"integer",
80 "EndingTime" =>
"integer",
81 "Fulltime" =>
"integer" 87 "Description" =>
"text",
89 "TutorName" =>
"text",
90 "TutorEmail" =>
"text",
91 "TutorPhone" =>
"text",
93 "Registration" =>
"integer",
94 "EventStart" =>
"text",
96 "StartingTime" =>
"integer",
97 "EndingTime" =>
"integer",
98 "Fulltime" =>
"integer",
99 "LimitedRegistration" =>
"integer",
100 "WaitingList" =>
"integer",
101 "LimitUsers" =>
"integer" 107 "Description" =>
"text",
108 "Location" =>
"text",
109 "TutorName" =>
"text",
110 "TutorEmail" =>
"text",
111 "TutorPhone" =>
"text",
113 "Registration" =>
"integer",
114 "EventStart" =>
"text",
115 "EventEnd" =>
"text",
116 "StartingTime" =>
"integer",
117 "EndingTime" =>
"integer",
118 "Fulltime" =>
"integer",
119 "LimitedRegistration" =>
"integer",
120 "WaitingList" =>
"integer",
121 "AutoWait" =>
"integer",
122 "LimitUsers" =>
"integer",
123 "MinUsers" =>
"integer" 129 "Description" =>
"text",
130 "Location" =>
"text",
131 "TutorName" =>
"text",
132 "TutorEmail" =>
"text",
133 "TutorPhone" =>
"text",
135 "Registration" =>
"integer",
136 "EventStart" =>
"text",
137 "EventEnd" =>
"text",
138 "StartingTime" =>
"integer",
139 "EndingTime" =>
"integer",
140 "Fulltime" =>
"integer",
141 "LimitedRegistration" =>
"integer",
142 "WaitingList" =>
"integer",
143 "AutoWait" =>
"integer",
144 "LimitUsers" =>
"integer",
145 "MinUsers" =>
"integer",
146 'MailMembers' =>
'integer',
147 'ShowMembers' =>
'integer',
156 "Description" =>
"text",
157 "Location" =>
"text",
158 "TutorName" =>
"text",
159 "TutorEmail" =>
"text",
160 "TutorPhone" =>
"text",
162 "Registration" =>
"integer",
163 "EventStart" =>
"text",
164 "EventEnd" =>
"text",
165 "StartingTime" =>
"integer",
166 "EndingTime" =>
"integer",
167 "Fulltime" =>
"integer",
168 "LimitedRegistration" =>
"integer",
169 "WaitingList" =>
"integer",
170 "AutoWait" =>
"integer",
171 "LimitUsers" =>
"integer",
172 "MinUsers" =>
"integer",
173 'MailMembers' =>
'integer',
174 'ShowMembers' =>
'integer',
176 'ShowCannotPart' =>
'integer',
177 'RegistrationNotificationEnabled' =>
'integer',
178 'RegistrationNotificationOption' =>
'text' 183 if ($a_entity ==
"sess_item") {
184 switch ($a_version) {
193 "SessionId" =>
"integer",
202 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
206 if ($a_entity ==
"sess") {
207 switch ($a_version) {
210 " location, tutor_name, tutor_email, tutor_phone, details, registration, " .
211 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
212 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
213 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
215 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
219 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
220 " reg_limited limited_registration, reg_waiting_list waiting_list, " .
221 " reg_limit_users limit_users, " .
222 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
223 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
224 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
225 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
227 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
231 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
232 " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
233 " reg_limit_users limit_users, reg_min_users min_users, " .
234 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
235 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
236 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
237 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
239 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
243 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
244 " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
245 " reg_limit_users limit_users, reg_min_users min_users, " .
246 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime, mail_members, show_members " .
247 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
248 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
249 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
251 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
259 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
260 " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
261 " reg_limit_users limit_users, reg_min_users min_users, " .
262 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime, mail_members, show_members, " .
263 " show_cannot_part, reg_notification registration_notification_enabled, " .
264 " notification_opt registration_notification_option " .
265 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
266 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
267 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
269 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
276 if ($a_entity ==
"sess_item") {
277 switch ($a_version) {
286 " FROM event_items " .
288 $ilDB->in(
"event_id", $a_ids,
false,
"integer"));
294 public function getXmlRecord(
string $a_entity,
string $a_version, array $a_set): array
296 if ($a_entity ==
"sess") {
298 if (!$a_set[
"Fulltime"]) {
300 #$start = new ilDateTime($a_set["EventStart"], IL_CAL_DATETIME); 301 #$a_set["EventStart"] = $start->get(IL_CAL_DATETIME,'','UTC'); 302 #$end = new ilDateTime($a_set["EventEnd"], IL_CAL_DATETIME); 303 #$a_set["EventEnd"] = $end->get(IL_CAL_DATETIME,'','UTC'); 306 if ($a_entity ==
"sess_item") {
316 ?array $a_rec = null,
322 "sess_item" => array(
"ids" => ($a_rec[
"Id"] ??
''))
333 if ($new_id = $a_mapping->
getMapping(
'components/ILIAS/Container',
'objs', $a_rec[
'Id'])) {
337 $this->
logger->debug(
'Session creation without existing instance');
339 $newObj->setType(
"sess");
340 $newObj->create(
true);
342 $newObj->setTitle((
string) ($a_rec[
"Title"] ??
''));
343 $newObj->setDescription((
string) ($a_rec[
"Description"] ??
''));
344 $newObj->setLocation((
string) ($a_rec[
"Location"] ??
''));
345 $newObj->setName((
string) ($a_rec[
"TutorName"] ??
''));
346 $newObj->setPhone((
string) ($a_rec[
"TutorPhone"] ??
''));
347 $newObj->setEmail((
string) ($a_rec[
"TutorEmail"] ??
''));
348 $newObj->setDetails((
string) ($a_rec[
"Details"] ??
''));
350 switch ($a_schema_version) {
354 if (isset($a_rec[
'MailMembers'])) {
355 $newObj->setMailToMembersType((
int) $a_rec[
'MailMembers']);
357 if (isset($a_rec[
'ShowMembers'])) {
358 $newObj->setShowMembers((
bool) $a_rec[
'ShowMembers']);
360 if (isset($a_rec[
'ShowCannotPart'])) {
361 $newObj->enableCannotParticipateOption((
bool) $a_rec[
'ShowCannotPart']);
363 if (isset($a_rec[
'RegistrationNotificationEnabled'])) {
364 $newObj->setRegistrationNotificationEnabled((
bool) $a_rec[
'RegistrationNotificationEnabled']);
366 if (isset($a_rec[
'RegistrationNotificationOption'])) {
367 $newObj->setRegistrationNotificationOption((
string) $a_rec[
'RegistrationNotificationOption']);
374 $newObj->setRegistrationType((
int) ($a_rec[
"Registration"] ?? 0));
376 $newObj->enableRegistrationUserLimit((
int) ($a_rec[
"LimitedRegistration"] ?? 0));
377 $newObj->setRegistrationMaxUsers((
int) ($a_rec[
"LimitUsers"] ?? 0));
378 $newObj->enableRegistrationWaitingList((
bool) ($a_rec[
"WaitingList"] ??
false));
380 if (isset($a_rec[
"MinUsers"])) {
381 $newObj->setRegistrationMinUsers((
int) ($a_rec[
"MinUsers"] ?? 0));
384 if (isset($a_rec[
"AutoWait"])) {
385 $newObj->setWaitingListAutoFill((
bool) ($a_rec[
"AutoWait"] ??
false));
390 $newObj->update(
true);
395 $app->setStart($start);
399 $app->toggleFullTime((
bool) ($a_rec[
"Fulltime"] ??
false));
400 $app->setSessionId($newObj->getId());
403 $this->current_obj = $newObj;
404 $a_mapping->
addMapping(
"components/ILIAS/Session",
"sess", $a_rec[
"Id"], (
string) $newObj->getId());
405 $a_mapping->
addMapping(
'components/ILIAS/ILIASObject',
'objs', $a_rec[
'Id'], (
string) $newObj->getId());
406 $a_mapping->
addMapping(
'components/ILIAS/AdvancedMetaData',
'parent', $a_rec[
'Id'], (
string) $newObj->getId());
408 "components/ILIAS/MetaData",
410 $a_rec[
"Id"] .
":0:sess",
411 $newObj->getId() .
":0:sess" 416 if ($obj_id = $a_mapping->
getMapping(
'components/ILIAS/Container',
'objs', $a_rec[
'ItemId'])) {
433 foreach ($a_obj_ids as $obj_id) {
435 foreach ($ref_ids as
$ref_id) {
437 $this->data[$counter++][
'Type'] = $tpl_id;
445 $this->
logger->debug(
'Apply didactic template');
448 $this->
logger->debug(
'Default permissions');
454 foreach ($templates as $template) {
455 if ($template->isAutoGenerated()) {
456 $this->
logger->debug(
'Apply first auto generated');
readData(string $a_entity, string $a_version, array $a_ids)
applyDidacticTemplate(int $tpl_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
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)
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...