ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilWorkspaceTree Class Reference

Tree handler for personal workspace. More...

+ Inheritance diagram for ilWorkspaceTree:
+ Collaboration diagram for ilWorkspaceTree:

Public Member Functions

 __construct ($a_tree_id, $a_root_id=0)
 createReference ($a_object_id)
 Create workspace reference for object.
 lookupObjectId ($a_node_id)
 Get object id for node id.
 lookupNodeId ($a_obj_id)
 Get node id for object id.
 lookupOwner ($a_node_id)
 Get owner for node id.
 insertObject ($a_parent_node_id, $a_object_id)
 Add object to tree.
 deleteReference ($a_node_id)
 Delete object from reference table.
 cascadingDelete ()
 Remove all tree and node data.
 getObjectsFromType ($a_type)
 Get all workspace objects of specific type.
 createTreeForUser ($a_user_id)
 Create personal workspace tree for user.
- Public Member Functions inherited from ilTree
 ilTree ($a_tree_id, $a_root_id=0)
 Constructor public.
 initTreeImplementation ()
 Init tree implementation.
 getTreeImplementation ()
 Get tree implementation.
 useCache ($a_use=true)
 Use Cache (usually activated)
 isCacheUsed ()
 Check if cache is active.
 getDepthCache ()
 Get depth cache.
 getParentCache ()
 Get parent cache.
 initLangCode ()
 Store user language.
 getTreeTable ()
 Get tree table name.
 getObjectDataTable ()
 Get object data table.
 getTreePk ()
 Get tree primary key.
 getTableReference ()
 Get reference table if available.
 getGap ()
 Get default gap *.
 resetInTreeCache ()
 setTableNames ($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
 set table names The primary key of the table containing your object_data must be 'obj_id' You may use a reference table.
 setReferenceTablePK ($a_column_name)
 set column containing primary key in reference table public
 setObjectTablePK ($a_column_name)
 set column containing primary key in object table public
 setTreeTablePK ($a_column_name)
 set column containing primary key in tree table public
 buildJoin ()
 build join depending on table settings private
 getRelation ($a_node_a, $a_node_b)
 Get relation of two nodes.
 getRelationOfNodes ($a_node_a_arr, $a_node_b_arr)
 get relation of two nodes by node data
 getChildIds ($a_node)
 Get node child ids type $ilDB.
 getChilds ($a_node_id, $a_order="", $a_direction="ASC")
 get child nodes of given node public
 getFilteredChilds ($a_filter, $a_node, $a_order="", $a_direction="ASC")
 get child nodes of given node (exclude filtered obj_types) public
 getChildsByType ($a_node_id, $a_type)
 get child nodes of given node by object type public
 getChildsByTypeFilter ($a_node_id, $a_types, $a_order="", $a_direction="ASC")
 get child nodes of given node by object type public
 insertNode ($a_node_id, $a_parent_id, $a_pos=IL_LAST_NODE, $a_reset_deletion_date=false)
 insert new node with node_id under parent node with parent_id public
 getFilteredSubTree ($a_node_id, $a_filter=array())
 get filtered subtree
 getSubTreeIds ($a_ref_id)
 Get all ids of subnodes.
 getSubTree ($a_node, $a_with_data=true, $a_type="")
 get all nodes in the subtree under specified node
 getSubTreeTypes ($a_node, $a_filter=0)
 get types of nodes in the subtree under specified node
 deleteTree ($a_node)
 delete node and the whole subtree under this node public
 getPathFull ($a_endnode_id, $a_startnode_id=0)
 get path from a given startnode to a given endnode if startnode is not given the rootnode is startnode.
 preloadDepthParent ($a_node_ids)
 Preload depth/parent.
 getPathId ($a_endnode_id, $a_startnode_id=0)
 get path from a given startnode to a given endnode if startnode is not given the rootnode is startnode public
 getNodePathForTitlePath ($titlePath, $a_startnode_id=null)
 Converts a path consisting of object titles into a path consisting of tree nodes.
 getNodePath ($a_endnode_id, $a_startnode_id=0)
 Returns the node path for the specified object reference.
 checkTree ()
 check consistence of tree all left & right values are checked if they are exists only once public
 checkTreeChilds ($a_no_zero_child=true)
 check, if all childs of tree nodes exist in object table
 getMaximumDepth ()
 Return the current maximum depth in the tree public.
 getDepth ($a_node_id)
 return depth of a node in tree private
 getNodeTreeData ($a_node_id)
 return all columns of tabel tree
 getNodeData ($a_node_id, $a_tree_pk=null)
 get all information of a node.
 fetchNodeData ($a_row)
 get data of parent node from tree and object_data private
 isInTree ($a_node_id)
 get all information of a node.
 getParentNodeData ($a_node_id)
 get data of parent node from tree and object_data public
 isGrandChild ($a_startnode_id, $a_querynode_id)
 checks if a node is in the path of an other node public
 addTree ($a_tree_id, $a_node_id=-1)
 create a new tree to do: ???
 getNodeDataByType ($a_type)
 get nodes by type
 removeTree ($a_tree_id)
 remove an existing tree
 moveToTrash ($a_node_id, $a_set_deleted=false)
 Wrapper for saveSubTree.
 saveSubTree ($a_node_id, $a_set_deleted=false)
 Use the wrapper moveToTrash save subtree: delete a subtree (defined by node_id) to a new tree with $this->tree_id -node_id.
 isDeleted ($a_node_id)
 This is a wrapper for isSaved() with a more useful name.
 isSaved ($a_node_id)
 Use method isDeleted check if node is saved.
 preloadDeleted ($a_node_ids)
 Preload deleted information.
 getSavedNodeData ($a_parent_id)
 get data saved/deleted nodes
 getSavedNodeObjIds (array $a_obj_ids)
 get object id of saved/deleted nodes
 getParentId ($a_node_id)
 get parent id of given node public
 getLeftValue ($a_node_id)
 get left value of given node public
 getChildSequenceNumber ($a_node, $type="")
 get sequence number of node in sibling sequence public
 readRootId ()
 read root id from database
 getRootId ()
 get the root id of tree public
 setRootId ($a_root_id)
 getTreeId ()
 get tree id public
 setTreeId ($a_tree_id)
 set tree id public
 fetchSuccessorNode ($a_node_id, $a_type="")
 get node data of successor node
 fetchPredecessorNode ($a_node_id, $a_type="")
 get node data of predecessor node
 renumber ($node_id=1, $i=1)
 Wrapper for renumber.
 __renumber ($node_id=1, $i=1)
 This method is private.
 checkForParentType ($a_ref_id, $a_type, $a_exclude_source_check=false)
 Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentType(3,'crs');.
 _removeEntry ($a_tree, $a_child, $a_db_table="tree")
 STATIC METHOD Removes a single entry from a tree.
 __isMainTree ()
 Check if operations are done on main tree.
 __checkDelete ($a_node)
 Check for deleteTree() compares a subtree of a given node by checking lft, rgt against parent relation.
 __getSubTreeByParentRelation ($a_node_id, &$parent_childs)
 type $ilDB
 __validateSubtrees (&$lft_childs, $parent_childs)
 moveTree ($a_source_id, $a_target_id, $a_location=self::POS_LAST_NODE)
 Move Tree Implementation.
 getRbacSubtreeInfo ($a_endnode_id)
 This method is used for change existing objects and returns all necessary information for this action.
 getSubTreeQuery ($a_node_id, $a_fields=array(), $a_types= '', $a_force_join_reference=false)
 Get tree subtree query.
 getSubTreeFilteredByObjIds ($a_node_id, array $a_obj_ids, array $a_fields=array())
 get all node ids in the subtree under specified node id, filter by object ids
 deleteNode ($a_tree_id, $a_node_id)

Additional Inherited Members

- Data Fields inherited from ilTree
const POS_LAST_NODE = -2
const POS_FIRST_NODE = -1
const RELATION_CHILD = 1
const RELATION_PARENT = 2
const RELATION_SIBLING = 3
const RELATION_EQUALS = 4
const RELATION_NONE = 5
 $ilias
 $log
 $root_id
 $tree_id
 $table_tree
 $table_obj_data
 $table_obj_reference
 $ref_pk
 $obj_pk
 $tree_pk
 $gap
- Protected Member Functions inherited from ilTree
 fetchTranslationFromObjectDataCache ($a_obj_ids)
 Get translation data from object cache (trigger in object cache on preload)
- Protected Attributes inherited from ilTree
 $depth_cache = array()
 $parent_cache = array()
 $in_tree_cache = array()

Detailed Description

Tree handler for personal workspace.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:
class.ilPersonalDesktopGUI.php 26976 2010-12-16 13:24:38Z akill

Definition at line 13 of file class.ilWorkspaceTree.php.

Constructor & Destructor Documentation

ilWorkspaceTree::__construct (   $a_tree_id,
  $a_root_id = 0 
)

Definition at line 15 of file class.ilWorkspaceTree.php.

References ilTree\readRootId(), ilTree\setObjectTablePK(), ilTree\setReferenceTablePK(), ilTree\setTableNames(), and ilTree\setTreeTablePK().

{
parent::__construct($a_tree_id, $a_root_id);
$this->setTableNames('tree_workspace', 'object_data', 'object_reference_ws');
$this->setTreeTablePK('tree');
$this->setObjectTablePK('obj_id');
$this->setReferenceTablePK('wsp_id');
// ilTree sets it to ROOT_FOLDER_ID if not given...
if(!$a_root_id)
{
$this->readRootId();
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilWorkspaceTree::cascadingDelete ( )

Remove all tree and node data.

Definition at line 141 of file class.ilWorkspaceTree.php.

References ilTree\$root_id, deleteReference(), ilTree\deleteTree(), ilObjectFactory\getInstanceByObjId(), ilTree\getNodeData(), ilTree\getSubTree(), and ilTree\readRootId().

{
$root_id = $this->readRootId();
if(!$root_id)
{
return;
}
$root = $this->getNodeData($root_id);
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
$access_handler = new ilWorkspaceAccessHandler($this);
// delete node data
$nodes = $this->getSubTree($root);
foreach($nodes as $node)
{
$access_handler->removePermission($node["wsp_id"]);
$object = ilObjectFactory::getInstanceByObjId($node["obj_id"], false);
if($object)
{
$object->delete();
}
$this->deleteReference($node["wsp_id"]);
}
$this->deleteTree($root);
}

+ Here is the call graph for this function:

ilWorkspaceTree::createReference (   $a_object_id)

Create workspace reference for object.

Parameters
int$a_object_id
Returns
int node id

Definition at line 37 of file class.ilWorkspaceTree.php.

References $ilDB.

Referenced by ilWorkspaceExplorer\__construct(), createTreeForUser(), and insertObject().

{
global $ilDB;
$next_id = $ilDB->nextId($this->table_obj_reference);
$fields = array($this->ref_pk => array("integer", $next_id),
$this->obj_pk => array("integer", $a_object_id));
$ilDB->insert($this->table_obj_reference, $fields);
return $next_id;
}

+ Here is the caller graph for this function:

ilWorkspaceTree::createTreeForUser (   $a_user_id)

Create personal workspace tree for user.

Parameters
int$a_user_id

Definition at line 190 of file class.ilWorkspaceTree.php.

References ilTree\$root_id, ilTree\addTree(), createReference(), ilObjectFactory\getClassByType(), and ilTree\setRootId().

Referenced by ilObjPortfolioBase\createBlogInPersonalWorkspace(), and ilExAssignmentGUI\getOverviewBody().

{
$root = new $root(null);
$root->create();
$root_id = $this->createReference($root->getId());
$this->addTree($a_user_id, $root_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilWorkspaceTree::deleteReference (   $a_node_id)

Delete object from reference table.

Parameters
int$a_node_id
Returns
bool

Definition at line 129 of file class.ilWorkspaceTree.php.

References $ilDB, and $query.

Referenced by cascadingDelete().

{
global $ilDB;
$query = "DELETE FROM ".$this->table_obj_reference.
" WHERE ".$this->ref_pk." = ".$ilDB->quote($a_node_id, "integer");
return $ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

ilWorkspaceTree::getObjectsFromType (   $a_type)

Get all workspace objects of specific type.

Parameters
string$a_type
Returns
array

Definition at line 178 of file class.ilWorkspaceTree.php.

References ilTree\getNodeData(), ilTree\getRootId(), and ilTree\getSubTree().

{
return $this->getSubTree(
$this->getNodeData($this->getRootId()),
false, $a_type);
}

+ Here is the call graph for this function:

ilWorkspaceTree::insertObject (   $a_parent_node_id,
  $a_object_id 
)

Add object to tree.

Parameters
int$a_parent_node_id
int$a_object_id
Returns
int node id

Definition at line 116 of file class.ilWorkspaceTree.php.

References createReference(), and ilTree\insertNode().

{
$node_id = $this->createReference($a_object_id);
$this->insertNode($node_id, $a_parent_node_id);
return $node_id;
}

+ Here is the call graph for this function:

ilWorkspaceTree::lookupNodeId (   $a_obj_id)

Get node id for object id.

As we do not allow references in workspace this should not be ambigious

Parameters
int$a_obj_id
Returns
int node id

Definition at line 78 of file class.ilWorkspaceTree.php.

References $ilDB, ilTree\$ref_pk, and $res.

Referenced by ilNote\_getRelatedObjectsOfUser().

{
global $ilDB;
$set = $ilDB->query("SELECT ".$this->ref_pk.
" FROM ".$this->table_obj_reference.
" WHERE ".$this->obj_pk." = ".$ilDB->quote($a_obj_id, "integer"));
$res = $ilDB->fetchAssoc($set);
}

+ Here is the caller graph for this function:

ilWorkspaceTree::lookupObjectId (   $a_node_id)

Get object id for node id.

Parameters
int$a_node_id
Returns
int object id

Definition at line 57 of file class.ilWorkspaceTree.php.

References $ilDB, ilTree\$obj_pk, and $res.

Referenced by ilObject2GUI\__construct(), ilTemplate\buildLoginTarget(), and ilObjBlog\sendNotification().

{
global $ilDB;
$set = $ilDB->query("SELECT ".$this->obj_pk.
" FROM ".$this->table_obj_reference.
" WHERE ".$this->ref_pk." = ".$ilDB->quote($a_node_id, "integer"));
$res = $ilDB->fetchAssoc($set);
}

+ Here is the caller graph for this function:

ilWorkspaceTree::lookupOwner (   $a_node_id)

Get owner for node id.

Parameters
int$a_node_id
Returns
int object id

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

References $ilDB, and $res.

Referenced by ilSharedResourceGUI\cancelPassword().

{
global $ilDB;
$set = $ilDB->query("SELECT tree".
" FROM ".$this->table_obj_reference.
" JOIN ".$this->table_tree." ON (".$this->table_obj_reference.".".$this->ref_pk." = ".$this->table_tree.".child)".
" WHERE ".$this->ref_pk." = ".$ilDB->quote($a_node_id, "integer"));
$res = $ilDB->fetchAssoc($set);
return $res["tree"];
}

+ Here is the caller graph for this function:


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