ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCheckboxGroupInputGUI Class Reference

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

+ Inheritance diagram for ilCheckboxGroupInputGUI:
+ Collaboration diagram for ilCheckboxGroupInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setUseValuesAsKeys ($a_val)
 Set use values as keys.
 getUseValuesAsKeys ()
 Get use values as keys.
 addOption ($a_option)
 Add Option.
 setOptions ($a_options)
 Set Options.
 getOptions ()
 Get Options.
 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.
 getItemByPostVar ($a_post_var)
 Get item by post var.
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters.
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI.
- 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.
- 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.

Protected Member Functions

 render ($a_mode= '')

Protected Attributes

 $options = array()
 $value
 $use_values_as_keys = false
- 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

This class represents a property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
Id:
class.ilCheckboxGroupInputGUI.php 42180 2013-05-14 11:00:52Z bheyser

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

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

Definition at line 46 of file class.ilCheckboxGroupInputGUI.php.

References ilFormPropertyGUI\setType().

{
parent::__construct($a_title, $a_postvar);
$this->setType("checkboxgroup");
}

+ Here is the call graph for this function:

Member Function Documentation

ilCheckboxGroupInputGUI::addOption (   $a_option)

Add Option.

Parameters
object$a_optionCheckboxOption object

Definition at line 77 of file class.ilCheckboxGroupInputGUI.php.

Referenced by ilObjTestSettingsGeneralGUI\buildForm(), ilObjUserTrackingGUI\initSettingsForm(), ilSettingsTemplateGUI\initSettingsTemplateForm(), and ilObjTestGUI\scoringObject().

{
$this->options[] = $a_option;
}

+ Here is the caller graph for this function:

ilCheckboxGroupInputGUI::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 152 of file class.ilCheckboxGroupInputGUI.php.

References $_POST, $lng, $ok, getOptions(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), and ilFormPropertyGUI\setAlert().

{
global $lng;
if ($this->getRequired() && count($_POST[$this->getPostVar()]) == 0)
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
$ok = true;
foreach($this->getOptions() as $option)
{
foreach($option->getSubItems() as $item)
{
$item_ok = $item->checkInput();
if (!$item_ok && in_array($option->getValue(), $_POST[$this->getPostVar()]))
{
$ok = false;
}
}
}
return $ok;
}

+ Here is the call graph for this function:

ilCheckboxGroupInputGUI::getItemByPostVar (   $a_post_var)

Get item by post var.

Returns
mixed false or item object

Reimplemented from ilSubEnabledFormPropertyGUI.

Definition at line 196 of file class.ilCheckboxGroupInputGUI.php.

References $ret, getOptions(), and ilFormPropertyGUI\getPostVar().

{
if ($this->getPostVar() == $a_post_var)
{
return $this;
}
foreach($this->getOptions() as $option)
{
foreach($option->getSubItems() as $item)
{
if ($item->getType() != "section_header")
{
$ret = $item->getItemByPostVar($a_post_var);
if (is_object($ret))
{
return $ret;
}
}
}
}
return false;
}

+ Here is the call graph for this function:

ilCheckboxGroupInputGUI::getOptions ( )

Get Options.

Returns
array Array of CheckboxOption objects

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

References $options.

Referenced by checkInput(), getItemByPostVar(), render(), and setValueByArray().

{
}

+ Here is the caller graph for this function:

ilCheckboxGroupInputGUI::getTableFilterHTML ( )

Get input item HTML to be inserted into table filters.

Returns
string

Implements ilTableFilterItem.

Definition at line 221 of file class.ilCheckboxGroupInputGUI.php.

References render().

{
return $this->render();
}

+ Here is the call graph for this function:

ilCheckboxGroupInputGUI::getToolbarHTML ( )

Get input item HTML to be inserted into ilToolbarGUI.

public

Returns
string

Implements ilToolbarItem.

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

References render().

{
return $this->render('toolbar');
}

+ Here is the call graph for this function:

ilCheckboxGroupInputGUI::getUseValuesAsKeys ( )

Get use values as keys.

Returns
bool use values as keys

Definition at line 67 of file class.ilCheckboxGroupInputGUI.php.

References $use_values_as_keys.

Referenced by render().

+ Here is the caller graph for this function:

ilCheckboxGroupInputGUI::getValue ( )

Get Value.

Returns
array Value

Definition at line 125 of file class.ilCheckboxGroupInputGUI.php.

References $value.

Referenced by render().

{
return $this->value;
}

+ Here is the caller graph for this function:

ilCheckboxGroupInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 184 of file class.ilCheckboxGroupInputGUI.php.

References render().

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

+ Here is the call graph for this function:

ilCheckboxGroupInputGUI::render (   $a_mode = '')
protected

Definition at line 231 of file class.ilCheckboxGroupInputGUI.php.

