<?php
include "config.php";
session_start();
include_once 'db/dbconfig.php';
require_once 'admin/objects/kasutaja.class.php';
$user_home = new Kasutaja();

include('header.php');
?>

<div class="container">

    <?php
    include("scripts/kategooriate-nav.php");

    $kategooria = isset($_GET['kategooria']) ? $_GET['kategooria'] : 0;

    if($kategooria != ''){
        include_once 'admin/objects/kategooria.class.php';

        $database = new Database();
        $db = $database->dbConnection();

        $cat = new Kategooria($db);
        $cat->id=$kategooria;

        $cat->readName();

        echo '<div class="col-md-9"><h3 class="decorated"><span>' . $cat->nimi . '</span></h3><br />';

    } else {
        echo '
        <div class="col-md-9">
            <div class="row carousel-holder">

                <div class="col-md-12">
                    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                        <ol class="carousel-indicators">
                            <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                            <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                            <li data-target="#carousel-example-generic" data-slide-to="2"></li>
                        </ol>
                        <div class="carousel-inner">
                            <div class="item active">';
                                /* Carouselis kasutatud piltide allikad:
                                img1: http://www.camdenpassageislington.co.uk/shops/kevin-page-oriental-art.htm (9.05.2016)
                                img2: http://raskinantiques.com/ (9.05.2016)
                                img3: http://pickwickantiques.com/about-pickwick/ (9.05.2016)
                                */
                                echo'
                                <img class="slide-image" src="'.HTTP.'admin/img/carousel/img1.jpg" alt="">
                            </div>
                            <div class="item">
                                <img class="slide-image" src="'.HTTP.'admin/img/carousel/img2.jpg" alt="">
                            </div>
                            <div class="item">
                                <img class="slide-image" src="'.HTTP.'admin/img/carousel/img3.jpg" alt="">
                            </div>
                        </div>
                        <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
                            <span class="glyphicon glyphicon-chevron-left"></span>
                        </a>
                        <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
                            <span class="glyphicon glyphicon-chevron-right"></span>
                        </a>
                    </div>
                    </div>
            </div>';

            echo '<h3 class="decorated"><span>Peagi lõppevad oksjonid</span></h3><br />';
        }
        ?>

        <?php

        echo '<div class="row">';

        // Kuvame peagi lõppevad oksjonid carousel'i alla
        include("scripts/kuva_oksjonid.php");

        $page_dom = basename(__FILE__);
        echo '</div><center>';
        if(isset($_GET['kategooria'])){
          $page_dom = $page_dom . "?kategooria=".$kategooria;
      }

      include_once ROOT.'admin/internetioksjon/paging_oksjon.php';

      echo'</center>';
      echo'</div>
  </div>';
  include "footer.php";
