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 ilObjStyleSettings extends ilObject
00037 {
00038 var $styles;
00039
00046 function ilObjStyleSettings($a_id = 0,$a_call_by_reference = true)
00047 {
00048 $this->type = "stys";
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, style_data WHERE folder_id = ".
00117 $ilDB->quote($this->getId()).
00118 " AND style_id = obj.obj_id".
00119 " AND style_data.id = obj.obj_id";
00120
00121 $style_set = $ilDB->query($q);
00122 while ($style_rec = $style_set->fetchRow(DB_FETCHMODE_ASSOC))
00123 {
00124 $this->styles[$style_rec["style_id"]] =
00125 array("id" => $style_rec["style_id"],
00126 "title" => $style_rec["title"],
00127 "category" => $style_rec["category"]);
00128
00129 }
00130 }
00131
00135 function _lookupActivatedStyle($a_skin, $a_style)
00136 {
00137 global $ilDB;
00138
00139 $q = "SELECT count(*) AS cnt FROM settings_deactivated_styles".
00140 " WHERE skin = ".$ilDB->quote($a_skin).
00141 " AND style = ".$ilDB->quote($a_style);
00142
00143 $cnt_set = $ilDB->query($q);
00144 $cnt_rec = $cnt_set->fetchRow(DB_FETCHMODE_ASSOC);
00145
00146 if ($cnt_rec["cnt"] > 0)
00147 {
00148 return false;
00149 }
00150 else
00151 {
00152 return true;
00153 }
00154 }
00155
00159 function _deactivateStyle($a_skin, $a_style)
00160 {
00161 global $ilDB;
00162
00163 $q = "REPLACE into settings_deactivated_styles".
00164 " (skin, style) VALUES ".
00165 " (".$ilDB->quote($a_skin).",".
00166 " ".$ilDB->quote($a_style).")";
00167
00168 $ilDB->query($q);
00169 }
00170
00174 function _activateStyle($a_skin, $a_style)
00175 {
00176 global $ilDB;
00177
00178 $q = "DELETE FROM settings_deactivated_styles".
00179 " WHERE skin = ".$ilDB->quote($a_skin).
00180 " AND style = ".$ilDB->quote($a_style);
00181
00182 $ilDB->query($q);
00183 }
00184
00190 function getStyles()
00191 {
00192 return $this->styles;
00193 }
00194
00195
00203 function ilClone($a_parent_ref)
00204 {
00205 global $rbacadmin;
00206
00207
00208 $new_ref_id = parent::ilClone($a_parent_ref);
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223 return $new_ref_id;
00224 }
00225
00232 function delete()
00233 {
00234
00235 if (!parent::delete())
00236 {
00237 return false;
00238 }
00239
00240
00241
00242 return true;
00243 }
00244
00254 function initDefaultRoles()
00255 {
00256 global $rbacadmin;
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268 return $roles ? $roles : array();
00269 }
00270
00284 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00285 {
00286 global $tree;
00287
00288 switch ($a_event)
00289 {
00290 case "link":
00291
00292
00293
00294
00295 break;
00296
00297 case "cut":
00298
00299
00300
00301 break;
00302
00303 case "copy":
00304
00305
00306
00307
00308 break;
00309
00310 case "paste":
00311
00312
00313
00314 break;
00315
00316 case "new":
00317
00318
00319
00320 break;
00321 }
00322
00323
00324 if ($a_node_id==$_GET["ref_id"])
00325 {
00326 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00327 $parent_type = $parent_obj->getType();
00328 if($parent_type == $this->getType())
00329 {
00330 $a_node_id = (int) $tree->getParentId($a_node_id);
00331 }
00332 }
00333
00334 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00335 }
00336 }
00337 ?>