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

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

+ Inheritance diagram for ilSelectInputGUI:
+ Collaboration diagram for ilSelectInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setOptions ($a_options)
 Set Options. More...
 
 getOptions ()
 Get Options. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 addCustomAttribute ($a_attr)
 
 getCustomAttributes ()
 
 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...
 
- 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

 $cust_attr = array()
 
 $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 = ""
 
 $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 selection list property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 29 of file class.ilSelectInputGUI.php.

References ilFormPropertyGUI\setType().

30  {
31  parent::__construct($a_title, $a_postvar);
32  $this->setType("select");
33  }
setType($a_type)
Set Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomAttribute()

ilSelectInputGUI::addCustomAttribute (   $a_attr)

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

131  {
132  $this->cust_attr[] = $a_attr;
133  }

◆ checkInput()

ilSelectInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 96 of file class.ilSelectInputGUI.php.

References $_POST, $lng, $valid, $value, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getMulti(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

97  {
98  global $lng;
99 
100  $valid = true;
101  if(!$this->getMulti())
102  {
103  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
104  if($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
105  {
106  $valid = false;
107  }
108  }
109  else
110  {
111  foreach($_POST[$this->getPostVar()] as $idx => $value)
112  {
113  $_POST[$this->getPostVar()][$idx] = ilUtil::stripSlashes($value);
114  }
115  $_POST[$this->getPostVar()] = array_unique($_POST[$this->getPostVar()]);
116 
117  if($this->getRequired() && !trim(implode("", $_POST[$this->getPostVar()])))
118  {
119  $valid = false;
120  }
121  }
122  if (!$valid)
123  {
124  $this->setAlert($lng->txt("msg_input_is_required"));
125  return false;
126  }
127  return $this->checkSubItemsInput();
128  }
$_POST['username']
Definition: cron.php:12
getPostVar()
Get Post Variable.
$valid
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ getCustomAttributes()

ilSelectInputGUI::getCustomAttributes ( )

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

References $cust_attr.

Referenced by render().

136  {
137  return (array) $this->cust_attr;
138  }
+ Here is the caller graph for this function:

◆ getOptions()

ilSelectInputGUI::getOptions ( )

Get Options.

Returns
array Options. Array ("value" => "option_text")

Definition at line 50 of file class.ilSelectInputGUI.php.

Referenced by render().

51  {
52  return $this->options ? $this->options : array();
53  }
+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilSelectInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

Definition at line 242 of file class.ilSelectInputGUI.php.

References render().

243  {
244  $html = $this->render();
245  return $html;
246  }
render($a_mode="")
Render item.
+ Here is the call graph for this function:

◆ getToolbarHTML()

ilSelectInputGUI::getToolbarHTML ( )

Get HTML for toolbar.

Implements ilToolbarItem.

Definition at line 251 of file class.ilSelectInputGUI.php.

References render().

252  {
253  $html = $this->render("toolbar");
254  return $html;
255  }
render($a_mode="")
Render item.
+ Here is the call graph for this function:

◆ getValue()

ilSelectInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 75 of file class.ilSelectInputGUI.php.

References $value.

Referenced by render().

76  {
77  return $this->value;
78  }
+ Here is the caller graph for this function:

◆ insert()

ilSelectInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 232 of file class.ilSelectInputGUI.php.

References render().

233  {
234  $a_tpl->setCurrentBlock("prop_generic");
235  $a_tpl->setVariable("PROP_GENERIC", $this->render());
236  $a_tpl->parseCurrentBlock();
237  }
render($a_mode="")
Render item.
+ Here is the call graph for this function:

◆ render()

ilSelectInputGUI::render (   $a_mode = "")

Render item.

Definition at line 143 of file class.ilSelectInputGUI.php.

References ilFormPropertyGUI\$postvar, $tpl, $value, getCustomAttributes(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilFormPropertyGUI\getHiddenTag(), ilFormPropertyGUI\getMulti(), ilFormPropertyGUI\getMultiIconsHTML(), ilFormPropertyGUI\getMultiValues(), getOptions(), ilFormPropertyGUI\getPostVar(), getValue(), and ilUtil\prepareFormOutput().

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

144  {
145  $tpl = new ilTemplate("tpl.prop_select.html", true, true, "Services/Form");
146 
147  foreach($this->getCustomAttributes() as $attr)
148  {
149  $tpl->setCurrentBlock('cust_attr');
150  $tpl->setVariable('CUSTOM_ATTR',$attr);
151  $tpl->parseCurrentBlock();
152  }
153 
154  // determin value to select. Due to accessibility reasons we
155  // should always select a value (per default the first one)
156  $first = true;
157  foreach($this->getOptions() as $option_value => $option_text)
158  {
159  if ($first)
160  {
161  $sel_value = $option_value;
162  }
163  $first = false;
164  if ((string) $option_value == (string) $this->getValue())
165  {
166  $sel_value = $option_value;
167  }
168  }
169  foreach($this->getOptions() as $option_value => $option_text)
170  {
171  $tpl->setCurrentBlock("prop_select_option");
172  $tpl->setVariable("VAL_SELECT_OPTION", ilUtil::prepareFormOutput($option_value));
173  if((string) $sel_value == (string) $option_value)
174  {
175  $tpl->setVariable("CHK_SEL_OPTION",
176  'selected="selected"');
177  }
178  $tpl->setVariable("TXT_SELECT_OPTION", $option_text);
179  $tpl->parseCurrentBlock();
180  }
181  $tpl->setVariable("ID", $this->getFieldId());
182 
183  $postvar = $this->getPostVar();
184  if($this->getMulti() && substr($postvar, -2) != "[]")
185  {
186  $postvar .= "[]";
187  }
188 
189  if ($this->getDisabled())
190  {
191  if($this->getMulti())
192  {
193  $value = $this->getMultiValues();
194  $hidden = "";
195  if(is_array($value))
196  {
197  foreach($value as $item)
198  {
199  $hidden .= $this->getHiddenTag($postvar, $item);
200  }
201  }
202  }
203  else
204  {
205  $hidden = $this->getHiddenTag($postvar, $this->getValue());
206  }
207  if($hidden)
208  {
209  $tpl->setVariable("DISABLED", " disabled=\"disabled\"");
210  $tpl->setVariable("HIDDEN_INPUT", $hidden);
211  }
212  }
213  else
214  {
215  $tpl->setVariable("POST_VAR", $postvar);
216  }
217 
218  // multi icons
219  if($this->getMulti() && !$a_mode && !$this->getDisabled())
220  {
221  $tpl->setVariable("MULTI_ICONS", $this->getMultiIconsHTML());
222  }
223 
224  return $tpl->get();
225  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getHiddenTag($a_post_var, $a_value)
Get hidden tag (used for disabled properties)
getPostVar()
Get Post Variable.
getMultiIconsHTML()
Get HTML for multiple value icons.
getMultiValues()
Get multi values.
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOptions()

ilSelectInputGUI::setOptions (   $a_options)

Set Options.

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

Definition at line 40 of file class.ilSelectInputGUI.php.

Referenced by FormMailCodesGUI\__construct(), ilSurveyEvaluationGUI\addApprSelectionToToolbar(), ilPaymentStatisticGUI\addCustomer(), ilObjPaymentSettingsGUI\addCustomerObject(), ilMemberAgreementGUI\addCustomFields(), ilTestExpressPageObjectGUI\addQuestion(), ilObjTestGUI\addQuestionObject(), ilSurveyPageGUI\addQuestionToolbarForm(), ilUserProfile\addStandardFieldsToForm(), ilObjQuestionPoolGUI\buildCreateQuestionForm(), ilObjTestDynamicQuestionSetConfigGUI\buildForm(), ilSurveyEvaluationGUI\competenceEval(), ilSurveyConstraintsGUI\constraintForm(), ilSurveyEditorGUI\copyQuestionsToPoolObject(), ilSurveyEditorGUI\createQuestionObject(), ilObjTestGUI\createQuestionObject(), ilSessionStatisticsGUI\current(), ilPCTableGUI\editCellAlignment(), ilObjPaymentSettingsGUI\editDetailsObject(), ilObjHelpSettingsGUI\editSettings(), ilObjNewsSettingsGUI\editSettings(), ilPDNewsBlockGUI\editSettings(), ilNotificationAdminSettingsForm\getChannelForm(), ilNotificationAdminSettingsForm\getGeneralSettingsForm(), ilObjectTranslationGUI\getMultiLangForm(), ilPCIIMTriggerEditorGUI\getToolbar(), ilImageMapEditorGUI\getToolbar(), ilNotificationAdminSettingsForm\getTypeForm(), ilObjStyleSettingsGUI\initAddPageLayoutForm(), ilAdvancedSearchGUI\initAdvancedMetaDataForm(), ilObjExerciseGUI\initAssignmentForm(), ilSetupGUI\initBasicSettingsForm(), ilECSSettingsGUI\initCategoryMappingForm(), ilObjStyleSheetGUI\initCharacteristicForm(), ilObjGlossaryGUI\initCreateForm(), ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI\initFilter(), ilTestManScoringParticipantsTableGUI\initFilter(), ilTestDynamicQuestionSetStatisticTableGUI\initFilter(), ilTestParticipantsTableGUI\initFilter(), ilRoleTableGUI\initFilter(), ilRegistrationCodesTableGUI\initFilter(), ilUserTableGUI\initFilter(), ilObjMailGUI\initForm(), ilPCTabsGUI\initForm(), ilPageLayoutGUI\initForm(), ilCalendarAppointmentGUI\initForm(), ilLDAPSettingsGUI\initForm(), ilObjUserGUI\initForm(), ilObjLinkResourceGUI\initFormLink(), ilConsultationHoursGUI\initFormSequence(), ilCASSettingsGUI\initFormSettings(), ilObjCalendarSettingsGUI\initFormSettings(), ilPersonalSettingsGUI\initGeneralSettingsForm(), ilSurveyEditorGUI\initHeadingForm(), ilObjSurveyGUI\initImportForm(), ilObjTestGUI\initImportForm(), ilObjSystemFolderGUI\initJavaServerIniForm(), ilPCListGUI\initListForm(), ilMailOptionsGUI\initMailOptionsForm(), ilPersonalSettingsGUI\initMailOptionsForm(), ilObjSCORM2004LearningModuleGUI\initPropertiesEditableForm(), ilPCTableGUI\initPropertiesForm(), ilObjSCORM2004LearningModuleGUI\initPropertiesForm(), ilObjContentObjectGUI\initPropertiesForm(), ilObjRepositorySettingsGUI\initSettingsForm(), ilCalendarUserSettingsGUI\initSettingsForm(), ilECSSettingsGUI\initSettingsForm(), ilObjTaxonomyGUI\initSettingsForm(), ilObjContentObjectGUI\initStylePropertiesForm(), ilObjPortfolioBaseGUI\initStylePropertiesForm(), ilObjSCORM2004LearningModuleGUI\initStylePropertiesForm(), ilObjWikiGUI\initStylePropertiesForm(), ilObjGlossaryGUI\initStylePropertiesForm(), ilObjBlogGUI\initStylePropertiesForm(), ilContainerGUI\initStylePropertiesForm(), ilObjStyleSheetGUI\initTagStyleForm(), ilObjStyleSheetGUI\initTemplateGenerationForm(), ilObjSAHSLearningModuleGUI\initUploadForm(), ilPCQuestionGUI\insert(), assFormulaQuestionGUI\isSaveCommand(), ilSessionStatisticsGUI\long(), ilSurveyPageGUI\movePageForm(), ilObjTestGUI\movePageFormObject(), ilTermsOfServiceAcceptanceHistoryTableGUI\numericOrdering(), ilAdvancedMDRecordGUI\parseFilter(), assMatchingQuestionGUI\populateQuestionSpecificFormPart(), assTextSubsetGUI\populateQuestionSpecificFormPart(), ilObjSCORMLearningModuleGUI\properties(), ilSurveyEditorGUI\questionsObject(), ilPaymentObjectGUI\resetObjectFilter(), ilMailAddressbookGUI\search(), ilSurveyEditorGUI\setBrowseForQuestionsSubtabs(), ilRadiusSettingsGUI\settings(), ilOpenIdSettingsGUI\settings(), ilObjCertificateSettingsGUI\settings(), ilSessionStatisticsGUI\short(), ilMailingListsGUI\showAssignmentForm(), ilChatroomHistoryTask\showMessages(), ilStartUpGUI\showOpenIdLoginForm(), ilPurchaseBMFGUI\showPersonalData(), ilPurchaseBaseGUI\showPersonalData(), and ilPaymentObjectGUI\showSelectedObject().

41  {
42  $this->options = $a_options;
43  }
+ Here is the caller graph for this function:

◆ setValue()

ilSelectInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 60 of file class.ilSelectInputGUI.php.

References ilFormPropertyGUI\getMulti(), and ilFormPropertyGUI\setMultiValues().

Referenced by ilUserProfile\addStandardFieldsToForm(), ilCertificateGUI\certificateEditor(), ilObjPaymentSettingsGUI\getSubTabs(), ilECSSettingsGUI\initCategoryMappingForm(), ilCalendarAppointmentGUI\initForm(), ilObjSearchSettingsGUI\initFormSettings(), ilAuthLoginPageEditorGUI\initLoginForm(), ilECSSettingsGUI\initMappingsForm(), ilObjPaymentSettingsGUI\InvoiceNumberObject(), ilAdvancedMDRecordGUI\parseSearch(), ilTaxAssignInputGUI\setCurrentValues(), and setValueByArray().

61  {
62  if($this->getMulti() && is_array($a_value))
63  {
64  $this->setMultiValues($a_value);
65  $a_value = array_shift($a_value);
66  }
67  $this->value = $a_value;
68  }
setMultiValues(array $a_values)
Set multi values.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValueByArray()

ilSelectInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 86 of file class.ilSelectInputGUI.php.

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

87  {
88  $this->setValue($a_values[$this->getPostVar()]);
89  }
getPostVar()
Get Post Variable.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:

Field Documentation

◆ $cust_attr

ilSelectInputGUI::$cust_attr = array()
protected

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

Referenced by getCustomAttributes().

◆ $options

ilSelectInputGUI::$options = array()
protected

◆ $value

ilSelectInputGUI::$value
protected

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

Referenced by checkInput(), getValue(), and render().


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