ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjItemGroup.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once "Services/Object/classes/class.ilObject2.php";
6require_once "Services/Object/classes/class.ilObjectActivation.php";
7
8include_once("./Modules/ItemGroup/classes/class.ilItemGroupAR.php");
9
10
20{
21 protected $access_type; // [int]
22 protected $access_begin; // [timestamp]
23 protected $access_end; // [timestamp]
24 protected $access_visibility; // [bool]
25 protected $item_data_ar = null; // active record
26
34 function __construct($a_id = 0, $a_reference = true)
35 {
36 global $tree, $objDefinition, $ilDB;
37
38 $this->tree = $tree;
39 $this->obj_def = $objDefinition;
40 $this->db = $ilDB;
41
42 $this->item_data_ar = new ilItemGroupAR();
43
44 parent::__construct($a_id, $a_reference);
45 }
46
52 function setId($a_val)
53 {
54 parent::setId($a_val);
55 $this->item_data_ar->setId($a_val);
56 }
57
61 function initType()
62 {
63 $this->type = "itgr";
64 }
65
71 function setHideTitle($a_val)
72 {
73 $this->item_data_ar->setHideTitle($a_val);
74 }
75
81 function getHideTitle()
82 {
83 return $this->item_data_ar->getHideTitle();
84 }
85
89 protected function doRead()
90 {
91 $this->item_data_ar = new ilItemGroupAR($this->getId());
92 }
93
97 protected function doCreate()
98 {
99 if($this->getId())
100 {
101 $this->item_data_ar->setId($this->getId());
102 $this->item_data_ar->create();
103 }
104 }
105
109 protected function doUpdate()
110 {
111 if($this->getId())
112 {
113 $this->item_data_ar->update();
114 }
115 }
116
120 protected function doDelete()
121 {
122 if($this->getId())
123 {
124 $this->item_data_ar->delete();
125 }
126 }
127
134 protected function doCloneObject($new_obj, $a_target_id, $a_copy_id)
135 {
136 $new_obj->setHideTitle($this->getHideTitle());
137 $new_obj->update();
138 }
139
146 function cloneDependencies($a_target_id,$a_copy_id)
147 {
148 global $ilLog;
149
150 $ilLog->write(__METHOD__.': Cloning item group dependencies -'.$a_source_id.'-');
151
152 parent::cloneDependencies($a_target_id,$a_copy_id);
153
154 include_once('./Modules/ItemGroup/classes/class.ilItemGroupItems.php');
155 $ig_items = new ilItemGroupItems($a_target_id);
156 $ig_items->cloneItems($this->getRefId(), $a_copy_id);
157
158 return true;
159 }
160
167 static function fixContainerItemGroupRefsAfterCloning($a_source_container, $a_copy_id)
168 {
169 global $ilLog;
170
171 $ilLog->write(__METHOD__.': Fix item group references in '.$a_source_container->getType());
172
173 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
174 $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
175 $mappings = $cwo->getMappings();
176
177 $new_container_ref_id = $mappings[$a_source_container->getRefId()];
178 $ilLog->write(__METHOD__.': 2-'.$new_container_ref_id.'-');
179 $new_container_obj_id = ilObject::_lookupObjId($new_container_ref_id);
180
181 include_once("./Services/COPage/classes/class.ilPageObject.php");
182 include_once("./Services/Container/classes/class.ilContainerPage.php");
183 $ilLog->write(__METHOD__.': 3'.$new_container_obj_id.'-');
184 if (ilPageObject::_exists("cont", $new_container_obj_id))
185 {
186 $ilLog->write(__METHOD__.': 4');
187 $new_page = new ilContainerPage($new_container_obj_id);
188 $new_page->buildDom();
189 include_once("./Services/COPage/classes/class.ilPCResources.php");
191 $new_page->update();
192 }
193 $ilLog->write(__METHOD__.': 5');
194 }
195
202 static function lookupHideTitle($a_id)
203 {
204 global $ilDB;
205
206 $set = $ilDB->query("SELECT hide_title FROM itgr_data ".
207 " WHERE id = ".$ilDB->quote($a_id, "integer")
208 );
209 $rec = $ilDB->fetchAssoc($set);
210 return $rec["hide_title"];
211 }
212
213}
214
215?>
Container page object.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
Item group active record class.
Class ilObjItemGroup.
cloneDependencies($a_target_id, $a_copy_id)
Clone dependencies.
setId($a_val)
Set ID.
__construct($a_id=0, $a_reference=true)
Constructor.
setHideTitle($a_val)
Set hide title.
getHideTitle()
Get hide title.
doCloneObject($new_obj, $a_target_id, $a_copy_id)
Clone obj item group.
static fixContainerItemGroupRefsAfterCloning($a_source_container, $a_copy_id)
Fix container item group references after a container has been cloned.
static lookupHideTitle($a_id)
Lookup hide title.
Class ilObject2 This is an intermediate progress of ilObject class.
getRefId()
get reference id @access public
getId()
get object id @access public
static _lookupObjId($a_id)
static modifyItemGroupRefIdsByMapping($a_page, $mappings)
Modify ref ids by mapping.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
global $ilDB