ILIAS  release_8 Revision v8.24
ilTaxonomyClassificationProvider Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 render (array &$a_html, object $a_parent_gui)
 Render HTML chunks. More...
 
 importPostData (?array $a_saved=null)
 Import post data. More...
 
 setSelection (array $a_value)
 @inheritDoc More...
 
 getFilteredObjects ()
 Get filtered object ref ids. More...
 
- Public Member Functions inherited from ilClassificationProvider
 __construct (int $a_parent_ref_id, int $a_parent_obj_id, string $a_parent_obj_type)
 
 render (array &$a_html, object $a_parent_gui)
 Render HTML chunks. More...
 
 importPostData (?array $a_saved=null)
 Import post data. More...
 
 setSelection (array $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 (int $a_parent_ref_id, int $a_parent_obj_id, string $a_parent_obj_type)
 Is provider currently active? More...
 
- Static Public Member Functions inherited from ilClassificationProvider
static getValidProviders (int $a_parent_ref_id, int $a_parent_obj_id, string $a_parent_obj_type)
 Get all valid providers (for parent container) More...
 
static isActive (int $a_parent_ref_id, int $a_parent_obj_id, string $a_parent_obj_type)
 Is provider currently active? More...
 

Protected Member Functions

 init ()
 
 init ()
 

Static Protected Member Functions

static getActiveTaxonomiesForParentRefId (int $a_parent_ref_id)
 

Protected Attributes

array $selection = []
 
int $incoming_id = 0
 
- Protected Attributes inherited from ilClassificationProvider
int $parent_ref_id
 
int $parent_obj_id
 
string $parent_type
 
RequestInterface $request
 

Static Protected Attributes

static array $valid_tax_map = []
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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

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

Member Function Documentation

◆ getActiveTaxonomiesForParentRefId()

static ilTaxonomyClassificationProvider::getActiveTaxonomiesForParentRefId ( int  $a_parent_ref_id)
staticprotected

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

92 : int
93 {
94 global $DIC;
95
96 $tree = $DIC->repositoryTree();
97
98 if (!isset(self::$valid_tax_map[$a_parent_ref_id])) {
100
101 $all_valid = array();
102 foreach ($tree->getPathFull($a_parent_ref_id) as $node) {
103 if ($node["type"] == "cat") {
104 $node_valid = array();
105
107 (int) $node["obj_id"],
109 false
110 ) !== '') {
111 $all_valid = array_merge(
112 $all_valid,
113 ilObjTaxonomy::getUsageOfObject((int) $node["obj_id"])
114 );
115
116 $active = array();
117 foreach (ilContainer::_getContainerSettings((int) $node["obj_id"]) as $keyword => $value) {
118 if (substr($keyword, 0, strlen($prefix)) == $prefix && (bool) $value) {
119 $active[] = substr($keyword, strlen($prefix));
120 }
121 }
122
123 $node_valid = array_intersect($all_valid, $active);
124 }
125
126 if (count($node_valid) !== 0) {
127 foreach ($node_valid as $idx => $node_id) {
128 // #15268 - deleted taxonomy?
129 if (ilObject::_lookupType((int) $node_id) != "tax") {
130 unset($node_valid[$idx]);
131 }
132 }
133 }
134
135 self::$valid_tax_map[$node["ref_id"]] = $node_valid;
136 }
137 }
138 }
139
140 if (isset(self::$valid_tax_map[$a_parent_ref_id]) && is_array(self::$valid_tax_map[$a_parent_ref_id])) {
141 return count(self::$valid_tax_map[$a_parent_ref_id]);
142 }
143
144 return 0;
145 }
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static _getContainerSettings(int $a_id)
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
static _lookupType(int $id, bool $reference=false)
global $DIC
Definition: feed.php:28

References $DIC, 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.

Reimplemented from ilClassificationProvider.

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

