-
Notifications
You must be signed in to change notification settings - Fork 2
/
author.php
178 lines (173 loc) · 9.06 KB
/
author.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html>
<head>
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=operaomnia v2;charset=utf8', 'root', '');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
$reponse = $bdd->query('SELECT * FROM authors WHERE ID='. $_GET['authid']);
while ($data = $reponse->fetch())
{
$bio=$data['Bio'];
$name=$data['FirstName'] . " ". $data['LastName'];
$familyName=$data['LastName'];
/*if ($data['Field']=='Physics')
{
$asideColor="asidePhys";
}
else if ($data['Field']=='Mathematics')
{
$asideColor="asideMaths";
}
else
{
$asideColor="asidePhys";
}*/
}
$reponse->closeCursor();
?>
<title>Opera Omnia - <?php echo $familyName?></title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css"
href="https://cdn.rawgit.com/dreampulse/computer-modern-web-font/master/fonts.css">
<meta charset="utf-8"/>
</head>
<body>
<?php include("headerAuthor.php");?>
<section>
<h1 id="nameAuthor"><?php echo $name?></h1>
<div id="core">
<h1>His Life</h1>
<p> <?php echo $bio?></p>
<h1>His Works</h1>
<h2> Papers</h2>
<ul id="paperList">
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=operaomnia v2;charset=utf8', 'root', '');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
$reponse = $bdd->query('SELECT * FROM papers WHERE /*AuthorID='.$_GET['authid'].' AND*/ Format=0 ORDER BY Date, ID');
$numberOfPapers=0;
while ($data = $reponse->fetch())
{
$authors=array();
$currentID="";
for($i=0;$i<=strlen($data['AuthorID']);$i++)
{
if(isset($data['AuthorID'][$i]) && $data['AuthorID'][$i]!="_")
{
$currentID.=$data['AuthorID'][$i];
}
else
{
array_push($authors,$currentID);
$currentID="";
}
}
foreach ($authors as $auth1)
{
if($_GET['authid']==$auth1)
{
$numberOfPapers=$numberOfPapers+1;
if(file_exists('papers/thumb_'.$data['ID'].'.png'))
{
?>
<li><a title="<?php echo $data['Title']?> (<?php echo date_format(date_create($data['Date']),"Y");?>)" href="paper.php?id=<?php echo $data['ID'];?>"><img width="232" height="300" src="papers/thumb_<?php echo $data['ID'];?>.png" /></a></li>
<?php
}
else
{
if(strlen($data['Title'])>170)
{?>
<li><a title="<?php echo $data['Title']?> (<?php echo date_format(date_create($data['Date']),"Y");?>)" href="paper.php?id=<?php echo $data['ID'];?>"><div class="paperCont" style="font-size:14px;"><img width="232" height="300" src="papers/thumb_def.png"/><div class="textCont"><?php echo $data['Title']?> <br/>(<?php echo date_format(date_create($data['Date']),"Y");?>)</div></div></a></li>
<?php
}
else
{?>
<li><a title="<?php echo $data['Title']?> (<?php echo date_format(date_create($data['Date']),"Y");?>)" href="paper.php?id=<?php echo $data['ID'];?>"><div class="paperCont"><img width="232" height="300" src="papers/thumb_def.png"/><div class="textCont"><?php echo $data['Title']?> <br/>(<?php echo date_format(date_create($data['Date']),"Y");?>)</div></div></a></li>
<?php
}
}}}}
$reponse->closeCursor();
if ($numberOfPapers==0)
{
echo "No paper by ".$name." is available on <em>Opera Omnia</em>.";
}?>
</ul>
<h2> Books</h2>
<ul id="paperList">
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=operaomnia v2;charset=utf8', 'root', '');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
$reponse = $bdd->query('SELECT * FROM papers WHERE /*AuthorID='.$_GET['authid'].' AND*/ Format=1 ORDER BY Date, ID');
$numberOfPapers=0;
while ($data = $reponse->fetch())
{
$authors=array();
$currentID="";
for($i=0;$i<=strlen($data['AuthorID']);$i++)
{
if(isset($data['AuthorID'][$i]) && $data['AuthorID'][$i]!="_")
{
$currentID.=$data['AuthorID'][$i];
}
else
{
array_push($authors,$currentID);
$currentID="";
}
}
foreach ($authors as $auth1)
{
if($_GET['authid']==$auth1)
{
$numberOfPapers=$numberOfPapers+1;
if(file_exists('papers/thumb_'.$data['ID'].'.png'))
{
?>
<li><a title="<?php echo $data['Title']?> (<?php echo date_format(date_create($data['Date']),"Y");?>)" href="paper.php?id=<?php echo $data['ID'];?>"><img width="232" height="300" src="papers/thumb_<?php echo $data['ID'];?>.png" /></a></li>
<?php
}
else
{
if(strlen($data['Title'])>170)
{?>
<li><a title="<?php echo $data['Title']?> (<?php echo date_format(date_create($data['Date']),"Y");?>)" href="paper.php?id=<?php echo $data['ID'];?>"><div class="paperCont" style="font-size:14px;"><img width="232" height="300" src="papers/thumb_def.png"/><div class="textCont"><?php echo $data['Title']?> (<?php echo date_format(date_create($data['Date']),"Y");?>)</div></div></a></li>
<?php
}
else
{?>
<li><a title="<?php echo $data['Title']?> (<?php echo date_format(date_create($data['Date']),"Y");?>)" href="paper.php?id=<?php echo $data['ID'];?>"><div class="paperCont"><img width="232" height="300" src="papers/thumb_def.png"/><div class="textCont"><?php echo $data['Title']?> (<?php echo date_format(date_create($data['Date']),"Y");?>)</div></div></a></li>
<?php
}
}}}}
$reponse->closeCursor();
if ($numberOfPapers==0)
{
echo "No book by ".$name." is available on <em>Opera Omnia</em>.";
}?>
</ul>
</div>
</section>
<?php include("footer.php"); ?>
</body>
</html>