Commit d82ade05 authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлен action удаления файла из базы;

parent f6d95d36
...@@ -11,6 +11,7 @@ namespace common\modules\analyticsSchool\controllers; ...@@ -11,6 +11,7 @@ namespace common\modules\analyticsSchool\controllers;
use common\components\AdminController; use common\components\AdminController;
use common\modules\analyticsSchool\models\AnalyticsSchoolLesson; use common\modules\analyticsSchool\models\AnalyticsSchoolLesson;
use common\modules\analyticsSchool\models\AnalyticsSchoolLessonFile;
use yii\data\ActiveDataProvider; use yii\data\ActiveDataProvider;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
...@@ -25,6 +26,7 @@ class LessonAdminController extends AdminController { ...@@ -25,6 +26,7 @@ class LessonAdminController extends AdminController {
'View' => 'Просмотр урока', 'View' => 'Просмотр урока',
'Update' => 'Редактирование урока', 'Update' => 'Редактирование урока',
'Delete' => 'Удаление урока', 'Delete' => 'Удаление урока',
'Deletefile' => 'Удаление файла вложения'
]; ];
} }
...@@ -110,6 +112,18 @@ class LessonAdminController extends AdminController { ...@@ -110,6 +112,18 @@ class LessonAdminController extends AdminController {
return $this->redirect(['manage']); return $this->redirect(['manage']);
} }
/**
* @param $id
* @return \yii\web\Response
*/
public function actionDeletefile($id){
/** @var AnalyticsSchoolLessonFile $model */
$model = AnalyticsSchoolLessonFile::findOne($id);
$model->delete();
return $this->redirect(['view', 'id' => $model->lesson_id]);
}
/** /**
* @param $id * @param $id
* @return AnalyticsSchoolLesson|null * @return AnalyticsSchoolLesson|null
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment