/
myEssay.php
78 lines (78 loc) · 2.13 KB
/
myEssay.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
<?php
include("config.php");
include("Essay.php");
session_start();
$conn = new PDO('mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
$essayList = Essay::getEssaysByAuthor($conn, $_SESSION["user_id"]);
$conn = null;
?>
<html>
<head>
<title>Ìîÿò ðåôåðàò</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-1.11.2.min.js"></script>
</head>
<body>
<?php include("menu.php"); ?>
<div class="container">
<div class="page-header">
<h1>Ìîÿò ðåôåðàò</h1>
</div>
<?php
if ($essayList != null) {
$currentVersion = $essayList[0];
array_shift($essayList);
?>
<fieldset>
<legend>Òåêóùà âåðñèÿ</legend>
<table class="table">
<tr>
<th>Âåðñèÿ</th>
<th>Äàòà íà êà÷âàíå</th>
<th>Ïðåãëåä</th>
<th>Ðåäàêöèÿ</th>
</tr>
<tr>
<?php
echo "<td>$currentVersion->version</td>";
echo "<td>$currentVersion->upload_date</td>";
echo "<td><a href=\"viewEssay.php?id=$currentVersion->id&myEssay=true\" class=\"btn btn-primary viewEssay\"><span class=\"glyphicon glyphicon-eye-open\" aria-hidden=\"true\"></span></button></td>";
echo "<td><a href=\"editEssay.php?id=$currentVersion->id\" class=\"btn btn-primary editEssay\"><span class=\"glyphicon glyphicon-edit\" aria-hidden=\"true\"></span></button></td>";
?>
</tr>
</table>
</fieldset>
<?php if ($essayList != null) { ?>
<fieldset>
<legend>Ñòàðè âåðñèè</legend>
<table class="table">
<tr>
<th>Âåðñèÿ</th>
<th>Äàòà íà êà÷âàíå</th>
<th>Ïðåãëåä</th>
</tr>
<?php
foreach ($essayList as $essay) {
echo "<tr>";
echo "<td>$essay->version</td>";
echo "<td>$essay->upload_date</td>";
echo "<td><a href=\"viewEssay.php?id=$essay->id&myEssay=true\" class=\"btn btn-primary viewEssay\"><span class=\"glyphicon glyphicon-eye-open\" aria-hidden=\"true\"></span></button></td>";
echo "</tr>";
}
}
} else {
?>
Âñå îùå íå ñòå äîáàâèëè ðåôåðàò.
<br />
<a href="newEssay.php" class="btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Äîáàâÿíå íà ðåôåïàò</a>
<?php } ?>
</table>
</fieldset>
</div>
</body>
</html>
<script>
$(function() {
$("#myEssay").addClass("active");
});
</script>