Пример #1
0
 private function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $query = \app\models\AccHist::find();
     //$sort = new CSort();
     //$sort->defaultOrder = 'dt DESC';
     return new \yii\data\ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['dt' => SORT_DESC]], 'pagination' => array('pageSize' => 4)]);
 }
Пример #2
0
 public function getAccHist()
 {
     return $this->hasMany(AccHist::className(), array('account_id' => 'id'));
 }
Пример #3
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = AccHist::findOne($id);
     if ($model === null) {
         throw new \yii\web\HttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #4
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search($params)
 {
     $query = AccHist::find();
     $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'account_id' => $this->account_id, 'dt' => $this->dt, 'type' => $this->type]);
     $query->andFilterWhere(['like', 'details', $this->details]);
     return $dataProvider;
 }
Пример #5
0
<?php

$this->params["menu"] = array(array('label' => Yii::t('app', 'Create Account Contact History'), 'url' => array('create')));
app\widgets\MiniForm::begin(array('header' => Yii::t('app', "Manage Account Contact History")));
?>

<?php 
echo app\widgets\GridView::widget(array('id' => 'acchist-grid', 'dataProvider' => $model->search([]), 'filterModel' => $model, 'columns' => array('subject', ['attribute' => 'type', 'filter' => \yii\helpers\ArrayHelper::map(\app\models\AccHist::getTypes(), 'id', 'name'), "value" => function ($data) {
    return $data->getTypeName();
}], array('attribute' => 'account_id', 'value' => function ($data) {
    return app\models\Accounts::findName($data->account_id);
}), array('attribute' => 'dt', 'value' => function ($data) {
    return $data->readDateFormat($data->dt);
}), array('class' => 'yii\\grid\\ActionColumn'))));
app\widgets\MiniForm::end();