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 ilObjStyleSettings extends ilObject
00036 {
00037 var $styles;
00038
00045 function ilObjStyleSettings($a_id = 0,$a_call_by_reference = true)
00046 {
00047 $this->type = "stys";
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, style_data WHERE folder_id = ".
00116 $ilDB->quote($this->getId()).
00117 " AND style_id = obj.obj_id".
00118 " AND style_data.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 "category" => $style_rec["category"]);
00127
00128 }
00129 }
00130
00134 function _lookupActivatedStyle($a_skin, $a_style)
00135 {
00136 global $ilDB;
00137
00138 $q = "SELECT count(*) AS cnt FROM settings_deactivated_styles".
00139 " WHERE skin = ".$ilDB->quote($a_skin).
00140 " AND style = ".$ilDB->quote($a_style);
00141
00142 $cnt_set = $ilDB->query($q);
00143 $cnt_rec = $cnt_set->fetchRow(DB_FETCHMODE_ASSOC);
00144
00145 if ($cnt_rec["cnt"] > 0)
00146 {
00147 return false;
00148 }
00149 else
00150 {
00151 return true;
00152 }
00153 }
00154
00158 function _deactivateStyle($a_skin, $a_style)
00159 {
00160 global $ilDB;
00161
00162 $q = "REPLACE into settings_deactivated_styles".
00163 " (skin, style) VALUES ".
00164 " (".$ilDB->quote($a_skin).",".
00165 " ".$ilDB->quote($a_style).")";
00166
00167 $ilDB->query($q);
00168 }
00169
00173 function _activateStyle($a_skin, $a_style)
00174 {
00175 global $ilDB;
00176
00177 $q = "DELETE FROM settings_deactivated_styles".
00178 " WHERE skin = ".$ilDB->quote($a_skin).
00179 " AND style = ".$ilDB->quote($a_style);
00180
00181 $ilDB->query($q);
00182 }
00183
00189 function getStyles()
00190 {
00191 return $this->styles;
00192 }
00193
00194
00201 function delete()
00202 {
00203
00204 if (!parent::delete())
00205 {
00206 return false;
00207 }
00208
00209
00210
00211 return true;
00212 }
00213
00223 function initDefaultRoles()
00224 {
00225 global $rbacadmin;
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237 return $roles ? $roles : array();
00238 }
00239
00253 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00254 {
00255 global $tree;
00256
00257 switch ($a_event)
00258 {
00259 case "link":
00260
00261
00262
00263
00264 break;
00265
00266 case "cut":
00267
00268
00269
00270 break;
00271
00272 case "copy":
00273
00274
00275
00276
00277 break;
00278
00279 case "paste":
00280
00281
00282
00283 break;
00284
00285 case "new":
00286
00287
00288
00289 break;
00290 }
00291
00292
00293 if ($a_node_id==$_GET["ref_id"])
00294 {
00295 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00296 $parent_type = $parent_obj->getType();
00297 if($parent_type == $this->getType())
00298 {
00299 $a_node_id = (int) $tree->getParentId($a_node_id);
00300 }
00301 }
00302
00303 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00304 }
00305 }
00306 ?>