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

This class represents a number property in a property form. More...

+ Inheritance diagram for ilCombinationInputGUI:
+ Collaboration diagram for ilCombinationInputGUI:

Public Member Functions

 addCombinationItem ($id, $item, $label="")
 Add property item.
 getCombinationItem ($id)
 Get property item.
 removeCombinationItem ($id)
 Remove property item.
 __call ($method, $param)
 Call item methods.
 serializeData ()
 serialize data
 unserializeData ($a_data)
 unserialize data
 setComparisonMode ($mode)
 Set mode for comparison (extended validation)
 setValue ($a_value)
 Set Value.
 getValue ()
 Get Value.
 setValueByArray ($a_values)
 Set value by array.
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.
 render ()
 Render item.
 getTableFilterHTML ()
 Get HTML for table filter.
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 checkSubItemsInput ()
 Check SubItems.
 getSubForm ()
 Get sub form html.
 getItemByPostVar ($a_post_var)
 Get item by post var.
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor.
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.
 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)

Data Fields

const COMPARISON_ASCENDING = 1
const COMPARISON_DESCENDING = 2

Protected Attributes

 $items = array()
 $labels
 $comparison
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = 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 number property in a property form.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 31 of file class.ilCombinationInputGUI.php.

Member Function Documentation

ilCombinationInputGUI::__call (   $method,
  $param 
)

Call item methods.

Parameters
string$method
array$param

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

References $result.

{
$result = array();
foreach($this->items as $id => $obj)
{
if(method_exists($obj, $method))
{
$result[$id] = call_user_func_array(array($obj, $method), $param);
}
}
return $result;
}
ilCombinationInputGUI::addCombinationItem (   $id,
  $item,
  $label = "" 
)

Add property item.

Parameters
string$id
object$item
string$label

Definition at line 47 of file class.ilCombinationInputGUI.php.

{
$this->items[$id] = $item;
if($label)
{
$this->labels[$id] = $label;
}
}
ilCombinationInputGUI::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 239 of file class.ilCombinationInputGUI.php.

References ilSubEnabledFormPropertyGUI\checkSubItemsInput().

{
if(sizeof($this->items))
{
foreach($this->items as $id => $obj)
{
if(!$obj->checkInput())
{
return false;
}
}
if($this->comparison_mode)
{
$prev = NULL;
foreach($this->items as $id => $obj)
{
$value = $obj->getPostValueForComparison();
if($value != "")
{
if($prev !== NULL)
{
if($this->comparison_mode == self::COMPARISON_ASCENDING)
{
if($value < $prev)
{
return false;
}
}
else
{
if($value > $prev)
{
return false;
}
}
}
$prev = $value;
}
}
}
}
return $this->checkSubItemsInput();
}

+ Here is the call graph for this function:

ilCombinationInputGUI::getCombinationItem (   $id)

Get property item.

Parameters
string$id
Returns
object

Definition at line 62 of file class.ilCombinationInputGUI.php.

{
if(isset($this->items[$id]))
{
return $this->items[$id];
}
}
ilCombinationInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

Definition at line 332 of file class.ilCombinationInputGUI.php.

References render().

{
$html = $this->render();
return $html;
}

+ Here is the call graph for this function:

ilCombinationInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 211 of file class.ilCombinationInputGUI.php.

References $result.

{
$result = array();
foreach($this->items as $id => $obj)
{
$result[$id] = $obj->getValue();
}
return $result;
}
ilCombinationInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 290 of file class.ilCombinationInputGUI.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:

ilCombinationInputGUI::removeCombinationItem (   $id)

Remove property item.

Parameters
string$id

Definition at line 75 of file class.ilCombinationInputGUI.php.

{
if(isset($this->items[$id]))
{
unset($this->items[$id]);
}
}
ilCombinationInputGUI::render ( )

Render item.

Definition at line 302 of file class.ilCombinationInputGUI.php.

References $lng, and $tpl.

Referenced by getTableFilterHTML(), and insert().

{
global $lng;
$tpl = new ilTemplate("tpl.prop_combination.html", true, true, "Services/Form");
if(sizeof($this->items))
{
foreach($this->items as $id => $obj)
{
// label
if(isset($this->labels[$id]))
{
$tpl->setCurrentBlock("prop_combination_label");
$tpl->setVariable("LABEL", $this->labels[$id]);
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("prop_combination");
$tpl->setVariable("FIELD", $obj->render());
$tpl->parseCurrentBlock();
}
}
return $tpl->get();
}

+ Here is the caller graph for this function:

ilCombinationInputGUI::serializeData ( )

serialize data

Reimplemented from ilFormPropertyGUI.

Definition at line 105 of file class.ilCombinationInputGUI.php.

References $result.

{
$result = array();
foreach($this->items as $id => $obj)
{
$result[$id] = $obj->serializeData();
}
return serialize($result);
}
ilCombinationInputGUI::setComparisonMode (   $mode)

Set mode for comparison (extended validation)

Parameters
int$mode
Returns
bool

Definition at line 147 of file class.ilCombinationInputGUI.php.

{
if(in_array($mode, array(self::COMPARISON_ASCENDING, self::COMPARISON_DESCENDING)))
{
foreach($this->items as $obj)
{
if(!method_exists($obj, "getPostValueForComparison"))
{
return false;
}
}
$this->comparison_mode = $mode;
return true;
}
}
ilCombinationInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 168 of file class.ilCombinationInputGUI.php.

Referenced by unserializeData().

{
if(is_array($a_value))
{
foreach($a_value as $id => $value)
{
if(isset($this->items[$id]))
{
$this->items[$id]->setValue($value);
}
}
}
else if($a_value === NULL)
{
foreach($this->items as $item)
{
if(method_exists($item, "setValue"))
{
$item->setValue(NULL);
}
// datetime
else if(method_exists($item, "setDate"))
{
$item->setDate();
}
// duration
else if(method_exists($item, "setMonths"))
{
$item->setMonths(0);
$item->setDays(0);
$item->setHours(0);
$item->setMinutes(0);
$item->setSeconds(0);
}
}
}
}

+ Here is the caller graph for this function:

ilCombinationInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 226 of file class.ilCombinationInputGUI.php.

{
foreach($this->items as $id => $obj)
{
$obj->setValueByArray($a_values);
}
}
ilCombinationInputGUI::unserializeData (   $a_data)

unserialize data

Reimplemented from ilFormPropertyGUI.

Definition at line 118 of file class.ilCombinationInputGUI.php.

References $data, and setValue().

{
$data = unserialize($a_data);
if ($data)
{
foreach($this->items as $id => $obj)
{
$obj->unserializeData($data[$id]);
}
}
else
{
foreach($this->items as $id => $obj)
{
if(method_exists($obj, "setValue"))
{
$this->setValue(false);
}
}
}
}

+ Here is the call graph for this function:

Field Documentation

ilCombinationInputGUI::$comparison
protected

Definition at line 35 of file class.ilCombinationInputGUI.php.

ilCombinationInputGUI::$items = array()
protected

Definition at line 33 of file class.ilCombinationInputGUI.php.

ilCombinationInputGUI::$labels
protected

Definition at line 34 of file class.ilCombinationInputGUI.php.

const ilCombinationInputGUI::COMPARISON_ASCENDING = 1

Definition at line 37 of file class.ilCombinationInputGUI.php.

Referenced by ilTable2GUI\addFilterItemByMetaType().

const ilCombinationInputGUI::COMPARISON_DESCENDING = 2

Definition at line 38 of file class.ilCombinationInputGUI.php.


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