Merge branch 'MDL-65153-master' of git://github.com/damyon/moodle
authorJun Pataleta <jun@moodle.com>
Mon, 6 May 2019 08:14:13 +0000 (16:14 +0800)
committerAdrian Greeve <abgreeve@gmail.com>
Tue, 7 May 2019 08:24:37 +0000 (16:24 +0800)
1  2 
admin/tool/lp/classes/external.php

@@@ -205,7 -205,7 +205,7 @@@ class external extends external_api 
          self::validate_context($framework->get_context());
          $output = $PAGE->get_renderer('tool_lp');
  
 -        $renderable = new output\manage_competencies_page($framework, $params['search'], $framework->get_context());
 +        $renderable = new output\manage_competencies_page($framework, $params['search'], $framework->get_context(), null);
  
          $data = $renderable->export_for_template($output);
  
              'The course id',
              VALUE_REQUIRED
          );
 -        $params = array('courseid' => $courseid);
 +        $moduleid = new external_value(
 +            PARAM_INT,
 +            'The module id',
 +            VALUE_DEFAULT,
 +            0
 +        );
 +        $params = array('courseid' => $courseid, 'moduleid' => $moduleid);
          return new external_function_parameters($params);
      }
  
       * Loads the data required to render the course_competencies_page template.
       *
       * @param int $courseid The course id to check.
 +     * @param int $moduleid The module id to check (0 for no filter).
       * @return boolean
       */
 -    public static function data_for_course_competencies_page($courseid) {
 +    public static function data_for_course_competencies_page($courseid, $moduleid) {
          global $PAGE;
          $params = self::validate_parameters(self::data_for_course_competencies_page_parameters(), array(
              'courseid' => $courseid,
 +            'moduleid' => $moduleid,
          ));
          self::validate_context(context_course::instance($params['courseid']));
  
 -        $renderable = new output\course_competencies_page($params['courseid']);
 +        $renderable = new output\course_competencies_page($params['courseid'], $params['moduleid']);
          $renderer = $PAGE->get_renderer('tool_lp');
  
          $data = $renderable->export_for_template($renderer);
                  ),
              ))),
              'manageurl' => new external_value(PARAM_LOCALURL, 'Url to the manage competencies page.'),
+             'pluginbaseurl' => new external_value(PARAM_LOCALURL, 'Url to the course competencies page.'),
          ));
  
      }