function generateAllCharts() { $genres = getGenres(); sort($genres); foreach ($genres as $genre) { $output = $genre["genre"]; generateCharts($output); } }
function getChartCategories() { $genres = getGenres(); sort($genres); $output = ''; foreach ($genres as $genre) { $currGenre = ucfirst($genre['genre']); $output .= "<li><a href='#' id='{$currGenre}' onclick='chart(this)'>{$currGenre}</a></li>"; } return $output; }
/** * Generate genres array for use with genre checkboxes * * @param array $selected selected genre IDs * @return string HTML for genre checkboxes */ function out_genres2($item_genres = null) { // get detailed genres $all_genres = getGenres(); $adultgenres = array(); if ($config['multiuser'] && !check_permission(PERM_ADULT)) { $adultgenres = get_adult_genres(); } $genres = array(); foreach ($all_genres as $gen) { // don't show adult genres if no permissions if (in_array($gen['id'], $adultgenres)) { continue; } // selected? if ($item_genres) { $gen['checked'] = @in_array($gen['id'], $item_genres) ? 1 : 0; } $genres[] = $gen; } return $genres; }
<option value="-1">Choose A Director</option> <?php $directorNames = getDirectors(); foreach ($directorNames as $director) { echo "<option value='" . $director['director'] . "'>" . $director['director'] . "</option>"; } ?> </select> </td> <td> <h3>Genre</h3> <select size=1 name="genre"> <option value="-1">Choose A Genre</option> <?php $movieGenres = getGenres(); foreach ($movieGenres as $genre) { echo "<option value='" . $genre['genre'] . "'>" . $genre['genre'] . "</option>"; } ?> </select> </td> <td> <h3>Rating</h3> <select size="1" name="rating"> <option value="-1">Choose A Rating</option> <?php $movieRatings = getRatings(); foreach ($movieRatings as $rating) { echo "<option value='" . $rating['rating'] . "'>" . $rating['rating'] . "</option>";
} foreach ($comments as $comment) { insertComment($comment); } // echo "<!-- Send the transaction and unlock the database. -->\n"; $app->commit(); header("location: /app/"); exit; break; // Reviews. // Reviews. case "review": require 'model/audiences.php'; $ages = getAges(); require 'model/genres.php'; $genres = getGenres(); require 'model/games.php'; $games = getGames(); $title = "Comparative Review - Review"; $active = "app"; include '../view/head.php'; include '../view/header.php'; include 'content/video_game_review.php'; break; case "submit_review": // echo "<!-- Get the different answers from the form. -->\n"; $review["age_id"] = filter_input(INPUT_POST, "age", FILTER_VALIDATE_INT); $review["like"] = trim(filter_input(INPUT_POST, "like", FILTER_SANITIZE_STRING)); $review["game"] = trim(filter_input(INPUT_POST, "game", FILTER_SANITIZE_STRING)); $review["genre"] = trim(filter_input(INPUT_POST, "genre", FILTER_SANITIZE_STRING)); $review["gender"] = trim(filter_input(INPUT_POST, "gender", FILTER_SANITIZE_STRING));
/** Function getInfoFilm return all movies with all information. It's possible to precised an attribute of the movie @param db connector PDO of the db @param attr array of filter for table movies /!\ Special syntax !!! Look example /!\ @param filter array of filter for other table /!\ Special syntax @return Success = array of Movies, Echec = False @example Example of attributes - field is the field in database - value : is the value for the test ('%r%' or '1', ...) - sign : is the sign for the comparation for permit compart string with special test % or _ ( '=' or 'LIKE', ...) $attr = array( 'field' => array( 'value', 'sign' ); Example of filter - field is the type of filter ('genres', 'countries', 'studios', 'actor', 'writer', 'director', 'producer', ) - value is the value for make filter /!\ add % caracter where you want for actor, writer, director and producer $filter = array( 'field' => value, 'actor' => %sara%toto% ) */ function getInfoMovies($db, $attr = array(), $filter = array()) { //recure filter array $secur = array('genres' => false, 'studios' => false, 'countries' => false, 'actor' => false, 'writer' => false, 'producer' => false, 'director' => false); $filter = array_merge($secur, $filter); $query = 'SELECT * FROM movies '; $query .= 'INNER JOIN files ON files.`fkMovies` = movies.`idMovies` '; $first = true; foreach ($attr as $key => $value) { $sign = $value[1]; if ($first) { $first = false; $query .= "WHERE movies.{$key} {$sign} '{$value[0]}' "; } else { $query .= "AND movies.{$key} {$sign} '{$value[0]}' "; } } $query .= "GROUP BY movies.`idMovies`"; $req = $db->prepare($query); if (!$req->execute()) { $error = $req->errorCode(); $error = "Error occurred during the execution of the request ('{$error}')"; //echo $error; return false; } if ($req->rowCount() >= 1) { $result = $req->fetchAll(); } else { return false; } for ($i = 0, $size = count($result); $i < $size; $i++) { $id = $result[$i]["idMovies"]; /* Need REWORK ! */ if (($result[$i]["genres"] = getGenres($db, $id, $filter['genres'])) === false && $filter['genres'] !== false) { unset($result[$i]); continue; } if (($result[$i]["countries"] = getCountries($db, $id, $filter['countries'])) === false && $filter['countries'] !== false) { unset($result[$i]); continue; } if (($result[$i]["writer"] = getPeople($db, $id, DB_WRITER_TYPE, $filter['writer'])) === false && $filter['writer'] !== false) { unset($result[$i]); continue; } if (($result[$i]["director"] = getPeople($db, $id, DB_DIRECTOR_TYPE, $filter['director'])) === false && $filter['director'] !== false) { unset($result[$i]); continue; } if (($result[$i]["actor"] = getPeople($db, $id, DB_ACTOR_TYPE, $filter['actor'])) === false && $filter['actor'] !== false) { unset($result[$i]); continue; } if (($result[$i]["producer"] = getPeople($db, $id, DB_PRODUCER_TYPE, $filter['producer'])) === false && $filter['producer'] !== false) { unset($result[$i]); continue; } if (($result[$i]["studios"] = getStudios($db, $id, $filter['studios'])) === false && $filter['studios'] !== false) { unset($result[$i]); continue; } } return $result; }
{ $dbh = new PDO('<host>', '<user>', '<password>'); return $dbh; } include "server/items.php"; $terms = isset($_GET['terms']) ? $_GET['terms'] : ""; $order = isset($_GET['order']) ? $_GET['order'] : 1; $genre = isset($_GET['genre']) ? "%" . $_GET['genre'] . "%" : "%"; $arr = searchItems($terms, $order, $genre); echo $arr; ?> ; var Genres = <?php echo json_encode(getGenres()); ?> //Games = JSON.parse(Games); function renderGameDiv(obj){ var _div = $("<div />",{class:"search_game_cont row"}); var _img = $("<img />",{src:obj.image_url}); var _imgDiv = $("<div />",{class:"col-sm-3"}); _imgDiv.append(_img); var _textDiv = $("<div />",{class:"col-sm-6"}); // title var _titleA = $("<a />",{href:"item.php?id="+obj.id});
<a href="#">L</a> <a href="#">M</a> <a href="#">N</a> <a href="#">O</a> <a href="#">P</a> <a href="#">R</a> <a href="#">S</a> <a href="#">T</a> <a href="#">V</a> <a href="#">W</a> <a href="#">Z</a> </nav> <nav class="thirdnav" id="genres"> <?php //get genres $menugenres = getGenres(); foreach ($menugenres['genre'] as $menugenre) { ?> <a href="genre.php?id=<?php echo $menugenre['id']; ?> "><?php echo $menugenre['name']; ?> </a> <?php } ?> </nav> <nav class="thirdnav" id="allreviews"> <?php
<strong>Director:</strong> <?php echo getDirector($row); ?> </div> <div id="runtime"> <strong>Runtime:</strong> <?php echo getRuntime($row); ?> </div> <div id="genres"> <strong>Genres:</strong> <?php echo getGenres($row); ?> </div> <!--div id="trailer"> <strong><?php echo getTrailerUrl($row); ?> </strong> </div--> <div id="tmdblink"> Get more at: <?php echo getTmdbLink(); ?> /<?php echo getImdbLink($row);
case 'getGenres': //retourne tous les genres disponibles en brut->ok $mySqueezeCLI = new SqueezeCLI(getGenres()); $response = $mySqueezeCLI->receiveCLI(); echo $response."\n"; break; */ /* case 'getGenres': //retourne tous les genres disponibles en brut->ok $mySqueezeCLI = new SqueezeCLI(getGenres()); $response = $mySqueezeCLI->receiveCLI(); echo $response."\n"; break; */ case 'listGenres': //formate le résultat de getGenres en html ->ok $mySqueezeCLI = new SqueezeCLI(getGenres()); //var_dump($mySqueezeCLI); $response = $mySqueezeCLI->receiveCLI(); listGenres($response); break; case 'getAllAlbums': //retourne tous les albums disponibles (avec nom, artiste, pochette) ->ok $mySqueezeCLI = new SqueezeCLI(getAllAlbums()); $response = $mySqueezeCLI->receiveCLI(); echo $response . "\n"; break; case 'getAlbumsByGenre': //les fichiers au format mp3 n'indique pas forcément le genre de l'album, que l'on peut retrouver dans ses titres exemple: setAlbumsGenre_Hip-hop/Rap 5 //recherche tous les titres avec genre = parameter, puis recherche leurs albums //print_r($tabAlbumsGenre); //setAlbumsGenre retourne un tableau contenant key -> album_id | value -> genre