assignsubmission_mahara: Fix log output for copying submission case.
assignsubmission_mahara: Prevent empty submission.

In case of multiple attempts, if user choose to base submission on previous,
the new submission draft will be empty because we do not allow that in Mahara to preserve
the original submission page state (leave it locked). The patch stops user
submitting empty submissions.
assignsubmission_mahara: Fix empty select element issue.

We need to make sure that we have something to display before forming a select
element. The particular case that caused problems was when user has Pages, but
all of them are submitted.
assignsubmission_mahara: Refactor function definitions and use constants.