ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSelectBuilderInputGUI Class Reference

Input GUI for the configuration of select input elements. More...

+ Inheritance diagram for ilSelectBuilderInputGUI:
+ Collaboration diagram for ilSelectBuilderInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 
 getOpenAnswerIndexes ()
 Get open answer indexes. More...
 
 setOpenAnswerIndexes ($a_indexes)
 Set open answer indexes. More...
 
 addOpenAnswerIndex ($a_idx)
 Mark an index as open answer. More...
 
 isOpenAnswerIndex ($a_idx)
 Check if an index is an open answer index. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilTextWizardInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValues ($a_values)
 Set Values. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValues ()
 Get Values. More...
 
 setAllowMove ($a_allow_move)
 Set allow move. More...
 
 getAllowMove ()
 Get allow move. 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

 $open_answer_indexes = array()
 
- Protected Attributes inherited from ilTextWizardInputGUI
 $values = array()
 
 $allowMove = false
 
- 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

Input GUI for the configuration of select input elements.

E.g course custum field, udf field, ...

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilSelectBuilderInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 19 of file class.ilSelectBuilderInputGUI.php.

20  {
21  parent::__construct($a_title, $a_postvar);
22  }

Member Function Documentation

◆ addOpenAnswerIndex()

ilSelectBuilderInputGUI::addOpenAnswerIndex (   $a_idx)

Mark an index as open answer.

Definition at line 44 of file class.ilSelectBuilderInputGUI.php.

Referenced by checkInput().

45  {
46  $this->open_answer_indexes[] = $a_idx;
47  }
+ Here is the caller graph for this function:

◆ checkInput()

ilSelectBuilderInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 64 of file class.ilSelectBuilderInputGUI.php.

References $_POST, $lng, ilTextInputGUI\$value, addOpenAnswerIndex(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilTextInputGUI\getValidationRegexp(), ilFormPropertyGUI\setAlert(), setOpenAnswerIndexes(), and ilUtil\stripSlashes().

65  {
66  global $lng;
67 
68  $foundvalues = $_POST[$this->getPostVar()];
69 
70 
71 
72  $this->setOpenAnswerIndexes(array());
73  if (is_array($foundvalues))
74  {
75  foreach ($foundvalues as $idx => $value)
76  {
77  $_POST[$this->getPostVar()][$idx] = ilUtil::stripSlashes($value);
78  if ($this->getRequired() && trim($value) == "")
79  {
80  $this->setAlert($lng->txt("msg_input_is_required"));
81 
82  return false;
83  }
84  else if (strlen($this->getValidationRegexp()))
85  {
86  if (!preg_match($this->getValidationRegexp(), $value))
87  {
88  $this->setAlert($lng->txt("msg_wrong_format"));
89  return FALSE;
90  }
91  }
92  }
93  }
94  else
95  {
96  $this->setAlert($lng->txt("msg_input_is_required"));
97  return FALSE;
98  }
99 
100  foreach((array) $_POST[$this->getPostVar().'_open'] as $oindex => $ovalue)
101  {
102  $this->addOpenAnswerIndex($oindex);
103  }
104 
105 
106  return $this->checkSubItemsInput();
107  }
$_POST['username']
Definition: cron.php:12
addOpenAnswerIndex($a_idx)
Mark an index as open answer.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
getValidationRegexp()
Get validation regexp.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setOpenAnswerIndexes($a_indexes)
Set open answer indexes.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ getOpenAnswerIndexes()

ilSelectBuilderInputGUI::getOpenAnswerIndexes ( )

Get open answer indexes.

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

References $open_answer_indexes.

◆ insert()

ilSelectBuilderInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Definition at line 114 of file class.ilSelectBuilderInputGUI.php.

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

115  {
116  $tpl = new ilTemplate("tpl.prop_selectbuilder.html", true, true, "Services/Form");
117  $i = 0;
118  foreach ($this->values as $value)
119  {
120  if(!is_string($value))
121  {
122  continue;
123  }
124 
125  if (strlen((string) $value))
126  {
127  $tpl->setCurrentBlock("prop_text_propval");
128  $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput((string) $value));
129  $tpl->parseCurrentBlock();
130  }
131  if ($this->getAllowMove())
132  {
133  $tpl->setCurrentBlock("move");
134  $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
135  $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
136  $tpl->setVariable("ID", $this->getFieldId() . "[$i]");
137  $tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
138  $tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
139  $tpl->parseCurrentBlock();
140  }
141  $tpl->setCurrentBlock("row");
142  $class = ($i % 2 == 0) ? "even" : "odd";
143  if ($i == 0) $class .= " first";
144  if ($i == count($this->values)-1) $class .= " last";
145  $tpl->setVariable("ROW_CLASS", $class);
146  $tpl->setVariable("POST_VAR", $this->getPostVar() . "[$i]");
147  #$tpl->setVariable('POST_VAR_OPEN',$this->getPostVar().'[open]'.'['.$i.']');
148  $tpl->setVariable('POST_VAR_OPEN',$this->getPostVar().'_open'.'['.$i.']');
149  $tpl->setVariable('POST_VAR_OPEN_ID', $this->getPostVar().'_open['.$i.']');
150 
151  if($this->isOpenAnswerIndex($i))
152  {
153  $tpl->setVariable('PROP_OPEN_CHECKED','checked="checked"');
154  }
155  if($this->getDisabled())
156  {
157  $tpl->setVariable('PROP_OPEN_DISABLED','disabled="disabled"');
158  }
159 
160  $tpl->setVariable("ID", $this->getFieldId() . "[$i]");
161  $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
162  $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
163  $tpl->setVariable("SIZE", $this->getSize());
164  $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
165  if ($this->getDisabled())
166  {
167  $tpl->setVariable("DISABLED",
168  " disabled=\"disabled\"");
169  }
170  $tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
171  $tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
172  $tpl->parseCurrentBlock();
173  $i++;
174  }
175  $tpl->setVariable("ELEMENT_ID", $this->getFieldId());
176 
177  $a_tpl->setCurrentBlock("prop_generic");
178  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
179  $a_tpl->parseCurrentBlock();
180 
181  global $tpl;
182  include_once "./Services/YUI/classes/class.ilYuiUtil.php";
184  $tpl->addJavascript("./Services/Form/templates/default/textwizard.js");
185  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getMaxLength()
Get Max Length.
getPostVar()
Get Post Variable.
isOpenAnswerIndex($a_idx)
Check if an index is an open answer index.
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
+ Here is the call graph for this function:

◆ isOpenAnswerIndex()

ilSelectBuilderInputGUI::isOpenAnswerIndex (   $a_idx)

Check if an index is an open answer index.

Parameters
type$a_idx
Returns
type

Definition at line 54 of file class.ilSelectBuilderInputGUI.php.

Referenced by insert().

55  {
56  return in_array($a_idx,(array) $this->open_answer_indexes);
57  }
+ Here is the caller graph for this function:

◆ setOpenAnswerIndexes()

ilSelectBuilderInputGUI::setOpenAnswerIndexes (   $a_indexes)

Set open answer indexes.

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

Referenced by checkInput().

37  {
38  $this->open_answer_indexes = $a_indexes;
39  }
+ Here is the caller graph for this function:

Field Documentation

◆ $open_answer_indexes

ilSelectBuilderInputGUI::$open_answer_indexes = array()
protected

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

Referenced by getOpenAnswerIndexes().


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