-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathviewletter.php
74 lines (71 loc) · 3.34 KB
/
viewletter.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
<?php require_once("includes/session.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php require_once("includes/connection.php"); ?>
<?php include("includes/header.php"); ?>
<?php $message = "";
if($_GET['link']=="inbox"){
$uid = $_SESSION['user_id'];
$uname = $_SESSION['username'];
$heading = "to ". $uname;
$id = "uid";
$page = $_GET['link'];
}
else{
$uid = $_SESSION['user_id'];
$uname = $_SESSION['username'];
$heading = "from ". $uname;
$id = "letterto";
$page = $_GET['link'];
}
?>
<?php
if(isset($_POST['accept'])||isset($_POST['reject']))
{
if(isset($_POST['accept']))
$stat = 1;
else
$stat = "0";
$colorq = mysql_query("update letter set status = '{$stat}' where letterto = '{$uid}' and sno = '{$_GET['id']}'");
}
?>
<table id="structure">
<tr>
<td id="page" align="center">
<fieldset>
<legend>Letters <?php echo $heading; ?></legend>
<table>
<?php
$query = mysql_query("select * from letter where sno = '{$_GET['id']}'");
if(!$query){
$message = "No Letters found..!";
}
else {
$i = 1;
while($q = mysql_fetch_array($query)){
$status = $q['status'];
if($status == "1")
$color = 'green';
else $color = 'red';
echo '<tr><td align="center"><fieldset id="'.$color.'"><legend style="background-color:#FF0"><strong>Letter '.$heading.' </strong></legend><table width="100%" height="100%" border="0"><caption><strong>Letter</strong></caption><tr><td width="150"> </td><td width="370"> </td><td width="150">'.$q["place"].'</td></tr><tr><td> </td><td> </td><td>'.$q["date"].'</td></tr><tr><td> </td></tr><tr><td>To</td><td> </td><td> </td></tr><tr><td><strong>'.$q["letterto"].'</strong></td><td> </td><td> </td></tr><tr><td>'.$q["dept"].'</td><td> </td><td> </td></tr><tr><td> </td><td><strong>Sub:</strong>'.$q["subject"].'</td><td> </td></tr><tr><td> </td></tr><tr><td>Respected Sir(Mam),</td><td> </td><td> </td></tr><tr><td> </td></tr><tr><td colspan="3"> '.$q["content"].'</td></tr><tr><td> </td>';
?>
<td> <?php if($q["fromdate"] != "0000-00-00" && $q["todate"] != "0000-00-00") echo 'Leave from: <strong>'.$q["fromdate"].'</strong> to: <strong>'.$q["todate"].'</strong>'; ?> </td>
<?php
echo '<td> </td></tr><tr><td> </td><td>'.$q["request"].'</td><td> </td></tr><tr><td> </td></tr><tr><td> </td><td>Thanking you,</td><td> </td></tr><tr><td> </td></tr><tr><td> </td><td> </td><td>Yours faithfully,</td></tr><tr><td> </td></tr><tr><td> </td><td> </td><td><strong>'.$q["uid"].'</strong></td></tr></table></fieldset></td></tr><tr><td>';
if($_SESSION['page'] == "staff.php" && $_GET['link']=="inbox"){
echo '<form action="viewletter.php?id='.$_GET['id'].'&&link=staff" method="post" name="ststusform">
<table width="100%"><tr><td width="40%"> </td><td width="40%"> </td><td><input type="submit" value="Accept" name="accept[]"></td><td><input type="submit" value="Reject" name="reject[]"></td></tr></table></form></td></tr>';
}
}
}
?>
<?php if (!empty($message)) {echo "<tr><td><p id='err' class=\"message\">" . $message . "</p></td></tr>";} ?>
<tr>
<td>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
<?php include("includes/footer.php"); ?>