本文整理汇总了PHP中StringUtils::arrangeOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtils::arrangeOptions方法的具体用法?PHP StringUtils::arrangeOptions怎么用?PHP StringUtils::arrangeOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtils
的用法示例。
在下文中一共展示了StringUtils::arrangeOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPageContent
public function getPageContent()
{
$template = $this->getTemplateEngine()->readTemplate($this->getTemplate());
$products = $this->getModel()->getProducts();
$sum = 0;
$visible = CSS::HIDDEN;
$empty = "";
$productsTpl = "";
if (count($products) > 0) {
$visible = "";
$empty = CSS::HIDDEN;
$engine = $tpl = $this->getTemplateEngine();
foreach ($products as $product) {
$tpl = $engine->readTemplate(Template::CART_PRODUCT);
$tpl = $engine->replaceTag("classification", $product->getClassification(), $tpl);
$tpl = $engine->replaceTag("type", $product->getType(), $tpl);
$tpl = $engine->replaceTag("imgname", $product->getImgname(), $tpl);
$tpl = $engine->replaceTag("id", $product->getId(), $tpl);
$tpl = $engine->replaceTag("name", $product->getName(), $tpl);
$tpl = $engine->replaceTag("optionsList", StringUtils::arrangeOptions($product->getProperties()), $tpl);
$tpl = $engine->replaceTag("price", StringUtils::formatAmount($product->getPrice()), $tpl);
$sum += $product->getPrice();
$productsTpl .= $tpl;
}
}
$template = $this->getTemplateEngine()->replaceTag("empty", $empty, $template);
$template = $this->getTemplateEngine()->replaceTag("visible", $visible, $template);
$template = $this->getTemplateEngine()->replaceTag("productrows", $productsTpl, $template);
$template = $this->getTemplateEngine()->replaceTag("total", StringUtils::formatAmount($sum), $template);
return $template;
}
示例2: createMailBody
/**
* This method reads the e-mail body template and fills it
* with the values from the cart and the given information
* about the user.
* @return HTML e-mail body
*/
private function createMailBody()
{
$engine = $this->getTemplateEngine();
// read the template for the e-mail body
$msgTpl = $engine->readTemplate(Template::MAIL_ORDER);
// create a new CartModel instance to get access to the cart's products
$cart = new CartModel();
// write all ordered products in the cart into e-mail
$rows = "";
$amount = 0;
foreach ($cart->getProducts() as $product) {
$rowTpl = $engine->readTemplate(Template::MAIL_ORDER_ROW);
$rowTpl = $engine->replaceTag("name", $product->getName(), $rowTpl);
$rowTpl = $engine->replaceTag("options", StringUtils::arrangeOptions($product->getProperties()), $rowTpl);
$rowTpl = $engine->replaceTag("price", StringUtils::formatAmount($product->getPrice()), $rowTpl);
$rows .= $rowTpl;
$amount += $product->getPrice();
}
// write the POST-ed values into e-mail
$msgTpl = $engine->replaceTag("firstname", StringUtils::removeTags($_POST["name-firstname"]), $msgTpl);
$msgTpl = $engine->replaceTag("lastname", StringUtils::removeTags($_POST["name-lastname"]), $msgTpl);
$msgTpl = $engine->replaceTag("email", StringUtils::removeTags($_POST["name-email"]), $msgTpl);
$msgTpl = $engine->replaceTag("address", StringUtils::removeTags($_POST["name-address"]), $msgTpl);
$msgTpl = $engine->replaceTag("addressnr", StringUtils::removeTags($_POST["name-addressnr"]), $msgTpl);
$msgTpl = $engine->replaceTag("zipcode", StringUtils::removeTags($_POST["name-zipcode"]), $msgTpl);
$msgTpl = $engine->replaceTag("city", StringUtils::removeTags($_POST["name-city"]), $msgTpl);
$msgTpl = $engine->replaceTag("country", StringUtils::removeTags($_POST["name-country"]), $msgTpl);
$msgTpl = $engine->replaceTag("shippingmethod", StringUtils::removeTags($_POST["name-shippingmethod"]), $msgTpl);
$msgTpl = $engine->replaceTag("paymentmethod", StringUtils::removeTags($_POST["name-paymentmethod"]), $msgTpl);
$msgTpl = $engine->replaceTag("total", StringUtils::formatAmount($amount), $msgTpl);
$giftboxYesNo = isset($_POST["name-giftbox"]) ? "yes" : "no";
$msgTpl = $engine->replaceTag("yesno", $giftboxYesNo, $msgTpl);
// replace the placeholder in e-mail's template with the product rows
$msgTpl = $engine->replaceTag("rows", $rows, $msgTpl);
// translate all keys in the template
$msgTpl = $this->handleTranslations($msgTpl);
// set the table with all informations to the view for displaying it
$this->getView()->setTable($msgTpl);
return $msgTpl;
}