ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAnswerWizardInputGUI Class Reference

This class represents a single choice wizard property in a property form. More...

+ Inheritance diagram for ilAnswerWizardInputGUI:
+ Collaboration diagram for ilAnswerWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setValue ($a_value)
 Set Value.
 setValues ($a_values)
 Set Values.
 getValues ()
 Get Values.
 setSingleline ($a_value)
 Set singleline.
 getSingleline ()
 Get singleline.
 setQuestionObject ($a_value)
 Set question object.
 getQuestionObject ()
 Get question object.
 setAllowMove ($a_allow_move)
 Set allow move.
 getAllowMove ()
 Get allow move.
 setMinvalueShouldBeGreater ($a_bool)
 Set minvalueShouldBeGreater.
 minvalueShouldBeGreater ()
 Get minvalueShouldBeGreater.
 setMinValue ($a_minvalue)
 Set Minimum Value.
 getMinValue ()
 Get Minimum Value.
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.
- Public Member Functions inherited from ilTextInputGUI
 getValue ()
 Get Value.
 setMulti ($a_multi, $a_sortable=false)
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure.
 getValidationFailureMessage ()
 setValidationRegexp ($a_value)
 Set validation regexp.
 getValidationRegexp ()
 Get validation regexp.
 setMaxLength ($a_maxlength)
 Set Max Length.
 getMaxLength ()
 Get Max Length.
 setSize ($a_size)
 Set Size.
 setInlineStyle ($a_style)
 Set inline style.
 getInlineStyle ()
 Get inline style.
 setCssClass ($a_class)
 getCssClass ()
 setValueByArray ($a_values)
 Set value by array.
 getSize ()
 Get Size.
 setSuffix ($a_value)
 Set suffix.
 getSuffix ()
 Get suffix.
 setInputType ($a_type)
 set input type
 getInputType ()
 get input type
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter.
 getSubmitFormOnEnter ()
 Get submit form on enter.
 getDataSource ()
 get datasource link for js autocomplete
 setDataSource ($href)
 set datasource link for js autocomplete
 setMultiValues (array $a_values)
 Set multi values.
 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.
 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)
 Set Multi.
 getMulti ()
 Get Multi.
 getMultiValues ()
 Get multi values.

Protected Attributes

 $values = array()
 $allowMove = false
 $singleline = true
 $qstObject = null
 $minvalue = false
 $minvalueShouldBeGreater = false
- Protected Attributes inherited from ilTextInputGUI
 $value
 $maxlength = 200
 $size = 40
 $validationRegexp
 $validationFailureMessage = ''
 $suffix
 $style_css
 $css_class
 $ajax_datasource
 $submit_form_on_enter = 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
 $multi_values

Additional Inherited Members

- Protected Member Functions inherited from ilTextInputGUI
 render ($a_mode="")
 Render item.

Detailed Description

This class represents a single choice wizard property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$

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

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

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

References ilTextInputGUI\setSize().

{
parent::__construct($a_title, $a_postvar);
$this->setSize('25');
$this->validationRegexp = "";
}

+ Here is the call graph for this function:

Member Function Documentation

ilAnswerWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilTextInputGUI.

Definition at line 198 of file class.ilAnswerWizardInputGUI.php.

