Ignore:
Timestamp:
Nov 10, 2019, 1:42:40 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Table filter made more general.
  • Added: Filter for movies table.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Movie/Movie.php

    r38 r46  
    1919    $this->System->RegisterPage('filmy', 'PageMovieList');
    2020    $this->System->RegisterMenuItem('/filmy', 'Filmy');
    21   } 
     21  }
    2222}
    2323
     
    3030    $this->ShortTitle = 'Filmy';
    3131  }
    32  
     32
    3333  function Show()
    3434  {
     35    $Output = '';
    3536    $this->Title = 'Filmy - '.$this->Title;
    36     $Output = '<div class="title">Filmy</div>';
     37    if (array_key_exists('lvm', $_GET) and ($_GET['lvm'] == 'seznam'))
     38      $this->ClearPage = true;
     39      else $Output .= '<div class="title">Filmy</div>';
     40
     41    $Filter = new Filter();
     42    $Filter->Items = array(
     43      array('Name' => 'year', 'Type' => 'Integer', 'DbName' => 'Year', 'Title' => 'Rok'),
     44      array('Name' => 'namecz', 'Type' => 'String', 'DbName' => 'NameCz', 'Title' => 'Český název'),
     45      array('Name' => 'nameen', 'Type' => 'String', 'DbName' => 'NameEn', 'Title' => 'Anglický název'),
     46    );
     47    $Output .= $Filter->GetOutput($this->System->Link('/filmy/'));
     48    $Where = $Filter->GetWhere($this->Database);
     49
     50    $DbResult = $this->Database->query('SELECT COUNT(*) FROM Movie WHERE '.$Where);
     51    $DbRow = $DbResult->fetch_row();
     52    $PageList = GetPageList($DbRow[0]);
     53    $Output .= $PageList['Output'];
     54    $TableColumns = array(
     55      array('Name' => 'Year', 'Title' => 'Rok'),
     56      array('Name' => 'NameCz', 'Title' => 'Český název'),
     57      array('Name' => 'NameEn', 'Title' => 'Anglický název'),
     58      array('Name' => 'Imdb', 'Title' => 'IMDB'),
     59      array('Name' => 'Csfd', 'Title' => 'ČSFD'),
     60    );
     61    $Order = GetOrderTableHeader($TableColumns, 'Year', 1);
     62
     63    $Output .= '<div id="list_content">';
    3764    $Output .= '<table class="WideTable">';
    38     $Output .= '<tr><th>Rok</th><th>Český název</th><th>Anglický název</th><th>IMDb</th><th>ČSFD</th>';
     65    $Output .= $Order['Output'];
    3966    $Output .= '</tr>';
    40     $DbResult = $this->Database->select('Movie', '*', '1 ORDER BY `Year` DESC');
     67    $DbResult = $this->Database->select('Movie', '*', $Where.$Order['SQL'].$PageList['SQLLimit']);
    4168    while($Movie = $DbResult->fetch_assoc())
    4269    {
     
    5077    }
    5178    $Output .= '</table>';
     79    $Output .= '</div>';
     80    $Output .= $PageList['Output'];
    5281
    5382    return($Output);
Note: See TracChangeset for help on using the changeset viewer.