source: trunk/Modules/Movie/Movie.php

Last change on this file was 63, checked in by chronos, 3 years ago
  • Modified: Used explicit types where possible for better error reporting.
  • Modified: Updated Common packaged to newer version.
  • Modified: Simplified pages title.
  • Added: Simple keyword based spam filter for meet items.
File size: 2.6 KB
Line 
1<?php
2
3class ModuleMovie extends Module
4{
5 function __construct($System)
6 {
7 parent::__construct($System);
8 $this->Name = 'Movie';
9 $this->Version = '1.0';
10 $this->Creator = 'Chronos';
11 $this->License = 'GNU/GPL';
12 $this->Description = 'List of dance movies';
13 $this->Dependencies = array();
14 $this->RSSChannels = array();
15 }
16
17 function Start(): void
18 {
19 $this->System->RegisterPage(['filmy'], 'PageMovieList');
20 Core::Cast($this->System)->RegisterMenuItem('/filmy', 'Filmy');
21 }
22}
23
24class PageMovieList extends Page
25{
26 function __construct($System)
27 {
28 parent::__construct($System);
29 $this->Title = 'Filmy';
30 $this->Description = 'Taneční filmy';
31 }
32
33 function Show(): string
34 {
35 $Output = '';
36 if (array_key_exists('lvm', $_GET) and ($_GET['lvm'] == 'seznam'))
37 $this->RawPage = true;
38 else $Output .= '<div class="title">Filmy</div>';
39
40 $Filter = new Filter();
41 $Filter->Items = array(
42 array('Name' => 'year', 'Type' => 'Integer', 'DbName' => 'Year', 'Title' => 'Rok'),
43 array('Name' => 'namecz', 'Type' => 'String', 'DbName' => 'NameCz', 'Title' => 'Český název'),
44 array('Name' => 'nameen', 'Type' => 'String', 'DbName' => 'NameEn', 'Title' => 'Anglický název'),
45 );
46 $Output .= $Filter->GetOutput($this->System->Link('/filmy/'));
47 $Where = $Filter->GetWhere($this->Database);
48
49 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Movie WHERE '.$Where);
50 $DbRow = $DbResult->fetch_row();
51 $PageList = GetPageList($DbRow[0]);
52 $Output .= $PageList['Output'];
53 $TableColumns = array(
54 array('Name' => 'Year', 'Title' => 'Rok'),
55 array('Name' => 'NameCz', 'Title' => 'Český název'),
56 array('Name' => 'NameEn', 'Title' => 'Anglický název'),
57 array('Name' => 'Imdb', 'Title' => 'IMDB'),
58 array('Name' => 'Csfd', 'Title' => 'ČSFD'),
59 );
60 $Order = GetOrderTableHeader($TableColumns, 'Year', 1);
61
62 $Output .= '<div id="list_content">';
63 $Output .= '<table class="WideTable">';
64 $Output .= $Order['Output'];
65 $Output .= '</tr>';
66 $DbResult = $this->Database->select('Movie', '*', $Where.$Order['SQL'].$PageList['SQLLimit']);
67 while ($Movie = $DbResult->fetch_assoc())
68 {
69 $Output .= '<tr>'.
70 '<td>'.$Movie['Year'].'</td>'.
71 '<td>'.$Movie['NameCz'].'</td>'.
72 '<td>'.$Movie['NameEn'].'</td>'.
73 '<td><a href="'.$Movie['Imdb'].'">Otevřít</a></td>'.
74 '<td><a href="'.$Movie['Csfd'].'">Otevřít</a></td>'.
75 '</tr>';
76 }
77 $Output .= '</table>';
78 $Output .= '</div>';
79 $Output .= $PageList['Output'];
80
81 return $Output;
82 }
83}
Note: See TracBrowser for help on using the repository browser.