
<meta charset="utf-8">
<link href="../../css/templatemo_style.css" rel="stylesheet" type="text/css" />


<?php
session_start();
if (isset($_GET['s'])) {
    $s = $_GET['s'];
    $_SESSION['GROUPOFUSE'] = $s;
}


if ($_SESSION['GROUPOFUSE'] == 6) {
    $pagetitle = "Διοικητή!!!";
    include('../../divs/header.php');
} else {
    require_once('../../login/login_functions.inc.php');
    $url = absolute_url('../../login/login.php');
    header("Location: $url");
    exit();
}
?>


<!--  MENU  -->

<div id="templatemo_menu_wrapper">

    <div id="templatemo_menu">
        <ul>
            <li><a href="dkths.php" class="current"><span></span>Αρχική</a></li>
            <li><span></span><a>Ενημέρωση Στελεχών</a>
                <ul><li><a href="enhmerosh.php" target="_parent" ><span></span>Δείτε τις πρόσφατες ανακοινώσεις</a></li>
                    <li><a href="anakoinosh.php" target="_parent"><span></span>Αναρτήστε τη δική σας ανακοίνωση</a></li>

                </ul></li>
            <li><a href="eiserhomena.php" target="_parent"><span></span>Επιθέωρηση Εισερχομένων</a></li>
            <li><a href="exerhomena.php" target="_parent"><span></span>Επιθέωρηση Εξερχομένων</a></li>
            <li><a href="logout.php" target="_parent"><span></span>Logout </a></li>
        </ul>    

    </div>
</div>  <!-- end of templatemo_menu -->





<!-- CONTENT -->
<div id="templatemo_main"> <span class="tm_bottom"></span>

 <style>
#templatemo_main table{
	   font-weight:bold;
	   color:#000000;
	   }
            #templatemo_main tr{
	   font-weight:500;
	   color:#000000;
	   }
</style>
    <!-- CONTENT -->
    <?php
    require_once ('../../mysqli_connect.php');
    $display = 5;
        $errors = array();
        if (isset($_GET['p']) && is_numeric($_GET['p'])) {
            $pages = $_GET['p'];
        } else {
            $q = "select count(ap) from eiserhomena";
            $r = mysqli_query($dbc, $q);
            $row = @mysqli_fetch_array($r, MYSQLI_NUM);
            $records = $row[0];
            if ($records > $display) {
                $pages = ceil($records / $display);
            } else {
                $pages = 1;
            }
        }
        if (isset($_GET['st']) && is_numeric($_GET['st'])) {
            $start = $_GET['st'];
        } else {
            $start = 0;
        }
        $sort = (isset($_GET['sort'])) ? $_GET['sort'] : 'rd';
        switch ($sort) {
            case 'pr':
                $order_by = 'apex ASC';
                break;
            case 'prr':
                $order_by = 'apex DESC';
                break;
            case 'dt':
                $order_by = 'date_apostolis ASC';
                break;
            case 'dtr':
                $order_by = 'date_apostolis DESC';
                break;
            case 'ap':
                $order_by = 'paralhpths ASC';
                break;
            case 'apr':
                $order_by = 'paralhpths DESC';
                break;
            case 'ie':
                $order_by = 'tautothta ASC';
                break;
            case 'ier':
                $order_by = 'tautothta DESC';
                break;
            default:
                $order_by = 'apex ASC';
                $sort = 'pr';
                break;
        }
    $q = "select * from exerhomena order by $order_by limit $start,$display";
    $r = mysqli_query($dbc, $q);

     if ($r) {
            $sort_pr = ($sort == 'pr') ? 'prr' : 'pr';
            $sort_ap = ($sort == 'ap') ? 'apr' : 'ap';
            $sort_dt = ($sort == 'dt') ? 'dtr' : 'dt';
            $sort_ie = ($sort == 'ie') ? 'ier' : 'ie';
    echo'
 <br/>
  <br/>
<table align="center"  bgcolor="#FFFF99"  bordercolor="#FF3300" border="2" cellspacing="3" cellpadding="3" width="100%">
<tr>
      <td align="center"><h3><a href="exerhomena.php?sort=' . $sort_pr . '"><b>Αριθμός Πρωτοκόλλου</b></h3></td>
      <td align="center"><h3><a href="exerhomena.php?sort=' . $sort_ap . '"><b>Ημερομηνία Αποστολής</b></h3></td>
      <td align="center"><h3><a href="exerhomena.php?sort=' . $sort_dt . '"><b>Παραλήπτης</b></h3></td>
      <td align="center"><h3><a href="exerhomena.php?sort=' . $sort_ie . '"><b>Ταυτότητα Εξερχομένου</b></h3></td>
      <td align="center"><h3><b>Ημερομηνία Έκδοσης</b></h3></td>
      <td align="center"><h3><b>Όνομα Χειριστή</b></h3></td>
      <td align="center"><h3><b>Βαθμός Ασφαλείας</b></h3></td> 
</tr>
';
    $bg = '#eeeeee';
    while ($row = mysqli_fetch_array($r, MYSQLI_BOTH)) {
        $bg = ($bg == '#eeeeee' ? '#ffffff' : '#eeeeee');
        echo '
     <tr bgcolor="' . $bg . '">
            <td align="center">' . $row[0] . '</td>
            <td align="center">' . $row[1] . '</td>
            <td align="center">' . $row[2] . '</td>
            <td align="center">' . $row[3] . '</td>
            <td align="center">' . $row[4] . '</td>
            <td align="center">' . $row[5] . '</td>
            <td align="center">' . $row[6] . '</td> 
          
     </tr>           
';
    }
    echo '</table>';
    if ($pages > 1) {
                echo'<br/><p>';
                $current_page = ($start / $display) + 1;
                if ($current_page != 1) {
                    echo '<a href="exerhomena.php?st=' . ($start - $display) . '&p=' . $pages . '&sort=' . $sort . '">Προηγούμενη&nbsp</a>';
                }
                for ($i = 1; $i <= $pages; $i++) {
                    if ($i != $current_page) {
                        echo '<a href="exerhomena.php?st=' . (($display * ($i - 1))) . '&p=' . $pages . '&sort=' . $sort . '">' . $i . '&nbsp</a>';
                    } else {
                        echo ' ' . $i . ' ';
                    }
                }
                if ($current_page != $pages) {
                    echo '<a href="exerhomena.php?st=' . ($start + $display) . '&p=' . $pages . '&sort=' . $sort . '">&nbspΕπόμενη</a>';
                }
                echo '</p>';
            }
        } else {
            echo '<h1>Error!</h1>
            <p class="error"> Τα παρακάτω λάθη προέκυψαν:<br/>';
            foreach ($errors as $msg) {
                echo "-$msg <br/>\n";
            }
        }
        
     
    ?>
    <div class="cleaner"></div>
</div> 


<!-- SIDEBAR -->








<?php
include('../../divs/footer.php');
?>