Esempio n. 1
0
    <?php 
$form = ActiveForm::begin();
?>

    <h2>@<?php 
echo Html::encode($model->user->screen_name);
?>
</h2>

    <p class="well well-sm"><?php 
echo Html::encode($model->text);
?>
</p>  

    <?php 
echo $form->field($model, 'contest_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Contest::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Select a Contest ...'], 'pluginOptions' => ['allowClear' => true]]);
?>

    <?php 
echo $form->field($model, 'entry_id')->widget(DepDrop::classname(), ['data' => ArrayHelper::map(Entry::find()->where(['contest_id' => $model->contest_id])->all(), 'id', 'name'), 'options' => ['placeholder' => Yii::t('app', 'Select a Entry ...')], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['allowClear' => true]], 'pluginOptions' => ['depends' => ['tweet-contest_id'], 'url' => Url::to(['/entry/contest-entries']), 'loadingText' => Yii::t('app', 'Loading Entries ...')]]);
?>

    <?php 
echo $form->field($model, 'rating')->textInput(['maxlength' => 4]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
 /**
  * Lists all Contest models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Contest::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }