ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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. More...
 
 importPostData ($a_saved=null)
 Import post data. More...
 
 setSelection ($a_value)
 Set selection. More...
 
 getFilteredObjects ()
 Get filtered object ref ids. More...
 
- Public Member Functions inherited from ilClassificationProvider
 __construct ($a_parent_ref_id, $a_parent_obj_id, $a_parent_obj_type)
 Constructor. More...
 
 render (array &$a_html, $a_parent_gui)
 Render HTML chunks. More...
 
 importPostData ($a_saved=null)
 Import post data. More...
 
 setSelection ($a_value)
 Set selection. More...
 
 getFilteredObjects ()
 Get filtered object ref ids. More...
 
 initListGUI (ilObjectListGUI $a_list_gui)
 Init list gui properties. More...
 

Static Public Member Functions

static isActive ($a_parent_ref_id, $a_parent_obj_id, $a_parent_obj_type)
 Is provider currently active? More...
 
- 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) More...
 
static isActive ($a_parent_ref_id, $a_parent_obj_id, $a_parent_obj_type)
 Is provider currently active? More...
 

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. More...
 

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

◆ getActiveTaxonomiesForParentRefId()

static ilTaxonomyClassificationProvider::getActiveTaxonomiesForParentRefId (   $a_parent_ref_id)
staticprotected

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

85 {
86 global $tree;
87
88 if(!isset(self::$valid_tax_map[$a_parent_ref_id]))
89 {
90 include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
91 include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
92 include_once "Modules/Category/classes/class.ilObjCategoryGUI.php";
93
95
96 $all_valid = array();
97 foreach($tree->getPathFull($a_parent_ref_id) as $node)
98 {
99 if($node["type"] == "cat")
100 {
101 $node_valid = array();
102
104 $node["obj_id"],
106 false
107 ))
108 {
109 $all_valid = array_merge($all_valid,
110 ilObjTaxonomy::getUsageOfObject($node["obj_id"]));
111
112 $active = array();
113 foreach(ilContainer::_getContainerSettings($node["obj_id"]) as $keyword => $value)
114 {
115 if(substr($keyword, 0, strlen($prefix)) == $prefix && (bool)$value)
116 {
117 $active[] = substr($keyword, strlen($prefix));
118 }
119 }
120
121 $node_valid = array_intersect($all_valid, $active);
122 }
123
124 if(sizeof($node_valid))
125 {
126 foreach($node_valid as $idx => $node_id)
127 {
128 // #15268 - deleted taxonomy?
129 if(ilObject::_lookupType($node_id) != "tax")
130 {
131 unset($node_valid[$idx]);
132 }
133 }
134 }
135
136 self::$valid_tax_map[$node["ref_id"]] = $node_valid;
137 }
138 }
139 }
140
141 return sizeof(self::$valid_tax_map[$a_parent_ref_id]);
142 }
static _getContainerSettings($a_id)
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
static _lookupType($a_id, $a_reference=false)
lookup object type

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

Referenced by isActive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilteredObjects()

ilTaxonomyClassificationProvider::getFilteredObjects ( )

Get filtered object ref ids.

Returns
array

Reimplemented from ilClassificationProvider.

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

145 {
146 include_once "Services/Taxonomy/classes/class.ilTaxonomyTree.php";
147 include_once "Services/Taxonomy/classes/class.ilTaxNodeAssignment.php";
148 include_once "Services/Taxonomy/classes/class.ilTaxonomyNode.php";
149
150 $tax_obj_ids = $tax_map = array();
151
152 // :TODO: this could be smarter
153 foreach($this->selection as $node_id)
154 {
155 $node = new ilTaxonomyNode($node_id);
156 $tax_map[$node->getTaxonomyId()][] = $node_id;
157 }
158
159 foreach($tax_map as $tax_id => $node_ids)
160 {
161 $tax_tree = new ilTaxonomyTree($tax_id);
162
163 // combine taxonomy nodes OR
164 $tax_nodes = array();
165 foreach($node_ids as $node_id)
166 {
167 $tax_nodes = array_merge($tax_nodes, $tax_tree->getSubTreeIds($node_id));
168 $tax_nodes[] = $node_id;
169 }
170
171 $tax_obj_ids[$tax_id] = ilTaxNodeAssignment::findObjectsByNode($tax_id, $tax_nodes, "obj");
172 }
173
174 // combine taxonomies AND
175 $obj_ids = null;
176 foreach($tax_obj_ids as $tax_objs)
177 {
178 if($obj_ids === null)
179 {
180 $obj_ids = $tax_objs;
181 }
182 else
183 {
184 $obj_ids = array_intersect($obj_ids, $tax_objs);
185 }
186 }
187
188 return (array)$obj_ids;
189 }
static findObjectsByNode($a_tax_id, array $a_node_ids, $a_item_type)
Find object which have assigned nodes.

References ilTaxNodeAssignment\findObjectsByNode().

+ Here is the call graph for this function:

◆ importPostData()

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.

55 {
56 $incoming_id = (int)$_REQUEST["tax_node"];
57 if($incoming_id)
58 {
59 if(is_array($a_saved))
60 {
61 foreach($a_saved as $idx => $node_id)
62 {
63 if($node_id == $incoming_id)
64 {
65 unset($a_saved[$idx]);
66 return $a_saved;
67 }
68 }
69 $a_saved[] = $incoming_id;
70 return $a_saved;
71 }
72 else
73 {
74 return array($incoming_id);
75 }
76 }
77 }
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_REQUEST.

◆ isActive()

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.

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

References getActiveTaxonomiesForParentRefId().

Referenced by ilClassificationProvider\getValidProviders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

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.

26 {
27 include_once("./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
28
29 foreach(self::$valid_tax_map[$this->parent_ref_id] as $tax_id)
30 {
31 $tax_exp = new ilTaxonomyExplorerGUI($a_parent_gui, null, $tax_id, null, null);
32 $tax_exp->setSkipRootNode(true);
33 $tax_exp->setOnClick("il.Classification.toggle({tax_node: '{NODE_CHILD}'});");
34
35 if(is_array($this->selection))
36 {
37 foreach($this->selection as $node_id)
38 {
39 $tax_exp->setPathOpen($node_id);
40 $tax_exp->setNodeSelected($node_id);
41 }
42 }
43
44 if (!$tax_exp->handleCommand())
45 {
46 $a_html[] = array(
47 "title" => ilObject::_lookupTitle($tax_id),
48 "html" => $tax_exp->getHTML()
49 );
50 }
51 }
52 }
static _lookupTitle($a_id)
lookup object title
Taxonomy explorer GUI class.

References ilObject\_lookupTitle().

+ Here is the call graph for this function:

◆ setSelection()

ilTaxonomyClassificationProvider::setSelection (   $a_value)

Set selection.

Parameters
mixed$a_value

Reimplemented from ilClassificationProvider.

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

80 {
81 $this->selection = $a_value;
82 }

Field Documentation

◆ $selection

ilTaxonomyClassificationProvider::$selection
protected

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

◆ $valid_tax_map

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: