original_string: protected function onRegister() {
          global $PAGE;
  
          if (empty($this->consumer)) {
              $this->ok = false;
              $this->message = get_string('invalidtoolconsumer', 'enrol_lti');
              return;
          }
  
          if (empty($this->returnUrl)) {
              $this->ok = false;
              $this->message = get_string('returnurlnotset', 'enrol_lti');
              return;
          }
  
          if ($this->doToolProxyService()) {
              // Map tool consumer and published tool, if necessary.
              $this->map_tool_to_consumer();
  
              // Indicate successful processing in message.
              $this->message = get_string('successfulregistration', 'enrol_lti');
  
              // Prepare response.
              $returnurl = new moodle_url($this->returnUrl);
              $returnurl->param('lti_msg', get_string("successfulregistration", "enrol_lti"));
              $returnurl->param('status', 'success');
              $guid = $this->consumer->getKey();
              $returnurl->param('tool_proxy_guid', $guid);
  
              $returnurlout = $returnurl->out(false);
  
              $registration = new registration($returnurlout);
              $output = $PAGE->get_renderer('enrol_lti');
              echo $output->render($registration);
  
          } else {
              // Tell the consumer that the registration failed.
              $this->ok = false;
              $this->message = get_string('couldnotestablishproxy', 'enrol_lti');
          }
      }
code: protected function onRegister() {
          global $PAGE;
  
          if (empty($this->consumer)) {
              $this->ok = false;
              $this->message = get_string('invalidtoolconsumer', 'enrol_lti');
              return;
          }
  
          if (empty($this->returnUrl)) {
              $this->ok = false;
              $this->message = get_string('returnurlnotset', 'enrol_lti');
              return;
          }
  
          if ($this->doToolProxyService()) {
              // Map tool consumer and published tool, if necessary.
              $this->map_tool_to_consumer();
  
              // Indicate successful processing in message.
              $this->message = get_string('successfulregistration', 'enrol_lti');
  
              // Prepare response.
              $returnurl = new moodle_url($this->returnUrl);
              $returnurl->param('lti_msg', get_string("successfulregistration", "enrol_lti"));
              $returnurl->param('status', 'success');
              $guid = $this->consumer->getKey();
              $returnurl->param('tool_proxy_guid', $guid);
  
              $returnurlout = $returnurl->out(false);
  
              $registration = new registration($returnurlout);
              $output = $PAGE->get_renderer('enrol_lti');
              echo $output->render($registration);
  
          } else {
              // Tell the consumer that the registration failed.
              $this->ok = false;
              $this->message = get_string('couldnotestablishproxy', 'enrol_lti');
          }
      }
code_tokens: protected function onRegister ( ) { global $ PAGE ; if ( empty ( $ this -> consumer ) ) { $ this -> ok = false ; $ this -> message = get_string ( 'invalidtoolconsumer' , 'enrol_lti' ) ; return ; } if ( empty ( $ this -> returnUrl ) ) { $ this -> ok = false ; $ this -> message = get_string ( 'returnurlnotset' , 'enrol_lti' ) ; return ; } if ( $ this -> doToolProxyService ( ) ) { // Map tool consumer and published tool, if necessary. $ this -> map_tool_to_consumer ( ) ; // Indicate successful processing in message. $ this -> message = get_string ( 'successfulregistration' , 'enrol_lti' ) ; // Prepare response. $ returnurl = new moodle_url ( $ this -> returnUrl ) ; $ returnurl -> param ( 'lti_msg' , get_string ( "successfulregistration" , "enrol_lti" ) ) ; $ returnurl -> param ( 'status' , 'success' ) ; $ guid = $ this -> consumer -> getKey ( ) ; $ returnurl -> param ( 'tool_proxy_guid' , $ guid ) ; $ returnurlout = $ returnurl -> out ( false ) ; $ registration = new registration ( $ returnurlout ) ; $ output = $ PAGE -> get_renderer ( 'enrol_lti' ) ; echo $ output -> render ( $ registration ) ; } else { // Tell the consumer that the registration failed. $ this -> ok = false ; $ this -> message = get_string ( 'couldnotestablishproxy' , 'enrol_lti' ) ; } }
docstring: Override onRegister with registration code.
docstring_tokens: Override onRegister with registration code .