ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBookmark Class Reference

Class Bookmarks Bookmark management. More...

+ Collaboration diagram for ilBookmark:

Public Member Functions

 __construct ($a_bm_id=0, $a_tree_id=0)
 Constructor public. More...
 
 read ()
 read bookmark folder data from db More...
 
 delete ()
 Delete bookmark data. More...
 
 create ()
 Create new bookmark item. More...
 
 update ()
 Update bookmark item. More...
 
 setId ($a_id)
 
 getId ()
 
 setTitle ($a_str)
 set title public More...
 
 getTitle ()
 
 setDescription ($a_str)
 set description public More...
 
 getDescription ()
 
 setTarget ($a_target)
 set target public More...
 
 getTarget ()
 
 setParent ($a_parent_id)
 
 getParent ()
 

Static Public Member Functions

static _getTypeOfId ($a_id)
 get type of a given id More...
 

Data Fields

 $user_Id
 
 $tree
 
 $title
 
 $description
 
 $target
 
 $id
 
 $parent
 

Protected Attributes

 $db
 
 $error
 

Detailed Description

Class Bookmarks Bookmark management.

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 17 of file class.ilBookmark.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookmark::__construct (   $a_bm_id = 0,
  $a_tree_id = 0 
)

Constructor public.

Parameters
integeruser_id (optional)

Definition at line 54 of file class.ilBookmark.php.

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

55  {
56  global $DIC;
57 
58  $this->db = $DIC->database();
59  $this->error = $DIC["ilErr"];
60  // Initiate variables
61  if ($a_tree_id == 0) {
62  $a_tree_id = $GLOBALS['DIC']['ilUser']->getId();
63  }
64 
65  $this->tree = new ilTree($a_tree_id);
66  $this->tree->setTableNames('bookmark_tree', 'bookmark_data');
67 
68  $this->id = $a_bm_id;
69 
70  if (!empty($this->id)) {
71  $this->read();
72  }
73  }
global $DIC
Definition: saml.php:7
read()
read bookmark folder data from db
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

Member Function Documentation

◆ _getTypeOfId()

static ilBookmark::_getTypeOfId (   $a_id)
static

get type of a given id

Parameters
numberid

Definition at line 230 of file class.ilBookmark.php.

References $DIC, and $ilDB.

Referenced by ilBookmarkAdministrationGUI\confirm(), and ilBookmarkAdministrationGUI\delete().

