<?php require_once 'header.php'; //$top_movies = array_slice($movies, 0, 8); //$top_movies = $db->query('SELECT * FROM movies ORDER BY year DESC LIMIT 8')->fetchAll(); //$rand_movies = $db->query('SELECT * FROM movies ORDER BY RAND() LIMIT 3')->fetchAll(); $top_movies = Movie::getList(8, 'year DESC'); $rand_movies = Movie::getList(3, 'RAND()'); ?> <div class="row"> <div class="col-xs-12 col-sm-9"> <div class="jumbotron"> <h1>Bienvenue sur Movies !</h1> <p>Le site n°1 du cinéma.<br /> Découvrez notre <a href="search.php">recherche</a> de films et des <a href="news.php">actualités</a> sur le cinéma. </p> </div><!-- .jumbotron --> <div class="row marketing"> <?php foreach ($rand_movies as $key => $movie) { ?> <!-- BLOCK RANDOM MOVIE --> <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4"> <img class="movie-thumbnail" src="<?php echo $movie->getCover(); ?> " />
if (isset($_GET['iDisplayLength'])) { $per_page = $_GET['iDisplayLength']; } else { $per_page = 50; } if ($per_page > 500) { $per_page = 1; } if (isset($_GET['iDisplayStart'])) { $start = $_GET['iDisplayStart']; } else { $start = 0; } $movie = new Movie(); if (isset($_GET['sSearch']) && $_GET['sSearch']) { $movies = $movie->getList(null, $start, $per_page, $sortby, $sortdir, $_GET['sSearch']); } else { $movies = $movie->getList(null, $start, $per_page, $sortby, $sortdir); } $res = array(); $res['sEcho'] = $echo; if (isset($_GET['sSearch']) && $_GET['sSearch']) { $res['iTotalDisplayRecords'] = $movie->getMovieCount($_GET['sSearch']); } else { $res['iTotalDisplayRecords'] = $movie->getMovieCount(); } $res['iTotalRecords'] = count($movies); $res['aaData'] = array(); if (count($movies)) { foreach ($movies as $key => $val) { extract($val);
<?php $top_rating_movies = Movie::getList(5, 'rating DESC', 'id, title'); $most_recent_movies = Movie::getList(5, 'year DESC', 'id, title'); $random_movies = Movie::getList(5, 'RAND()', 'id, title'); $last_news = Movie::_getList($db->query('SELECT news_id as id, news_title as title FROM news ORDER BY news_date DESC LIMIT 5')->fetchAll()); ?> <!-- SIDEBAR --> <div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar"> <?php echo Utils::displayList($top_rating_movies, 'Les 5 films les mieux notés', 'movie.php', 'primary'); echo Utils::displayList($most_recent_movies, 'Les 5 films les plus récents', 'movie.php', 'info'); echo Utils::displayList($random_movies, '5 films au hasard', 'movie.php', 'warning'); echo Utils::displayList($last_news, 'Les dernières actualités', 'article.php'); ?> </div> <!-- END SIDEBAR -->