ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjFolder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 public ?ilTree $folder_tree = null;
29
30 public function __construct(
31 int $a_id = 0,
32 bool $a_call_by_reference = true
33 ) {
34 global $DIC;
35
36 $this->tree = $DIC->repositoryTree();
37 $this->lng = $DIC->language();
38 $this->rbacsystem = $DIC->rbac()->system();
39 $this->access = $DIC->access();
40 $this->type = "fold";
41 parent::__construct($a_id, $a_call_by_reference);
42 $this->lng->loadLanguageModule('fold');
43 }
44
45 public function setFolderTree(ilTree $a_tree): void
46 {
47 $this->folder_tree = $a_tree;
48 }
49
50 public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree = false): ?ilObject
51 {
52 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
53
54 // Copy learning progress settings
55 $obj_settings = new ilLPObjSettings($this->getId());
56 $obj_settings->cloneSettings($new_obj->getId());
57 unset($obj_settings);
58
59 return $new_obj;
60 }
61
62 public function putInTree(int $parent_ref_id): void
63 {
65
66 if (!is_object($this->folder_tree)) {
67 $this->folder_tree = &$tree;
68 }
69
70 if ($this->withReferences()) {
71 // put reference id into tree
72 $this->folder_tree->insertNode($this->getRefId(), $parent_ref_id);
73 } else {
74 // put object id into tree
75 $this->folder_tree->insertNode($this->getId(), $parent_ref_id);
76 }
77 }
78
79 public function cloneDependencies(int $target_id, int $copy_id): bool
80 {
81 parent::cloneDependencies($target_id, $copy_id);
82
83 ilObjectActivation::cloneDependencies($this->getRefId(), $target_id, $copy_id);
84
85 return true;
86 }
87
88 public function getViewMode(): int
89 {
91 $possible_view_modes = [
95 ];
96
97 // always try to inherit from grp container, then crs container
98 $container_grp_ref_id = $tree->checkForParentType($this->ref_id, 'grp');
99 if ($container_grp_ref_id) {
100 $grp_view_mode = ilObjGroup::lookupViewMode(ilObject::_lookupObjId($container_grp_ref_id));
101 if (in_array($grp_view_mode, $possible_view_modes)) {
102 return $grp_view_mode;
103 }
104 }
105 $container_crs_ref_id = $tree->checkForParentType($this->ref_id, 'crs');
106 if ($container_crs_ref_id) {
107 $crs_view_mode = ilObjCourseAccess::_lookupViewMode(ilObject::_lookupObjId($container_crs_ref_id));
108 if (in_array($crs_view_mode, $possible_view_modes)) {
109 return $crs_view_mode;
110 }
111 }
112
113 // default: by type
115 }
116
117 public function addAdditionalSubItemInformation(array &$object): void
118 {
120 }
121
122 public function read(): void
123 {
124 parent::read();
125
126 // Inherit order type from parent course (if exists)
128 }
129}
Class ilContainer.
setOrderType(int $a_value)
static _lookupViewMode(int $a_id)
Class ilObjFolder.
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.
Class ilObject Basic functions for all objects.
ilTree $tree
withReferences()
determines whether objects are referenced or not (got ref ids or not)
static _lookupObjId(int $ref_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
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...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26