-
Notifications
You must be signed in to change notification settings - Fork 1
/
airdates.php
92 lines (88 loc) · 3.13 KB
/
airdates.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
<?php
include_once "auth.php";
include_once "check.php";
include_once "./template/config.php";
include_once "./template/functions.php";
include_once "./template/Series/_SERIEN.php";
include_once "globals.php";
if (!isAdmin()) { exit; }
?>
<head>
<?php include("head.php"); ?>
<script type="text/javascript">
<?php
echo "\t\t".'var bindF = false;'.";\r\n";
echo "\t\t".'var isAdmin = '.(isAdmin() ? '1' : '0').";\r\n";
echo "\t\t".'var xbmcRunning = '.(isAdmin() && xbmcRunning() ? '1' : '0').";\r\n";
echo "\t\t".'var newMovies = false;'.";\r\n";
?>
$(document).ready(function() {
initShowFancies();
});
</script>
</head>
<body id="xbmcDB" style="overflow-x:hidden; overflow-y:auto;">
<?php
#main
#$maself = $_SERVER['PHP_SELF'];
#postNavBar($maself == '/index.php');
$dbh = getPDO();
$SQL = $GLOBALS['SerienSQL'].';';
$serien = fetchSerien($SQL, null, $dbh);
$serien->sortSerienAirdateAsc();
#echo "\t".'<div class="tabDiv" onmouseover="closeNavs();">'."\r\n";
fillTable($serien, $dbh);
#echo "\t".'</div>'."\r\n";
?>
</body>
<?php
function fillTable($serien, $dbh) {
echo "\t".'<table id="showsTable" class="film">'."\r\n";
echo "\t".'<tbody id="showsBody">'."\r\n";
postSerien($serien);
echo "\t".'</tbody>'."\r\n";
echo "\t".'</table>'."\r\n";
}
function postSerien($serien) {
$counter = 1;
foreach ($serien->getSerien() as $serie) {
if (!is_object($serie)) { continue; }
if (!$serie->isRunning()) { continue; }
$counter = postSerie($serie, $counter);
}
}
function postSerie($serie, $counter) {
$airDate = null;
$daysLeft = -1;
$fCol = '';
$idShow = $serie->getIdShow();
$checkAirDate = isset($GLOBALS['CHECK_NEXT_AIRDATE']) ? $GLOBALS['CHECK_NEXT_AIRDATE'] : false;
if ($checkAirDate) {
$airDate = $serie->getNextAirDateStr();
$daysLeft = daysLeft(addRlsDiffToDate($airDate));
$fCol = getDateColor($airDate, $daysLeft);
$airDate = toEuropeanDateFormat(addRlsDiffToDate($airDate));
}
if (empty($airDate)) { return $counter; }
$ANONYMIZER = $GLOBALS['ANONYMIZER'];
$EP_SEARCH = isset($GLOBALS['EP_SEARCH']) ? $GLOBALS['EP_SEARCH'] : null;
$epSearch = null;
if (!empty($EP_SEARCH)) {
$name = str_replace ("'", "", $serie->getName());
$nextEp = fetchNextEpisodeFromDB($idShow);
$enNum = !empty($nextEp) ? getFormattedSE($nextEp['s'], $nextEp['e']) : null;
$epSearch = !empty($enNum) ? $ANONYMIZER.$EP_SEARCH.$name.'+'.$enNum : null;
}
$title = $daysLeft > 0 ?
($daysLeft == 1 ? 'Tomorrow' : 'In '.$daysLeft.' days') :
($daysLeft < 0 ? 'Missed episode' : 'Today');
$eSrch1 = !empty($epSearch) ? '<a tabindex="-1" class="fancy_iframe4" href="'.$epSearch.'">' : '';
$eSrch2 = !empty($epSearch) ? '</a>' : '';
echo "\t\t".'<tr id="iD'.$idShow.'" class="sTR showShowInfo">';
echo '<td class="righto">'.$counter.'</td>';
echo '<td id="epl_'.$idShow.'"><span class="showName">'.$serie->getName().'</span></td>';
echo '<td style="padding-right:15px; margin:0px;">'.$eSrch1.'<span class="airdate sInfoSize" style="vertical-align:middle; cursor:default; '.$fCol.getDateFontsize($daysLeft).'" title="'.$title.'">'.$airDate.'</span>'.$eSrch2.'</td>';
echo '</tr>'."\r\n";
return ++$counter;
}
?>