ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTaxAssignInputGUI Class Reference

Input GUI class for taxonomy assignments. More...

+ Inheritance diagram for ilTaxAssignInputGUI:
+ Collaboration diagram for ilTaxAssignInputGUI:

Public Member Functions

 __construct ( $a_taxonomy_id, $a_multi=true, $a_title="", $a_postvar="", $a_include_please_select=true)
 Constructor. More...
 
 setTaxonomyId ($a_val)
 Set taxonomy id. More...
 
 getTaxonomyId ()
 Get taxonomy id. More...
 
 setOptions ($a_options)
 Set Options. More...
 
 getOptions ()
 Get Options. More...
 
 saveInput ($a_component_id, $a_obj_id, $a_item_type, $a_item_id)
 Save input. More...
 
 setCurrentValues ($a_component_id, $a_obj_id, $a_item_type, $a_item_id)
 Set current values. More...
 
- Public Member Functions inherited from ilSelectInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setOptions ($a_options)
 Set Options. More...
 
 getOptions ()
 Get Options. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 addCustomAttribute ($a_attr)
 
 getCustomAttributes ()
 
 render ($a_mode="")
 Render item. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
 setHideSubForm ($a_value, $a_condition=null)
 Set initial sub form visibility, optionally add dynamic value-based condition. More...
 
 hideSubForm ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 
- Protected Attributes inherited from ilSelectInputGUI
 $cust_attr = array()
 
 $options = array()
 
 $value
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Detailed Description

