-
Notifications
You must be signed in to change notification settings - Fork 0
/
editVideo.php
73 lines (64 loc) · 2.52 KB
/
editVideo.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
require_once "include/header.php";
require_once 'include/classes/VideoPlayer.php';
require_once 'include/classes/VideoDetailsFormProvider.php';
require_once 'include/classes/VideoUploadData.php';
require_once 'include/classes/selectThumbnail.php';
if (!User::isLoggedIn()) header("location: signIn.php");
if (!isset($_GET['videoId']) || $_GET['videoId'] == ""){
die("No video selected!");
}
$video = new Video($conn, $_GET['videoId'], $userLoggedInObj);
if ($video->getUploadedBy() != $userLoggedInObj->getUserName()){
die("Not your video");
}
$detailsMessage = "";
if (isset($_POST['save'])){
$videUpdateData = new VideoUploadData(
null,
$_POST['title'],
$_POST['description'],
$_POST['privacy'],
$_POST['category'],
$userLoggedInObj->getUserName()
);
if($videUpdateData->updateDetails($conn, $video->getId())){
//success
$detailsMessage = "<div class='alert alert-success alert-dismissible fade show' role='alert'>
<strong>SUCCESS!</strong> Details updated successfully!
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
$video = new Video($conn, $_GET['videoId'], $userLoggedInObj);
}else{
//update failed
$detailsMessage = "<div class='alert alert-danger alert-dismissible fade show' role='alert'>
<strong>ERROR!</strong> Something Went Wrong!
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
}
}
?>
<div class="editVideoContainer column">
<div class="message">
<?php echo $detailsMessage;?>
</div>
<div class="topSection">
<?php
$videoPlayer = new VideoPlayer($video);
echo $videoPlayer->create(false);
$selectThumbnail = new selectThumbnail($conn,$video);
echo $selectThumbnail->create();
?>
</div>
<div class="bottomSection">
<?php
$videoDetailsFormProvider = new VideoDetailsFormProvider($conn);
echo $videoDetailsFormProvider->createEditDetailsForm($video);
?>
</div>
</div>
<script src="assets/js/editVideoActions.js"></script>