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

Taxonomy classification provider. More...

+ Inheritance diagram for ilTaxonomyClassificationProvider:
+ Collaboration diagram for ilTaxonomyClassificationProvider:

Public Member Functions

 render (array &$a_html, $a_parent_gui)
 Render HTML chunks.
 importPostData ($a_saved=null)
 Import post data.
 setSelection ($a_value)
 Set selection.
 getFilteredObjects ()
 Get filtered object ref ids.
- Public Member Functions inherited from ilClassificationProvider
 __construct ($a_parent_ref_id, $a_parent_obj_id, $a_parent_obj_type)
 Constructor.
 initListGUI (ilObjectListGUI $a_list_gui)
 Init list gui properties.

Static Public Member Functions

static isActive ($a_parent_ref_id, $a_parent_obj_id, $a_parent_obj_type)
 Is provider currently active?
- Static Public Member Functions inherited from ilClassificationProvider
static getValidProviders ($a_parent_ref_id, $a_parent_obj_id, $a_parent_obj_type)
 Get all valid providers (for parent container)

Static Protected Member Functions

static getActiveTaxonomiesForParentRefId ($a_parent_ref_id)

Protected Attributes

 $selection
- Protected Attributes inherited from ilClassificationProvider
 $parent_ref_id
 $parent_obj_id
 $parent_type

Static Protected Attributes

static $valid_tax_map = array()

Additional Inherited Members

- Protected Member Functions inherited from ilClassificationProvider
 init ()
 Instance initialisation.

Detailed Description

Taxonomy classification provider.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Member Function Documentation

static ilTaxonomyClassificationProvider::getActiveTaxonomiesForParentRefId (   $a_parent_ref_id)
staticprotected

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

References ilContainer\_getContainerSettings(), ilContainer\_lookupContainerSetting(), ilObject\_lookupType(), ilObjCategoryGUI\CONTAINER_SETTING_TAXBLOCK, ilObjTaxonomy\getUsageOfObject(), and ilObjectServiceSettingsGUI\TAXONOMIES.

Referenced by isActive().

