ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilBookmarkFolder Class Reference

bookmark folder (note: this class handles personal bookmarks folders only) More...

+ Collaboration diagram for ilBookmarkFolder:

Public Member Functions

 __construct ($a_bmf_id=0, $a_tree_id=0)
 Constructor public. More...
 
 read ()
 read bookmark folder data from db More...
 
 delete ()
 delete object data More...
 
 createNewBookmarkTree ()
 create personal bookmark tree More...
 
 create ()
 creates new bookmark folder in db More...
 
 update ()
 Update bookmark folder item. More...
 
 getId ()
 
 setId ($a_id)
 
 getTitle ()
 
 setTitle ($a_title)
 
 getParent ()
 
 setParent ($a_parent_id)
 
 getRootFolder ()
 

Static Public Member Functions

static _lookupTitle ($a_bmf_id)
 lookup bookmark folder title More...
 
static getObjects ($a_id)
 static More...
 
static _getNumberOfObjects ()
 Get number of folders and bookmarks for current user. More...
 
static getObject ($a_id)
 static More...
 
static isRootFolder ($a_id)
 
static _getParentId ($a_id)
 

Data Fields

 $tree
 
 $ilias
 
 $id
 
 $title
 
 $parent
 

Detailed Description

bookmark folder (note: this class handles personal bookmarks folders only)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Manfred Thaler manfr.nosp@m.ed.t.nosp@m.haler.nosp@m.@end.nosp@m.o7.co.nosp@m.m
Version
$Id$

Definition at line 14 of file class.ilBookmarkFolder.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookmarkFolder::__construct (   $a_bmf_id = 0,
  $a_tree_id = 0 
)

Constructor public.

Parameters
integeruser_id (optional)

Definition at line 39 of file class.ilBookmarkFolder.php.

References $GLOBALS, $ilias, and read().

