ILIAS  release_8 Revision v8.24
class.ilObjFolder.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
24{
25 public ?ilTree $folder_tree = null;
26
27 public function __construct(
28 int $a_id = 0,
29 bool $a_call_by_reference = true
30 ) {
31 global $DIC;
32
33 $this->tree = $DIC->repositoryTree();
34 $this->lng = $DIC->language();
35 $this->rbacsystem = $DIC->rbac()->system();
36 $this->access = $DIC->access();
37 $this->type = "fold";
38 parent::__construct($a_id, $a_call_by_reference);
39 $this->lng->loadLanguageModule('fold');
40 }
41
42 public function setFolderTree(ilTree $a_tree): void
43 {
44 $this->folder_tree = $a_tree;
45 }
46
47 public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree = false): ?ilObject
48 {
49 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
50
51 // Copy learning progress settings
52 $obj_settings = new ilLPObjSettings($this->getId());
53 $obj_settings->cloneSettings($new_obj->getId());
54 unset($obj_settings);
55
56 return $new_obj;
57 }
58
59 public function putInTree(int $parent_ref_id): void
60 {
62
63 if (!is_object($this->folder_tree)) {
64 $this->folder_tree = &$tree;
65 }
66
67 if ($this->withReferences()) {
68 // put reference id into tree
69 $this->folder_tree->insertNode($this->getRefId(), $parent_ref_id);
70 } else {
71 // put object id into tree
72 $this->folder_tree->insertNode($this->getId(), $parent_ref_id);
73 }
74 }
75
76 public function cloneDependencies(int $target_id, int $copy_id): bool
77 {
78 parent::cloneDependencies($target_id, $copy_id);
79
80 ilObjectActivation::cloneDependencies($this->getRefId(), $target_id, $copy_id);
81
82 return true;
83 }
84
85 public function getViewMode(): int
86 {
88 $possible_view_modes = [
92 ];
93
94 // always try to inherit from grp container, then crs container
95 $container_grp_ref_id = $tree->checkForParentType($this->ref_id, 'grp');
96 if ($container_grp_ref_id) {
97 $grp_view_mode = ilObjGroup::lookupViewMode(ilObject::_lookupObjId($container_grp_ref_id));
98 if (in_array($grp_view_mode, $possible_view_modes)) {
99 return $grp_view_mode;
100 }
101 }
102 $container_crs_ref_id = $tree->checkForParentType($this->ref_id, 'crs');
103 if ($container_crs_ref_id) {
104 $crs_view_mode = ilObjCourseAccess::_lookupViewMode(ilObject::_lookupObjId($container_crs_ref_id));
105 if (in_array($crs_view_mode, $possible_view_modes)) {
106 return $crs_view_mode;
107 }
108 }
109
110 // default: by type
112 }
113
114 public function addAdditionalSubItemInformation(array &$object): void
115 {
117 }
118
119 public function read(): void
120 {
121 parent::read();
122
123 // Inherit order type from parent course (if exists)
125 }
126}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOrderType(int $a_value)
static _lookupViewMode(int $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
cloneDependencies(int $target_id, int $copy_id)
Clone object dependencies (container sorting)
putInTree(int $parent_ref_id)
maybe this method should be in tree object!?
__construct(int $a_id=0, bool $a_call_by_reference=true)
addAdditionalSubItemInformation(array &$object)
Add additional information to sub item, e.g.
cloneObject(int $target_id, int $copy_id=0, bool $omit_tree=false)
setFolderTree(ilTree $a_tree)
static lookupViewMode($a_obj_id)
static cloneDependencies(int $ref_id, int $target_id, int $copy_id)
static addAdditionalSubItemInformation(array &$item)
Parse item data for list entries.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilTree $tree
withReferences()
determines whether objects are referenced or not (got ref ids or not)
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
insertNode(int $a_node_id, int $a_parent_id, int $a_pos=self::POS_LAST_NODE, bool $a_reset_deletion_date=false)
insert new node with node_id under parent node with parent_id
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
global $DIC
Definition: feed.php:28
$target_id
Definition: goto.php:52
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc