bookmark folder (note: this class handles personal bookmarks folders only) More...
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 () | |
| 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 | |
bookmark folder (note: this class handles personal bookmarks folders only)
Definition at line 33 of file class.ilBookmarkFolder.php.
| ilBookmarkFolder::_getNumberOfObjects | ( | ) |
Get number of folders and bookmarks for current user.
Definition at line 242 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 308 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 189 of file class.ilBookmarkFolder.php.
Referenced by ilBookmarkBlockGUI::getListRowData().
{
global $ilDB;
$q = "SELECT * FROM bookmark_data WHERE obj_id = ".$ilDB->quote($a_bmf_id);
$bmf_set = $ilDB->query($q);
$bmf = $bmf_set->fetchRow(DB_FETCHMODE_ASSOC);
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 130 of file class.ilBookmarkFolder.php.
References $_SESSION, getId(), getParent(), getTitle(), and setId().
{
$q = sprintf(
"INSERT INTO bookmark_data (user_id, title, type) ".
"VALUES (%s,%s,%s)",
$this->ilias->db->quote($_SESSION["AccountId"]),
$this->ilias->db->quote($this->getTitle()),
$this->ilias->db->quote('bmf')
);
$this->ilias->db->query($q);
$this->setId($this->ilias->db->getLastInsertId());
$this->tree->insertNode($this->getId(), $this->getParent());
}
Here is the call graph for this function:| ilBookmarkFolder::createNewBookmarkTree | ( | ) |
create personal bookmark tree
Definition at line 113 of file class.ilBookmarkFolder.php.
{
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 104 of file class.ilBookmarkFolder.php.
References getId().
{
$q = "DELETE FROM bookmark_data WHERE obj_id = ".$this->ilias->db->quote($this->getId());
$this->ilias->db->query($q);
}
Here is the call graph for this function:| ilBookmarkFolder::getId | ( | ) |
Definition at line 156 of file class.ilBookmarkFolder.php.
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 268 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 203 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 176 of file class.ilBookmarkFolder.php.
Referenced by create().
{
return $this->parent;
}
Here is the caller graph for this function:| ilBookmarkFolder::getRootFolder | ( | ) |
| ilBookmarkFolder::getTitle | ( | ) |
Definition at line 166 of file class.ilBookmarkFolder.php.
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.
| integer | user_id (optional) |
Definition at line 58 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 283 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 82 of file class.ilBookmarkFolder.php.
References $ilias, getId(), setParent(), and setTitle().
Referenced by ilBookmarkFolder().
{
global $ilias;
$q = "SELECT * FROM bookmark_data WHERE obj_id = ".$this->ilias->db->quote($this->getId());
$bmf_set = $this->ilias->db->query($q);
if ($bmf_set->numRows() == 0)
{
$message = "ilBookmarkFolder::read(): Bookmark Folder with id ".$this->getId()." not found!";
$ilias->raiseError($message,$ilias->error_obj->WARNING);
}
else
{
$bmf = $bmf_set->fetchRow(DB_FETCHMODE_ASSOC);
$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 161 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 181 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 171 of file class.ilBookmarkFolder.php.
Referenced by read().
{
$this->title = $a_title;
}
Here is the caller graph for this function:| ilBookmarkFolder::update | ( | ) |
Definition at line 144 of file class.ilBookmarkFolder.php.
{
$q = sprintf(
"UPDATE bookmark_data SET title=%s ".
"WHERE obj_id=%s",
$this->ilias->db->quote($this->getTitle()),
$this->ilias->db->quote($this->getId())
);
$this->ilias->db->query($q);
}
| ilBookmarkFolder::$id |
Definition at line 49 of file class.ilBookmarkFolder.php.
| ilBookmarkFolder::$ilias |
Definition at line 47 of file class.ilBookmarkFolder.php.
Referenced by ilBookmarkFolder(), and read().
| ilBookmarkFolder::$parent |
Definition at line 51 of file class.ilBookmarkFolder.php.
| ilBookmarkFolder::$title |
Definition at line 50 of file class.ilBookmarkFolder.php.
| ilBookmarkFolder::$tree |
Definition at line 40 of file class.ilBookmarkFolder.php.
Referenced by _getNumberOfObjects(), _getParentId(), getObject(), getObjects(), getRootFolder(), and isRootFolder().
1.7.1