50 $this->tree =
new ilTree($a_tree_id);
51 $this->tree->setTableNames(
'bookmark_tree',
'bookmark_data');
52 $this->
id = $a_bmf_id;
67 $q =
"SELECT * FROM bookmark_data WHERE obj_id = ".
68 $ilDB->quote($this->
getId(),
"integer");
69 $bmf_set = $ilDB->query($q);
70 if ($ilDB->numRows($bmf_set) == 0)
72 $message =
"ilBookmarkFolder::read(): Bookmark Folder with id ".$this->getId().
" not found!";
73 $ilias->raiseError($message,$ilias->error_obj->WARNING);
77 $bmf = $ilDB->fetchAssoc($bmf_set);
79 $this->
setParent($this->tree->getParentId($this->getId()));
90 $q =
"DELETE FROM bookmark_data WHERE obj_id = ".$ilDB->quote($this->
getId(),
"integer");
106 $this->tree->addTree($this->tree->getTreeId(), 1);
118 $this->
setId($ilDB->nextId(
"bookmark_data"));
120 "INSERT INTO bookmark_data (obj_id, user_id, title, type) ".
121 "VALUES (%s,%s,%s,%s)",
122 $ilDB->quote($this->getId(),
"integer"),
123 $ilDB->quote(
$_SESSION[
"AccountId"],
"integer"),
124 $ilDB->quote($this->
getTitle(),
"text"),
125 $ilDB->quote(
'bmf',
"text")
128 $ilDB->manipulate($q);
140 "UPDATE bookmark_data SET title=%s ".
142 $ilDB->quote($this->getTitle(),
"text"),
143 $ilDB->quote($this->getId(),
"integer")
145 $ilDB->manipulate($q);
166 $this->title = $a_title;
176 $this->parent = $a_parent_id;
186 $q =
"SELECT * FROM bookmark_data WHERE obj_id = ".
187 $ilDB->quote($a_bmf_id,
"integer");
188 $bmf_set = $ilDB->query($q);
189 $bmf = $ilDB->fetchAssoc($bmf_set);
191 return $bmf[
"title"];
201 $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)
215 switch ($child[
"type"])
222 $bookmarks[] = $child;
226 foreach ($bookmarks as $key => $bookmark)
228 $objects[] = $bookmark;
240 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
242 $root_node =
$tree->getNodeData(
$tree->getRootId());
244 if ($root_node[
"lft"] !=
"")
246 $bmf =
$tree->getSubTree($root_node,
false,
"bmf");
247 $bm =
$tree->getSubTree($root_node,
false,
"bm");
251 $bmf = array(
"dummy");
255 return array(
"folders" => (
int) count($bmf) - 1,
"bookmarks" => (
int) count($bm));
266 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
270 $a_id =
$tree->getRootId();
273 $object =
$tree->getNodeData($a_id);
281 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
283 if ($a_id ==
$tree->getRootId())
297 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
299 return $tree->getRootId();
306 $tree->setTableNames(
'bookmark_tree',
'bookmark_data');
307 return $tree->getParentId($a_id);