Exemple #1
0
    <?php 
$form = ActiveForm::begin();
?>



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

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

    <?php 
echo $form->field($model, 'id_area')->dropDownList(ArrayHelper::map(Area::findAll(['eliminado' => '0']), 'id', 'nombre'), ['prompt' => 'Area']);
?>
    <?php 
echo $form->field($model, 'id_tipo')->radioList(ArrayHelper::map(Tipo::find()->all(), 'id', 'nombre'))->label(false);
?>

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

    <?php 
ActiveForm::end();
?>
 /**
  * Delete multiple existing Area model.
  * For ajax request will return json object
  * and for non-ajax request if deletion is successful, the browser will be redirected to the 'index' page.
  * @param string $id
  * @return mixed
  */
 public function actionBulkDelete()
 {
     $request = Yii::$app->request;
     $pks = $request->post('pks');
     // Array or selected records primary keys
     foreach (Area::findAll(json_decode($pks)) as $model) {
         $model->delete();
     }
     if ($request->isAjax) {
         /*
          *   Process for ajax request
          */
         Yii::$app->response->format = Response::FORMAT_JSON;
         return ['forceClose' => true, 'forceReload' => '#crud-datatable-pjax'];
     } else {
         /*
          *   Process for non-ajax request
          */
         return $this->redirect(['index']);
     }
 }