Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 public function getCharacters()
 {
     return $this->hasMany(Character::className(), ['story_id' => 'id']);
 }
Ejemplo n.º 3
0
 /**
  * Finds the Character model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Character the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Character::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 4
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();
?>