original_string: public static function list_course_modules_using_competency($competencyid, $courseid) {
          static::require_enabled();
  
          $result = array();
          self::validate_course($courseid);
  
          $coursecontext = context_course::instance($courseid);
  
          // We will not check each module - course permissions should be enough.
          $capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:coursecompetencymanage');
          if (!has_any_capability($capabilities, $coursecontext)) {
              throw new required_capability_exception($coursecontext, 'moodle/competency:coursecompetencyview', 'nopermissions', '');
          }
  
          $cmlist = course_module_competency::list_course_modules($competencyid, $courseid);
          foreach ($cmlist as $cmid) {
              if (self::validate_course_module($cmid, false)) {
                  array_push($result, $cmid);
              }
          }
  
          return $result;
      }
code: public static function list_course_modules_using_competency($competencyid, $courseid) {
          static::require_enabled();
  
          $result = array();
          self::validate_course($courseid);
  
          $coursecontext = context_course::instance($courseid);
  
          // We will not check each module - course permissions should be enough.
          $capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:coursecompetencymanage');
          if (!has_any_capability($capabilities, $coursecontext)) {
              throw new required_capability_exception($coursecontext, 'moodle/competency:coursecompetencyview', 'nopermissions', '');
          }
  
          $cmlist = course_module_competency::list_course_modules($competencyid, $courseid);
          foreach ($cmlist as $cmid) {
              if (self::validate_course_module($cmid, false)) {
                  array_push($result, $cmid);
              }
          }
  
          return $result;
      }
code_tokens: public static function list_course_modules_using_competency ( $ competencyid , $ courseid ) { static :: require_enabled ( ) ; $ result = array ( ) ; self :: validate_course ( $ courseid ) ; $ coursecontext = context_course :: instance ( $ courseid ) ; // We will not check each module - course permissions should be enough. $ capabilities = array ( 'moodle/competency:coursecompetencyview' , 'moodle/competency:coursecompetencymanage' ) ; if ( ! has_any_capability ( $ capabilities , $ coursecontext ) ) { throw new required_capability_exception ( $ coursecontext , 'moodle/competency:coursecompetencyview' , 'nopermissions' , '' ) ; } $ cmlist = course_module_competency :: list_course_modules ( $ competencyid , $ courseid ) ; foreach ( $ cmlist as $ cmid ) { if ( self :: validate_course_module ( $ cmid , false ) ) { array_push ( $ result , $ cmid ) ; } } return $ result ; }
docstring: List all the courses modules using a competency in a course.
  
  @param int $competencyid The id of the competency to check.
  @param int $courseid The id of the course to check.
  @return array[int] Array of course modules ids.
docstring_tokens: List all the courses modules using a competency in a course .