original_string: public static function get_tool_launch_data($toolid) {
          global $DB, $CFG;
          require_once($CFG->dirroot . '/mod/lti/lib.php');
  
          $params = self::validate_parameters(self::get_tool_launch_data_parameters(),
                                              array(
                                                  'toolid' => $toolid
                                              ));
          $warnings = array();
  
          // Request and permission validation.
          $lti = $DB->get_record('lti', array('id' => $params['toolid']), '*', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($lti, 'lti');
  
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          require_capability('mod/lti:view', $context);
  
          $lti->cmid = $cm->id;
          list($endpoint, $parms) = lti_get_launch_data($lti);
  
          $parameters = array();
          foreach ($parms as $name => $value) {
              $parameters[] = array(
                  'name' => $name,
                  'value' => $value
              );
          }
  
          $result = array();
          $result['endpoint'] = $endpoint;
          $result['parameters'] = $parameters;
          $result['warnings'] = $warnings;
          return $result;
      }
code: public static function get_tool_launch_data($toolid) {
          global $DB, $CFG;
          require_once($CFG->dirroot . '/mod/lti/lib.php');
  
          $params = self::validate_parameters(self::get_tool_launch_data_parameters(),
                                              array(
                                                  'toolid' => $toolid
                                              ));
          $warnings = array();
  
          // Request and permission validation.
          $lti = $DB->get_record('lti', array('id' => $params['toolid']), '*', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($lti, 'lti');
  
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          require_capability('mod/lti:view', $context);
  
          $lti->cmid = $cm->id;
          list($endpoint, $parms) = lti_get_launch_data($lti);
  
          $parameters = array();
          foreach ($parms as $name => $value) {
              $parameters[] = array(
                  'name' => $name,
                  'value' => $value
              );
          }
  
          $result = array();
          $result['endpoint'] = $endpoint;
          $result['parameters'] = $parameters;
          $result['warnings'] = $warnings;
          return $result;
      }
code_tokens: public static function get_tool_launch_data ( $ toolid ) { global $ DB , $ CFG ; require_once ( $ CFG -> dirroot . '/mod/lti/lib.php' ) ; $ params = self :: validate_parameters ( self :: get_tool_launch_data_parameters ( ) , array ( 'toolid' => $ toolid ) ) ; $ warnings = array ( ) ; // Request and permission validation. $ lti = $ DB -> get_record ( 'lti' , array ( 'id' => $ params [ 'toolid' ] ) , '*' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ lti , 'lti' ) ; $ context = context_module :: instance ( $ cm -> id ) ; self :: validate_context ( $ context ) ; require_capability ( 'mod/lti:view' , $ context ) ; $ lti -> cmid = $ cm -> id ; list ( $ endpoint , $ parms ) = lti_get_launch_data ( $ lti ) ; $ parameters = array ( ) ; foreach ( $ parms as $ name => $ value ) { $ parameters [ ] = array ( 'name' => $ name , 'value' => $ value ) ; } $ result = array ( ) ; $ result [ 'endpoint' ] = $ endpoint ; $ result [ 'parameters' ] = $ parameters ; $ result [ 'warnings' ] = $ warnings ; return $ result ; }
docstring: Return the launch data for a given external tool.
  
  @param int $toolid the external tool instance id
  @return array of warnings and launch data
  @since Moodle 3.0
  @throws moodle_exception
docstring_tokens: Return the launch data for a given external tool .