Changeset 148 for www/otevreno.php


Ignore:
Timestamp:
Feb 15, 2009, 7:59:35 PM (16 years ago)
Author:
george
Message:
  • Upraveno: Přepracován systém generování zobrazení výstupu. Pro nový systím přepsáno mnoho stránek.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/otevreno.php

    r146 r148  
    11<?php
    2 include('style.php');
     2include_once('global.php');
    33
    4 ShowHeader('Otvírací doby místních subjektů', 'Otvírací doby');
    5 $DaysOfWeek = array('Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota', 'Neděle');
     4class SubjectOpenTimePage extends Page
     5{
     6  var $FullTitle = 'Otvírací doby místních subjektů';
     7  var $ShortTitle = 'Otvírací doby';
     8  var $DaysOfWeek = array('Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota', 'Neděle');
    69
    710  function Show()
    811  {
    9         global $Database, $DaysOfWeek;
    10        
    1112    $Output = '<div align="center">';
    12     $DbResult = $Database->query('SELECT SubjectOpenTime.*, DATE_FORMAT(SubjectOpenTime.UpdateTime, "%e.%c.%Y") as UpdateTime, Subject.Name as Name FROM SubjectOpenTime JOIN Subject ON Subject.Id = SubjectOpenTime.Subject');
     13    $DbResult = $this->Database->query('SELECT SubjectOpenTime.*, DATE_FORMAT(SubjectOpenTime.UpdateTime, "%e.%c.%Y") as UpdateTime, Subject.Name as Name FROM SubjectOpenTime JOIN Subject ON Subject.Id = SubjectOpenTime.Subject');
    1314    while($Subject = $DbResult->fetch_array())
    1415    {
    1516      $Output .= '<strong>'.$Subject['Name'].':</strong><br />';
    16       $DbResult2 = $Database->query('SELECT Subject, OpenTime, CloseTime, TIMEDIFF(CloseTime, DATE_FORMAT(NOW(), "0000-01-%w %T")) as RemainTime FROM `SubjectOpenTimeInterval` WHERE DATE_FORMAT(NOW(), "0000-01-%w %T") > OpenTime AND DATE_FORMAT(NOW(), "0000-01-%w %T") < CloseTime AND Subject='.$Subject['Subject']);
     17      $DbResult2 = $this->Database->query('SELECT Subject, OpenTime, CloseTime, TIMEDIFF(CloseTime, DATE_FORMAT(NOW(), "0000-01-%w %T")) as RemainTime FROM `SubjectOpenTimeInterval` WHERE DATE_FORMAT(NOW(), "0000-01-%w %T") > OpenTime AND DATE_FORMAT(NOW(), "0000-01-%w %T") < CloseTime AND Subject='.$Subject['Subject']);
    1718      if($DbResult2->num_rows > 0)
    1819      {
     
    2122      } else
    2223      {
    23         $DbResult2 = $Database->query('SELECT Subject, OpenTime, CloseTime, TIMEDIFF(OpenTime, DATE_FORMAT(NOW(), "0000-01-%w %T")) as RemainTime FROM `SubjectOpenTimeInterval` WHERE DATE_FORMAT(NOW(), "0000-01-%w %T") < OpenTime AND Subject='.$Subject['Subject'].' ORDER BY OpenTime LIMIT 1');
     24        $DbResult2 = $this->Database->query('SELECT Subject, OpenTime, CloseTime, TIMEDIFF(OpenTime, DATE_FORMAT(NOW(), "0000-01-%w %T")) as RemainTime FROM `SubjectOpenTimeInterval` WHERE DATE_FORMAT(NOW(), "0000-01-%w %T") < OpenTime AND Subject='.$Subject['Subject'].' ORDER BY OpenTime LIMIT 1');
    2425        $DbRow = $DbResult2->fetch_array();
    2526        $Output .= 'Otevírá za '.$DbRow['RemainTime'];
     
    2728      $Output .= '<table class="WideTable">
    2829<tr><th>Den</th><th>Čas</th></tr>';
    29       foreach($DaysOfWeek as $DayIndex => $DayOfWeek)
     30      foreach($this->DaysOfWeek as $DayIndex => $DayOfWeek)
    3031      {
    31         $DbResult2 = $Database->query('SELECT *, DATE_FORMAT(OpenTime, "%k:%i") as OpenTime, DATE_FORMAT(CloseTime, "%k:%i") as CloseTime FROM SubjectOpenTimeInterval WHERE SubjectOpenTimeInterval.Subject = '.$Subject['Subject'].' AND ((DAYOFWEEK(OpenTime) + 0) MOD 7)='.$DayIndex);
     32        $DbResult2 = $this->Database->query('SELECT *, DATE_FORMAT(OpenTime, "%k:%i") as OpenTime, DATE_FORMAT(CloseTime, "%k:%i") as CloseTime FROM SubjectOpenTimeInterval WHERE SubjectOpenTimeInterval.Subject = '.$Subject['Subject'].' AND ((DAYOFWEEK(OpenTime) + 0) MOD 7)='.$DayIndex);
    3233        $Output .= '<tr><td>'.$DayOfWeek.'</td><td align="center">';
    3334        if($DbResult2->num_rows)
     
    4748    return($Output);
    4849  }
     50}
    4951
    50 echo(Show());
    51 
    52 ShowFooter();
     52$System->AddModule(new SubjectOpenTimePage());
     53$System->Modules['SubjectOpenTimePage']->GetOutput();
    5354
    5455?>
Note: See TracChangeset for help on using the changeset viewer.