<?PHP
require('config.php');
require('connect.php');
?>
<TITLE><?php echo $domain ?> - Admin Utilities</TITLE>
<link REL="stylesheet" TYPE="text/css" HREF="../portalxp.css">
<style>
A:hover
{
COLOR: #ff3333;
TEXT-DECORATION: none
}
</style>
<?php
if ($submit) {
//$teacherid = $HTTP_POST_VARS["menu1"];
$email = $HTTP_POST_VARS["email"];
$result8 = mysql_query("select teacher_id from teacher where email = '$email' ");
$myrow8 = mysql_fetch_array($result8);
$teacherid = $myrow8['teacher_id'];
$teacherpass = $HTTP_POST_VARS["teacherpass"];
$email = $HTTP_POST_VARS["email"];
$result = mysql_query("select * from news where news.teacher_id = $teacherid ORDER BY news.news_id",$db);
$result2 = mysql_query("select * from periods where periods.teacher_id = $teacherid ORDER BY periods. periodorder",$db);
$result3 = mysql_query("select * from links where links.teacher_id = $teacherid ORDER BY links.links_id",$db);
//$result4 = mysql_query("select * from assignments where assignments.teacher_id = $teacherid ORDER BY assignments.assignments_id",$db);
$result4 = mysql_query("select * from assignments, periods where assignments.teacher_id = $teacherid and periods.periods_id = assignments.periods_id ORDER BY assignments.assignments_id",$db);
$result6 = mysql_query("select teacherpass from teacher where teacher_id = $teacherid",$db);
$myrow6 = mysql_fetch_array($result6);
$result7 = mysql_query("select * from calendar where calendar.teacher_id = $teacherid ORDER BY calendar.id",$db);
if ($teacherpass != $myrow6["teacherpass"]) {
printf("Incorrect password\n");
exit;
} else {
// For Calendar to work
$currentday = date("j", time());
$currentmonth = date("m", time());
$currentyear = date("Y", time());
$lastday = 1;
if (!isset($month))
{
$month = date("m", time());
$year = date("Y", time());
}
?>
<SCRIPT TYPE="text/javascript">
<!--
function popup(mylink, editassignments)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, editassignments, 'width=550,height=500,scrollbars=no');
return false;
}
//-->
</SCRIPT>
<? INCLUDE("top.php")?>
<h3>Global Tools</h3>
<table width="100%" border=0>
<tr>
<td width='550'>
<a href="editteacher.php?id=<?php echo $teacherid ?>" onClick="return popup(this, 'notes')">Edit Teacher Information</a>
</td>
</tr>
</table>
<h3>Add Tools</h3>
<table width="100%" border=0>
<tr>
<td width='550'>
<a href="addnews.php?id=<?php echo $teacherid ?>" onClick="return popup(this, 'notes')">Add News Items</a>
</td>
</tr>
<tr>
<td width='550'>
<a href="addperiods.php?id=<?php echo $teacherid ?>" onClick="return popup(this, 'notes')">Add a new period</a>
</td>
</tr>
<tr>
<td width='550'>
<a href="addlinks.php?id=<?php echo $teacherid ?>" onClick="return popup(this, 'notes')">Add a new link</a>
</td>
</tr>
<tr>
<td width='550'>
<a href="addassignments.php?id=<?php echo $teacherid ?>" onClick="return popup(this, 'notes')">Add a new assignment</a>
</td>
</tr>
<tr>
<td width='550'>
<a href="adddownload.php?id=<?php echo $teacherid ?>" onClick="return popup(this, 'notes')">Upload File to Server</a>
</td>
</tr>
<tr>
<td width='550'>
<a href="editclassrules.php?id=<?php echo $teacherid ?>" onClick="return popup(this, 'notes')">Edit Classrules</a>
</td>
</tr>
</table>
<h3>Edit News:</h3><p>
<table width="100%" border=0>
<?php
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<tr>\n");
printf("<td width='550'>\n");
printf("%s - %s\n", $myrow["subject"], $myrow["postdate"]);
printf("<td width='50'>\n");
printf("<a href=\"editnews.php?id=%s\" onClick=\"return popup(this, 'notes')\">Edit</a><br>\n", $myrow["news_id"]);
printf("<td width='50'>\n");
printf("<a href=\"deletenews.php?id=%s\" onClick=\"return popup(this, 'notes')\">Delete</a><br>\n", $myrow["news_id"]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found. Use the link above to create a record.";
}
?>
</table>
<h3>Edit Periods:</h3><p>
<table width="100%" border=0>
<?php
if ($myrow2 = mysql_fetch_array($result2)) {
do {
printf("<tr>\n");
printf("<td width='550'>\n");
printf("%s - %s\n", $myrow2["hournumber"], $myrow2["classname"]);
printf("<td width='50'>\n");
printf("<a href=\"editperiods.php?id=%s\" onClick=\"return popup(this, 'notes')\">Edit</a><br>\n", $myrow2["periods_id"]);
printf("<td width='50'>\n");
printf("<a href=\"deleteperiods.php?id=%s\" onClick=\"return popup(this, 'notes')\">Delete</a><br>\n", $myrow2["periods_id"]);
} while ($myrow2 = mysql_fetch_array($result2));
} else {
echo "Sorry, no records were found. Use the link above to create a record.";
}
?>
</table>
<h3>Edit Links:</h3><p>
<table width="100%" border=0>
<?php
if ($myrow3 = mysql_fetch_array($result3)) {
do {
printf("<tr>\n");
printf("<td width='550'>\n");
printf("%s - %s\n", $myrow3["website"], $myrow3["displayname"]);
printf("<td width='50'>\n");
printf("<a href=\"editlinks.php?id=%s\" onClick=\"return popup(this, 'notes')\">Edit</a><br>\n", $myrow3["links_id"]);
printf("<td width='50'>\n");
printf("<a href=\"deletelinks.php?id=%s\" onClick=\"return popup(this, 'notes')\">Delete</a><br>\n", $myrow3["links_id"]);
} while ($myrow3 = mysql_fetch_array($result3));
} else {
echo "Sorry, no records were found. Use the link above to create a record.";
}
?>
</table>
<h3>Edit Assignments:</h3><p>
<table width="100%" border=0>
<?php
if ($myrow4 = mysql_fetch_array($result4)) {
do {
printf("<tr>\n");
printf("<td width='550'>\n");
printf("Period %s, %s - %s\n", $myrow4["hournumber"], $myrow4["shortname"], $myrow4["datedue"]);
printf("<td width='50'>\n");
printf("<a href=\"editassignments.php?id=%s&teacherid=%s\" onClick=\"return popup(this, 'notes')\">Edit</a><br>\n", $myrow4["assignments_id"], $myrow4["teacher_id"]);
printf("<td width='50'>\n");
printf("<a href=\"deleteassignments.php?id=%s\" onClick=\"return popup(this, 'notes')\">Delete</a><br>\n", $myrow4["assignments_id"]);
} while ($myrow4 = mysql_fetch_array($result4));
} else {
echo "Sorry, no records were found. Use the link above to create a record.";
}
?>
</table>
<h3>Calendar Tools:</h3><p>
<form method=post target='new' action=../calendar/operate.php?teacher_id=<?php echo $teacherid?>>
<input type=hidden name=month value=<?php echo $month ?> >
<input type=hidden name=year value=<?php echo $year ?> >
<input type=submit name='action' value="Add item to calendar">
</form>
<h4>Edit Calendar Items</h4>
<table width="100%" border=0>
<?php
if ($myrow7 = mysql_fetch_array($result7)) {
do {
printf("<tr>\n");
printf("<td width='550'>\n");
printf("%s - %s\n", $myrow7["stamp"], $myrow7["subject"]);
printf("<td width='50'>\n");
printf("<a href=\"editcalendar.php?id=%s&teacherid=%s\" onClick=\"return popup(this, 'notes')\">Edit</a><br>\n", $myrow7["id"], $myrow7["teacher_id"]);
printf("<td width='50'>\n");
printf("<a href=\"deletecalendar.php?id=%s\" onClick=\"return popup(this, 'notes')\">Delete</a><br>\n", $myrow7["id"]);
} while ($myrow7 = mysql_fetch_array($result7));
} else {
echo "Sorry, no records were found. Use the link above to create a record.";
}
?>
</table>
</td>
</tr>
<tr>
</td>
<tr>
<td colspan=4 bgcolor='#349601'>
</td>
</tr>
<tr>
<td colspan=4>
<center>
©2002 Da Who Software - PortalXP Version <?php echo $versionnumber ?>
</center>
</td>
</tr>
</table>
</div>
<?php
} } else {
$result5 = mysql_query("select * from teacher ORDER BY lastname, firstname",$db);
?>
<? INCLUDE("top.php")?>
<table width='300px' align=center>
<tr>
<td>
<form method='post' action='<?php echo $PHP_SELF?>'>
<!-- Select Name: <select name="menu1">
<option>Select One</option>
<?php
while ($myrow = mysql_fetch_array($result5)) {
printf("<option value='%s'>%s, %s</option>\n", $myrow["teacher_id"], $myrow["lastname"], $myrow["firstname"]);
}
?>
</select>
-->
<br>
Enter E-mail Address: <input type="text" id="text" name="email">
<br>
Enter Password: <input type="password" id="text" name="teacherpass">
<input type='hidden' name='submit' value='Select Name'>
<br>
<input type='Submit' name='submit' value='Select Name'>
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=4 bgcolor='#349601'>
</td>
</tr>
<tr>
<td colspan=4>
<center>
©2002 Da Who Software - PortalXP Version <?php echo $versionnumber ?>
</center>
</td>
</tr>
</table>
</div>
<?php
}
?>