ILIAS  release_8 Revision v8.24
ilObjectActivation Class Reference

Class ilObjectActivation. More...

+ Collaboration diagram for ilObjectActivation:

Public Member Functions

 __construct ()
 
 setTimingType (int $type)
 
 getTimingType ()
 
 setTimingStart (?int $start)
 
 getTimingStart ()
 
 setTimingEnd (?int $end)
 
 getTimingEnd ()
 
 setSuggestionStart (?int $start)
 
 setSuggestionStartRelative (?int $start)
 
 setSuggestionEndRelative (int $end)
 
 setSuggestionEnd (?int $end)
 
 toggleVisible (bool $status)
 
 enabledVisible ()
 
 toggleChangeable (bool $status)
 
 enabledChangeable ()
 
 update (int $ref_id, ?int $parent_id=null)
 
 read (int $ref_id, int $parent_id=0)
 

Static Public Member Functions

static preloadData (array $ref_ids)
 Preload data to internal cache. More...
 
static getItem (int $ref_id)
 
static addAdditionalSubItemInformation (array &$item)
 Parse item data for list entries. More...
 
static addListGUIActivationProperty (ilObjectListGUI $list_gui, array &$item)
 Get timing details for list gui. More...
 
static deleteAllEntries (int $ref_id)
 Delete all db entries for ref id. More...
 
static cloneDependencies (int $ref_id, int $target_id, int $copy_id)
 
static hasTimings (int $ref_id)
 Check if there is any active timing (in subtree) More...
 
static hasChangeableTimings (int $ref_id)
 Check if there is any active changeable timing (in subtree) More...
 
static getItemsByEvent (int $event_id)
 Get session material / event items. More...
 
static getItemsByItemGroup (int $item_group_ref_id)
 Get materials of item group. More...
 
static getItemsByObjective (int $objective_id)
 Get objective items. More...
 
static getItems (int $parent_id, bool $with_list_data=true)
 Get sub item data. More...
 
static getTimingsAdministrationItems (int $parent_id)
 Get (sub) item data for timings administration view (active/inactive) More...
 
static getTimingsItems (int $container_ref_id)
 Get (sub) item data for timings view (no session material, no side blocks) More...
 

Data Fields

const ERR_SUG_START_END = 1
 
const TIMINGS_ACTIVATION = 0
 
const TIMINGS_DEACTIVATED = 1
 
const TIMINGS_PRESETTING = 2
 
const TIMINGS_FIXED = 3
 

Static Protected Member Functions

static createDefaultEntry (int $ref_id)
 Create db entry with default values. More...
 
static processListItems (array $ref_ids)
 Validate ref ids and add list data. More...
 

Protected Attributes

ilErrorHandling $error
 
ilLanguage $lng
 
ilDBInterface $db
 
int $timing_type = 0
 
int $timing_start = null
 
int $timing_end = null
 
int $suggestion_start = null
 
int $suggestion_end = null
 
bool $visible = false
 
int $changeable = 0
 
int $suggestion_start_rel = null
 
int $suggestion_end_rel = null
 

Static Protected Attributes

static array $preloaded_data = array()
 

Detailed Description

Class ilObjectActivation.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilCourseItems.php 30321 2011-08-22 12:05:03Z jluetzen

Definition at line 27 of file class.ilObjectActivation.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectActivation::__construct ( )

Definition at line 53 of file class.ilObjectActivation.php.

54 {
55 global $DIC;
56
57 $this->error = $DIC["ilErr"];
58 $this->lng = $DIC->language();
59 $this->db = $DIC->database();
60 }
error(string $a_errmsg)
global $DIC
Definition: feed.php:28

