ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
34require_once "./Services/Object/classes/class.ilObject.php";
35require_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
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 translations of current category
164 function deleteTranslation($a_lang)
165 {
166 global $ilDB;
167
168 $query = "DELETE FROM object_translation WHERE obj_id= ".
169 $ilDB->quote($this->getId(),'integer')." AND lang_code = ".
170 $ilDB->quote($a_lang, 'text');
171 $res = $ilDB->manipulate($query);
172 }
173
174 // remove all Translations of current category
176 {
177 global $ilDB;
178
179 $query = "DELETE FROM object_translation WHERE obj_id= ".
180 $ilDB->quote($this->getId(),'integer');
181 $res = $ilDB->manipulate($query);
182 }
183
184 // add a new translation to current category
185 function addTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
186 {
187 global $ilDB;
188
189 if (empty($a_title))
190 {
191 $a_title = "NO TITLE";
192 }
193
194 $query = "INSERT INTO object_translation ".
195 "(obj_id,title,description,lang_code,lang_default) ".
196 "VALUES ".
197 "(".$ilDB->quote($this->getId(),'integer').",".
198 $ilDB->quote($a_title,'text').",".
199 $ilDB->quote($a_desc,'text').",".
200 $ilDB->quote($a_lang,'text').",".
201 $ilDB->quote($a_lang_default,'integer').")";
202 $res = $ilDB->manipulate($query);
203 return true;
204 }
205
206 function addAdditionalSubItemInformation(&$a_item_data)
207 {
208 include_once './Services/Object/classes/class.ilObjectActivation.php';
210 }
211
212} // END class.ObjRootFolder
213?>
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
Class ilContainer.
Class ilObjRootFolder.
ilObjRootFolder($a_id, $a_call_by_reference=true)
Constructor @access public.
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
getTranslations()
get all translations from this category
addTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
addAdditionalSubItemInformation(&$a_item_data)
Add additional information to sub item, e.g.
static addAdditionalSubItemInformation(array &$a_item)
Parse item data for list entries.
ilObject($a_id=0, $a_reference=true)
Constructor @access public.
getId()
get object id @access public
$data
$r
Definition: example_031.php:79
redirection script todo: (a better solution should control the processing via a xml file)
global $ilDB