-
Notifications
You must be signed in to change notification settings - Fork 0
/
topic.php
119 lines (109 loc) · 5 KB
/
topic.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
<?php
include_once("analyticstracking.php");
include 'internal_api.php';
session_start();
?>
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>LearningX | Your perfect Java teacher</title>
<link rel="stylesheet" href="css/normalize.css">
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
<link rel="import" href="bower_components/paper-material/paper-material.html">
<link rel="import" href="bower_components/paper-styles/paper-styles.html">
<link rel="import" href="css/my_custom_styles.html">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include 'menu.php';?>
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 center">
<?php include 'header.html';?>
<h2 class="page-header text-center"><?php if(isset($theTopic)) echo $theTopic ?></h2>
<?php
if (!empty($_GET['id'])){
//Declare the Array
$resources=array();
//Declare additional resources (including all the fields)
$addtionalResources = array();
//Set the Array to call the function (this function is in internal_api.php)
$resources=getResources($_GET['id']);
//Loop through the results and display them.. y
foreach($resources as $item) {
if ($item['featured'] == 1)
$featuredResource = $item['resource'];
else if ($item['resourceType'] == "Text")
$descriptionText = $item['resource'];
else
$addtionalResources[] = $item;
}
}
//Get the id of featured resource, because the video cannot be displayed by raw url
$tempArray = explode("watch?v=", $featuredResource);
$featuredResourceId = $tempArray[1];
?>
<div class="video-container">
<iframe class="center-block" width="560" height="315" src="https://www.youtube.com/embed/<?php echo $featuredResourceId ?>" frameborder="0" allowfullscreen></iframe>
</div>
<center><p><?php echo $descriptionText ?></p></center>
<!-- <div class="">
<h4>Additional Resource</h4>
<ul>
<?php
foreach ($addtionalResources as $item) {
echo "<li><a href=" . $itemresourceDisplayName . ">" . $item['resource'] . "</a></li>";
}
?>
</ul>
</div>
<div class="">
<h4>Practice</h4>
<ul>
<li><a href="#">Let's go!</a></li>
</ul>
</div> -->
<div class="table-responsive" style="border: 0">
<center>
<table class="table">
<thead>
<tr>
<th><h5>Additonal Resources</h5></th>
<th><h5>Practice</h5></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php
foreach ($addtionalResources as $item) {
echo "<a target ='_blank' href=" . $item['resource'] . ">" . $item['resourceDisplayName'] . "</a><br>";
}
?>
</td>
<td>
<form method="POST" action="practice">
<input type="hidden" name="topicid" value=<?php echo $_GET['id']?>></input>
<input type="submit" class="btn btn-success" value="Let's Go!">
</form>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>