public function getAllGems() { $db = new Db(); $gems = array(); $results = $db->select("SELECT * from gems"); foreach ($results as $result) { $gem = new Gem(); $gem->hydrate($result); $gems[] = $gem; } return $gems; }
break; case 'edit_gem': $gemManager = new gemManager(); $gem = $gemManager->getGem($target); include '../views/gem_add_edit.php'; break; case 'save_gem': $gemManager = new gemManager(); $arr = array(); $arr["ID"] = isset($_GET["id"]) ? $_GET["id"] : ''; $arr["gemName"] = isset($_GET["name"]) ? $_GET["name"] : ''; $arr["gemColor"] = isset($_GET["color"]) ? $_GET["color"] : ''; $arr["Mohs"] = isset($_GET["mohs"]) ? $_GET["mohs"] : ''; $arr["gemFamily"] = isset($_GET["family"]) ? $_GET["family"] : ''; $gem = new Gem(); $gem->hydrate($arr); $gemManager->save($gem); header('Location: gem.php'); break; default: $gemManager = new gemManager(); $gems = $gemManager->getAllGems(); include '../views/gem_view_list.php'; break; } ?> </body> </html>