PATH:
home
/
letacommog
/
letaweb
/
protected
/
extensions
/
yiibooster
/
widgets
<?php class TbFormInputElement extends CFormElement { /** * Input types (alias => TbActiveForm method name). * @var array */ public static $inputTypes = array( // standard fields 'text' => 'textFieldGroup', 'hidden' => 'hiddenField', 'password' => 'passwordFieldGroup', 'textarea' => 'textAreaGroup', 'file' => 'fileFieldGroup', 'radio' => 'radioButtonGroup', 'checkbox' => 'checkBoxGroup', 'listbox' => 'listBoxGroup', 'dropdownlist' => 'dropDownListGroup', 'checkboxlist' => 'checkBoxListGroup', 'radiolist' => 'radioButtonListGroup', 'url' => 'urlFieldGroup', 'email' => 'emailFieldGroup', 'number' => 'numberFieldGroup', 'range' => 'rangeFieldGroup', 'date' => 'dateFieldGroup', 'time' => 'timeFieldGroup', 'tel' => 'telFieldGroup', 'search' => 'searchFieldGroup', // extended fields 'switch' => 'switchGroup', 'datepicker' => 'datePickerGroup', 'daterange' => 'dateRangeGroup', 'timepicker' => 'timePickerGroup', 'datetimepicker' => 'dateTimePickerGroup', 'select2' => 'select2Group', 'redactor' => 'redactorGroup', 'html5editor' => 'html5EditorGroup', 'markdowneditor' => 'markdownEditorGroup', 'ckeditor' => 'ckEditorGroup', 'typeahead' => 'typeAheadGroup', 'maskedtext' => 'maskedTextFieldGroup', 'colorpicker' => 'colorPickerGroup', //'captcha' => 'captchaGroup', 'pass' => 'passFieldGroup' ); public $widgetOptions = array(); /** * The type of this input. This can be a widget class name, a path alias of a widget class name, * or an input type alias (text, hidden, password, textarea, file, etc.). * If a widget class, it must extend from {@link CInputWidget} or (@link CJuiInputWidget). * @var string */ public $type; /** * @var string Name of this input. */ public $name; /** * Label for this input. * @var string */ public $label; /** * The options used when rendering label part. This property will be passed to the {@link CActiveForm::labelEx} * or {@link CHtml::label} if $label is defined, method call as its $htmlOptions parameter. * @var array * @see CActiveForm::labelEx * @see CHtml::label */ public $labelOptions; /** * Hint text of this input. * @var string */ public $hint; /** * The options used when rendering hint part. * This property will be passed as $htmlOptions parameter for hint wrapper tag. * @var array */ public $hintOptions; /** * Text/html prepended to input field. * @var string */ public $prepend; /** * The options used when rendering prepend part. * This property will be passed as $htmlOptions parameter for prepend wrapper tag. * @var array */ public $prependOptions; /** * Text/html appended to input field. * @var string */ public $append; /** * The options used when rendering append part. * This property will be passed as $htmlOptions parameter for append wrapper tag. * @var array */ public $appendOptions; /** * The options for this input when it is a list box, drop-down list, check box list, or radio button list. * Please see {@link CHtml::listData} for details of generating this property value. * @var array */ public $items = array(); /** * The options used when rendering the error part. This property will be passed * to the {@link CActiveForm::error} method call as its $htmlOptions parameter. * @var array * @see CActiveForm::error */ public $errorOptions = array(); /** * Whether to allow AJAX-based validation for this input. Note that in order to use * AJAX-based validation, {@link CForm::activeForm} must be configured with 'enableAjaxValidation'=>true. * This property allows turning on or off AJAX-based validation for individual input fields. * Defaults to true. * @var boolean */ public $enableAjaxValidation = true; /** * Whether to allow client-side validation for this input. Note that in order to use * client-side validation, {@link CForm::activeForm} must be configured with 'enableClientValidation'=>true. * This property allows turning on or off client-side validation for individual input fields. * Defaults to true. * @var boolean */ public $enableClientValidation = true; /** * Generates row options array from this class properties. * @return array The row options. */ protected function generateGroupOptions() { $options = array(); $fields = array('widgetOptions, label', 'labelOptions', 'errorOptions', 'hint', 'hintOptions', 'prepend', 'prependOptions', 'append', 'appendOptions', 'enableAjaxValidation', 'enableClientValidation'); foreach ($fields as $prop) { if (isset($this->$prop)) { $options[$prop] = $this->$prop; } } $options['widgetOptions']['data'] = $this->items; return $options; } /** * Render this element. * @return string The rendered element. */ public function render() { $model = $this->getParent()->getModel(); $attribute = $this->name; $options = $this->generateGroupOptions(); if (isset(self::$inputTypes[$this->type])) { $method = self::$inputTypes[$this->type]; // FIXME ... why we are passing $this->attributes ... most all TbActiveForm method only require $options return $this->getParent()->getActiveFormWidget()->$method($model, $attribute, $this->attributes, $options); /* no need for this as now data goes inside $options['widgetOptions']['data'] switch ($method) { case 'listBoxGroup': case 'dropDownListGroup': case 'checkBoxListGroup': case 'radioButtonListGroup': return $this->getParent()->getActiveFormWidget()->$method($model, $attribute, $this->attributes, $this->items, $options); default: return $this->getParent()->getActiveFormWidget()->$method($model, $attribute, $this->attributes, $options); } */ } else { $attributes = $this->attributes; $attributes['model'] = $this->getParent()->getModel(); $attributes['attribute'] = $this->name; return $this->getParent()->getActiveFormWidget()->customFieldGroup( array(array($this->getParent()->getOwner(), 'widget'), array($this->type, $attributes, true)), $model, $attribute, $options ); } } /** * Evaluates the visibility of this element. This method will check if the attribute associated with this * input is safe for the current model scenario. * @return bool Whether this element is visible. */ protected function evaluateVisible() { return $this->getParent()->getModel()->isAttributeSafe($this->name); } }
[+]
..
[-] TbTabView.php
[edit]
[-] TbNavbar.php
[edit]
[-] TbHighCharts.php
[edit]
[-] TbPager.php
[edit]
[-] TbLabel.php
[edit]
[-] TbActiveForm.php
[edit]
[-] TbPanel.php
[edit]
[-] TbJsonButtonColumn.php
[edit]
[-] TbModalManager.php
[edit]
[-] TbToggleColumn.php
[edit]
[-] TbUiLayout.php
[edit]
[-] TbBaseMenu.php
[edit]
[-] widgets.md
[edit]
[-] TbEditableDetailView.php
[edit]
[-] TbButtonGroup.php
[edit]
[-] TbEditable.php
[edit]
[-] TbFileUpload.php
[edit]
[-] TbEditableField.php
[edit]
[-] TbTags.php
[edit]
[-] TbFormButtonElement.php
[edit]
[-] TbFormInputElement.php
[edit]
[-] TbJsonPager.php
[edit]
[-] TbCollapse.php
[edit]
[-] TbBulkActions.php
[edit]
[-] TbRelationalColumn.php
[edit]
[-] TbTabs.php
[edit]
[-] TbModal.php
[edit]
[-] TbExtendedGridView.php
[edit]
[-] TbJumbotron.php
[edit]
[-] TbImageGallery.php
[edit]
[-] TbWidget.php
[edit]
[-] TbMenu.php
[edit]
[-] TbProgress.php
[edit]
[-] TbButtonColumn.php
[edit]
[-] TbJsonToggleColumn.php
[edit]
[-] TbJsonPickerColumn.php
[edit]
[-] TbColorPicker.php
[edit]
[-] TbButtonGroupColumn.php
[edit]
[-] TbSwitch.php
[edit]
[-] TbHeroUnit.php
[edit]
[-] TbDatePicker.php
[edit]
[-] TbJsonCheckBoxColumn.php
[edit]
[-] TbButton.php
[edit]
[-] TbTypeahead.php
[edit]
[-] TbForm.php
[edit]
[-] TbPassfield.php
[edit]
[-] TbEditableColumn.php
[edit]
[-] TbMarkdownEditorJs.php
[edit]
[-] TbPopoverColumn.php
[edit]
[-] TbMarkdownEditor.php
[edit]
[-] TbAlert.php
[edit]
[-] TbGroupGridView.php
[edit]
[-] TbBaseInputWidget.php
[edit]
[-] TbWizard.php
[edit]
[-] TbGroupButtonColumn.php
[edit]
[-] TbExtendedFilter.php
[edit]
[-] TbGoogleVisualizationChart.php
[edit]
[-] TbHtml5Editor.php
[edit]
[-] TbGridView.php
[edit]
[-] TbListView.php
[edit]
[-] TbTimePicker.php
[edit]
[-] TbJsonGridView.php
[edit]
[-] TbCKEditor.php
[edit]
[-] TbTotalSumColumn.php
[edit]
[-] TbDateRangePicker.php
[edit]
[-] TbBadge.php
[edit]
[-] TbDropdown.php
[edit]
[-] TbBreadcrumbs.php
[edit]
[-] TbJsonGridColumn.php
[edit]
[-] TbDateTimePicker.php
[edit]
[-] TbDataColumn.php
[edit]
[-] TbCarousel.php
[edit]
[-] TbJsonDataColumn.php
[edit]
[-] TbRedactorJs.php
[edit]
[-] TbThumbnails.php
[edit]
[-] TbScrollSpy.php
[edit]
[-] TbDetailView.php
[edit]
[+]
input
[-] TbSelect2.php
[edit]
[-] TbImageColumn.php
[edit]