*
* @var mysqli
*/
- private $_DB;
+ private mysqli $_DB;
/**
* The data for this item
*
* @var array
*/
- private $_data;
+ private array $_data;
/**
* @param mysqli $databaseConnectionObject
public function __construct(mysqli $databaseConnectionObject) {
$this->_DB = $databaseConnectionObject;
}
-}
\ No newline at end of file
+
+ public function create(array $data): string {
+ $ret = "";
+
+
+
+ return $ret;
+ }
+}
<?php
?>
<nav>
- <a href="index.php">Home</a> | <a href="index.php?p=entry">New</a> | <a href="index.php?p=list">Search</a>
+ <a href="index.php">Home</a> | <a href="index.php?p=item">New</a> | <a href="index.php?p=list">Search</a>
</nav>
+++ /dev/null
-<form>
- <fieldset>
- <label for="receipt">Receipt <small>Just leave it blank to create a new based on data and market name.</small></label>
- <input name="fdata[receipt]" id="receipt" type="text" list="receiptList" autocomplete="off"
- value="<?php echo Summoner::ifset($TemplateData['editData'], 'receipt'); ?>" />
- <datalist id="receiptList">
- <option>Rewe</option>
- <option>Lidl</option>
- </datalist>
-
- <label for="receiptdate">Date and time</label>
- <input name="fdata[receiptdate]" id="receiptdate" type="datetime-local" autocomplete="off"
- value="<?php echo Summoner::ifset($TemplateData['editData'], 'receiptdate'); ?>" />
-
- <label for="market">Market</label>
- <input name="fdata[market]" id="market" type="text" list="marketList" autocomplete="off"
- value="<?php echo Summoner::ifset($TemplateData['editData'], 'market'); ?>" />
- <datalist id="marketList">
- <option>Rewe</option>
- <option>Lidl</option>
- </datalist>
-
- <label for="product">Product</label>
- <input name="fdata[product]" id="product" type="text" list="productList" autocomplete="off"
- value="<?php echo Summoner::ifset($TemplateData['editData'], 'product'); ?>"/>
- <datalist id="productList">
- <option>Rewe</option>
- <option>Lidl</option>
- </datalist>
-
- <label for="manufacturer">Manufacturer</label>
- <input name="fdata[manufacturer]" id="manufacturer" type="text" list="manufacturerList" autocomplete="off"
- value="<?php echo Summoner::ifset($TemplateData['editData'], 'manufacturer'); ?>"/>
- <datalist id="manufacturerList">
- <option>Rewe</option>
- <option>Lidl</option>
- </datalist>
-
- <label for="weight">Weight(g)</label>
- <input name="fdata[weight]" id="weight" type="number" autocomplete="off"
- value="<?php echo Summoner::ifset($TemplateData['editData'], 'weight'); ?>"/>
-
- <label for="itemcount">Itemcount</label>
- <input name="fdata[itemcount]" id="itemcount" type="number" autocomplete="off"
- value="<?php echo Summoner::ifset($TemplateData['editData'], 'itemcount'); ?>"/>
-
- <label for="price">Price</label>
- <input name="fdata[price]" id="price" type="number" autocomplete="off"
- value="<?php echo Summoner::ifset($TemplateData['editData'], 'price'); ?>"/>
-
- <label for="catalog">Catalog</label>
- <input name="fdata[catalog]" id="catalog" type="text" list="catalogList" autocomplete="off"
- value="<?php echo Summoner::ifset($TemplateData['editData'], 'catalog'); ?>"/>
- <datalist id="catalogList">
- <option>Rewe</option>
- <option>Lidl</option>
- </datalist>
-
- <input type="submit" class="tui-button" value="Save" name="submitForm" />
- </fieldset>
-</form>
+++ /dev/null
-<?php
-require_once 'lib/item.class.php';
-$Item = new Item($DB);
-
-$_id = false;
-if(isset($_GET['id']) && !empty($_GET['id'])) {
- $_id = trim($_GET['id']);
- $_id = Summoner::validate($_id,'nospace') ? $_id : false;
-}
-
-$TemplateData['pageTitle'] = 'New item';
-if(!empty($_id)) {
- $TemplateData['pageTitle'] = 'Edit item';
-}
-
-$TemplateData['editData'] = array();
-
-$TemplateData['message']['content'] = "";
-$TemplateData['message']['status'] = "";
-
-if(isset($_POST['fdata']) && !empty($_POST['fdata']) && isset($_POST['submitForm'])) {
- $fdata = $_POST['fdata'];
- if (!empty($fdata)) {
-
- } else {
- $TemplateData['message']['content'] = "Collection could not be loaded.";
- $TemplateData['message']['status'] = "error";
- }
-}
--- /dev/null
+<form method="post">
+ <fieldset>
+ <label for="receipt">Receipt* <small>Just leave it blank to create a new based on data and market name.</small></label>
+ <input name="fdata[receipt]" id="receipt" type="text" list="receiptList" autocomplete="off" required
+ value="<?php echo Summoner::ifset($TemplateData['editData'], 'receipt'); ?>" />
+ <datalist id="receiptList">
+ <option>Rewe</option>
+ <option>Lidl</option>
+ </datalist>
+
+ <label for="receiptdate">Date and time*</label>
+ <input name="fdata[receiptdate]" id="receiptdate" type="datetime-local" autocomplete="off" required
+ value="<?php echo Summoner::ifset($TemplateData['editData'], 'receiptdate'); ?>" />
+
+ <label for="market">Market*</label>
+ <input name="fdata[market]" id="market" type="text" list="marketList" autocomplete="off" required
+ value="<?php echo Summoner::ifset($TemplateData['editData'], 'market'); ?>" />
+ <datalist id="marketList">
+ <option>Rewe</option>
+ <option>Lidl</option>
+ </datalist>
+
+ <label for="product">Product*</label>
+ <input name="fdata[product]" id="product" type="text" list="productList" autocomplete="off" required
+ value="<?php echo Summoner::ifset($TemplateData['editData'], 'product'); ?>"/>
+ <datalist id="productList">
+ <option>Rewe</option>
+ <option>Lidl</option>
+ </datalist>
+
+ <label for="manufacturer">Manufacturer*</label>
+ <input name="fdata[manufacturer]" id="manufacturer" type="text" list="manufacturerList" autocomplete="off" required
+ value="<?php echo Summoner::ifset($TemplateData['editData'], 'manufacturer'); ?>"/>
+ <datalist id="manufacturerList">
+ <option>Rewe</option>
+ <option>Lidl</option>
+ </datalist>
+
+ <label for="weight">Weight(g)</label>
+ <input name="fdata[weight]" id="weight" type="number" autocomplete="off"
+ value="<?php echo Summoner::ifset($TemplateData['editData'], 'weight'); ?>"/>
+
+ <label for="itemcount">Itemcount</label>
+ <input name="fdata[itemcount]" id="itemcount" type="number" autocomplete="off"
+ value="<?php echo Summoner::ifset($TemplateData['editData'], 'itemcount'); ?>"/>
+
+ <label for="price">Price*</label>
+ <input name="fdata[price]" id="price" type="number" autocomplete="off" required
+ value="<?php echo Summoner::ifset($TemplateData['editData'], 'price'); ?>"/>
+
+ <label for="catalog">Catalog</label>
+ <input name="fdata[catalog]" id="catalog" type="text" list="catalogList" autocomplete="off"
+ value="<?php echo Summoner::ifset($TemplateData['editData'], 'catalog'); ?>"/>
+ <datalist id="catalogList">
+ <option>Rewe</option>
+ <option>Lidl</option>
+ </datalist>
+
+ <input type="submit" class="tui-button" value="Save" name="submitForm" />
+ </fieldset>
+</form>
--- /dev/null
+<?php
+require_once 'lib/item.class.php';
+$Item = new Item($DB);
+
+$_id = false;
+if(isset($_GET['id']) && !empty($_GET['id'])) {
+ $_id = trim($_GET['id']);
+ $_id = Summoner::validate($_id,'nospace') ? $_id : false;
+}
+
+$TemplateData['pageTitle'] = 'New item';
+if(!empty($_id)) {
+ $TemplateData['pageTitle'] = 'Edit item';
+}
+
+$TemplateData['editData'] = array();
+
+$TemplateData['message']['content'] = "";
+$TemplateData['message']['status'] = "";
+
+if(isset($_POST['fdata']) && !empty($_POST['fdata']) && isset($_POST['submitForm'])) {
+ $fdata = $_POST['fdata'];
+ if (!empty($fdata)) {
+
+ var_dump($fdata);
+
+ } else {
+ $TemplateData['message']['content'] = "Collection could not be loaded.";
+ $TemplateData['message']['status'] = "error";
+ }
+}