示例#1
0
<?php 
echo $form->errorSummary($model);
?>

<?php 
echo $form->field($model, 'name');
?>

<?php 
$models = Acctype::find()->All();
//array('order' => 'name')
//$list = \yii\helpers\ArrayHelper::map($models, 'id', 'name');
//$options = array("class" => 'span5', 'id' => ucfirst($this->id) . '_AccType_id');
//$select = \yii\helpers\Html::dropDownList(ucfirst($this->id) . '[AccType_id]', 0, $list, $options);
echo $form->field($model, 'AccType_id')->widget(Select2::className(), ['data' => \yii\helpers\ArrayHelper::map($models, 'id', 'name')]);
?>

<?php 
//echo $form->field($model,'AccType_id',array('class'=>'span5'));
if (isset($items)) {
    $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('app', 'Add new'), 'type' => 'success', 'options' => array('onclick' => '$("#addnew").dialog("open"); return false;')));
    echo app\widgets\GridView::widget(array('id' => 'acc-templateItem-grid', 'dataProvider' => $items->search(), 'filter' => $items, 'columns' => array(array('attribute' => 'eavFields_id', 'value' => '$data->EavFields->name'), array('class' => 'yii\\grid\\ActionColumn', 'template' => '{remove}', 'buttons' => array('remove' => array('label' => '<i class="glyphicon glyphicon-remove"></i>', 'url' => '$data->id', 'options' => array('onclick' => 'deleteTempItm(this);return false;')))))));
}
?>





<div class="form-actions">
示例#2
0
 /**
  * Get default widget class based on input field type
  * @param string $type
  * @return string
  */
 public static function getWidgetClassNameFromFieldType($type)
 {
     switch ($type) {
         case self::INPUT_DATE:
             $widgetClass = DatePicker::className();
             break;
         case self::INPUT_DATETIME:
             $widgetClass = DateTimePicker::className();
             break;
         case self::INPUT_COLOR:
             $widgetClass = ColorInput::className();
             break;
         case self::INPUT_SELECT2_MULTI:
         case self::INPUT_SELECT2_TAGS:
         case self::INPUT_SELECT2:
             $widgetClass = Select2::className();
             break;
         case self::INPUT_SELECT_PICKER:
         case self::INPUT_SELECT_PICKER_MULTI:
             $widgetClass = BootstrapSelect::className();
             break;
         case self::INPUT_EDITOR_CK:
             $widgetClass = CKEditor::className();
             break;
         case self::INPUT_EDITOR_BS_WYSIHTML5:
             $widgetClass = BootstrapWysihtml5::className();
             break;
         case self::INPUT_EDITOR_BS_SUMMERNOTE:
             $widgetClass = BootstrapSummernote::className();
             break;
         default:
             $widgetClass = '';
             break;
     }
     return $widgetClass;
 }