function addCategory() { $category = new Category(); $category->setValues($_REQUEST); if ($category->newCategory()) { Common::jsonSuccess("Category Added Successfully!"); } else { Common::jsonError("Error"); } }
<?php if (isset($_GET['logout'])) { session_destroy(); Url::relocate("home.php"); } if (isset($_POST["nameNewCategory"])) { $nameNewCategory = $_POST['nameNewCategory']; $category = new Category(); $category->setName($nameNewCategory); $category->newCategory(); } elseif (isset($_POST["nameNewObjective"])) { $nameNewObjective = $_POST['nameNewObjective']; $objective = new Objective(); $objective->setName($nameNewObjective); $objective->newObjective(); } elseif (isset($_POST["nameNewSituation"])) { $nameNewSituation = $_POST['nameNewSituation']; $situation = new Situation(); $situation->setName($nameNewSituation); $situation->newSituation(); } elseif (isset($_POST["nameNewSystem"])) { $nameNewSystem = $_POST['nameNewSystem']; $system = new System(); $system->setName($nameNewSystem); $system->newSystem(); } elseif (isset($_POST["nameNewActor"])) { $nameNewActor = $_POST['nameNewActor']; $actor = new Actor(); $actor->setName($nameNewActor); $actor->newActor();