echo 'Error getting background with id =' . $request_id; } break; case 'get_background_list': $background_object = new Background(); $return_boolean = $background_object->getNameList(); if ($return_boolean) { echo json_encode($background_object->data()); } else { echo 'Error getting background name list'; } break; case 'change_background': $background_object = new Background(); $array_of_fields = (array) json_decode($request_json); $background_object->change($array_of_fields, $request_id); echo 'OK'; break; case 'remove_background': $background_object = new Background(); $background_object->remove($request_id); echo 'OK'; break; case 'add_track_type': $track_type_object = new TrackType(); $array_of_fields = (array) json_decode($request_json); // remove the db_id (first) item in the array since we're adding a new one to the database table array_shift($array_of_fields); $track_type_object->add($array_of_fields); echo 'OK'; break;