147 : array
148 {
149 $tax_obj_ids = array();
150 $tax_map = array();
151
152 // :TODO: this could be smarter
153 foreach ($this->selection as $node_id) {
154 $node = new ilTaxonomyNode((int) $node_id);
155 $tax_map[$node->getTaxonomyId()][] = (int) $node_id;
156 }
157
158 foreach ($tax_map as $tax_id => $node_ids) {
159 $tax_tree = new ilTaxonomyTree((int) $tax_id);
160
161 // combine taxonomy nodes OR
162 $tax_nodes = array();
163 foreach ($node_ids as $node_id) {
164 $tax_nodes = array_merge($tax_nodes, $tax_tree->getSubTreeIds((int) $node_id));
165 $tax_nodes[] = (int) $node_id;
166 }
167 $tax_obj_ids[$tax_id] = ilTaxNodeAssignment::findObjectsByNode((int) $tax_id, $tax_nodes, "obj");
168 }
169
170 // combine taxonomies AND
171 $obj_ids = null;
172 foreach ($tax_obj_ids as $tax_objs) {
173 $obj_ids = $obj_ids === null ? $tax_objs : array_intersect($obj_ids, $tax_objs);
174 }
175
176 return (array) $obj_ids;
177 }
static findObjectsByNode(int $a_tax_id, array $a_node_ids, string $a_item_type)
Find object which have assigned nodes.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilTaxNodeAssignment\findObjectsByNode(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ importPostData()

ilTaxonomyClassificationProvider::importPostData ( ?array  $a_saved = null)

Import post data.

Parameters
array | null$a_saved

Reimplemented from ilClassificationProvider.

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

64 : array
65 {
67 if ($incoming_id !== 0) {
68 if (is_array($a_saved)) {
69 foreach ($a_saved as $idx => $node_id) {
70 if ($node_id == $incoming_id) {
71 unset($a_saved[$idx]);
72 return $a_saved;
73 }
74 }
75 $a_saved[] = $incoming_id;
76 return $a_saved;
77 } else {
78 return array($incoming_id);
79 }
80 }
81 return [];
82 }

References $incoming_id.

◆ init()

ilTaxonomyClassificationProvider::init ( )
protected

Reimplemented from ilClassificationProvider.

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

34 : void
35 {
36 $params = $this->request->getQueryParams();
37 $body = $this->request->getParsedBody();
38 $this->incoming_id = (int) ($body["tax_node"] ?? ($params["tax_node"] ?? null));
39 }
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33

References $params, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ isActive()

static ilTaxonomyClassificationProvider::isActive ( int  $a_parent_ref_id,
int  $a_parent_obj_id,
string  $a_parent_obj_type 
)
static

Is provider currently active?

Reimplemented from ilClassificationProvider.

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

29 : bool
30 {
31 return (bool) self::getActiveTaxonomiesForParentRefId($a_parent_ref_id);
32 }
static getActiveTaxonomiesForParentRefId(int $a_parent_ref_id)

References getActiveTaxonomiesForParentRefId().

+ Here is the call graph for this function:

◆ render()

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

Render HTML chunks.

Reimplemented from ilClassificationProvider.

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

41 : void
42 {
43 foreach (self::$valid_tax_map[$this->parent_ref_id] as $tax_id) {
44 $tax_exp = new ilTaxonomyClassificationExplorerGUI($a_parent_gui, "", (int) $tax_id, "", "");
45 $tax_exp->setSkipRootNode(true);
46 $tax_exp->setOnClick("il.Classification.toggle({tax_node: '{NODE_CHILD}'});");
47
48 if (isset($this->selection) && is_array($this->selection)) {
49 foreach ($this->selection as $node_id) {
50 $tax_exp->setPathOpen($node_id);
51 $tax_exp->setNodeSelected($node_id);
52 }
53 }
54
55 if (!$tax_exp->handleCommand()) {
56 $a_html[] = array(
57 "title" => ilObject::_lookupTitle((int) $tax_id),
58 "html" => $tax_exp->getHTML(true)
59 );
60 }
61 }
62 }
static _lookupTitle(int $obj_id)

References ilObject\_lookupTitle().

+ Here is the call graph for this function:

◆ setSelection()

ilTaxonomyClassificationProvider::setSelection ( array  $a_value)

@inheritDoc

Reimplemented from ilClassificationProvider.

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

87 : void
88 {
89 $this->selection = $a_value;
90 }

Field Documentation

◆ $incoming_id

int ilTaxonomyClassificationProvider::$incoming_id = 0
protected

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

Referenced by importPostData().

◆ $selection

array ilTaxonomyClassificationProvider::$selection = []
protected

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

◆ $valid_tax_map

array ilTaxonomyClassificationProvider::$valid_tax_map = []
staticprotected

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


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