This repository was archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewNugget.php
More file actions
153 lines (139 loc) · 3.88 KB
/
Copy pathviewNugget.php
File metadata and controls
153 lines (139 loc) · 3.88 KB
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
<?php
include_once('globals.php');
include_once('checklogin.php');
include_once('classes/nugget.php');
include_once('classes/semester.php');
include_once('classes/file.php');
include_once('classes/quota.php');
$_SESSION['currentGroup'] = $currentGroup;
$currentQuota = new Quota($currentGroup, $db);
function peopleSort($array)
{
$newArray = array();
foreach($array as $person)
$newArray[$person->getCommaName()] = $person;
ksort($newArray);
return $newArray;
}
function printNugget($nugget)
{
$authors = $nugget->getAuthors();
$files = $nugget->getFiles();
$semester = $nugget->getSemester();
echo "<div class=\"item\"><strong>Nugget Type/Name:</strong> ";
//used to print a nugget that is from a prior semester or for viewing purposes only
$nug = $nugget->getType();
if($nug == 'Code of Ethics')
$nugprint = 'Ethics Statement';
else if($nug == 'Website')
$nugprint = 'Website (optional)';
else if($nug == 'Midterm Report')
$nugprint = 'Midterm Presentation';
else if($nug == 'Team Minutes')
$nugprint = 'Team Minutes (optional)';
else if($nug == 'Final Report')
$nugprint = 'Final Report or Grant Proposal';
else
$nugprint = $nug;
echo $nugprint.'</div>';
echo '<div class="item"><strong>Description:</strong> '.htmlspecialchars($nugget->getDesc()).'</div>';
echo '<div class="item"><strong>Date Created:</strong> '.$nugget->getDate().'</div>';
echo '<div class="item"><strong>Security:</strong> ';
if($nugget->isPrivate())
echo 'Protected (Not publicly viewable)';
else
echo 'Public';
echo "</div>";
echo '<div class="item"><strong>Authors:</strong> <br />';
if(count($authors) > 0)
{
echo '<ul>';
foreach($authors as $author)
{
//print the author name
echo '<li>';
echo $author->getFullName();
echo '</li>';
}
echo '</ul></div>';
}
else
echo "There are no authors for this nugget.</div>";
echo '<div class="item"><strong>Files:</strong>'.'<br />';
if(count($files) > 0)
{
echo '<ul>';
foreach($files as $file)
{
echo '<li>';
if($nugget->isOld())
echo "<a href=\"downloadOld.php?file={$file[0]}\">{$file[1]}</a> ";
else
echo '<a href="download.php?id='.$file->getID().'">'.$file->getNameNoVer().'</a> ';
echo '</li>';
}
echo '</ul></div>';
}
else
echo 'There are no files for this nugget.</div>';
}
//----------Start XHTML Output----------------------------------//
require('doctype.php');
require('appearance.php');
echo "<link rel=\"stylesheet\" href=\"skins/$skin/nuggets.css\" type=\"text/css\" title=\"$skin\" />\n";
foreach($altskins as $altskin)
echo "<link rel=\"alternate stylesheet\" href=\"skins/$altskin/nuggets.css\" type=\"text/css\" title=\"$altskin\" />\n";
?>
<title><?php echo $appname; ?> - Nuggets</title>
<script type="text/javascript">
//<![CDATA[
function nuggetRedirect(nugget){
form = document.getElementById("redirectForm");
form.nuggetType.value= nugget;
form.submit();
}
//]]>
</script>
</head>
<body>
<?php
/**** begin html head *****/
require('htmlhead.php');
//starts main container
/****end html head content ****/
if(isset($_GET['nug']))
{
//proceed with view
//check that the nugget belongs to the group before displaying
if(isset($_GET['isOld']))
$nugget = new Nugget($_GET['nug'], $db, 1);
else
$nugget = new Nugget($_GET['nug'], $db, 0);
$nugGroup = $nugget->getGroupID();
if($nugGroup != $currentGroup->getID())
{
echo "<script type=\"text/javascript\">
<!--
window.location = 'index.php'
//-->
</script>";
}
else //proceed
printNugget($nugget);
}
else
{
echo "<script type=\"text/javascript\">
<!--
window.location = 'nuggets.php'
//-->
</script>";
}
?>
<?php
/**** begin html footer*****/
require('htmlcontentfoot.php');
// ends main container
/****** end html footer*****/
?>
</body></html>