-
Notifications
You must be signed in to change notification settings - Fork 2
/
video.php
42 lines (35 loc) · 1.15 KB
/
video.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
class Video {
function addForm($f3){
echo Template::instance()->render('templates/header.html');
echo Template::instance()->render('templates/video.add.html');
}
function add($f3){
$video = new DB\SQL\Mapper($f3->get('db'),'videos');
$video->channel = $f3->get('PARAMS.channelID');
$video->youtubeID = $f3->get('POST.youtubeID');
$video->startTime = $f3->get('POST.startTime');
$video->endTime = $f3->get('POST.endTime');
$video->save();
$f3->reroute('@channelList');
}
function editForm($f3){
$video = new DB\SQL\Mapper($f3->get('db'),'videos');
$video = $video->load(array('id=?', $f3->get('PARAMS.videoID')));
$f3->set('video',$video);
echo Template::instance()->render('templates/header.html');
echo Template::instance()->render('templates/video.edit.html');
}
function edit($f3){
$video = new DB\SQL\Mapper($f3->get('db'),'videos');
$video->load(array('id=?', $f3->get('PARAMS.videoID')));
if($f3->get('POST.delete') == '1'){
$video->erase();
}else{
$video->startTime = $f3->get('POST.startTime');
$video->endTime = $f3->get('POST.endTime');
$video->save();
}
$f3->reroute('@channelList');
}
}