aboutsummaryrefslogtreecommitdiff
path: root/handler/admin/AutoAddOrEdit.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2024-01-31 06:11:00 +0300
committerEvgeny Zinoviev <me@ch1p.io>2024-01-31 20:45:40 +0300
commitc0dc531ebefd8912819f3b6c8bda1fed3c7e750c (patch)
tree2c75aa9df182260aef09faf4befd81a4c2b9c5e2 /handler/admin/AutoAddOrEdit.php
parent48d688cdf7f9eae1bf11b8a6f0e5b98687c604cb (diff)
make it simple, but not simpler
Diffstat (limited to 'handler/admin/AutoAddOrEdit.php')
-rw-r--r--handler/admin/AutoAddOrEdit.php99
1 files changed, 0 insertions, 99 deletions
diff --git a/handler/admin/AutoAddOrEdit.php b/handler/admin/AutoAddOrEdit.php
deleted file mode 100644
index 1627642..0000000
--- a/handler/admin/AutoAddOrEdit.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-
-namespace handler\admin;
-
-use Page;
-use Post;
-use Response;
-
-abstract class AutoAddOrEdit extends AdminRequestHandler {
-
- public function beforeDispatch(): ?Response {
- $this->skin->setOptions([
- 'full_width' => true,
- 'no_footer' => true
- ]);
- return parent::beforeDispatch();
- }
-
- protected function _get_postAdd(
- string $title = '',
- string $text = '',
- ?array $tags = null,
- string $short_name = '',
- ?string $error_code = null
- ): Response {
- $this->skin->addLangKeys($this->lang->search('/^(err_)?blog_/'));
- $this->skin->title = $this->lang['blog_write'];
- return $this->skin->renderPage('admin/postForm',
- title: $title,
- text: $text,
- tags: $tags ? implode(', ', $tags) : '',
- short_name: $short_name,
- error_code: $error_code);
- }
-
- protected function _get_postEdit(
- Post $post,
- string $title = '',
- string $text = '',
- ?array $tags = null,
- bool $visible = false,
- bool $toc = false,
- string $short_name = '',
- ?string $error_code = null,
- bool $saved = false,
- ): Response {
- $this->skin->addLangKeys($this->lang->search('/^(err_)?blog_/'));
- $this->skin->title = ($this->lang)('blog_post_edit_title', $post->title);
- return $this->skin->renderPage('admin/postForm',
- is_edit: true,
- post_id: $post->id,
- post_url: $post->getUrl(),
- title: $title,
- text: $text,
- tags: $tags ? implode(', ', $tags) : '',
- visible: $visible,
- toc: $toc,
- saved: $saved,
- short_name: $short_name,
- error_code: $error_code
- );
- }
-
- protected function _get_pageAdd(
- string $name,
- string $title = '',
- string $text = '',
- ?string $error_code = null
- ): Response {
- $this->skin->addLangKeys($this->lang->search('/^(err_)?pages_/'));
- $this->skin->title = ($this->lang)('pages_create_title', $name);
- return $this->skin->renderPage('admin/pageForm',
- short_name: $name,
- title: $title,
- text: $text,
- error_code: $error_code);
- }
-
- protected function _get_pageEdit(
- Page $page,
- string $title = '',
- string $text = '',
- bool $saved = false,
- bool $visible = false,
- ?string $error_code = null
- ): Response {
- $this->skin->addLangKeys($this->lang->search('/^(err_)?pages_/'));
- $this->skin->title = ($this->lang)('pages_page_edit_title', $page->shortName.'.html');
- return $this->skin->renderPage('admin/pageForm',
- is_edit: true,
- short_name: $page->shortName,
- title: $title,
- text: $text,
- visible: $visible,
- saved: $saved,
- error_code: $error_code);
- }
-
-} \ No newline at end of file