public function form() { global $db, $html, $settings; $form = new Forms(); if ($_GET['p'] != "add") { $modal = new Modal(); $modal->start("delete", $this->name); echo "Are you sure you want to delete this product?"; $modal->end("delete", "products.php?c={$this->collection_id}&d={$this->product_id}" . (isset($_GET['f']) ? "&f=" . $_GET['f'] : '')); $modal->form = true; $modal->start("move", $this->name, "products.php?c={$this->collection_id}&move={$this->product_id}"); $collections = $db->select("collections", null, "id,name,barcodes", null, "name"); $form->select("start", "collection_id"); foreach ($collections as $key => $collection) { if ($collection['id'] != $_GET['c']) { $form->select("option", $collection['name'], $collection['id']); } } $form->select("end"); $modal->end("move", "products.php?c={$this->collection_id}&move={$this->product_id}"); } $form->start("products.php?c={$this->collection_id}&p={$this->product_id}" . (isset($_GET['f']) ? "&f=" . $_GET['f'] : '')); echo "<div class='col-xs-12 col-md-6 text-right'>"; $html->button("products.php?c={$this->collection_id}" . (isset($_GET['f']) ? "&f=" . $_GET['f'] : ''), "back", "default"); $html->button("products.php?c={$this->collection_id}&p={$this->product_id}" . (isset($_GET['f']) ? "&f=" . $_GET['f'] : ''), "reset", "warning"); if ($db->is_admin() and $settings['collection']['variation_ids'] == null) { $html->button("barcodes.php?p={$this->product_id}", "new barcode", "warning"); } if ($_GET['p'] != "add") { $modal->button("delete"); $modal->button("move"); } $form->button("save"); echo "</div>"; echo "</div>"; echo "<hr />"; $collection = $db->select("collections", "id={$this->collection_id}", "*", 1); switch ($_GET['p']) { case 'add': $form->input("user_id", null, "text", $_SESSION['userid'], true); break; default: $form->input("id", null, "text", $this->product_id, true); $form->input("user_id", null, "text", $this->owner_id, true); break; } $form->input("barcode", null, "text", isset($this->barcode) ? $this->barcode : '', true); $form->input("name", null, "text", $this->name, null, null, null, true, true); echo "<div class='row'>"; echo "<div class='col-xs-12 col-sm-4'>"; $form->input("sku", null, "text", $this->sku); echo "</div>"; echo "<div class='col-xs-12 col-sm-4'>"; $form->input("price", null, "currency", $this->price, $collection['price_overide_toggle']); echo "</div>"; echo "<div class='col-xs-12 col-sm-4'>"; $form->input("asin", null, "text", $this->asin); echo "</div>"; echo "</div>"; echo "<div class='row'>"; echo "<div class='col-xs-12 col-sm-6'>"; $form->input("bullet 1", "amz_bullet_1", "text", $this->amz_bullet_1, $collection['amz_toggle_1']); $form->input("bullet 2", "amz_bullet_2", "text", $this->amz_bullet_2, $collection['amz_toggle_2']); $form->input("bullet 3", "amz_bullet_3", "text", $this->amz_bullet_3, $collection['amz_toggle_3']); $form->input("bullet 4", "amz_bullet_4", "text", $this->amz_bullet_4, $collection['amz_toggle_4']); $form->input("bullet 5", "amz_bullet_5", "text", $this->amz_bullet_5, $collection['amz_toggle_5']); echo "</div>"; echo "<div class='col-xs-12 col-sm-6'>"; $form->input("search 1", "amz_search_1", "text", $this->amz_search_1, $collection['amz_stoggle_1']); $form->input("search 2", "amz_search_2", "text", $this->amz_search_2, $collection['amz_stoggle_2']); $form->input("search 3", "amz_search_3", "text", $this->amz_search_3, $collection['amz_stoggle_3']); $form->input("search 4", "amz_search_4", "text", $this->amz_search_4, $collection['amz_stoggle_4']); $form->input("search 5", "amz_search_5", "text", $this->amz_search_5, $collection['amz_stoggle_5']); echo "</div>"; echo "</div>"; echo "<div class='row'>"; echo "<div class='col-xs-12'>"; $form->input("description", "description", "textarea", isset($this->description) ? $this->description : null, null, 5); echo "</div>"; echo "</div>"; $form->end(); }
public function create() { $modal = new Modal(); $modal->form = true; $modal->button("create"); $modal->start("create", "add collection", "collections.php?c=add"); $form = new Forms(); $form->input("name"); $modal->end("create"); }