ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 Sub form hidden on init? More...
 
- 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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Additional Inherited Members

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

26 {
27 global $lng;
28
29 $lng->loadLanguageModule("tax");
30 $this->setMulti($a_multi);
31 $this->include_please_select = $a_include_please_select;
32
33 if ($a_title == "")
34 {
35 $a_title = $lng->txt("tax_taxonomy");
36 }
37
38 if ($a_postvar == "")
39 {
40 $a_postvar = "tax_node_assign";
41 }
42
43 parent::__construct($a_title, $a_postvar);
44 $this->setType("tax_assign");
45
46 if ((int) $a_taxonomy_id == 0)
47 {
48 throw new ilTaxonomyExceptions("No taxonomy ID passed to ilTaxAssignInputGUI.");
49 }
50
51 $this->setTaxonomyId((int) $a_taxonomy_id);
52 }
setType($a_type)
Set Type.
setMulti($a_multi, $a_sortable=false, $a_addremove=true)
Set Multi.
setTaxonomyId($a_val)
Set taxonomy id.
global $lng
Definition: privfeed.php:40

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getOptions()

ilTaxAssignInputGUI::getOptions ( )

Get Options.

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

Reimplemented from ilSelectInputGUI.

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

90 {
91 global $lng;
92
93 if ($this->include_please_select)
94 {
95 $options = array("" => $lng->txt("please_select"));
96 }
97
98 include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
99 $tax_tree = new ilTaxonomyTree($this->getTaxonomyId());
100
101 $nodes = $tax_tree->getSubtree($tax_tree->getNodeData($tax_tree->readRootId()));
102 foreach ($nodes as $n)
103 {
104 if ($n["type"] == "taxn")
105 {
106 $options[$n["child"]] = str_repeat(" ", ($n["depth"] - 2) * 2).$n["title"];
107 }
108 }
109
110 return $options;
111 }
$n
Definition: RandomTest.php:80

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

+ Here is the call graph for this function:

◆ getTaxonomyId()

ilTaxAssignInputGUI::getTaxonomyId ( )

Get taxonomy id.

Returns
int taxonomy id

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

70 {
71 return $this->taxononmy_id;
72 }

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

+ 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

return

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

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

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

+ 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

return

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

168 {
169 include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
170 $tax_node_ass = new ilTaxNodeAssignment($a_component_id, $a_obj_id, $a_item_type, $this->getTaxonomyId());
171 $ass = $tax_node_ass->getAssignmentsOfItem($a_item_id);
172
173 $nodes = array();
174 foreach ($ass as $a)
175 {
176 $nodes[] = $a["node_id"];
177 }
178 if ($this->getMulti())
179 {
180 $this->setValue($nodes);
181 }
182 else
183 {
184 $this->setValue($nodes[0]);
185 }
186 }
setValue($a_value)
Set Value.

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

+ Here is the call graph for this function:

◆ setOptions()

ilTaxAssignInputGUI::setOptions (   $a_options)

Set Options.

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

Reimplemented from ilSelectInputGUI.

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

80 {
81 throw new ilTaxonomyExceptions("setOptions: Not supported for ilTaxAssignInputGUI.");
82 }

◆ setTaxonomyId()

ilTaxAssignInputGUI::setTaxonomyId (   $a_val)

Set taxonomy id.

Parameters
int$a_valtaxonomy id

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

60 {
61 $this->taxononmy_id = $a_val;
62 }

Referenced by __construct().

+ Here is the caller graph for this function:

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