<? 
  $idRestaurantIN = 7;
  header('Content-type: text/xml'); 
  include_once $_SERVER['DOCUMENT_ROOT'].'/c/pignwhistle.incl.php';
  include_once $_SERVER['DOCUMENT_ROOT'].TXPATHSITE.'c/feed.incl.php';
?><rss version="2.0" 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Pig N Whistle, <?php echo getNameRestaurant(); ?></title>
<link>http://www.pignwhistle.com.au/<?php echo getNameDirectoryRestaurant(); ?>/index.xml</link>
<description>Pig N Whistle is the best Pub in <?php echo getNameRestaurant(); ?>, whether you are looking for a fun night out, good food or your next function venue.</description>
<dc:language>en-gb</dc:language>
<dc:rights>Copyright 2002 Pig N Whistle.</dc:rights>
<dc:date>2005-12-17T17:30:04+10:00</dc:date>

<admin:generatorAgent rdf:resource="http://www.pignwhistle.com.au/feed/" />
<admin:errorReportsTo rdf:resource="mailto:rsshelp@pignwhistle.com.au"/>
<sy:updatePeriod>weekly</sy:updatePeriod>
<sy:updateFrequency>3</sy:updateFrequency>
<sy:updateBase>2005-12-17T17:30+10:00</sy:updateBase>

<?php
  $txQuery = getFeedData($idRestaurantIN);
  $result = mysql_query($txQuery);
  
  if (false !== $result) {
    $lsEvents = array();
    while ($row = mysql_fetch_object($result)) {
      writeEventEntry(stripslashes($row->txTitleEvent), stripslashes($row->dsEvent));
    }
    mysql_free_result($result);
  }
  
  $txDays = 'SunMonTueWedThuFriSat';
  $dtNow = time();
  $noDayRoot = date('j', $dtNow) - strpos ( $txDays, date('D', $dtNow) )/3;
      
// no sunday display
      $lsResults[0] = '';

// monday
      $dtMonday =  mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+1, date('Y', $dtNow) );
      if ($dtMonday < $dtNow) {$dtMonday = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+1+7, date('Y', $dtNow) ); }
      $lsResults[1]['title'] = 'Monday Night, '.date('F j', $dtMonday).' - Killer Pool from 7PM';
      $lsResults[1]['desc'] = '<img style="float: left;" src="http://www.pignwhistle.com.au/Indooroopilly/images/home-monday.gif" width="200" height="73" alt="">The Pig N Whistle is The place for Killer Pool on Monday Nights.'."\n";
      $lsResults[1]['date'] = $dtMonday;

// tuesday
      $dtTuesday = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+2, date('Y', $dtNow) );
      if ($dtTuesday < $dtNow) {$dtTuesday = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+2+7, date('Y', $dtNow) ); }
      $lsResults[2]['title'] = 'Trivia night - Tuesday Night, '.date('F j', $dtTuesday).' from 7PM';
      $lsResults[2]['desc'] = '<img style="float: left;" src="http://www.pignwhistle.com.au/Indooroopilly/images/home-tuesday.gif" width="200" height="77" alt=""> Tuesday Trivia at the Pig is something of a tradition. Phone 3878 8899 to register your team now, and come join the fun.'."\n";
      $lsResults[2]['date'] = $dtTuesday;

// no wednesday display
      $lsResults[3] = '';

// thursday
      $dtThursday = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+4, date('Y', $dtNow) );
      if ($dtThursday < $dtNow) {$dtThursday = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+4+7, date('Y', $dtNow) ); }
      $lsResults[4]['title'] = 'Karaoke, Thursday, '.date('F j', $dtThursday).' from 9PM';
      $lsResults[4]['desc'] = '<img style="float: left;" src="http://www.pignwhistle.com.au/Indooroopilly/images/home-thursday.gif" width="200" height="74" alt="">Karaoke on Thursday Nights at the Pig, from 9PM - Come along and show the rest of us how its really done!'."\n";
      $lsResults[4]['date'] = $dtThursday;

// friday / saturday
      $dtFriday = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+5, date('Y', $dtNow) );
      $dtSaturday2 = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+6, date('Y', $dtNow) ); 
      if ($dtFriday < $dtNow) {
        $dtFriday = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+5+7, date('Y', $dtNow) ); 
        $dtSaturday2 = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+5+8, date('Y', $dtNow) ); 
      }  
        $lsResults[5]['title'] = 'Friday and Saturday Night ('.date('jS', $dtFriday).' and '.date('jS F', $dtSaturday2).') - Live Music and DJs';
        $lsResults[5]['desc'] = '<img style="float: left;" src="http://www.pignwhistle.com.au/Indooroopilly/images/home-fri-sat.gif" width="200" height="74" alt="">The Pig N Whistle is proud to feature Brisbane\'s best line-up of live cover bands and DJs, live from the Bombay Polo Club.'."\n";
      $lsResults[5]['date'] = $dtFriday;
      
      $noDayToday = strpos ( $txDays, date('D', $dtNow) )/3;
      if (6 == $noDayToday) { 
        $dtSaturday = mktime ( 0 , 0, 0, date('n', $dtNow), $noDayRoot+6, date('Y', $dtNow) );
        $lsResults[6]['title'] = 'Saturday Night, '.date('F j', $dtSaturday).' - Live Music and DJs';
        $lsResults[6]['desc'] = '<img style="float: left;" src="http://www.pignwhistle.com.au/Indooroopilly/images/home-saturday.gif" width="200" height="74" alt="">The Pig N Whistle is proud to feature Brisbane\'s best line-up of live cover bands and DJs, live from the Bombay Polo Club.'."\n";
        $lsResults[6]['date'] = $dtSaturday;
      }  
      
      for ($jj=0; $jj<=sizeof($lsResults); $jj++) {
        if (isset($lsResults[$jj]['title']) && 0 < sizeof($lsResults[$jj]['title'])) {
          writeEventEntry($lsResults[$jj]['title'], $lsResults[$jj]['desc']);
        }
      }
?>

</channel>
</rss>