Input GUI class for taxonomy assignments.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilTaxAssignInputGUI::__construct (   $a_taxonomy_id,
  $a_multi = true,
  $a_title = "",
  $a_postvar = "",
  $a_include_please_select = true 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 24 of file class.ilTaxAssignInputGUI.php.

References $DIC, ilFormPropertyGUI\$lng, ilFormPropertyGUI\setMulti(), setTaxonomyId(), and ilFormPropertyGUI\setType().

30  {
31  global $DIC;
32 
33  $this->lng = $DIC->language();
34  $lng = $DIC->language();
35 
36  $lng->loadLanguageModule("tax");
37  $this->setMulti($a_multi);
38  $this->include_please_select = $a_include_please_select;
39 
40  if ($a_title == "") {
41  $a_title = $lng->txt("tax_taxonomy");
42  }
43 
44  if ($a_postvar == "") {
45  $a_postvar = "tax_node_assign";
46  }
47 
48  parent::__construct($a_title, $a_postvar);
49  $this->setType("tax_assign");
50 
51  if ((int) $a_taxonomy_id == 0) {
52  throw new ilTaxonomyExceptions("No taxonomy ID passed to ilTaxAssignInputGUI.");
53  }
54 
55  $this->setTaxonomyId((int) $a_taxonomy_id);
56  }
global $DIC
Definition: saml.php:7
setType($a_type)
Set Type.
setMulti($a_multi, $a_sortable=false, $a_addremove=true)
Set Multi.
setTaxonomyId($a_val)
Set taxonomy id.
+ Here is the call graph for this function:

Member Function Documentation

◆ getOptions()

ilTaxAssignInputGUI::getOptions ( )

Get Options.

Returns
array Options. Array ("value" => "option_text")

Definition at line 93 of file class.ilTaxAssignInputGUI.php.

References ilFormPropertyGUI\$lng, $n, ilSelectInputGUI\$options, array, and getTaxonomyId().

94  {
95  $lng = $this->lng;
96 
97  if ($this->include_please_select) {
98  $options = array("" => $lng->txt("please_select"));
99  }
100 
101  include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
102  $tax_tree = new ilTaxonomyTree($this->getTaxonomyId());
103 
104  $nodes = $tax_tree->getSubtree($tax_tree->getNodeData($tax_tree->readRootId()));
105  foreach ($nodes as $n) {
106  if ($n["type"] == "taxn") {
107  $options[$n["child"]] = str_repeat(" ", ($n["depth"] - 2) * 2) . $n["title"];
108  }
109  }
110 
111  return $options;
112  }
getTaxonomyId()
Get taxonomy id.
$n
Definition: RandomTest.php:85
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getTaxonomyId()

ilTaxAssignInputGUI::getTaxonomyId ( )

Get taxonomy id.

Returns
int taxonomy id

Definition at line 73 of file class.ilTaxAssignInputGUI.php.

Referenced by getOptions(), saveInput(), and setCurrentValues().

74  {
75  return $this->taxononmy_id;
76  }
+ Here is the caller graph for this function:

◆ saveInput()

ilTaxAssignInputGUI::saveInput (   $a_component_id,
  $a_obj_id,
  $a_item_type,
  $a_item_id 
)

Save input.

Parameters

Definition at line 120 of file class.ilTaxAssignInputGUI.php.

References $_POST, $post, array, ilFormPropertyGUI\getMulti(), ilFormPropertyGUI\getPostVar(), getTaxonomyId(), and ilUtil\stripSlashes().

121  {
122  include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
123  $tax_node_ass = new ilTaxNodeAssignment($a_component_id, $a_obj_id, $a_item_type, $this->getTaxonomyId());
124  //$tax_node_ass->deleteAssignmentsOfItem($a_item_id);
125 
126  $post = $_POST[$this->getPostVar()];
127  if (!$this->getMulti()) {
128  $post = array($post);
129  } elseif (!is_array($post)) {
130  // BH: when multi values are ENABLED and $form->checkInput is NOT called
131  // there is no post parameter available WHEN the selection is left empty
132  // - fixed mantis #22186 - the followup issue
133  $post = array();
134  }
135 
136  $current_ass = $tax_node_ass->getAssignmentsOfItem($a_item_id);
137  $exising = array();
138  foreach ($current_ass as $ca) {
139  if (!in_array($ca["node_id"], $post)) {
140  $tax_node_ass->deleteAssignment($ca["node_id"], $a_item_id);
141  } else {
142  $exising[] = $ca["node_id"];
143  }
144  }
145 
146  foreach ($post as $p) {
147  if (!in_array($p, $exising)) {
148  $tax_node_ass->addAssignment(ilUtil::stripSlashes($p), $a_item_id);
149  }
150  }
151  }
Taxonomy node <-> item assignment.
getTaxonomyId()
Get taxonomy id.
getPostVar()
Get Post Variable.
$post
Definition: post.php:34
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ setCurrentValues()

ilTaxAssignInputGUI::setCurrentValues (   $a_component_id,
  $a_obj_id,
  $a_item_type,
  $a_item_id 
)

Set current values.

Parameters

Definition at line 159 of file class.ilTaxAssignInputGUI.php.

References array, ilFormPropertyGUI\getMulti(), getTaxonomyId(), and ilSelectInputGUI\setValue().

160  {
161  include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
162  $tax_node_ass = new ilTaxNodeAssignment($a_component_id, $a_obj_id, $a_item_type, $this->getTaxonomyId());
163  $ass = $tax_node_ass->getAssignmentsOfItem($a_item_id);
164 
165  $nodes = array();
166  foreach ($ass as $a) {
167  $nodes[] = $a["node_id"];
168  }
169  if ($this->getMulti()) {
170  $this->setValue($nodes);
171  } else {
172  $this->setValue($nodes[0]);
173  }
174  }
Taxonomy node <-> item assignment.
getTaxonomyId()
Get taxonomy id.
setValue($a_value)
Set Value.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ setOptions()

ilTaxAssignInputGUI::setOptions (   $a_options)

Set Options.

Parameters
array$a_optionsOptions. Array ("value" => "option_text")

Definition at line 83 of file class.ilTaxAssignInputGUI.php.

84  {
85  throw new ilTaxonomyExceptions("setOptions: Not supported for ilTaxAssignInputGUI.");
86  }

◆ setTaxonomyId()

ilTaxAssignInputGUI::setTaxonomyId (   $a_val)

Set taxonomy id.

Parameters
int$a_valtaxonomy id

Definition at line 63 of file class.ilTaxAssignInputGUI.php.

Referenced by __construct().

64  {
65  $this->taxononmy_id = $a_val;
66  }
+ Here is the caller graph for this function:

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