Exemplo n.º 1
0
<?php

/**
 * Created by PhpStorm.
 * User: Colin
 * Date: 2016-02-12
 * Time: 9:19 PM
 */
require_once "includes/config.php";
include_once "includes/page_header.php";
require_once "includes/functions.php";
$movie_array = get_movies();
$show_array = get_shows();
$movie_array = array_filter($movie_array, function ($k) {
    if (strpos($k, $_GET["q"]) != false) {
        return true;
    } else {
        return false;
    }
});
$show_array = array_filter($show_array, function ($k) {
    if (strpos($k, $_GET["q"]) != false) {
        return true;
    } else {
        return false;
    }
});
echo "<H1>Results</H1>";
if (sizeof($movie_array) > 0) {
    echo "<H2>Matching Movies:</H2>";
    foreach ($movie_array as $movie) {
Exemplo n.º 2
0
<?php

/**
 * Created by PhpStorm.
 * User: Colin
 * Date: 2016-02-11
 * Time: 7:53 PM
 *
 * Builds the list of Movies
 */
require_once "functions.php";
$movies = get_movies();
echo sizeof($movies) . " movies" . "<br/>";
foreach ($movies as $movie) {
    print_movie($movie);
}
Exemplo n.º 3
0
    echo $twig->render('movies.html.twig', array('is_logged_in' => is_logged_in(), 'user' => get_user_from_session(), 'genre_ids' => get_movie_genres(), 'movies' => $movies));
} else {
    //Check for get params
    if (isset($_GET['page']) && !empty($_GET['page'])) {
        $page = $_GET['page'];
        $params = array();
        if (isset($_SESSION['genre_id'])) {
            $params['genre_id'] = $_SESSION['genre_id'];
        }
        if (isset($_SESSION['title'])) {
            $params['title'] = $_SESSION['title'];
        }
        if (isset($_SESSION['releasedFrom'])) {
            $params['releasedFrom'] = $_SESSION['releasedFrom'];
        }
        if (isset($_SESSION['releasedTo'])) {
            $params['releasedTo'] = $_SESSION['releasedTo'];
        }
        if (isset($_SESSION['pageResults'])) {
            $pageResults = $_SESSION['pageResults'];
        } else {
            $pageResults = 30;
        }
        $movies = get_movies($params, intval($pageResults), $page);
        echo $twig->render('movies.html.twig', array('is_logged_in' => is_logged_in(), 'user' => get_user_from_session(), 'genre_ids' => get_movie_genres(), 'movies' => $movies));
    } else {
        $movies = get_movies(null, 30, 0);
        echo $twig->render('movies.html.twig', array('is_logged_in' => is_logged_in(), 'user' => get_user_from_session(), 'genre_ids' => get_movie_genres(), 'movies' => $movies));
    }
}
//Check the session state for form values, if we have them and a GET that just means new pagination