ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjSystemFolder.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 
37 {
44  function ilObjSystemFolder($a_id,$a_call_by_reference = true)
45  {
46  $this->type = "adm";
47  $this->ilObject($a_id,$a_call_by_reference);
48  }
49 
50 
57  function delete()
58  {
59  // DISABLED
60  return false;
61 
62  // always call parent delete function first!!
63  if (!parent::delete())
64  {
65  return false;
66  }
67 
68  // put here systemfolder specific stuff
69 
70  // always call parent delete function at the end!!
71  return true;
72  }
73 
81  {
82  global $ilDB;
83 
84  $q = "SELECT * FROM object_translation WHERE obj_id = ".
85  $ilDB->quote($this->getId(),'integer')." ORDER BY lang_default DESC";
86  $r = $this->ilias->db->query($q);
87 
88  $num = 0;
89 
90  while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
91  {
92  $data["Fobject"][$num]= array("title" => $row->title,
93  "desc" => ilUtil::shortenText($row->description,MAXLENGTH_OBJ_DESC,true),
94  "lang" => $row->lang_code
95  );
96  $num++;
97  }
98 
99  // first entry is always the default language
100  $data["default_language"] = 0;
101 
102  return $data ? $data : array();
103  }
104 
105  // remove all Translations of current category
107  {
108  global $ilDB;
109 
110  $query = "DELETE FROM object_translation WHERE obj_id= ".
111  $ilDB->quote($this->getId(),'integer');
112  $res = $ilDB->manipulate($query);
113  }
114 
115  // add a new translation to current category
116  function addHeaderTitleTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
117  {
118  global $ilDB;
119 
120  $query = "INSERT INTO object_translation ".
121  "(obj_id,title,description,lang_code,lang_default) ".
122  "VALUES ".
123  "(".$ilDB->quote($this->getId(),'integer').",".
124  $ilDB->quote($a_title,'text').",".
125  $ilDB->quote($a_desc,'text').",".
126  $ilDB->quote($a_lang,'text').",".
127  $ilDB->quote($a_lang_default,'integer').")";
128  $res = $ilDB->manipulate($query);
129 
130  return true;
131  }
132 
133  function _getId()
134  {
135  $q = "SELECT obj_id FROM object_data ".
136  "WHERE type = 'adm'";
137  $r = $this->ilias->db->query($q);
138  $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
139 
140  return $row->obj_id;
141  }
142 
143  function _getHeaderTitle()
144  {
145  global $ilDB;
146 
148 
149  $q = "SELECT title,description FROM object_translation ".
150  "WHERE obj_id = ".$ilDB->quote($id,'integer')." ".
151  "AND lang_default = 1";
152  $r = $this->ilias->db->query($q);
153  $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
154  $title = $row->title;
155 
156  $q = "SELECT title,description FROM object_translation ".
157  "WHERE obj_id = ".$ilDB->quote($id,'integer')." ".
158  "AND lang_code = ".
159  $ilDB->quote($this->ilias->account->getPref("language"),'text')." ".
160  "AND NOT lang_default = 1";
161  $r = $this->ilias->db->query($q);
162  $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
163 
164  if ($row)
165  {
166  $title = $row->title;
167  }
168 
169  return $title;
170  }
171 
173  {
174  global $ilDB;
175 
177 
178  $q = "SELECT title,description FROM object_translation ".
179  "WHERE obj_id = ".$ilDB->quote($id,'integer')." ".
180  "AND lang_default = 1";
181  $r = $this->ilias->db->query($q);
182  $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
183  $description = $row->description;
184 
185  $q = "SELECT title,description FROM object_translation ".
186  "WHERE obj_id = ".$ilDB->quote($id,'integer')." ".
187  "AND lang_code = ".
188  $ilDB->quote($this->ilias->account->getPref("language"),'text')." ".
189  "AND NOT lang_default = 1";
190  $r = $this->ilias->db->query($q);
191  $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
192 
193  if ($row)
194  {
195  $description = ilUtil::shortenText($row->description,MAXLENGTH_OBJ_DESC,true);
196  }
197 
198  return $description;
199  }
200 
201 } // END class.ilObjSystemFolder
202 ?>