Диплом: Автоматизация учета рабочего времени сотрудников МБОУДО "ДДЮТ"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
127
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Worker model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Worker the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
public static function findModel($id)
{
if (($model = Worker::findOne($id)) !== null) {
return $model;
}
128
throw new NotFoundHttpException(Yii::t('app', 'The requested page does
not exist.'));
}
}
<?php
namespace app\controllers;
use Yii;
use app\models\WorkTime;
use app\models\WorkTimeSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* WorkTimeController implements the CRUD actions for WorkTime model.
*/
class WorkTimeController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
129
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' =>
[
[
'actions' => ['index', 'view', 'create',
'update', 'delete'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
130
],
];
}
/**
* Lists all WorkTime models.
* @return mixed
*/
public function actionIndex($id_worker)
{
$worker = WorkerController::findModel($id_worker);
$searchModel = new WorkTimeSearch();
$dataProvider = $searchModel->search(Yii::$app->request-
>queryParams);
$dataProvider->query->andWhere(['id_worker' => $worker->id]);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'worker' => $worker,
]);
}
131
/**
* Displays a single WorkTime model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
$model = $this->findModel($id);
$worker = WorkerController::findModel($model->id_worker);
return $this->render('view', [
'model' => $model,
'worker' => $worker,
]);
}
/**
* Creates a new WorkTime model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate($id_worker)
{
132
$worker = WorkerController::findModel($id_worker);
$model = new WorkTime();
$model->id_worker = $worker->id;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('create', [
'model' => $model,
'worker' => $worker,
]);
}
/**
* Updates an existing WorkTime 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)
{
133
$model = $this->findModel($id);
$worker = WorkerController::findModel($model->id_worker);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
'worker' => $worker,
]);
}
/**
* Deletes an existing WorkTime model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$model = $this->findModel($id);
$worker = WorkerController::findModel($model->id_worker);
134
$model->delete();
return $this->redirect(['index', 'id_worker' => $worker->id]);
}
/**
* Finds the WorkTime model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return WorkTime the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = WorkTime::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException(Yii::t('app', 'The requested page does
not exist.'));
}
}
<?php
namespace app\controllers;
135
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 ReportsController extends Controller
{
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' =>
[
[
'actions' => ['report-t7', 'report-t13',
'report-time-control'],
136
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
public function actionReportT7()
{
$vacations = \app\models\Vacation::find()->leftJoin('worker',
'worker.id = vacation.id_worker')
->andWhere(['active' => true])

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
IPO - инструмент финансирования деятельности организации. На примере ПАО «Нефтяная компания «Лукойл»
PR как средство продвижения организации (на примере ПАО "Тамбовский завод "Комсомолец им. Н.С. Артемова")
PR-коммуникации в сфере общественного питания (на примере кафе-кондитерской «Cream Cheese»)
SMM как средство повышения эффективности работы учреждений социокультурной сферы (на примере Малого театра)