getBrandByName($name); $modelService = new ModelService(); $models = $modelService->getAllModelsByBrand($brand->id, is_updater()); if ($models) { $smarty = new Smarty; $smarty->assign('brand', $name); $smarty->assign('models', $models); $smarty->assign('user_can_update', is_updater()); $smarty->assign('user_logged_in', is_logged_in($user)); $smarty->display('views/models.tpl'); } else { header("location:add_model.php?brand=$name"); } } else { $brandService = new BrandService(); $brands = $brandService->getAllBrands(); $smarty = new Smarty; $smarty->assign('brands', $brands); $smarty->assign('action', "models.php"); $smarty->display('views/selectbrand.tpl'); } } ?>