Definition at line 35 of file class.ilSearchFolder.php.
ilSearchFolder::__createNewTree | ( | ) |
Definition at line 294 of file class.ilSearchFolder.php.
References $query, $res, $root_id, __getLastInsertId(), getUserId(), setFolderId(), and setRootId().
Referenced by assignResult(), and ilSearchFolder().
{ // ADD ENTRY search_data $query = "INSERT INTO ".TABLE_SEARCH_DATA." ". "SET user_id = '".$this->getUserId()."', ". "type = 'seaf'"; $res = $this->ilias->db->query($query); $root_id = $this->__getLastInsertId(); $this->s_tree->addTree($this->getUserId(),$root_id); // SET MEMBER VARIABLES $this->setFolderId($root_id); $this->setRootId($root_id); return true; }
ilSearchFolder::__createNewTree | ( | ) |
Definition at line 294 of file class.ilSearchFolder.php.
References $query, $res, $root_id, __getLastInsertId(), getUserId(), setFolderId(), and setRootId().
{ // ADD ENTRY search_data $query = "INSERT INTO ".TABLE_SEARCH_DATA." ". "SET user_id = '".$this->getUserId()."', ". "type = 'seaf'"; $res = $this->ilias->db->query($query); $root_id = $this->__getLastInsertId(); $this->s_tree->addTree($this->getUserId(),$root_id); // SET MEMBER VARIABLES $this->setFolderId($root_id); $this->setRootId($root_id); return true; }
ilSearchFolder::__getLastInsertId | ( | ) |
Definition at line 327 of file class.ilSearchFolder.php.
Referenced by __createNewTree().
{
return $this->ilias->db->getLastInsertId();
}
ilSearchFolder::__getLastInsertId | ( | ) |
Definition at line 327 of file class.ilSearchFolder.php.
{
return $this->ilias->db->getLastInsertId();
}
ilSearchFolder::__init | ( | ) |
Definition at line 260 of file class.ilSearchFolder.php.
References $query, $res, $row, setParentId(), and setTitle().
{ $query = "SELECT * FROM ".TABLE_SEARCH_TREE.", ".TABLE_SEARCH_DATA." ". "WHERE child = obj_id ". "AND child = '".$this->getFolderId()."' ". "AND tree = '".$this->getUserId()."'"; $res = $this->ilias->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->setTitle($row->title); $this->setParentId($row->parent); } }
ilSearchFolder::__init | ( | ) |
Definition at line 260 of file class.ilSearchFolder.php.
References $query, $res, $row, setParentId(), and setTitle().
Referenced by ilSearchFolder().
{ $query = "SELECT * FROM ".TABLE_SEARCH_TREE.", ".TABLE_SEARCH_DATA." ". "WHERE child = obj_id ". "AND child = '".$this->getFolderId()."' ". "AND tree = '".$this->getUserId()."'"; $res = $this->ilias->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->setTitle($row->title); $this->setParentId($row->parent); } }
ilSearchFolder::__initTreeObject | ( | ) |
Definition at line 276 of file class.ilSearchFolder.php.
References getRootId(), and getUserId().
Referenced by ilSearchFolder().
{ $this->s_tree = new ilTree($this->getUserId(),$this->getRootId()); $this->s_tree->setTableNames(TABLE_SEARCH_TREE,TABLE_SEARCH_DATA); return true; }
ilSearchFolder::__initTreeObject | ( | ) |
Definition at line 276 of file class.ilSearchFolder.php.
References getRootId(), and getUserId().
{ $this->s_tree = new ilTree($this->getUserId(),$this->getRootId()); $this->s_tree->setTableNames(TABLE_SEARCH_TREE,TABLE_SEARCH_DATA); return true; }
ilSearchFolder::__readRootId | ( | ) |
Definition at line 313 of file class.ilSearchFolder.php.
References $query, $res, $row, and setRootId().
{ $query = "SELECT child FROM ".TABLE_SEARCH_TREE." ". "WHERE tree = '".$this->getUserId()."' ". "AND parent = '0'"; $res = $this->ilias->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->setRootId($row->child); } return true; }
ilSearchFolder::__readRootId | ( | ) |
Definition at line 313 of file class.ilSearchFolder.php.
References $query, $res, $row, and setRootId().
Referenced by ilSearchFolder().
{ $query = "SELECT child FROM ".TABLE_SEARCH_TREE." ". "WHERE tree = '".$this->getUserId()."' ". "AND parent = '0'"; $res = $this->ilias->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->setRootId($row->child); } return true; }
ilSearchFolder::__treeExists | ( | ) |
Definition at line 284 of file class.ilSearchFolder.php.
Referenced by assignResult(), and ilSearchFolder().
{ $query = "SELECT tree FROM ".TABLE_SEARCH_TREE." ". "WHERE tree = ".$this->getUserId(); $res = $this->ilias->db->query($query); return $res->numRows() ? true : false; }
ilSearchFolder::__treeExists | ( | ) |
ilSearchFolder::assignResult | ( | &$ | search_result | ) |
Definition at line 184 of file class.ilSearchFolder.php.
References $query, $res, __createNewTree(), __treeExists(), and getFolderId().
{ if(!$this->__treeExists()) { $this->__createNewTree(); } // CREATE RESULT $query = "INSERT INTO ".TABLE_SEARCH_DATA ." ". "SET user_id = '".$this->getUserId()."', ". "title = '".$search_result->getTitle()."', ". "target = '".$search_result->getTarget()."', ". "type = 'sea'"; $res = $this->ilias->db->query($query); $this->s_tree->insertNode($this->ilias->db->getLastInsertId(),$this->getFolderId()); return true; }
ilSearchFolder::assignResult | ( | &$ | search_result | ) |
Definition at line 184 of file class.ilSearchFolder.php.
References $query, $res, __createNewTree(), __treeExists(), and getFolderId().
{ if(!$this->__treeExists()) { $this->__createNewTree(); } // CREATE RESULT $query = "INSERT INTO ".TABLE_SEARCH_DATA ." ". "SET user_id = '".$this->getUserId()."', ". "title = '".$search_result->getTitle()."', ". "target = '".$search_result->getTarget()."', ". "type = 'sea'"; $res = $this->ilias->db->query($query); $this->s_tree->insertNode($this->ilias->db->getLastInsertId(),$this->getFolderId()); return true; }
ilSearchFolder::countFolders | ( | ) |
Definition at line 134 of file class.ilSearchFolder.php.
References $counter, and getRootId().
{ $childs = $this->s_tree->getChilds($this->getRootId(),"type","DESC"); $counter = 0; while(true) { if($childs[$counter]["type"] != "seaf") { break; } ++$counter; } return $counter; }
ilSearchFolder::countFolders | ( | ) |
Definition at line 134 of file class.ilSearchFolder.php.
References $counter, and getRootId().
{ $childs = $this->s_tree->getChilds($this->getRootId(),"type","DESC"); $counter = 0; while(true) { if($childs[$counter]["type"] != "seaf") { break; } ++$counter; } return $counter; }
& ilSearchFolder::create | ( | $ | a_title | ) |
Definition at line 216 of file class.ilSearchFolder.php.
References $query, $res, getFolderId(), getUserId(), and ilSearchFolder().
{ // CREATE FOLDER $query = "INSERT INTO ".TABLE_SEARCH_DATA ." ". "SET user_id = '".$this->getUserId()."', ". "title = '".addslashes($a_title)."', ". "type = 'seaf'"; $res = $this->ilias->db->query($query); $this->s_tree->insertNode($this->ilias->db->getLastInsertId(),$this->getFolderId()); $new_obj =& new ilSearchFolder($this->getUserId(),$this->getFolderId()); $new_obj->setTitle($a_title); return $new_obj; }
& ilSearchFolder::create | ( | $ | a_title | ) |
Definition at line 216 of file class.ilSearchFolder.php.
References $query, $res, getFolderId(), getUserId(), and ilSearchFolder().
{ // CREATE FOLDER $query = "INSERT INTO ".TABLE_SEARCH_DATA ." ". "SET user_id = '".$this->getUserId()."', ". "title = '".addslashes($a_title)."', ". "type = 'seaf'"; $res = $this->ilias->db->query($query); $this->s_tree->insertNode($this->ilias->db->getLastInsertId(),$this->getFolderId()); $new_obj =& new ilSearchFolder($this->getUserId(),$this->getFolderId()); $new_obj->setTitle($a_title); return $new_obj; }
ilSearchFolder::delete | ( | $ | a_folder_id | ) |
Definition at line 165 of file class.ilSearchFolder.php.
{ $subtree = $this->s_tree->getSubTree($this->s_tree->getNodeData($a_folder_id)); foreach($subtree as $node) { // DELETE DATA ENTRIES $query = "DELETE FROM ".TABLE_SEARCH_DATA." ". "WHERE user_id = '".$this->getUserId()."' ". "AND obj_id = '".$node["obj_id"]."'"; $res = $this->ilias->db->query($query); } // FINALLY DELETE SUBTREE $this->s_tree->deleteTree($this->s_tree->getNodeData($a_folder_id)); return true; }
ilSearchFolder::delete | ( | $ | a_folder_id | ) |
Definition at line 165 of file class.ilSearchFolder.php.
{ $subtree = $this->s_tree->getSubTree($this->s_tree->getNodeData($a_folder_id)); foreach($subtree as $node) { // DELETE DATA ENTRIES $query = "DELETE FROM ".TABLE_SEARCH_DATA." ". "WHERE user_id = '".$this->getUserId()."' ". "AND obj_id = '".$node["obj_id"]."'"; $res = $this->ilias->db->query($query); } // FINALLY DELETE SUBTREE $this->s_tree->deleteTree($this->s_tree->getNodeData($a_folder_id)); return true; }
ilSearchFolder::getChilds | ( | ) |
Definition at line 118 of file class.ilSearchFolder.php.
References getFolderId().
{ return $this->s_tree->getChilds($this->getFolderId(),"type","DESC"); }
ilSearchFolder::getChilds | ( | ) |
Definition at line 118 of file class.ilSearchFolder.php.
References getFolderId().
Referenced by hasResults(), and hasSubfolders().
{ return $this->s_tree->getChilds($this->getFolderId(),"type","DESC"); }
ilSearchFolder::getFolderId | ( | ) |
Definition at line 96 of file class.ilSearchFolder.php.
{
return $this->folder_id;
}
ilSearchFolder::getFolderId | ( | ) |
Definition at line 96 of file class.ilSearchFolder.php.
Referenced by assignResult(), create(), getChilds(), getPath(), and getTree().
{
return $this->folder_id;
}
ilSearchFolder::getParentId | ( | ) |
Definition at line 160 of file class.ilSearchFolder.php.
{
return $this->parent_id;
}
ilSearchFolder::getParentId | ( | ) |
Definition at line 160 of file class.ilSearchFolder.php.
{
return $this->parent_id;
}
ilSearchFolder::getPath | ( | ) |
Definition at line 150 of file class.ilSearchFolder.php.
References getFolderId(), and getRootId().
{ return $this->s_tree->getPathFull($this->getFolderId(),$this->getRootId()); }
ilSearchFolder::getPath | ( | ) |
Definition at line 150 of file class.ilSearchFolder.php.
References getFolderId(), and getRootId().
{ return $this->s_tree->getPathFull($this->getFolderId(),$this->getRootId()); }
ilSearchFolder::getRootId | ( | ) |
Definition at line 84 of file class.ilSearchFolder.php.
{
return $this->root_id;
}
ilSearchFolder::getRootId | ( | ) |
Definition at line 84 of file class.ilSearchFolder.php.
Referenced by __initTreeObject(), countFolders(), getPath(), getTree(), and ilSearchFolder().
{
return $this->root_id;
}
ilSearchFolder::getSubtree | ( | ) |
Definition at line 245 of file class.ilSearchFolder.php.
Referenced by getTree().
{ $subtree = $this->s_tree->getSubtree($this->s_tree->getNodeData($this->getFolderId())); // FILTER FOLDERS foreach($subtree as $node) { if($node["type"] == "seaf") { $filtered[] = $node; } } return count($filtered) ? $filtered : array(); }
ilSearchFolder::getSubtree | ( | ) |
Definition at line 245 of file class.ilSearchFolder.php.
{ $subtree = $this->s_tree->getSubtree($this->s_tree->getNodeData($this->getFolderId())); // FILTER FOLDERS foreach($subtree as $node) { if($node["type"] == "seaf") { $filtered[] = $node; } } return count($filtered) ? $filtered : array(); }
ilSearchFolder::getTitle | ( | ) |
Definition at line 113 of file class.ilSearchFolder.php.
{
return $this->title;
}
ilSearchFolder::getTitle | ( | ) |
Definition at line 113 of file class.ilSearchFolder.php.
{
return $this->title;
}
ilSearchFolder::getTree | ( | ) |
Definition at line 233 of file class.ilSearchFolder.php.
References getFolderId(), getRootId(), getSubtree(), and setFolderId().
{ $tmp_folder_id = $this->getFolderId(); $this->setFolderId($this->getRootId()); $tree_data = $this->getSubtree(); $this->setFolderId($tmp_folder_id); return $tree_data; }
ilSearchFolder::getTree | ( | ) |
Definition at line 233 of file class.ilSearchFolder.php.
References getFolderId(), getRootId(), getSubtree(), and setFolderId().
{ $tmp_folder_id = $this->getFolderId(); $this->setFolderId($this->getRootId()); $tree_data = $this->getSubtree(); $this->setFolderId($tmp_folder_id); return $tree_data; }
ilSearchFolder::getType | ( | ) |
Definition at line 79 of file class.ilSearchFolder.php.
{ return "seaf"; }
ilSearchFolder::getType | ( | ) |
Definition at line 79 of file class.ilSearchFolder.php.
{ return "seaf"; }
ilSearchFolder::getUserId | ( | ) |
Definition at line 105 of file class.ilSearchFolder.php.
{
return $this->user_id;
}
ilSearchFolder::getUserId | ( | ) |
Definition at line 105 of file class.ilSearchFolder.php.
Referenced by __createNewTree(), __initTreeObject(), and create().
{
return $this->user_id;
}
ilSearchFolder::hasResults | ( | ) |
Definition at line 128 of file class.ilSearchFolder.php.
References getChilds().
{ $childs = $this->getChilds(); return $childs[count($childs)-1]["type"] == "sea" ? true : false; }
ilSearchFolder::hasResults | ( | ) |
Definition at line 128 of file class.ilSearchFolder.php.
References getChilds().
{ $childs = $this->getChilds(); return $childs[count($childs)-1]["type"] == "sea" ? true : false; }
ilSearchFolder::hasSubfolders | ( | ) |
Definition at line 122 of file class.ilSearchFolder.php.
References getChilds().
{ $childs = $this->getChilds(); return $childs[0]["type"] == "seaf" ? true : false; }
ilSearchFolder::hasSubfolders | ( | ) |
Definition at line 122 of file class.ilSearchFolder.php.
References getChilds().
{ $childs = $this->getChilds(); return $childs[0]["type"] == "seaf" ? true : false; }
ilSearchFolder::ilSearchFolder | ( | $ | a_user_id, | |
$ | a_folder_id = 0 | |||
) |
Constructor public.
Definition at line 51 of file class.ilSearchFolder.php.
References $ilias, __createNewTree(), __init(), __initTreeObject(), __readRootId(), __treeExists(), getRootId(), and setFolderId().
Referenced by create().
{ global $ilias; define("TABLE_SEARCH_TREE","search_tree"); define("TABLE_SEARCH_DATA","search_data"); $this->ilias =& $ilias; $this->user_id = $a_user_id; $this->__readRootId(); // IF NO FOLDER ID IS GIVEN DEFAULT TO ROOT ID $this->setFolderId($a_folder_id ? $a_folder_id : $this->getRootId()); $this->__initTreeObject(); if(!$this->__treeExists()) { $this->__createNewTree(); } $this->__init(); // CHECK USER TREE IF HAS BEEN CREATED }
ilSearchFolder::ilSearchFolder | ( | $ | a_user_id, | |
$ | a_folder_id = 0 | |||
) |
Constructor public.
Definition at line 51 of file class.ilSearchFolder.php.
References $ilias, __createNewTree(), __init(), __initTreeObject(), __readRootId(), __treeExists(), getRootId(), and setFolderId().
{ global $ilias; define("TABLE_SEARCH_TREE","search_tree"); define("TABLE_SEARCH_DATA","search_data"); $this->ilias =& $ilias; $this->user_id = $a_user_id; $this->__readRootId(); // IF NO FOLDER ID IS GIVEN DEFAULT TO ROOT ID $this->setFolderId($a_folder_id ? $a_folder_id : $this->getRootId()); $this->__initTreeObject(); if(!$this->__treeExists()) { $this->__createNewTree(); } $this->__init(); // CHECK USER TREE IF HAS BEEN CREATED }
ilSearchFolder::setFolderId | ( | $ | a_folder_id | ) |
Definition at line 92 of file class.ilSearchFolder.php.
{ $this->folder_id = $a_folder_id; }
ilSearchFolder::setFolderId | ( | $ | a_folder_id | ) |
Definition at line 92 of file class.ilSearchFolder.php.
Referenced by __createNewTree(), getTree(), and ilSearchFolder().
{ $this->folder_id = $a_folder_id; }
ilSearchFolder::setParentId | ( | $ | a_parent_id | ) |
Definition at line 155 of file class.ilSearchFolder.php.
Referenced by __init().
{ $this->parent_id = $a_parent_id; }
ilSearchFolder::setParentId | ( | $ | a_parent_id | ) |
Definition at line 155 of file class.ilSearchFolder.php.
{ $this->parent_id = $a_parent_id; }
ilSearchFolder::setRootId | ( | $ | a_root_id | ) |
Definition at line 88 of file class.ilSearchFolder.php.
Referenced by __createNewTree(), and __readRootId().
{ $this->root_id = $a_root_id; }
ilSearchFolder::setRootId | ( | $ | a_root_id | ) |
Definition at line 88 of file class.ilSearchFolder.php.
{ $this->root_id = $a_root_id; }
ilSearchFolder::setTitle | ( | $ | a_title | ) |
Definition at line 109 of file class.ilSearchFolder.php.
Referenced by __init().
{ $this->title = $a_title; }
ilSearchFolder::setTitle | ( | $ | a_title | ) |
Definition at line 109 of file class.ilSearchFolder.php.
{ $this->title = $a_title; }
ilSearchFolder::setUserId | ( | $ | a_user_id | ) |
Definition at line 100 of file class.ilSearchFolder.php.
{ $this->user_id = $a_user_id; }
ilSearchFolder::setUserId | ( | $ | a_user_id | ) |
Definition at line 100 of file class.ilSearchFolder.php.
{ $this->user_id = $a_user_id; }
ilSearchFolder::updateTitle | ( | $ | a_title | ) |
Definition at line 204 of file class.ilSearchFolder.php.
ilSearchFolder::updateTitle | ( | $ | a_title | ) |
Definition at line 204 of file class.ilSearchFolder.php.
ilSearchFolder::$folder_id |
Definition at line 43 of file class.ilSearchFolder.php.
ilSearchFolder::$ilias |
Definition at line 39 of file class.ilSearchFolder.php.
Referenced by ilSearchFolder().
ilSearchFolder::$parent_id |
Definition at line 44 of file class.ilSearchFolder.php.
ilSearchFolder::$root_id |
Definition at line 42 of file class.ilSearchFolder.php.
Referenced by __createNewTree().
ilSearchFolder::$s_tree |
Definition at line 38 of file class.ilSearchFolder.php.
ilSearchFolder::$title |
Definition at line 45 of file class.ilSearchFolder.php.
ilSearchFolder::$user_id |
Definition at line 41 of file class.ilSearchFolder.php.