Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-39126

support $mform->setType() for additional backup parameters.

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 2.6
    • Backup

      Developers can not set a setType() for additional parameters, see in backup/util/ui/base_moodleform.class.php:

      function definition() {
              $ui = $this->uistage->get_ui();
              $mform = $this->_form;
              $mform->setDisableShortforms();
              $stage = $mform->addElement('hidden', 'stage', $this->uistage->get_stage());
              $mform->setType('stage', PARAM_INT);
              $stage = $mform->addElement('hidden', $ui->get_name(), $ui->get_uniqueid());
              $mform->setType($ui->get_name(), PARAM_ALPHANUM);
              $params = $this->uistage->get_params();
              if (is_array($params) && count($params) > 0) {
                  foreach ($params as $name=>$value) {
                      // TODO: Horrible hack, but current backup ui structure does not allow
                      // to make this easy (only changing params to objects that would be
                      // possible. MDL-38735.
                      $intparams = array(
                              'contextid', 'importid', 'target');
                      $stage = $mform->addElement('hidden', $name, $value);
                      if (in_array($name, $intparams)) {
                          $mform->setType($name, PARAM_INT);
                      } else {
                          // Adding setType() to avoid missing setType() warnings.
                          // MDL-39126: support $mform->setType() for additional backup parameters.
                          $mform->setType($name, PARAM_RAW);
                      }
                  }
              }
          }
      

      The way we call backup_ui (from course publish feature):

      $backup = new backup_ui($bc,
               array('id' => $id, 'hubcourseid' => $hubcourseid, 'huburl' => $huburl, 'hubname' => $hubname));
      

      The "issue" is that we should have a way to indicate what these parameter type are.

            Unassigned Unassigned
            jerome Jérôme Mouneyrac
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.