<?php include 'Bidder.php'; include 'Article.php'; include 'Bid.php'; use Bidder\Bidder; use Article\Article; use Bid\Bid; $bidder1 = new Bidder("Bert", "Rose", "*****@*****.**", "female"); $bidder2 = new Bidder("Rush", "Tommy", "*****@*****.**", "male"); $article = new Article("Gold Watch", "10", "New with tags: A brand-new, unused, and unworn item (including handmade items) in the original packaging\n (such as the original box or bag) and/or with the original tags attached", '2015-10-26 15:45'); $bid1 = new Bid($bidder1, "12", '2015-10-25 12:22'); $bid2 = new Bid($bidder2, "13", '2014-10-26 9:13'); $bid3 = new Bid($bidder1, "15.50", '2015-10-26 15:00'); echo "<dl>"; echo "<dt>{$article->getArticle()}</dt>\n <dd><p>{$article->getAnotation()}</p>\n <p>Price: {$article->getPrice()}€</p>\n <p>Ended {$article->getDate()}</p>\n <p><ul>\n <li>{$bid3->getBidder()->getFirstName()}; {$bid3->getValue()}€; {$bid3->getDate()}; Sold;</li>\n <li>{$bid2->getBidder()->getFirstName()}; {$bid2->getValue()}€; {$bid2->getDate()}</li>\n <li>{$bid1->getBidder()->getFirstName()}; {$bid1->getValue()}€; {$bid1->getDate()}</li>\n </ul></p>\n </dd>"; $bidder1->setFirstName("Miguel")->setLastName("Howard")->setMail("*****@*****.**")->setGender("male"); $article->setArticle("Linen Jacket")->setAnotation("It has a smooth chalk stripe pattern which gives the suit a refined look. The 6 buttons of his double\n breasted jacket are all buttoned up with the exception of one, it adds a casual touch to an elegant look.<br>\n The jacket is the same length all around, it has vents at either side, there's a pocket on either side and there's\n a breast pocket which contains a stylish pocket square.")->setPrice("135")->setDate("2015-10-29 12:00"); $bid1->setBidder($bidder1)->setValue("140")->setDate('2015-10-28 13:58'); $bid2->setBidder($bidder2)->setValue("155")->setDate('2015-10-29 9:13'); echo "<dt>{$article->getArticle()}</dt>\n <dd><p>{$article->getAnotation()}</p>\n <p>Price: {$article->getPrice()}€</p>\n <p>Ended {$article->getDate()}</p>\n <p><ul>\n <li>{$bid2->getBidder()->getFirstName()}; {$bid2->getValue()}€; {$bid2->getDate()}</li>\n <li>{$bid1->getBidder()->getFirstName()}; {$bid1->getValue()}€; {$bid1->getDate()}</li>\n </ul></p>\n </dd>"; echo "</dl>"; $bidder1->setFirstName("Zygimantas")->setLastName("Koncius")->setMail("*****@*****.**")->setGender("male"); $article->setArticle("Kebab")->setAnotation("Extremely tasty and fresh")->setPrice("50")->setDate("2015-10-29 22:00"); $bid1->setBidder($bidder1)->setValue("60")->setDate('2015-10-28 13:58'); $bid2->setBidder($bidder2)->setValue("70")->setDate('2015-10-29 9:13'); $bid3->setBidder($bidder1)->setValue("100")->setDate('2015-10-29 21:59'); echo "<dl>"; echo "<dt>{$article->getArticle()}</dt>\n <dd><p>{$article->getAnotation()}</p>\n <p>Price: {$article->getPrice()}€</p>\n <p>Ended {$article->getDate()}</p>\n <p><ul>\n <li>{$bid3->getBidder()->getFirstName()}; {$bid3->getValue()}€; {$bid3->getDate()}; Sold;</li>\n <li>{$bid2->getBidder()->getFirstName()}; {$bid2->getValue()}€; {$bid2->getDate()}</li>\n <li>{$bid1->getBidder()->getFirstName()}; {$bid1->getValue()}€; {$bid1->getDate()}</li>\n </ul></p>\n </dd>"; $bidder1->setFirstName("Zygimantas")->setLastName("Koncius")->setMail("*****@*****.**")->setGender("male"); $article->setArticle("PC")->setAnotation("Extremely powerful, light and slim")->setPrice("420")->setDate("2015-10-31 23:59");
$bid4 = new Bid\Bid(); $bid4->setUser($person2)->setValue(6)->setArticle($article2)->setDate('2015-10-25 12:22'); $bidArr[$bid4->getArticle()->getArticle()][] = $bid4; $bid5 = new Bid\Bid(); $bid5->setUser($person1)->setValue(6.5)->setArticle($article2)->setDate('2015-10-25 12:22'); $bidArr[$bid5->getArticle()->getArticle()][] = $bid5; $bid6 = new Bid\Bid(); $bid6->setUser($person1)->setValue(3)->setArticle($article3)->setDate('2015-10-25 12:22'); $bidArr[$bid6->getArticle()->getArticle()][] = $bid6; $bid7 = new Bid\Bid(); $bid7->setUser($person2)->setValue(4)->setArticle($article3)->setDate('2015-10-25 12:22'); $bidArr[$bid7->getArticle()->getArticle()][] = $bid7; $bid8 = new Bid\Bid(); $bid8->setUser($person3)->setValue(140)->setArticle($article4)->setDate('2015-10-28 13:58'); $bidArr[$bid8->getArticle()->getArticle()][] = $bid8; $bid9 = new Bid\Bid(); $bid9->setUser($person2)->setValue(155)->setArticle($article4)->setDate('2014-10-29 9:13'); $bidArr[$bid9->getArticle()->getArticle()][] = $bid9; $html = "<dl>"; foreach ($articlesArray as $article) { $html .= "<dt>{$article->getArticle()}</dt>\n <dd><p>{$article->getAnotation()}</p>\n <p>Price: {$article->getPrice()}€</p>"; if (strtotime($article->getDate()) < time()) { $html .= "<p>Ended {$article->getDate()}</p>"; } else { $html .= "<p>Ends {$article->getDate()}</p>"; } $html .= "<p><ul>"; $bids = array_reverse($bidArr[$article->getArticle()]); foreach ($bids as $bid) { $html .= "\n <li>{$bid->getUser()->getLastName()};\n {$bid->getValue()}€\n {$bid->getDate()};"; $html .= $bid->getSold() ? ' ' . $bid->getSold() . ';' : '';