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 pathnuggets.php
More file actions
312 lines (290 loc) · 9.65 KB
/
nuggets.php
File metadata and controls
312 lines (290 loc) · 9.65 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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<?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');
include_once('nuggetTypes.php');
global $_DEFAULTNUGGETS;
function displayNuggets($currentGroup)
{
global $_DEFAULTNUGGETS, $skin, $db;
echo "<h1>Current Semester's IPRO Deliverable Nuggets</h1>\n";
//Get the list of nuggets
if($_SESSION['selectedSemester'] < 32)
$nuggets = getOldNuggetsByGroupAndSemester($currentGroup, $_SESSION['selectedSemester']);
else
{
$nuggets = getNuggetStatus($currentGroup, $_SESSION['selectedSemester']);
$currsem = new Semester($_SESSION['selectedSemester'], $db);
$active = $currsem->isActive();
}
$nugCount = 0;
?>
<table cellpadding="3">
<tr>
<?php
//nuggets is an associative array that has the various nugget types for keys and their id's if they exists, as values
//iGroups 2.1 nuggets
if($_SESSION['selectedSemester'] >= 32)
{
foreach($_DEFAULTNUGGETS as $nug)
{
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 if($nug == 'Abstract')
$nugprint = 'Abstract/Brochure';
else
$nugprint = $nug;
if($nugCount == 2)
{
echo "</tr>\n<tr>";
$nugCount = 0;
}
if($nuggets[$nug] != 0 && $active)
echo "<td><img src=\"skins/$skin/img/upload.png\" alt=\"Y\" title=\"$nugprint has been uploaded\" /> <a href=\"viewNugget.php?nug={$nuggets[$nug]}\">$nugprint</a></td><td><a href=\"editNugget.php?edit=true&nugID={$nuggets[$nug]}\">Edit</a></td>";
else if($active)
echo "<td><img src=\"skins/$skin/img/no_upload.png\" alt=\"N\" title=\"$nugprint not uploaded\" /> $nugprint</td><td><a href=\"addNugget.php?type=$nug\">Add Nugget</a></td>";
else if($nuggets[$nug] != 0)
echo "<td><img src=\"skins/$skin/img/upload.png\" alt=\"Y\" title=\"$nugprint has been uploaded\" /> <a href=\"viewNugget.php?nug={$nuggets[$nug]}\">$nugprint</a></td><td><a href=\"viewNugget.php?nug={$nuggets[$nug]}\">View</a></td>";
else
echo "<td><img src=\"skins/$skin/img/no_upload.png\" alt=\"N\" title=\"$nugprint not uploaded\" /> $nugprint</td><td>Not Uploaded</td>";
$nugCount++;
}
}
else
{
foreach($_DEFAULTNUGGETS as $def)
{
if($nugCount == 2)
{
echo "</tr>\n<tr>";
$nugCount = 0;
}
$link = null;
if ($def == 'Website')
$def = 'Web Site';
foreach($nuggets as $nug)
{
if($nugCount == 2)
{
$link .= "</tr>\n<tr>";
$nugCount = 0;
}
$id = $nug->getID();
$type = $nug->getType();
if(strstr($type, $def))
{
$link .= "<td><img src=\"skins/$skin/img/upload.png\" alt=\"Y\" title=\"Uploaded\" /> $def</td><td><a href=\"viewNugget.php?nug=$id&isOld=1\">View</a></td>";
$nugCount++;
}
}
if(!$link)
{
$link = "<td><img src=\"skins/$skin/img/no_upload.png\" alt=\"N\" title=\"Not uploaded\" /> $def</td><td>Not Uploaded</td>";
$nugCount++;
}
echo $link;
}
}
echo "</tr></table>\n";
}
function displayNonDefaultNuggets($currentGroup)
{
global $_DEFAULTNUGGETS, $db;
echo "<h1>Current Semester's Non-Deliverable Nuggets</h1>\n";
if($_SESSION['selectedSemester'] >= 32)
{
$currsem = new Semester($_SESSION['selectedSemester'], $db);
$active = $currsem->isActive();
$nuggets = allActiveByTypeandID("Other", $currentGroup->getID(), $_SESSION['selectedSemester']);
if(count($nuggets) > 0)
{
echo "<table cellpadding=\"3\">\n";
echo "<tr><th>Name</th><th>Edit/Delete</th></tr>\n";
foreach($nuggets as $nugget)
{
echo "<tr>";
printNugPreview($nugget, $active);
echo "</tr>";
}
echo "</table>\n";
echo "<br />";
if($active)
echo "<a href=\"addNugget.php?type=Other\">Start a new Non-Deliverable Nugget</a>";
}
else
{
echo "There are currently no Non-deliverable Nuggets for this semester<br />";
if($active)
echo "<a href=\"addNugget.php?type=Other\">Start a new Non-Deliverable Nugget</a>";
}
}
// display iKnow non-default nuggets
else
{
$nuggets = getOldNuggetsByGroupAndSemester($currentGroup, $_SESSION['selectedSemester']);
echo "<table cellpadding=\"3\">";
$nugs = false;
foreach($nuggets as $nug)
{
$found = false;
$id = $nug->getID();
$type = $nug->getType();
foreach($_DEFAULTNUGGETS as $def)
{
if($def == 'Website')
$def = 'Web Site';
if(strstr($type, $def))
$found = true;
}
if(!$found)
{
echo "<tr><td><a href=\"viewNugget.php?nug=$id&isOld=1\">$type</a></td></tr>\n";
$nugCount++;
$nugs = true;
}
else
echo "<tr><td></td></tr>\n";
}
echo "</table>";
if (!$nugs)
echo "There are currently no Non-Deliverable Nuggets for this semester<br />";
}
}
function displayOldNuggets($currentGroup)
{
$oldNuggets = $currentGroup->getInactiveNuggets();
echo "<h1>Other Semesters' Nuggets</h1>";
if(count($oldNuggets)!= 0)
{
echo "<table><tr>\n";
$nuggetCount = 0;
foreach($oldNuggets as $tempNugget)
{
if($nuggetCount == 2)
{
echo "</tr>\n<tr>";
$nuggetCount = 0;
}
echo "<td>";
echo "<a href=\"viewNugget.php?nug=".$tempNugget->getID()."\">".$tempNugget->getType()."</a>";
echo "</td>";
$nuggetCount++;
}
echo "</tr></table>\n";
}
else
echo "There are no previous nuggets created with the iGroups nugget system.<br />";
echo "To display nuggets prior to 3.0 release date visit <a href='http://iknow.iit.edu'>http://iknow.iit.edu</a>";
}
function printNugPreview($nugget, $active)
{
$title = $nugget->getType();
$desc = $nugget->getDescShort();
$id = $nugget->getID();
$status = $nugget->getStatus();
echo "<td><a href=\"viewNugget.php?nug=$id\">".$title."</a></td><td>";
if($active)
echo "<a href=\"editNugget.php?edit=true&nugID=$id\">Edit</a></td>";
else
echo '</td>';
}
function printNuggetNoEdit($nugget)
{
$authors = $nugget->getAuthors();
$files = $nugget->getFiles();
$semester = $nugget->getSemester();
echo "<div class='item'><strong>Nugget Type/Name:</strong>";
echo $nugget->getType()."</div>";
echo '<div class="item"><strong>Description:</strong> '.substr($nugget->getDesc(),0,40).'</div>';
echo '<div class="item"><strong>Date Created:</strong> '.$nugget->getDate().'</div>';
echo '<div class="item"><strong>Authors:</strong> <br />';
if(count($authors) > 0)
{
echo '<ul>';
foreach($authors as $author)
{
//checks to see if the author is the primary author
if($nugget->isPrimaryAuthor($author->getID()))
{
//if it is, the following parameter will be added to its radio button
$toCheck = 'checked';
}
else
{//or nothing will be added
$toCheck = '';
}
//print the author name
echo '<li>';
echo $author->getFullName();
if($toCheck == 'checked')
echo ' <strong>Primary Author</strong>';
echo '</li>';
}
echo '</ul></div>';
}
else
echo "There are currently 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>';
echo '<a href="/igroups/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 ****/
echo "<p>Submitted nuggets will be considered final versions by the IPRO Office, and will therefore will be reviewed as such and, if applicable, printed. Please be aware that the IPRO Office will only print one version of each poster and abstract/brochure submitted by teams.</p>\n";
echo "<p>If your document is still a draft, i.e. it has not been approved by all members of your team and your faculty advisor(s), upload it to <a href=\"files.php\">Files</a> instead of Nuggets.</p>\n";
echo "<p>If your document will not be ready for submission by its due date, you can request a deadline extension from the IPRO Office by emailing Jennifer Keplinger at <a href=\"mailto:keplinger@iit.edu\">keplinger@iit.edu</a>.</p>\n";
echo "<p>For information about the requirements for these deliverables, including due dates, see <a href=\"http://ipro.iit.edu/deliverables\">the IPRO website</a>.</p>\n";
displayNuggets($currentGroup);
echo "<br />";
displayNonDefaultNuggets($currentGroup);
echo "<br />";
//displayOldNuggets($currentGroup);
?>
<?php
//include rest of html layout file
require('htmlcontentfoot.php');// ends main container
?>
</body></html>