45 $this->db = $DIC->database();
46 $this->error = $DIC[
"ilErr"];
48 if ($a_tree_id == 0) {
49 $a_tree_id =
$GLOBALS[
'DIC'][
'ilUser']->getId();
52 $this->tree =
new ilTree($a_tree_id);
53 $this->tree->setTableNames(
'bookmark_tree',
'bookmark_data');
54 $this->
id = $a_bmf_id;
56 if (!empty($this->
id)) {
69 $q =
"SELECT * FROM bookmark_data WHERE obj_id = " .
71 $bmf_set =
$ilDB->query($q);
72 if (
$ilDB->numRows($bmf_set) == 0) {
73 $message =
"ilBookmarkFolder::read(): Bookmark Folder with id " . $this->
getId() .
" not found!";
76 $bmf =
$ilDB->fetchAssoc($bmf_set);
78 $this->
setParent($this->tree->getParentId($this->getId()));
85 public function delete()
89 $q =
"DELETE FROM bookmark_data WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
105 $this->tree->addTree($this->tree->getTreeId(), 1);
119 "INSERT INTO bookmark_data (obj_id, user_id, title, type) " .
120 "VALUES (%s,%s,%s,%s)",
121 $ilDB->quote($this->getId(),
"integer"),
123 $ilDB->quote($this->getTitle(),
"text"),
124 $ilDB->quote(
'bmf',
"text")
127 $ilDB->manipulate($q);
139 "UPDATE bookmark_data SET title=%s " .
141 $ilDB->quote($this->getTitle(),
"text"),
142 $ilDB->quote($this->getId(),
"integer")
144 $ilDB->manipulate($q);
165 $this->title = $a_title;
175 $this->parent = $a_parent_id;
185 $ilDB = $DIC->database();
187 $q =
"SELECT * FROM bookmark_data WHERE obj_id = " .
188 $ilDB->quote($a_bmf_id,
"integer");
189 $bmf_set =
$ilDB->query($q);
190 $bmf =
$ilDB->fetchAssoc($bmf_set);
192 return $bmf[
"title"];
200 $a_tree_id =
$GLOBALS[
'DIC'][
'ilUser']->getId();
202 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
205 $a_id =
$tree->getRootId();
208 $childs =
$tree->getChilds($a_id,
"title");
211 $bookmarks =
array();
213 foreach ($childs as
$key => $child) {
214 switch ($child[
"type"]) {
220 $bookmarks[] = $child;
224 foreach ($bookmarks as
$key => $bookmark) {
225 $objects[] = $bookmark;
235 $a_tree_id =
$GLOBALS[
'DIC'][
'ilUser']->getId();
237 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
239 $root_node =
$tree->getNodeData(
$tree->getRootId());
241 if ($root_node[
"lft"] !=
"") {
242 $bmf =
$tree->getSubTree($root_node,
false,
"bmf");
243 $bm =
$tree->getSubTree($root_node,
false,
"bm");
245 $bmf =
array(
"dummy");
249 return array(
"folders" => (
int) count($bmf) - 1,
"bookmarks" => (
int) count($bm));
258 $a_tree_id =
$GLOBALS[
'DIC'][
'ilUser']->getId();
260 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
263 $a_id =
$tree->getRootId();
266 $object =
$tree->getNodeData($a_id);
272 $a_tree_id =
$GLOBALS[
'DIC'][
'ilUser']->getId();
274 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
276 if ($a_id ==
$tree->getRootId()) {
285 $a_tree_id =
$GLOBALS[
'DIC'][
'ilUser']->getId();
287 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
289 return $tree->getRootId();
294 $a_tree_id =
$GLOBALS[
'DIC'][
'ilUser']->getId();
296 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
297 return $tree->getParentId($a_id);
static _getParentId($a_id)
static getObject($a_id)
static
static _getNumberOfObjects()
Get number of folders and bookmarks for current user.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static isRootFolder($a_id)
__construct($a_bmf_id=0, $a_tree_id=0)
Constructor public.
static _lookupTitle($a_bmf_id)
lookup bookmark folder title
catch(Exception $e) $message
read()
read bookmark folder data from db
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
bookmark folder (note: this class handles personal bookmarks folders only)
createNewBookmarkTree()
create personal bookmark tree
static getObjects($a_id)
static
update()
Update bookmark folder item.
create()
creates new bookmark folder in db