ILIAS  Release_4_2_x_branch Revision 61807
 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.
 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.
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 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)

Protected Attributes

 $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 = ""

Additional Inherited Members

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

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 28338 2011-04-04 08:24:22Z akill

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

References ilFormPropertyGUI\setType().

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

+ 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 55 of file class.ilCheckboxGroupInputGUI.php.

Referenced by ilSettingsTemplateGUI\initSettingsTemplateForm(), ilObjTestGUI\propertiesObject(), 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 130 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 231 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 83 of file class.ilCheckboxGroupInputGUI.php.

References $options.

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

{
}

+ Here is the caller graph for this function:

ilCheckboxGroupInputGUI::getValue ( )

Get Value.

Returns
array Value

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

References $value.

Referenced by insert().

{
return $this->value;
}

+ Here is the caller graph for this function:

ilCheckboxGroupInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

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

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

{
$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");
$tpl->setVariable("POST_VAR", $this->getPostVar() . '[]');
$tpl->setVariable("VAL_CHECKBOX_OPTION", $option->getValue());
$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 (in_array($option->getValue(), $this->getValue()))
{
$tpl->setVariable("CHK_CHECKBOX_OPTION",
'checked="checked"');
}
}
$tpl->setVariable("TXT_CHECKBOX_OPTION", $option->getTitle());
$tpl->parseCurrentBlock();
}
$tpl->setVariable("ID", $this->getFieldId());
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilCheckboxGroupInputGUI::setOptions (   $a_options)

Set Options.

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

Definition at line 65 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::setValue (   $a_value)

Set Value.

Parameters
array$a_valueValue

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

Referenced by ilObjCourseGUI\fillECSExportSettings(), ilPageLayoutGUI\initForm(), ilCustomUserFieldsGUI\initForm(), ilObjAssessmentFolderGUI\settingsObject(), 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 113 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::$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: