/** * @return String HTML */ public function getHTML() { $title = $this->product->getTitle(); $desciption = $this->product->getDescription(); $price = $this->product->getPrice(); $popularity = $this->popularityView->getHTML(); $backLink = $this->navigationView->getLinkToCatalog(); return "<div>\n\t\t\t\t\t<h2>{$title}</h2>\n\t\t\t\t\t{$popularity}\n\t\t\t\t\t<p>Price: {$price} sek</p>\n\t\t\t\t\t<p>{$desciption}</p>\n\t\t\t\t\t{$backLink}\n\t\t\t\t</div>"; }
public function getProduct(\model\Product $product, LikeView $likeView) { $name = $product->getName(); $price = $product->getPrice(); $unique = $product->getUniqueProductID(); $backUrl = $this->url->getURL(); $this->url->addArgument(self::$productURLID, $unique); $likeHTML = $likeView->createLikeButton(); $ret = "<h1>Product {$name}</h1>{$likeHTML}<br/>"; $ret .= ""; $ret .= "{$price} sek<br/>"; $ret .= "<a href='{$backUrl}'>back</a> "; return $ret; }
/** * Method to generate HTML * @param \model\Product $p * @return string HTML */ public function getUpdateForm(\model\Product $p) { if ($this->nv->adminWantsToUpdateProduct() && $this->nv->getProductID() == $p->getProductID()) { return "<li class='update-form'>\n\t\t\t\t\t\t<form method='post'>\n\t\t\t\t\t\t\t<input type='text' class='update-title-input' id='" . self::$title . "' name='" . self::$title . "' value='" . $p->getTitle() . "'/>\n\t\t\t\t\t\t\t<input type='text' class='update-price-input' id='" . self::$price . "' name='" . self::$price . "' value='" . $p->getPrice() . "'/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<input type='submit' name='" . self::$cancel . "' value='Cancel' class='cancel-button'/>\n\t\t\t\t\t\t\t<input type='submit' name='" . self::$confirm . "' value='Update' class='confirm-button'/>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</li>"; } }
public function updateProduct(\model\Product $p) { $smt = $this->conn->prepare("UPDATE " . self::$table . " SET " . self::$c_title . " = '" . $p->getTitle() . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . self::$c_desc . " = '" . $p->getDesc() . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . self::$c_price . " = '" . $p->getPrice() . "', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . self::$c_unique . " = '" . $p->getUnique() . "' WHERE " . self::$c_id . "=" . $p->getProductID() . ""); $smt->execute(); }