• 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 
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                 // save styles of style folder
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                 // get styles of style folder
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                 // always call parent clone function first!!
00153                 $new_ref_id = parent::ilClone($a_parent_ref);
00154                 
00155                 // get object instance of cloned object
00156                 //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id);
00157 
00158                 // create a local role folder & default roles
00159                 //$roles = $newObj->initDefaultRoles();
00160 
00161                 // ...finally assign role to creator of object
00162                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n");          
00163 
00164                 // always destroy objects in clone method because clone() is recursive and creates instances for each object in subtree!
00165                 //unset($newObj);
00166 
00167                 // ... and finally always return new reference ID!!
00168                 return $new_ref_id;
00169         }
00170 
00177         function delete()
00178         {               
00179                 // always call parent delete function first!!
00180                 if (!parent::delete())
00181                 {
00182                         return false;
00183                 }
00184                 
00185                 //put here your module specific stuff
00186                 
00187                 return true;
00188         }
00189 
00199         function initDefaultRoles()
00200         {
00201                 global $rbacadmin;
00202                 
00203                 // create a local role folder
00204                 //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
00205 
00206                 // create moderator role and assign role to rolefolder...
00207                 //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
00208                 //$roles[] = $roleObj->getId();
00209 
00210                 //unset($rfoldObj);
00211                 //unset($roleObj);
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                                 //var_dump("<pre>",$a_params,"</pre>");
00238                                 //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
00239                                 //exit;
00240                                 break;
00241                         
00242                         case "cut":
00243                                 
00244                                 //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
00245                                 //exit;
00246                                 break;
00247                                 
00248                         case "copy":
00249                         
00250                                 //var_dump("<pre>",$a_params,"</pre>");
00251                                 //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
00252                                 //exit;
00253                                 break;
00254 
00255                         case "paste":
00256                                 
00257                                 //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
00258                                 //exit;
00259                                 break;
00260                         
00261                         case "new":
00262                                 
00263                                 //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
00264                                 //exit;
00265                                 break;
00266                 }
00267                 
00268                 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
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 } // END class.ilObjStyleSheetFolder
00282 ?>

Generated on Fri Dec 13 2013 13:52:08 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1