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

link/classes/class.ilObjLinkResource.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 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 
00053         function create()
00054         {
00055                 parent::create();
00056                 $this->createMetaData();
00057         }
00058 
00062         function update()
00063         {
00064                 $this->updateMetaData();
00065                 parent::update();
00066         }
00067 
00075         function ilClone($a_parent_ref)
00076         {               
00077                 global $rbacadmin;
00078 
00079                 // always call parent clone 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                 // delete items
00113                 include_once './link/classes/class.ilLinkResourceItems.php';
00114                 ilLinkResourceItems::_deleteAll($this->getId());
00115 
00116 
00117                 // Delete notify entries
00118                 include_once './classes/class.ilLinkCheckNotify.php';
00119                 ilLinkCheckNotify::_deleteObject($this->getId());
00120 
00121                 // delete meta data
00122                 $this->deleteMetaData();
00123 
00124                 return true;
00125         }
00126 
00127         function initLinkResourceItemsObject()
00128         {
00129                 include_once './link/classes/class.ilLinkResourceItems.php';
00130 
00131                 $this->items_obj =& new ilLinkResourceItems($this->getId());
00132 
00133                 return true;
00134         }
00135 
00136         function _goto($a_target)
00137         {
00138                 global $rbacsystem, $ilErr, $lng;
00139 
00140                 include_once 'classes/class.ilSearch.php';
00141                         
00142                 // Added this additional check (ParentConditions) to avoid calls of objects inside e.g courses.
00143                 // Will be replaced in future releases by ilAccess::checkAccess()
00144                 if ($rbacsystem->checkAccess("read", $a_target) and ilSearch::_checkParentConditions($a_target))
00145                 {
00146                         ilUtil::redirect("link/link_resources.php?ref_id=$a_target");
00147                 }
00148                 else
00149                 {
00150                         $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
00151                 }
00152         }
00153 
00154         // PRIVATE
00155 
00156 
00157 } // END class.ilObjLinkResource
00158 ?>

Generated on Fri Dec 13 2013 10:18:30 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1