Changeset 101 for devel/www/otevreno.php


Ignore:
Timestamp:
Aug 3, 2008, 6:04:53 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Zobrazování dostupnosti sítě.
  • Přidáno: Skript pro transformaci dat starého webu do nového.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/www/otevreno.php

    r93 r101  
    77  var $ShortTitle = 'Otvírací doby';
    88  var $DaysOfWeek = array('Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota', 'Neděle');
    9   var $Subjects = array(
    10     'Jednota' => array(
    11       'Notice' => '',
    12       'LastUpdateTime' => '2008-07-04',
    13       'Intervals' => array(
    14         array('DayOfWeek' => 0, 'Index' => 0, 'OpenTime' => '7:00:00', 'CloseTime' => '12:00:00'),
    15         array('DayOfWeek' => 0, 'Index' => 1,  'OpenTime' => '14:00:00', 'CloseTime' => '16:30:00'),
    16         array('DayOfWeek' => 1, 'Index' => 0,  'OpenTime' => '7:00:00', 'CloseTime' => '12:00:00'),
    17         array('DayOfWeek' => 2, 'Index' => 0,  'OpenTime' => '7:00:00', 'CloseTime' => '12:00:00'),
    18         array('DayOfWeek' => 2, 'Index' => 1,  'OpenTime' => '14:00:00', 'CloseTime' => '16:30:00'),
    19         array('DayOfWeek' => 3, 'Index' => 0,  'OpenTime' => '7:00:00', 'CloseTime' => '12:00:00'),
    20         array('DayOfWeek' => 3, 'Index' => 1,  'OpenTime' => '14:00:00', 'CloseTime' => '16:30:00'),
    21         array('DayOfWeek' => 4, 'Index' => 0,  'OpenTime' => '7:00:00', 'CloseTime' => '12:00:00'),
    22         array('DayOfWeek' => 4, 'Index' => 1,  'OpenTime' => '13:30:00', 'CloseTime' => '16:30:00'),
    23         array('DayOfWeek' => 5, 'Index' => 0,  'OpenTime' => '6:00:00', 'CloseTime' => '10:30:00'),
    24       ),
    25     ),
    26     'Pošta' => array(
    27       'Notice' => 'Schránka se vybírá v pracovní dny v 7:45 a 9:30',
    28       'LastUpdateTime' => '2007-07-20',
    29       'Intervals' => array(
    30         array('DayOfWeek' => 0, 'Index' => 0,  'OpenTime' => '8:00:00', 'CloseTime' => '10:00:00'),
    31         array('DayOfWeek' => 0, 'Index' => 1,  'OpenTime' => '14:30:00', 'CloseTime' => '15:30:00'),
    32         array('DayOfWeek' => 1, 'Index' => 0,  'OpenTime' => '8:00:00', 'CloseTime' => '10:00:00'),
    33         array('DayOfWeek' => 1, 'Index' => 1,  'OpenTime' => '14:30:00', 'CloseTime' => '15:30:00'),
    34         array('DayOfWeek' => 2, 'Index' => 0,  'OpenTime' => '8:00:00', 'CloseTime' => '10:00:00'),
    35         array('DayOfWeek' => 2, 'Index' => 1,  'OpenTime' => '14:30:00', 'CloseTime' => '15:30:00'),
    36         array('DayOfWeek' => 3, 'Index' => 0,  'OpenTime' => '8:00:00', 'CloseTime' => '10:00:00'),
    37         array('DayOfWeek' => 3, 'Index' => 1,  'OpenTime' => '14:30:00', 'CloseTime' => '15:30:00'),
    38         array('DayOfWeek' => 4, 'Index' => 0,  'OpenTime' => '8:00:00', 'CloseTime' => '10:00:00'),
    39         array('DayOfWeek' => 4, 'Index' => 1,  'OpenTime' => '14:30:00', 'CloseTime' => '15:30:00'),
    40         array('DayOfWeek' => 5, 'Index' => 0,  'OpenTime' => '6:00:00', 'CloseTime' => '10:30:00'),
    41       ),
    42     ),
    43     'Obecní úřad' => array(
    44       'Notice' => 'Zdroj <a href="http://www.zdechov.cz/pages/main.php?pg=obecniurad&cat=1">www.zdechov.cz</a>',
    45       'LastUpdateTime' => '2008-07-07',
    46       'Intervals' => array(
    47         array('DayOfWeek' => 0, 'Index' => 0,  'OpenTime' => '7:00:00', 'CloseTime' => '11:00:00'),
    48         array('DayOfWeek' => 0, 'Index' => 1,  'OpenTime' => '11:30:00', 'CloseTime' => '14:00:00'),
    49         array('DayOfWeek' => 1, 'Index' => 0,  'OpenTime' => '7:00:00', 'CloseTime' => '11:00:00'),
    50         array('DayOfWeek' => 1, 'Index' => 1,  'OpenTime' => '11:30:00', 'CloseTime' => '14:00:00'),
    51         array('DayOfWeek' => 2, 'Index' => 0,  'OpenTime' => '7:00:00', 'CloseTime' => '11:00:00'),
    52         array('DayOfWeek' => 2, 'Index' => 1,  'OpenTime' => '11:30:00', 'CloseTime' => '14:00:00'),
    53         array('DayOfWeek' => 3, 'Index' => 0,  'OpenTime' => '7:00:00', 'CloseTime' => '11:00:00'),
    54         array('DayOfWeek' => 3, 'Index' => 1,  'OpenTime' => '11:30:00', 'CloseTime' => '14:00:00'),
    55         array('DayOfWeek' => 4, 'Index' => 0,  'OpenTime' => '7:00:00', 'CloseTime' => '11:00:00'),
    56         array('DayOfWeek' => 4, 'Index' => 1,  'OpenTime' => '11:30:00', 'CloseTime' => '14:00:00'),
    57       ),
    58     ),
    59     'Kavárna Centrum' => array(
    60       'Notice' => '',
    61       'LastUpdateTime' => '2006-09-13',
    62       'Intervals' => array(
    63         array('DayOfWeek' => 0, 'Index' => 0,  'OpenTime' => '15:00:00', 'CloseTime' => '21:00:00'),
    64         array('DayOfWeek' => 1, 'Index' => 0,  'OpenTime' => '15:00:00', 'CloseTime' => '21:00:00'),
    65         array('DayOfWeek' => 2, 'Index' => 0,  'OpenTime' => '15:00:00', 'CloseTime' => '21:00:00'),
    66         array('DayOfWeek' => 3, 'Index' => 0,  'OpenTime' => '15:00:00', 'CloseTime' => '21:00:00'),
    67         array('DayOfWeek' => 4, 'Index' => 0,  'OpenTime' => '15:00:00', 'CloseTime' => '21:00:00'),
    68         array('DayOfWeek' => 5, 'Index' => 0,  'OpenTime' => '15:00:00', 'CloseTime' => '22:00:00'),
    69       ),
    70     ),
    71     'Knihovna' => array(
    72       'Notice' => '',
    73       'LastUpdateTime' => '2004-08-20',
    74       'Intervals' => array(
    75         array('DayOfWeek' => 4, 'Index' => 0,  'OpenTime' => '14:30:00', 'CloseTime' => '17:00:00'),
    76       ),
    77     ),
    78     'Koliba' => array(
    79       'Notice' => '',
    80       'LastUpdateTime' => '2008-04-29',
    81       'Intervals' => array(
    82         array('DayOfWeek' => 2, 'Index' => 0,  'OpenTime' => '14:00:00', 'CloseTime' => '22:00:00'),
    83         array('DayOfWeek' => 3, 'Index' => 0,  'OpenTime' => '14:00:00', 'CloseTime' => '22:00:00'),
    84         array('DayOfWeek' => 4, 'Index' => 0,  'OpenTime' => '14:00:00', 'CloseTime' => '27:00:00'),
    85         array('DayOfWeek' => 5, 'Index' => 0,  'OpenTime' => '14:00:00', 'CloseTime' => '27:00:00'),
    86         array('DayOfWeek' => 6, 'Index' => 0,  'OpenTime' => '14:00:00', 'CloseTime' => '21:00:00'),
    87       ),
    88     ),
    89     'Hospoda Kasino' => array(
    90       'Notice' => '',
    91       'LastUpdateTime' => '2008-07-04',
    92       'Intervals' => array(
    93         array('DayOfWeek' => 0, 'Index' => 0,  'OpenTime' => '16:00:00', 'CloseTime' => '21:00:00'),
    94         array('DayOfWeek' => 1, 'Index' => 0,  'OpenTime' => '16:00:00', 'CloseTime' => '21:00:00'),
    95         array('DayOfWeek' => 2, 'Index' => 0,  'OpenTime' => '17:00:00', 'CloseTime' => '21:00:00'),
    96         array('DayOfWeek' => 3, 'Index' => 0,  'OpenTime' => '17:00:00', 'CloseTime' => '21:00:00'),
    97         array('DayOfWeek' => 4, 'Index' => 0,  'OpenTime' => '16:00:00', 'CloseTime' => '24:00:00'),
    98         array('DayOfWeek' => 5, 'Index' => 0,  'OpenTime' => '14:00:00', 'CloseTime' => '24:00:00'),
    99         array('DayOfWeek' => 6, 'Index' => 0,  'OpenTime' => '10:00:00', 'CloseTime' => '21:00:00'),
    100       ),
    101     ),
    102   );
    1039
    10410  function Show()
    10511  {
    106     //$this->ImportToDatabase();
    107 
    10812    $Output = '<div align="center">';
    10913    $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');
     
    14448    return($Output);
    14549  }
    146 
    147   function ImportToDatabase()
    148   {
    149     $this->Database->query('DELETE FROM Subject WHERE Subject.Id = SubjectOpenTime.Subject');
    150     $this->Database->query('TRUNCATE TABLE SubjectOpenTime');
    151     $this->Database->query('TRUNCATE TABLE SubjectOpenTimeInterval');
    152     foreach($this->Subjects as $SubjectName => $Subject)
    153     {
    154       $this->Database->insert('Subject', array('Name' => $SubjectName));
    155       $Subject['Id'] = $this->Database->insert_id;
    156       $this->Database->insert('SubjectOpenTime', array('Notice' => $Subject['Notice'], 'UpdateTime' => $Subject['LastUpdateTime'], 'Subject' => $Subject['Id']));
    157       foreach($Subject['Intervals'] as $TimeInterval)
    158       {
    159         $TimeInterval['Subject'] = $Subject['Id'];
    160         $TimeInterval['OpenTime'] = '0000-01-0'.($TimeInterval['DayOfWeek'] + 1).' '.$TimeInterval['OpenTime'];
    161         $TimeInterval['CloseTime'] = '0000-01-0'.($TimeInterval['DayOfWeek'] + 1).' '.$TimeInterval['CloseTime'];
    162         unset($TimeInterval['DayOfWeek']);
    163         unset($TimeInterval['Index']);
    164         $this->Database->insert('SubjectOpenTimeInterval', $TimeInterval);
    165         //echo($this->Database->LastQuery.'<br>');
    166       }
    167     }
    168   }
    16950}
    17051
Note: See TracChangeset for help on using the changeset viewer.