231  {
232  global $DIC;
233 
234  $ilDB = $DIC->database();
235 
236  $q = "SELECT * FROM bookmark_data WHERE obj_id = " .
237  $ilDB->quote($a_id, "integer");
238  $bm_set = $ilDB->query($q);
239  if ($ilDB->numRows($bm_set) == 0) {
240  return null;
241  } else {
242  $bm = $ilDB->fetchAssoc($bm_set);
243  return $bm["type"];
244  }
245  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ create()

ilBookmark::create ( )

Create new bookmark item.

Definition at line 117 of file class.ilBookmark.php.

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

118  {
119  $ilDB = $this->db;
120 
121  $this->setId($ilDB->nextId("bookmark_data"));
122  $q = sprintf(
123  "INSERT INTO bookmark_data (obj_id, user_id, title,description, target, type) " .
124  "VALUES (%s,%s,%s,%s,%s,%s)",
125  $ilDB->quote($this->getId(), "integer"),
126  $ilDB->quote($GLOBALS['DIC']['ilUser']->getId(), "integer"),
127  $ilDB->quote($this->getTitle(), "text"),
128  $ilDB->quote($this->getDescription(), "text"),
129  $ilDB->quote($this->getTarget(), "text"),
130  $ilDB->quote('bm', "text")
131  );
132 
133  $ilDB->manipulate($q);
134  $this->tree->insertNode($this->getId(), $this->getParent());
135  }
global $ilDB
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ delete()

ilBookmark::delete ( )

Delete bookmark data.

Definition at line 102 of file class.ilBookmark.php.

References $db, $ilDB, and getId().

103  {
104  $ilDB = $this->db;
105 
106  if ($this->getId() != 1) {
107  $q = "DELETE FROM bookmark_data WHERE obj_id = " .
108  $ilDB->quote($this->getId(), "integer");
109  $ilDB->manipulate($q);
110  }
111  }
global $ilDB
+ Here is the call graph for this function:

◆ getDescription()

ilBookmark::getDescription ( )

Definition at line 195 of file class.ilBookmark.php.

References $description.

196  {
197  return $this->description;
198  }

◆ getId()

ilBookmark::getId ( )

Definition at line 166 of file class.ilBookmark.php.

References $id.

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

167  {
168  return $this->id;
169  }
+ Here is the caller graph for this function:

◆ getParent()

ilBookmark::getParent ( )

Definition at line 221 of file class.ilBookmark.php.

References $parent.

Referenced by create().

222  {
223  return $this->parent;
224  }
+ Here is the caller graph for this function:

◆ getTarget()

ilBookmark::getTarget ( )

Definition at line 211 of file class.ilBookmark.php.

References $target.

212  {
213  return $this->target;
214  }

◆ getTitle()

ilBookmark::getTitle ( )

Definition at line 181 of file class.ilBookmark.php.

References $title.

182  {
183  return $this->title;
184  }

◆ read()

ilBookmark::read ( )

read bookmark folder data from db

Definition at line 79 of file class.ilBookmark.php.

References $db, $error, $ilDB, $ilErr, $message, getId(), setDescription(), setParent(), setTarget(), and setTitle().

Referenced by __construct().

80  {
81  $ilDB = $this->db;
83 
84  $q = "SELECT * FROM bookmark_data WHERE obj_id = " .
85  $ilDB->quote($this->getId(), "integer");
86  $bm_set = $ilDB->query($q);
87  if ($ilDB->numRows($bm_set) == 0) {
88  $message = "ilBookmark::read(): Bookmark with id " . $this->id . " not found!";
89  $ilErr->raiseError($message, $ilErr->WARNING);
90  } else {
91  $bm = $ilDB->fetchAssoc($bm_set);
92  $this->setTitle($bm["title"]);
93  $this->setDescription($bm["description"]);
94  $this->setTarget($bm["target"]);
95  $this->setParent($this->tree->getParentId($this->id));
96  }
97  }
setTarget($a_target)
set target public
setTitle($a_str)
set title public
$ilErr
Definition: raiseError.php:18
catch(Exception $e) $message
setParent($a_parent_id)
setDescription($a_str)
set description public
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDescription()

ilBookmark::setDescription (   $a_str)

set description public

Parameters
string

Definition at line 190 of file class.ilBookmark.php.

Referenced by read().

191  {
192  $this->description = $a_str;
193  }
+ Here is the caller graph for this function:

◆ setId()

ilBookmark::setId (   $a_id)

Definition at line 161 of file class.ilBookmark.php.

Referenced by create().

162  {
163  $this->id = $a_id;
164  }
+ Here is the caller graph for this function:

◆ setParent()

ilBookmark::setParent (   $a_parent_id)

Definition at line 216 of file class.ilBookmark.php.

Referenced by read().

217  {
218  $this->parent = $a_parent_id;
219  }
+ Here is the caller graph for this function:

◆ setTarget()

ilBookmark::setTarget (   $a_target)

set target public

Parameters
string

Definition at line 205 of file class.ilBookmark.php.

Referenced by read().

206  {
207  $this->target = $a_target;
208  }
+ Here is the caller graph for this function:

◆ setTitle()

ilBookmark::setTitle (   $a_str)

set title public

Parameters
string

Definition at line 176 of file class.ilBookmark.php.

Referenced by read().

177  {
178  $this->title = $a_str;
179  }
+ Here is the caller graph for this function:

◆ update()

ilBookmark::update ( )

Update bookmark item.

Definition at line 140 of file class.ilBookmark.php.

References $db, and $ilDB.

141  {
142  $ilDB = $this->db;
143 
144  $q = sprintf(
145  "UPDATE bookmark_data SET title=%s,description=%s,target=%s " .
146  "WHERE obj_id=%s",
147  $ilDB->quote($this->getTitle(), "text"),
148  $ilDB->quote($this->getDescription(), "text"),
149  $ilDB->quote($this->getTarget(), "text"),
150  $ilDB->quote($this->getId(), "integer")
151  );
152  $ilDB->manipulate($q);
153  }
global $ilDB

Field Documentation

◆ $db

ilBookmark::$db
protected

Definition at line 22 of file class.ilBookmark.php.

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

◆ $description

ilBookmark::$description

Definition at line 44 of file class.ilBookmark.php.

Referenced by getDescription().

◆ $error

ilBookmark::$error
protected

Definition at line 27 of file class.ilBookmark.php.

Referenced by read().

◆ $id

ilBookmark::$id

Definition at line 46 of file class.ilBookmark.php.

Referenced by getId().

◆ $parent

ilBookmark::$parent

Definition at line 47 of file class.ilBookmark.php.

Referenced by getParent().

◆ $target

ilBookmark::$target

Definition at line 45 of file class.ilBookmark.php.

Referenced by getTarget().

◆ $title

ilBookmark::$title

Definition at line 43 of file class.ilBookmark.php.

Referenced by getTitle().

◆ $tree

ilBookmark::$tree

Definition at line 41 of file class.ilBookmark.php.

◆ $user_Id

ilBookmark::$user_Id

Definition at line 34 of file class.ilBookmark.php.


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