Дипломная работа: Автоматизация и обеспечение информационной безопасности процесса ведения документации и отчетности в компании ООО "Игровед-4"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
124
],
],
];
}
/**
* Lists all Folder models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new FolderSearch();
$dataProvider = $searchModel->search(Yii::$app->request-
>queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Folder model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
$model = $this->findModel($id);
$model->TestAccessByFlag('flag_view');
125
return $this->render('view', [
'model' => $model,
]);
}
/**
* Creates a new Folder model.
* If creation is successful, the browser will be redirected to the 'view'
page.
* @return mixed
*/
public function actionCreate()
{
$model = new Folder();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model->registration_date = date('Y-m-d h:i:s');
$model->id_user = Yii::$app->user->identity->id;
$model->save();
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Folder model.
126
* 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);
$model->TestAccessByFlag('flag_edit');
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 Folder model.
* If deletion is successful, the browser will be redirected to the 'index'
page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$model = $this->findModel($id);
$model->TestAccessByFlag('flag_delete');
$model->delete();
127
return $this->redirect(['index']);
}
/**
* Finds the Folder model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Folder the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
public static function findModel($id)
{
if (($model = Folder::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not
exist.');
}
}
}
Источник: https://baza.diplomsite.ru/previewfile/1794