Public Member Functions | Data Fields

ilBookmarkFolder Class Reference

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)
 getObjects ($a_id)
 static
 isRootFolder ($a_id)
 getRootFolder ()

Data Fields

 $tree
 $ilias
 $id
 $title
 $parent

Detailed Description

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


Member Function Documentation

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 $q, getId(), getParent(), getTitle(), and setId().

        {
                $q =    "INSERT INTO bookmark_data (user_id, title, target, type) ".
                                "VALUES ('".$_SESSION["AccountId"]."','".$this->getTitle()."','','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 $q.

        {
                $q = "DELETE FROM bookmark_data WHERE obj_id = '".$this->getId()."'";
                $this->ilias->db->query($q);
        }

ilBookmarkFolder::getId (  ) 

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

Referenced by create(), and update().

        {
                return $this->id;
        }

Here is the caller graph for this function:

ilBookmarkFolder::getObjects ( a_id  ) 

static

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

References $_SESSION, and $tree.

Referenced by ilPersonalDesktopGUI::displayBookmarks(), 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 167 of file class.ilBookmarkFolder.php.

Referenced by create().

        {
                return $this->parent;
        }

Here is the caller graph for this function:

ilBookmarkFolder::getRootFolder (  ) 

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

References $_SESSION, and $tree.

Referenced by ilPersonalDesktopGUI::displayBookmarks().

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

                return $tree->getRootId();
        }

Here is the caller graph for this function:

ilBookmarkFolder::getTitle (  ) 

Definition at line 157 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.

Parameters:
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 216 of file class.ilBookmarkFolder.php.

References $_SESSION, and $tree.

Referenced by ilPersonalDesktopGUI::displayBookmarks().

        {
                $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, $q, setParent(), and setTitle().

Referenced by ilBookmarkFolder().

        {
                global $ilias;

                $q = "SELECT * FROM bookmark_data WHERE obj_id = '".$this->id."'";
                $bmf_set = $this->ilias->db->query($q);
                if ($bmf_set->numRows() == 0)
                {
                        $message = "ilBookmarkFolder::read(): Bookmark Folder with id ".$this->id." 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->id));
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilBookmarkFolder::setId ( a_id  ) 

Definition at line 152 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 172 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 162 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 141 of file class.ilBookmarkFolder.php.

References $q, and getId().

        {
                $q = "UPDATE bookmark_data SET title = '".$this->getTitle()."' WHERE obj_id = '".$this->getId()."'";
                $this->ilias->db->query($q);
        }

Here is the call graph for this function:


Field Documentation

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 getObjects(), getRootFolder(), and isRootFolder().


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