1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\Admin; |
4
|
|
|
|
5
|
|
|
use App\Models\Video; |
6
|
|
|
use App\Models\Release; |
7
|
|
|
use Illuminate\Http\Request; |
8
|
|
|
use Blacklight\processing\tv\TV; |
9
|
|
|
use App\Http\Controllers\BasePageController; |
10
|
|
|
|
11
|
|
|
class ShowsController extends BasePageController |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @param \Illuminate\Http\Request $request |
15
|
|
|
* @throws \Exception |
16
|
|
|
*/ |
17
|
|
|
public function index(Request $request) |
18
|
|
|
{ |
19
|
|
|
$this->setAdminPrefs(); |
20
|
|
|
|
21
|
|
|
$meta_title = $title = 'TV Shows List'; |
22
|
|
|
|
23
|
|
|
$tvshowname = ($request->has('showname') && ! empty($request->input('showname')) ? $request->input('showname') : ''); |
24
|
|
|
|
25
|
|
|
$this->smarty->assign( |
|
|
|
|
26
|
|
|
[ |
27
|
|
|
'showname' => $tvshowname, |
28
|
|
|
'tvshowlist' => Video::getRange($tvshowname), |
29
|
|
|
] |
30
|
|
|
); |
31
|
|
|
|
32
|
|
|
$content = $this->smarty->fetch('show-list.tpl'); |
|
|
|
|
33
|
|
|
$this->smarty->assign(compact('title', 'meta_title', 'content')); |
34
|
|
|
$this->adminrender(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param \Illuminate\Http\Request $request |
39
|
|
|
* @throws \Exception |
40
|
|
|
*/ |
41
|
|
|
public function edit(Request $request) |
42
|
|
|
{ |
43
|
|
|
$this->setAdminPrefs(); |
44
|
|
|
|
45
|
|
|
switch ($request->input('action') ?? 'view') { |
46
|
|
|
case 'submit': |
|
|
|
|
47
|
|
|
if ($request->has('from') && ! empty($request->input('from'))) { |
48
|
|
|
header('Location:'.$request->input('from')); |
49
|
|
|
exit; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
header('Location:'.WWW_TOP.'admin/show-list'); |
|
|
|
|
53
|
|
|
break; |
54
|
|
|
|
55
|
|
|
case 'view': |
|
|
|
|
56
|
|
|
default: |
57
|
|
|
if ($request->has('id')) { |
58
|
|
|
$title = 'TV Show Edit'; |
|
|
|
|
59
|
|
|
$show = Video::getByVideoID($request->input('id')); |
60
|
|
|
} |
61
|
|
|
break; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
$this->smarty->assign('show', $show); |
|
|
|
|
65
|
|
|
|
66
|
|
|
$meta_title = $title = 'Edit TV Show Data'; |
67
|
|
|
$content = $this->smarty->fetch('show-edit.tpl'); |
68
|
|
|
$this->smarty->assign(compact('title', 'meta_title', 'content')); |
69
|
|
|
$this->adminrender(); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param $id |
74
|
|
|
* |
75
|
|
|
* @throws \Exception |
76
|
|
|
*/ |
77
|
|
|
public function destroy($id) |
78
|
|
|
{ |
79
|
|
|
$this->setAdminPrefs(); |
80
|
|
|
|
81
|
|
|
$success = false; |
82
|
|
|
|
83
|
|
|
if ($id) { |
84
|
|
|
$success = Release::removeVideoIdFromReleases($id); |
85
|
|
|
$this->smarty->assign('videoid', $id); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
$this->smarty->assign('success', $success); |
89
|
|
|
|
90
|
|
|
$meta_title = $title = 'Remove Video and Episode IDs from Releases'; |
91
|
|
|
$content = $this->smarty->fetch('show-remove.tpl'); |
92
|
|
|
$this->smarty->assign(compact('title', 'meta_title', 'content')); |
93
|
|
|
$this->adminrender(); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.