-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmovies.php
149 lines (95 loc) · 3.7 KB
/
movies.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
<?php
session_start();
include("includes/functions.php");
include("includes/classes/DisplayElements.php");
$user_data = check_login();
$HTML = new SiteGenerator("Movies Page","background3");
$HTML->generateSiteStart();
?>
<div class ="fade-in">
<?php
// check if series screen or movies screen
if ($_GET["site"] == "series")
{
$showMovies = 0;
//mark as series tab for correct redirectment after editing watchlist
$location = 2;
}
else
{
$showMovies = 1;
//mark as movies tab for correct redirectment after editing watchlist
$location = 1;
}
// MOVED CLASSES FOR BOXES TO includes/classes/DisplayElements.php
if(($_GET["action"] == "sub")AND(isset($_GET["mov"]))AND(isset($_GET["type"]))){
$location = 4;
// if a subcategory from the header got clicked do this!!!
$showMovies = $_GET["mov"];
$GROUP = $_GET["type"];
$neededGroupID = 0;
switch($GROUP){
// assign the group id's from the db to the term
case("science"):
$neededGroupID = 8;
break;
case("slasher"):
$neededGroupID = 1;
break;
case("haunted"):
$neededGroupID = 3;
break;
default:
// ERROR MESSAGE
break;
}
$getGroupResult = getGroup($neededGroupID, $showMovies);
//title and list of results of ids get assigned to proper names
list($title, $results) = $getGroupResult;
$groupElements = array();
// get Data for each specific Movie that is shown
foreach($results as $elemtNum => $id){
// get picture dorm movie ID
$tmp = getEntityBoxInfos($id[0]);
array_push($groupElements, new vidBoxElement($tmp["picture"],$id[0],$location, $arrayOfGroupID));
}
// create new object
$OutputGroup = new vidBoxWrapper($title, $value, $groupElements);
// print out
echo $OutputGroup->getString();
}
else{
//the regular usage of movies.php (multiple categories)
//get IDs for Groups
$numGroups = 6;
// Workaround to have same display after adding / removing from watchlist
if(isset($_GET["objlist"])){
$arrayOfGroupID = explode(":",$_GET["objlist"], $numGroups);
}
// first PARAMETER = MOVIE (0 or 1)
else{ // second PARAMETER = HOW MANY SHALL BE DISPLYED
$arrayOfGroupID = getRandomGroupIDs($showMovies, $numGroups);
}
foreach ($arrayOfGroupID as $key => $value){
// get Data of each group
$getGroupResult = getGroup($value[0], $showMovies);
//title and list of results of ids get assigned to proper names
list($title, $results) = $getGroupResult;
$groupElements = array();
// get Data for each specific Movie that is shown
foreach($results as $elemtNum => $id){
// get picture dorm movie ID
$tmp = getEntityBoxInfos($id[0]);
array_push($groupElements, new vidBoxElement($tmp["picture"],$id[0],$location, $arrayOfGroupID));
}
// create new object
$OutputGroup = new vidBoxWrapper($title, $value, $groupElements);
// print out
echo $OutputGroup->getString();
}
echo "<h4 class='addwatchlist'>".$showMovies."</h4></div>";
}
require_once("includes/header.php");
require_once("includes/footer.php");
$HTML->generateSiteEnd();
?>