ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjRootFolder.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 
34 require_once "./classes/class.ilObject.php";
35 require_once "./Services/Container/classes/class.ilContainer.php";
36 
38 {
45  function ilObjRootFolder($a_id,$a_call_by_reference = true)
46  {
47  $this->type = "root";
48  $this->ilObject($a_id,$a_call_by_reference);
49  }
50 
51 
52 
59  function delete()
60  {
61  // delete is disabled
62 
63  $message = get_class($this)."::delete(): Can't delete root folder!";
64  $this->ilias->raiseError($message,$this->ilias->error_obj->WARNING);
65  return false;
66 
67  // always call parent delete function first!!
68  if (!parent::delete())
69  {
70  return false;
71  }
72 
73  // put here rootfolder specific stuff
74 
75  return true;;
76  }
77 
88  function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
89  {
90  global $tree;
91 
92  switch ($a_event)
93  {
94  case "link":
95 
96  //var_dump("<pre>",$a_params,"</pre>");
97  //echo "RootFolder ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
98  //exit;
99  break;
100 
101  case "cut":
102 
103  //echo "RootFolder ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
104  //exit;
105  break;
106 
107  case "copy":
108 
109  //var_dump("<pre>",$a_params,"</pre>");
110  //echo "RootFolder ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
111  //exit;
112  break;
113 
114  case "paste":
115 
116  //echo "RootFolder ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
117  //exit;
118  break;
119 
120  case "new":
121 
122  //echo "RootFolder ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
123  //exit;
124  break;
125  }
126 
127 
128  return true;
129  }
130 
137  function getTranslations()
138  {
139  global $ilDB;
140 
141  $q = "SELECT * FROM object_translation WHERE obj_id = ".
142  $ilDB->quote($this->getId(),'integer')." ORDER BY lang_default DESC";
143  $r = $this->ilias->db->query($q);
144 
145  $num = 0;
146 
147  $data["Fobject"] = array();
148  while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
149  {
150  $data["Fobject"][$num]= array("title" => $row->title,
151  "desc" => $row->description,
152  "lang" => $row->lang_code
153  );
154  $num++;
155  }
156 
157  // first entry is always the default language
158  $data["default_language"] = 0;
159 
160  return $data ? $data : array();
161  }
162 
163  // remove all Translations of current category
165  {
166  global $ilDB;
167 
168  $query = "DELETE FROM object_translation WHERE obj_id= ".
169  $ilDB->quote($this->getId(),'integer');
170  $res = $ilDB->manipulate($query);
171  }
172 
173  // add a new translation to current category
174  function addTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
175  {
176  global $ilDB;
177 
178  if (empty($a_title))
179  {
180  $a_title = "NO TITLE";
181  }
182 
183  $query = "INSERT INTO object_translation ".
184  "(obj_id,title,description,lang_code,lang_default) ".
185  "VALUES ".
186  "(".$ilDB->quote($this->getId(),'integer').",".
187  $ilDB->quote($a_title,'text').",".
188  $ilDB->quote($a_desc,'text').",".
189  $ilDB->quote($a_lang,'text').",".
190  $ilDB->quote($a_lang_default,'integer').")";
191  $res = $ilDB->manipulate($query);
192  return true;
193  }
194 
195 } // END class.ObjRootFolder
196 ?>