function store_edit() { $store = new Store(); $storeid = isset($_POST['storeid']) ? $_POST['storeid'] : ""; $store->id = $storeid; $store->name = isset($_POST['name']) ? $_POST['name'] : ""; $store->address = isset($_POST['address']) ? $_POST['address'] : ""; $store->contact = isset($_POST['contact']) ? $_POST['contact'] : ""; $store->phone = isset($_POST['phone']) ? $_POST['phone'] : ""; $store->active = isset($_POST['active']) ? 1 : 0; $store->fax = isset($_POST['fax']) ? $_POST['fax'] : ""; $store->email = isset($_POST['email']) ? $_POST['email'] : ""; $store->description = isset($_POST['description']) ? $_POST['description'] : ""; if ($storeid == "new") { if ($store->add()) { header("location: index.php?pages=store_detail&store={$store->id}"); exit; } } else { return $store->update(); } return false; }
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Store.php'; $action = ""; $store = new Store(); $response = array(); if (!empty($_GET['action'])) { $action = strip_tags($_GET['action']); } switch ($action) { case "login": $data = $store->login(); break; case "logout": $data = $store->logout(); break; case "add": $data = $store->add(); break; case "delete": $data = $store->delete(); break; case "edit": $data = $store->edit(); break; case "search": $data = $store->search(); break; default: $data = array('success' => false, 'data' => array(), 'error' => array('warning' => 'Invalid action')); break; } echo json_encode($data);
/** * Opens the Start Tag (Normally: <div) * * @return void */ private function _openStart() { if ($this->name === 'blank') { return; } /* * Store it. */ Store::add($this); if (!$this->hasOption('inline')) { Generator::tabs(); } echo str_replace(':name', $this->realName, $this->brackets['start']); }