MovieData::getToplist PHP Method

getToplist() public method

public getToplist ( )
    public function getToplist()
    {
        $data = array();
        $sth = $this->db->query('SELECT imdbinfo.* FROM imdbtop20 LEFT JOIN imdbinfo ON imdbtop20.imdbid = imdbinfo.imdbid ORDER BY imdbtop20.id ASC');
        return $sth->fetchAll(PDO::FETCH_ASSOC);
    }

Usage Example

Esempio n. 1
0
     $movieData = new MovieData($db);
     httpResponse($movieData->search($_GET["search"]));
     break;
 case validateRoute('GET', 'moviedata/imdb/\\w+'):
     $movieData = new MovieData($db);
     $arr = $movieData->getDataByImdbId($params[2]);
     httpResponse($arr);
     break;
 case validateRoute('GET', 'moviedata/toplist'):
     $cacheId = 'toplists-toplist';
     if ($memcache && ($cached = $memcache->get($cacheId))) {
         httpResponse($cached);
     } else {
         $movieData = new MovieData($db);
         $torrent = new Torrent($db);
         $data = $movieData->getToplist();
         $result = array();
         foreach ($data as $movie) {
             $movie["torrents"] = $torrent->getByMovieId($movie["id"]);
             $result[] = $movie;
         }
         $memcache && $memcache->set($cacheId, $result, MEMCACHE_COMPRESSED, 60 * 60 * 6);
         httpResponse($result);
     }
     break;
 case validateRoute('GET', 'start-torrents'):
     $torrent = new Torrent($db);
     $index = explode(',', $user->getIndexList());
     if (!$index[0]) {
         $index = array();
     }