Exemple #1
0
 /**
  * Initializes the widget
  *
  * @throws InvalidConfigException
  */
 public function init()
 {
     $this->_msgCat = 'kveditable';
     parent::init();
     if (empty($this->inputType)) {
         throw new InvalidConfigException("The 'type' of editable input must be set.");
     }
     if (!Config::isValidInput($this->inputType)) {
         throw new InvalidConfigException("Invalid input type '{$this->inputType}'.");
     }
     if ($this->inputType === self::INPUT_WIDGET && empty($this->widgetClass)) {
         throw new InvalidConfigException("The 'widgetClass' must be set when the 'inputType' is set to 'widget'.");
     }
     if (Config::isDropdownInput($this->inputType) && !isset($this->data)) {
         throw new InvalidConfigException("You must set the 'data' property for '{$this->inputType}'.");
     }
     if (!empty($this->formClass) && !class_exists($this->formClass)) {
         throw new InvalidConfigException("The form class '{$this->formClass}' does not exist.");
     }
     Config::validateInputWidget($this->inputType);
     $this->initI18N(__DIR__);
     $this->initOptions();
     $this->_popoverOptions['options']['id'] = $this->options['id'] . '-popover';
     $this->_popoverOptions['toggleButton']['id'] = $this->options['id'] . '-targ';
     $this->registerAssets();
     echo Html::beginTag('div', $this->containerOptions);
     if ($this->format == self::FORMAT_BUTTON) {
         echo Html::tag('div', $this->displayValue, $this->editableValueOptions);
     }
     if ($this->asPopover === true) {
         PopoverX::begin($this->_popoverOptions);
     } elseif ($this->format !== self::FORMAT_BUTTON) {
         echo $this->renderToggleButton();
     }
     echo Html::beginTag('div', $this->contentOptions);
     $class = $this->formClass;
     $this->_form = $class::begin($this->formOptions);
     if (!$this->_form instanceof \yii\widgets\ActiveForm) {
         throw new InvalidConfigException("The form class '{$class}' MUST extend from \\yii\\widgets\\ActiveForm.");
     }
 }
Exemple #2
0
				
					<div class='row'>
						<div class="col-md-6">
							<?php 
echo Html::submitButton('Aceptar', ['class' => 'btn btn-primary', 'id' => 'btnSubmit']);
?>
						</div>
						<div class="col-md-6">
							<div class="pull-right">
							<?php 
if ($model->control) {
    $cartel = '<i class="glyphicon glyphicon-eye-open"></i> Control';
} else {
    $cartel = 'Control';
}
PopoverX::begin(['options' => ['id' => 'popControl'], 'placement' => PopoverX::ALIGN_RIGHT_BOTTOM, 'toggleButton' => ['label' => $cartel, 'class' => 'btn btn-default'], 'header' => '<i class="glyphicon glyphicon-eye-open"></i> Control de guardia', 'footer' => Html::button('Aceptar', ['id' => 'btnPop', 'class' => 'btn btn-sm btn-primary', 'onclick' => '$("#popControl").popoverX("hide")']), 'size' => 'lg']);
echo $form->field($model, 'control')->textInput(['maxlength' => true, 'style' => 'text-transform: uppercase']);
PopoverX::end();
?>
							</div>
						</div>
					</div>
					<?php 
ActiveForm::end();
?>
				
			</div><!-- fin div col1 -->

			<div id="col2" class="col-md-6"><!-- comienzo div col2 -->
				<div id="divlistavehiculos">
						<?php