ILIAS  eassessment Revision 61809
 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 
147  function initDefaultRoles()
148  {
149  global $rbacadmin;
150 
151  return $roles ? $roles : array();
152  }
153 
167  function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
168  {
169  global $tree;
170 
171  switch ($a_event)
172  {
173  case "link":
174 
175  //var_dump("<pre>",$a_params,"</pre>");
176  //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
177  //exit;
178  break;
179 
180  case "cut":
181 
182  //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
183  //exit;
184  break;
185 
186  case "copy":
187 
188  //var_dump("<pre>",$a_params,"</pre>");
189  //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
190  //exit;
191  break;
192 
193  case "paste":
194 
195  //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
196  //exit;
197  break;
198 
199  case "new":
200 
201  //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
202  //exit;
203  break;
204  }
205 
206  // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
207  if ($a_node_id==$_GET["ref_id"])
208  {
209  $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
210  $parent_type = $parent_obj->getType();
211  if($parent_type == $this->getType())
212  {
213  $a_node_id = (int) $tree->getParentId($a_node_id);
214  }
215  }
216 
217  parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
218  }
219 } // END class.ilObjStyleSheetFolder
220 ?>