ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBookmarkFolder Class Reference

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

+ Collaboration diagram for ilBookmarkFolder:

Public Member Functions

 ilBookmarkFolder ($a_bmf_id=0, $a_tree_id=0)
 Constructor public.
 read ()
 read bookmark folder data from db
 delete ()
 delete object data
 createNewBookmarkTree ()
 create personal bookmark tree
 create ()
 creates new bookmark folder in db
 update ()
 Update bookmark folder item.
 getId ()
 setId ($a_id)
 getTitle ()
 setTitle ($a_title)
 getParent ()
 setParent ($a_parent_id)
 _lookupTitle ($a_bmf_id)
 lookup bookmark folder title
 getObjects ($a_id)
 static
 _getNumberOfObjects ()
 Get number of folders and bookmarks for current user.
 getObject ($a_id)
 static
 isRootFolder ($a_id)
 getRootFolder ()
 _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:
class.ilBookmarkFolder.php 20152 2009-06-08 18:41:37Z akill

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

Member Function Documentation

ilBookmarkFolder::_getNumberOfObjects ( )

Get number of folders and bookmarks for current user.

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

References $_SESSION, and $tree.

Referenced by ilBookmarkBlockGUI\fillDataSection().

{
$a_tree_id = $_SESSION["AccountId"];
$tree = new ilTree($a_tree_id);
$tree->setTableNames('bookmark_tree','bookmark_data');
$root_node = $tree->getNodeData($tree->getRootId());
if ($root_node["lft"] != "")
{
$bmf = $tree->getSubTree($root_node, false, "bmf");
$bm = $tree->getSubTree($root_node, false, "bm");
}
else
{
$bmf = array("dummy");
$bm = array();
}
return array("folders" => (int) count($bmf) - 1, "bookmarks" => (int) count($bm));
}

+ Here is the caller graph for this function:

ilBookmarkFolder::_getParentId (   $a_id)

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

References $_SESSION, and $tree.

Referenced by ilBookmarkBlockGUI\getListRowData().

{
$a_tree_id = $_SESSION["AccountId"];
$tree = new ilTree($a_tree_id);
$tree->setTableNames('bookmark_tree','bookmark_data');
return $tree->getParentId($a_id);
}

+ Here is the caller graph for this function:

ilBookmarkFolder::_lookupTitle (   $a_bmf_id)

lookup bookmark folder title

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

References $ilDB.

Referenced by ilBookmarkBlockGUI\getListRowData().

{
global $ilDB;
$q = "SELECT * FROM bookmark_data WHERE obj_id = ".
$ilDB->quote($a_bmf_id, "integer");
$bmf_set = $ilDB->query($q);
$bmf = $ilDB->fetchAssoc($bmf_set);
return $bmf["title"];
}

+ Here is the caller graph for this function:

ilBookmarkFolder::create ( )

creates new bookmark folder in db

note: parent and title must be set

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

References $_SESSION, $ilDB, getId(), getParent(), getTitle(), and setId().

{
global $ilDB;
$this->setId($ilDB->nextId("bookmark_data"));
$q = sprintf(
"INSERT INTO bookmark_data (obj_id, user_id, title, type) ".
"VALUES (%s,%s,%s,%s)",
$ilDB->quote($this->getId(), "integer"),
$ilDB->quote($_SESSION["AccountId"], "integer"),
$ilDB->quote($this->getTitle(), "text"),
$ilDB->quote('bmf', "text")
);
$ilDB->manipulate($q);
$this->tree->insertNode($this->getId(), $this->getParent());
}

+ Here is the call graph for this function:

ilBookmarkFolder::createNewBookmarkTree ( )

create personal bookmark tree

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

References $ilDB.

{
global $ilDB;
/*
$q = "INSERT INTO bookmark_data (user_id, title, target, type) ".
"VALUES ('".$this->tree->getTreeId()."','dummy_folder','','bmf')";
$ilDB->query($q);*/
//$this->tree->addTree($this->tree->getTreeId(), $ilDB->getLastInsertId());
$this->tree->addTree($this->tree->getTreeId(), 1);
}
ilBookmarkFolder::delete ( )

delete object data

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

References $ilDB, and getId().

{
global $ilDB;
$q = "DELETE FROM bookmark_data WHERE obj_id = ".$ilDB->quote($this->getId(), "integer");
$ilDB->query($q);
}

+ Here is the call graph for this function:

ilBookmarkFolder::getId ( )

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

References $id.

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

{
return $this->id;
}

+ Here is the caller graph for this function:

ilBookmarkFolder::getObject (   $a_id)

static

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

