ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSearchFolder Class Reference
+ Collaboration diagram for ilSearchFolder:

Public Member Functions

 ilSearchFolder ($a_user_id, $a_folder_id=0)
 Constructor public.
 getType ()
 getRootId ()
 setRootId ($a_root_id)
 setFolderId ($a_folder_id)
 getFolderId ()
 setUserId ($a_user_id)
 getUserId ()
 setTitle ($a_title)
 getTitle ()
 getChilds ()
 hasSubfolders ()
 hasResults ()
 countFolders ()
 getPath ()
 setParentId ($a_parent_id)
 getParentId ()
 delete ($a_folder_id)
 assignResult (&$search_result)
 updateTitle ($a_title)
create ($a_title)
 getTree ()
 getSubtree ()
 __init ()
 __initTreeObject ()
 __treeExists ()
 __createNewTree ()
 __readRootId ()
 __getLastInsertId ()

Data Fields

 $s_tree
 $ilias
 $user_id
 $root_id
 $folder_id
 $parent_id
 $title

Detailed Description

Definition at line 35 of file class.ilSearchFolder.php.

Member Function Documentation

ilSearchFolder::__createNewTree ( )

Definition at line 294 of file class.ilSearchFolder.php.

References $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);
$this->s_tree->addTree($this->getUserId(),$root_id);
// SET MEMBER VARIABLES
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchFolder::__getLastInsertId ( )

Definition at line 327 of file class.ilSearchFolder.php.

Referenced by __createNewTree().

{
return $this->ilias->db->getLastInsertId();
}

+ Here is the caller graph for this function:

ilSearchFolder::__init ( )

Definition at line 260 of file class.ilSearchFolder.php.

References $res, DB_FETCHMODE_OBJECT, 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);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchFolder::__readRootId ( )

Definition at line 313 of file class.ilSearchFolder.php.

References $res, DB_FETCHMODE_OBJECT, 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;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchFolder::__treeExists ( )

Definition at line 284 of file class.ilSearchFolder.php.

References $res.

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;
}

+ Here is the caller graph for this function:

ilSearchFolder::assignResult ( $search_result)

Definition at line 184 of file class.ilSearchFolder.php.

References $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;
}

+ Here is the call graph for this function:

ilSearchFolder::countFolders ( )

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

References getRootId().

{
$childs = $this->s_tree->getChilds($this->getRootId(),"type","DESC");
$counter = 0;
while(true)
{
if($childs[$counter]["type"] != "seaf")
{
break;
}
++$counter;
}
return $counter;
}

+ Here is the call graph for this function:

& ilSearchFolder::create (   $a_title)

Definition at line 216 of file class.ilSearchFolder.php.

References $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;
}

+ Here is the call graph for this function:

ilSearchFolder::delete (   $a_folder_id)

Definition at line 165 of file class.ilSearchFolder.php.

References $res.

{
$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().

Referenced by hasResults(), and hasSubfolders().

{
return $this->s_tree->getChilds($this->getFolderId(),"type","DESC");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchFolder::getFolderId ( )

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

References $folder_id.

Referenced by assignResult(), create(), getChilds(), getPath(), and getTree().

{
}

+ Here is the caller graph for this function:

ilSearchFolder::getParentId ( )

Definition at line 160 of file class.ilSearchFolder.php.

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

+ Here is the call graph for this function:

ilSearchFolder::getRootId ( )

Definition at line 84 of file class.ilSearchFolder.php.

References $root_id.

Referenced by __initTreeObject(), countFolders(), getPath(), getTree(), and ilSearchFolder().

{
}

+ Here is the caller graph for this function:

ilSearchFolder::getSubtree ( )

Definition at line 245 of file class.ilSearchFolder.php.

Referenced by ilSearchGUI\__getFolderSelect(), ilAdvancedSearchGUI\__getFolderSelect(), and 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();
}

+ Here is the caller graph for this function:

ilSearchFolder::getTitle ( )

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

References $title.

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

+ Here is the call graph for this function:

ilSearchFolder::getType ( )

Definition at line 79 of file class.ilSearchFolder.php.

{
return "seaf";
}
ilSearchFolder::getUserId ( )

Definition at line 105 of file class.ilSearchFolder.php.

References $user_id.

Referenced by __createNewTree(), __initTreeObject(), and create().

{
}

+ Here is the caller graph for this function:

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;
}

+ Here is the call graph for this function:

ilSearchFolder::hasSubfolders ( )

Definition at line 122 of file class.ilSearchFolder.php.

References getChilds().

{
$childs = $this->getChilds();
return $childs[0]["type"] == "seaf" ? true : false;
}

+ Here is the call graph for this function:

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
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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;
}

+ Here is the caller graph for this function:

ilSearchFolder::setParentId (   $a_parent_id)

Definition at line 155 of file class.ilSearchFolder.php.

Referenced by __init().

{
$this->parent_id = $a_parent_id;
}

+ Here is the caller graph for this function:

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;
}

+ Here is the caller graph for this function:

ilSearchFolder::setTitle (   $a_title)

Definition at line 109 of file class.ilSearchFolder.php.

Referenced by __init().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

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.

References $res.

{
$query = "UPDATE ".TABLE_SEARCH_DATA." ".
"SET title = '".addslashes($a_title)."' ".
"WHERE obj_id = '".$this->getFolderId()."' ".
"AND user_id = '".$this->getUserId()."'";
$res = $this->ilias->db->query($query);
return true;
}

Field Documentation

ilSearchFolder::$folder_id

Definition at line 43 of file class.ilSearchFolder.php.

Referenced by getFolderId().

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.

Referenced by getParentId().

ilSearchFolder::$root_id

Definition at line 42 of file class.ilSearchFolder.php.

Referenced by __createNewTree(), and getRootId().

ilSearchFolder::$s_tree

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

ilSearchFolder::$title

Definition at line 45 of file class.ilSearchFolder.php.

Referenced by getTitle().

ilSearchFolder::$user_id

Definition at line 41 of file class.ilSearchFolder.php.

Referenced by getUserId().


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