Ok - that's a bit different from the original one posted. Here's what I would do:
First, solder your wires to the board from the rear of the PCB.
Then, on the panel where you have your hole drilled for the shaft, epoxy a couple of pieces of plastic the width of the PCB, so that the PCB fits flush to the top of the plastic pieces (or near enough). The best way to do this would be to insert the shaft thru the hole, position the PCB, and mark with a pencil or sharpie each edge (or an outline) of the PCB. Then measure the PCB, and verify the markings. Then cut/trim the plastic pieces and fit them in place on the panel. If you are careful with the epoxy, you could even position the plastic pieces using the PCB as a guide, until it sets (just don't get any on the board, shaft, etc).
Once the epoxy has set up, put the shaft in place, then use a small piece of plastic as a bracket and screw it down over the back into the plastic side pieces. The first pieces of plastic are to keep the board from rotating, while the backing piece of plastic is to keep the module from falling out of the panel or otherwise becoming loose.
Variations of this idea are also possible (perhaps a couple of plastic tubes mounted so that a couple of zip-ties could be used to secure things). Alternatively, you could goop it on with some silicone (or as mentioned by others, hot glue). If you don't think you'll need to replace the part, drill the hole in the panel slightly smaller (use a drill the next barest amount down in size, then ream the hole slightly larger), and press fit it in, then use dots of epoxy along the edge of the encoder/pot and panel.