ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjTaxonomy Class Reference

Taxonomy. More...

+ Inheritance diagram for ilObjTaxonomy:
+ Collaboration diagram for ilObjTaxonomy:

Public Member Functions

 ilObjTaxonomy ($a_id=0)
 Constructor.
 initType ()
 Init type.
 setSortingMode ($a_val)
 Set sorting mode.
 getSortingMode ()
 Get sorting mode.
 setItemSorting ($a_val)
 Set item sorting.
 getItemSorting ()
 Get item sorting.
 getTree ()
 Get tree.
 getNodeMapping ()
 Get node mapping (used after cloning)
 doCreate ()
 Create a new taxonomy.
 doCloneObject ($a_new_obj, $a_target_id, $a_copy_id)
 clone taxonomy sheet (note: taxonomies have no ref ids and return an object id)
 cloneNodes ($a_new_obj, $a_target_parent, $a_source_parent)
 Clone nodes.
 doDelete ()
 Delete taxonomy object.
 doRead ()
 Read taxonomy properties.
 doUpdate ()
 Upate taxonomy properties.
- Public Member Functions inherited from ilObject2
 __construct ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 Read data from db.
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 create ($a_clone_mode=false)
 update ()
 update object in db
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 createReference ()
 creates reference for object
 countReferences ()
 count references of object
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!!
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public
 createRoleFolder ()
 creates a local role folder
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts.
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneMetaData ($target_obj)
 Copy meta data.
 cloneObject ($a_target_id, $a_copy_id=null, $a_omit_tree=false)
 Clone object permissions, put in tree ...
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 create ()
 create
 applyDidacticTemplate ($a_tpl_id)
 Apply template.
 getXMLZip ()
 getHTMLDirectory ()
 _lookupCreationDate ($a_id)
 Lookup creation date.

Static Public Member Functions

static loadLanguageModule ()
 Load language module.
static saveUsage ($a_tax_id, $a_obj_id)
 Save Usage.
static getUsageOfObject ($a_obj_id, $a_include_titles=false)
 Get usage of object.
static deleteUsagesOfTaxonomy ($a_id)
 Delete all usages of a taxonomy.
static getSubTreeItems ($a_comp, $a_obj_id, $a_item_type, $a_tax_id, $a_node)
 Get all assigned items under a node.
static lookupSortingMode ($a_id)
 Lookup sorting mode.
- Static Public Member Functions inherited from ilObject2
static _lookupObjIdByImportId ($a_import_id)
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupDescription ($a_id)
 lookup object description
static _lookupObjId ($a_id)
static _lookupType ($a_id, $a_reference=false)
 lookup object type
static _lookupObjectId ($a_ref_id)
 lookup object id
static _exists ($a_id, $a_reference=false)
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type)
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
- Static Public Member Functions inherited from ilObject
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB.
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.
static getLongDescriptions (array $a_obj_ids)
 Get long description data.
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns.
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course.

Data Fields

const SORT_ALPHABETICAL = 0
const SORT_MANUAL = 1

Static Protected Member Functions

static lookup ($a_field, $a_id)
 Lookup.

Protected Attributes

 $node_mapping = array()
 $item_sorting = false

Additional Inherited Members

- Protected Member Functions inherited from ilObject2
 beforeCreate ()
 beforeUpdate ()
 doMDUpdateListener ($a_element)
 beforeMDUpdateListener ($a_element)
 doCreateMetaData ()
 beforeCreateMetaData ()
 doUpdateMetaData ()
 beforeUpdateMetaData ()
 beforeDelete ()
 beforeCloneObject ()

Detailed Description

Taxonomy.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e $Id$

Definition at line 14 of file class.ilObjTaxonomy.php.

Member Function Documentation

ilObjTaxonomy::cloneNodes (   $a_new_obj,
  $a_target_parent,
  $a_source_parent 
)

Clone nodes.

Parameters
@return

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

References getTree(), and ilObject2\putInTree().

Referenced by doCloneObject().

