ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjRecoveryFolderGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once "./Services/Container/classes/class.ilContainerGUI.php";
25 
37 {
42  function ilObjRecoveryFolderGUI($a_data,$a_id,$a_call_by_reference)
43  {
44  $this->type = "recf";
45  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
46  }
47 
52  function saveObject()
53  {
54  global $rbacadmin;
55 
56  // create and insert forum in objecttree
57  $newObj = parent::saveObject();
58 
59  // setup rolefolder & default local roles
60  //$roles = $newObj->initDefaultRoles();
61 
62  // ...finally assign role to creator of object
63  //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
64 
65  // put here object specific stuff
66 
67  // always send a message
68  ilUtil::sendInfo($this->lng->txt("object_added"),true);
69  exit();
70  }
71 
73  {
74  global $rbacsystem;
75 
76  // AT LEAST ONE OBJECT HAS TO BE CHOSEN.
77  if (!isset($_POST["id"]))
78  {
79  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
80  }
81 
82  $this->object->notify("removeFromSystem", $_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$_POST["trash_id"]);
83 
84  $affected_ids = array();
85 
86  // DELETE THEM
87  foreach ($_POST["id"] as $id)
88  {
89  // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
90  $node_data = $this->tree->getNodeData($id);
91  $subtree_nodes = $this->tree->getSubTree($node_data);
92 
93  // remember already checked deleted node_ids
94  $checked[] = $id;
95 
96  // dive in recursive manner in each already deleted subtrees and remove these objects too
97  $this->removeDeletedNodes($id, $checked, true, $affected_ids);
98 
99  foreach ($subtree_nodes as $node)
100  {
101  $node_obj =& $this->ilias->obj_factory->getInstanceByRefId($node["ref_id"]);
102 
103  // this is due to bug #1860 (even if this will not completely fix it)
104  // and the fact, that media pool folders may find their way into
105  // the recovery folder (what results in broken pools, if the are deleted)
106  // Alex, 2006-07-21
107  #if ($node_obj->getType() != "fold")
108 
109  if($node_obj->getType() == 'fold' and $this->isMediaFolder($node_obj->getId()))
110  {
111  continue;
112  }
113  $node_obj->delete();
114  }
115 
116  // FIRST DELETE ALL ENTRIES IN RBAC TREE
117  $this->tree->deleteTree($node_data);
118  }
119 
120  ilUtil::sendInfo($this->lng->txt("msg_removed"),true);
121 
122  $this->ctrl->redirect($this, "view");
123  }
124 
125  function &executeCommand()
126  {
127  $next_class = $this->ctrl->getNextClass($this);
128  $cmd = $this->ctrl->getCmd();
129  $this->prepareOutput();
130 
131  switch($next_class)
132  {
133  case 'ilpermissiongui':
134  include_once("./classes/class.ilPermissionGUI.php");
135  $perm_gui =& new ilPermissionGUI($this);
136  $ret =& $this->ctrl->forwardCommand($perm_gui);
137  break;
138 
139  default:
140  if(!$cmd)
141  {
142  $cmd = "view";
143  }
144  $cmd .= "Object";
145  $this->$cmd();
146 
147  break;
148  }
149  return true;
150  }
151 
152 
154  {
155  $this->sub_objects = "";
156  }
157 
161  function getActions()
162  {
163  // standard actions for container
164  return array(
165  "cut" => array("name" => "cut", "lng" => "cut"),
166  "clear" => array("name" => "clear", "lng" => "clear"),
167  "removeFromSystem" => array("name" => "removeFromSystem", "lng" => "btn_remove_system")
168  );
169  }
170 
171  protected function isMediaFolder($a_obj_id)
172  {
173  global $ilDB;
174 
175  if(!is_array($this->media_pool_ids))
176  {
177  $this->media_pool_ids = array();
178  $query = "SELECT child FROM mep_tree ";
179  $res = $ilDB->query($query);
180  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
181  {
182  $this->media_pool_ids[] = $row->child;
183  }
184  }
185 
186  return in_array($a_obj_id,$this->media_pool_ids) ? true : false;
187  }
188 
189 
190 } // END class.ilObjRecoveryFolderGUI
191 ?>