Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00034 require_once "class.ilObject.php";
00035
00036 class ilObjStyleSheetFolder extends ilObject
00037 {
00038 var $styles;
00039
00046 function ilObjStyleSheetFolder($a_id = 0,$a_call_by_reference = true)
00047 {
00048 $this->type = "styf";
00049 $this->ilObject($a_id,$a_call_by_reference);
00050
00051 $this->styles = array();
00052 }
00053
00059 function addStyle($a_style_id)
00060 {
00061 $this->styles[$a_style_id] =
00062 array("id" => $a_style_id,
00063 "title" => ilObject::_lookupTitle($a_style_id));
00064 }
00065
00066
00070 function removeStyle($a_id)
00071 {
00072 unset($a_id);
00073 }
00074
00075
00082 function update()
00083 {
00084 global $ilDB;
00085
00086 if (!parent::update())
00087 {
00088 return false;
00089 }
00090
00091
00092 $q = "DELETE FROM style_folder_styles WHERE folder_id = ".
00093 $ilDB->quote($this->getId());
00094 $ilDB->query($q);
00095 foreach($this->styles as $style)
00096 {
00097 $q = "INSERT INTO style_folder_styles (folder_id, style_id) VALUES".
00098 "(".$ilDB->quote($this->getId()).", ".
00099 $ilDB->quote($style["id"]).")";
00100 $ilDB->query($q);
00101 }
00102
00103 return true;
00104 }
00105
00109 function read()
00110 {
00111 global $ilDB;
00112
00113 parent::read();
00114
00115
00116 $q = "SELECT * FROM style_folder_styles, object_data as obj WHERE folder_id = ".
00117 $ilDB->quote($this->getId()).
00118 " AND style_id = obj.obj_id";
00119
00120 $style_set = $ilDB->query($q);
00121 while ($style_rec = $style_set->fetchRow(DB_FETCHMODE_ASSOC))
00122 {
00123 $this->styles[$style_rec["style_id"]] =
00124 array("id" => $style_rec["style_id"],
00125 "title" => $style_rec["title"]);
00126 }
00127 }
00128
00129
00135 function getStyles()
00136 {
00137 return $this->styles;
00138 }
00139
00140
00148 function ilClone($a_parent_ref)
00149 {
00150 global $rbacadmin;
00151
00152
00153 $new_ref_id = parent::ilClone($a_parent_ref);
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 return $new_ref_id;
00169 }
00170
00177 function delete()
00178 {
00179
00180 if (!parent::delete())
00181 {
00182 return false;
00183 }
00184
00185
00186
00187 return true;
00188 }
00189
00199 function initDefaultRoles()
00200 {
00201 global $rbacadmin;
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213 return $roles ? $roles : array();
00214 }
00215
00229 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00230 {
00231 global $tree;
00232
00233 switch ($a_event)
00234 {
00235 case "link":
00236
00237
00238
00239
00240 break;
00241
00242 case "cut":
00243
00244
00245
00246 break;
00247
00248 case "copy":
00249
00250
00251
00252
00253 break;
00254
00255 case "paste":
00256
00257
00258
00259 break;
00260
00261 case "new":
00262
00263
00264
00265 break;
00266 }
00267
00268
00269 if ($a_node_id==$_GET["ref_id"])
00270 {
00271 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00272 $parent_type = $parent_obj->getType();
00273 if($parent_type == $this->getType())
00274 {
00275 $a_node_id = (int) $tree->getParentId($a_node_id);
00276 }
00277 }
00278
00279 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00280 }
00281 }
00282 ?>