{source}
<!– You can place html anywhere within the source tags –>
<script language=”javascript” type=”text/javascript”>
// You can place JavaScript like this
</script>
<?php
require_once ‘../mylibs/globals.php’;
echo header(“Content-Type: text/html; charset=utf-8”);
echo ‘<link rel=”stylesheet” type=”text/css” href=”apofstyle.css”>’;
session_start();
$httpdir=”ftp://87.203.227.27/apofaseis/”;
$start=0;
$limit=25;
// $httpdir=”http://www.serres.gr/apofaseis/”;
/*
if ($_POST[‘organo’]==”Όλα” && empty($_POST[‘arapof’]) && empty($_POST[‘etos’]) && empty($_POST[‘thema’]) && empty($_POST[‘apohmer’]) && empty($_POST[‘ewshmer’])) { //σε περίπτωση που διαλέξει Ολα και τίποτα άλλο, πάει στο ftp
header(“Location:$httpdir”);
exit;
}
*/
//echo $_POST[‘organo’];
// database connection parameters
// connect to database
//$conn = new mysqli($server, $username, $password, $database);
$conn = new mysqli(HOST, USERNAME, PASSWORD, DATABASE);
//mysql_set_charset(‘utf8’);
//$db = mysql_select_db(DATABASE, $conn);
if ($conn->connect_error) die (“Connection to DB failed: ” . $conn->connect_error);
$conn->set_charset(‘utf8’);
// Κρατάμε το είδος
$organo = $_POST[‘organo’];
//echo $organo;
// fetch data
$fields = “*”;
$sql = “SELECT $fields, cast(ArApof as signed) as numApof FROM “. APOFTABLE;
$filter=” where 1=1 “;
if (!empty($_POST[‘organo’])) {
if ($_POST[‘organo’]!=”Όλα”)
$filter.=” and organo='” .$_POST[‘organo’].”‘”;
}
if (!empty($_POST[‘etos’])) {
$filter.=” and etos='” .$_POST[‘etos’].”‘”;
}
if (!empty($_POST[‘arapof’])) {
$filter.=” and ArApof like ‘%” .$_POST[‘arapof’].”%'”;
}
if (!empty($_POST[‘thema’])) {
$filter.=” and thema like ‘%” .$_POST[‘thema’].”%'”;
}
if (!empty($_POST[‘apohmer’])) {
$filter.=” and DateSined>= ‘” .$_POST[‘apohmer’].”‘”;
}
if (!empty($_POST[‘ewshmer’])) {
$filter.=” and DateSined<= ‘” .$_POST[‘ewshmer’].”‘”;
}
$page=$_GET[“page”];
//echo “<p>page=”.$page.”<p>”;
if ($page==”” || $page==”1″) {
$page1=0;
}
else {
$page1=($page*20) -20;
}
//echo $_SESSION[‘sql’];
if(empty($_SESSION[‘sql’])){
// to construct search_sql
$sql.=” “.$filter.” order by etos,organo , numApof, ArApof
“;
$_SESSION[‘sql’] = $sql;
}else{
$sql = $_SESSION[‘sql’];
}
//echo $sql;
$sqlcount=$sql; //αντιγραφη του ερωτηματος γιατι θα το χρειαστω στο τελος..
$sql.=” limit $page1,20″;
//echo $sql;
$result = $conn->query($sql);
//$result = mysql_query($sql);
$rows = mysqli_num_rows($result);
//echo “Rows=”.$rows;
// Δημιουργία πίνακα με τα αποτελέσματα
$html = ‘<div class=”table-responsive” >’;
$html .= ‘<table class=”table table-striped table-bordered
” >’;
//if ($organo==’ΔΣ’)
//$html .= ‘<tr><td colspan=”5″>ΔΣ</td></tr>’;
//else
//$html .= ‘<tr><td colspan=”5″>Οικ. Επιτροπή</td></tr>’;
$html .= ‘<thead>’;
$html .= ‘<tr>’;
$html .= ‘<th>Έτος</th>’;
$html .= ‘<th>Όργανο απόφασης</th>’;
$html .= ‘<th>Αρ. απόφασης</th>’;
$html .= ‘<th>Ημ/νία Συνεδρίασης</th>’;
//$html .= ‘<th>ΑΔΑ</th>’;
//$html .= ‘<th>Αρ. Φακέλου</th>’;
$html .= ‘<th>Θέμα</th>’;
//$html .= ‘<th>Αρ. πρακτικού</th>’;
//$html .= ‘<th>Ημ/νια Συνεδρίασης</th>’;
//$html .= ‘<th>Ώρα Συνεδρίασης</th>’;
$html .= ‘<th>Αρχείο</th>’;
$html .= ‘</tr>’;
$html .= ‘</thead>’;
// Table rows
$result = $conn->query($sql) or die($conn->error);
while( $row = $result->fetch_assoc() ) {
$id = $row[‘id’];
$dateapof = $row[‘DateApof’];
$dt = new DateTime($dateapof);
$dateapof = $dt->format(‘d/m/Y’);
$datesined = $row[‘DateSined’];
$dt = new DateTime($datesined);
$datesined = $dt->format(‘d/m/Y’);
$timesined = $row[‘TimeSined’];
/*if ($timesined != null) {
$dt = new DateTime($timesined);
$timesined = $dt->format(‘H:i’);
}
*/
$etos = $row[‘etos’];
$organo = $row[‘organo’];
$arapof = $row[‘ArApof’];
$ada = $row[‘ada’];
$arfakelou = $row[‘ArFakelou’];
$thema = $row[‘thema’];
$arpraktikou = $row[‘arpraktikou’];
$filename=$row[‘filename1’];
$html .= ‘<tr>’;
$html .= ‘<td>’ . $etos . ‘</td>’;
$html .= ‘<td>’ . $organo . ‘</td>’;
$html .= ‘<td>’ . $arapof . ‘</td>’;
$html .= ‘<td>’ . $datesined. ‘</td>’;
//$html .= ‘<td>’ . $ada . ‘</td>’;
//$html .= ‘<td>’ . $arfakelou . ‘</td>’;
$html .= ‘<td>’ . $thema . ‘</td>’;
//$html .= ‘<td>’ . $arpraktikou . ‘</td>’;
//$html .= ‘<td>’ . $datesined . ‘</td>’;
//$html .= ‘<td>’ . $timesined . ‘</td>’;
// $html .= ‘<td>’ . “…..”. ‘</td>’;
if ($organo==”ΔΣ”)
$subdir=”ΔΣ”;
elseif ($organo==”Οικονομική Επιτροπή”)
$subdir=”ΟΙΚΟΝΟΜΙΚΗ ΕΠΙΤΡΟΠΗ”;
//echo $subdir;
//δημιουργία path αρχείου προς κατέβασμα
// $dir = “/var/www/html/apofaseis/$subdir/$etos”;
if (isset($filename) && strlen($filename)){
$dirfile=$httpdir.$subdir.”/”.$etos.”/”.$filename.”.pdf”;
//echo ‘<a href=”‘ . $linkfound. ‘” target=\”_blank\”>’ . str_replace($keyword,'<span style=\”color:red;font-weight:normal\”>’.$keyword,$file) . ‘ (‘.round(filesize($dirfile)/1024).’ kb)’ . ‘</a><br />
$linkfound='<a href=”‘ . $dirfile. ‘” target=\”_blank\”>’ . “Λήψη” . ‘ (‘.round(filesize($dirfile)/1024).’ kb)’. ‘</a><br />’;
$html .= ‘<td>’ .$linkfound. ‘</td>’;
}
else
$dirfile=”no filename”;
// echo $linkfound. “<p>”;
$html .= ‘</tr>’;
} //end while
// Κλείσιμο του tab <table> και του <div> και εκτύπωση
$html .= ‘</table>’;
$html .= ‘</div>’;
echo $html;
$result1 = $conn->query($sqlcount);
//$result1 = mysql_query($sqlcount);
$cou = mysqli_num_rows($result1);
//echo $_PHP_SELF;
$a=$cou/20;
$a=ceil($a);
for($b=1;$b<=$a;$b++){
if ($page==$b)
echo “<a href = \”ndex.php?option=com_k2&view=item&layout=item&id=969&page=$b\”><font color=\”red\” size=\”4\”>$b </a>”;
else
echo “<a href = \”ndex.php?option=com_k2&view=item&layout=item&id=969&page=$b\”><font size=\”3\”>$b </a>”;
}
// Αν δεν είναι η πρώτη σελίδα, $page>1 // εμφάνιση της επιλογής “ΠΡΟΗΓΟΥΜΕΝΟ”
echo “<p>”;
echo “<p>”;
if ( $page > 1 ) {
$prev=$page-1;
echo “<a href=\”index.php?option=com_k2&view=item&layout=item&id=969&page=$prev\”><font color=\”red\”> Προηγούμενο</a>”;
}
// Αν δεν είναι η τελευταία σελίδα ($id != $total) // εμφάνιση της επιλογής “ΕΠΟΜΕΝΟ”
if ( $page != $a ) {
if ($page==0) $page=1;
$next=$page+1;
echo “<a class=\”page\” href=\”index.php?option=com_k2&view=item&layout=item&id=969&page=$next\”><font color=\”red\”> Επόμενο</a>”;
}
echo “<center><a href=\”index.php/enimerosi-pvlitvn/synedreiaseis/apofaseis\”><font color=\”red\”>Νέα αναζήτηση</a></center>”;
echo “<p>”;
?>
{/source}