Remove show in menu and related functions

This commit is contained in:
DariusIII
2024-07-25 20:34:50 +02:00
parent 06ec6bd68d
commit e1dfea9283
8 changed files with 1 additions and 57 deletions
-33
View File
@@ -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();
}
}
@@ -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;
@@ -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')));
}
-2
View File
@@ -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)
+1 -2
View File
@@ -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`;
-3
View File
@@ -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,
@@ -53,12 +53,6 @@
<div class="hint">Only appropriate for articles and useful links</div>
</td>
</tr>
<tr>
<td><label for="showinmenu">Show In Menu:</label></td>
<td>
{html_radios id="showinmenu" name='showinmenu' values=$yesno_ids output=$yesno_names selected=$content->showinmenu separator='<br />'}
</td>
</tr>
<tr>
<td><label for="status">Status:</label></td>
<td>
@@ -46,13 +46,6 @@
Admins
{/if}
</td>
<td style="width:50px;">
{if $content->showinmenu == "1"}
Yes
{else}
No
{/if}
</td>
<td title="{$content->body|escape:'htmlall'}">{$content->body|truncate:100|escape:'htmlall'}</td>
<td><a class="confirm_action"
href="{{url("/admin/content-delete?id={$content->id}")}}">delete</a></td>