Changeset 52 for trunk/Modules/Event


Ignore:
Timestamp:
Jan 4, 2020, 11:59:33 AM (5 years ago)
Author:
chronos
Message:
  • Added: New filter data type Boolean for representing on/off switches.
  • Added: Show only upcoming events. Allow to show also past events.
Location:
trunk/Modules/Event
Files:
3 edited

Legend:

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

    r51 r52  
    5858  public $Id;
    5959  public $Database;
     60  public $AddedCount;
     61
     62  function ImportInternal()
     63  {
     64  }
    6065
    6166  function Import()
    6267  {
    6368    $this->AddedCount = 0;
    64     $Output = 'Parsing '.$this->Name.' ('.$this->Id.')...</br>';
     69    $Output = 'Parsing '.$this->Name.' ('.$this->Id.')...';
     70    $this->ImportInternal();
     71    $Output .= 'done.';
     72    if ($this->AddedCount > 0) $Output .= ' '.$this->AddedCount.' new.';
     73    $Output .= '</br>'."\n";
    6574    return $Output;
    6675  }
  • trunk/Modules/Event/EventPage.php

    r51 r52  
    3838    $Filter = new Filter();
    3939    $Filter->Items = array(
     40      array('Name' => 'past', 'Type' => 'Boolean', 'DbName' => '', 'Title' => 'Proběhlé'),
    4041      array('Name' => 'title', 'Type' => 'String', 'DbName' => 'Title', 'Title' => 'Titulek'),
    4142      array('Name' => 'description', 'Type' => 'String', 'DbName' => 'Description', 'Title' => 'Popis'),
    42       array('Name' => 'price', 'Type' => 'String', 'DbName' => 'Price', 'Title' => 'Cena'),
     43      array('Name' => 'price', 'Type' => 'Integer', 'DbName' => 'Price', 'Title' => 'Cena'),
    4344      array('Name' => 'location', 'Type' => 'String', 'DbName' => 'Location', 'Title' => 'Umístění'),
    4445      array('Name' => 'source', 'Type' => 'String', 'DbName' => 'SourceName', 'Title' => 'Import'),
     
    5354    $Output .= $Filter->GetOutput($this->System->Link('/udalosti/'));
    5455    $Where = $Filter->GetWhere($this->Database);
     56    if ($_SESSION['past'] != 1) $Where .= ' AND (TimeFrom > NOW())';
    5557
    5658    $DbResult = $this->Database->query('SELECT COUNT(*) FROM (SELECT *, '.
     
    7173      array('Name' => '', 'Title' => 'Detail'),
    7274    );
    73     $Order = GetOrderTableHeader($TableColumns, 'TimeFrom', 1);
     75    $Order = GetOrderTableHeader($TableColumns, 'TimeFrom', 0);
    7476    $Output .= '<table class="WideTable">';
    7577    $Output .= $Order['Output'];
  • trunk/Modules/Event/Import/JoeClub.php

    r51 r52  
    33class EventSourceJoeClub extends EventSource
    44{
    5   function Import()
     5  function ImportInternal()
    66  {
    7     $Output = parent::Import();
     7    $Output = '';
    88    $Content = file_get_contents($this->URL);
    99
     
    6262    $Event->Price = trim(str_replace('Kč', '', $Event->Price));
    6363    if ($Event->Price == 'Zdarma') $Event->Price = 0;
     64    if ($Event->Price == '') $Event->Price = 0;
    6465    return $Output;
    6566  }
Note: See TracChangeset for help on using the changeset viewer.