Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-1013

Decide how to retrieve information required for creating HTML forms for Moodle features



    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: DEV backlog
    • Fix Version/s: None
    • Component/s: Policy
    • Labels:


      I was reviewing the mod_forum code for adding new discussions and posts in order to create new external functions for posting via the app. I noticed that the post_form.php is pretty complex since the form elements depends on capabilities, specific settings of the module or group settings/configurations.
      We have to think also that moodle field forms have dependencies, size limitations, etc.. (everything you can configure via quickforms)

      So basically, I see that there are 3 alternatives for retrieve all the information needed for building the form:

      1. Creating new external functions matching Moodle APIs, (groups_get_activity_allowed_groups, groups_get_activity_groupmode, has_capability, etc..)
        PROS: Since they are generic, we can reuse them in other areas
        CONS: Lot of logic and requests required in the code
      2. Creating a new external function (generic) for retrieving all the user permissions and group status in a forum (so we retrieve in a single request all the information we need to build the form)
        PROS: With a single request we'll retrieve all the information we need
        CONS: It solves the request problem, but we still need complex logic for creating the form and we will need a new external function for every form
      3. Retrieving all the Quickform elements generated in the post_form.php (including name, type, maxchars, validation rules, disabling rules, etc..)
        PROS: We will be able to reuse the logic everywhere (for any moodle form)
        CONS: It will require to implement a local framework for creating angularforms via quickform settings
      4. As suggested by Frédéric Massart, create simple features / external functions (just title and post text). This means a partial implementation of the WS (or a _simple function)

      Any ideas?




            jleyva Juan Leyva
            jleyva Juan Leyva
            Component watchers:
            0 Vote for this issue
            2 Start watching this issue