ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 setTaxonomyId ($a_val)
 Set taxonomy id.
 getTaxonomyId ()
 Get taxonomy id.
 setOptions ($a_options)
 Set Options.
 getOptions ()
 Get Options.
 saveInput ($a_component_id, $a_obj_id, $a_item_type, $a_item_id)
 Save input.
 setCurrentValues ($a_component_id, $a_obj_id, $a_item_type, $a_item_id)
 Set current values.
- Public Member Functions inherited from ilSelectInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor.
 setValue ($a_value)
 Set Value.
 getValue ()
 Get Value.
 setValueByArray ($a_values)
 Set value by array.
 checkInput ()
 Check input, strip slashes etc.
 addCustomAttribute ($a_attr)
 getCustomAttributes ()
 render ($a_mode="")
 Render item.
 insert (&$a_tpl)
 Insert property html.
 getTableFilterHTML ()
 Get HTML for table filter.
 getToolbarHTML ()
 Get HTML for toolbar.
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively
 checkSubItemsInput ()
 Check SubItems.
 getSubForm ()
 Get sub form html.
 getItemByPostVar ($a_post_var)
 Get item by post var.
- Public Member Functions inherited from ilFormPropertyGUI
executeCommand ()
 Execute command.
 getType ()
 Get Type.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setPostVar ($a_postvar)
 Set Post Variable.
 getPostVar ()
 Get Post Variable.
 getFieldId ()
 Get Post Variable.
 setInfo ($a_info)
 Set Information Text.
 getInfo ()
 Get Information Text.
 setAlert ($a_alert)
 Set Alert Text.
 getAlert ()
 Get Alert Text.
 setRequired ($a_required)
 Set Required.
 getRequired ()
 Get Required.
 setDisabled ($a_disabled)
 Set Disabled.
 getDisabled ()
 Get Disabled.
 setParentForm ($a_parentform)
 Set Parent Form.
 getParentForm ()
 Get Parent Form.
 setParent ($a_val)
 Set Parent GUI object.
 getParent ()
 Get Parent GUI object.
 hideSubForm ()
 Sub form hidden on init?
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders)
 getHiddenTitle ()
 Get hidden title.
 serializeData ()
 serialize data
 unserializeData ($a_data)
 unserialize data
 writeToSession ()
 Write to session.
 clearFromSession ()
 Clear session value.
 readFromSession ()
 Read from session.
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties)
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi.
 getMulti ()
 Get Multi.
 setMultiValues (array $a_values)
 Set multi values.
 getMultiValues ()
 Get multi values.
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g.

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type.
 getMultiIconsHTML ()
 Get HTML for multiple value icons.
- Protected Attributes inherited from ilSelectInputGUI
 $cust_attr = array()
 $options = array()
 $value

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

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 $lng, ilFormPropertyGUI\setMulti(), setTaxonomyId(), and ilFormPropertyGUI\setType().

{
global $lng;
$lng->loadLanguageModule("tax");
$this->setMulti($a_multi);
$this->include_please_select = $a_include_please_select;
if ($a_title == "")
{
$a_title = $lng->txt("tax_taxonomy");
}
if ($a_postvar == "")
{
$a_postvar = "tax_node_assign";
}
parent::__construct($a_title, $a_postvar);
$this->setType("tax_assign");
if ((int) $a_taxonomy_id == 0)
{
throw new ilTaxonomyExceptions("No taxonomy ID passed to ilTaxAssignInputGUI.");
}
$this->setTaxonomyId((int) $a_taxonomy_id);
}

+ Here is the call graph for this function:

Member Function Documentation

ilTaxAssignInputGUI::getOptions ( )

Get Options.

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

Reimplemented from ilSelectInputGUI.

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

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

{
global $lng;
if ($this->include_please_select)
{
$options = array("" => $lng->txt("please_select"));
}
include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
$tax_tree = new ilTaxonomyTree($this->getTaxonomyId());
$nodes = $tax_tree->getSubtree($tax_tree->getNodeData($tax_tree->readRootId()));
foreach ($nodes as $n)
{
if ($n["type"] == "taxn")
{
$options[$n["child"]] = str_repeat(" ", ($n["depth"] - 2) * 2).$n["title"];
}
}
return $options;
}

+ Here is the call graph for this function:

ilTaxAssignInputGUI::getTaxonomyId ( )

Get taxonomy id.

Returns
int taxonomy id

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

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

{
return $this->taxononmy_id;
}

+ Here is the caller graph for this function:

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.

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

{
include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
$tax_node_ass = new ilTaxNodeAssignment($a_component_id, $a_obj_id, $a_item_type, $this->getTaxonomyId());
//$tax_node_ass->deleteAssignmentsOfItem($a_item_id);
$post = $_POST[$this->getPostVar()];
if (!$this->getMulti())
{
$post = array($post);
}
$current_ass = $tax_node_ass->getAssignmentsOfItem($a_item_id);
$exising = array();
foreach ($current_ass as $ca)
{
if (!in_array($ca["node_id"], $post))
{
$tax_node_ass->deleteAssignment($ca["node_id"], $a_item_id);
}
else
{
$exising[] = $ca["node_id"];
}
}
foreach ($post as $p)
{
if (!in_array($p, $exising))
{
$tax_node_ass->addAssignment(ilUtil::stripSlashes($p), $a_item_id);
}
}
}

+ Here is the call graph for this function:

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

Set current values.

Parameters
@return

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

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

Referenced by assQuestionGUI\populateTaxonomyFormSection().

{
include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
$tax_node_ass = new ilTaxNodeAssignment($a_component_id, $a_obj_id, $a_item_type, $this->getTaxonomyId());
$ass = $tax_node_ass->getAssignmentsOfItem($a_item_id);
$nodes = array();
foreach ($ass as $a)
{
$nodes[] = $a["node_id"];
}
if ($this->getMulti())
{
$this->setValue($nodes);
}
else
{
$this->setValue($nodes[0]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

{
throw new ilTaxonomyExceptions("setOptions: Not supported for ilTaxAssignInputGUI.");
}
ilTaxAssignInputGUI::setTaxonomyId (   $a_val)

Set taxonomy id.

Parameters
int$a_valtaxonomy id

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

Referenced by __construct().

{
$this->taxononmy_id = $a_val;
}

+ Here is the caller graph for this function:


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