4 * Copyright 2004 $ThePhpWikiProgrammingTeam
6 * This file is (not yet) part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with PhpWiki; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Query results from a local imdb copy.
25 * see amdbfront for the conversion.
26 * "imdb = mysql://user:pass@localhost/imdb" in lib/plugin/SqlResult.ini
29 * <<Imdb query=movie_main title||="Sample Movie (2002)" >>
30 * <<Imdb query=movie_combined title||="Sample Movie (2002)" >>
31 * <<Imdb query=movie_full title||="Sample Movie (2002)" >>
32 * <<Imdb query=movie_company_credits title||="Sample Movie (2002)" >>
33 * <<Imdb query=name name||="Lastname, Firstname (I)" >>
35 * business, moviebudgets, colorinfo, mpaaratingsreasons,
36 * akatitles, alternateversions, miscellaneouscompanies, moviecountries,
37 * certificates, completecast, completecrew, crazycredits, genres, goofs,
38 * keywords, movielinks, plot, quotes, ratings, soundtracks, specialeffectscompanies,
39 * taglines, trivia, distributors, language, laserdisc, literature, locations,
40 * miscellaneouscompanies, productioncompanies, releasedates, runningtimes, soundmix,
43 * akanames, guestappearances, biographies
49 include_once("lib/plugin/SqlResult.php");
52 extends WikiPlugin_SqlResult
58 function getDescription () {
59 return _("Query a local imdb database");
62 function getDefaultArguments() {
64 'query' => false, // what
65 'template' => false, // TODO: use a custom <theme>/template.tmpl for the result
66 'where' => false, // custom filter for the query
67 'title' => false, // custom filter for the query
68 'name' => false, // custom filter for the query
69 'sortby' => false, // for paging, default none
70 'limit' => false, // for paging, default: only the first 50
74 function run($dbi, $argstr, &$request, $basepage) {
75 $args = $this->getArgs($argstr, $request);
77 include_once("lib/imdb.php");
80 if (method_exists($imdb, $query)) {
81 $SqlResult = $imdb->$query($title ? $title : $name);
86 // if ($limit) ; // TODO: fill paging vars (see PageList)
88 $html = HTML::ol(array('class'=>'sqlresult'));
89 foreach ($SqlResult as $row) {
90 $html->pushContent(HTML::li(array('class'=> $i++ % 2 ? 'evenrow' : 'oddrow'), $row[0]));
93 $html = HTML::table(array('class'=>'sqlresult'));
95 foreach ($SqlResult as $row) {
96 $tr = HTML::tr(array('class'=> $i++ % 2 ? 'evenrow' : 'oddrow'));
97 foreach ($row as $col) {
98 $tr->pushContent(HTML::td($col));
100 $html->pushContent($tr);
103 // if ($limit) ; // do paging via pagelink template
112 // c-hanging-comment-ender-p: nil
113 // indent-tabs-mode: nil