photo settings

This commit is contained in:
2024-12-02 16:25:28 +03:00
parent 567ab8544d
commit a1bed2d9f2
9 changed files with 125 additions and 78 deletions

View File

@ -8,7 +8,11 @@ use kernel\AdminController;
use kernel\app_modules\photo\models\form\CreatePhotoForm;
use kernel\app_modules\photo\models\Photo;
use kernel\app_modules\photo\services\PhotoService;
use kernel\EntityRelation;
use kernel\Flash;
use kernel\helpers\Debug;
use kernel\Request;
class PhotoController extends AdminController
{
private PhotoService $photoService;
@ -55,50 +59,19 @@ class PhotoController extends AdminController
$this->cgView->render("view.php", ['photo' => $photo]);
}
// /**
// * @throws Exception
// */
// public function actionUpdate($id): void
// {
// $model = Tag::find($id);
// if (!$model){
// throw new Exception(message: "The tag not found");
// }
//
// $this->cgView->render("form.php", ['model' => $model]);
// }
//
// /**
// * @throws Exception
// */
// public function actionEdit($id): void
// {
// $tag = Tag::find($id);
// if (!$tag){
// throw new Exception(message: "The tag not found");
// }
// $tagForm = new CreateTagForm();
// $tagService = new TagService();
// $tagForm->load($_REQUEST);
// if ($tagForm->validate()) {
// $tag = $tagService->update($tagForm, $tag);
// if ($tag) {
// $this->redirect("/admin/tag/view/" . $tag->id);
// }
// }
// $this->redirect("/admin/tag/update/" . $id);
// }
//
// #[NoReturn] public function actionDelete($id): void
// {
// $post = Tag::find($id)->first();
// $post->delete();
// $this->redirect("/admin/tag/");
// }
//
// public function actionSettings(): void
// {
// $this->cgView->render('form.php');
// }
public function actionSettings(): void
{
$this->cgView->render('settingsForm.php');
}
#[NoReturn] public function actionSaveSettings(): void
{
$request = new Request();
$entities = $request->post('entity');
EntityRelation::configurationEntitiesByProperty($entities, 'photo');
Flash::setMessage("success", "Настройка прошла успешно");
$this->redirect("/admin/settings/photo", 302);
}
}