Дипломная работа: Автоматизация учета рабочего времени сотрудников в ТОО "Автоцентр АСТЭК"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
116
}
public function actionReportT13()
{
$workers = \app\models\Worker::find()
->andWhere(['active' => true])
->orderBy(['last_name' => SORT_ASC, 'first_name' =>
SORT_ASC, 'middle_name' => SORT_ASC])
->all();
return Yii::$app->response->sendContentAsFile($this-
>renderPartial('report-t13', ['workers' => $workers, 'settings' => Yii::$app->user-
>identity]), Yii::t('app', 'Report T13') . '.xls');
}
public function actionReportTimeControl()
{
$workers = \app\models\Worker::find()
->andWhere(['active' => true])
->orderBy(['last_name' => SORT_ASC, 'first_name' =>
SORT_ASC, 'middle_name' => SORT_ASC])
->all();
return Yii::$app->response->sendContentAsFile($this-
>renderPartial('report-time-control', ['workers' => $workers, 'settings' => Yii::$app-
>user->identity]), Yii::t('app', 'Report Time Control') . '.xls');
}
117
}
<?php
namespace app\controllers;
use Yii;
use app\models\User;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* ReportSettingsController implements the CRUD actions for User model.
*/
class ReportSettingsController extends Controller
{
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' =>
[
[
'actions' => ['view', 'update'],
'allow' => true,
'roles' => ['@'],
118
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Displays a single User model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView()
{
return $this->render('view', [
'model' => $this->findModel(),
]);
}
/**
* Updates an existing User model.
* If update is successful, the browser will be redirected to the 'view' page.
119
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate()
{
$model = $this->findModel();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Finds the User model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return User the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel()
{
if (($model = User::findOne(Yii::$app->user->identity->id)) !== null) {
return $model;
}
throw new NotFoundHttpException(Yii::t('app', 'The requested page does
120
not exist.'));
}
}
<?php
namespace app\controllers;
use Yii;
use app\models\Vacation;
use app\models\VacationSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* VacationController implements the CRUD actions for Vacation model.
*/
class VacationController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' =>
[
Источник: https://baza.diplomsite.ru/previewfile/2419