ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 = []
 

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: shib_login.php:26

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 224 of file class.ilObjectActivation.php.

224 : void
225 {
226 global $DIC;
227 $ilUser = $DIC->user();
228
229 $item_array = self::getItem((int) $item['ref_id']);
230
231 $item['obj_id'] = ($item['obj_id'] > 0)
232 ? $item['obj_id']
233 : ilObject::_lookupObjId((int) $item['ref_id']);
234 $item['type'] = ($item['type'] != '')
235 ? $item['type']
236 : ilObject::_lookupType((int) $item['obj_id']);
237
238 $item['timing_type'] = $item_array['timing_type'] ?? 0;
239
240 if ($item['timing_type'] == self::TIMINGS_PRESETTING &&
241 (
242 ($item_array['changeable'] ?? false) ||
244 )
245 ) {
246 // cognos-blu-patch: begin
247 $user_data = new ilTimingUser((int) $item['ref_id'], $ilUser->getId());
248 if ($user_data->isScheduled()) {
249 $item['start'] = $user_data->getStart()->get(IL_CAL_UNIX);
250 $item['end'] = $user_data->getEnd()->get(IL_CAL_UNIX);
251 $item['activation_info'] = 'crs_timings_planed_info';
252 } else {
253 $item['start'] = $item_array['suggestion_start'] ?? "";
254 $item['end'] = $item_array['suggestion_end'] ?? "";
255 $item['activation_info'] = 'crs_timings_suggested_info';
256 }
257 // cognos-blu-patch: end
258 } elseif (($item_array['timing_type'] ?? 0) == self::TIMINGS_PRESETTING) {
259 $item['start'] = $item_array['suggestion_start'] ?? "";
260 $item['end'] = $item_array['suggestion_end'] ?? "";
261 $item['activation_info'] = 'crs_timings_suggested_info';
262 } elseif (($item_array['timing_type'] ?? 0) == self::TIMINGS_ACTIVATION) {
263 $item['start'] = $item_array['timing_start'] ?? "";
264 $item['end'] = $item_array['timing_end'] ?? "";
265 $item['activation_info'] = 'obj_activation_list_gui';
266 }
267
268 // #7359 - session sorting should always base on appointment date
269 if ($item['type'] == 'sess') {
270 $info = ilSessionAppointment::_lookupAppointment((int) $item['obj_id']);
271 // #11987
272 $item['masked_start'] = $item['start'] ?? '';
273 $item['masked_end'] = $item['end'] ?? '';
274 $item['start'] = $info['start'] ?? '';
275 $item['end'] = $info['end'] ?? '';
276 }
277 }
const IL_CAL_UNIX
static lookupTimingMode(int $a_obj_id)
static getItem(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupAppointment(int $a_obj_id)
TableGUI class for timings administration.
$info
Definition: entry_point.php:21

References $DIC, $info, ilSessionAppointment\_lookupAppointment(), ilObject\_lookupObjId(), ilObject\_lookupType(), getItem(), IL_CAL_UNIX, ilCourseConstants\IL_CRS_VIEW_TIMING_RELATIVE, and ilObjCourse\lookupTimingMode().

Referenced by ilObjCategory\addAdditionalSubItemInformation(), ilObjCourse\addAdditionalSubItemInformation(), ilObjFolder\addAdditionalSubItemInformation(), ilObjGroup\addAdditionalSubItemInformation(), ilObjRootFolder\addAdditionalSubItemInformation(), ILIAS\Container\Content\ItemSetManager\addAdditionalSubItemInformationToObject(), 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 282 of file class.ilObjectActivation.php.

282 : void
283 {
285 if (isset($item['timing_type'])) {
286 if (!isset($item['masked_start'])) {
287 $start = $item['start'] ?? 0;
288 $end = $item['end'] ?? 0;
289 } else {
290 $start = $item['masked_start'];
291 $end = $item['masked_end'];
292 }
293 $activation = '';
294 switch ($item['timing_type']) {
297 new ilDateTime($start, IL_CAL_UNIX),
298 new ilDateTime($end, IL_CAL_UNIX)
299 );
300 break;
301
304 new ilDate($start, IL_CAL_UNIX),
305 new ilDate($end, IL_CAL_UNIX)
306 );
307 break;
308 }
309 if ($activation != "") {
310 global $DIC;
311
312 $lng = $DIC->language();
313 $lng->loadLanguageModule('crs');
314
315 $list_gui->addCustomProperty(
316 $lng->txt($item['activation_info']),
317 $activation,
318 false,
319 true
320 );
321 }
322 }
323 }
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
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(), ilObjSessionGUI\modifyItemGUI(), ilContainerContentGUI\renderItem(), and ILIAS\Containter\Content\ItemRenderer\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 418 of file class.ilObjectActivation.php.

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

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

Referenced by ilObjGroup\cloneDependencies(), ilObjCourse\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 328 of file class.ilObjectActivation.php.

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

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

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

Referenced by 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 194 of file class.ilObjectActivation.php.

