ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNestedListInputGUI Class Reference

This class represents a (nested) list of checkboxes (could be extended for radio items, too) More...

+ Inheritance diagram for ilNestedListInputGUI:
+ Collaboration diagram for ilNestedListInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 addListNode ($a_id, $a_text, $a_parent=0, $a_checked=false, $a_disabled=false, $a_img_src="", $a_img_alt="", $a_post_var="")
 Add list node.
 setValue ($a_value)
 Set Value.
 getValue ()
 Get Value.
 setValueByArray ($a_values)
 Set value by array.
 checkInput ()
 Check input, strip slashes etc.
 render ()
 Render item.
 insert (&$a_tpl)
 Insert property html.
- 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.
 getSubForm ()
 Get sub form html.
 hideSubForm ()
 Sub form hidden on init?
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders)
 getHiddenTitle ()
 Get hidden title.
 getItemByPostVar ($a_post_var)
 Get item by post var.
 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)

Protected Attributes

 $value = "1"
 $checked
 $list_nodes = array()
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false
 $parentgui
 $parentform
 $hidden_title = ""

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type.

Detailed Description

This class represents a (nested) list of checkboxes (could be extended for radio items, too)

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

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

Constructor & Destructor Documentation

ilNestedListInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

References ilFormPropertyGUI\setType().

{
parent::__construct($a_title, $a_postvar);
$this->setType("nested_list");
include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
$this->list = new ilNestedList();
}

+ Here is the call graph for this function:

Member Function Documentation

ilNestedListInputGUI::addListNode (   $a_id,
  $a_text,
  $a_parent = 0,
  $a_checked = false,
  $a_disabled = false,
  $a_img_src = "",
  $a_img_alt = "",
  $a_post_var = "" 
)

Add list node.

Parameters

Definition at line 40 of file class.ilNestedListInputGUI.php.

{
$this->list_nodes[$a_id] = array("text" => $a_text,
"parent" => $a_parent, "checked" => $a_checked, "disabled" => $a_disabled,
"img_src" => $a_img_src, "img_alt" => $a_img_alt, "post_var" => $a_post_var);
}
ilNestedListInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

Definition at line 87 of file class.ilNestedListInputGUI.php.

References $lng.

{
global $lng;
return true;
}
ilNestedListInputGUI::getValue ( )

Get Value.

Returns
string Value

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

References $value.

{
return $this->value;
}
ilNestedListInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 130 of file class.ilNestedListInputGUI.php.

References render().

{
$html = $this->render();
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $html);
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilNestedListInputGUI::render ( )

Render item.

Definition at line 97 of file class.ilNestedListInputGUI.php.

References $n, $value, ilUtil\formCheckbox(), ilFormPropertyGUI\getPostVar(), and ilUtil\img().

Referenced by insert().

{
foreach ($this->list_nodes as $id => $n)
{
if ($n["post_var"] == "")
{
$post_var = $this->getPostVar()."[]";
$value = $id;
}
else
{
$post_var = $n["post_var"];
$value = $id;
}
$item_html = ilUtil::formCheckbox($n["checked"], $post_var, $value,
$n["disabled"]);
if ($n["img_src"] != "")
{
$item_html.= ilUtil::img($n["img_src"], $n["img_alt"])." ";
}
$item_html.= $n["text"];
$this->list->addListNode($item_html, $id, $n["parent"]);
}
return $this->list->getHTML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNestedListInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 53 of file class.ilNestedListInputGUI.php.

{
$this->value = $a_value;
}
ilNestedListInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
object$a_itemItem

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

{
// $this->setChecked($a_values[$this->getPostVar()]);
// foreach($this->getSubItems() as $item)
// {
// $item->setValueByArray($a_values);
// }
}

Field Documentation

ilNestedListInputGUI::$checked
protected

Definition at line 17 of file class.ilNestedListInputGUI.php.

ilNestedListInputGUI::$list_nodes = array()
protected

Definition at line 18 of file class.ilNestedListInputGUI.php.

ilNestedListInputGUI::$value = "1"
protected

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

Referenced by getValue(), and render().


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