References $tpl, ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getOptions(), ilFormPropertyGUI\getParentForm(), ilFormPropertyGUI\getPostVar(), getUseValuesAsKeys(), and getValue().

Referenced by getTableFilterHTML(), getToolbarHTML(), and insert().

{
$tpl = new ilTemplate("tpl.prop_checkbox_group.html", true, true, "Services/Form");
foreach($this->getOptions() as $option)
{
// information text for option
if ($option->getInfo() != "")
{
$tpl->setCurrentBlock("checkbox_option_desc");
$tpl->setVariable("CHECKBOX_OPTION_DESC", $option->getInfo());
$tpl->parseCurrentBlock();
}
if (count($option->getSubItems()) > 0)
{
$tpl->setCurrentBlock("checkbox_option_subform");
$pf = new ilPropertyFormGUI();
$pf->setMode("subform");
$pf->setItems($option->getSubItems());
$tpl->setVariable("SUB_FORM", $pf->getContent());
$tpl->setVariable("SOP_ID", $this->getFieldId()."_".$option->getValue());
if ($pf->getMultipart())
{
$this->getParentForm()->setMultipart(true);
}
$tpl->parseCurrentBlock();
if ($pf->getMultipart())
{
$this->getParentForm()->setMultipart(true);
}
}
$tpl->setCurrentBlock("prop_checkbox_option");
if (!$this->getUseValuesAsKeys())
{
$tpl->setVariable("POST_VAR", $this->getPostVar() . '[]');
$tpl->setVariable("VAL_CHECKBOX_OPTION", $option->getValue());
}
else
{
$tpl->setVariable("POST_VAR", $this->getPostVar().'['.$option->getValue().']');
$tpl->setVariable("VAL_CHECKBOX_OPTION", "1");
}
$tpl->setVariable("OP_ID", $this->getFieldId()."_".$option->getValue());
$tpl->setVariable("FID", $this->getFieldId());
if($this->getDisabled() or $option->getDisabled())
{
$tpl->setVariable('DISABLED','disabled="disabled" ');
}
if (is_array($this->getValue()))
{
if (!$this->getUseValuesAsKeys())
{
if (in_array($option->getValue(), $this->getValue()))
{
$tpl->setVariable("CHK_CHECKBOX_OPTION",
'checked="checked"');
}
}
else
{
$cval = $this->getValue();
if ($cval[$option->getValue()] == 1)
{
$tpl->setVariable("CHK_CHECKBOX_OPTION",
'checked="checked"');
}
}
}
$tpl->setVariable("TXT_CHECKBOX_OPTION", $option->getTitle());
$tpl->parseCurrentBlock();
}
$tpl->setVariable("ID", $this->getFieldId());
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCheckboxGroupInputGUI::setOptions (   $a_options)

Set Options.

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

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

{
foreach($a_options as $key => $label) {
if (is_string($label)) {
$chb = new ilCheckboxInputGUI($label, $key);
$this->options[] = $chb;
}
else if ($label instanceof ilCheckboxInputGUI) {
$this->options[] = $label;
}
}
}
ilCheckboxGroupInputGUI::setUseValuesAsKeys (   $a_val)

Set use values as keys.

Parameters
bool$a_valuse values as keys

Definition at line 57 of file class.ilCheckboxGroupInputGUI.php.

{
$this->use_values_as_keys = $a_val;
}
ilCheckboxGroupInputGUI::setValue (   $a_value)

Set Value.

Parameters
array$a_valueValue

Definition at line 115 of file class.ilCheckboxGroupInputGUI.php.

Referenced by ilECSObjectSettings\addSettingsToForm(), ilObjAssessmentFolderGUI\buildSettingsForm(), ilPageLayoutGUI\initForm(), ilCustomUserFieldsGUI\initForm(), setValueByArray(), and ilObjPrivacySecurityGUI\showPrivacy().

{
$this->value = $a_value;
}

+ Here is the caller graph for this function:

ilCheckboxGroupInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 135 of file class.ilCheckboxGroupInputGUI.php.

References getOptions(), ilFormPropertyGUI\getPostVar(), and setValue().

{
$this->setValue($a_values[$this->getPostVar()]);
foreach($this->getOptions() as $option)
{
foreach($option->getSubItems() as $item)
{
$item->setValueByArray($a_values);
}
}
}

+ Here is the call graph for this function:

Field Documentation

ilCheckboxGroupInputGUI::$options = array()
protected

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

Referenced by getOptions().

ilCheckboxGroupInputGUI::$use_values_as_keys = false
protected

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

Referenced by getUseValuesAsKeys().

ilCheckboxGroupInputGUI::$value
protected

Definition at line 36 of file class.ilCheckboxGroupInputGUI.php.

Referenced by getValue().


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