function getHTML_ForInitialBidCase($offerItem) { // This is for the normal case where The person hasn't bid yet $retn = ''; $offerItem = new SingleItem($_SESSION['ItemID'], false); // false => don't include desc $retn .= "<DIV ALIGN=CENTER> \n"; $retn .= "<TABLE><TR><TD> \n"; $retn .= $offerItem->getBrowseItemAsHTML_Table(); $retn .= "</TD></TR></TABLE>\n"; if (isset($_SESSION['token']) && $_SESSION['loginState'] == 'loggedIn') { // a bit stronger than a simple token existence check if ($offerItem->resp->Item->ListingType == 'Chinese') { //print "Getting Chinese form<br>"; $retn .= $offerItem->getBiddingFormAsHTML_Table('./PlaceOffer.php'); } else { $retn .= $offerItem->getBuyingFormAsHTML_Table('./PlaceOffer.php'); } } else { $retn .= "ERROR - We don't have a token"; } $retn .= "</DIV> \n"; return $retn; }
print "<p>{$apicall}</p>"; // see what call is if we're debugging - $debug comes from keys.php } // Load the call and capture the document returned by the Finding API $resp = simplexml_load_file($apicall); // Check to see if the response was loaded, else print an error if ($resp) { $results = ''; if ($resp->paginationOutput->totalEntries == 0) { $results .= "<BR>Sorry, there were no results found\n"; } else { $results .= "<DIV ALIGN=CENTER> \n"; // If the response was loaded, parse it and build links // To keep things simple, we're showing only the first returned item; foreach ($resp->searchResult->item as $item) { $browseItem = new SingleItem($resp->searchResult->item->itemId); $results .= $browseItem->getBrowseItemAsHTML_Table(); $results .= "<form\tname=\"BidOrBuyIt\" method=\"post\" action=\"./Login.php\" >\n"; $results .= "<INPUT TYPE=\"submit\" NAME=\"BidOrBuyIt\" VALUE=\"Bid or Buy It!\"></form>\n"; $_SESSION['ItemID'] = (string) $browseItem->resp->Item->ItemID; // cast to string to keep in $_SESSION } // for each $results .= "</DIV> \n"; } } else { $results = "<BR>Sorry, did not receive a search result\n"; } // if $resp print $results; ?>