ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules 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

 setDisableActions ($disable_actions)
 
 setDisableText ($disable_text)
 
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 setValues ($a_values)
 Set Values. More...
 
 getValues ()
 Get Values. More...
 
 setSingleline ($a_value)
 Set singleline. More...
 
 getSingleline ()
 Get singleline. More...
 
 setQuestionObject ($a_value)
 Set question object. More...
 
 getQuestionObject ()
 Get question object. More...
 
 setAllowMove ($a_allow_move)
 Set allow move. More...
 
 getAllowMove ()
 Get allow move. More...
 
 setMinvalueShouldBeGreater ($a_bool)
 Set minvalueShouldBeGreater. More...
 
 minvalueShouldBeGreater ()
 Get minvalueShouldBeGreater. More...
 
 setMinValue ($a_minvalue)
 Set Minimum Value. More...
 
 getMinValue ()
 Get Minimum Value. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (&$a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilTextInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure. More...
 
 getValidationFailureMessage ()
 
 setValidationRegexp ($a_value)
 Set validation regexp. More...
 
 getValidationRegexp ()
 Get validation regexp. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setInlineStyle ($a_style)
 Set inline style. More...
 
 getInlineStyle ()
 Get inline style. More...
 
 setCssClass ($a_class)
 
 getCssClass ()
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setSuffix ($a_value)
 Set suffix. More...
 
 getSuffix ()
 Get suffix. More...
 
 setInputType ($a_type)
 set input type More...
 
 getInputType ()
 get input type More...
 
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter. More...
 
 getSubmitFormOnEnter ()
 Get submit form on enter. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getDataSource ()
 get datasource link for js autocomplete More...
 
 setDataSource ($href, $a_delimiter=null)
 set datasource link for js autocomplete More...
 
 setMultiValues (array $a_values)
 
 render ($a_mode="")
 Render item. More...
 
 insert (&$a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
 setDisableHtmlAutoComplete ($autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 

Protected Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

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 11 of file class.ilAnswerWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References ilTextInputGUI\setSize().

52  {
53  parent::__construct($a_title, $a_postvar);
54  $this->setSize('25');
55  $this->validationRegexp = "";
56  }
setSize($a_size)
Set Size.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilAnswerWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

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

204  {
205  global $lng;
206  if (is_array($_POST[$this->getPostVar()])) $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
207  $foundvalues = $_POST[$this->getPostVar()];
208  if (is_array($foundvalues))
209  {
210  // check answers
211  if (is_array($foundvalues['answer']))
212  {
213  foreach ($foundvalues['answer'] as $aidx => $answervalue)
214  {
215  if ((strlen($answervalue)) == 0)
216  {
217  $this->setAlert($lng->txt("msg_input_is_required"));
218  return FALSE;
219  }
220  }
221  }
222  // check points
223  $max = 0;
224  if (is_array($foundvalues['points']))
225  {
226  foreach ($foundvalues['points'] as $points)
227  {
228  if ($points > $max) $max = $points;
229  if (((strlen($points)) == 0) || (!is_numeric($points)))
230  {
231  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
232  return FALSE;
233  }
234  if ($this->minvalueShouldBeGreater())
235  {
236  if (trim($points) != "" &&
237  $this->getMinValue() !== false &&
238  $points <= $this->getMinValue())
239  {
240  $this->setAlert($lng->txt("form_msg_value_too_low"));
241 
242  return false;
243  }
244  }
245  else
246  {
247  if (trim($points) != "" &&
248  $this->getMinValue() !== false &&
249  $points < $this->getMinValue())
250  {
251  $this->setAlert($lng->txt("form_msg_value_too_low"));
252 
253  return false;
254 
255  }
256  }
257  }
258  }
259  if ($max == 0)
260  {
261  $this->setAlert($lng->txt("enter_enough_positive_points"));
262  return false;
263  }
264  }
265  else
266  {
267  $this->setAlert($lng->txt("msg_input_is_required"));
268  return FALSE;
269  }
270 
271  return $this->checkSubItemsInput();
272  }
$_POST['username']
Definition: cron.php:12
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ getAllowMove()

ilAnswerWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

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

References $allowMove.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getMinValue()

ilAnswerWizardInputGUI::getMinValue ( )

Get Minimum Value.

Returns
float Minimum Value

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

References $minvalue.

Referenced by checkInput().

+ Here is the caller graph for this function:

◆ getQuestionObject()

ilAnswerWizardInputGUI::getQuestionObject ( )

Get question object.

Returns
object Value

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

References $qstObject.

◆ getSingleline()

ilAnswerWizardInputGUI::getSingleline ( )

Get singleline.

Returns
boolean Value

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

References $singleline.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getValues()

ilAnswerWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

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

References $values.

◆ insert()

ilAnswerWizardInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 279 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().

280  {
281  global $lng;
282 
283  $tpl = new ilTemplate("tpl.prop_answerwizardinput.html", true, true, "Modules/TestQuestionPool");
284  $i = 0;
285  foreach ($this->values as $value)
286  {
287  if ($this->getSingleline())
288  {
289  if (is_object($value))
290  {
291  $tpl->setCurrentBlock("prop_text_propval");
292  $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
293  $tpl->parseCurrentBlock();
294  $tpl->setCurrentBlock("prop_points_propval");
295  $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
296  $tpl->parseCurrentBlock();
297  }
298  $tpl->setCurrentBlock('singleline');
299  $tpl->setVariable("SIZE", $this->getSize());
300  $tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][$i]");
301  $tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
302  $tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
303  $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
304  if ($this->getDisabled() || $this->disable_text)
305  {
306  $tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
307  }
308  $tpl->parseCurrentBlock();
309  }
310  else if (!$this->getSingleline())
311  {
312  if (is_object($value))
313  {
314  $tpl->setCurrentBlock("prop_points_propval");
315  $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
316  $tpl->parseCurrentBlock();
317  }
318  $tpl->setCurrentBlock('multiline');
319  $tpl->setVariable("PROPERTY_VALUE", $this->qstObject->prepareTextareaOutput($value->getAnswertext()));
320  $tpl->setVariable("MULTILINE_ID", $this->getPostVar() . "[answer][$i]");
321  $tpl->setVariable("MULTILINE_ROW_NUMBER", $i);
322  $tpl->setVariable("MULTILINE_POST_VAR", $this->getPostVar());
323  if ($this->getDisabled())
324  {
325  $tpl->setVariable("DISABLED_MULTILINE", " disabled=\"disabled\"");
326  }
327  $tpl->parseCurrentBlock();
328  }
329  if ($this->getAllowMove())
330  {
331  $tpl->setCurrentBlock("move");
332  $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
333  $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
334  $tpl->setVariable("MOVE_ID", $this->getPostVar() . "[$i]");
335  $tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
336  $tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
337  $tpl->parseCurrentBlock();
338  }
339  $tpl->setCurrentBlock("row");
340  $class = ($i % 2 == 0) ? "even" : "odd";
341  if ($i == 0) $class .= " first";
342  if ($i == count($this->values)-1) $class .= " last";
343  $tpl->setVariable("ROW_CLASS", $class);
344  $tpl->setVariable("POST_VAR", $this->getPostVar());
345  $tpl->setVariable("ROW_NUMBER", $i);
346  if(!$this->disable_actions)
347  {
348  $tpl->setVariable( "ID", $this->getPostVar() . "[answer][$i]" );
349  $tpl->setVariable( "POINTS_ID", $this->getPostVar() . "[points][$i]" );
350  $tpl->setVariable( "CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]" );
351  $tpl->setVariable( "CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]" );
352  }
353  if ($this->getDisabled())
354  {
355  $tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
356  }
357  if(!$this->disable_actions)
358  {
359  $tpl->setVariable( "ADD_BUTTON", ilUtil::getImagePath( 'edit_add.png' ) );
360  $tpl->setVariable( "REMOVE_BUTTON", ilUtil::getImagePath( 'edit_remove.png' ) );
361  }
362  $tpl->parseCurrentBlock();
363  $i++;
364  }
365 
366  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
367  $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
368  $tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
369  if(!$this->disable_actions)
370  {
371  $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
372  }
373 
374  $a_tpl->setCurrentBlock("prop_generic");
375  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
376  $a_tpl->parseCurrentBlock();
377 
378  global $tpl;
379  include_once "./Services/YUI/classes/class.ilYuiUtil.php";
381  $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/answerwizard.js");
382  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getMaxLength()
Get Max Length.
getPostVar()
Get Post Variable.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
static initDomEvent()
Init YUI DomEvent.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ minvalueShouldBeGreater()

ilAnswerWizardInputGUI::minvalueShouldBeGreater ( )

Get minvalueShouldBeGreater.

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

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

References $minvalueShouldBeGreater.

Referenced by checkInput(), and setMinvalueShouldBeGreater().

+ Here is the caller graph for this function:

◆ setAllowMove()

ilAnswerWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

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

146  {
147  $this->allowMove = $a_allow_move;
148  }

◆ setDisableActions()

ilAnswerWizardInputGUI::setDisableActions (   $disable_actions)
Parameters
mixed$disable_actions
Returns
$this

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

References $disable_actions.

29  {
30  $this->disable_actions = $disable_actions;
31  return $this;
32  }

◆ setDisableText()

ilAnswerWizardInputGUI::setDisableText (   $disable_text)
Parameters
mixed$disable_text
Returns
$this

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

References $disable_text.

40  {
41  $this->disable_text = $disable_text;
42  return $this;
43  }

◆ setMinValue()

ilAnswerWizardInputGUI::setMinValue (   $a_minvalue)

Set Minimum Value.

Parameters
float$a_minvalueMinimum Value

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

185  {
186  $this->minvalue = $a_minvalue;
187  }

◆ setMinvalueShouldBeGreater()

ilAnswerWizardInputGUI::setMinvalueShouldBeGreater (   $a_bool)

Set minvalueShouldBeGreater.

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

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

References minvalueShouldBeGreater().

166  {
167  $this->minvalueShouldBeGreater = $a_bool;
168  }
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
+ Here is the call graph for this function:

◆ setQuestionObject()

ilAnswerWizardInputGUI::setQuestionObject (   $a_value)

Set question object.

Parameters
object$a_valuetest object

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

126  {
127  $this->qstObject =& $a_value;
128  }

◆ setSingleline()

ilAnswerWizardInputGUI::setSingleline (   $a_value)

Set singleline.

Parameters
boolean$a_valueValue

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

106  {
107  $this->singleline = $a_value;
108  }

◆ setValue()

ilAnswerWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

References ilTextInputGUI\$value.

64  {
65  $this->values = array();
66  if (is_array($a_value))
67  {
68  if (is_array($a_value['answer']))
69  {
70  foreach ($a_value['answer'] as $index => $value)
71  {
72  include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
73  $answer = new ASS_AnswerBinaryStateImage($value, $a_value['points'][$index], $index, 1, $a_value['imagename'][$index]);
74  array_push($this->values, $answer);
75  }
76  }
77  }
78  }
Class for answers with a binary state indicator.

◆ setValues()

ilAnswerWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

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

86  {
87  $this->values = $a_values;
88  }

Field Documentation

◆ $allowMove

ilAnswerWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

◆ $disable_actions

ilAnswerWizardInputGUI::$disable_actions
protected

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

Referenced by setDisableActions().

◆ $disable_text

ilAnswerWizardInputGUI::$disable_text
protected

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

Referenced by setDisableText().

◆ $minvalue

ilAnswerWizardInputGUI::$minvalue = false
protected

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

Referenced by getMinValue().

◆ $minvalueShouldBeGreater

ilAnswerWizardInputGUI::$minvalueShouldBeGreater = false
protected

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

Referenced by minvalueShouldBeGreater().

◆ $qstObject

ilAnswerWizardInputGUI::$qstObject = null
protected

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

Referenced by getQuestionObject().

◆ $singleline

ilAnswerWizardInputGUI::$singleline = true
protected

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

Referenced by getSingleline().

◆ $values

ilAnswerWizardInputGUI::$values = array()
protected

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

Referenced by getValues().


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