-
Notifications
You must be signed in to change notification settings - Fork 0
/
watch.phtml
497 lines (399 loc) · 26.9 KB
/
watch.phtml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
<?php
if ($playlist) $this->addBodyClass('is-playlist');
$this->addMeta('videoId', $video->videoId);
$this->addMeta('theme', $this->options->themeUrl);
$this->addMeta('loggedIn', (boolean) $loggedInUser);
$this->addCss('video-js.css');
$this->addCss('scrollbar.css');
$this->addJs('video.plugin.js');
$this->addJs('scrollbar.js');
$this->setLayout('full');
?>
<div class="row">
<div class="col-md-8 play-left">
<div class="alert hidden"></div>
<!-- BEGIN Video Player -->
<?php if ($video->gated && !$loggedInUser): ?>
<div id="player-gated">
<img width="750" height="420" src="<?=$config->thumbUrl?>/<?=$video->filename?>.jpg" alt="" />
<div>
<p><?=Language::getText('gated_video')?></p>
<a href="<?=BASE_URL?>/login/" class="button_small"><?=Language::getText('login')?></a>
<?php if ($config->enableRegistrations): ?>
<a href="<?=BASE_URL?>/register/" class="button_small"><?=Language::getText('register')?></a>
<?php endif; ?>
</div>
</div>
<?php else: ?>
<div class="video-player-container">
<video id="video-player" class="video-js vjs-default-skin vjs-16-9" data-setup='{ "controls": true, "autoplay": true, "preload": "auto" }' width="750" height="420" poster="<?=$config->thumbUrl?>/<?=$video->filename?>.jpg">
<source src="<?=$config->h264Url?>/<?=$video->filename?>.mp4" type="video/mp4" />
<?php if ($webmEncodingEnabled): ?>
<source src="<?=$config->webmUrl?>/<?=$video->filename?>.webm" type="video/webm" />
<?php endif; ?>
<?php if ($theoraEncodingEnabled): ?>
<source src="<?=$config->theoraUrl?>/<?=$video->filename?>.ogg" type="video/ogg" />
<?php endif; ?>
</video>
</div>
<?php endif; ?>
<!-- END Video Player -->
<!-- BEGIN Playlist -->
<?php if ($playlist): ?>
<div id="playlist">
<header>
<a class="playlist-collapse pull-right hidden-lg" href="#playlist .video-list" data-toggle="collapse">
<span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<h5><?=Functions::cutOff($this->getService('Playlist')->getPlaylistName($playlist), 85)?></h5>
<?php $playlistAuthor = $this->getMapper('User')->getUserById($playlist->userId); ?>
<p class="small">
<span class="author"><?=Language::getText('by')?>: <a href="<?=BASE_URL?>/members/<?=$playlistAuthor->username?>/"><?=$playlistAuthor->username?></a></span>
<?=Language::getText('videos')?>: <?=count($playlistVideos)?>
</p>
</header>
<div class="scrollbar-outer">
<div class="video-list collapse in">
<?php $videoService = $this->getService('Video'); ?>
<?php foreach ($playlistVideos as $playlistVideo): ?>
<div class="video video-small media <?=($playlistVideo->videoId == $video->videoId) ? 'active' : ''?>">
<div class="media-left thumbnail">
<a href="<?=$videoService->getUrl($playlistVideo)?>/?playlist=<?=$playlist->playlistId?>" title="<?=$playlistVideo->title?>">
<span class="glyphicon glyphicon-play"></span>
<img class="media-object" width="100" height="56" src="<?=$config->thumbUrl?>/<?=$playlistVideo->filename?>.jpg" />
</a>
</div>
<div class="media-body">
<p class="media-heading"><a href="<?=$videoService->getUrl($playlistVideo)?>/?playlist=<?=$playlist->playlistId?>" title="<?=$playlistVideo->title?>"><?=$playlistVideo->title?></a></p>
<div class="small">
<?=Language::getText('by')?>:</strong> <a href="<?=BASE_URL?>/members/<?=$playlistVideo->username?>/" title="<?=$playlistVideo->username?>"><?=$playlistVideo->username?></a>
<span class="duration"><span class="glyphicon glyphicon-time"></span> <?=$playlistVideo->duration?></span>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
<!-- END Playlist -->
<!-- BEGIN Actions -->
<div class="panel panel-default actions">
<div class="panel-body row">
<div class="col-xs-12">
<h1><?=$video->title?></h1>
</div>
<div class="col-xs-6">
<p class="h4"><?=$video->views?> views</p>
<p>
<span class="like">
<span class="glyphicon glyphicon-thumbs-up"></span>
<?=$rating->likes?>
</span>
<span class="dislike">
<span class="glyphicon glyphicon-thumbs-down"></span>
<?=$rating->dislikes?>
</span>
</p>
</div>
<div class="col-xs-6 text-right">
<a class="rating" href="" data-video="<?php echo $video->videoId; ?>" data-rating="1" title="<?=Language::getText('like')?>">
<span class="glyphicon glyphicon-thumbs-up"></span>
<?=Language::getText('like')?>
</a>
<a class="rating" href="" data-video="<?php echo $video->videoId; ?>" data-rating="0" title="<?=Language::getText('dislike')?>">
<span class="glyphicon glyphicon-thumbs-down"></span>
<?=Language::getText('dislike')?>
</a>
</div>
</div>
</div>
<!-- END Actions -->
<!-- BEGIN Action Tabs -->
<ul class="nav nav-tabs">
<li><a href="#about" data-toggle="tab"><?=Language::getText('about')?></a></li>
<li><a href="#share" data-toggle="tab"><?=Language::getText('share')?></a></li>
<li><a href="#add-to-playlist" data-toggle="tab" id="playlist-toggle"><?=Language::getText('add')?></a></li>
<li><a href="" class="flag" data-type="video" data-id="<?=$video->videoId?>"><?=Language::getText('flag')?></a></li>
</ul>
<!-- END Action Tabs -->
<!-- BEGIN Tab Panes -->
<div class="tab-content">
<!-- BEGIN About Tab -->
<div class="tab-pane" id="about">
<h4><?=Language::getText('about')?></h4>
<div class="panel panel-default">
<div class="panel-body row">
<div class="col-xs-12 col-sm-10 media">
<div class="media-left">
<?php $avatar = $this->getService('User')->getAvatarUrl($member); ?>
<img class="media-object" width="65" height="65" src="<?=($avatar) ? $avatar : $this->options->themeUrl . '/images/avatar.png'?>" alt="<?=$member->username?>" />
</div>
<div class="media-body">
<p><strong><?=Language::getText('by')?>:</strong> <a href="<?=BASE_URL?>/members/<?=$member->username?>/" title="<?=$member->username?>"><?=$member->username?></a></p>
<p><strong><?=Language::getText('date_uploaded')?>:</strong> <?=date('m/d/Y', strtotime($video->dateCreated))?></p>
<p><strong><?=Language::getText('tags')?>:</strong>
<?php foreach ($video->tags as $value): ?>
<a href="<?=BASE_URL?>/search/?keyword=<?=$value?>" title="<?=$value?>"><?=$value?></a>
<?php endforeach; ?>
</p>
<?php if (!empty($attachments)): ?>
<p><strong><?=Language::getText('attachments')?>:</strong>
<?php foreach ($attachments as $attachment): ?>
<a
class="attachment"
href="<?php echo $this->getService('File')->getUrl($attachment); ?>"
title="<?php echo htmlspecialchars($attachment->name); ?> (<?php echo \Functions::formatBytes($attachment->filesize, 0); ?>)"
><i class="glyphicon glyphicon-paperclip"></i>
<?php echo htmlspecialchars($attachment->name); ?> (<?php echo \Functions::formatBytes($attachment->filesize, 0); ?>)
</a>
<?php endforeach; ?>
</p>
<?php endif; ?>
</div>
</div>
<div class="col-xs-12 col-sm-2">
<a href="" class="btn btn-primary subscribe" title="<?=Language::getText($subscribe_text)?>" data-type="<?=$subscribe_text?>" data-user="<?=$video->userId?>"><?=Language::getText($subscribe_text)?></a>
</div>
<p class="col-xs-12"><?=$video->description?></p>
</div>
</div>
</div>
<!-- END About Tab -->
<!-- BEGIN Share Tab -->
<div class="tab-pane" id="share">
<h4><?=Language::getText('share')?></h4>
<div class="panel panel-default">
<div class="panel-body row">
<div class="col-xs-4">
<!--
Share Widget Notes
- Please replace <your_app_id> in the FaceBook share URL with your actual app id obtained from FaceBook's website. This widget will not work until that happens.
- FaceBook, and Google + widgets require the video's URL to be publicly accessible, otherwise the widgets will not work.
-->
<!-- FACEBOOK BUTTON -->
<meta property="og:url" content="<?=$this->getService('Video')->getUrl($video)?>/" />
<meta property="og:title" content="<?=$video->title?>" />
<meta property="og:description" content="<?=$video->description?>" />
<meta property="og:image" content="<?=$config->thumbUrl?>/<?=$video->filename?>.jpg" />
<meta property="og:type" content="video" />
<meta property="og:video" content="<?=$config->h264Url?>/<?=$video->filename?>.mp4">
<meta property="og:video:type" content="video/mp4">
<meta property="og:video:width" content="640">
<meta property="og:video:height" content="360">
<script>if (window.location.hash === '#facebook-share') {window.close();}</script>
<a class="facebook" href="https://www.facebook.com/dialog/share?app_id=<your_app_id>&display=popup&href=<?=urlencode($this->getService('Video')->getUrl($video) . '/')?>&redirect_uri=<?=urlencode($this->getService('Video')->getUrl($video) . '/#facebook-share')?>" onClick="window.open(this.href, 'sharewindow','width=550,height=300');return false;">Share on Facebook</a>
<!-- TWITTER BUTTON -->
<a class="twitter" href="" onClick="window.open('https://twitter.com/share?url=<?=urlencode($this->getService('Video')->getUrl($video) . '/')?>&text=<?=urlencode(Functions::cutOff($video->description, 140))?>','sharewindow','width=650,height=400');return false;">Share on Twitter</a>
<!-- Google +BUTTON -->
<a class="google" href="https://plus.google.com/share?url=<?=urlencode($this->getService('Video')->getUrl($video) . '/')?>" onClick="javascript:window.open(this.href, 'sharewindow', 'height=600,width=600');return false;">Share</a>
</div>
<?php if ($video->disableEmbed == '0' && $video->gated == '0'): ?>
<!-- EMBED CODE -->
<div class="col-xs-8">
<p class="h4"><?=Language::getText('embed')?></p>
<p><?=Language::getText('embed_text')?></p>
<textarea class="form-control" rows="5" cols="58"><iframe src="<?=BASE_URL?>/embed/<?=$video->videoId?>/" width="480" height="360" frameborder="0" allowfullscreen></iframe></textarea>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- END Share Tab -->
<!-- BEGIN Add Tab -->
<div class="tab-pane" id="add-to-playlist">
<h4><?=Language::getText('add_to')?></h4>
<div class="panel panel-default">
<div class="panel-body">
<?php if ($loggedInUser): ?>
<div class="test col-xs-12 col-sm-5">
<div class="scrollbar-outer playlist-container" >
<ul>
<?php $playlistService = $this->getService('Playlist'); ?>
<li class="<?php echo $playlistService->checkListing($video, $favoritesList) ? 'added' : ''; ?>">
<i class="glyphicon glyphicon-ok-sign"></i>
<i class="glyphicon glyphicon-plus-sign"></i>
<a
data-playlist_id="<?=$favoritesList->playlistId?>"
href=""
data-video="<?php echo $video->videoId; ?>"
><?=Language::getText('favorites')?></a>
</li>
<li class="<?php echo $playlistService->checkListing($video, $watchLaterList) ? 'added' : ''; ?>">
<i class="glyphicon glyphicon-ok-sign"></i>
<i class="glyphicon glyphicon-plus-sign"></i>
<a
data-playlist_id="<?=$watchLaterList->playlistId?>"
href=""
data-video="<?php echo $video->videoId; ?>"
><?=Language::getText('watch_later')?></a>
</li>
<?php if (count($userPlaylists) > 0): ?>
<li><strong><?=Language::getText('playlists')?></strong></li>
<?php foreach ($userPlaylists as $userPlaylist): ?>
<li class="<?php echo $playlistService->checkListing($video, $userPlaylist) ? 'added' : ''; ?>">
<i class="glyphicon glyphicon-ok-sign"></i>
<i class="glyphicon glyphicon-plus-sign"></i>
<a
data-playlist_id="<?=$userPlaylist->playlistId?>"
href=""
data-video="<?php echo $video->videoId; ?>"
><?=$userPlaylist->name?> (<?=count($userPlaylist->entries)?>)</a>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
</div>
<div class="col-xs-12 col-sm-5 col-sm-offset-2">
<p class="h4"><?=Language::getText('create_new_playlist')?></p>
<form>
<div class="form-group">
<label class="control-label"><?=Language::getText('playlist_name')?>:</label>
<input class="form-control" type="text" name="playlist_name" />
</div>
<div class="form-group">
<label class="control-label"><?=Language::getText('visibility')?>:</label>
<select class="form-control" name="playlist_visibility">
<option value="public"><?=Language::getText('public')?></option>
<option value="private"><?=Language::getText('private')?></option>
</select>
</div>
<input type="hidden" name="action" value="create" />
<input type="hidden" name="video_id" value="<?=$video->videoId?>" />
<input class="btn btn-primary" type="submit" value="<?=Language::getText('create_playlist_button')?>" />
</form>
</div>
<?php else: ?>
<?=Language::getText('playlist_login', array('url' => BASE_URL . '/login/?redirect=' . urlencode($this->getService('Video')->getUrl($video))))?>
<?php endif; ?>
</div>
</div>
</div>
<!-- END Add Tab -->
</div>
<!-- END Tab Panes -->
<!-- BEGIN Comments Header -->
<div class="row" id="comments-header">
<h4 class="col-xs-6">
<?=Language::getText('comments_header')?>
<?=($video->commentsClosed) ? '' : ' (<span class="comment-total">' . $commentCount . '</span>)'?>
</h4>
<?php if (!$loggedInUser && $config->enableRegistrations): ?>
<p class="col-xs-6 text-right"><?=Language::getText('comments_login_register', array('login_link' => BASE_URL . '/login/?redirect=' . urlencode($this->getService('Video')->getUrl($video)), 'register_link' => BASE_URL . '/register/'))?></p>
<?php elseif (!$loggedInUser && !$config->enableRegistrations): ?>
<p class="col-xs-6 text-right"><?=Language::getText('comments_login', array('login_link' => BASE_URL . '/login/?redirect=' . urlencode($this->getService('Video')->getUrl($video))))?></p>
<?php endif; ?>
</div>
<!-- END Comments Header -->
<!-- BEGIN Comments Container -->
<div id="comments" class="panel panel-default">
<div class="panel-body">
<?php if ($video->commentsClosed): ?>
<?=Language::getText('comments_closed')?>
<?php else: ?>
<?php if ($loggedInUser): ?>
<!-- BEGIN Comments Form -->
<div class="collapsed comment-form comment-form-main row">
<form action="" method="post">
<div class="col-xs-12 collapsed-show">
<textarea class="form-control" rows="2" cols="50" name="comments" placeholder="<?=Language::getText('comments_button')?>"></textarea>
</div>
<div class="col-xs-12 collapsed-hide">
<textarea class="form-control" rows="4" cols="50" name="comments" placeholder="<?=Language::getText('comments')?>"></textarea>
</div>
<div class="col-xs-6 col-sm-3 collapsed-hide">
<a class="cancel" href=""><?=Language::getText('cancel')?></a>
</div>
<div class="col-xs-6 col-sm-3 col-sm-offset-6 text-right collapsed-hide">
<input type="hidden" name="videoId" value="<?=$video->videoId?>" />
<input type="hidden" name="parentCommentId" value="" />
<input class="btn btn-primary" type="submit" name="button" value="<?=Language::getText('comments_button')?>" />
</div>
</form>
</div>
<!-- END Comments Form -->
<?php endif; ?>
<!-- BEGIN Comments List -->
<div class="comment-list">
<?php if ($commentCount > 0): ?>
<?php foreach ($commentCardList as $commentCard): ?>
<?php $commentIndentClass = getCommentIndentClass($commentCard->comment); ?>
<div class="media comment <?=$commentIndentClass?>" data-comment="<?=$commentCard->comment->commentId?>">
<div class="media-left">
<img class="media-object" width="60" height="60" src="<?=($commentCard->avatar) ? $commentCard->avatar : $this->options->themeUrl . '/images/avatar.png'?>" />
</div>
<div class="media-body row">
<div class="col-xs-8">
<a href="<?=getUserProfileLink($commentCard->author)?>" class="comment-author"><?=$commentCard->author->username?></a>
<span class="comment-date"><?=date('m/d/Y', strtotime($commentCard->comment->dateCreated))?></span>
<?php if ($commentCard->comment->parentId != 0): ?>
<span class="comment-reply"><?=Language::getText('reply_to')?>
<a class="comment-parent-author" href="<?=getUserProfileLink($commentCard->parentAuthor)?>"><?=$commentCard->parentAuthor->username?></a>
</span>
<?php endif; ?>
</div>
<div class="col-xs-4 comment-action text-right">
<a class="reply" href=""><?=Language::getText('reply')?></a>
<a class="flag" data-type="comment" data-id="<?=$commentCard->comment->commentId?>" href=""><?=Language::getText('report_abuse')?></a>
</div>
<p class="col-xs-12 comment-text"><?=nl2br($commentCard->comment->comments)?></p>
</div>
</div>
<?php endforeach; ?>
<?php else: ?>
<p class="no-comments"><?=Language::getText('no_comments')?></p>
<?php endif; ?>
</div>
<!-- END Comments List -->
<?php endif; ?>
</div>
<?php if ($commentCount > 5): ?>
<div class="panel-footer text-center load-more">
<button
class="btn btn-primary load-more-btn"
data-total="<?php echo $commentCount; ?>"
data-video="<?php echo $video->videoId; ?>"
data-loading-text="<?=Language::getText('loading')?>"
><?=Language::getText('load_more')?></button>
</div>
<?php endif; ?>
</div>
<!-- END Comments Container -->
</div>
<!-- END PLAY LEFT -->
<!-- BEGIN PLAY RIGHT -->
<div class="col-md-4 play-right">
<?php $this->Block ('ad300.phtml'); ?>
<!-- BEGIN RELATED VIDEOS -->
<div class="related-videos">
<h4><?=Language::getText('suggestions_header')?></h4>
<?php if (count($relatedVideos) > 0): ?>
<div class="video-list">
<?php $videoService = $this->getService('Video'); ?>
<?php foreach ($relatedVideos as $relatedVideo): ?>
<div class="video video-medium media">
<div class="media-left thumbnail">
<a href="<?=$videoService->getUrl($relatedVideo)?>/" title="<?=$relatedVideo->title?>">
<span class="glyphicon glyphicon-play"></span>
<img class="media-object" width="140" height="78" src="<?=$config->thumbUrl?>/<?=$relatedVideo->filename?>.jpg" />
</a>
</div>
<div class="media-body">
<p class="media-heading"><a href="<?=$videoService->getUrl($relatedVideo)?>/" title="<?=$relatedVideo->title?>"><?=$relatedVideo->title?></a></p>
<div class="small">
<?=Language::getText('by')?>: <a href="<?=BASE_URL?>/members/<?=$relatedVideo->username?>/" title="<?=$relatedVideo->username?>"><?=$relatedVideo->username?></a>
<span class="duration"><span class="glyphicon glyphicon-time"></span> <?=$relatedVideo->duration?></span>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php else: ?>
<strong><?=Language::getText('no_suggestions')?></strong>
<?php endif; ?>
</div>
<!-- END RELATED VIDEOS -->
</div>
<!-- END PLAY RIGHT -->
</div>