MDL-38559 Clean-up the course completion settings code

This patch does not alter the code, only some syntax fixes and
coding guidelines rules are applied. Strings are re-ordered
alphabetically with no change of their wording. PHP doc blocks
reconstructed using the Git log records.
MDL-38559 Reorganise course completion settings form
MDL-38559 Fix the ability to disable the grade condition in the course completion settings form