References $DIC, error(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAdditionalSubItemInformation()

static ilObjectActivation::addAdditionalSubItemInformation ( array &  $item)
static

Parse item data for list entries.

Definition at line 222 of file class.ilObjectActivation.php.

222 : void
223 {
224 global $DIC;
225 $ilUser = $DIC->user();
226
227 $item_array = self::getItem((int) $item['ref_id']);
228
229 $item['obj_id'] = ($item['obj_id'] > 0)
230 ? $item['obj_id']
231 : ilObject::_lookupObjId((int) $item['ref_id']);
232 $item['type'] = ($item['type'] != '')
233 ? $item['type']
234 : ilObject::_lookupType((int) $item['obj_id']);
235
236 $item['timing_type'] = $item_array['timing_type'] ?? 0;
237
238 if (($item_array['changeable'] ?? false) &&
239 $item_array['timing_type'] == self::TIMINGS_PRESETTING) {
240 // cognos-blu-patch: begin
241 $user_data = new ilTimingUser((int) $item['ref_id'], $ilUser->getId());
242 if ($user_data->isScheduled()) {
243 $item['start'] = $user_data->getStart()->get(IL_CAL_UNIX);
244 $item['end'] = $user_data->getEnd()->get(IL_CAL_UNIX);
245 $item['activation_info'] = 'crs_timings_planed_info';
246 } else {
247 $item['start'] = $item_array['suggestion_start'] ?? "";
248 $item['end'] = $item_array['suggestion_end'] ?? "";
249 $item['activation_info'] = 'crs_timings_suggested_info';
250 }
251 // cognos-blu-patch: end
252 } elseif (($item_array['timing_type'] ?? 0) == self::TIMINGS_PRESETTING) {
253 $item['start'] = $item_array['suggestion_start'] ?? "";
254 $item['end'] = $item_array['suggestion_end'] ?? "";
255 $item['activation_info'] = 'crs_timings_suggested_info';
256 } elseif (($item_array['timing_type'] ?? 0) == self::TIMINGS_ACTIVATION) {
257 $item['start'] = $item_array['timing_start'] ?? "";
258 $item['end'] = $item_array['timing_end'] ?? "";
259 $item['activation_info'] = 'obj_activation_list_gui';
260 } else {
261 $item['start'] = 'abc';
262 }
263
264 // #7359 - session sorting should always base on appointment date
265 if ($item['type'] == 'sess') {
266 $info = ilSessionAppointment::_lookupAppointment((int) $item['obj_id']);
267 // #11987
268 $item['masked_start'] = $item['start'];
269 $item['masked_end'] = $item['end'] ?? "";
270 $item['start'] = $info['start'] ?? '';
271 $item['end'] = $info['end'] ?? '';
272 }
273 }
const IL_CAL_UNIX
static getItem(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupAppointment(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ilUser
Definition: imgupload.php:34

References $DIC, $ilUser, ilSessionAppointment\_lookupAppointment(), ilObject\_lookupObjId(), ilObject\_lookupType(), getItem(), IL_CAL_UNIX, and TIMINGS_PRESETTING.

Referenced by ilObjCategory\addAdditionalSubItemInformation(), ilObjCourse\addAdditionalSubItemInformation(), ilObjFolder\addAdditionalSubItemInformation(), ilObjGroup\addAdditionalSubItemInformation(), ilObjRootFolder\addAdditionalSubItemInformation(), addListGUIActivationProperty(), getItems(), and processListItems().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addListGUIActivationProperty()

static ilObjectActivation::addListGUIActivationProperty ( ilObjectListGUI  $list_gui,
array &  $item 
)
static

Get timing details for list gui.

Definition at line 278 of file class.ilObjectActivation.php.

278 : void
279 {
281 if (isset($item['timing_type'])) {
282 if (!isset($item['masked_start'])) {
283 $start = $item['start'] ?? 0;
284 $end = $item['end'] ?? 0;
285 } else {
286 $start = $item['masked_start'];
287 $end = $item['masked_end'];
288 }
289 $activation = '';
290 switch ($item['timing_type']) {
293 new ilDateTime($start, IL_CAL_UNIX),
294 new ilDateTime($end, IL_CAL_UNIX)
295 );
296 break;
297
300 new ilDate($start, IL_CAL_UNIX),
301 new ilDate($end, IL_CAL_UNIX)
302 );
303 break;
304 }
305 if ($activation != "") {
306 global $DIC;
307
308 $lng = $DIC->language();
309 $lng->loadLanguageModule('crs');
310
311 $list_gui->addCustomProperty(
312 $lng->txt($item['activation_info']),
313 $activation,
314 false,
315 true
316 );
317 }
318 }
319 }
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
Class for single dates.
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static addAdditionalSubItemInformation(array &$item)
Parse item data for list entries.
addCustomProperty(string $property="", string $value="", bool $alert=false, bool $newline=false)

References $DIC, $lng, addAdditionalSubItemInformation(), ilObjectListGUI\addCustomProperty(), ilDatePresentation\formatPeriod(), IL_CAL_UNIX, ilLanguage\loadLanguageModule(), TIMINGS_ACTIVATION, TIMINGS_PRESETTING, and ilLanguage\txt().

Referenced by ilSearchResultTableGUI\fillRow(), ilPDSelectedItemsBlockGUI\getCardForData(), ilPDSelectedItemsBlockGUI\getListItemForData(), ilPDSelectedItemsBlockGUI\getListItemGroups(), ilObjSessionGUI\modifyItemGUI(), and ilContainerContentGUI\renderItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneDependencies()

static ilObjectActivation::cloneDependencies ( int  $ref_id,
int  $target_id,
int  $copy_id 
)
static

Definition at line 414 of file class.ilObjectActivation.php.

414 : void
415 {
416 global $DIC;
417
418 $ilLog = $DIC["ilLog"];
419
420 $ilLog->write(__METHOD__ . ': Begin course items...' . $ref_id);
421
422 $items = self::getItems($ref_id, false);
423 if (!$items) {
424 $ilLog->write(__METHOD__ . ': No course items found.');
425 return;
426 }
427
428 // new course item object
429 if (!is_object(ilObjectFactory::getInstanceByRefId($target_id, false))) {
430 $ilLog->write(__METHOD__ . ': Cannot create target object.');
431 return;
432 }
433
434 $cp_options = ilCopyWizardOptions::_getInstance($copy_id);
435 $mappings = $cp_options->getMappings();
436
437 foreach ($items as $item) {
438 if (!isset($mappings[$item['parent_id']]) or !$mappings[$item['parent_id']]) {
439 $ilLog->write(__METHOD__ . ': No mapping for parent nr. ' . $item['parent_id']);
440 continue;
441 }
442 if (!isset($mappings[$item['obj_id']]) or !$mappings[$item['obj_id']]) {
443 $ilLog->write(__METHOD__ . ': No mapping for item nr. ' . $item['obj_id']);
444 continue;
445 }
446 $new_item_id = $mappings[$item['obj_id']];
447 $new_parent = $mappings[$item['parent_id']];
448
449 $new_item = new self();
450 $new_item->setTimingType((int) $item['timing_type']);
451 $new_item->setTimingStart((int) $item['timing_start']);
452 $new_item->setTimingEnd((int) $item['timing_end']);
453 $new_item->setSuggestionStart((int) $item['suggestion_start']);
454 $new_item->setSuggestionEnd((int) $item['suggestion_end']);
455 $new_item->toggleChangeable((bool) $item['changeable']);
456 $new_item->toggleVisible((bool) $item['visible']);
457 $new_item->update($new_item_id, $new_parent);
458 $new_item->setSuggestionStartRelative((int) ($item['suggestion_start_rel'] ?? 0));
459 $new_item->setSuggestionEndRelative((int) ($item['suggestion_end_rel'] ?? 0));
460 $new_item->createDefaultEntry($new_item_id);
461 $new_item->update($new_item_id);
462 }
463 }
static _getInstance(int $a_copy_id)
static getItems(int $parent_id, bool $with_list_data=true)
Get sub item data.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
$target_id
Definition: goto.php:52
$ref_id
Definition: ltiauth.php:67

References $DIC, $ref_id, $target_id, ilCopyWizardOptions\_getInstance(), ilObjectFactory\getInstanceByRefId(), and getItems().

Referenced by ilObjCourse\cloneDependencies(), ilObjGroup\cloneDependencies(), and ilObjFolder\cloneDependencies().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createDefaultEntry()

static ilObjectActivation::createDefaultEntry ( int  $ref_id)
staticprotected

Create db entry with default values.

Definition at line 324 of file class.ilObjectActivation.php.

324 : array
325 {
326 global $DIC;
327
328 $db = $DIC->database();
329 $tree = $DIC->repositoryTree();
330
331 $parent_id = $tree->getParentId($ref_id);
332 if (!$parent_id) {
333 return [];
334 }
335
336 $ilAtomQuery = $db->buildAtomQuery();
337 $ilAtomQuery->addTableLock("crs_items");
338
339 $ilAtomQuery->addQueryCallable(function (ilDBInterface $db) use ($ref_id, $parent_id, &$item): void {
340 $sql =
341 "SELECT parent_id, obj_id, timing_type, timing_start, timing_end, suggestion_start," . PHP_EOL
342 . "suggestion_end, changeable, visible, position, suggestion_start_rel, suggestion_end_rel" . PHP_EOL
343 . "FROM crs_items" . PHP_EOL
344 . "WHERE obj_id = " . $db->quote($ref_id, "integer") . PHP_EOL
345 ;
346 $set = $db->query($sql);
347 if (!$db->numRows($set)) {
348 $now = time();
349
350 $item = array();
351 $item["timing_type"] = self::TIMINGS_DEACTIVATED;
352 $item["timing_start"] = $now;
353 $item["timing_end"] = $now;
354 $item["suggestion_start"] = $now;
355 $item["suggestion_end"] = $now;
356 $item['visible'] = 0;
357 $item['changeable'] = 0;
358
359 $values = [
360 "parent_id" => ["integer", $parent_id],
361 "obj_id" => ["integer", $ref_id],
362 "timing_type" => ["integer", $item["timing_type"]],
363 "timing_start" => ["integer", $item["timing_start"]],
364 "timing_end" => ["integer", $item["timing_end"]],
365 "suggestion_start" => ["integer", $item["suggestion_start"]],
366 "suggestion_end" => ["integer", $item["suggestion_end"]],
367 "changeable" => ["integer", $item["changeable"]],
368 "visible" => ["integer", $item["visible"]],
369 "suggestion_start_rel" => ["integer", $item["suggestion_start_rel"] ?? 0],
370 "suggestion_end_rel" => ["integer", $item["suggestion_end_rel"] ?? 0],
371 "position" => ["integer", 0]
372 ];
373 $db->insert("crs_items", $values);
374 }
375 });
376
377 $ilAtomQuery->run();
378
379 // #9982 - to make getItem()-cache work
380 $item["obj_id"] = $ref_id;
381 $item["parent_id"] = $parent_id;
382
383 return $item;
384 }
Interface ilDBInterface.
numRows(ilDBStatement $statement)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.

References $db, $DIC, $ref_id, ilDBInterface\buildAtomQuery(), ilDBInterface\numRows(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by getItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllEntries()

static ilObjectActivation::deleteAllEntries ( int  $ref_id)
static

Delete all db entries for ref id.

Definition at line 389 of file class.ilObjectActivation.php.

389 : bool
390 {
391 global $DIC;
392
393 $db = $DIC->database();
394
395 if (!$ref_id) {
396 return false;
397 }
398
399 $sql =
400 "DELETE FROM crs_items " . PHP_EOL
401 . "WHERE obj_id = " . $db->quote($ref_id, 'integer') . PHP_EOL
402 ;
403 $db->manipulate($sql);
404
405 $sql =
406 "DELETE FROM crs_items " . PHP_EOL
407 . "WHERE parent_id = " . $db->quote($ref_id, 'integer') . PHP_EOL
408 ;
409 $db->manipulate($sql);
410
411 return true;
412 }
manipulate(string $query)
Run a (write) Query on the database.

References $db, $DIC, $ref_id, ilDBInterface\manipulate(), and ilDBInterface\quote().

Referenced by ilObjChatroom\delete(), ilObject\delete(), and ilObjPoll\doDelete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enabledChangeable()

ilObjectActivation::enabledChangeable ( )

Definition at line 139 of file class.ilObjectActivation.php.

139 : bool
140 {
141 return (bool) $this->changeable;
142 }

References $changeable.

Referenced by update().

+ Here is the caller graph for this function:

◆ enabledVisible()

ilObjectActivation::enabledVisible ( )

Definition at line 129 of file class.ilObjectActivation.php.

129 : bool
130 {
131 return $this->visible;
132 }

References $visible.

Referenced by update().

+ Here is the caller graph for this function:

◆ getItem()

static ilObjectActivation::getItem ( int  $ref_id)
static

Definition at line 193 of file class.ilObjectActivation.php.

193 : array
194 {
195 global $DIC;
196 $db = $DIC->database();
197
198 if (isset(self::$preloaded_data[$ref_id])) {
199 return self::$preloaded_data[$ref_id];
200 }
201
202 $sql =
203 "SELECT parent_id, obj_id, timing_type, timing_start, timing_end, suggestion_start," . PHP_EOL
204 . "suggestion_end, changeable, visible, position, suggestion_start_rel, suggestion_end_rel" . PHP_EOL
205 . "FROM crs_items" . PHP_EOL
206 . "WHERE obj_id = " . $db->quote($ref_id, "integer") . PHP_EOL
207 ;
208 $set = $db->query($sql);
209 $row = $db->fetchAssoc($set);
210
211 if (!isset($row["obj_id"])) {
213 } else {
214 self::$preloaded_data[$row["obj_id"]] = $row;
215 }
216 return $row;
217 }
static createDefaultEntry(int $ref_id)
Create db entry with default values.
fetchAssoc(ilDBStatement $statement)

References $db, $DIC, $ref_id, createDefaultEntry(), ilDBInterface\fetchAssoc(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilObjCourse\__readSettings(), ilTimingCache\_getTimings(), ilObjCourseAccess\_isActivated(), ilObjPollAccess\_isActivated(), addAdditionalSubItemInformation(), ilObjectXMLWriter\appendTimeTargets(), ilObjSurvey\checkReminder(), ilObjPoll\doRead(), ilObjPortfolioTemplate\doRead(), ilTimingsUser\handleNewMembership(), ilObjChatroomAccess\isActivated(), ilObjSurvey\loadFromDb(), ilObjTest\loadFromDb(), ilObjCmiXapi\loadRepositoryActivationSettings(), ilObjLTIConsumer\loadRepositoryActivationSettings(), ilCalendarScheduleFilterTimings\modifyEvent(), ilObjChatroom\read(), ilTimingCache\readObjectInformation(), ilObjCmiXapi\saveRepositoryActivationSettings(), ilObjLTIConsumer\saveRepositoryActivationSettings(), ilObjSurvey\saveToDb(), ilObjTest\saveToDb(), ilObjPortfolioTemplate\updateActivation(), ilSoapObjectAdministration\updateReferences(), ilObjCourse\updateSettings(), ilTimingPlaned\validate(), and ilContainerXmlWriter\writeCourseItemInformation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItems()

static ilObjectActivation::getItems ( int  $parent_id,
bool  $with_list_data = true 
)
static

Get sub item data.

Definition at line 588 of file class.ilObjectActivation.php.

588 : array
589 {
590 global $DIC;
591
592 $tree = $DIC->repositoryTree();
593
594 $items = array();
595
596 $ref_ids = array();
597 foreach ($tree->getChilds($parent_id) as $item) {
598 if ($item['type'] !== 'rolf') {
599 $items[] = $item;
600 $ref_ids[] = (int) $item['ref_id'];
601 }
602 }
603
604 if ($ref_ids) {
605 self::preloadData($ref_ids);
606
607 foreach ($items as $idx => $item) {
608 if (!$with_list_data) {
609 $items[$idx] = array_merge($item, self::getItem((int) $item['ref_id']));
610 } else {
612 $items[$idx] = $item;
613 }
614 }
615 }
616 return $items;
617 }
static preloadData(array $ref_ids)
Preload data to internal cache.

References $DIC, addAdditionalSubItemInformation(), ILIAS\Repository\int(), and preloadData().

Referenced by cloneDependencies(), ilCourseStart\getPossibleStarters(), ilContainerStartObjects\getPossibleStarters(), getTimingsAdministrationItems(), and ilCourseContentGUI\managePersonalTimings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItemsByEvent()

static ilObjectActivation::getItemsByEvent ( int  $event_id)
static

Get session material / event items.

Definition at line 560 of file class.ilObjectActivation.php.

560 : array
561 {
562 $event_items = new ilEventItems($event_id);
563 return self::processListItems($event_items->getItems());
564 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static processListItems(array $ref_ids)
Validate ref ids and add list data.

References processListItems().

Referenced by ilAppointmentPresentationSessionGUI\collectPropertiesAndActions(), ilAppointmentSessionFileHandler\getFiles(), ilContainerGUI\redrawListItemObject(), and ilContainerContentGUI\renderItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItemsByItemGroup()

static ilObjectActivation::getItemsByItemGroup ( int  $item_group_ref_id)
static

Get materials of item group.

Definition at line 569 of file class.ilObjectActivation.php.

569 : array
570 {
571 $ig_items = new ilItemGroupItems($item_group_ref_id);
572 $items = $ig_items->getValidItems();
573 return self::processListItems($items);
574 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References processListItems().

Referenced by ilContainerContentGUI\renderItemGroup(), and ilRepositoryExplorerGUI\sortChilds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItemsByObjective()

static ilObjectActivation::getItemsByObjective ( int  $objective_id)
static

Get objective items.

Definition at line 579 of file class.ilObjectActivation.php.

579 : array
580 {
581 $item_ids = ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id);
582 return self::processListItems($item_ids);
583 }
static _getAssignedMaterials(int $a_objective_id)

References ilCourseObjectiveMaterials\_getAssignedMaterials(), and processListItems().

+ Here is the call graph for this function:

◆ getTimingEnd()

ilObjectActivation::getTimingEnd ( )

Definition at line 87 of file class.ilObjectActivation.php.

87 : ?int
88 {
89 return $this->timing_end;
90 }

References $timing_end.

Referenced by update().

+ Here is the caller graph for this function:

◆ getTimingsAdministrationItems()

static ilObjectActivation::getTimingsAdministrationItems ( int  $parent_id)
static

Get (sub) item data for timings administration view (active/inactive)

Definition at line 622 of file class.ilObjectActivation.php.

622 : array
623 {
624 $items = self::getItems($parent_id, false);
625 $active = $availability = $inactive = [];
626 foreach ($items as $item) {
627 if ($item['timing_type'] == self::TIMINGS_DEACTIVATED) {
628 $inactive[] = $item;
629 } elseif ($item['timing_type'] == self::TIMINGS_ACTIVATION) {
630 $availability[] = $item;
631 } else {
632 $active[] = $item;
633 }
634 }
635 $active = ilArrayUtil::sortArray($active, 'suggestion_start');
636 $availability = ilArrayUtil::sortArray($availability, 'timing_start');
637 $inactive = ilArrayUtil::sortArray($inactive, 'title');
638
639 $items = array_merge($active, $availability, $inactive);
640 return $items;
641 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)

References getItems(), and ilArrayUtil\sortArray().

Referenced by ilCourseContentGUI\__renderUserItem(), ilCourseContentGUI\manageTimings(), and ilCourseContentGUI\showUserTimings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimingsItems()

static ilObjectActivation::getTimingsItems ( int  $container_ref_id)
static

Get (sub) item data for timings view (no session material, no side blocks)

Definition at line 646 of file class.ilObjectActivation.php.

646 : array
647 {
648 global $DIC;
649
650 $objDefinition = $DIC["objDefinition"];
651
652 $filtered = array();
653
654 $event_items = ilEventItems::_getItemsOfContainer($container_ref_id);
655 foreach (self::getTimingsAdministrationItems($container_ref_id) as $item) {
656 if (!in_array($item['ref_id'], $event_items) &&
657 !$objDefinition->isSideBlock($item['type'])) {
658 $filtered[] = $item;
659 }
660 }
661
662 return $filtered;
663 }
static _getItemsOfContainer(int $a_ref_id)

References $DIC, and ilEventItems\_getItemsOfContainer().

Referenced by ilCalendarScheduleFilterTimings\addCustomEvents(), and ilObjCourse\prepareAppointments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimingStart()

ilObjectActivation::getTimingStart ( )

Definition at line 77 of file class.ilObjectActivation.php.

77 : ?int
78 {
80 }

References $timing_start.

Referenced by update().

+ Here is the caller graph for this function:

◆ getTimingType()

ilObjectActivation::getTimingType ( )

Definition at line 67 of file class.ilObjectActivation.php.

67 : int
68 {
69 return $this->timing_type;
70 }

References $timing_type.

Referenced by update().

+ Here is the caller graph for this function:

◆ hasChangeableTimings()

static ilObjectActivation::hasChangeableTimings ( int  $ref_id)
static

Check if there is any active changeable timing (in subtree)

Definition at line 499 of file class.ilObjectActivation.php.

499 : bool
500 {
501 global $DIC;
502
503 $tree = $DIC->repositoryTree();
504 $db = $DIC->database();
505
506 $subtree = $tree->getSubTree($tree->getNodeData($ref_id));
507 $ref_ids = array();
508 foreach ($subtree as $node) {
509 $ref_ids[] = $node['ref_id'];
510 }
511
512 $sql =
513 "SELECT parent_id" . PHP_EOL
514 . "FROM crs_items" . PHP_EOL
515 . "WHERE timing_type = " . $db->quote(self::TIMINGS_PRESETTING, 'integer') . PHP_EOL
516 . "AND changeable = " . $db->quote(1, 'integer') . PHP_EOL
517 . "AND " . $db->in('obj_id', $ref_ids, false, 'integer') . PHP_EOL
518 ;
519 $res = $db->query($sql);
520 return (bool) $res->numRows();
521 }
in(string $field, array $values, bool $negate=false, string $type="")
$res
Definition: ltiservices.php:69

References $db, $DIC, $ref_id, $res, ilDBInterface\in(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilCourseContentGUI\__renderUserItem(), and ilCourseContentGUI\showUserTimings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasTimings()

static ilObjectActivation::hasTimings ( int  $ref_id)
static

Check if there is any active timing (in subtree)

Definition at line 473 of file class.ilObjectActivation.php.

473 : bool
474 {
475 global $DIC;
476
477 $tree = $DIC->repositoryTree();
478 $db = $DIC->database();
479
480 $subtree = $tree->getSubTree($tree->getNodeData($ref_id));
481 $ref_ids = array();
482 foreach ($subtree as $node) {
483 $ref_ids[] = $node['ref_id'];
484 }
485
486 $sql =
487 "SELECT parent_id" . PHP_EOL
488 . "FROM crs_items" . PHP_EOL
489 . "WHERE timing_type = " . $db->quote(self::TIMINGS_PRESETTING, 'integer') . PHP_EOL
490 . "AND " . $db->in('obj_id', $ref_ids, false, 'integer') . PHP_EOL
491 ;
492 $res = $db->query($sql);
493 return (bool) $res->numRows();
494 }

References $db, $DIC, $ref_id, $res, ilDBInterface\in(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilCourseMembershipGUI\initParticipantTableGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preloadData()

static ilObjectActivation::preloadData ( array  $ref_ids)
static

Preload data to internal cache.

Definition at line 176 of file class.ilObjectActivation.php.

176 : void
177 {
178 global $DIC;
179 $db = $DIC->database();
180
181 $sql =
182 "SELECT parent_id, obj_id, timing_type, timing_start, timing_end, suggestion_start," . PHP_EOL
183 . "suggestion_end, changeable, visible, position, suggestion_start_rel, suggestion_end_rel" . PHP_EOL
184 . "FROM crs_items" . PHP_EOL
185 . "WHERE " . $db->in("obj_id", $ref_ids, false, "integer") . PHP_EOL
186 ;
187 $set = $db->query($sql);
188 while ($row = $db->fetchAssoc($set)) {
189 self::$preloaded_data[$row["obj_id"]] = $row;
190 }
191 }

References $db, $DIC, ilDBInterface\fetchAssoc(), ilDBInterface\in(), and ilDBInterface\query().

Referenced by getItems(), ilTimingsUser\init(), ilObjectListGUIPreloader\preload(), and processListItems().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processListItems()

static ilObjectActivation::processListItems ( array  $ref_ids)
staticprotected

Validate ref ids and add list data.

Definition at line 526 of file class.ilObjectActivation.php.

526 : array
527 {
528 global $DIC;
529
530 $tree = $DIC->repositoryTree();
531
532 $res = array();
533
534 foreach (array_map('intval', $ref_ids) as $item_ref_id) {
535 if ($tree->isDeleted($item_ref_id)) {
536 continue;
537 }
538 // #7571: when node is removed from system, e.g. inactive trashcan, an empty array is returned
539 $node = $tree->getNodeData($item_ref_id);
540 if (!isset($node["ref_id"]) || (int) $node["ref_id"] !== $item_ref_id) {
541 continue;
542 }
543 $res[$item_ref_id] = $node;
544 }
545
546 if (count($res)) {
547 self::preloadData(array_keys($res));
548 foreach ($res as $idx => $item) {
550 $res[$idx] = $item;
551 }
552 }
553
554 return array_values($res);
555 }

References $DIC, $res, addAdditionalSubItemInformation(), and preloadData().

Referenced by getItemsByEvent(), getItemsByItemGroup(), and getItemsByObjective().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilObjectActivation::read ( int  $ref_id,
int  $parent_id = 0 
)

Definition at line 665 of file class.ilObjectActivation.php.

665 : void
666 {
667 global $DIC;
668 $db = $DIC->database();
669
670 $sql =
671 "SELECT parent_id, obj_id, timing_type, timing_start, timing_end, suggestion_start," . PHP_EOL
672 . "suggestion_end, changeable, visible, position, suggestion_start_rel, suggestion_end_rel" . PHP_EOL
673 . "FROM crs_items" . PHP_EOL
674 . "WHERE obj_id = " . $db->quote($ref_id, 'integer') . PHP_EOL
675 ;
676
677 if ($parent_id) {
678 $sql .= "AND parent_id = " . $db->quote($parent_id, "integer") . PHP_EOL;
679 }
680
681 $res = $db->query($sql);
682 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
683 $this->setSuggestionStart((int) $row->suggestion_start);
684 $this->setSuggestionEnd((int) $row->suggestion_end);
685 $this->setSuggestionStartRelative((int) $row->suggestion_start_rel);
686 $this->setSuggestionEndRelative((int) $row->suggestion_end_rel);
687 $this->toggleVisible((bool) $row->visible);
688 $this->toggleChangeable((bool) $row->changeable);
689 $this->setTimingType((int) $row->timing_type);
690 $this->setTimingStart((int) $row->timing_start);
691 $this->setTimingEnd((int) $row->timing_end);
692 }
693 }

References $db, $DIC, $ref_id, $res, ilDBConstants\FETCHMODE_OBJECT, ilDBInterface\query(), ilDBInterface\quote(), setSuggestionEnd(), setSuggestionEndRelative(), setSuggestionStart(), setSuggestionStartRelative(), setTimingEnd(), setTimingStart(), setTimingType(), toggleChangeable(), and toggleVisible().

Referenced by ilObjectActivationGUI\update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSuggestionEnd()

ilObjectActivation::setSuggestionEnd ( ?int  $end)

Definition at line 116 of file class.ilObjectActivation.php.

116 : void
117 {
118 if ($end === 0) {
119 $end = null;
120 }
121 $this->suggestion_end = $end;
122 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSuggestionEndRelative()

ilObjectActivation::setSuggestionEndRelative ( int  $end)

Definition at line 108 of file class.ilObjectActivation.php.

108 : void
109 {
110 if ($end === 0) {
111 $end = null;
112 }
113 $this->suggestion_end_rel = $end;
114 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSuggestionStart()

ilObjectActivation::setSuggestionStart ( ?int  $start)

Definition at line 92 of file class.ilObjectActivation.php.

92 : void
93 {
94 if ($start === 0) {
95 $start = null;
96 }
97 $this->suggestion_start = $start;
98 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSuggestionStartRelative()

ilObjectActivation::setSuggestionStartRelative ( ?int  $start)

Definition at line 100 of file class.ilObjectActivation.php.

100 : void
101 {
102 if ($start === 0) {
103 $start = null;
104 }
105 $this->suggestion_start_rel = $start;
106 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTimingEnd()

ilObjectActivation::setTimingEnd ( ?int  $end)

Definition at line 82 of file class.ilObjectActivation.php.

82 : void
83 {
84 $this->timing_end = $end;
85 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTimingStart()

ilObjectActivation::setTimingStart ( ?int  $start)

Definition at line 72 of file class.ilObjectActivation.php.

72 : void
73 {
74 $this->timing_start = $start;
75 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTimingType()

ilObjectActivation::setTimingType ( int  $type)

Definition at line 62 of file class.ilObjectActivation.php.

62 : void
63 {
64 $this->timing_type = $type;
65 }
$type

References $type.

Referenced by read().

+ Here is the caller graph for this function:

◆ toggleChangeable()

ilObjectActivation::toggleChangeable ( bool  $status)

Definition at line 134 of file class.ilObjectActivation.php.

134 : void
135 {
136 $this->changeable = (int) $status;
137 }

References ILIAS\Repository\int().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggleVisible()

ilObjectActivation::toggleVisible ( bool  $status)

Definition at line 124 of file class.ilObjectActivation.php.

124 : void
125 {
126 $this->visible = $status;
127 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilObjectActivation::update ( int  $ref_id,
?int  $parent_id = null 
)

Definition at line 144 of file class.ilObjectActivation.php.

144 : bool
145 {
146 $values = [
147 "timing_type" => ["integer", $this->getTimingType()],
148 "timing_start" => ["integer", $this->getTimingStart() ?? 0],
149 "timing_end" => ["integer", $this->getTimingEnd() ?? 0],
150 "suggestion_start" => ["integer", $this->suggestion_start ?? 0],
151 "suggestion_end" => ["integer", $this->suggestion_end ?? 0],
152 "changeable" => ["integer", (int) $this->enabledChangeable()],
153 "suggestion_start_rel" => ["integer", $this->suggestion_start_rel ?? 0],
154 "suggestion_end_rel" => ["integer", $this->suggestion_end_rel ?? 0],
155 "visible" => ["integer", $this->enabledVisible()]
156 ];
157
158 if (!is_null($parent_id)) {
159 $values["parent_id"] = ["integer", $parent_id];
160 }
161
162 $where = [
163 "obj_id" => ["integer", $ref_id]
164 ];
165
166 $this->db->update("crs_items", $values, $where);
167
168 unset(self::$preloaded_data[$ref_id]);
169
170 return true;
171 }

References $ref_id, enabledChangeable(), enabledVisible(), getTimingEnd(), getTimingStart(), getTimingType(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

Field Documentation

◆ $changeable

int ilObjectActivation::$changeable = 0
protected

Definition at line 48 of file class.ilObjectActivation.php.

Referenced by enabledChangeable().

◆ $db

ilDBInterface ilObjectActivation::$db
protected

◆ $error

ilErrorHandling ilObjectActivation::$error
protected

Definition at line 38 of file class.ilObjectActivation.php.

◆ $lng

ilLanguage ilObjectActivation::$lng
protected

Definition at line 39 of file class.ilObjectActivation.php.

Referenced by addListGUIActivationProperty().

◆ $preloaded_data

array ilObjectActivation::$preloaded_data = array()
staticprotected

Definition at line 36 of file class.ilObjectActivation.php.

◆ $suggestion_end

int ilObjectActivation::$suggestion_end = null
protected

Definition at line 46 of file class.ilObjectActivation.php.

◆ $suggestion_end_rel

int ilObjectActivation::$suggestion_end_rel = null
protected

Definition at line 51 of file class.ilObjectActivation.php.

◆ $suggestion_start

int ilObjectActivation::$suggestion_start = null
protected

Definition at line 45 of file class.ilObjectActivation.php.

◆ $suggestion_start_rel

int ilObjectActivation::$suggestion_start_rel = null
protected

Definition at line 50 of file class.ilObjectActivation.php.

◆ $timing_end

int ilObjectActivation::$timing_end = null
protected

Definition at line 44 of file class.ilObjectActivation.php.

Referenced by getTimingEnd().

◆ $timing_start

int ilObjectActivation::$timing_start = null
protected

Definition at line 43 of file class.ilObjectActivation.php.

Referenced by getTimingStart().

◆ $timing_type

int ilObjectActivation::$timing_type = 0
protected

Definition at line 42 of file class.ilObjectActivation.php.

Referenced by getTimingType().

◆ $visible

bool ilObjectActivation::$visible = false
protected

Definition at line 47 of file class.ilObjectActivation.php.

Referenced by enabledVisible().

◆ ERR_SUG_START_END

const ilObjectActivation::ERR_SUG_START_END = 1

Definition at line 29 of file class.ilObjectActivation.php.

◆ TIMINGS_ACTIVATION

◆ TIMINGS_DEACTIVATED

◆ TIMINGS_FIXED

const ilObjectActivation::TIMINGS_FIXED = 3

Definition at line 34 of file class.ilObjectActivation.php.

◆ TIMINGS_PRESETTING


The documentation for this class was generated from the following file: