<?php if (false === isset($this->soapResponse)) { $chunk .= 'This area will show raw exchange response output with each exchange request'; } else { if (true === isset($this->soapResponse->Result->paymentCardItems)) { $chunk .= 'I am not going to show you this bit. '; } else { $chunk .= betfairHelper::returnVar($this->soapResponse); } } $chunk .= <<<EOT </div> <div class="yui-u"> \t </div> <div class="yui-u"> EOT; if (isset($displayUnit)) { $chunk .= $displayUnit; } $chunk .= <<<EOT </div> </div> </div> \t</div> \t<div class="yui-b"> \t\t<!--div class="counit"> <a href="http://www.anrdoezrs.net/gj117vpyvpxCGKLLEHJCEDJMDJFL" target="_top" onmouseover="window.status='http://www.totesport.com/asset_tracker?action=go_asset&new=1&aff_id=115&asset_id=118';return true;" onmouseout="window.status=' ';return true;"> <img src="http://www.awltovhc.com/46108m-3sywHLPQQJMOHJIORIOKQ" alt="Bet now with totesport" border="0"/></a> \t\t</div-->
/** * poor man's soapfault dump to stdout * * @param object $fault soapfault object * @todo modify this to make a betairLogger:: call */ private function handleError(SoapFault $fault) { if (true === betfairConstants::DEBUG_MODE) { betfairHelper::dumpAndExit($fault); } }
/** * construct markup to return to controller, rendering the soapResponse data * */ public function render() { $chunk = ''; $displayUnit = ''; $hostname = betfairDemoConstants::HOSTNAME; switch ($this->context) { case 'getAllEventTypes': foreach ($this->soapResponse->Result->eventTypeItems->EventType as $eventType) { $displayUnit .= "<li><p><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getEvents/{$eventType->id}'>{$eventType->name}</a></li>"; } break; case 'getEvents': /* either this is another list of event nodes, or it is a market summary */ if (isset($this->soapResponse->Result->marketItems->MarketSummary)) { if (is_array($this->soapResponse->Result->marketItems->MarketSummary)) { foreach ($this->soapResponse->Result->marketItems->MarketSummary as $market) { $displayUnit .= "<li><p><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getMarket/{$market->marketId}'>{$market->marketName}</a></p></li>"; } } else { $market = $this->soapResponse->Result->marketItems->MarketSummary; $displayUnit .= "<li><p><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getMarket/{$market->marketId}'>{$market->marketName}</a></p></li>"; } } if (isset($this->soapResponse->Result->eventItems->BFEvent)) { /* * if it's an array, there are more than one events, otherwise there is just one * this is somewhat broken in that the datatype switches from an object to an object array depending on * the number of items. Probably it would be better if BF just served up an array with a * single object in it in cases where there is only one eventItem under an eventParent * */ if (is_array($this->soapResponse->Result->eventItems->BFEvent)) { foreach ($this->soapResponse->Result->eventItems->BFEvent as $event) { $displayUnit .= "<li><p><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getEvents/{$event->eventId}'>{$event->eventName}</a></p></li>"; } } else { $event = $this->soapResponse->Result->eventItems->BFEvent; $displayUnit .= "<li><p><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getEvents/{$event->eventId}'>{$event->eventName}</a></p></li>"; } } break; case 'getAllMarkets': $markets = explode(":", $this->soapResponse->Result->marketData); array_shift($markets); foreach ($markets as $market) { $marketData = explode('~', $market); $displayUnit .= "<li> {$marketData[1]}\n\t\t\t\t\t\t<a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getCompleteMarketPricesCompressed/{$marketData[0]}'>get compressed</a> |\n\t\t\t\t\t\t<a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getMarketPriceCompressed/{$marketData[0]}'>get market</a> |\n\t\t\t\t\t\t<a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getBFMarketPrices/{$marketData[0]}'>get BF market prices</a> |\n\t\t\t\t\t\t</li>"; } break; case 'getInPlayMarkets': $markets = explode(":", $this->soapResponse->Result->marketData); array_shift($markets); foreach ($markets as $market) { $marketData = explode('~', $market); $displayUnit .= "<li><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getCompleteMarketPricesCompressed/{$marketData[0]}'>{$marketData[1]}</a></li>"; } break; case 'getMarket': if (betfairConstants::ERROR_OK === $this->soapResponse->Result->header->errorCode) { $marketDescription = $this->soapResponse->Result->market->marketDescription; include 'templates/marketData.tpl.php'; $displayUnit = betfairHelper::returnVar($this->soapResponse); } else { } break; case 'getCompleteMarketPricesCompressed': $displayUnit = betfairHelper::returnVar($this->soapResponse); break; case 'getBFMarketPrices': $displayUnit = '<table>'; foreach ($this->soapResponse->allRunnerData as &$runner) { $displayUnit .= '<tr>'; foreach ($runner->prices as $priceDetails) { $displayUnit .= '<p>odds:' . $priceDetails->odds . '- back: ' . $priceDetails->backAmountAvailable . '- lay: ' . $priceDetails->layAmountAvailable; $displayUnit .= '</p>'; } $displayUnit .= '</tr>'; } $displayUnit .= '</table>'; break; default: $displayUnit .= "<p><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getAllEventTypes/'>get all event types</a></p>"; $displayUnit .= "<p><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getAccountFunds/'>get account funds</a></p>"; $displayUnit .= "<p><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getAllCurrencies/'>get all currencies</a></p>"; $displayUnit .= "<p><a href='http://" . betfairDemoConstants::HOSTNAME . "/v1/getPaymentCard/'>get payment card</a></p>"; break; } include 'templates/header.tpl.php'; include 'templates/body.tpl.php'; $chunk .= <<<EOT \t </div> EOT; return $chunk; }