ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTaxMDGUI Class Reference
+ Collaboration diagram for ilTaxMDGUI:

Public Member Functions

 __construct ($a_md_rbac_id, $a_md_obj_id, $a_md_obj_type)
 Constructor. More...
 
 addToMDForm (ilPropertyFormGUI $a_form)
 Add taxonomy selector to MD (quick edit) form. More...
 
 updateFromMDForm ()
 Import settings from MD (quick edit) form. More...
 

Protected Member Functions

 getSelectableTaxonomies ()
 Get selectable taxonomies for current object. More...
 
 initTaxNodeAssignment ($a_tax_id)
 Init tax node assignment. More...
 

Protected Attributes

 $md_rbac_id
 
 $md_obj_id
 
 $md_obj_type
 

Detailed Description

Definition at line 12 of file class.ilTaxMDGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTaxMDGUI::__construct (   $a_md_rbac_id,
  $a_md_obj_id,
  $a_md_obj_type 
)

Constructor.

Parameters
int$a_md_rbac_id
int$a_md_obj_id
int$a_md_obj_type
Returns
self

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

27  {
28  $this->md_rbac_id = $a_md_rbac_id;
29  $this->md_obj_id = $a_md_obj_id;
30  $this->md_obj_type = $a_md_obj_type;
31  }

Member Function Documentation

◆ addToMDForm()

ilTaxMDGUI::addToMDForm ( ilPropertyFormGUI  $a_form)

Add taxonomy selector to MD (quick edit) form.

Parameters
ilPropertyFormGUI$a_form

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

References ilPropertyFormGUI\addItem(), array, getSelectableTaxonomies(), and initTaxNodeAssignment().

Referenced by ilMDEditorGUI\initQuickEditForm().

97  {
98  $tax_ids = $this->getSelectableTaxonomies();
99  if(is_array($tax_ids))
100  {
101  include_once "Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php";
102  foreach($tax_ids as $tax_id)
103  {
104  // get existing assignments
105  $node_ids = array();
106  $ta = $this->initTaxNodeAssignment($tax_id);
107  foreach($ta->getAssignmentsOfItem($this->md_obj_id) as $ass)
108  {
109  $node_ids[] = $ass["node_id"];
110  }
111 
112  $tax_sel = new ilTaxSelectInputGUI($tax_id, "md_tax_".$tax_id, true);
113  $tax_sel->setValue($node_ids);
114  $a_form->addItem($tax_sel);
115  }
116  }
117  }
Select taxonomy nodes input GUI.
addItem($a_item)
Add Item (Property, SectionHeader).
getSelectableTaxonomies()
Get selectable taxonomies for current object.
initTaxNodeAssignment($a_tax_id)
Init tax node assignment.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableTaxonomies()

ilTaxMDGUI::getSelectableTaxonomies ( )
protected

Get selectable taxonomies for current object.

Returns
array

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

References $res, ilContainer\_lookupContainerSetting(), array, ilObjTaxonomy\getUsageOfObject(), and ilObjectServiceSettingsGUI\TAXONOMIES.

Referenced by addToMDForm(), and updateFromMDForm().

39  {
40  global $objDefinition, $tree;
41 
42  if($objDefinition->isRBACObject($this->md_obj_type))
43  {
44  $res = array();
45 
46  // see ilTaxonomyBlockGUI::getActiveTaxonomies()
47 
48  // get all active taxonomies of parent objects
49  foreach($tree->getPathFull((int)$_REQUEST["ref_id"]) as $node)
50  {
51  // currently only active for categories
52  if($node["type"] == "cat")
53  {
54  include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
55  include_once "Services/Container/classes/class.ilContainer.php";
57  $node["obj_id"],
59  false
60  ))
61  {
62  include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
63  $tax_ids = ilObjTaxonomy::getUsageOfObject($node["obj_id"]);
64  if(sizeof($tax_ids))
65  {
66  $res = array_merge($res, $tax_ids);
67  }
68  }
69  }
70  }
71 
72  if(sizeof($res))
73  {
74  return $res;
75  }
76  }
77  }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
Create styles array
The data for the language used.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTaxNodeAssignment()

ilTaxMDGUI::initTaxNodeAssignment (   $a_tax_id)
protected

Init tax node assignment.

Parameters
int$a_tax_id
Returns
ilTaxNodeAssignment

Definition at line 85 of file class.ilTaxMDGUI.php.

Referenced by addToMDForm(), and updateFromMDForm().

86  {
87  include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
88  return new ilTaxNodeAssignment($this->md_obj_type, $this->md_obj_id, "obj", $a_tax_id);
89  }
Taxonomy node <-> item assignment.
+ Here is the caller graph for this function:

◆ updateFromMDForm()

ilTaxMDGUI::updateFromMDForm ( )

Import settings from MD (quick edit) form.

Definition at line 122 of file class.ilTaxMDGUI.php.

References $_POST, getSelectableTaxonomies(), and initTaxNodeAssignment().

Referenced by ilMDEditorGUI\updateQuickEdit().

123  {
124  $tax_ids = $this->getSelectableTaxonomies();
125  if(is_array($tax_ids))
126  {
127  include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
128 
129  foreach($tax_ids as $tax_id)
130  {
131  $ta = $this->initTaxNodeAssignment($tax_id);
132 
133  // delete existing assignments
134  $ta->deleteAssignmentsOfItem($this->md_obj_id);
135 
136  // set current assignment
137  if(is_array($_POST["md_tax_".$tax_id]))
138  {
139  foreach($_POST["md_tax_".$tax_id] as $node_id)
140  {
141  $ta->addAssignment($node_id, $this->md_obj_id);
142  }
143  }
144  }
145  }
146  }
getSelectableTaxonomies()
Get selectable taxonomies for current object.
initTaxNodeAssignment($a_tax_id)
Init tax node assignment.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $md_obj_id

ilTaxMDGUI::$md_obj_id
protected

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

◆ $md_obj_type

ilTaxMDGUI::$md_obj_type
protected

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

◆ $md_rbac_id

ilTaxMDGUI::$md_rbac_id
protected

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


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