194 : array
195 {
196 global $DIC;
197
198 $db = $DIC->database();
199
200 if (isset(self::$preloaded_data[$ref_id])) {
201 return self::$preloaded_data[$ref_id];
202 }
203
204 $sql =
205 "SELECT parent_id, obj_id, timing_type, timing_start, timing_end, suggestion_start," . PHP_EOL
206 . "suggestion_end, changeable, visible, position, suggestion_start_rel, suggestion_end_rel" . PHP_EOL
207 . "FROM crs_items" . PHP_EOL
208 . "WHERE obj_id = " . $db->quote($ref_id, "integer") . PHP_EOL
209 ;
210 $set = $db->query($sql);
211 $row = $db->fetchAssoc($set);
212
213 if (!isset($row["obj_id"])) {
215 } else {
216 self::$preloaded_data[$row["obj_id"]] = $row;
217 }
218 return $row;
219 }
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(), addAdditionalSubItemInformation(), ILIAS\Repository\Form\addStdAvailability(), ilObjectXMLWriter\appendTimeTargets(), ilObjSurvey\checkReminder(), ilObjPoll\doRead(), ilObjPortfolioTemplate\doRead(), ilTimingsUser\handleNewMembership(), ilObjSurvey\loadFromDb(), ilObjCmiXapi\loadRepositoryActivationSettings(), ilObjLTIConsumer\loadRepositoryActivationSettings(), ilCalendarScheduleFilterTimings\modifyEvent(), ilTimingCache\readObjectInformation(), ilObjCmiXapi\saveRepositoryActivationSettings(), ilObjLTIConsumer\saveRepositoryActivationSettings(), ilObjSurvey\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 592 of file class.ilObjectActivation.php.

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

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

Referenced by cloneDependencies(), ilContainerStartObjects\getPossibleStarters(), ilCourseStart\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 564 of file class.ilObjectActivation.php.

564 : array
565 {
566 $event_items = new ilEventItems($event_id);
567 return self::processListItems($event_items->getItems());
568 }
class ilEventItems
static processListItems(array $ref_ids)
Validate ref ids and add list data.

References processListItems().

Referenced by ilAppointmentPresentationSessionGUI\collectPropertiesAndActions(), ilAppointmentSessionFileHandler\getFiles(), ilContainerGUI\redrawListItemObject(), ilContainerContentGUI\renderItem(), and ILIAS\Containter\Content\ItemRenderer\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 573 of file class.ilObjectActivation.php.

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

References processListItems().

Referenced by ILIAS\Container\Content\ItemBlock\ItemBlockSequenceGenerator\getItemGroupItemRefIds(), 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 583 of file class.ilObjectActivation.php.

583 : array
584 {
585 $item_ids = ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id);
586 return self::processListItems($item_ids);
587 }
static _getAssignedMaterials(int $a_objective_id)

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

Referenced by ILIAS\Container\Content\ItemSetManager\addObjectiveItems(), and ILIAS\Container\Content\ItemBlock\ItemBlockSequenceGenerator\getBlocksForPart().

+ Here is the call graph for this function:
+ Here is the caller 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 626 of file class.ilObjectActivation.php.

626 : array
627 {
628 $items = self::getItems($parent_id, false);
629 $active = $availability = $inactive = [];
630 foreach ($items as $item) {
631 if ($item['timing_type'] == self::TIMINGS_DEACTIVATED) {
632 $inactive[] = $item;
633 } elseif ($item['timing_type'] == self::TIMINGS_ACTIVATION) {
634 $availability[] = $item;
635 } else {
636 $active[] = $item;
637 }
638 }
639 $active = ilArrayUtil::sortArray($active, 'suggestion_start');
640 $availability = ilArrayUtil::sortArray($availability, 'timing_start');
641 $inactive = ilArrayUtil::sortArray($inactive, 'title');
642
643 $items = array_merge($active, $availability, $inactive);
644 return $items;
645 }
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 650 of file class.ilObjectActivation.php.

650 : array
651 {
652 global $DIC;
653
654 $objDefinition = $DIC["objDefinition"];
655
656 $filtered = [];
657
658 $event_items = ilEventItems::_getItemsOfContainer($container_ref_id);
659 foreach (self::getTimingsAdministrationItems($container_ref_id) as $item) {
660 if (!in_array($item['ref_id'], $event_items) &&
661 !$objDefinition->isSideBlock($item['type'])) {
662 $filtered[] = $item;
663 }
664 }
665
666 return $filtered;
667 }
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 503 of file class.ilObjectActivation.php.

503 : bool
504 {
505 global $DIC;
506
507 $tree = $DIC->repositoryTree();
508 $db = $DIC->database();
509
510 $subtree = $tree->getSubTree($tree->getNodeData($ref_id));
511 $ref_ids = [];
512 foreach ($subtree as $node) {
513 $ref_ids[] = $node['ref_id'];
514 }
515
516 $sql =
517 "SELECT parent_id" . PHP_EOL
518 . "FROM crs_items" . PHP_EOL
519 . "WHERE timing_type = " . $db->quote(self::TIMINGS_PRESETTING, 'integer') . PHP_EOL
520 . "AND changeable = " . $db->quote(1, 'integer') . PHP_EOL
521 . "AND " . $db->in('obj_id', $ref_ids, false, 'integer') . PHP_EOL
522 ;
523 $res = $db->query($sql);
524 return (bool) $res->numRows();
525 }
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 477 of file class.ilObjectActivation.php.

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

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 177 of file class.ilObjectActivation.php.

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

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 530 of file class.ilObjectActivation.php.

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

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 669 of file class.ilObjectActivation.php.

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

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

+ Here is the call 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 }

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

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 = []
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: