• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilObjStyleSheetFolder.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2005 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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                 // save styles of style folder
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                 // get styles of style folder
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                 // always call parent delete function first!!
00150                 if (!parent::delete())
00151                 {
00152                         return false;
00153                 }
00154                 
00155                 //put here your module specific stuff
00156                 
00157                 return true;
00158         }
00159 
00169         function initDefaultRoles()
00170         {
00171                 global $rbacadmin;
00172                 
00173                 // create a local role folder
00174                 //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
00175 
00176                 // create moderator role and assign role to rolefolder...
00177                 //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
00178                 //$roles[] = $roleObj->getId();
00179 
00180                 //unset($rfoldObj);
00181                 //unset($roleObj);
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                                 //var_dump("<pre>",$a_params,"</pre>");
00208                                 //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
00209                                 //exit;
00210                                 break;
00211                         
00212                         case "cut":
00213                                 
00214                                 //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
00215                                 //exit;
00216                                 break;
00217                                 
00218                         case "copy":
00219                         
00220                                 //var_dump("<pre>",$a_params,"</pre>");
00221                                 //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
00222                                 //exit;
00223                                 break;
00224 
00225                         case "paste":
00226                                 
00227                                 //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
00228                                 //exit;
00229                                 break;
00230                         
00231                         case "new":
00232                                 
00233                                 //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
00234                                 //exit;
00235                                 break;
00236                 }
00237                 
00238                 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
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 } // END class.ilObjStyleSheetFolder
00252 ?>

Generated on Fri Dec 13 2013 17:56:48 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1