ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 public function __construct($a_id,$a_call_by_reference = true)
46 {
47 $this->type = "root";
48 parent::__construct($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
84 function getTranslations()
85 {
86 global $ilDB;
87
88 $q = "SELECT * FROM object_translation WHERE obj_id = ".
89 $ilDB->quote($this->getId(),'integer')." ORDER BY lang_default DESC";
90 $r = $this->ilias->db->query($q);
91
92 $num = 0;
93
94 $data["Fobject"] = array();
95 while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
96 {
97 $data["Fobject"][$num]= array("title" => $row->title,
98 "desc" => $row->description,
99 "lang" => $row->lang_code
100 );
101 $num++;
102 }
103
104 // first entry is always the default language
105 $data["default_language"] = 0;
106
107 return $data ? $data : array();
108 }
109
110 // remove translations of current category
111 function deleteTranslation($a_lang)
112 {
113 global $ilDB;
114
115 $query = "DELETE FROM object_translation WHERE obj_id= ".
116 $ilDB->quote($this->getId(),'integer')." AND lang_code = ".
117 $ilDB->quote($a_lang, 'text');
118 $res = $ilDB->manipulate($query);
119 }
120
121 // remove all Translations of current category
123 {
124 global $ilDB;
125
126 $query = "DELETE FROM object_translation WHERE obj_id= ".
127 $ilDB->quote($this->getId(),'integer');
128 $res = $ilDB->manipulate($query);
129 }
130
131 // add a new translation to current category
132 function addTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
133 {
134 global $ilDB;
135
136 if (empty($a_title))
137 {
138 $a_title = "NO TITLE";
139 }
140
141 $query = "INSERT INTO object_translation ".
142 "(obj_id,title,description,lang_code,lang_default) ".
143 "VALUES ".
144 "(".$ilDB->quote($this->getId(),'integer').",".
145 $ilDB->quote($a_title,'text').",".
146 $ilDB->quote($a_desc,'text').",".
147 $ilDB->quote($a_lang,'text').",".
148 $ilDB->quote($a_lang_default,'integer').")";
149 $res = $ilDB->manipulate($query);
150 return true;
151 }
152
153 function addAdditionalSubItemInformation(&$a_item_data)
154 {
155 include_once './Services/Object/classes/class.ilObjectActivation.php';
157 }
158
159} // END class.ObjRootFolder
160?>
An exception for terminatinating execution or to throw for unit testing.
Class ilContainer.
Class ilObjRootFolder.
__construct($a_id, $a_call_by_reference=true)
Constructor @access public.
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.
getId()
get object id @access public
$r
Definition: example_031.php:79
redirection script todo: (a better solution should control the processing via a xml file)
global $ilDB