References $_SESSION, and $tree.

Referenced by ilBookmarkImportExport\_exportBookmark().

{
$a_tree_id = $_SESSION["AccountId"];
$tree = new ilTree($a_tree_id);
$tree->setTableNames('bookmark_tree','bookmark_data');
if(empty($a_id))
{
$a_id = $tree->getRootId();
}
$object = $tree->getNodeData($a_id);
return $object;
}

+ Here is the caller graph for this function:

ilBookmarkFolder::getObjects (   $a_id)

static

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

References $_SESSION, and $tree.

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

{
$a_tree_id = $_SESSION["AccountId"];
$tree = new ilTree($a_tree_id);
$tree->setTableNames('bookmark_tree','bookmark_data');
if(empty($a_id))
{
$a_id = $tree->getRootId();
}
$childs = $tree->getChilds($a_id, "title");
$objects = array();
$bookmarks = array();
foreach ($childs as $key => $child)
{
switch ($child["type"])
{
case "bmf":
$objects[] = $child;
break;
case "bm":
$bookmarks[] = $child;
break;
}
}
foreach ($bookmarks as $key => $bookmark)
{
$objects[] = $bookmark;
}
return $objects;
}

+ Here is the caller graph for this function:

ilBookmarkFolder::getParent ( )

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

References $parent.

Referenced by create().

{
return $this->parent;
}

+ Here is the caller graph for this function:

ilBookmarkFolder::getRootFolder ( )

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

References $_SESSION, and $tree.

{
$a_tree_id = $_SESSION["AccountId"];
$tree = new ilTree($a_tree_id);
$tree->setTableNames('bookmark_tree','bookmark_data');
return $tree->getRootId();
}
ilBookmarkFolder::getTitle ( )

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

References $title.

Referenced by create().

{
return $this->title;
}

+ Here is the caller graph for this function:

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

Constructor public.

Parameters
integeruser_id (optional)

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

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

{
global $ilias;
// Initiate variables
$this->ilias =& $ilias;
if ($a_tree_id == 0)
{
$a_tree_id = $_SESSION["AccountId"];
}
$this->tree = new ilTree($a_tree_id);
$this->tree->setTableNames('bookmark_tree','bookmark_data');
$this->id = $a_bmf_id;
if(!empty($this->id))
{
$this->read();
}
}

+ Here is the call graph for this function:

ilBookmarkFolder::isRootFolder (   $a_id)

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

References $_SESSION, and $tree.

Referenced by ilBookmarkBlockGUI\getListRowData().

{
$a_tree_id = $_SESSION["AccountId"];
$tree = new ilTree($a_tree_id);
$tree->setTableNames('bookmark_tree','bookmark_data');
if ($a_id == $tree->getRootId())
{
return true;
}
else
{
return false;
}
}

+ Here is the caller graph for this function:

ilBookmarkFolder::read ( )

read bookmark folder data from db

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

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

Referenced by ilBookmarkFolder().

{
global $ilias, $ilDB;
$q = "SELECT * FROM bookmark_data WHERE obj_id = ".
$ilDB->quote($this->getId(), "integer");
$bmf_set = $ilDB->query($q);
if ($ilDB->numRows($bmf_set) == 0)
{
$message = "ilBookmarkFolder::read(): Bookmark Folder with id ".$this->getId()." not found!";
$ilias->raiseError($message,$ilias->error_obj->WARNING);
}
else
{
$bmf = $ilDB->fetchAssoc($bmf_set);
$this->setTitle($bmf["title"]);
$this->setParent($this->tree->getParentId($this->getId()));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkFolder::setId (   $a_id)

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

Referenced by create().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilBookmarkFolder::setParent (   $a_parent_id)

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

Referenced by read().

{
$this->parent = $a_parent_id;
}

+ Here is the caller graph for this function:

ilBookmarkFolder::setTitle (   $a_title)

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

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilBookmarkFolder::update ( )

Update bookmark folder item.

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

References $ilDB.

{
global $ilDB;
$q = sprintf(
"UPDATE bookmark_data SET title=%s ".
"WHERE obj_id=%s",
$ilDB->quote($this->getTitle(), "text"),
$ilDB->quote($this->getId(), "integer")
);
$ilDB->manipulate($q);
}

Field Documentation

ilBookmarkFolder::$id

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

Referenced by getId().

ilBookmarkFolder::$ilias

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

Referenced by ilBookmarkFolder(), and read().

ilBookmarkFolder::$parent

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

Referenced by getParent().

ilBookmarkFolder::$title

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

Referenced by getTitle().

ilBookmarkFolder::$tree

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