buy=='Yes') return 1; if ($wine->buy=='No') return 0; return 0.5; } function rowHtml($id,$wine) { global $count, $buyCount; ++$count; $buyCount += buyCount($wine); $ret .= ""; $ret .= sprintf("\n"; return $ret; } $wdb = new WineDB(); $count = 0; $buyCount = 0; #print "\$_GET['store']=".$_GET['store']; for ($i=$wdb->count-1; $i >= 0; --$i) { $id = sprintf("%d",$i); if (!$wdb->exists($id)) continue; $wine = $wdb->get($id); #if ($wine->store) print "store=$wine->store"; if ((array_key_exists('lastTen',$_GET) and $count < 10) or (array_key_exists('country',$_GET) and $wine->country == $_GET['country']) or (array_key_exists('year',$_GET) and $wine->year == $_GET['year']) or (array_key_exists('buy',$_GET) and $wine->buy == $_GET['buy']) or (array_key_exists('color',$_GET) and $wine->color == $_GET['color']) or (array_key_exists('store',$_GET) and $wine->store == quoteEval($_GET['store']))) { print rowHtml($i,$wine); } elseif (array_key_exists('price',$_GET)) { if ($wine->price < 8) { if ($_GET['price']==8) print rowHtml($i,$wine); } elseif ($wine->price < 12) { if ($_GET['price']==12) print rowHtml($i,$wine); } elseif ($wine->price < 18) { if ($_GET['price']==18) print rowHtml($i,$wine); } else if ($_GET['price']==100) print rowHtml($i,$wine); } } $wdb->close(); ?>
Entry DateColorBuy?PriceYearGrape/NameCountryRegion/AppellationVintner
%s",$wine->entryDate->abrStr()); $color = $wine->color=='Red'?' class="red"':($wine->color=='Rose'?' class="rose"':''); $ret .= sprintf("%s",$color,$wine->color); $color = $wine->buy=='Yes'?' class="green"':($wine->buy=='No'?' class="red"':''); $ret .= sprintf("%s",$color,$wine->buy); $ret .= sprintf("\$%d",$wine->price); $ret .= sprintf("%s",$wine->year); if ($wine->grape) $ret .= sprintf("%s",$wine->grape); else $ret .= sprintf("%s",$wine->name); $ret .= sprintf("%s",$wine->country); if ($wine->app) $ret .= sprintf("%s",$wine->app); else $ret .= sprintf("%s",$wine->region); $ret .= sprintf("%s",$wine->vintner); $ret .= sprintf("Details...",$id); $ret .= "
Buy rating: %d%%\n",$buyCount/$count*100); ?>