Дипломная работа: Автоматизация приема и обработки заявок отделом техподдержки АО "Ренессанс Страхование"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
121
}
}
/**
* Updates an existing Object model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Object model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
122
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Object model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Object the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Object::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
ReportController.php
123
<?php
namespace app\controllers;
use Yii;
use app\models\Settings;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\base\UserException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\data\ActiveDataProvider;
use yii\data\ArrayDataProvider;
class ReportController extends \yii\web\Controller
{
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' =>
[
[
124
'actions' => ['user', 'common'],
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action)
{
return Yii::$app->user->identity->IsAdmin;
}
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
public function actionUser()
{
$Settings = Settings::findOne(Yii::$app->user->identity->id);
$searchModel = new \app\models\UserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
125
return $this->render('user', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'Settings' => $Settings,
]);
}
public function RequestCountСreated ($date)
{
$Q = new Yii\db\Query ();
return $Q->select('*')->from(['request'])->where('receive_date >= :date1 and
receive_date < :date2')
->params ([':date1'=>date('Y-m-d', $date), ':date2'=>date('Y-m-d',
strtotime(date('Y-m-d', $date) . ' +1 day'))])->count();
}
public function RequestCountClosed ($date)
{
$Q = new Yii\db\Query ();
return $Q->select('*')->from(['request'])->where('id_request_state = 4 and
complete_date >= :date1 and complete_date < :date2')
->params ([':date1'=>date('Y-m-d', $date), ':date2'=>date('Y-m-d',
strtotime(date('Y-m-d', $date) . ' +1 day'))])->count();
}
Источник: https://baza.diplomsite.ru/previewfile/1969