} } /** * Handler for the change presenter functionality */ if (isset($_POST['form']) && $_POST['form'] == "change_presenter") { if (isset($_POST['presenter_sequence_id']) && isset($_POST['party_id'])) { //get the presenter id from the sequence id require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php'; $presenter = new Presenter(); $presenter_id = $presenter->getIdBySequenceId($_POST['presenter_sequence_id']); if ($presenter_id) { $data = array("id" => $_POST['party_id'], "presenter_id" => $presenter_id); require_once APPLICATION_PATH . MODEL_DIR . '/Party.php'; $party = new Party(); $party->set($data); if ($party->save()) { $result->success = TRUE; $result->message = "Presenter changed successfully."; } else { $result->success = FALSE; $result->message = "Failed to change presenter."; } } else { $result->success = FALSE; $result->message = "Failed to change presenter. Check the presenter id."; } } } header('Content-Type: application/json'); echo json_encode($result);