{
global $tree;
if(!isset(self::$valid_tax_map[$a_parent_ref_id]))
{
include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
include_once "Modules/Category/classes/class.ilObjCategoryGUI.php";
$all_valid = array();
foreach($tree->getPathFull($a_parent_ref_id) as $node)
{
if($node["type"] == "cat")
{
$node_valid = array();
$node["obj_id"],
false
))
{
$all_valid = array_merge($all_valid,
ilObjTaxonomy::getUsageOfObject($node["obj_id"]));
$active = array();
foreach(ilContainer::_getContainerSettings($node["obj_id"]) as $keyword => $value)
{
if(substr($keyword, 0, strlen($prefix)) == $prefix && (bool)$value)
{
$active[] = substr($keyword, strlen($prefix));
}
}
$node_valid = array_intersect($all_valid, $active);
}
if(sizeof($node_valid))
{
foreach($node_valid as $idx => $node_id)
{
// #15268 - deleted taxonomy?
if(ilObject::_lookupType($node_id) != "tax")
{
unset($node_valid[$idx]);
}
}
}
self::$valid_tax_map[$node["ref_id"]] = $node_valid;
}
}
}
return sizeof(self::$valid_tax_map[$a_parent_ref_id]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTaxonomyClassificationProvider::getFilteredObjects ( )

Get filtered object ref ids.

Returns
array

Reimplemented from ilClassificationProvider.

Definition at line 144 of file class.ilTaxonomyClassificationProvider.php.

References ilTaxNodeAssignment\findObjectsByNode().

{
include_once "Services/Taxonomy/classes/class.ilTaxonomyTree.php";
include_once "Services/Taxonomy/classes/class.ilTaxNodeAssignment.php";
include_once "Services/Taxonomy/classes/class.ilTaxonomyNode.php";
$tax_obj_ids = $tax_map = array();
// :TODO: this could be smarter
foreach($this->selection as $node_id)
{
$node = new ilTaxonomyNode($node_id);
$tax_map[$node->getTaxonomyId()][] = $node_id;
}
foreach($tax_map as $tax_id => $node_ids)
{
$tax_tree = new ilTaxonomyTree($tax_id);
// combine taxonomy nodes OR
$tax_nodes = array();
foreach($node_ids as $node_id)
{
$tax_nodes = array_merge($tax_nodes, $tax_tree->getSubTreeIds($node_id));
$tax_nodes[] = $node_id;
}
$tax_obj_ids[$tax_id] = ilTaxNodeAssignment::findObjectsByNode($tax_id, $tax_nodes, "obj");
}
// combine taxonomies AND
$obj_ids = null;
foreach($tax_obj_ids as $tax_objs)
{
if($obj_ids === null)
{
$obj_ids = $tax_objs;
}
else
{
$obj_ids = array_intersect($obj_ids, $tax_objs);
}
}
return (array)$obj_ids;
}

+ Here is the call graph for this function:

ilTaxonomyClassificationProvider::importPostData (   $a_saved = null)

Import post data.

Parameters
mixed$a_saved
Returns
mixed

Reimplemented from ilClassificationProvider.

Definition at line 54 of file class.ilTaxonomyClassificationProvider.php.

References $_REQUEST.

{
$incoming_id = (int)$_REQUEST["tax_node"];
if($incoming_id)
{
if(is_array($a_saved))
{
foreach($a_saved as $idx => $node_id)
{
if($node_id == $incoming_id)
{
unset($a_saved[$idx]);
return $a_saved;
}
}
$a_saved[] = $incoming_id;
return $a_saved;
}
else
{
return array($incoming_id);
}
}
}
static ilTaxonomyClassificationProvider::isActive (   $a_parent_ref_id,
  $a_parent_obj_id,
  $a_parent_obj_type 
)
static

Is provider currently active?

Parameters
int$a_parent_ref_id
int$a_parent_obj_id
string$a_parent_obj_type
Returns
bool

Reimplemented from ilClassificationProvider.

Definition at line 20 of file class.ilTaxonomyClassificationProvider.php.

References getActiveTaxonomiesForParentRefId().

Referenced by ilClassificationProvider\getValidProviders().

{
return (bool)self::getActiveTaxonomiesForParentRefId($a_parent_ref_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTaxonomyClassificationProvider::render ( array &  $a_html,
  $a_parent_gui 
)

Render HTML chunks.

Parameters
array$a_html
object$a_parent_gui

Reimplemented from ilClassificationProvider.

Definition at line 25 of file class.ilTaxonomyClassificationProvider.php.

References ilObject\_lookupTitle().

{
include_once("./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
foreach(self::$valid_tax_map[$this->parent_ref_id] as $tax_id)
{
$tax_exp = new ilTaxonomyExplorerGUI($a_parent_gui, null, $tax_id, null, null);
$tax_exp->setSkipRootNode(true);
$tax_exp->setOnClick("il.Classification.toggle({tax_node: '{NODE_CHILD}'});");
if(is_array($this->selection))
{
foreach($this->selection as $node_id)
{
$tax_exp->setPathOpen($node_id);
$tax_exp->setNodeSelected($node_id);
}
}
if (!$tax_exp->handleCommand())
{
$a_html[] = array(
"title" => ilObject::_lookupTitle($tax_id),
"html" => $tax_exp->getHTML()
);
}
}
}

+ Here is the call graph for this function:

ilTaxonomyClassificationProvider::setSelection (   $a_value)

Set selection.

Parameters
mixed$a_value

Reimplemented from ilClassificationProvider.

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

{
$this->selection = $a_value;
}

Field Documentation

ilTaxonomyClassificationProvider::$selection
protected

Definition at line 16 of file class.ilTaxonomyClassificationProvider.php.

ilTaxonomyClassificationProvider::$valid_tax_map = array()
staticprotected

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


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