Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Character::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'story_id' => $this->story_id, 'group_id' => $this->group_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'char_name', $this->char_name]);
     return $dataProvider;
 }
Beispiel #2
0
?>

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

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

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

    <?php 
echo $form->field($model, 'chars')->label('Character')->widget(Select2::classname(), ['addon' => ['prepend' => ['content' => '<span class="fa fa-flag" aria-hidden="true"></span> Character']], 'data' => ArrayHelper::map(Character::find()->all(), 'id', 'char_name'), 'options' => ['placeholder' => 'Select Character ...', 'multiple' => true]]);
?>

    <?php 
echo $form->field($model, 'story_id')->label('Story')->widget(Select2::classname(), ['addon' => ['prepend' => ['content' => '<span class="fa fa-flag" aria-hidden="true"></span> Story']], 'data' => ArrayHelper::map(Story::find()->all(), 'id', 'story_name'), 'options' => ['placeholder' => 'Select Story ...']]);
?>

    <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();
?>