public function actionChamdiem() { $this->allowUser(2); $searchModel = new WorkSearch(); $dataProvider = $searchModel->chamdiem(Yii::$app->request->queryParams); if (Yii::$app->request->post('hasEditable')) { $workId = Yii::$app->request->post('editableKey'); $timesheetId = Work::findOne($workId)->timesheet_id; $model = Timesheet::findOne($timesheetId); $out = Json::encode(['output' => '', 'message' => '']); $post = current($_POST['Work']); foreach ($post as $postname => $value) { if ($postname == "timesheet.point") { $model->point = $value; if ($value != null) { $model->status = 1; } else { $model->status = 0; } } if ($postname == "timesheet.director_comment") { $model->director_comment = $value; } } if ($model->validate()) { $model->save(); } echo $out; return; } return $this->render('chamdiem', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
public function actionTeacherTerm() { $searchModel = new WorkSearch(['teacher_id' => Yii::$app->user->identity->teacher->id, 'work_type_id' => Work::TYPE_TERM]); //->find()->where(['teacher_id' => Yii::$app->user->identity->teacher->id]); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('teacher_term', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); }
<?php use yii\bootstrap\Html; use yii\helpers\Url; use yii\grid\GridView; use yii\bootstrap\Modal; use yii\widgets\Pjax; use frontend\models\WorkSearch; use common\models\Work; $searchModel = new WorkSearch(['work_type_id' => Work::TYPE_GRADUATE, 'approve_status' => Work::STATUS_SENDED]); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); ?> <div class="work-chief-graduate"> <?php Pjax::begin(['enablePushState' => false, 'id' => 'chief-gradiate-container']); echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'options' => ['class' => 'table table-responsive'], 'columns' => ['studentFullname', 'groupName', 'workTitle.name', 'status', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}{approve}{nopprove}', 'buttons' => ['view' => function ($url, $model) { return Html::button('<span class="glyphicon glyphicon-eye-open"></span> Смотреть', ['value' => Url::to(['//work/view', 'id' => $model->id]), 'class' => 'btn btn-default modalButton']); }, 'approve' => function ($url, $model) { return Html::button('<span class="glyphicon glyphicon-ok"></span> Утвердить', ['value' => Url::to(['//chief/approve-graduate', 'id' => $model->id, 'status' => Work::STATUS_APPROVED]), 'class' => 'btn btn-default postPjaxButton', 'container' => '#chief-gradiate-container', 'data-pjax' => 1]); }, 'nopprove' => function ($url, $model) { return Html::button('<span class="glyphicon glyphicon-remove"></span> Отклонить', ['value' => Url::to(['//chief/approve-graduate', 'id' => $model->id, 'status' => Work::STATUS_NOT_APPROVED]), 'container' => '#chief-gradiate-container', 'data-pjax' => 1, 'class' => 'btn btn-default postPjaxButton']); }]]]]); Pjax::end(); ?> </div>