= GridView::widget([
'hover' => true,
'headerContainer' => ['class' => 'thead-light'],
'tableOptions' => ['class' => 'table-sm'],
'striped' => false,
'summary' => false,
'pager' => [
'firstPageLabel' => '<<',
'prevPageLabel' => '<',
'nextPageLabel' => '>',
'lastPageLabel' => '>>',
],
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'username',
'label' => 'Имя модератора',
],
[
'attribute' => 'name',
'label' => 'Название приемной кампании',
'value' => function ($data) {
$manage_ac = ApplicationType::find()
->select('name')
->leftJoin('{{%moderate_admission_campaign}}', 'application_type.id = moderate_admission_campaign.application_type_id')
->where(['rbac_auth_assignment_user_id' => $data['user_id']])
->orderBy('application_type.id')
->asArray()
->all();
$array_manger_ac = [];
foreach ($manage_ac as $m) {
$array_manger_ac[] = $m['name'];
}
if (empty($array_manger_ac)) {
return 'Для данного модератора нет приемных кампаний';
} else {
return join(', ', $array_manger_ac);
}
}
],
[
'attribute' => 'all',
'label' => 'Общее число обработанных заявлений',
'value' => function ($data) {
$tnModerateHistory = ModerateHistory::tableName();
$post = Yii::$app->request->post();
$username = $data['username'];
$campaign = ArrayHelper::getValue($post, 'DynamicModel.campaign');
$timeStop = ArrayHelper::getValue($post, 'DynamicModel.timeStop');
$timeStart = ArrayHelper::getValue($post, 'DynamicModel.timeStart');
$query = ModerateHistory::getModerateQuery(
$username,
$campaign,
$timeStart,
$timeStop
);
$query = $query
->select(["{$tnModerateHistory}.id"])
->groupBy("{$tnModerateHistory}.id")
->orderBy("{$tnModerateHistory}.id");
$result = (new Query())
->from(['t' => $query])
->count();
if (isset($result)) {
return $result;
}
return '-';
}
],
[
'attribute' => 'approved',
'label' => 'Общее число принятых заявлений',
'value' => function ($data) {
$tnModerateHistory = ModerateHistory::tableName();
$post = Yii::$app->request->post();
$username = $data['username'];
$campaign = ArrayHelper::getValue($post, 'DynamicModel.campaign');
$timeStop = ArrayHelper::getValue($post, 'DynamicModel.timeStop');
$timeStart = ArrayHelper::getValue($post, 'DynamicModel.timeStart');
$query = ModerateHistory::getModerateQuery(
$username,
$campaign,
$timeStart,
$timeStop
);
$query = $query
->select(["{$tnModerateHistory}.id"])
->andWhere(["{$tnModerateHistory}.status" => BachelorApplication::STATUS_APPROVED])
->groupBy("{$tnModerateHistory}.id")
->orderBy("{$tnModerateHistory}.id");
$result = (new Query())
->from(['t' => $query])
->count();
if (isset($result)) {
return $result;
}
return '-';
}
],
[
'attribute' => 'rejected',
'label' => 'Общее число отклонённых заявлений',
'value' => function ($data) {
$tnModerateHistory = ModerateHistory::tableName();
$post = Yii::$app->request->post();
$username = $data['username'];
$campaign = ArrayHelper::getValue($post, 'DynamicModel.campaign');
$timeStop = ArrayHelper::getValue($post, 'DynamicModel.timeStop');
$timeStart = ArrayHelper::getValue($post, 'DynamicModel.timeStart');
$query = ModerateHistory::getModerateQuery(
$username,
$campaign,
$timeStart,
$timeStop
);
$query = $query
->select(["{$tnModerateHistory}.id"])
->andWhere(["{$tnModerateHistory}.status" => BachelorApplication::STATUS_NOT_APPROVED])
->groupBy("{$tnModerateHistory}.id")
->orderBy("{$tnModerateHistory}.id");
$result = (new Query())
->from(['t' => $query])
->count();
if (isset($result)) {
return $result;
}
return '-';
}
]
],
]); ?>