ILIAS  release_4-4 Revision
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 
5 require_once "Services/Object/classes/class.ilObject2.php";
6 require_once "Services/Object/classes/class.ilObjectActivation.php";
7 
17 {
18  protected $access_type; // [int]
19  protected $access_begin; // [timestamp]
20  protected $access_end; // [timestamp]
21  protected $access_visibility; // [bool]
22 
30  function __construct($a_id = 0, $a_reference = true)
31  {
32  global $tree, $objDefinition;
33 
34  $this->tree = $tree;
35  $this->obj_def = $objDefinition;
36 
37  parent::__construct($a_id, $a_reference);
38  }
39 
43  function initType()
44  {
45  $this->type = "itgr";
46  }
47 
51  protected function doRead()
52  {
53  global $ilDB;
54 
55  /*$set = $ilDB->query("SELECT * FROM il_poll".
56  " WHERE id = ".$ilDB->quote($this->getId(), "integer"));
57  $row = $ilDB->fetchAssoc($set);*/
58 
59  if ($this->ref_id)
60  {
61 /* $activation = ilObjectActivation::getItem($this->ref_id);
62  $this->setAccessType($activation["timing_type"]);
63  $this->setAccessBegin($activation["timing_start"]);
64  $this->setAccessEnd($activation["timing_end"]);
65  $this->setAccessVisibility($activation["visible"]);*/
66  }
67  }
68 
72  protected function propertiesToDB()
73  {
74  $fields = array(
75  );
76 
77  return $fields;
78  }
79 
83  protected function doCreate()
84  {
85  global $ilDB;
86 
87  if($this->getId())
88  {
89  $fields = $this->propertiesToDB();
90 // $fields["id"] = array("integer", $this->getId());
91 
92 // $ilDB->insert("il_poll", $fields);
93 
94 
95  // object activation default entry will be created on demand
96 
97 
98  }
99  }
100 
104  protected function doUpdate()
105  {
106  global $ilDB;
107 
108  if($this->getId())
109  {
110  $fields = $this->propertiesToDB();
111 
112 // $ilDB->update("il_poll", $fields,
113 // array("id"=>array("integer", $this->getId())));
114 
115 
116  if($this->ref_id)
117  {
118 /* $activation = new ilObjectActivation();
119  $activation->setTimingType($this->getAccessType());
120  $activation->setTimingStart($this->getAccessBegin());
121  $activation->setTimingEnd($this->getAccessEnd());
122  $activation->toggleVisible($this->getAccessVisibility());
123  $activation->update($this->ref_id);*/
124  }
125 
126  }
127  }
128 
132  protected function doDelete()
133  {
134  global $ilDB;
135 
136  if($this->getId())
137  {
138  if($this->ref_id)
139  {
140 // ilObjectActivation::deleteAllEntries($this->ref_id);
141  }
142 
143 // $ilDB->manipulate("DELETE FROM il_poll".
144 // " WHERE id = ".$ilDB->quote($this->id, "integer"));
145  }
146  }
147 
154  protected function doCloneObject($new_obj, $a_target_id, $a_copy_id)
155  {
156 
157  }
158 
165  function cloneDependencies($a_target_id,$a_copy_id)
166  {
167  global $ilLog;
168 
169  $ilLog->write(__METHOD__.': Cloning item group dependencies -'.$a_source_id.'-');
170 
171  parent::cloneDependencies($a_target_id,$a_copy_id);
172 
173  include_once('./Modules/ItemGroup/classes/class.ilItemGroupItems.php');
174  $ig_items = new ilItemGroupItems($a_target_id);
175  $ig_items->cloneItems($this->getRefId(), $a_copy_id);
176 
177  return true;
178  }
179 
186  static function fixContainerItemGroupRefsAfterCloning($a_source_container, $a_copy_id)
187  {
188  global $ilLog;
189 
190  $ilLog->write(__METHOD__.': Fix item group references in '.$a_source_container->getType());
191 
192  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
193  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
194  $mappings = $cwo->getMappings();
195 
196  $new_container_ref_id = $mappings[$a_source_container->getRefId()];
197  $ilLog->write(__METHOD__.': 2-'.$new_container_ref_id.'-');
198  $new_container_obj_id = ilObject::_lookupObjId($new_container_ref_id);
199 
200  include_once("./Services/COPage/classes/class.ilPageObject.php");
201  include_once("./Services/Container/classes/class.ilContainerPage.php");
202  $ilLog->write(__METHOD__.': 3'.$new_container_obj_id.'-');
203  if (ilPageObject::_exists("cont", $new_container_obj_id))
204  {
205  $ilLog->write(__METHOD__.': 4');
206  $new_page = new ilContainerPage($new_container_obj_id);
207  $new_page->buildDom();
208  include_once("./Services/COPage/classes/class.ilPCResources.php");
209  ilPCResources::modifyItemGroupRefIdsByMapping($new_page, $mappings);
210  $new_page->update();
211  }
212  $ilLog->write(__METHOD__.': 5');
213  }
214 }
215 
216 ?>
__construct($a_id=0, $a_reference=true)
Constructor.
static modifyItemGroupRefIdsByMapping($a_page, $mappings)
Modify ref ids by mapping.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
Container page object.
doCloneObject($new_obj, $a_target_id, $a_copy_id)
Clone obj item group.
static _lookupObjId($a_id)
Item group items.
Class ilObjItemGroup.
static fixContainerItemGroupRefsAfterCloning($a_source_container, $a_copy_id)
Fix container item group references after a container has been cloned.
propertiesToDB()
Get properties array.
Class ilObject2 This is an intermediate progress of ilObject class.
cloneDependencies($a_target_id, $a_copy_id)
Clone dependencies.