References $_POST, $lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), getMinValue(), ilFormPropertyGUI\getPostVar(), minvalueShouldBeGreater(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashesRecursive().

{
global $lng;
if (is_array($_POST[$this->getPostVar()])) $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
$foundvalues = $_POST[$this->getPostVar()];
if (is_array($foundvalues))
{
// check answers
if (is_array($foundvalues['answer']))
{
foreach ($foundvalues['answer'] as $aidx => $answervalue)
{
if ((strlen($answervalue)) == 0)
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
}
}
// check points
$max = 0;
if (is_array($foundvalues['points']))
{
foreach ($foundvalues['points'] as $points)
{
if ($points > $max) $max = $points;
if (((strlen($points)) == 0) || (!is_numeric($points)))
{
$this->setAlert($lng->txt("form_msg_numeric_value_required"));
return FALSE;
}
{
if (trim($points) != "" &&
$this->getMinValue() !== false &&
$points <= $this->getMinValue())
{
$this->setAlert($lng->txt("form_msg_value_too_low"));
return false;
}
}
else
{
if (trim($points) != "" &&
$this->getMinValue() !== false &&
$points < $this->getMinValue())
{
$this->setAlert($lng->txt("form_msg_value_too_low"));
return false;
}
}
}
}
if ($max == 0)
{
$this->setAlert($lng->txt("enter_enough_positive_points"));
return false;
}
}
else
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
return $this->checkSubItemsInput();
}

+ Here is the call graph for this function:

ilAnswerWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

Definition at line 150 of file class.ilAnswerWizardInputGUI.php.

References $allowMove.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilAnswerWizardInputGUI::getMinValue ( )

Get Minimum Value.

Returns
float Minimum Value

Definition at line 189 of file class.ilAnswerWizardInputGUI.php.

References $minvalue.

Referenced by checkInput().

{
}

+ Here is the caller graph for this function:

ilAnswerWizardInputGUI::getQuestionObject ( )

Get question object.

Returns
object Value

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

References $qstObject.

{
}
ilAnswerWizardInputGUI::getSingleline ( )

Get singleline.

Returns
boolean Value

Definition at line 110 of file class.ilAnswerWizardInputGUI.php.

References $singleline.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilAnswerWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

Definition at line 90 of file class.ilAnswerWizardInputGUI.php.

References $values.

{
return $this->values;
}
ilAnswerWizardInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilTextInputGUI.

Definition at line 274 of file class.ilAnswerWizardInputGUI.php.

References $lng, $tpl, ilTextInputGUI\$value, getAllowMove(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilUtil\getImagePath(), ilTextInputGUI\getMaxLength(), ilFormPropertyGUI\getPostVar(), getSingleline(), ilTextInputGUI\getSize(), ilYuiUtil\initDomEvent(), and ilUtil\prepareFormOutput().

{
global $lng;
$tpl = new ilTemplate("tpl.prop_answerwizardinput.html", true, true, "Modules/TestQuestionPool");
$i = 0;
foreach ($this->values as $value)
{
if ($this->getSingleline())
{
if (is_object($value))
{
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("prop_points_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('singleline');
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][$i]");
$tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
$tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled())
{
$tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
}
else if (!$this->getSingleline())
{
if (is_object($value))
{
$tpl->setCurrentBlock("prop_points_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('multiline');
$tpl->setVariable("PROPERTY_VALUE", $this->qstObject->prepareTextareaOutput($value->getAnswertext()));
$tpl->setVariable("MULTILINE_ID", $this->getPostVar() . "[answer][$i]");
$tpl->setVariable("MULTILINE_ROW_NUMBER", $i);
$tpl->setVariable("MULTILINE_POST_VAR", $this->getPostVar());
if ($this->getDisabled())
{
$tpl->setVariable("DISABLED_MULTILINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
}
if ($this->getAllowMove())
{
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
$tpl->setVariable("ID", $this->getPostVar() . "[$i]");
$tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
$tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$class = ($i % 2 == 0) ? "even" : "odd";
if ($i == 0) $class .= " first";
if ($i == count($this->values)-1) $class .= " last";
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[answer][$i]");
$tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][$i]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
if ($this->getDisabled())
{
$tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
}
$tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
$tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
$tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
$tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/answerwizard.js");
}

+ Here is the call graph for this function:

ilAnswerWizardInputGUI::minvalueShouldBeGreater ( )

Get minvalueShouldBeGreater.

Returns
boolean true if the minimum value should be greater than minvalue

Definition at line 170 of file class.ilAnswerWizardInputGUI.php.

References $minvalueShouldBeGreater.

Referenced by checkInput(), and setMinvalueShouldBeGreater().

+ Here is the caller graph for this function:

ilAnswerWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 140 of file class.ilAnswerWizardInputGUI.php.

{
$this->allowMove = $a_allow_move;
}
ilAnswerWizardInputGUI::setMinValue (   $a_minvalue)

Set Minimum Value.

Parameters
float$a_minvalueMinimum Value

Definition at line 179 of file class.ilAnswerWizardInputGUI.php.

{
$this->minvalue = $a_minvalue;
}
ilAnswerWizardInputGUI::setMinvalueShouldBeGreater (   $a_bool)

Set minvalueShouldBeGreater.

Parameters
boolean$a_booltrue if the minimum value should be greater than minvalue

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

References minvalueShouldBeGreater().

{
$this->minvalueShouldBeGreater = $a_bool;
}

+ Here is the call graph for this function:

ilAnswerWizardInputGUI::setQuestionObject (   $a_value)

Set question object.

Parameters
object$a_valuetest object

Definition at line 120 of file class.ilAnswerWizardInputGUI.php.

{
$this->qstObject =& $a_value;
}
ilAnswerWizardInputGUI::setSingleline (   $a_value)

Set singleline.

Parameters
boolean$a_valueValue

Definition at line 100 of file class.ilAnswerWizardInputGUI.php.

{
$this->singleline = $a_value;
}
ilAnswerWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilTextInputGUI.

Definition at line 58 of file class.ilAnswerWizardInputGUI.php.

References ilTextInputGUI\$value.

{
$this->values = array();
if (is_array($a_value))
{
if (is_array($a_value['answer']))
{
foreach ($a_value['answer'] as $index => $value)
{
include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
$answer = new ASS_AnswerBinaryStateImage($value, $a_value['points'][$index], $index, 1, $a_value['imagename'][$index]);
array_push($this->values, $answer);
}
}
}
}
ilAnswerWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

Definition at line 80 of file class.ilAnswerWizardInputGUI.php.

{
$this->values = $a_values;
}

Field Documentation

ilAnswerWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

ilAnswerWizardInputGUI::$minvalue = false
protected

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

Referenced by getMinValue().

ilAnswerWizardInputGUI::$minvalueShouldBeGreater = false
protected

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

Referenced by minvalueShouldBeGreater().

ilAnswerWizardInputGUI::$qstObject = null
protected

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

Referenced by getQuestionObject().

ilAnswerWizardInputGUI::$singleline = true
protected

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

Referenced by getSingleline().

ilAnswerWizardInputGUI::$values = array()
protected

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

Referenced by getValues().


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