> * <> * <> * <> * <> * More title queries: * business, moviebudgets, colorinfo, mpaaratingsreasons, * akatitles, alternateversions, miscellaneouscompanies, moviecountries, * certificates, completecast, completecrew, crazycredits, genres, goofs, * keywords, movielinks, plot, quotes, ratings, soundtracks, specialeffectscompanies, * taglines, trivia, distributors, language, laserdisc, literature, locations, * miscellaneouscompanies, productioncompanies, releasedates, runningtimes, soundmix, * technical * More name queries: * akanames, guestappearances, biographies * job.descriptions * * @author: ReiniUrban */ include_once 'lib/plugin/SqlResult.php'; class WikiPlugin_Imdb extends WikiPlugin_SqlResult { function getDescription() { return _("Query a local imdb database."); } function getDefaultArguments() { return array( 'query' => false, // what 'template' => false, // TODO: use a custom /template.tmpl for the result 'where' => false, // custom filter for the query 'title' => false, // custom filter for the query 'name' => false, // custom filter for the query 'sortby' => false, // for paging, default none 'limit' => false, // for paging, default: only the first 50 ); } function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); extract($args); include_once 'lib/imdb.php'; $imdb = new imdb(); if (method_exists($imdb, $query)) { $SqlResult = $imdb->$query($title ? $title : $name); } else { $SqlResult = array(); } // if ($limit) ; // TODO: fill paging vars (see PageList) if ($ordered) { $html = HTML::ol(array('class' => 'sqlresult')); foreach ($SqlResult as $row) { $html->pushContent(HTML::li(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'), $row[0])); } } else { $html = HTML::table(array('class' => 'sqlresult')); $i = 0; foreach ($SqlResult as $row) { $tr = HTML::tr(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow')); foreach ($row as $col) { $tr->pushContent(HTML::td($col)); } $html->pushContent($tr); } } // if ($limit) ; // do paging via pagelink template return $html; } } // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: