Дипломная работа: Автоматизация управленческого учета в дошкольном образовательном учреждении (на примере ИП «Мельникова»)

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
87
*/
public function actionLogout()
{
Yii::$app->user->logout();
return $this->goHome();
}
}
<?php
namespace backend\controllers;
use Yii;
use backend\models\Child;
use backend\models\ChildSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* ChildController implements the CRUD actions for Child model.
*/
class ChildController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
88
];
}
/**
* Lists all Child models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new ChildSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Child model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Child model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
89
{
$model = new Child();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing Child model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing Child model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
90
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Child model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Child the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Child::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}
<?php
namespace backend\models;
use Yii;
/**
* This is the model class for table "{{%child}}".
*
* @property int $id
* @property int $parent_id
91
* @property string $full_name
* @property string|null $medical_data
*
* @property ParentModel $parent
* @property Poll[] $polls
* @property Questionnaire[] $questionnaires
* @property Request[] $requests
* @property Test[] $tests
*/
class Child extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%child}}';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['parent_id', 'full_name'], 'required'],
[['parent_id'], 'integer'],
[['medical_data'], 'string'],
[['full_name'], 'string', 'max' => 255],
[['parent_id'], 'exist', 'skipOnError' => true, 'targetClass' =>
ParentModel::className(), 'targetAttribute' => ['parent_id' => 'id']],
];
}
/**
* {@inheritdoc}
*/
Источник: https://baza.diplomsite.ru/previewfile/571