original_string: public static function list_plan_competencies($id) {
          global $PAGE;
  
          $params = self::validate_parameters(self::list_plan_competencies_parameters(), array('id' => $id));
          $id = $params['id'];
          $plan = api::read_plan($id);
          $usercontext = $plan->get_context();
          self::validate_context($usercontext);
          $output = $PAGE->get_renderer('core');
  
          $result = api::list_plan_competencies($plan);
  
          if ($plan->get('status') == plan::STATUS_COMPLETE) {
              $ucproperty = 'usercompetencyplan';
          } else {
              $ucproperty = 'usercompetency';
          }
  
          $helper = new performance_helper();
          foreach ($result as $key => $r) {
              $context = $helper->get_context_from_competency($r->competency);
              $scale = $helper->get_scale_from_competency($r->competency);
  
              $exporter = new competency_exporter($r->competency, array('context' => $context));
              $r->competency = $exporter->export($output);
  
              if ($r->usercompetency) {
                  $exporter = new user_competency_exporter($r->usercompetency, array('scale' => $scale));
                  $r->usercompetency = $exporter->export($output);
                  unset($r->usercompetencyplan);
              } else {
                  $exporter = new user_competency_plan_exporter($r->usercompetencyplan, array('scale' => $scale));
                  $r->usercompetencyplan = $exporter->export($output);
                  unset($r->usercompetency);
              }
          }
          return $result;
      }
code: public static function list_plan_competencies($id) {
          global $PAGE;
  
          $params = self::validate_parameters(self::list_plan_competencies_parameters(), array('id' => $id));
          $id = $params['id'];
          $plan = api::read_plan($id);
          $usercontext = $plan->get_context();
          self::validate_context($usercontext);
          $output = $PAGE->get_renderer('core');
  
          $result = api::list_plan_competencies($plan);
  
          if ($plan->get('status') == plan::STATUS_COMPLETE) {
              $ucproperty = 'usercompetencyplan';
          } else {
              $ucproperty = 'usercompetency';
          }
  
          $helper = new performance_helper();
          foreach ($result as $key => $r) {
              $context = $helper->get_context_from_competency($r->competency);
              $scale = $helper->get_scale_from_competency($r->competency);
  
              $exporter = new competency_exporter($r->competency, array('context' => $context));
              $r->competency = $exporter->export($output);
  
              if ($r->usercompetency) {
                  $exporter = new user_competency_exporter($r->usercompetency, array('scale' => $scale));
                  $r->usercompetency = $exporter->export($output);
                  unset($r->usercompetencyplan);
              } else {
                  $exporter = new user_competency_plan_exporter($r->usercompetencyplan, array('scale' => $scale));
                  $r->usercompetencyplan = $exporter->export($output);
                  unset($r->usercompetency);
              }
          }
          return $result;
      }
code_tokens: public static function list_plan_competencies ( $ id ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: list_plan_competencies_parameters ( ) , array ( 'id' => $ id ) ) ; $ id = $ params [ 'id' ] ; $ plan = api :: read_plan ( $ id ) ; $ usercontext = $ plan -> get_context ( ) ; self :: validate_context ( $ usercontext ) ; $ output = $ PAGE -> get_renderer ( 'core' ) ; $ result = api :: list_plan_competencies ( $ plan ) ; if ( $ plan -> get ( 'status' ) == plan :: STATUS_COMPLETE ) { $ ucproperty = 'usercompetencyplan' ; } else { $ ucproperty = 'usercompetency' ; } $ helper = new performance_helper ( ) ; foreach ( $ result as $ key => $ r ) { $ context = $ helper -> get_context_from_competency ( $ r -> competency ) ; $ scale = $ helper -> get_scale_from_competency ( $ r -> competency ) ; $ exporter = new competency_exporter ( $ r -> competency , array ( 'context' => $ context ) ) ; $ r -> competency = $ exporter -> export ( $ output ) ; if ( $ r -> usercompetency ) { $ exporter = new user_competency_exporter ( $ r -> usercompetency , array ( 'scale' => $ scale ) ) ; $ r -> usercompetency = $ exporter -> export ( $ output ) ; unset ( $ r -> usercompetencyplan ) ; } else { $ exporter = new user_competency_plan_exporter ( $ r -> usercompetencyplan , array ( 'scale' => $ scale ) ) ; $ r -> usercompetencyplan = $ exporter -> export ( $ output ) ; unset ( $ r -> usercompetency ) ; } } return $ result ; }
docstring: List plan competencies.
  @param  int $id The plan ID.
  @return array
docstring_tokens: List plan competencies .