original_string: public static function list_course_competencies($courseorid) {
          static::require_enabled();
          $course = $courseorid;
          if (!is_object($courseorid)) {
              $course = get_course($courseorid);
          }
  
          // Check the user have access to the course.
          self::validate_course($course);
          $context = context_course::instance($course->id);
  
          $capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:coursecompetencymanage');
          if (!has_any_capability($capabilities, $context)) {
              throw new required_capability_exception($context, 'moodle/competency:coursecompetencyview', 'nopermissions', '');
          }
  
          $result = array();
  
          // TODO We could improve the performance of this into one single query.
          $coursecompetencies = course_competency::list_course_competencies($course->id);
          $competencies = course_competency::list_competencies($course->id);
  
          // Build the return values.
          foreach ($coursecompetencies as $key => $coursecompetency) {
              $result[] = array(
                  'competency' => $competencies[$coursecompetency->get('competencyid')],
                  'coursecompetency' => $coursecompetency
              );
          }
  
          return $result;
      }
code: public static function list_course_competencies($courseorid) {
          static::require_enabled();
          $course = $courseorid;
          if (!is_object($courseorid)) {
              $course = get_course($courseorid);
          }
  
          // Check the user have access to the course.
          self::validate_course($course);
          $context = context_course::instance($course->id);
  
          $capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:coursecompetencymanage');
          if (!has_any_capability($capabilities, $context)) {
              throw new required_capability_exception($context, 'moodle/competency:coursecompetencyview', 'nopermissions', '');
          }
  
          $result = array();
  
          // TODO We could improve the performance of this into one single query.
          $coursecompetencies = course_competency::list_course_competencies($course->id);
          $competencies = course_competency::list_competencies($course->id);
  
          // Build the return values.
          foreach ($coursecompetencies as $key => $coursecompetency) {
              $result[] = array(
                  'competency' => $competencies[$coursecompetency->get('competencyid')],
                  'coursecompetency' => $coursecompetency
              );
          }
  
          return $result;
      }
code_tokens: public static function list_course_competencies ( $ courseorid ) { static :: require_enabled ( ) ; $ course = $ courseorid ; if ( ! is_object ( $ courseorid ) ) { $ course = get_course ( $ courseorid ) ; } // Check the user have access to the course. self :: validate_course ( $ course ) ; $ context = context_course :: instance ( $ course -> id ) ; $ capabilities = array ( 'moodle/competency:coursecompetencyview' , 'moodle/competency:coursecompetencymanage' ) ; if ( ! has_any_capability ( $ capabilities , $ context ) ) { throw new required_capability_exception ( $ context , 'moodle/competency:coursecompetencyview' , 'nopermissions' , '' ) ; } $ result = array ( ) ; // TODO We could improve the performance of this into one single query. $ coursecompetencies = course_competency :: list_course_competencies ( $ course -> id ) ; $ competencies = course_competency :: list_competencies ( $ course -> id ) ; // Build the return values. foreach ( $ coursecompetencies as $ key => $ coursecompetency ) { $ result [ ] = array ( 'competency' => $ competencies [ $ coursecompetency -> get ( 'competencyid' ) ] , 'coursecompetency' => $ coursecompetency ) ; } return $ result ; }
docstring: List the competencies associated to a course.
  
  @param mixed $courseorid The course, or its ID.
  @return array( array(
  'competency' => \core_competency\competency,
  'coursecompetency' => \core_competency\course_competency
  ))
docstring_tokens: List the competencies associated to a course .