20 declare(strict_types=1);
40 $this->
logger = $DIC->logger()->sess();
54 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
56 return "http://www.ilias.de/xml/Modules/Session/" . $a_entity;
59 protected function getTypes(
string $a_entity,
string $a_version): array
61 if ($a_entity ==
"sess") {
67 "Description" =>
"text",
69 "TutorName" =>
"text",
70 "TutorEmail" =>
"text",
71 "TutorPhone" =>
"text",
73 "Registration" =>
"integer",
74 "EventStart" =>
"text",
76 "StartingTime" =>
"integer",
77 "EndingTime" =>
"integer",
78 "Fulltime" =>
"integer" 84 "Description" =>
"text",
86 "TutorName" =>
"text",
87 "TutorEmail" =>
"text",
88 "TutorPhone" =>
"text",
90 "Registration" =>
"integer",
91 "EventStart" =>
"text",
93 "StartingTime" =>
"integer",
94 "EndingTime" =>
"integer",
95 "Fulltime" =>
"integer",
96 "LimitedRegistration" =>
"integer",
97 "WaitingList" =>
"integer",
98 "LimitUsers" =>
"integer" 104 "Description" =>
"text",
105 "Location" =>
"text",
106 "TutorName" =>
"text",
107 "TutorEmail" =>
"text",
108 "TutorPhone" =>
"text",
110 "Registration" =>
"integer",
111 "EventStart" =>
"text",
112 "EventEnd" =>
"text",
113 "StartingTime" =>
"integer",
114 "EndingTime" =>
"integer",
115 "Fulltime" =>
"integer",
116 "LimitedRegistration" =>
"integer",
117 "WaitingList" =>
"integer",
118 "AutoWait" =>
"integer",
119 "LimitUsers" =>
"integer",
120 "MinUsers" =>
"integer" 126 "Description" =>
"text",
127 "Location" =>
"text",
128 "TutorName" =>
"text",
129 "TutorEmail" =>
"text",
130 "TutorPhone" =>
"text",
132 "Registration" =>
"integer",
133 "EventStart" =>
"text",
134 "EventEnd" =>
"text",
135 "StartingTime" =>
"integer",
136 "EndingTime" =>
"integer",
137 "Fulltime" =>
"integer",
138 "LimitedRegistration" =>
"integer",
139 "WaitingList" =>
"integer",
140 "AutoWait" =>
"integer",
141 "LimitUsers" =>
"integer",
142 "MinUsers" =>
"integer",
143 'MailMembers' =>
'integer',
144 'ShowMembers' =>
'integer',
151 "Description" =>
"text",
152 "Location" =>
"text",
153 "TutorName" =>
"text",
154 "TutorEmail" =>
"text",
155 "TutorPhone" =>
"text",
157 "Registration" =>
"integer",
158 "EventStart" =>
"text",
159 "EventEnd" =>
"text",
160 "StartingTime" =>
"integer",
161 "EndingTime" =>
"integer",
162 "Fulltime" =>
"integer",
163 "LimitedRegistration" =>
"integer",
164 "WaitingList" =>
"integer",
165 "AutoWait" =>
"integer",
166 "LimitUsers" =>
"integer",
167 "MinUsers" =>
"integer",
168 'MailMembers' =>
'integer',
169 'ShowMembers' =>
'integer',
171 'ShowCannotPart' =>
'integer',
172 'RegistrationNotificationEnabled' =>
'integer',
173 'RegistrationNotificationOption' =>
'text' 178 if ($a_entity ==
"sess_item") {
179 switch ($a_version) {
186 "SessionId" =>
"integer",
195 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
199 if ($a_entity ==
"sess") {
200 switch ($a_version) {
203 " location, tutor_name, tutor_email, tutor_phone, details, registration, " .
204 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
205 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
206 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
208 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
211 $this->
getDirectDataFromQuery($q =
"SELECT ev.obj_id id, od.title title, odes.description description, " .
212 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
213 " reg_limited limited_registration, reg_waiting_list waiting_list, " .
214 " reg_limit_users limit_users, " .
215 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
216 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
217 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
218 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
220 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
223 $this->
getDirectDataFromQuery($q =
"SELECT ev.obj_id id, od.title title, odes.description description, " .
224 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
225 " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
226 " reg_limit_users limit_users, reg_min_users min_users, " .
227 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
228 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
229 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
230 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
232 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
235 $this->
getDirectDataFromQuery($q =
"SELECT ev.obj_id id, od.title title, odes.description description, " .
236 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
237 " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
238 " reg_limit_users limit_users, reg_min_users min_users, " .
239 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime, mail_members, show_members " .
240 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
241 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
242 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
244 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
249 $this->
getDirectDataFromQuery($q =
"SELECT ev.obj_id id, od.title title, odes.description description, " .
250 " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
251 " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
252 " reg_limit_users limit_users, reg_min_users min_users, " .
253 " e_start event_start, e_end event_end, starting_time, ending_time, fulltime, mail_members, show_members, " .
254 " show_cannot_part, reg_notification registration_notification_enabled, " .
255 " notification_opt registration_notification_option " .
256 " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
257 " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
258 " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
260 $ilDB->in(
"ev.obj_id", $a_ids,
false,
"integer"));
267 if ($a_entity ==
"sess_item") {
268 switch ($a_version) {
275 " FROM event_items " .
277 $ilDB->in(
"event_id", $a_ids,
false,
"integer"));
283 public function getXmlRecord(
string $a_entity,
string $a_version, array $a_set): array
285 if ($a_entity ==
"sess") {
287 if (!$a_set[
"Fulltime"]) {
289 #$start = new ilDateTime($a_set["EventStart"], IL_CAL_DATETIME); 290 #$a_set["EventStart"] = $start->get(IL_CAL_DATETIME,'','UTC'); 291 #$end = new ilDateTime($a_set["EventEnd"], IL_CAL_DATETIME); 292 #$a_set["EventEnd"] = $end->get(IL_CAL_DATETIME,'','UTC'); 295 if ($a_entity ==
"sess_item") {
305 ?array $a_rec = null,
311 "sess_item" => array(
"ids" => ($a_rec[
"Id"] ??
''))
322 if ($new_id = $a_mapping->
getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
326 $this->
logger->debug(
'Session creation without existing instance');
328 $newObj->setType(
"sess");
329 $newObj->create(
true);
331 $newObj->setTitle((
string) ($a_rec[
"Title"] ??
''));
332 $newObj->setDescription((
string) ($a_rec[
"Description"] ??
''));
333 $newObj->setLocation((
string) ($a_rec[
"Location"] ??
''));
334 $newObj->setName((
string) ($a_rec[
"TutorName"] ??
''));
335 $newObj->setPhone((
string) ($a_rec[
"TutorPhone"] ??
''));
336 $newObj->setEmail((
string) ($a_rec[
"TutorEmail"] ??
''));
337 $newObj->setDetails((
string) ($a_rec[
"Details"] ??
''));
339 switch ($a_schema_version) {
342 if (isset($a_rec[
'MailMembers'])) {
343 $newObj->setMailToMembersType((
int) $a_rec[
'MailMembers']);
345 if (isset($a_rec[
'ShowMembers'])) {
346 $newObj->setShowMembers((
bool) $a_rec[
'ShowMembers']);
348 if (isset($a_rec[
'ShowCannotPart'])) {
349 $newObj->enableCannotParticipateOption((
bool) $a_rec[
'ShowCannotPart']);
351 if (isset($a_rec[
'RegistrationNotificationEnabled'])) {
352 $newObj->setRegistrationNotificationEnabled((
bool) $a_rec[
'RegistrationNotificationEnabled']);
354 if (isset($a_rec[
'RegistrationNotificationOption'])) {
355 $newObj->setRegistrationNotificationOption((
string) $a_rec[
'RegistrationNotificationOption']);
361 $newObj->setRegistrationType((
int) ($a_rec[
"Registration"] ?? 0));
363 $newObj->enableRegistrationUserLimit((
int) ($a_rec[
"LimitedRegistration"] ?? 0));
364 $newObj->setRegistrationMaxUsers((
int) ($a_rec[
"LimitUsers"] ?? 0));
365 $newObj->enableRegistrationWaitingList((
bool) ($a_rec[
"WaitingList"] ??
false));
367 if (isset($a_rec[
"MinUsers"])) {
368 $newObj->setRegistrationMinUsers((
int) ($a_rec[
"MinUsers"] ?? 0));
371 if (isset($a_rec[
"AutoWait"])) {
372 $newObj->setWaitingListAutoFill((
bool) ($a_rec[
"AutoWait"] ??
false));
377 if (isset($a_rec[
'MailMembers'])) {
378 $newObj->setMailToMembersType((
int) ($a_rec[
'MailMembers'] ?? 0));
380 if (isset($a_rec[
'ShowMembers'])) {
381 $newObj->setShowMembers((
bool) ($a_rec[
'ShowMembers'] ??
false));
383 if (isset($a_rec[
'ShowCannotPart'])) {
384 $newObj->enableCannotParticipateOption((
bool) ($a_rec[
'show_cannot_part'] ??
false));
391 $newObj->update(
true);
396 $app->setStart($start);
400 $app->toggleFullTime((
bool) ($a_rec[
"Fulltime"] ??
false));
401 $app->setSessionId($newObj->getId());
404 $this->current_obj = $newObj;
405 $a_mapping->
addMapping(
"Modules/Session",
"sess", $a_rec[
"Id"], (
string) $newObj->getId());
406 $a_mapping->
addMapping(
'Services/Object',
'objs', $a_rec[
'Id'], (
string) $newObj->getId());
407 $a_mapping->
addMapping(
'Services/AdvancedMetaData',
'parent', $a_rec[
'Id'], (
string) $newObj->getId());
411 $a_rec[
"Id"] .
":0:sess",
412 $newObj->getId() .
":0:sess" 417 if ($obj_id = $a_mapping->
getMapping(
'Services/Container',
'objs', $a_rec[
'ItemId'])) {
434 foreach ($a_obj_ids as $obj_id) {
436 foreach ($ref_ids as
$ref_id) {
438 $this->data[$counter++][
'Type'] = $tpl_id;
446 $this->
logger->debug(
'Apply didactic template');
449 $this->
logger->debug(
'Default permissions');
455 foreach ($templates as $template) {
456 if ($template->isAutoGenerated()) {
457 $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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...