<?php require_once "lib/init.php"; ensure("post"); expects(array("name" => "string", "description" => "string", "price" => "int")); json(RecommendedItem::create($params));
<input name="summ_rec_add_new_item_price" type="text" placeholder="Item Price" /> <textarea name="summ_rec_add_new_item_description" placeholder="Item Description"></textarea> <a class="summ_rec_button _custom_add" href="#">Add</a> </div> <div class="clearfix"></div> <h5>Current Items</h5> <table> <tbody id="summ_rec_current_items_table"> <tr> <td width="100px"><p>Item Ref.</p></td> <td width="550px"><p>Description</p></td> <td></td> </tr> <?php foreach (RecommendedItem::all("id ASC") as $item) { ?> <tr rg-id="<?php h($item->id); ?> "> <td><p><?php printf("%03d", $item->id); ?> </p></td> <td> <h4><?php h($item->name); ?> </h4> <p><?php
$pdf->SetFillColor(0, 0, 0); $pdf->Cell(0, 0, "Recommendations", 1, 1, 'L', 1); $pdf->SetFontSize(11); $pdf->SetTextColor(0, 0, 0); $pdf->SetFillColor(255, 255, 255); $pdf->SetTextColor(255, 255, 255); $pdf->SetFillColor(0, 167, 143); $pdf->Cell(40, 7, "Item Ref.", 0, 0, 'L', 1); $pdf->Cell(140, 7, "Description", 0, 0, 'L', 1); $pdf->Ln(); $pdf->SetTextColor(0, 0, 0); $pdf->SetFillColor(255, 255, 255); if (is_array($data['current_items'])) { foreach ($data['current_items'] as $item_id) { if (!is_numeric($item_id)) { continue; } $item = RecommendedItem::find($item_id); if (!$item) { continue; } $pdf->SetFont('', 'B'); $pdf->Cell(40, 7, sprintf("%03d", $item->id), 0, 0, 'L', 1); $pdf->Cell(140, 7, $item->name, 0, 0, 'L', 1); $pdf->Ln(); $pdf->SetFont('', ''); $pdf->Cell(40, 7, "", 0, 0, 'L', 1); $pdf->MultiCell(140, 7, $item->description, 0, 'L'); } } $pdf->Ln();
<?php require_once "lib/init.php"; RecommendedItem::get()->destroy(); json(array("status" => true));