Ejemplo n.º 1
0
            </section>
            <h1 id="lib"><a href="http://coss.github.com/bnetlib" title="End User Documentation">bnetlib</a></h1>
    </header>
    <section>
        <section>
            <article>
                <div class="inner">
                    <h1>Auction Demo</h1>
                    <?php 
use bnetlib\Locale\Locale;
use bnetlib\Connection\Stub;
use bnetlib\WorldOfWarcraft;
use bnetlib\Resource\Entity\Wow\Auction\Faction;
$locale = new Locale(Stub::LOCALE_GB, WorldOfWarcraft::SHORT_NAME);
$wow = new WorldOfWarcraft(new Stub());
$wow->getConnection()->setOptions(array('defaults' => array('region' => Stub::REGION_EU)));
$wow->getServiceLocator()->setLocale($locale);
$auction = $wow->getAuction(array('realm' => 'Die ewige Wacht'));
$auctionData = $wow->getAuctionData($auction);
foreach (array(0 => 'getAlliance', 1 => 'getHorde') as $id => $method) {
    printf('<h2>%s</h2>', $locale->get('faction.' . $id));
    /* @var $faction Faction */
    $faction = call_user_func(array($auctionData, $method));
    $ruby = $faction->getByItem(52986);
    if (empty($ruby)) {
        echo '<p>No "Heartblossom" listed.</p>';
    } else {
        printf('<p>Found <strong>%d</strong> entries for "Heartblossom". ' . 'The duration for <strong>%d</strong> auctions is "Short".</p>', count($ruby), count($faction->getItemAndTimeIntersection(52177, Faction::TIME_SHORT)));
        echo '<table><thead><tr><th>Auction Id</th><th>Quantity</th><th>Owner</th>';
        echo '<th>Bid</th><th>Buyout</th><th>Duration</th></tr></thead><tbody>';
        foreach ($ruby as $key => $auction) {