forked from WWBN/AVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchannelProgram.php
720 lines (669 loc) · 42 KB
/
channelProgram.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
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
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
<?php
global $global, $config, $isChannel;
$isChannel = 1; // still workaround, for gallery-functions, please let it there.
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (empty($_GET['program_id'])) {
if (User::isLogged()) {
$_GET['user_id'] = User::getId();
} else {
return false;
}
} else {
$program = new PlayList($_GET['program_id']);
$_GET['user_id'] = $program->getUsers_id();
}
$user_id = $_GET['user_id'];
$publicOnly = true;
$isMyChannel = false;
if (User::isLogged() && $user_id == User::getId()) {
$publicOnly = false;
$isMyChannel = true;
}
$programs = PlayList::getAllFromUser($user_id, $publicOnly, false, @$_GET['program_id']);
if (empty($programs)) {
$programs = PlayList::getAllFromUser($user_id, $publicOnly);
} else {
$videosArrayId = PlayList::getVideosIdFromPlaylist($_GET['program_id']);
$videos_id = @$videosArrayId[0];
}
$playListsObj = AVideoPlugin::getObjectData("PlayLists");
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo __("Program") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<style>
.galleryVideo .panel{
border-color: transparent;
box-shadow: none;
}
.galleryVideo .panel .panel-body {
padding: 5px;
}
</style>
<?php
if (!empty($videos_id)) {
getOpenGraph($videos_id);
}
?>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid gallery">
<?php
$channelName = @$_GET['channelName'];
unset($_GET['channelName']);
$startC = microtime(true);
foreach ($programs as $key => $program) {
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
$videosArrayId = PlayList::getVideosIdFromPlaylist($program['id']);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
if (empty($videosArrayId) && ($program['status'] == "favorite" || $program['status'] == "watch_later")) {
unset($programs[$key]);
continue;
} elseif (empty($videosArrayId)) {
$videosP = [];
} else {
$videosP = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
}//var_dump($videosArrayId, $videosP);exit;
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//_error_log("channelPlaylist videosP: ".json_encode($videosP));
$videosP = PlayList::sortVideos($videosP, $videosArrayId);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//_error_log("channelPlaylist videosP2: ".json_encode($videosP));
//_error_log("channelPlaylist videosArrayId: ".json_encode($videosArrayId));
$playListButtons = AVideoPlugin::getPlayListButtons($program['id']);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
$isASerie = PlayLists::isPlayListASerie($program['id']);
if (empty($isASerie)) {
$currentSerieVideos_id = 0;
} else {
$currentSerieVideos_id = $isASerie['id'];
} ?>
<br>
<div class="panel panel-default program" playListId="<?php echo $program['id']; ?>">
<div class="panel-heading">
<strong class="playlistName"><?php echo $program['name']; ?> </strong>
<?php
if (!empty($videosArrayId)) {
$link = PlayLists::getLink($program['id']); ?>
<a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" ><span class="fa fa-play"></span> <?php echo __("Play All"); ?></a><?php echo $playListButtons; ?>
<?php
echo PlayLists::getPlayLiveButton($program['id']);
}
if ($isMyChannel) {
?>
<script>
$(function () {
$("#sortable<?php echo $program['id']; ?>").sortable({
items: "li",
stop: function (event, ui) {
modal.showPleaseWait();
saveSortable(this, <?php echo $program['id']; ?>);
}
});
$("#sortable<?php echo $program['id']; ?>").disableSelection();
});
</script>
<div class="dropdown" style="display: inline-block;">
<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown"><?php echo __("Auto Sort"); ?>
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=1"><?php echo __("Alphabetical"); ?> A-Z</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=2"><?php echo __("Alphabetical"); ?> Desc Z-A</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=3"><?php echo __("Created Date"); ?> 0-9</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=4"><?php echo __("Created Date"); ?> Desc 9-0</a></li>
</ul>
</div>
<div class="pull-right btn-group" style="display: inline-flex;">
<?php
echo PlayLists::getShowOnTVSwitch($program['id']); ?>
<?php
if ($program['status'] != "favorite" && $program['status'] != "watch_later") {
if (AVideoPlugin::isEnabledByName("PlayLists")) {
?>
<button class="btn btn-xs btn-default" onclick="copyToClipboard($('#playListEmbedCode<?php echo $program['id']; ?>').val());setTextEmbedCopied();" data-toggle="tooltip" title="<?php echo __('Copy embed code'); ?>" >
<span class="fa fa-copy"></span>
<span id="btnEmbedText" class="hidden-xs hidden-sm"><?php echo __("Copy embed code"); ?></span></button>
<input type="hidden" id="playListEmbedCode<?php echo $program['id']; ?>" value='<iframe width="640" height="480" style="max-width: 100%;max-height: 100%;" src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/embed.php?playlists_id=<?php echo $program['id']; ?>" frameborder="0" allowfullscreen="allowfullscreen" allow="autoplay"></iframe>'/>
<?php
}
if (User::canUpload()) {
?>
<button class="btn btn-xs btn-info seriePlaylist" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Add this playlist in your video library'); ?>" >
<i class="fas fa-film"></i> <span class="hidden-xs hidden-sm"><?php echo __("Serie"); ?></span>
</button>
<div id="seriePlaylistModal" class="modal fade" tabindex="-1" role="dialog" >
<div class="modal-dialog" role="document" style="width: 90%; margin: auto;">
<div class="modal-content">
<div class="modal-body">
<iframe style="width: 100%; height: 80vh;" src="about:blank">
</iframe>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(function () {
$('.seriePlaylist').click(function () {
$($('#seriePlaylistModal').find('iframe')[0]).attr('src', 'about:blank');
var playlist_id = $(this).attr('playlist_id');
$($('#seriePlaylistModal').find('iframe')[0]).attr('src', '<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/playListToSerie.php?playlist_id=' + playlist_id);
$('#seriePlaylistModal').modal();
//$('#seriePlaylistModal').modal('hide');
});
});
</script>
<?php
} ?>
<button class="btn btn-xs btn-danger deletePlaylist" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Delete'); ?>" ><i class="fas fa-trash"></i> <span class="hidden-xs hidden-sm"><?php echo __("Delete"); ?></span></button>
<button class="btn btn-xs btn-primary renamePlaylist" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Rename'); ?>" ><i class="fas fa-edit"></i> <span class="hidden-xs hidden-sm"><?php echo __("Rename"); ?></span></button>
<button class="btn btn-xs btn-success" onclick="openVideoSearch(<?php echo $currentSerieVideos_id; ?>)" playlist_id="<?php echo $program['id']; ?>" data-toggle="tooltip" title="<?php echo __('Add to Program'); ?>" ><i class="fas fa-plus"></i> <span class="hidden-xs hidden-sm"><?php echo __("Add"); ?></span></button>
<button class="btn btn-xs btn-default statusPlaylist statusPlaylist<?php echo $program['id']; ?>" playlist_id="<?php echo $program['id']; ?>" style="" >
<span class="fa fa-lock" id="statusPrivate<?php echo $program['id']; ?>" style="color: red; <?php
if ($program['status'] !== 'private') {
echo ' display: none;';
} ?> " data-toggle="tooltip" title="<?php echo __('This playlist is private, click to make it public'); ?>" ></span>
<span class="fa fa-globe" id="statusPublic<?php echo $program['id']; ?>" style="color: green; <?php
if ($program['status'] !== 'public') {
echo ' display: none;';
} ?>" data-toggle="tooltip" title="<?php echo __('This playlist is public, click to make it unlisted'); ?>" ></span>
<span class="fa fa-eye-slash" id="statusUnlisted<?php echo $program['id']; ?>" style="color: gray; <?php
if ($program['status'] !== 'unlisted') {
echo ' display: none;';
} ?>" data-toggle="tooltip" title="<?php echo __('This playlist is unlisted, click to make it private'); ?>" ></span>
</button>
<?php
} ?>
</div>
<?php
} ?>
</div>
<?php
if (!empty($videosArrayId)) {
?>
<div class="panel-body">
<?php
$_REQUEST['user_id'] = $program['users_id'];
$_REQUEST['playlists_id'] = $program['id'];
include $global['systemRootPath'] . 'plugin/PlayLists/epg.html.php'; ?>
<div id="sortable<?php echo $program['id']; ?>" style="list-style: none;">
<?php
$count = 0;
foreach ($videosP as $value) {
$episodeLink = "{$global['webSiteRootURL']}program/{$program['id']}/{$count}";
$count++;
if (empty($value['created'])) {
continue;
}
$img_portrait = ($value['rotation'] === "90" || $value['rotation'] === "270") ? "img-portrait" : "";
$name = User::getNameIdentificationById($value['users_id']);
$images = Video::getImageFromFilename($value['filename'], $value['type'], true);
$imgGif = $images->thumbsGif;
$poster = $images->thumbsJpg;
$class = '';
$style = '';
if ($count > 6) {
$class = "showMoreLess{$program['id']}";
$style = "display: none;";
} ?>
<li class="col-lg-2 col-md-4 col-sm-4 col-xs-6 galleryVideo showMoreLess <?php echo $class; ?> " id="<?php echo $value['id']; ?>" style="padding: 1px; <?php echo $style; ?>">
<div class="panel panel-default" playListId="<?php echo $program['id']; ?>" style="min-height: 215px;">
<div class="panel-body" style="overflow: hidden;">
<a class="aspectRatio16_9" href="<?php echo $episodeLink; ?>" title="<?php echo $value['title']; ?>" style="margin: 15px 0; overflow: visible;" >
<img src="<?php echo $poster; ?>" alt="<?php echo $value['title']; ?>" class="img img-responsive <?php echo $img_portrait; ?> rotate<?php echo $value['rotation']; ?>" />
<?php
if ($value['type'] !== 'pdf' && $value['type'] !== 'article' && $value['type'] !== 'serie') {
?>
<span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
<div class="progress" style="height: 3px; margin-bottom: 2px;">
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $value['progress']['percent'] ?>%;" aria-valuenow="<?php echo $value['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<?php
} ?>
</a>
<a class="h6 galleryLink hrefLink" href="<?php echo $episodeLink; ?>" title="<?php echo $value['title']; ?>">
<strong class="title"><?php echo $value['title']; ?></strong>
</a>
<div class="galeryDetails" style="min-height: 60px;">
<div class="galleryTags">
<?php
$value['tags'] = Video::getTags($value['id']);
foreach ($value['tags'] as $value2) {
if (is_array($value2)) {
$value2 = (object) $value2;
}
if ($value2->label === __("Group")) {
?>
<span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span>
<?php
}
} ?>
</div>
<?php
if (empty($advancedCustom->doNotDisplayViews)) {
?>
<div>
<i class="fa fa-eye"></i>
<span itemprop="interactionCount">
<?php echo number_format($value['views_count'], 0); ?> <?php echo __("Views"); ?>
</span>
</div>
<?php
} ?>
<div>
<i class="far fa-clock"></i>
<?php
echo humanTiming(strtotime($value['videoCreation'])), " ", __('ago'); ?>
</div>
<div>
<i class="fa fa-user"></i>
<?php
echo $name; ?>
</div>
<?php
if (Video::canEdit($value['id'])) {
?>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>mvideos?video_id=<?php echo $value['id']; ?>"><i class="fa fa-edit"></i> <?php echo __("Edit Video"); ?></a>
</div>
<?php
} ?>
<?php
if ($isMyChannel) {
?>
<div>
<span style=" cursor: pointer;" class="btn-link text-primary removeVideo" playlist_id="<?php echo $program['id']; ?>" video_id="<?php echo $value['id']; ?>">
<i class="fa fa-trash"></i> <?php echo __("Remove"); ?>
</span>
</div>
<div>
<span playlist_id="<?php echo $program['id']; ?>" video_id="<?php echo $value['id']; ?>">
<i class="fas fa-sort-numeric-down"></i> <?php echo __("Sort"); ?>
<input type="number" step="1" class="video_order" value="<?php echo intval($program['videos'][$count - 1]['video_order']); ?>" style="max-width: 50px;">
<button class="btn btn-sm btn-xs sortNow"><i class="fas fa-check-square"></i></button>
</span>
</div>
<?php
} ?>
</div>
</div>
</div>
</li>
<?php
if ($count % 6 === 0) {
echo '<div class="clearfix hidden-md hidden-sm hidden-xs"></div>';
}
if ($count % 3 === 0) {
echo '<div class="clearfix hidden-lg hidden-xs"></div>';
}
if ($count % 2 === 0) {
echo '<div class="clearfix hidden-md hidden-sm hidden-lg"></div>';
}
} ?>
</div>
</div>
<div class="panel-footer">
<?php
if (count($programs) > 1) {
?>
<button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle();
$('.<?php echo $class; ?>').slideDown();"><i class="fas fa-angle-down"></i> <?php echo __('Show More'); ?></button>
<button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle();
$('.<?php echo $class; ?>').slideUp();" style="display: none;"><i class="fas fa-angle-up"></i> <?php echo __('Show Less'); ?></button>
<?php
}
if ($isMyChannel && !empty($videosArrayId)) {
?>
<span class="label label-info" ><i class="fa fa-info-circle"></i> <?php echo __("Drag and drop to sort"); ?></span>
<?php
} ?>
</div>
<?php
} ?>
</div>
<?php
}
$_GET['channelName'] = $channelName;
?>
<div class="modal fade" id="videoSearchModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<div class="panel panle-default">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#addSeries"><i class="fas fa-list"></i> <?php echo __('Series'); ?></a></li>
<li><a data-toggle="tab" href="#addVideos"><i class="fas fa-video"></i> <?php echo __('Videos'); ?></a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div id="addSeries" class="tab-pane fade in active">
<form id="serieSearch-form" name="search-form" action="<?php echo $global['webSiteRootURL'] . ''; ?>" method="get">
<div id="custom-search-input">
<div class="input-group col-md-12">
<input type="search" name="searchPhrase" id="serieSearch-input" class="form-control input-lg" placeholder="<?php echo __('Search Serie'); ?>" value="">
<span class="input-group-btn">
<button class="btn btn-info btn-lg" type="submit">
<i class="fas fa-search"></i>
</button>
</span>
</div>
</div>
</form>
<hr>
<div id="searchSerieResult"></div>
</div>
<div id="addVideos" class="tab-pane fade">
<form id="videoSearch-form" name="search-form" action="<?php echo $global['webSiteRootURL'] . ''; ?>" method="get">
<div id="custom-search-input">
<div class="input-group col-md-12">
<input type="search" name="searchPhrase" id="videoSearch-input" class="form-control input-lg" placeholder="<?php echo __('Search Videos'); ?>" value="">
<span class="input-group-btn">
<button class="btn btn-info btn-lg" type="submit">
<i class="fas fa-search"></i>
</button>
</span>
</div>
</div>
</form>
<hr>
<div id="searchVideoResult"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var timoutembed;
function setTextEmbedCopied() {
clearTimeout(timoutembed);
$("#btnEmbedText").html("<?php echo __("Copied!"); ?>");
timoutembed = setTimeout(function () {
$("#btnEmbedText").html("<?php echo __("Copy embed code"); ?>");
}, 3000);
}
function saveSortable($sortableObject, playlist_id) {
var list = $($sortableObject).sortable("toArray");
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php',
data: {
"list": list,
"playlist_id": playlist_id
},
type: 'post',
success: function (response) {
//$("#channelPlaylists").load(webSiteRootURL + "view/channelPlaylist.php?channelName=" + channelName);
modal.hidePleaseWait();
}
});
}
function sortNow($t, position) {
var $this = $($t).closest('.galleryVideo');
var $uiDiv = $($t).closest('.ui-sortable');
var $playListId = $($t).closest('.panel').attr('playListId');
var $list = $($t).closest('.ui-sortable').find('li');
if (position < 0) {
return false;
}
if (position === 0) {
$this.slideUp(500, function () {
$this.insertBefore($this.siblings(':eq(0)'));
saveSortable($uiDiv, $playListId);
}).slideDown(500);
} else if ($list.length - 1 > position) {
$this.slideUp(500, function () {
$this.insertBefore($this.siblings(':eq(' + position + ')'));
saveSortable($uiDiv, $playListId);
}).slideDown(500);
} else {
$this.slideUp(500, function () {
$this.insertAfter($this.siblings(':eq(' + ($list.length - 2) + ')'));
saveSortable($uiDiv, $playListId);
}).slideDown(500);
}
}
var currentObject;
$(function () {
<?php
if (count($programs) <= 1 || !empty($palyListsObj->expandPlayListOnChannels)) {
?>
$('.showMoreLess').slideDown();
$('.showMoreLessBtn').toggle();
<?php
}
?>
$('.removeVideo').click(function () {
currentObject = this;
swal({
title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then(function (willDelete) {
if (willDelete) {
modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id');
var video_id = $(currentObject).attr('video_id');
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemoveVideo.php',
data: {
"playlist_id": playlist_id,
"video_id": video_id
},
type: 'post',
success: function (response) {
reloadPlayLists();
$(".playListsIds" + video_id).prop("checked", false);
$(currentObject).closest('.galleryVideo').fadeOut();
modal.hidePleaseWait();
}
});
}
});
});
$('.deletePlaylist').click(function () {
currentObject = this;
swal({
title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then(function (willDelete) {
if (willDelete) {
modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id');
console.log(playlist_id);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemove.php',
data: {
"playlist_id": playlist_id
},
type: 'post',
success: function (response) {
$(currentObject).closest('.panel').slideUp();
modal.hidePleaseWait();
}
});
}
});
});
$('.statusPlaylist').click(function () {
var playlist_id = $(this).attr('playlist_id');
var status = "public";
if ($('#statusPrivate' + playlist_id).is(":visible")) {
status = "public";
$('.statusPlaylist' + playlist_id + ' span').hide();
$('#statusPublic' + playlist_id).fadeIn();
} else if ($('#statusPublic' + playlist_id).is(":visible")) {
status = "unlisted";
$('.statusPlaylist' + playlist_id + ' span').hide();
$('#statusUnlisted' + playlist_id).fadeIn();
} else if ($('#statusUnlisted' + playlist_id).is(":visible")) {
status = "private";
$('.statusPlaylist' + playlist_id + ' span').hide();
$('#statusPrivate' + playlist_id).fadeIn();
}
modal.showPleaseWait();
console.log(playlist_id);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistStatus.php',
data: {
"playlist_id": playlist_id,
"status": status
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
$('.renamePlaylist').click(function () {
currentObject = this;
swal({
text: "<?php echo __("Change Playlist Name"); ?>!",
content: "input",
button: {
text: "<?php echo __("Confirm Playlist name"); ?>",
closeModal: false,
},
}).then(function (name) {
if (!name)
throw null;
modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id');
console.log(playlist_id);
return fetch('<?php echo $global['webSiteRootURL']; ?>objects/playlistRename.php?playlist_id=' + playlist_id + '&name=' + encodeURI(name));
}).then(function (results) {
return results.json();
}).then(function (response) {
if (response.error) {
avideoAlert("<?php echo __("Sorry!"); ?>", response.msg, "error");
modal.hidePleaseWait();
} else {
$(currentObject).closest('.panel').find('.playlistName').text(response.name);
swal.stopLoading();
swal.close();
modal.hidePleaseWait();
}
}).catch(function (err) {
if (err) {
swal("Oh noes!", "The AJAX request failed!", "error");
} else {
swal.stopLoading();
swal.close();
}
modal.hidePleaseWait();
});
;
});
$('.sortNow').click(function () {
var $val = $(this).siblings("input").val();
sortNow(this, $val);
});
$('.video_order').keypress(function (e) {
if (e.which == 13) {
sortNow(this, $(this).val());
}
});
});
</script>
<!--
channelPlaylist
<?php
$timesC[__LINE__] = microtime(true) - $startC;
$startC = microtime(true);
foreach ($timesC as $key => $value) {
echo "Line: {$key} -> {$value}\n";
}
?>
-->
</div><!--/.container-->
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
var currentSerieVideos_id = 0;
var videoWasAdded = false;
function openVideoSearch(videos_id) {
currentSerieVideos_id = videos_id;
$('#videoSearchModal').modal();
}
$(document).ready(function () {
$('#videoSearch-form').submit(function (event) {
event.preventDefault();
videoSearch(0);
});
$('#serieSearch-form').submit(function (event) {
event.preventDefault();
videoSearch(1);
});
$('#videoSearchModal').on('hidden.bs.modal', function () {
if (videoWasAdded) {
modal.showPleaseWait();
location.reload();
}
});
});
function videoSearch(is_serie) {
modal.showPleaseWait();
var searchPhrase = $('#videoSearch-input').val();
if (is_serie) {
searchPhrase = $('#serieSearch-input').val();
}
$.ajax({
url: webSiteRootURL + 'plugin/API/get.json.php?APIName=video&rowCount=10&is_serie=' + is_serie + '&searchPhrase=' + searchPhrase,
success: function (response) {
console.log(response);
var resultId = '#searchVideoResult';
if (is_serie) {
resultId = '#searchSerieResult';
}
$(resultId).empty();
var rows = response.response.rows;
for (var i in rows) {
if (typeof rows[i] !== 'object') {
continue;
}
if (rows[i].id == currentSerieVideos_id) {
continue;
}
var html = '<button type="button" class="btn btn-default btn-block" data-toggle="tooltip" title="<?php echo __('Add To Serie'); ?>" onclick="addToSerie(<?php echo $program['id']; ?>, ' + rows[i].id + ');" id="videos_id_' + rows[i].id + '_playlists_id_<?php echo $program['id']; ?>" ><i class="fas fa-plus"></i> ' + rows[i].title + '</button>';
$(resultId).append(html);
}
modal.hidePleaseWait();
}
});
}
function addToSerie(playlists_id, videos_id) {
addVideoToPlayList(videos_id, true, playlists_id);
$('#videos_id_' + videos_id + '_playlists_id_' + playlists_id).fadeOut();
videoWasAdded = true;
}
</script>
</body>
</html>