<div class="row-fluid">

			<?php 
include_layout_template('admin_menu.php');
?>

			<div class="span9">
				<h2>Read Notification</h2>
                <hr>
                <?php 
$nid = customDecrypt($_POST["nid"]);
$from = customDecrypt($_POST["from"]);
$notification = NotificationLog::find_by_sql("SELECT * FROM `notifications` WHERE notification_id = " . $nid);
$notification = array_shift($notification);
$sender = AdminLog::find_by_id($notification->user_id);
$sender = show_role($sender->role, $sender->staff_id, $sender->department_id);
?>
                <form action="<?php 
echo $from;
?>
" method="POST" class="form-horizontal" >
                
                    <div class="control-group">
                        <label class="control-label" for="selectRecipient">Sender: </label>
                        <div class="controls">
                            <div class="input-prepend">
                            <span class="add-on"><i class="icon-user"></i></span>
                                <input type="text" class="input-large" value="<?php 
if (isset($sender)) {
    echo $sender;
}
										<tr>
											<th>S/N</th>
											<th>Sender</th>
											<th>Title</th>
											<th>Date</th>
											<th>Time</th>
											<th></th>
											<th></th>
										</tr>
									</thead>
									<tbody>';
    }
    echo '<form action="view_notification.php" method="POST">
									<tr>
										<td>' . $serialno . '</td>
										<td>' . show_role($row["role"], $row["staff_id"], $row["department_id"]) . '</td>
										<td>' . $row["title"] . '</td>
										<td>' . $row["notification_date"] . '</td>
										<td>' . $row["notification_time"] . '</td>
										<td><button type="submit" class="btn btn-info" name="read_notification">View</button></td>
										
									</tr>
									<input type="hidden" name="nid" value="' . customEncrypt($row["notification_id"]) . '" />
									<input type="hidden" name="from" value="' . customEncrypt($file) . '" />
									</form>';
    if ($serialno % $max == 0) {
        echo '</tbody>';
        echo '</table>';
        echo '</div>';
        $pagecounter++;
    } elseif ($serialno == $number_of_notifications) {
$sql_all_users = $database->query("SELECT * FROM admin_users");
$admin_details = AdminLog::find_by_sql("SELECT * FROM admin_users WHERE user_id='" . $session->applicant_id . "'");
$admin_details = array_shift($admin_details);
?>
                <form action="" method="POST" class="form-horizontal sendnotification" id="sendnotification" >
                
                    <div class="control-group">
                        <label class="control-label" for="selectRecipient">Select Recipient: </label>
                        <div class="controls">
                            <div class="input-prepend">
                            <span class="add-on"><i class="icon-user"></i></span>
                                <select name="recipient" class="input-xlarge" id="recipient" required >
                                <option value="">--Select A Recipient--</option>
                                <?php 
while ($result = $database->fetch_array($sql_all_users)) {
    echo '<option value="' . $result['user_id'] . '">' . show_role($result['role'], $result['staff_id']) . '</option>';
}
?>
                            </select>
                            </div>
                        </div>
                    </div>
                    
                    <div class="control-group">
                        <label class="control-label" for="inputNotificationTitle">Notification Title: </label>
                        <div class="controls">
                            <div class="input-prepend">
                            <span class="add-on"><i class="icon-envelope"></i></span>
                                <input type="text" class="input-large" value="" id="title" name="title" />
                            </div>
                        </div>