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 include_once "./classes/class.ilObject.php"; 00035 00036 class ilObjLinkResource extends ilObject 00037 { 00044 function ilObjLinkResource($a_id = 0,$a_call_by_reference = true) 00045 { 00046 $this->type = "lnkr"; 00047 $this->ilObject($a_id,$a_call_by_reference); 00048 } 00049 00057 function ilClone($a_parent_ref) 00058 { 00059 global $rbacadmin; 00060 00061 // always call parent clone function first!! 00062 $new_ref_id = parent::ilClone($a_parent_ref); 00063 00064 // get object instance of cloned object 00065 //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id); 00066 00067 // create a local role folder & default roles 00068 //$roles = $newObj->initDefaultRoles(); 00069 00070 // ...finally assign role to creator of object 00071 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n"); 00072 00073 // always destroy objects in clone method because clone() is recursive and creates instances for each object in subtree! 00074 //unset($newObj); 00075 00076 // ... and finally always return new reference ID!! 00077 return $new_ref_id; 00078 } 00079 00086 function delete() 00087 { 00088 // always call parent delete function first!! 00089 if (!parent::delete()) 00090 { 00091 return false; 00092 } 00093 00094 // delete items 00095 include_once './link/classes/class.ilLinkResourceItems.php'; 00096 ilLinkResourceItems::_deleteAll($this->getId()); 00097 00098 00099 // Delete notify entries 00100 include_once './classes/class.ilLinkCheckNotify.php'; 00101 ilLinkCheckNotify::_deleteObject($this->getId()); 00102 00103 00104 00105 return true; 00106 } 00107 function initLinkResourceItemsObject() 00108 { 00109 include_once './link/classes/class.ilLinkResourceItems.php'; 00110 00111 $this->items_obj =& new ilLinkResourceItems($this->getId()); 00112 00113 return true; 00114 } 00115 00116 function _goto($a_target) 00117 { 00118 global $rbacsystem, $ilErr, $lng; 00119 00120 include_once 'classes/class.ilSearch.php'; 00121 00122 // Added this additional check (ParentConditions) to avoid calls of objects inside e.g courses. 00123 // Will be replaced in future releases by ilAccess::checkAccess() 00124 if ($rbacsystem->checkAccess("read", $a_target) and ilSearch::_checkParentConditions($a_target)) 00125 { 00126 ilUtil::redirect("link/link_resources.php?ref_id=$a_target"); 00127 } 00128 else 00129 { 00130 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL); 00131 } 00132 } 00133 00134 // PRIVATE 00135 00136 00137 } // END class.ilObjLinkResource 00138 ?>