40  {
41  global $ilias;
42 
43  // Initiate variables
44  $this->ilias = $ilias;
45  if ($a_tree_id == 0)
46  {
47  $a_tree_id = $GLOBALS['DIC']['ilUser']->getId();
48  }
49 
50  $this->tree = new ilTree($a_tree_id);
51  $this->tree->setTableNames('bookmark_tree','bookmark_data');
52  $this->id = $a_bmf_id;
53 
54  if(!empty($this->id))
55  {
56  $this->read();
57  }
58  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
read()
read bookmark folder data from db
redirection script todo: (a better solution should control the processing via a xml file) ...
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the call graph for this function:

Member Function Documentation

◆ _getNumberOfObjects()

static ilBookmarkFolder::_getNumberOfObjects ( )
static

Get number of folders and bookmarks for current user.

Definition at line 236 of file class.ilBookmarkFolder.php.

References $GLOBALS, and array.

Referenced by ilBookmarkBlockGUI\fillDataSection().

237  {
238  $a_tree_id = $GLOBALS['DIC']['ilUser']->getId();
239  $tree = new ilTree($a_tree_id);
240  $tree->setTableNames('bookmark_tree','bookmark_data');
241 
242  $root_node = $tree->getNodeData($tree->getRootId());
243 
244  if ($root_node["lft"] != "")
245  {
246  $bmf = $tree->getSubTree($root_node, false, "bmf");
247  $bm = $tree->getSubTree($root_node, false, "bm");
248  }
249  else
250  {
251  $bmf = array("dummy");
252  $bm = array();
253  }
254 
255  return array("folders" => (int) count($bmf) - 1, "bookmarks" => (int) count($bm));
256  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
+ Here is the caller graph for this function:

◆ _getParentId()

static ilBookmarkFolder::_getParentId (   $a_id)
static

Definition at line 302 of file class.ilBookmarkFolder.php.

References $GLOBALS.

Referenced by ilBookmarkBlockGUI\getListRowData().

303  {
304  $a_tree_id = $GLOBALS['DIC']['ilUser']->getId();
305  $tree = new ilTree($a_tree_id);
306  $tree->setTableNames('bookmark_tree','bookmark_data');
307  return $tree->getParentId($a_id);
308  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the caller graph for this function:

◆ _lookupTitle()

static ilBookmarkFolder::_lookupTitle (   $a_bmf_id)
static

lookup bookmark folder title

Definition at line 182 of file class.ilBookmarkFolder.php.

References $ilDB.

Referenced by ilBookmarkBlockGUI\getListRowData().

183  {
184  global $ilDB;
185 
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);
190 
191  return $bmf["title"];
192  }
global $ilDB
+ Here is the caller graph for this function:

◆ create()

ilBookmarkFolder::create ( )

creates new bookmark folder in db

note: parent and title must be set

Definition at line 114 of file class.ilBookmarkFolder.php.

References $GLOBALS, $ilDB, getId(), getParent(), and setId().

115  {
116  global $ilDB;
117 
118  $this->setId($ilDB->nextId("bookmark_data"));
119  $q = sprintf(
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($GLOBALS['DIC']['ilUser']->getId(), "integer"),
124  $ilDB->quote($this->getTitle(), "text"),
125  $ilDB->quote('bmf', "text")
126  );
127 
128  $ilDB->manipulate($q);
129  $this->tree->insertNode($this->getId(), $this->getParent());
130  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilDB
+ Here is the call graph for this function:

◆ createNewBookmarkTree()

ilBookmarkFolder::createNewBookmarkTree ( )

create personal bookmark tree

Definition at line 97 of file class.ilBookmarkFolder.php.

References $ilDB.

98  {
99  global $ilDB;
100 
101  /*
102  $q = "INSERT INTO bookmark_data (user_id, title, target, type) ".
103  "VALUES ('".$this->tree->getTreeId()."','dummy_folder','','bmf')";
104  $ilDB->query($q);*/
105  //$this->tree->addTree($this->tree->getTreeId(), $ilDB->getLastInsertId());
106  $this->tree->addTree($this->tree->getTreeId(), 1);
107  }
global $ilDB

◆ delete()

ilBookmarkFolder::delete ( )

delete object data

Definition at line 86 of file class.ilBookmarkFolder.php.

References $ilDB, and getId().

87  {
88  global $ilDB;
89 
90  $q = "DELETE FROM bookmark_data WHERE obj_id = ".$ilDB->quote($this->getId(), "integer");
91  $ilDB->query($q);
92  }
global $ilDB
+ Here is the call graph for this function:

◆ getId()

ilBookmarkFolder::getId ( )

Definition at line 149 of file class.ilBookmarkFolder.php.

References $id.

Referenced by create(), delete(), and read().

150  {
151  return $this->id;
152  }
+ Here is the caller graph for this function:

◆ getObject()

static ilBookmarkFolder::getObject (   $a_id)
static

static

Definition at line 262 of file class.ilBookmarkFolder.php.

References $GLOBALS.

Referenced by ilBookmarkImportExport\_exportBookmark().

263  {
264  $a_tree_id = $GLOBALS['DIC']['ilUser']->getId();
265  $tree = new ilTree($a_tree_id);
266  $tree->setTableNames('bookmark_tree','bookmark_data');
267 
268  if(empty($a_id))
269  {
270  $a_id = $tree->getRootId();
271  }
272 
273  $object = $tree->getNodeData($a_id);
274  return $object;
275  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the caller graph for this function:

◆ getObjects()

static ilBookmarkFolder::getObjects (   $a_id)
static

static

Definition at line 197 of file class.ilBookmarkFolder.php.

References $GLOBALS, and array.

Referenced by ilBookmarkImportExport\__parseExport(), ilBookmarkBlockGUI\getListRowData(), and ilBookmarkAdministrationGUI\view().

198  {
199  $a_tree_id = $GLOBALS['DIC']['ilUser']->getId();
200  $tree = new ilTree($a_tree_id);
201  $tree->setTableNames('bookmark_tree','bookmark_data');
202 
203  if(empty($a_id))
204  {
205  $a_id = $tree->getRootId();
206  }
207 
208  $childs = $tree->getChilds($a_id, "title");
209 
210  $objects = array();
211  $bookmarks = array();
212 
213  foreach ($childs as $key => $child)
214  {
215  switch ($child["type"])
216  {
217  case "bmf":
218  $objects[] = $child;
219  break;
220 
221  case "bm":
222  $bookmarks[] = $child;
223  break;
224  }
225  }
226  foreach ($bookmarks as $key => $bookmark)
227  {
228  $objects[] = $bookmark;
229  }
230  return $objects;
231  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
+ Here is the caller graph for this function:

◆ getParent()

ilBookmarkFolder::getParent ( )

Definition at line 169 of file class.ilBookmarkFolder.php.

References $parent.

Referenced by create().

170  {
171  return $this->parent;
172  }
+ Here is the caller graph for this function:

◆ getRootFolder()

ilBookmarkFolder::getRootFolder ( )

Definition at line 293 of file class.ilBookmarkFolder.php.

References $GLOBALS.

294  {
295  $a_tree_id = $GLOBALS['DIC']['ilUser']->getId();
296  $tree = new ilTree($a_tree_id);
297  $tree->setTableNames('bookmark_tree','bookmark_data');
298 
299  return $tree->getRootId();
300  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

◆ getTitle()

ilBookmarkFolder::getTitle ( )

Definition at line 159 of file class.ilBookmarkFolder.php.

References $title.

160  {
161  return $this->title;
162  }

◆ isRootFolder()

static ilBookmarkFolder::isRootFolder (   $a_id)
static

Definition at line 277 of file class.ilBookmarkFolder.php.

References $GLOBALS.

Referenced by ilBookmarkBlockGUI\getListRowData().

278  {
279  $a_tree_id = $GLOBALS['DIC']['ilUser']->getId();
280  $tree = new ilTree($a_tree_id);
281  $tree->setTableNames('bookmark_tree','bookmark_data');
282 
283  if ($a_id == $tree->getRootId())
284  {
285  return true;
286  }
287  else
288  {
289  return false;
290  }
291  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the caller graph for this function:

◆ read()

ilBookmarkFolder::read ( )

read bookmark folder data from db

Definition at line 63 of file class.ilBookmarkFolder.php.

References $ilDB, $ilias, getId(), setParent(), and setTitle().

Referenced by __construct().

64  {
65  global $ilias, $ilDB;
66 
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)
71  {
72  $message = "ilBookmarkFolder::read(): Bookmark Folder with id ".$this->getId()." not found!";
73  $ilias->raiseError($message,$ilias->error_obj->WARNING);
74  }
75  else
76  {
77  $bmf = $ilDB->fetchAssoc($bmf_set);
78  $this->setTitle($bmf["title"]);
79  $this->setParent($this->tree->getParentId($this->getId()));
80  }
81  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setId()

ilBookmarkFolder::setId (   $a_id)

Definition at line 154 of file class.ilBookmarkFolder.php.

Referenced by create().

155  {
156  $this->id = $a_id;
157  }
+ Here is the caller graph for this function:

◆ setParent()

ilBookmarkFolder::setParent (   $a_parent_id)

Definition at line 174 of file class.ilBookmarkFolder.php.

Referenced by read().

175  {
176  $this->parent = $a_parent_id;
177  }
+ Here is the caller graph for this function:

◆ setTitle()

ilBookmarkFolder::setTitle (   $a_title)

Definition at line 164 of file class.ilBookmarkFolder.php.

Referenced by read().

165  {
166  $this->title = $a_title;
167  }
+ Here is the caller graph for this function:

◆ update()

ilBookmarkFolder::update ( )

Update bookmark folder item.

Definition at line 135 of file class.ilBookmarkFolder.php.

References $ilDB.

136  {
137  global $ilDB;
138 
139  $q = sprintf(
140  "UPDATE bookmark_data SET title=%s ".
141  "WHERE obj_id=%s",
142  $ilDB->quote($this->getTitle(), "text"),
143  $ilDB->quote($this->getId(), "integer")
144  );
145  $ilDB->manipulate($q);
146  }
global $ilDB

Field Documentation

◆ $id

ilBookmarkFolder::$id

Definition at line 30 of file class.ilBookmarkFolder.php.

Referenced by getId().

◆ $ilias

ilBookmarkFolder::$ilias

Definition at line 28 of file class.ilBookmarkFolder.php.

Referenced by __construct(), and read().

◆ $parent

ilBookmarkFolder::$parent

Definition at line 32 of file class.ilBookmarkFolder.php.

Referenced by getParent().

◆ $title

ilBookmarkFolder::$title

Definition at line 31 of file class.ilBookmarkFolder.php.

Referenced by getTitle().

◆ $tree

ilBookmarkFolder::$tree

Definition at line 21 of file class.ilBookmarkFolder.php.


The documentation for this class was generated from the following file: