ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTaxMDGUI Class Reference

Taxonomies selection for metadata helper GUI. More...

+ Collaboration diagram for ilTaxMDGUI:

Public Member Functions

 __construct ($a_md_rbac_id, $a_md_obj_id, $a_md_obj_type, $a_ref_id)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 show ()
 Show. More...
 
 save ()
 Save form. More...
 
 initForm ()
 Init taxonomy form. More...
 
 getSelectableTaxonomies ()
 Get selectable taxonomies for current object. More...
 
 addToMDForm (ilPropertyFormGUI $a_form)
 Add taxonomy selector to MD (quick edit) form. More...
 
 updateFromMDForm ()
 Import settings from MD (quick edit) form. More...
 
 addSubTab ()
 addSubTab More...
 

Protected Member Functions

 initTaxNodeAssignment ($a_tax_id)
 Init tax node assignment. More...
 

Protected Attributes

 $obj_definition
 
 $tree
 
 $md_rbac_id
 
 $md_obj_id
 
 $md_obj_type
 

Detailed Description

Taxonomies selection for metadata helper GUI.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om @ilCtrl_Calls ilTaxMDGUI: ilFormPropertyDispatchGUI

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

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

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

37 {
38 global $DIC;
39
40 $this->obj_definition = $DIC["objDefinition"];
41 $this->tree = $DIC->repositoryTree();
42
43
44 $this->tabs = $DIC->tabs();
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $this->tpl = $DIC["tpl"];
48
49 $this->md_rbac_id = $a_md_rbac_id;
50 $this->md_obj_id = $a_md_obj_id;
51 $this->md_obj_type = $a_md_obj_type;
52 $this->ref_id = $a_ref_id;
53 }
global $DIC
Definition: goto.php:24

References $DIC.

Member Function Documentation

◆ addSubTab()

ilTaxMDGUI::addSubTab ( )

addSubTab

Parameters

return

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

244 {
245 $tabs = $this->tabs;
246 $ctrl = $this->ctrl;
248
249 $tax_ids = $this->getSelectableTaxonomies();
250 if (is_array($tax_ids)) {
251 $tabs->addSubTab(
252 "tax_assignment",
253 $lng->txt("tax_tax_assignment"),
254 $ctrl->getLinkTarget($this, "")
255 );
256 }
257 }
getSelectableTaxonomies()
Get selectable taxonomies for current object.
$lng

References $lng, and getSelectableTaxonomies().

+ Here is the call graph for this function:

◆ addToMDForm()

ilTaxMDGUI::addToMDForm ( ilPropertyFormGUI  $a_form)

Add taxonomy selector to MD (quick edit) form.

Parameters
ilPropertyFormGUI$a_form

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

193 {
194 $tax_ids = $this->getSelectableTaxonomies();
195 if (is_array($tax_ids)) {
196 include_once "Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php";
197 foreach ($tax_ids as $tax_id) {
198 // get existing assignments
199 $node_ids = array();
200 $ta = $this->initTaxNodeAssignment($tax_id);
201 foreach ($ta->getAssignmentsOfItem($this->md_obj_id) as $ass) {
202 $node_ids[] = $ass["node_id"];
203 }
204
205 $tax_sel = new ilTaxSelectInputGUI($tax_id, "md_tax_" . $tax_id, true);
206 $tax_sel->setValue($node_ids);
207 $a_form->addItem($tax_sel);
208 }
209 }
210 }
addItem($a_item)
Add Item (Property, SectionHeader).
initTaxNodeAssignment($a_tax_id)
Init tax node assignment.
Select taxonomy nodes input GUI.

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

Referenced by initForm().

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

◆ executeCommand()

ilTaxMDGUI::executeCommand ( )

Execute command.

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

59 {
60 $next_class = $this->ctrl->getNextClass($this);
61 $cmd = $this->ctrl->getCmd("show");
62
63 switch ($next_class) {
64 case 'ilformpropertydispatchgui':
65 $form = $this->initForm();
66 include_once './Services/Form/classes/class.ilFormPropertyDispatchGUI.php';
67 $form_prop_dispatch = new ilFormPropertyDispatchGUI();
68 $item = $form->getItemByPostVar($_GET["postvar"]);
69 $form_prop_dispatch->setItem($item);
70 return $this->ctrl->forwardCommand($form_prop_dispatch);
71
72 default:
73 if (in_array($cmd, array("show", "save"))) {
74 $this->$cmd();
75 }
76 }
77 }
$_GET["client_id"]
initForm()
Init taxonomy form.

References $_GET, and initForm().

+ Here is the call graph for this function:

◆ getSelectableTaxonomies()

ilTaxMDGUI::getSelectableTaxonomies ( )

Get selectable taxonomies for current object.

Returns
array

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

137 {
138 $objDefinition = $this->obj_definition;
140
141 if ($this->ref_id > 0 && $objDefinition->isRBACObject($this->md_obj_type)) {
142 $res = array();
143
144 // see ilTaxonomyBlockGUI::getActiveTaxonomies()
145
146 // get all active taxonomies of parent objects
147 foreach ($tree->getPathFull((int) $this->ref_id) as $node) {
148 if ($node["ref_id"] != (int) $this->ref_id) {
149 // currently only active for categories
150 if ($node["type"] == "cat") {
151 include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
152 include_once "Services/Container/classes/class.ilContainer.php";
154 $node["obj_id"],
156 false
157 )
158 ) {
159 include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
160 $tax_ids = ilObjTaxonomy::getUsageOfObject($node["obj_id"]);
161 if (sizeof($tax_ids)) {
162 $res = array_merge($res, $tax_ids);
163 }
164 }
165 }
166 }
167 }
168
169 if (sizeof($res)) {
170 return $res;
171 }
172 }
173 }
static _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.
foreach($_POST as $key=> $value) $res

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

Referenced by addSubTab(), addToMDForm(), and updateFromMDForm().

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

◆ initForm()

ilTaxMDGUI::initForm ( )

Init taxonomy form.

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

116 {
117 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
118 $form = new ilPropertyFormGUI();
119
120 $this->addToMDForm($form);
121
122 $form->addCommandButton("save", $this->lng->txt("save"));
123
124
125 $form->setTitle($this->lng->txt("tax_tax_assignment"));
126 $form->setFormAction($this->ctrl->getFormAction($this));
127
128 return $form;
129 }
This class represents a property form user interface.
addToMDForm(ilPropertyFormGUI $a_form)
Add taxonomy selector to MD (quick edit) form.

References addToMDForm().

Referenced by executeCommand(), save(), and show().

+ 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 181 of file class.ilTaxMDGUI.php.

182 {
183 include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
184 return new ilTaxNodeAssignment($this->md_obj_type, $this->md_obj_id, "obj", $a_tax_id);
185 }
Taxonomy node <-> item assignment.

Referenced by addToMDForm(), and updateFromMDForm().

+ Here is the caller graph for this function:

◆ save()

ilTaxMDGUI::save ( )

Save form.

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

97 {
99 $ctrl = $this->ctrl;
100
101 $form = $this->initForm();
102 if ($form->checkInput()) {
103 $this->updateFromMDForm();
104 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
105 $ctrl->redirect($this, "show");
106 } else {
107 $form->setValuesByPost();
108 $tpl->setContent($form->getHtml());
109 }
110 }
updateFromMDForm()
Import settings from MD (quick edit) form.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

References $tpl, initForm(), and updateFromMDForm().

+ Here is the call graph for this function:

◆ show()

ilTaxMDGUI::show ( )

Show.

Parameters

return

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

86 {
88
89 $form = $this->initForm();
90 $tpl->setContent($form->getHTML());
91 }

References $tpl, and initForm().

+ Here is the call graph for this function:

◆ updateFromMDForm()

ilTaxMDGUI::updateFromMDForm ( )

Import settings from MD (quick edit) form.

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

216 {
217 $tax_ids = $this->getSelectableTaxonomies();
218 if (is_array($tax_ids)) {
219 include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
220
221 foreach ($tax_ids as $tax_id) {
222 $ta = $this->initTaxNodeAssignment($tax_id);
223
224 // delete existing assignments
225 $ta->deleteAssignmentsOfItem($this->md_obj_id);
226
227 // set current assignment
228 if (is_array($_POST["md_tax_" . $tax_id])) {
229 foreach ($_POST["md_tax_" . $tax_id] as $node_id) {
230 $ta->addAssignment($node_id, $this->md_obj_id);
231 }
232 }
233 }
234 }
235 }
$_POST["username"]

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

Referenced by save().

+ 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 24 of file class.ilTaxMDGUI.php.

◆ $md_obj_type

ilTaxMDGUI::$md_obj_type
protected

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

◆ $md_rbac_id

ilTaxMDGUI::$md_rbac_id
protected

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

◆ $obj_definition

ilTaxMDGUI::$obj_definition
protected

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

Referenced by getSelectableTaxonomies().

◆ $tree

ilTaxMDGUI::$tree
protected

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

Referenced by getSelectableTaxonomies().


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