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)
 _lookupTitle ($a_bmf_id)
 lookup bookmark folder title
 getObjects ($a_id)
 static
 getObject ($a_id)
 static
 isRootFolder ($a_id)
 getRootFolder ()
 _getParentId ($a_id)

Data Fields

 $tree
 $ilias
 $id
 $title
 $parent

Detailed Description

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


Member Function Documentation

ilBookmarkFolder::_getParentId ( a_id  ) 

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

References $_SESSION, and $tree.

Referenced by ilBookmarkAdministrationGUI::getPDBookmarkListHTMLFlat().

        {
                $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 190 of file class.ilBookmarkFolder.php.

References $q.

        {
                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"];
        }

ilBookmarkFolder::create (  ) 

creates new bookmark folder in db

note: parent and title must be set

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

References $_SESSION, $q, 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 114 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 105 of file class.ilBookmarkFolder.php.

References $q, and 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 157 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 242 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 204 of file class.ilBookmarkFolder.php.

References $_SESSION, $key, and $tree.

Referenced by ilBookmarkImportExport::__parseExport(), ilBookmarkAdministrationGUI::getPDBookmarkListHTMLFlat(), 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 177 of file class.ilBookmarkFolder.php.

Referenced by create().

        {
                return $this->parent;
        }

Here is the caller graph for this function:

ilBookmarkFolder::getRootFolder (  ) 

Definition at line 273 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 167 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 59 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 257 of file class.ilBookmarkFolder.php.

References $_SESSION, and $tree.

Referenced by ilBookmarkAdministrationGUI::getPDBookmarkListHTMLFlat().

        {
                $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 83 of file class.ilBookmarkFolder.php.

References $ilias, $q, 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 162 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 182 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 172 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 145 of file class.ilBookmarkFolder.php.

References $q.

        {
                $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);
        }


Field Documentation

ilBookmarkFolder::$id

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

ilBookmarkFolder::$ilias

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

Referenced by ilBookmarkFolder(), and read().

ilBookmarkFolder::$parent

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

ilBookmarkFolder::$title

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

ilBookmarkFolder::$tree

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