public function action_create() { RoutingEngine::setPage("runnDAILY", "PV__300"); $goal = new Goal($_POST); if ($goal->createGoal()) { Goal::updatePercentForList(array(0 => array("go_id" => $goal->id))); Page::redirect("/goals/view/{$goal->id}"); } else { Page::redirect("/goals"); } }
public function action_save() { RoutingEngine::setPage("runnDAILY Training Save", "PV__300"); $t_item = new TrainingLog($_POST); if (array_safe($_POST, "t_rid") == "") { $t_item->rid = null; } if ($t_item->createItem()) { $affected_goals = Goal::getGoalIdsForUserInRange(User::$current_user->uid, $t_item->date); if ($affected_goals) { Goal::updatePercentForList($affected_goals); } Page::redirect("/training/"); } Page::redirect("/training/"); }