-
Notifications
You must be signed in to change notification settings - Fork 2
/
study.php
75 lines (67 loc) · 2.26 KB
/
study.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
<?php
require './core/init.php';
$topic_id = $_GET['topic_id'];
$title = $_GET['title'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . "/api/cards.php?id=" . $topic_id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$cards = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
$cards = json_decode(trim($cards), true);
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $title; ?></title>
<link href="https://fonts.googleapis.com/css?family=Roboto:200,300,400,500" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./css/study.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<div id="topContainer">
<div id="colorBar"></div>
<h2 id="title"><?php echo $title; ?></h2>
<a id="topics" href="./index.php">Back to Topics</a>
</div>
<div id="sideDiv">
<p id="displayCount"></p>
<div id="options">
<button id="shuffle">Shuffle</button>
<button id="studyOppositeSide">Definition First</button>
</div>
<button id="newCard">+</button>
</div>
<div id="container">
<div id="card">
<h2 id="cardDisplay"></h2>
</div>
<div id="altCard">
<h2 id="altCardDisplay"></h2>
</div>
<div id="newCardDiv" style="display:none;">
<div id="block" style="height: 42%;">
</div>
<input type="text" name="title" id="titleInput" placeholder="Front Side">
<form id="newCardForm" action="./api/cards.php" method="post" style="display: none;">
<input type="text" name="titleCopy" id="titleInputCopy" style="display: none;">
<input type="text" name="definition" id="definitionInput" placeholder="Back Side">
<input type="text" name="topic_id" value=<?php echo $topic_id; ?> style="display: none;">
<input type="text" name="topic_title" value=<?php echo urlencode($title); ?> style="display: none;">
<button id="addCard">Add Card</button>
</form>
</div>
<div id="cardInteract">
<button id="nextCard" class="arrow">></button>
<button id="previousCard" class="arrow"><</button>
<button id="flipCard">Flip</button>
</div>
</div>
</body>
<script type="text/javascript">
var cards = <?php echo json_encode($cards); ?>;
</script>
<script type="text/javascript" src="./js/study.js"></script>
</html>