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
00033 require_once "class.ilObject.php";
00034
00035 class ilObjStyleSheetFolder extends ilObject
00036 {
00037 var $styles;
00038
00045 function ilObjStyleSheetFolder($a_id = 0,$a_call_by_reference = true)
00046 {
00047 $this->type = "styf";
00048 $this->ilObject($a_id,$a_call_by_reference);
00049
00050 $this->styles = array();
00051 }
00052
00058 function addStyle($a_style_id)
00059 {
00060 $this->styles[$a_style_id] =
00061 array("id" => $a_style_id,
00062 "title" => ilObject::_lookupTitle($a_style_id));
00063 }
00064
00065
00069 function removeStyle($a_id)
00070 {
00071 unset($a_id);
00072 }
00073
00074
00081 function update()
00082 {
00083 global $ilDB;
00084
00085 if (!parent::update())
00086 {
00087 return false;
00088 }
00089
00090
00091 $q = "DELETE FROM style_folder_styles WHERE folder_id = ".
00092 $ilDB->quote($this->getId());
00093 $ilDB->query($q);
00094 foreach($this->styles as $style)
00095 {
00096 $q = "INSERT INTO style_folder_styles (folder_id, style_id) VALUES".
00097 "(".$ilDB->quote($this->getId()).", ".
00098 $ilDB->quote($style["id"]).")";
00099 $ilDB->query($q);
00100 }
00101
00102 return true;
00103 }
00104
00108 function read()
00109 {
00110 global $ilDB;
00111
00112 parent::read();
00113
00114
00115 $q = "SELECT * FROM style_folder_styles, object_data as obj WHERE folder_id = ".
00116 $ilDB->quote($this->getId()).
00117 " AND style_id = obj.obj_id";
00118
00119 $style_set = $ilDB->query($q);
00120 while ($style_rec = $style_set->fetchRow(DB_FETCHMODE_ASSOC))
00121 {
00122 $this->styles[$style_rec["style_id"]] =
00123 array("id" => $style_rec["style_id"],
00124 "title" => $style_rec["title"]);
00125 }
00126 }
00127
00128
00134 function getStyles()
00135 {
00136 return $this->styles;
00137 }
00138
00139
00140
00147 function delete()
00148 {
00149
00150 if (!parent::delete())
00151 {
00152 return false;
00153 }
00154
00155
00156
00157 return true;
00158 }
00159
00169 function initDefaultRoles()
00170 {
00171 global $rbacadmin;
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 return $roles ? $roles : array();
00184 }
00185
00199 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00200 {
00201 global $tree;
00202
00203 switch ($a_event)
00204 {
00205 case "link":
00206
00207
00208
00209
00210 break;
00211
00212 case "cut":
00213
00214
00215
00216 break;
00217
00218 case "copy":
00219
00220
00221
00222
00223 break;
00224
00225 case "paste":
00226
00227
00228
00229 break;
00230
00231 case "new":
00232
00233
00234
00235 break;
00236 }
00237
00238
00239 if ($a_node_id==$_GET["ref_id"])
00240 {
00241 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00242 $parent_type = $parent_obj->getType();
00243 if($parent_type == $this->getType())
00244 {
00245 $a_node_id = (int) $tree->getParentId($a_node_id);
00246 }
00247 }
00248
00249 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00250 }
00251 }
00252 ?>