original_string: public function send_intent() {
          global $CFG, $DB;
          require_once($CFG->dirroot . '/mnet/xmlrpc/client.php');
          $client = new mnet_xmlrpc_client();
          $client->set_method('portfolio/mahara/lib.php/send_content_intent');
          $client->add_param($this->get('user')->username);
          $this->ensure_mnethost();
          if (!$client->send($this->mnethost)) {
              foreach ($client->error as $errormessage) {
                  list($code, $message) = array_map('trim',explode(':', $errormessage, 2));
                  $message .= "ERROR $code:<br/>$errormessage<br/>";
              }
              throw new portfolio_export_exception($this->get('exporter'), 'failedtoping', 'portfolio_mahara', '', $message);
          }
          // we should get back... the send type and a shared token
          $response = (object)$client->response;
          if (empty($response->sendtype) || empty($response->token)) {
              throw new portfolio_export_exception($this->get('exporter'), 'senddisallowed', 'portfolio_mahara');
          }
          switch ($response->sendtype) {
              case 'immediate':
                  $this->sendtype = PORTFOLIO_MAHARA_IMMEDIATE;
                  break;
              case 'queue':
                  $this->sendtype = PORTFOLIO_MAHARA_QUEUE;
                  break;
              case 'none':
              default:
                  throw new portfolio_export_exception($this->get('exporter'), 'senddisallowed', 'portfolio_mahara');
          }
          $this->token = $response->token;
          $this->get('exporter')->save();
          // put the entry in the mahara queue table now too
          $q = new stdClass;
          $q->token = $this->token;
          $q->transferid = $this->get('exporter')->get('id');
          $DB->insert_record('portfolio_mahara_queue', $q);
      }
code: public function send_intent() {
          global $CFG, $DB;
          require_once($CFG->dirroot . '/mnet/xmlrpc/client.php');
          $client = new mnet_xmlrpc_client();
          $client->set_method('portfolio/mahara/lib.php/send_content_intent');
          $client->add_param($this->get('user')->username);
          $this->ensure_mnethost();
          if (!$client->send($this->mnethost)) {
              foreach ($client->error as $errormessage) {
                  list($code, $message) = array_map('trim',explode(':', $errormessage, 2));
                  $message .= "ERROR $code:<br/>$errormessage<br/>";
              }
              throw new portfolio_export_exception($this->get('exporter'), 'failedtoping', 'portfolio_mahara', '', $message);
          }
          // we should get back... the send type and a shared token
          $response = (object)$client->response;
          if (empty($response->sendtype) || empty($response->token)) {
              throw new portfolio_export_exception($this->get('exporter'), 'senddisallowed', 'portfolio_mahara');
          }
          switch ($response->sendtype) {
              case 'immediate':
                  $this->sendtype = PORTFOLIO_MAHARA_IMMEDIATE;
                  break;
              case 'queue':
                  $this->sendtype = PORTFOLIO_MAHARA_QUEUE;
                  break;
              case 'none':
              default:
                  throw new portfolio_export_exception($this->get('exporter'), 'senddisallowed', 'portfolio_mahara');
          }
          $this->token = $response->token;
          $this->get('exporter')->save();
          // put the entry in the mahara queue table now too
          $q = new stdClass;
          $q->token = $this->token;
          $q->transferid = $this->get('exporter')->get('id');
          $DB->insert_record('portfolio_mahara_queue', $q);
      }
code_tokens: public function send_intent ( ) { global $ CFG , $ DB ; require_once ( $ CFG -> dirroot . '/mnet/xmlrpc/client.php' ) ; $ client = new mnet_xmlrpc_client ( ) ; $ client -> set_method ( 'portfolio/mahara/lib.php/send_content_intent' ) ; $ client -> add_param ( $ this -> get ( 'user' ) -> username ) ; $ this -> ensure_mnethost ( ) ; if ( ! $ client -> send ( $ this -> mnethost ) ) { foreach ( $ client -> error as $ errormessage ) { list ( $ code , $ message ) = array_map ( 'trim' , explode ( ':' , $ errormessage , 2 ) ) ; $ message .= "ERROR $code:<br/>$errormessage<br/>" ; } throw new portfolio_export_exception ( $ this -> get ( 'exporter' ) , 'failedtoping' , 'portfolio_mahara' , '' , $ message ) ; } // we should get back... the send type and a shared token $ response = ( object ) $ client -> response ; if ( empty ( $ response -> sendtype ) || empty ( $ response -> token ) ) { throw new portfolio_export_exception ( $ this -> get ( 'exporter' ) , 'senddisallowed' , 'portfolio_mahara' ) ; } switch ( $ response -> sendtype ) { case 'immediate' : $ this -> sendtype = PORTFOLIO_MAHARA_IMMEDIATE ; break ; case 'queue' : $ this -> sendtype = PORTFOLIO_MAHARA_QUEUE ; break ; case 'none' : default : throw new portfolio_export_exception ( $ this -> get ( 'exporter' ) , 'senddisallowed' , 'portfolio_mahara' ) ; } $ this -> token = $ response -> token ; $ this -> get ( 'exporter' ) -> save ( ) ; // put the entry in the mahara queue table now too $ q = new stdClass ; $ q -> token = $ this -> token ; $ q -> transferid = $ this -> get ( 'exporter' ) -> get ( 'id' ) ; $ DB -> insert_record ( 'portfolio_mahara_queue' , $ q ) ; }
docstring: sends the 'content_intent' ping to mahara
  if all goes well, this will set the 'token' and 'sendtype' member variables.
docstring_tokens: sends the content_intent ping to mahara if all goes well this will set the token and sendtype member variables .