ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjStyleSheetFolder.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
13 require_once "./classes/class.ilObject.php";
14 
16 {
17  var $styles;
18 
25  function ilObjStyleSheetFolder($a_id = 0,$a_call_by_reference = true)
26  {
27  $this->type = "styf";
28  $this->ilObject($a_id,$a_call_by_reference);
29 
30  $this->styles = array();
31  }
32 
38  function addStyle($a_style_id)
39  {
40  $this->styles[$a_style_id] =
41  array("id" => $a_style_id,
42  "title" => ilObject::_lookupTitle($a_style_id));
43  }
44 
45 
49  function removeStyle($a_id)
50  {
51  unset($a_id);
52  }
53 
54 
61  function update()
62  {
63  global $ilDB;
64 
65  if (!parent::update())
66  {
67  return false;
68  }
69 
70  // save styles of style folder
71  $q = "DELETE FROM style_folder_styles WHERE folder_id = ".
72  $ilDB->quote((int) $this->getId(), "integer");
73  $ilDB->manipulate($q);
74  foreach($this->styles as $style)
75  {
76  $q = "INSERT INTO style_folder_styles (folder_id, style_id) VALUES".
77  "(".$ilDB->quote((int) $this->getId(), "integer").", ".
78  $ilDB->quote((int) $style["id"], "integer").")";
79  $ilDB->manipulate($q);
80  }
81 
82  return true;
83  }
84 
88  function read()
89  {
90  global $ilDB;
91 
92  parent::read();
93 
94  // get styles of style folder
95  $q = "SELECT * FROM style_folder_styles WHERE folder_id = ".
96  $ilDB->quote($this->getId(), "integer");
97 
98  $style_set = $ilDB->query($q);
99  while ($style_rec = $style_set->fetchRow(DB_FETCHMODE_ASSOC))
100  {
101  $this->styles[$style_rec["style_id"]] =
102  array("id" => $style_rec["style_id"],
103  "title" => ilObject::_lookupTitle($style_rec["style_id"]));
104  }
105  }
106 
107 
113  function getStyles()
114  {
115  return $this->styles;
116  }
117 
118 
119 
126  function delete()
127  {
128  // always call parent delete function first!!
129  if (!parent::delete())
130  {
131  return false;
132  }
133 
134  //put here your module specific stuff
135 
136  return true;
137  }
138 
148  function initDefaultRoles()
149  {
150  global $rbacadmin;
151 
152  // create a local role folder
153  //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
154 
155  // create moderator role and assign role to rolefolder...
156  //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
157  //$roles[] = $roleObj->getId();
158 
159  //unset($rfoldObj);
160  //unset($roleObj);
161 
162  return $roles ? $roles : array();
163  }
164 
178  function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
179  {
180  global $tree;
181 
182  switch ($a_event)
183  {
184  case "link":
185 
186  //var_dump("<pre>",$a_params,"</pre>");
187  //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
188  //exit;
189  break;
190 
191  case "cut":
192 
193  //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
194  //exit;
195  break;
196 
197  case "copy":
198 
199  //var_dump("<pre>",$a_params,"</pre>");
200  //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
201  //exit;
202  break;
203 
204  case "paste":
205 
206  //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
207  //exit;
208  break;
209 
210  case "new":
211 
212  //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
213  //exit;
214  break;
215  }
216 
217  // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
218  if ($a_node_id==$_GET["ref_id"])
219  {
220  $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
221  $parent_type = $parent_obj->getType();
222  if($parent_type == $this->getType())
223  {
224  $a_node_id = (int) $tree->getParentId($a_node_id);
225  }
226  }
227 
228  parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
229  }
230 } // END class.ilObjStyleSheetFolder
231 ?>