mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 17:01:32 +00:00
87c6e5d64f
[ci skip] [skip ci]
95 lines
2.5 KiB
PHP
95 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Models\Video;
|
|
use App\Models\Release;
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\BasePageController;
|
|
|
|
class ShowsController extends BasePageController
|
|
{
|
|
/**
|
|
* @param \Illuminate\Http\Request $request
|
|
* @throws \Exception
|
|
*/
|
|
public function index(Request $request)
|
|
{
|
|
$this->setAdminPrefs();
|
|
|
|
$meta_title = $title = 'TV Shows List';
|
|
|
|
$tvshowname = ($request->has('showname') && ! empty($request->input('showname')) ? $request->input('showname') : '');
|
|
|
|
$this->smarty->assign(
|
|
[
|
|
'showname' => $tvshowname,
|
|
'tvshowlist' => Video::getRange($tvshowname),
|
|
]
|
|
);
|
|
|
|
$content = $this->smarty->fetch('show-list.tpl');
|
|
$this->smarty->assign(compact('title', 'meta_title', 'content'));
|
|
$this->adminrender();
|
|
}
|
|
|
|
/**
|
|
* @param \Illuminate\Http\Request $request
|
|
* @throws \Exception
|
|
*/
|
|
public function edit(Request $request)
|
|
{
|
|
$this->setAdminPrefs();
|
|
|
|
switch ($request->input('action') ?? 'view') {
|
|
case 'submit':
|
|
if ($request->has('from') && ! empty($request->input('from'))) {
|
|
header('Location:'.$request->input('from'));
|
|
exit;
|
|
}
|
|
|
|
header('Location:'.WWW_TOP.'admin/show-list');
|
|
break;
|
|
|
|
case 'view':
|
|
default:
|
|
if ($request->has('id')) {
|
|
$title = 'TV Show Edit';
|
|
$show = Video::getByVideoID($request->input('id'));
|
|
}
|
|
break;
|
|
}
|
|
|
|
$this->smarty->assign('show', $show);
|
|
|
|
$meta_title = $title = 'Edit TV Show Data';
|
|
$content = $this->smarty->fetch('show-edit.tpl');
|
|
$this->smarty->assign(compact('title', 'meta_title', 'content'));
|
|
$this->adminrender();
|
|
}
|
|
|
|
/**
|
|
* @param $id
|
|
*
|
|
* @throws \Exception
|
|
*/
|
|
public function destroy($id)
|
|
{
|
|
$this->setAdminPrefs();
|
|
|
|
$success = false;
|
|
|
|
if ($id) {
|
|
$success = Release::removeVideoIdFromReleases($id);
|
|
$this->smarty->assign('videoid', $id);
|
|
}
|
|
|
|
$this->smarty->assign('success', $success);
|
|
|
|
$meta_title = $title = 'Remove Video and Episode IDs from Releases';
|
|
$content = $this->smarty->fetch('show-remove.tpl');
|
|
$this->smarty->assign(compact('title', 'meta_title', 'content'));
|
|
$this->adminrender();
|
|
}
|
|
}
|