ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjSystemFolder.php
Go to the documentation of this file.
1<?php
2
25{
26 protected ilObjUser $user;
27
34 public function __construct($a_id, $a_call_by_reference = true)
35 {
36 global $DIC;
37
38 $this->db = $DIC->database();
39 $this->user = $DIC->user();
40 $this->type = "adm";
41 parent::__construct($a_id, $a_call_by_reference);
42 }
43
44
51 public function delete(): bool
52 {
53 // DISABLED
54 return false;
55
56 // always call parent delete function first!!
57 if (!parent::delete()) {
58 return false;
59 }
60
61 // put here systemfolder specific stuff
62
63 // always call parent delete function at the end!!
64 return true;
65 }
66
73 public function getHeaderTitleTranslations()
74 {
79
80 $q = "SELECT * FROM object_translation WHERE obj_id = " .
81 $ilDB->quote($this->getId(), 'integer') . " ORDER BY lang_default DESC";
82 $r = $ilDB->query($q);
83
84 $num = 0;
85
86 while ($row = $ilDB->fetchObject($r)) {
87 $data["Fobject"][$num] = array("title" => $row->title,
89 (string) $row->description,
91 true
92 ),
93 "lang" => $row->lang_code
94 );
95 $num++;
96 }
97
98 // first entry is always the default language
99 $data["default_language"] = 0;
100
101 return $data ? $data : array();
102 }
103
104 // remove all Translations of current category
106 {
108
109 $query = "DELETE FROM object_translation WHERE obj_id= " .
110 $ilDB->quote($this->getId(), 'integer');
111 $res = $ilDB->manipulate($query);
112 }
113
114 // add a new translation to current category
115 public function addHeaderTitleTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
116 {
118
119 $query = "INSERT INTO object_translation " .
120 "(obj_id,title,description,lang_code,lang_default) " .
121 "VALUES " .
122 "(" . $ilDB->quote($this->getId(), 'integer') . "," .
123 $ilDB->quote($a_title, 'text') . "," .
124 $ilDB->quote($a_desc, 'text') . "," .
125 $ilDB->quote($a_lang, 'text') . "," .
126 $ilDB->quote($a_lang_default, 'integer') . ")";
127 $res = $ilDB->manipulate($query);
128
129 return true;
130 }
131
132 public static function _getId()
133 {
137 global $DIC;
138
139 $ilDB = $DIC->database();
140
141 $q = "SELECT obj_id FROM object_data WHERE type = " . $ilDB->quote('adm', 'text');
142 $r = $ilDB->query($q);
143 $row = $ilDB->fetchObject($r);
144
145 return $row->obj_id;
146 }
147
148 public static function _getHeaderTitle(): string
149 {
154 global $DIC;
155
156 $ilDB = $DIC->database();
157 $ilUser = $DIC->user();
158
159 $id = ilObjSystemFolder::_getId();
160
161 $title = '';
162
163 $q = "SELECT title FROM object_translation " .
164 "WHERE obj_id = " . $ilDB->quote($id, 'integer') . " " .
165 "AND lang_default = 1";
166 $r = $ilDB->query($q);
167 $row = $ilDB->fetchObject($r);
168 if ($row !== null) {
169 $title = (string) $row->title;
170 }
171
172 $q = "SELECT title FROM object_translation " .
173 "WHERE obj_id = " . $ilDB->quote($id, 'integer') . " " .
174 "AND lang_code = " .
175 $ilDB->quote($ilUser->getCurrentLanguage(), 'text') . " " .
176 "AND NOT lang_default = 1";
177 $r = $ilDB->query($q);
178 $row = $ilDB->fetchObject($r);
179
180 if ($row !== null) {
181 $title = (string) $row->title;
182 }
183
184 return $title;
185 }
186
188 {
190 $ilUser = $this->user;
191
192 $id = ilObjSystemFolder::_getId();
193
194 $q = "SELECT title,description FROM object_translation " .
195 "WHERE obj_id = " . $ilDB->quote($id, 'integer') . " " .
196 "AND lang_default = 1";
197 $r = $ilDB->query($q);
198 $row = $ilDB->fetchObject($r);
199 $description = $row->description;
200
201 $q = "SELECT title,description FROM object_translation " .
202 "WHERE obj_id = " . $ilDB->quote($id, 'integer') . " " .
203 "AND lang_code = " .
204 $ilDB->quote($ilUser->getLanguage(), 'text') . " " .
205 "AND NOT lang_default = 1";
206 $r = $ilDB->query($q);
207 $row = $ilDB->fetchObject($r);
208
209 if ($row) {
210 $description = ilStr::shortenTextExtended($row->description, ilObject::DESC_LENGTH, true);
211 }
212
213 return $description;
214 }
215} // END class.ilObjSystemFolder
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct($a_id, $a_call_by_reference=true)
Constructor @access public.
addHeaderTitleTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
User class.
Class ilObject Basic functions for all objects.
string $title
const DESC_LENGTH
ilDBInterface $db
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
$res
Definition: ltiservices.php:69
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26
$q
Definition: shib_logout.php:23