ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 
132  // default: by type
134 
135  // always inherit from
136  $container_ref_id = $tree->checkForParentType($this->ref_id, 'grp');
137  if (!$container_ref_id) {
138  $container_ref_id = $tree->checkForParentType($this->ref_id, 'crs');
139  }
140  if ($container_ref_id) {
141  include_once("./Modules/Course/classes/class.ilObjCourseAccess.php");
142  $view_mode = ilObjCourseAccess::_lookupViewMode(ilObject::_lookupObjId($container_ref_id));
143  if ($view_mode == ilContainer::VIEW_SESSIONS ||
144  $view_mode == ilContainer::VIEW_BY_TYPE ||
145  $view_mode == ilContainer::VIEW_SIMPLE) {
146  $view = $view_mode;
147  }
148  }
149 
150  return $view;
151  }
152 
157  public function addAdditionalSubItemInformation(&$a_item_data)
158  {
159  include_once './Services/Object/classes/class.ilObjectActivation.php';
161  }
162 
170  public function read()
171  {
172  $tree = $this->tree;
173 
174  parent::read();
175 
176  // Inherit order type from parent course (if exists)
177  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
179  }
180 } // 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)
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)
$DIC
Definition: xapitoken.php:46
getRefId()
get reference id public
static _lookupSortMode($a_obj_id)
lookup sort mode
static _lookupViewMode($a_id)
Lookup view mode.