ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjFolder.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
26 
27 require_once "./Services/Container/classes/class.ilContainer.php";
28 
37 class ilObjFolder extends ilContainer
38 {
39  public $folder_tree;
40 
47  public function __construct($a_id = 0, $a_call_by_reference = true)
48  {
49  global $DIC;
50 
51  $this->tree = $DIC->repositoryTree();
52  $this->lng = $DIC->language();
53  $this->rbacsystem = $DIC->rbac()->system();
54  $this->access = $DIC->access();
55  $this->type = "fold";
56  parent::__construct($a_id, $a_call_by_reference);
57  $this->lng->loadLanguageModule('fold');
58  }
59 
60  public function setFolderTree($a_tree)
61  {
62  $this->folder_tree = &$a_tree;
63  }
64 
73  public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
74  {
75  $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
76 
77  // Copy learning progress settings
78  include_once('Services/Tracking/classes/class.ilLPObjSettings.php');
79  $obj_settings = new ilLPObjSettings($this->getId());
80  $obj_settings->cloneSettings($new_obj->getId());
81  unset($obj_settings);
82 
83  return $new_obj;
84  }
85 
90  public function putInTree($a_parent)
91  {
93 
94  if (!is_object($this->folder_tree)) {
95  $this->folder_tree = &$tree;
96  }
97 
98  if ($this->withReferences()) {
99  // put reference id into tree
100  $this->folder_tree->insertNode($this->getRefId(), $a_parent);
101  } else {
102  // put object id into tree
103  $this->folder_tree->insertNode($this->getId(), $a_parent);
104  }
105  }
106 
115  public function cloneDependencies($a_target_id, $a_copy_id)
116  {
117  parent::cloneDependencies($a_target_id, $a_copy_id);
118 
119  include_once('Services/Object/classes/class.ilObjectActivation.php');
120  ilObjectActivation::cloneDependencies($this->getRefId(), $a_target_id, $a_copy_id);
121 
122  return true;
123  }
124 
128  public function getViewMode()
129  {
130  $tree = $this->tree;
131  $possible_view_modes = [
135  ];
136 
137  // always try to inherit from grp container, then crs container
138  $container_grp_ref_id = $tree->checkForParentType($this->ref_id, 'grp');
139  if ($container_grp_ref_id) {
140  $grp_view_mode = ilObjGroup::lookupViewMode(ilObject::_lookupObjId($container_grp_ref_id));
141  if (in_array($grp_view_mode, $possible_view_modes)) {
142  return $grp_view_mode;
143  }
144  }
145  $container_crs_ref_id = $tree->checkForParentType($this->ref_id, 'crs');
146  if ($container_crs_ref_id) {
147  $crs_view_mode = ilObjCourseAccess::_lookupViewMode(ilObject::_lookupObjId($container_crs_ref_id));
148  if (in_array($crs_view_mode, $possible_view_modes)) {
149  return $crs_view_mode;
150  }
151  }
152 
153  // default: by type
155  }
156 
161  public function addAdditionalSubItemInformation(&$a_item_data)
162  {
163  include_once './Services/Object/classes/class.ilObjectActivation.php';
165  }
166 
174  public function read()
175  {
176  $tree = $this->tree;
177 
178  parent::read();
179 
180  // Inherit order type from parent course (if exists)
181  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
183  }
184 } // END class.ilObjFolder
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
Class ilObjFolder.
withReferences()
determines wehter objects are referenced or not (got ref ids or not)
putInTree($a_parent)
insert folder into grp_tree
setFolderTree($a_tree)
static addAdditionalSubItemInformation(array &$a_item)
Parse item data for list entries.
getId()
get object id public
read()
Overwritten read method.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone folder.
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
addAdditionalSubItemInformation(&$a_item_data)
Add additional information to sub item, e.g.
getViewMode()
Get container view mode.
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies (crs items, preconditions)
Class ilContainer.
setOrderType($a_value)
static cloneDependencies($a_ref_id, $a_target_id, $a_copy_id)
Clone dependencies.
__construct(Container $dic, ilPlugin $plugin)
getRefId()
get reference id public
static _lookupSortMode($a_obj_id)
lookup sort mode
static lookupViewMode($a_obj_id)
lookup view mode $ilDB
static _lookupViewMode($a_id)
Lookup view mode.