This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
project.php
65 lines (58 loc) · 3.24 KB
/
project.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
<?php
include_once '_class/IdeaAbstractionManager.class.php';
include_once '_class/StudentManager.class.php';
include_once '_class/LecturerManager.class.php';
include '_pages/header.php';
if(isset($_GET['uid'])){
$uid = $_GET['uid'];
$database = new PDO('mysql:host=localhost;dbname=srproj', 'root', '');
$database->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$manager = new IdeaAbstractionManager($database);
$project = $manager->get($uid);
// customizing page title eg. "My research's title blahblabla - Research"
$s = get_class($project)=='SeniorProject' ? 'Senior Project' : get_class($project);
echo '<head><title>'.$project->title().' - '.$s.'</title></head>';
// showing details
$links = explode(';', $project->links());
$authors = explode(';', $project->coauthors());
$keywords = explode(';', $project->keywords());
$postedby = $project->postedby();
$documents = explode(';', $project->docs());
echo '<h1>'.$project->title().'</h1>
<p>'.$project->description().'</p></br>
Links: ';
$temp = '';
foreach ($links as $link)
$temp = $temp.'<a href="'.$link.'" target="_blank">'.$link.'</a>; ';
echo substr($temp, 0, -2).'</br>';
echo 'Posted by: ';
if(LecturerManager::lecturerExists($postedby, $database))
echo '<a href="http://localhost/sr-proj/profile.php?user='.$postedby.'&type=Lecturer">'.LecturerManager::getFullname($postedby, $database).'</a></br>';
else
echo '<a href="http://localhost/sr-proj/profile.php?user='.$postedby.'&type=Student">'.StudentManager::getFullname($postedby, $database).'</a></br>';
echo 'Authors: ';
$temp = '';
foreach ($authors as $uname){
if(LecturerManager::lecturerExists($uname, $database))
$temp = $temp.'<a href="http://localhost/sr-proj/profile.php?user='.$uname.'&type=Lecturer">'.LecturerManager::getFullname($uname, $database).'</a>; ';
else
$temp = $temp.'<a href="http://localhost/sr-proj/profile.php?user='.$uname.'&type=Student">'.StudentManager::getFullname($uname, $database).'</a>; ';
}
echo substr($temp, 0, -2).'<br>';
echo 'Created on '.
$project->creationdate().'</br>
State: '.
$project->state().'</br>
Type: '.
$project->type().'</br>
Keywords: ';
foreach ($keywords as $key)
echo '<u><a href="http://localhost/sr-proj/search.php?topic='.$key.'">'.$key.'</a></u> ';
echo '</br>Documents: ';
$temp = '';
foreach ($documents as $doc)
$temp = $temp.'<a href="./_uploads/_documents/AB8CE9F1D6DF.docx" target="_blank" download>download</a>; ';
echo substr($temp, 0, -2).'</br>';
}
else header("Location: index.php");
?>