There's a few threads here on LCT that cover this topic.

http://www.luxurycruisetalk.com/ubb/ultimatebb.php?ubb=get_topic;f=1;t=002358#000000
http://www.luxurycruisetalk.com/cgi-bin/ubbcgi/ultimatebb.cgi?ubb=get_topic;f=1;t=000571#000017
http://www.luxurycruisetalk.com/cgi-bin/ubbcgi/ultimatebb.cgi?ubb=get_topic;f=1;t=002814#000002

It's probably better to try to get the classroom work done before you get on the PG - otherwise, you'll end up spending valuable vacation time sitting in a classroom studying a textbook. You'll need to do a PADI referral so that you can do your open water training onboard. And important to check out whether you can qualify medically to get certified.

FWIW, I haven't been on board the PG myself to date - this information is from others who have been on the PG and from my own experience getting certified.

Hope this helps!

Masaki