add totals to frontend collection/index

This commit is contained in:
2015-11-04 16:36:40 +01:00
parent cee5d60d9d
commit 9751e7756e
2 changed files with 16 additions and 1 deletions

View File

@@ -29,7 +29,8 @@ class CollectionSearch extends Collection
return [
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
];
[['id_account'],'integer']
];
}
/**
@@ -58,12 +59,15 @@ class CollectionSearch extends Collection
$this->load($params);
$this->id_user = Yii::$app->user->id;
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_account' => $this->id_account,
]);