From e1dfea9283dc28126f7ba6fbfaf4675f177662bd Mon Sep 17 00:00:00 2001 From: DariusIII Date: Thu, 25 Jul 2024 20:34:50 +0200 Subject: [PATCH] Remove show in menu and related functions --- Blacklight/Contents.php | 33 ------------------- .../Admin/AdminContentController.php | 2 -- app/Http/Controllers/BasePageController.php | 2 -- app/Models/Content.php | 2 -- database/schema/mariadb-schema.sql | 3 +- database/seeders/ContentTableSeeder.php | 3 -- resources/views/themes/admin/content-add.tpl | 6 ---- resources/views/themes/admin/content-list.tpl | 7 ---- 8 files changed, 1 insertion(+), 57 deletions(-) diff --git a/Blacklight/Contents.php b/Blacklight/Contents.php index 384028bc1..153ebb1ca 100755 --- a/Blacklight/Contents.php +++ b/Blacklight/Contents.php @@ -96,24 +96,6 @@ class Contents return $arr; } - /** - * @return array|false - */ - public function getForMenuByTypeAndRole($id, $role): bool|array - { - $arr = []; - $rows = $this->data_getForMenuByTypeAndRole($id, $role); - if ($rows === false) { - return false; - } - - foreach ($rows as $row) { - $arr[] = $row; - } - - return $arr; - } - public function getIndex() { $row = $this->data_getIndex(); @@ -185,7 +167,6 @@ class Contents 'metadescription' => $content['metadescription'], 'metakeywords' => $content['metakeywords'], 'contenttype' => $content['contenttype'], - 'showinmenu' => $content['showinmenu'], 'status' => $content['status'], 'ordinal' => $content['ordinal'], ] @@ -204,7 +185,6 @@ class Contents 'metadescription' => $content['metadescription'], 'metakeywords' => $content['metakeywords'], 'contenttype' => $content['contenttype'], - 'showinmenu' => $content['showinmenu'], 'status' => $content['status'], 'ordinal' => $content['ordinal'], ] @@ -279,17 +259,4 @@ class Contents ] )->first(); } - - /** - * @return \Illuminate\Database\Eloquent\Collection|static[] - */ - public function data_getForMenuByTypeAndRole($id, $role): \Illuminate\Database\Eloquent\Collection|static - { - $query = Content::query()->where('showinmenu', '=', 1)->where('contenttype', $id)->where('status', '=', 1); - if ($role !== User::ROLE_ADMIN) { - $query->where('role', $role)->orWhere('role', '=', 0); - } - - return $query->get(); - } } diff --git a/app/Http/Controllers/Admin/AdminContentController.php b/app/Http/Controllers/Admin/AdminContentController.php index 4ac6bd47d..04b424b34 100644 --- a/app/Http/Controllers/Admin/AdminContentController.php +++ b/app/Http/Controllers/Admin/AdminContentController.php @@ -50,7 +50,6 @@ class AdminContentController extends BasePageController 'metadescription' => '', 'metakeywords' => '', 'contenttype' => '', - 'showinmenu' => '', 'status' => '', 'ordinal' => '', 'created_at' => '', @@ -60,7 +59,6 @@ class AdminContentController extends BasePageController switch ($action) { case 'add': $meta_title = 'Content Add'; - $content['showinmenu'] = '1'; $content['status'] = '1'; $content['contenttype'] = '2'; break; diff --git a/app/Http/Controllers/BasePageController.php b/app/Http/Controllers/BasePageController.php index 757ccef58..2378e0f1d 100644 --- a/app/Http/Controllers/BasePageController.php +++ b/app/Http/Controllers/BasePageController.php @@ -178,8 +178,6 @@ class BasePageController extends Controller } $content = new Contents(); - $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role)); - $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role)); if ($this->userdata !== null) { $this->smarty->assign('recentforumpostslist', Forumpost::getPosts(Settings::settingValue('..showrecentforumposts'))); } diff --git a/app/Models/Content.php b/app/Models/Content.php index 1bf4b33dd..85f530d6a 100644 --- a/app/Models/Content.php +++ b/app/Models/Content.php @@ -14,7 +14,6 @@ use Illuminate\Database\Eloquent\Model; * @property string $metadescription * @property string $metakeywords * @property int $contenttype - * @property int $showinmenu * @property int $status * @property int|null $ordinal * @property int $role @@ -26,7 +25,6 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereMetakeywords($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereOrdinal($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereRole($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereShowinmenu($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereStatus($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereTitle($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Content whereUrl($value) diff --git a/database/schema/mariadb-schema.sql b/database/schema/mariadb-schema.sql index 953297745..9fad88599 100644 --- a/database/schema/mariadb-schema.sql +++ b/database/schema/mariadb-schema.sql @@ -257,12 +257,11 @@ CREATE TABLE `content` ( `metadescription` varchar(1000) NOT NULL, `metakeywords` varchar(1000) NOT NULL, `contenttype` int(11) NOT NULL, - `showinmenu` int(11) NOT NULL, `status` int(11) NOT NULL, `ordinal` int(11) DEFAULT NULL, `role` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), - KEY `ix_showinmenu_status_contenttype_role` (`showinmenu`,`status`,`contenttype`,`role`) + KEY `ix_status_contenttype_role` (`status`,`contenttype`,`role`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `countries`; diff --git a/database/seeders/ContentTableSeeder.php b/database/seeders/ContentTableSeeder.php index b76fb56fa..0ddd77e7e 100644 --- a/database/seeders/ContentTableSeeder.php +++ b/database/seeders/ContentTableSeeder.php @@ -23,7 +23,6 @@ class ContentTableSeeder extends Seeder 'metadescription' => '""', 'metakeywords' => '""', 'contenttype' => 3, - 'showinmenu' => 0, 'status' => 1, 'ordinal' => 0, 'role' => 0, @@ -36,7 +35,6 @@ class ContentTableSeeder extends Seeder 'metadescription' => '""', 'metakeywords' => '""', 'contenttype' => 1, - 'showinmenu' => 2, 'status' => 1, 'ordinal' => 1, 'role' => 0, @@ -49,7 +47,6 @@ class ContentTableSeeder extends Seeder 'metadescription' => '""', 'metakeywords' => '""', 'contenttype' => 1, - 'showinmenu' => 2, 'status' => 1, 'ordinal' => 0, 'role' => 0, diff --git a/resources/views/themes/admin/content-add.tpl b/resources/views/themes/admin/content-add.tpl index 80081beff..1fbb0d566 100644 --- a/resources/views/themes/admin/content-add.tpl +++ b/resources/views/themes/admin/content-add.tpl @@ -53,12 +53,6 @@
Only appropriate for articles and useful links
- - - - {html_radios id="showinmenu" name='showinmenu' values=$yesno_ids output=$yesno_names selected=$content->showinmenu separator='
'} - - diff --git a/resources/views/themes/admin/content-list.tpl b/resources/views/themes/admin/content-list.tpl index aada6f7fa..fa797c0cf 100644 --- a/resources/views/themes/admin/content-list.tpl +++ b/resources/views/themes/admin/content-list.tpl @@ -46,13 +46,6 @@ Admins {/if} - - {if $content->showinmenu == "1"} - Yes - {else} - No - {/if} - {$content->body|truncate:100|escape:'htmlall'} id}")}}">delete