ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 "./Services/Object/classes/class.ilObject.php";
35 require_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  public 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  return false;
70  }
71 
72  // put here rootfolder specific stuff
73 
74  return true;
75  ;
76  }
77 
84  public 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  $data["Fobject"][$num]= array("title" => $row->title,
97  "desc" => $row->description,
98  "lang" => $row->lang_code
99  );
100  $num++;
101  }
102 
103  // first entry is always the default language
104  $data["default_language"] = 0;
105 
106  return $data ? $data : array();
107  }
108 
109  // remove translations of current category
110  public function deleteTranslation($a_lang)
111  {
112  global $ilDB;
113 
114  $query = "DELETE FROM object_translation WHERE obj_id= " .
115  $ilDB->quote($this->getId(), 'integer') . " AND lang_code = " .
116  $ilDB->quote($a_lang, 'text');
117  $res = $ilDB->manipulate($query);
118  }
119 
120  // remove all Translations of current category
121  public function removeTranslations()
122  {
123  global $ilDB;
124 
125  $query = "DELETE FROM object_translation WHERE obj_id= " .
126  $ilDB->quote($this->getId(), 'integer');
127  $res = $ilDB->manipulate($query);
128  }
129 
130  // add a new translation to current category
131  public function addTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
132  {
133  global $ilDB;
134 
135  if (empty($a_title)) {
136  $a_title = "NO TITLE";
137  }
138 
139  $query = "INSERT INTO object_translation " .
140  "(obj_id,title,description,lang_code,lang_default) " .
141  "VALUES " .
142  "(" . $ilDB->quote($this->getId(), 'integer') . "," .
143  $ilDB->quote($a_title, 'text') . "," .
144  $ilDB->quote($a_desc, 'text') . "," .
145  $ilDB->quote($a_lang, 'text') . "," .
146  $ilDB->quote($a_lang_default, 'integer') . ")";
147  $res = $ilDB->manipulate($query);
148  return true;
149  }
150 
151  public function addAdditionalSubItemInformation(&$a_item_data)
152  {
153  include_once './Services/Object/classes/class.ilObjectActivation.php';
155  }
156 } // END class.ObjRootFolder
Class ilObjRootFolder.
addTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
__construct($a_id, $a_call_by_reference=true)
Constructor public.
static addAdditionalSubItemInformation(array &$a_item)
Parse item data for list entries.
$r
Definition: example_031.php:79
catch(Exception $e) $message
foreach($_POST as $key=> $value) $res
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
Class ilContainer.
$query
getTranslations()
get all translations from this category
Create styles array
The data for the language used.
addAdditionalSubItemInformation(&$a_item_data)
global $ilDB