{
include_once("./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
// get all childs
$nodes = $this->getTree()->getChilds($a_source_parent);
foreach ($nodes as $node)
{
switch ($node["type"])
{
case "taxn":
$tax_node = new ilTaxonomyNode($node["child"]);
$new_node = $tax_node->copy($a_new_obj->getId());
break;
}
ilTaxonomyNode::putInTree($a_new_obj->getId(),
$new_node, $a_target_parent);
$this->node_mapping[$node["child"]] = $new_node->getId();
// handle childs
$this->cloneNodes($a_new_obj, $new_node->getId(), $node["child"]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjTaxonomy::deleteUsagesOfTaxonomy (   $a_id)
static

Delete all usages of a taxonomy.

Parameters
@return

Definition at line 329 of file class.ilObjTaxonomy.php.

Referenced by doDelete().

{
global $ilDB;
$ilDB->manipulate("DELETE FROM tax_usage WHERE ".
" tax_id = ".$ilDB->quote($a_id, "integer")
);
}

+ Here is the caller graph for this function:

ilObjTaxonomy::doCloneObject (   $a_new_obj,
  $a_target_id,
  $a_copy_id 
)

clone taxonomy sheet (note: taxonomies have no ref ids and return an object id)

public

Returns
integer new obj id

Reimplemented from ilObject2.

Definition at line 145 of file class.ilObjTaxonomy.php.

References ilObject\$lng, $log, cloneNodes(), ilObject2\getDescription(), getSortingMode(), ilObject2\getTitle(), and getTree().

{
global $log, $lng;
$a_new_obj->setTitle($this->getTitle());
$a_new_obj->setDescription($this->getDescription());
$a_new_obj->setSortingMode($this->getSortingMode());
$this->node_mapping = array();
$this->cloneNodes($a_new_obj, $a_new_obj->getTree()->readRootId(),
$this->getTree()->readRootId());
}

+ Here is the call graph for this function:

ilObjTaxonomy::doCreate ( )

Create a new taxonomy.

Reimplemented from ilObject2.

Definition at line 115 of file class.ilObjTaxonomy.php.

References ilObject2\getId().

{
global $ilDB;
// create tax data record
$ilDB->manipulate("INSERT INTO tax_data ".
"(id, sorting_mode, item_sorting) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote((int) $this->getSortingMode(), "integer").",".
$ilDB->quote((int) $this->getItemSorting(), "integer").
")");
// create the taxonomy tree
include_once("./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
$node = new ilTaxonomyNode();
$node->setType(""); // empty type
$node->setTitle("Root node for taxonomy ".$this->getId());
$node->setTaxonomyId($this->getId());
$node->create();
include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
$tax_tree = new ilTaxonomyTree($this->getId());
$tax_tree->addTree($this->getId(), $node->getId());
}

+ Here is the call graph for this function:

ilObjTaxonomy::doDelete ( )

Delete taxonomy object.

Reimplemented from ilObject2.

Definition at line 196 of file class.ilObjTaxonomy.php.

References deleteUsagesOfTaxonomy(), ilObject2\getId(), and getTree().

{
global $ilDB;
// delete usages
// get all nodes
$tree = $this->getTree();
$subtree = $tree->getSubTreeIds($tree->readRootId());
$subtree[] = $tree->readRootId();
// get root node data (important: must happen before we
// delete the nodes
$root_node_data = $tree->getNodeData($tree->readRootId());
// delete all nodes
include_once("./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
foreach ($subtree as $node_id)
{
// delete node (this also deletes its assignments)
$node = new ilTaxonomyNode($node_id);
$node->delete();
}
// delete the tree
$tree->deleteTree($root_node_data);
// delete taxonoymy properties record
$ilDB->manipulate("DELETE FROM tax_data WHERE ".
" id = ".$ilDB->quote($this->getId(), "integer")
);
}

+ Here is the call graph for this function:

ilObjTaxonomy::doRead ( )

Read taxonomy properties.

Reimplemented from ilObject2.

Definition at line 235 of file class.ilObjTaxonomy.php.

References setItemSorting(), and setSortingMode().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM tax_data ".
" WHERE id = ".$ilDB->quote($this->getId(), "integer")
);
$rec = $ilDB->fetchAssoc($set);
$this->setSortingMode($rec["sorting_mode"]);
$this->setItemSorting($rec["item_sorting"]);
}

+ Here is the call graph for this function:

ilObjTaxonomy::doUpdate ( )

Upate taxonomy properties.

Reimplemented from ilObject2.

Definition at line 250 of file class.ilObjTaxonomy.php.

References $t.

{
global $ilDB;
$ilDB->manipulate($t = "UPDATE tax_data SET ".
" sorting_mode = ".$ilDB->quote((int) $this->getSortingMode(), "integer").", ".
" item_sorting = ".$ilDB->quote((int) $this->getItemSorting(), "integer").
" WHERE id = ".$ilDB->quote($this->getId(), "integer")
);
}
ilObjTaxonomy::getItemSorting ( )

Get item sorting.

Returns
bool item sorting

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

References $item_sorting.

{
}
ilObjTaxonomy::getNodeMapping ( )

Get node mapping (used after cloning)

Parameters
@return

Definition at line 106 of file class.ilObjTaxonomy.php.

References $node_mapping.

Referenced by ilTestRandomQuestionSetDuplicatedTaxonomiesKeysMap\addDuplicatedTaxonomy().

{
}

+ Here is the caller graph for this function:

ilObjTaxonomy::getSortingMode ( )

Get sorting mode.

Returns
int sorting mode

Definition at line 58 of file class.ilObjTaxonomy.php.

Referenced by doCloneObject().

{
return $this->sorting_mode;
}

+ Here is the caller graph for this function:

static ilObjTaxonomy::getSubTreeItems (   $a_comp,
  $a_obj_id,
  $a_item_type,
  $a_tax_id,
  $a_node 
)
static

Get all assigned items under a node.

Parameters
@return

Definition at line 346 of file class.ilObjTaxonomy.php.

Referenced by ilGlossaryTerm\getFirstLetters(), ilGlossaryTerm\getTermList(), and ilGlossaryPresentationGUI\printView().

{
include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
$tree = new ilTaxonomyTree($a_tax_id);
$sub_nodes = $tree->getSubTreeIds($a_node);
$sub_nodes[] = $a_node;
include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
$tn_ass = new ilTaxNodeAssignment($a_comp, $a_obj_id, $a_item_type, $a_tax_id);
$items = $tn_ass->getAssignmentsOfNode($sub_nodes);
return $items;
}

+ Here is the caller graph for this function:

ilObjTaxonomy::getTree ( )

Get tree.

Parameters
@return

Definition at line 89 of file class.ilObjTaxonomy.php.

References ilObject2\getId().

Referenced by cloneNodes(), ilObjTaxonomyGUI\confirmedDelete(), doCloneObject(), and doDelete().

{
if ($this->getId() > 0)
{
include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
$tax_tree = new ilTaxonomyTree($this->getId());
return $tax_tree;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjTaxonomy::getUsageOfObject (   $a_obj_id,
  $a_include_titles = false 
)
static

Get usage of object.

Parameters
int$a_obj_idobject id
Returns
array array of taxonomies

Definition at line 299 of file class.ilObjTaxonomy.php.

References ilObject\_lookupTitle().

Referenced by ilTaxonomyListTableGUI\__construct(), ilTestPlayerDynamicQuestionSetGUI\buildQuestionSetFilteredStatisticTableGUI(), ilObjTestDynamicQuestionSetConfigGUI\buildTaxonomySelectInputOptionArray(), ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator\duplicate(), ilObjQuestionPoolGUI\filterQuestionBrowserObject(), ilObjTaxonomyGUI\getCurrentTaxonomyId(), ilGlossaryTerm\getFirstLetters(), ilObjGlossary\getTaxonomyId(), ilObjQuestionPool\getTaxonomyIds(), ilGlossaryTerm\getTermList(), ilGlossaryExporter\getXmlExportTailDependencies(), ilTestDynamicQuestionSet\initFilteredQuestionList(), ilObjGlossaryGUI\initSettingsForm(), ilObjTaxonomyGUI\listTaxonomies(), ilObjQuestionPoolGUI\questionsObject(), ilTestRandomQuestionSetStagingPoolBuilder\removeMirroredTaxonomies(), ilObjQuestionPoolGUI\resetQuestionBrowserObject(), ilTestRandomQuestionSetConfigGUI\saveCreateSourcePoolDefinitionFormCmd(), ilTestRandomQuestionSetConfigGUI\saveEditSourcePoolDefinitionFormCmd(), ilTestRandomQuestionSetConfigGUI\showCreateSourcePoolDefinitionFormCmd(), ilTestRandomQuestionSetConfigGUI\showEditSourcePoolDefinitionFormCmd(), ilGlossaryPresentationGUI\showTaxonomy(), and ilObjGlossaryGUI\showTaxonomy().

{
global $ilDB;
$set = $ilDB->query("SELECT tax_id FROM tax_usage ".
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
$tax = array();
while ($rec = $ilDB->fetchAssoc($set))
{
if (!$a_include_titles)
{
$tax[] = $rec["tax_id"];
}
else
{
$tax[] = array("tax_id" => $rec["tax_id"],
"title" => ilObject::_lookupTitle($rec["tax_id"])
);
}
}
return $tax;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjTaxonomy::ilObjTaxonomy (   $a_id = 0)

Constructor.

Parameters
integerobject id

Definition at line 26 of file class.ilObjTaxonomy.php.

References ilObject\ilObject().

{
$this->type = "tax";
parent::ilObject($a_id, false);
}

+ Here is the call graph for this function:

ilObjTaxonomy::initType ( )

Init type.

Parameters
@return

Reimplemented from ilObject2.

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

{
$this->type = "tax";
}
static ilObjTaxonomy::loadLanguageModule ( )
static

Load language module.

Parameters
@return

Definition at line 267 of file class.ilObjTaxonomy.php.

References ilObject\$lng.

Referenced by ilObjGlossaryGUI\setSettingsSubTabs().

{
global $lng;
$lng->loadLanguageModule("tax");
}

+ Here is the caller graph for this function:

static ilObjTaxonomy::lookup (   $a_field,
  $a_id 
)
staticprotected

Lookup.

Parameters
@return

Definition at line 367 of file class.ilObjTaxonomy.php.

Referenced by lookupSortingMode().

{
global $ilDB;
$set = $ilDB->query("SELECT ".$a_field." FROM tax_data ".
" WHERE id = ".$ilDB->quote($a_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec[$a_field];
}

+ Here is the caller graph for this function:

static ilObjTaxonomy::lookupSortingMode (   $a_id)
static

Lookup sorting mode.

Parameters
int$a_idtaxonomy id
Returns
int sorting mode

Definition at line 385 of file class.ilObjTaxonomy.php.

References lookup().

Referenced by ilTaxonomyExplorerGUI\__construct().

{
return self::lookup("sorting_mode", $a_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjTaxonomy::saveUsage (   $a_tax_id,
  $a_obj_id 
)
static

Save Usage.

Parameters
@return

Definition at line 281 of file class.ilObjTaxonomy.php.

Referenced by ilObjTaxonomyGUI\afterSave(), ilObjGlossary\cloneObject(), ilTestRandomQuestionSetSourcePoolTaxonomiesDuplicator\duplicateTaxonomyFromPoolToTest(), and ilGlossaryImporter\finalProcessing().

{
global $ilDB;
$ilDB->replace("tax_usage",
array("tax_id" => array("integer", $a_tax_id),
"obj_id" => array("integer", $a_obj_id)
),
array()
);
}

+ Here is the caller graph for this function:

ilObjTaxonomy::setItemSorting (   $a_val)

Set item sorting.

Parameters
bool$a_valitem sorting

Definition at line 68 of file class.ilObjTaxonomy.php.

Referenced by doRead().

{
$this->item_sorting = $a_val;
}

+ Here is the caller graph for this function:

ilObjTaxonomy::setSortingMode (   $a_val)

Set sorting mode.

Parameters
int$a_valsorting mode

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

Referenced by doRead().

{
$this->sorting_mode = $a_val;
}

+ Here is the caller graph for this function:

Field Documentation

ilObjTaxonomy::$item_sorting = false
protected

Definition at line 19 of file class.ilObjTaxonomy.php.

Referenced by getItemSorting().

ilObjTaxonomy::$node_mapping = array()
protected

Definition at line 18 of file class.ilObjTaxonomy.php.

Referenced by getNodeMapping().

const ilObjTaxonomy::SORT_ALPHABETICAL = 0

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