Beispiel #1
0
use yii\helpers\ArrayHelper;
use app\models\Colegio;
use kartik\select2\Select2;
/* @var $this yii\web\View */
/* @var $model app\models\Llave */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="llave-form">

    <?php 
$form = ActiveForm::begin();
?>

        <?php 
echo $form->field($model, 'id_colegio')->widget(Select2::classname(), ['data' => ArrayHelper::map(Colegio::find()->all(), 'id', 'nombre'), 'language' => 'en', 'options' => ['placeholder' => 'Colegio ...'], 'pluginOptions' => ['allowClear' => true]]);
?>



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

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Generar Llave' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
Beispiel #2
0
 /**
  * Lists all Colegio models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Colegio::find()->where(['eliminado' => 0])]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }