form.php 889 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use kartik\select2\Select2;
  3. use common\modules\rbac\models\Assignment;
  4. use yii\bootstrap\Alert;
  5. use yii\helpers\Html;
  6. use yii\widgets\ActiveForm;
  7. /**
  8. * @var $model Assignment
  9. */
  10. ?>
  11. <?php if ($model->updated): ?>
  12. <?= Alert::widget([
  13. 'options' => [
  14. 'class' => 'alert-success'
  15. ],
  16. 'body' => Yii::t('backend', 'Assignments have been updated'),
  17. ]) ?>
  18. <?php endif ?>
  19. <?php $form = ActiveForm::begin([
  20. 'enableClientValidation' => false,
  21. 'enableAjaxValidation' => false,
  22. ]) ?>
  23. <?= Html::activeHiddenInput($model, 'user_id') ?>
  24. <?= $form->field($model, 'items')->widget(Select2::className(), [
  25. 'data' => $model->getAvailableRoles(),
  26. 'options' => [
  27. 'id' => 'items',
  28. 'multiple' => true
  29. ],
  30. ]) ?>
  31. <?= Html::submitButton(Yii::t('app', 'Update'), ['class' => 'btn bg-maroon btn-flat btn-block']) ?>
  32. <?php ActiveForm::end() ?>