Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Voice GsocFormslibExercise

From MoodleDocs


Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.



  1. Write a form using the Formslib class and its documentation.
    1. Deadline: 8th of April, 2007
      1. Estimated time to finish: 4 hours
    2. There should be two files: example.php and example_form.php
      1. example.php: It should invoke the form the first time called. If the form is the caller, then just present the parameters and their values on screen (to test if it has worked).
      2. example_form.php: The form itself. It should be a class that extends "moodleform" from "formslib.php". Note that this file should not be invoked from the browser.
    3. The form should have the next fields
      1. name: max 20 chars, obligatory
      2. password: max 20 chars, it should be presented with asterisks, obligatory
      3. email: max 20 chars, obligatory, preferably with validation
      4. comment: textfield, max 250 chars, optional
    4. You can use the next examples (and all you can find) from the Moodle CVS:
      1. http://moodle.cvs.sourceforge.net/moodle/moodle/login/signup.php?view=markup
      2. http://moodle.cvs.sourceforge.net/moodle/moodle/login/signup_form.php?view=markup
      3. http://moodle.cvs.sourceforge.net/moodle/moodle/login/change_password.php?view=markup
      4. http://moodle.cvs.sourceforge.net/moodle/moodle/login/change_password_form.php?view=markup
      5. http://moodle.cvs.sourceforge.net/moodle/moodle/login/forgot_password.php?view=markup
      6. http://moodle.cvs.sourceforge.net/moodle/moodle/login/forgot_password_form.php?view=markup
    5. FAQ
      1. Do I have to install the whole Moodle? No, just use the formslib.php file and any other if needed.
      2. Do I need any tools? You can use any tools as you need. In the project we will work probably with Eclipse and phpEclipse, although it can be discussed.
      3. Can I strip down the formslib.php file so it doesn´t have any references to other Moodle files? Yes you can, although you should state somewhere the changes so I can see them.
      4. Does it need to work? Well, let´s just say that if it works, it gets more points. :)
      5. Where do I find the Moodle CVS? Here is the Moodle CVS
      6. What aspects will be taken into account?
        1. Well documented
        2. Easy to understand
        3. It should work
        4. It should not have security breaches or if it has, they should to be documented
      7. What Coding Guidelines should I use?
        1. Output HTML code should be XHTML 1.0 Strict.
        2. Use 4 spaces for indentation (tabs are forbidden). Use correctly nested indentations.
        3. Document every function: parameters, return value and functionality.
        4. Specify the system you used for development and testing: Operating System, browser and IDE.
        5. We suggest using PHP Doc documentation format, the standard Moodle documentation format, although it is not required at this stage. It is very similar to Javadoc.
        6. We suggest using Moodle Coding Guidelines, although it is not required at this stage.
    6. Finally, you can either send me the files with two screenshots of them running (the first time called and second time called) or you can set it up in your webserver so I can see them running, plus a zip or tar.gz file with the files so I can download them. Please, do not include temporal files!