00001 <?php 00002 /* 00003 +-----------------------------------------------------------------------------+ 00004 | ILIAS open source | 00005 +-----------------------------------------------------------------------------+ 00006 | Copyright (c) 1998-2001 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 ilObjRecoveryFolder extends ilObject 00037 { 00044 function ilObjRecoveryFolder($a_id = 0,$a_call_by_reference = true) 00045 { 00046 $this->type = "recf"; 00047 $this->ilObject($a_id,$a_call_by_reference); 00048 } 00049 00056 function update() 00057 { 00058 if (!parent::update()) 00059 { 00060 return false; 00061 } 00062 00063 // put here object specific stuff 00064 00065 return true; 00066 } 00067 00075 function ilClone($a_parent_ref) 00076 { 00077 global $rbacadmin; 00078 00079 // always call parent ilClone function first!! 00080 $new_ref_id = parent::ilClone($a_parent_ref); 00081 00082 // get object instance of cloned object 00083 //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id); 00084 00085 // create a local role folder & default roles 00086 //$roles = $newObj->initDefaultRoles(); 00087 00088 // ...finally assign role to creator of object 00089 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n"); 00090 00091 // always destroy objects in clone method because clone() is recursive and creates instances for each object in subtree! 00092 //unset($newObj); 00093 00094 // ... and finally always return new reference ID!! 00095 return $new_ref_id; 00096 } 00097 00104 function delete() 00105 { 00106 // always call parent delete function first!! 00107 if (!parent::delete()) 00108 { 00109 return false; 00110 } 00111 00112 //put here your module specific stuff 00113 00114 return true; 00115 } 00116 00126 function initDefaultRoles() 00127 { 00128 global $rbacadmin; 00129 00130 // create a local role folder 00131 //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId()); 00132 00133 // create moderator role and assign role to rolefolder... 00134 //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId()); 00135 //$roles[] = $roleObj->getId(); 00136 00137 //unset($rfoldObj); 00138 //unset($roleObj); 00139 00140 return $roles ? $roles : array(); 00141 } 00142 00156 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0) 00157 { 00158 global $tree; 00159 00160 switch ($a_event) 00161 { 00162 case "link": 00163 00164 //var_dump("<pre>",$a_params,"</pre>"); 00165 //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id; 00166 //exit; 00167 break; 00168 00169 case "cut": 00170 00171 //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id; 00172 //exit; 00173 break; 00174 00175 case "copy": 00176 00177 //var_dump("<pre>",$a_params,"</pre>"); 00178 //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id; 00179 //exit; 00180 break; 00181 00182 case "paste": 00183 00184 //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id; 00185 //exit; 00186 break; 00187 00188 case "new": 00189 00190 //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id; 00191 //exit; 00192 break; 00193 } 00194 00195 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter 00196 if ($a_node_id==$_GET["ref_id"]) 00197 { 00198 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id); 00199 $parent_type = $parent_obj->getType(); 00200 if($parent_type == $this->getType()) 00201 { 00202 $a_node_id = (int) $tree->getParentId($a_node_id); 00203 } 00204 } 00205 00206 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params); 00207 } 00208 } // END class.ilObjRecoveryFolder 00209 ?>